netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ruslan Bilovol <ruslan.bilovol@gmail.com>
To: oneukum@suse.de
Cc: netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] net: usb: allow MTU that is a multiple of USB packet size
Date: Thu,  7 May 2015 12:49:18 +0300	[thread overview]
Message-ID: <1430992159-27783-1-git-send-email-ruslan.bilovol@gmail.com> (raw)

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

             reply	other threads:[~2015-05-07  9:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-07  9:49 Ruslan Bilovol [this message]
2015-05-07 10:11 ` [PATCH] net: usb: allow MTU that is a multiple of USB packet size 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430992159-27783-1-git-send-email-ruslan.bilovol@gmail.com \
    --to=ruslan.bilovol@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oneukum@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).