[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#820622: linux-image-4.5.0-trunk-armmp-lpae: raspberry pi 2: smsc95xx 1-1.1:1.0 eth0: kevent 2 may have been dropped



On Thu, 2016-04-28 at 17:30 +0200, Diederik de Haas wrote:
> On Thursday 28 April 2016 17:12:27 Ben Hutchings wrote:
> > 
> > Could you test with turbo_mode re-enabled and with this patch applied?
> Which patch? (or do I need more coffee?)
> I did find a commit in git which may be related, but I didn't see a direct 
> reference to this issue.
> https://anonscm.debian.org/cgit/kernel/linux.git/commit/?h=sid&id=76d0845dce198a77d063aac386886c0bc8c3330b

D'oh.  Here it is.

Ben.

-- 
Ben Hutchings
All extremists should be taken out and shot.
From 01983960918ad1e491dce39fbfd75d4f603ca3d6 Mon Sep 17 00:00:00 2001
From: Ben Hutchings <ben@decadent.org.uk>
Date: Thu, 28 Apr 2016 16:44:43 +0200
Subject: [PATCH] smsc95xx: Limit RX burst size to order-1 to avoid allocation
 failures

The smsc95xx driver enables RX burst mode or 'turbo mode' by default,
in which the hardware packs multiple packets into a single URB of size
~17 K (order-3, assuming 4 K pages).  The Raspberry Pi boards use this
driver and have as little as 512 MiB RAM, so when they have been
running for a while heavy network traffic tends to result in
allocation failures.

Currently the Raspbian distribution works around this by disabling
turbo mode by default, at the cost of network performance.  But we
should be able to get some benefit from burst mode without using
such large buffers.  Limit the burst size to 2 pages, i.e. order-1.

References: https://bugs.debian.org/820622
Reported-by: Vagrant Cascadian <vagrant@debian.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/usb/smsc95xx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 66b3ab9f614e..56d16b9568eb 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -35,8 +35,12 @@
 #define SMSC_DRIVER_VERSION		"1.0.4"
 #define HS_USB_PKT_SIZE			(512)
 #define FS_USB_PKT_SIZE			(64)
-#define DEFAULT_HS_BURST_CAP_SIZE	(16 * 1024 + 5 * HS_USB_PKT_SIZE)
-#define DEFAULT_FS_BURST_CAP_SIZE	(6 * 1024 + 33 * FS_USB_PKT_SIZE)
+/* Maximum URB size to limit risk of allocation failures */
+#define MAX_URB_SIZE			SKB_MAX_ORDER(NET_IP_ALIGN, 1)
+#define DEFAULT_HS_BURST_CAP_SIZE					\
+	min_t(size_t, 16 * 1024 + 5 * HS_USB_PKT_SIZE, MAX_URB_SIZE)
+#define DEFAULT_FS_BURST_CAP_SIZE					\
+	min_t(size_t, 6 * 1024 + 33 * FS_USB_PKT_SIZE, MAX_URB_SIZE)
 #define DEFAULT_BULK_IN_DELAY		(0x00002000)
 #define MAX_SINGLE_PACKET_SIZE		(2048)
 #define LAN95XX_EEPROM_MAGIC		(0x9500)

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: