Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754921AbbLKKre (ORCPT ); Fri, 11 Dec 2015 05:47:34 -0500 Received: from mx18-05.smtp.antispamcloud.com ([207.244.64.174]:35659 "EHLO mx18-05.smtp.antispamcloud.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752326AbbLKKrb convert rfc822-to-8bit (ORCPT ); Fri, 11 Dec 2015 05:47:31 -0500 Subject: Re: [PATCH v2] usb: gadget: ether: Allow changing the MTU To: References: <1448882303-6658-1-git-send-email-mike.looijmans@topic.nl> CC: , , From: Mike Looijmans Organization: TOPIC Message-ID: <566AA9B6.3010108@topic.nl> Date: Fri, 11 Dec 2015 11:47:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1448882303-6658-1-git-send-email-mike.looijmans@topic.nl> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8BIT X-Originating-IP: [192.168.80.121] X-EXCLAIMER-MD-CONFIG: 9833cda7-5b21-4d34-9a38-8d025ddc3664 X-EXCLAIMER-MD-BIFURCATION-INSTANCE: 0 X-Filter-ID: s0sct1PQhAABKnZB5plbIbbvfIHzQjPVmPLZeVYSu3xU9luQrU+8/8qthi+0Jd/W6KAUC/fjyuDn NXFr4uarw5ms6RcG0elW3+jLiGkKPpIgcjLqQ3aq96lEwIowfhW6+JYCiHrg87mney9o8EMzC6M7 Sk++9VtgJ3jn62C2a8KJ0yWEKej9CxhpOWHLLCQZaihYce6MB7vRCVGd0unk+RRAGebS4LcXoeFu Nz0aNYNFr38NRjBcr+gK5nycAjpZFa9O0JIXxEjII4IVmXGIObRH/unnP3ey7Ydj+BYVBxs+i16o S2NiiB6lZAls651BPAlbDjazCbhs7qBpykynMqDbIWxfylChKSlutXO9bUccLM6B+z2b4r9zX2/k O53mpVvJPE1MmMbWnND3aBlJcSgJZp+EGNF2ucOZkdt/1pkQJLQH3TOAUZb2jICpdaUeSqOtnEfH HnAuBaECBvsDx1uDQEdKm65cTUbfWaDAny6GscLLf7qnPd4q6R7xOaSRxcShVE6Xv35PSLL+4xLx zxtnh67vwc34ME4psYWcv56kRZLM/aEzUid+EfFga8x2CVx9HplrMp5f0UUMTCgkyZnckpWaLvah yBjmQxBKOztPDYi8MNt5tPuFyvtlAUUDoGz7/zF7Pl96LhadMlFwSTyaA52M9P1jIz5CuAEDGU9d c/8+FpxKAvAtd3FgAVpYorT8WeuxpmDPzzymjzSOouidX4Ts4xdG+C13IyWeZaJXwxwwzVbqUbnj CIf9mPoWsT3iUdHsesIbRrh8BR7fONaYkbirGLWCEaHYmk4DRs7e3rIaEwnRDlDLxQKAI/FB X-Report-Abuse-To: spam@mx99.antispamcloud.com X-Filter-Fingerprint: IFrWXGses7OKB5S5G8/dJUb3OPwsHaH0Fvg5oXltHd/JUWjZ8+qhjyB23tbDuyLOYL8Ff78gYsez 4Rl08xudmXi4esCQ0R1MchVjt7wblGlvhFgW0MjUMRkF5sMCDfftTXNFDzN17hnrWeZYOJvLq0Ic WjZ+XcEjj/7Pkld0zkmvziDInX9WdMov2kn2yXjdwv61T+KDYyYtREgszdyFwv8IxCB3p/oCKvxr eyISh3JGb7OS5oVgiO+kDxZrVPLz3MmEGC2PrUKqLq5WmHK+Nw== X-Originating-IP: 88.159.208.100 X-Spampanel-Domain: topic.nl X-Spampanel-Username: 88.159.208.100 Authentication-Results: antispamcloud.com; auth=pass smtp.auth=88.159.208.100@topic.nl X-Spampanel-Outgoing-Class: ham X-Spampanel-Outgoing-Evidence: SB/global_tokens (0.00763203145293) X-Recommended-Action: accept Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2829 Lines: 84 Just a "ping" reminder, I'd like to inquire about the status of this patch... On 30-11-15 12:18, Mike Looijmans wrote: > The gadget ethernet driver supports changing the MTU, but only allows this > when the USB cable is removed. The comment indicates that this is because > the "peer won't know". Even if the network link is still down and only the > USB link is established, the driver won't allow the change. > > Other network interfaces allow changing the MTU any time, and don't force > the link to be disabled. This makes perfect sense, because in order to be > able to negotiate the MTU, the link needs to be up. > > Remove the restriction so that it is now actually possible to change the > MTU (e.g. using "ifconfig usb0 mtu 15000") without having to manually pull > the plug or change the driver's default setting. > > This is especially important after commit bba787a860fa > ("usb: gadget: ether: Allow jumbo frames") > > Signed-off-by: Mike Looijmans > --- > v2: Fix commit reference (checkpatch) and unused variable 'dev' (kbuild test robot) > > drivers/usb/gadget/function/u_ether.c | 18 ++++-------------- > 1 file changed, 4 insertions(+), 14 deletions(-) > > diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c > index 6554322..637809e 100644 > --- a/drivers/usb/gadget/function/u_ether.c > +++ b/drivers/usb/gadget/function/u_ether.c > @@ -143,21 +143,11 @@ static inline int qlen(struct usb_gadget *gadget, unsigned qmult) > > static int ueth_change_mtu(struct net_device *net, int new_mtu) > { > - struct eth_dev *dev = netdev_priv(net); > - unsigned long flags; > - int status = 0; > + if (new_mtu <= ETH_HLEN || new_mtu > GETHER_MAX_ETH_FRAME_LEN) > + return -ERANGE; > + net->mtu = new_mtu; > > - /* don't change MTU on "live" link (peer won't know) */ > - spin_lock_irqsave(&dev->lock, flags); > - if (dev->port_usb) > - status = -EBUSY; > - else if (new_mtu <= ETH_HLEN || new_mtu > GETHER_MAX_ETH_FRAME_LEN) > - status = -ERANGE; > - else > - net->mtu = new_mtu; > - spin_unlock_irqrestore(&dev->lock, flags); > - > - return status; > + return 0; > } > > static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p) > Kind regards, Mike Looijmans System Expert TOPIC Embedded Products Eindhovenseweg 32-C, NL-5683 KH Best Postbus 440, NL-5680 AK Best Telefoon: +31 (0) 499 33 69 79 Telefax: +31 (0) 499 33 69 70 E-mail: mike.looijmans@topicproducts.com Website: www.topicproducts.com Please consider the environment before printing this e-mail -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/