Skip to content

Commit 3de3518

Browse files
jemelepopcornmix
authored andcommitted
lan78xx: Debounce link events to minimize poll storm
The bInterval is set to 4 (i.e. 8 microframes => 1ms) and the only bit that the driver pays attention to is "link was reset". If there's a flapping status bit in that endpoint data, (such as if PHY negotiation needs a few tries to get a stable link) then polling at a slower rate would act as a de-bounce. See: #2447
1 parent e8b1d25 commit 3de3518

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/net/usb/lan78xx.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,11 @@ static bool enable_tso;
609609
module_param(enable_tso, bool, 0644);
610610
MODULE_PARM_DESC(enable_tso, "Enables TCP segmentation offload");
611611

612+
#define INT_URB_MICROFRAMES_PER_MS 8
613+
static int int_urb_interval_ms = 8;
614+
module_param(int_urb_interval_ms, int, 0);
615+
MODULE_PARM_DESC(int_urb_interval_ms, "Override usb interrupt urb interval");
616+
612617
static int lan78xx_read_reg(struct lan78xx_net *dev, u32 index, u32 *data)
613618
{
614619
u32 *buf;
@@ -4542,7 +4547,13 @@ static int lan78xx_probe(struct usb_interface *intf,
45424547
if (ret < 0)
45434548
goto out4;
45444549

4545-
period = ep_intr->desc.bInterval;
4550+
if (int_urb_interval_ms <= 0)
4551+
period = ep_intr->desc.bInterval;
4552+
else
4553+
period = int_urb_interval_ms * INT_URB_MICROFRAMES_PER_MS;
4554+
4555+
netif_notice(dev, probe, netdev, "int urb period %d\n", period);
4556+
45464557
maxp = usb_maxpacket(dev->udev, dev->pipe_intr);
45474558

45484559
dev->urb_intr = usb_alloc_urb(0, GFP_KERNEL);

0 commit comments

Comments
 (0)