netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: usb: allow MTU that is a multiple of USB packet size
@ 2015-05-07  9:49 Ruslan Bilovol
  2015-05-07 10:11 ` Oliver Neukum
  2015-05-07 13:24 ` Sergei Shtylyov
  0 siblings, 2 replies; 6+ messages in thread
From: Ruslan Bilovol @ 2015-05-07  9:49 UTC (permalink / raw)
  To: oneukum; +Cc: netdev, linux-usb, linux-kernel

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@gmail.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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-05-07 16:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-07  9:49 [PATCH] net: usb: allow MTU that is a multiple of USB packet size Ruslan Bilovol
2015-05-07 10:11 ` Oliver Neukum
     [not found]   ` <1430993477.30151.6.camel-l3A5Bk7waGM@public.gmane.org>
2015-05-07 10:51     ` Ruslan Bilovol
2015-05-07 11:07       ` Oliver Neukum
2015-05-07 16:19   ` David Laight
2015-05-07 13:24 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).