[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1430992159-27783-1-git-send-email-ruslan.bilovol@gmail.com>
Date: Thu, 7 May 2015 12:49:18 +0300
From: Ruslan Bilovol <ruslan.bilovol@...il.com>
To: oneukum@...e.de
Cc: netdev@...r.kernel.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] net: usb: allow MTU that is a multiple of USB packet size
Current usbnet driver rejects setting MTU that is a multiple
of USB endpoint's wMaxPacketSize size. However, it may only
lead to possible performance degradation but is not so
critical that its using should be prohibited. So allow it
but also warn user about possible issue.
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@...il.com>
---
drivers/net/usb/usbnet.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 733f4fe..09dc848 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -382,9 +382,11 @@ int usbnet_change_mtu (struct net_device *net, int new_mtu)
if (new_mtu <= 0)
return -EINVAL;
- // no second zero-length packet read wanted after mtu-sized packets
+ /* warn about second zero-length packet read after mtu-sized packets */
if ((ll_mtu % dev->maxpacket) == 0)
- return -EDOM;
+ netdev_warn(dev->net, "MTU %d is a multiple of USB wMaxPacketSize (%d),"
+ " consider possible performance degradation\n",
+ ll_mtu, dev->maxpacket);
net->mtu = new_mtu;
dev->hard_mtu = net->mtu + net->hard_header_len;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists