From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752874AbdESOqo (ORCPT ); Fri, 19 May 2017 10:46:44 -0400 Received: from smtp-out6.electric.net ([192.162.217.189]:65407 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750746AbdESOqm (ORCPT ); Fri, 19 May 2017 10:46:42 -0400 From: David Laight To: =?utf-8?B?J0Jqw7hybiBNb3JrJw==?= CC: "'Jim Baxter'" , "linux-usb@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Oliver Neukum Subject: RE: [RFC V1 1/1] net: cdc_ncm: Reduce memory use when kernel memory low Thread-Topic: [RFC V1 1/1] net: cdc_ncm: Reduce memory use when kernel memory low Thread-Index: AQHS0KeifdEf3ZnqxEOQuresTzkisqH7ueAw Date: Fri, 19 May 2017 14:46:34 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6DCFFFAC2B@AcuExch.aculab.com> References: <1494956480-6127-1-git-send-email-jim_baxter@mentor.com> <1494956480-6127-2-git-send-email-jim_baxter@mentor.com> <063D6719AE5E284EB5DD2968C1650D6DCFFFAA5C@AcuExch.aculab.com> <87pof5rlw4.fsf@miraculix.mork.no> In-Reply-To: <87pof5rlw4.fsf@miraculix.mork.no> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-Outbound-IP: 156.67.243.126 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuExch.aculab.com X-TLS: TLSv1:AES128-SHA:128 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v4JEkmfv018497 From: Bjørn Mork > Sent: 19 May 2017 14:56 ... > Unless someone has a nice way to just collect a list of skbs and have > them converted to proper framing on the fly when transmitting, without > having to care about USB packet boundaries. skb can be linked into arbitrary chains (or even trees), but I suspect the usbnet code would need to be taught about them. For XHCI it isn't too bad because it will do arbitrary scatter-gather (apart from the ring end). But I believe the earlier controllers only support fragments that end on usb packet boundaries. I looked at the usbnet code a few years ago, I'm sure it ought to be possible to shortcut most of the code that uses URB and directly write to the xhci (in particular) ring descriptors. For receive you probably want to feed the USB stack multiple (probably) 2k buffers, and handle the debatching into ethernet frames yourself. One of the ASIX drivers used to be particularly bad, it allocated 64k skb for receive (the hardware can merge IP packets) and then hacked the true_size before passing upstream. David