From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755341AbbICOYB (ORCPT ); Thu, 3 Sep 2015 10:24:01 -0400 Received: from mx6-14.smtp.antispamcloud.com ([95.211.2.226]:59331 "EHLO mx6-14.smtp.antispamcloud.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753284AbbICOX6 convert rfc822-to-8bit (ORCPT ); Thu, 3 Sep 2015 10:23:58 -0400 X-Greylist: delayed 17256 seconds by postgrey-1.27 at vger.kernel.org; Thu, 03 Sep 2015 10:23:58 EDT Message-ID: <55E8148F.20004@topic.nl> Date: Thu, 3 Sep 2015 11:36:15 +0200 From: Mike Looijmans Organization: TOPIC User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: , CC: , Subject: Re: [PATCH] usb/gadget/function/u_ether.c: Allow jumbo frames References: <1438757695-4719-1-git-send-email-mike.looijmans@topic.nl> In-Reply-To: <1438757695-4719-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 NXFr4uarw4L+0Gk8Er9EDAmooWNG6NUXhYU8Jrr8yzFMFofcPkGGfd6n87fj8KT35QxdxwfjRBdS xobDJnniA8Rvq4/xR+lYGxLcRm31r7HJL906rtNSToWMsbWVpbcgPjHh2sOCfMLUlvhe7OdxptK8 fykXLft155pEfzBoXYZqk36IjWftFa9O0JIXxEjII4IVmXGIOfzDteYZI6hDCMNKlJUbGeT3T77Z Wh80YBUPFvns5Kt7PAlbDjazCbhs7qBpykynMqDbIWxfylChKSlutXO9bUccLM6B+z2b4r9zX2/k O53mpVvJPE1MmMbWnND3aBlJcSgJZp+EGNF2ucOZkdt/1pkQJLQH3TOAUZb2jICpdaUeSqOtnEfH HnAuBaECBvsDx1uDQEdKm65cTUbfWaDAny6GscLLf7qnPd4q6R7xOaSRxcShVE6Xv35PSLL+4xLx zxtnh67vwc34ME4psYWcv56kRZLM/aEzUid+EfFga8x2CVx9HplrMp5f0UUMTCgkyZnckpWaLvah yBjmQxBKOztPDYi8MNt5tPuFyvtlAUUDoGz7/zF7Pl96LhadMlFwSTyaA52M9P1jIz5CuAEDGU8s HZvhvjrkwWutyN8MB1pAEKbgVi8fiAIfjOCPsIrfBZs9zSZic0xNU+sMoNUh1wteJze/hsKQqfFw mUA5avNur7/R9G2II98pRHcrpC2sXzICad/K9AjU1vqsvCdgPGWb4yg+N8hOv41p0OJQOxS/ X-Report-Abuse-To: spam@mx99.antispamcloud.com X-Filter-Fingerprint: IFrWXGses7OKB5S5G8/dJXhXyDRoOQM5J3kcUr0HrMvJUWjZ8+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.00926148578781) X-Recommended-Action: accept Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'd like to bring this to your attention again please. If there is something wrong about this patch, please tell me so. And also note that this patch does not enable jumbo frames on itself, it just removes the artificial limits in the kernel prohibiting mtus above 1500. The MTU can be set from user space, and the impact on performance is quite impressive. On 05-08-15 08:54, Mike Looijmans wrote: > USB network adapters support Jumbo frames. The only thing blocking > that feature is the code in the gadget driver that disposes of > packets larger than 1518 bytes, and the limit on the ioctl to set > the mtu. > > This patch relaxes these limits, and allows up to 15k frames sizes. > The 15k value was chosen because 16k does not work on all platforms, > and usingclose to 16k will result in allocating 5 or 8 4k pages to > store the skb, wasting pages at no measurable performance gain. > > On a topic-miami board (Zynq-7000), iperf3 performance reports: > MTU= 1500, PC-to-gadget: 139 Mbps, Gadget-to-PC: 116 Mbps > MTU=15000, PC-to-gadget: 239 Mbps, Gadget-to-PC: 361 Mbps > > On boards with slower CPUs the performance improvement will be > relatively much larger, e.g. an OMAP-L138 increased from 40 to > 220 Mbps using a similar patch on an 2.6.37 kernel. > > Signed-off-by: Mike Looijmans > --- > drivers/usb/gadget/function/u_ether.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c > index f1fd777..6828ea2 100644 > --- a/drivers/usb/gadget/function/u_ether.c > +++ b/drivers/usb/gadget/function/u_ether.c > @@ -48,6 +48,11 @@ > > #define UETH__VERSION "29-May-2008" > > +/* Experiments show that both Linux and Windows hosts allow up to 16k > + * frame sizes. Set the max size to 15k+52 to prevent allocating 32k > + * blocks and still have efficient handling. */ > +#define GETHER_MAX_ETH_FRAME_LEN 15412 > + > struct eth_dev { > /* lock is held while accessing port_usb > */ > @@ -146,7 +151,7 @@ static int ueth_change_mtu(struct net_device *net, int new_mtu) > spin_lock_irqsave(&dev->lock, flags); > if (dev->port_usb) > status = -EBUSY; > - else if (new_mtu <= ETH_HLEN || new_mtu > ETH_FRAME_LEN) > + else if (new_mtu <= ETH_HLEN || new_mtu > GETHER_MAX_ETH_FRAME_LEN) > status = -ERANGE; > else > net->mtu = new_mtu; > @@ -294,7 +299,7 @@ static void rx_complete(struct usb_ep *ep, struct usb_request *req) > while (skb2) { > if (status < 0 > || ETH_HLEN > skb2->len > - || skb2->len > VLAN_ETH_FRAME_LEN) { > + || skb2->len > GETHER_MAX_ETH_FRAME_LEN) { > dev->net->stats.rx_errors++; > dev->net->stats.rx_length_errors++; > DBG(dev, "rx length %d\n", skb2->len); > 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