All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bjørn Mork" <bjorn@mork.no>
To: Oliver Neukum <oneukum@suse.de>
Cc: alexey.orishko@stericsson.com, netdev@vger.kernel.org,
	linux-usb@vger.kernel.org
Subject: Re: changing usbnet's API to better deal with cdc-ncm
Date: Thu, 06 Sep 2012 10:17:46 +0200	[thread overview]
Message-ID: <87ehmf36qd.fsf@nemi.mork.no> (raw)
In-Reply-To: <2791550.LhGu6po6Xy@linux-lqwf.site> (Oliver Neukum's message of "Wed, 05 Sep 2012 22:12:54 +0200")

Oliver Neukum <oneukum@suse.de> writes:

> looking at cdc-ncm it seeems to me that cdc-ncm is forced to play
> very dirty games because usbnet doesn't have a notion about aggregating
> packets for a single transfer.
>
> It seems to me that this can be fixed introducing a method for bundling,
> which tells usbnet how packets have been aggregated. To have performance
> usbnet strives to always keep at least two transfers in flight.
>
> The code isn't complete and I need to get a device for testing, but to get
> your opinion, I ask you to comment on what I have now.

I haven't tested this on any device either, but it looks like the right
direction to me.  Note that there are several other existing minidrivers
which could take advantage of this code. A quick look found that both
sierra_net and rndis_host have some unbundling support in their
rx_fixups, but both ignore tx bundling. rndis_host has the following
explanation in tx_fixup:

        /* fill out the RNDIS header.  we won't bother trying to batch
         * packets; Linux minimizes wasted bandwidth through tx queues.
         */

Although that may be true for the host, I am not sure it will be true
for every device?


> @@ -874,71 +840,37 @@ cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb)
>  	/* return skb */
>  	ctx->tx_curr_skb = NULL;
>  	ctx->netdev->stats.tx_packets += ctx->tx_curr_frame_num;


Maybe all the statistics could be moved back to usbnet now that it will
see all packets again?


> index f87cf62..bb2f622 100644
> --- a/include/linux/usb/usbnet.h
> +++ b/include/linux/usb/usbnet.h
> @@ -33,6 +33,7 @@ struct usbnet {
>  	wait_queue_head_t	*wait;
>  	struct mutex		phy_mutex;
>  	unsigned char		suspend_count;
> +	atomic_t		tx_in_flight;
>  
>  	/* i/o info: pipes etc */
>  	unsigned		in, out;


So you don't keep any timer here?  The idea is that you always will
transmit immediately unless there are two transmit's in flight?  I
believe that is a change which has to be tested against real devices.
They may be optimized for receiving bundles.


Not really related, but I am still worrying how MBIM is going to fit
into the usbnet model where you have a strict relation between one
netdev and one USB interface.  Do you see any way usbnet could be
extended to manage a list of netdevs?

All the netdev related functions doing

	struct usbnet		*dev = netdev_priv(net);

would still work.  But all the USB related functions using dev->net to
get _the_ netdev would fail.  Maybe this will be too difficult to
implement within the usbnet framework at all?


Bjørn

  parent reply	other threads:[~2012-09-06  8:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-05 20:12 changing usbnet's API to better deal with cdc-ncm Oliver Neukum
     [not found] ` <2791550.LhGu6po6Xy-ugxBuEnWX9yG/4A2pS7c2Q@public.gmane.org>
2012-09-06  3:23   ` Ming Lei
     [not found]     ` <CACVXFVMXz1mqANBYR56KZsh3RgN5M_og_OggDEHT02w0Pe-UiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-06  8:30       ` Bjørn Mork
     [not found]         ` <87a9x33656.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2012-09-06 16:09           ` Ming Lei
2012-09-06 17:56             ` Oliver Neukum
     [not found]               ` <1676538.CEPj2RtrPe-ugxBuEnWX9yG/4A2pS7c2Q@public.gmane.org>
2012-09-07  3:55                 ` Ming Lei
2012-09-07  7:35                   ` Oliver Neukum
     [not found]                     ` <1446113.XC2Qbo4flT-ugxBuEnWX9yG/4A2pS7c2Q@public.gmane.org>
2012-09-07 12:01                       ` Alexey ORISHKO
     [not found]                         ` <2AC7D4AD8BA1C640B4C60C61C8E520154A6AA5741E-8ZTw5gFVCTjVH5byLeRTJxkTb7+GphCuwzqs5ZKRSiY@public.gmane.org>
2012-09-07 13:08                           ` Oliver Neukum
2012-09-07 15:23                             ` Alexey ORISHKO
     [not found]                               ` <2AC7D4AD8BA1C640B4C60C61C8E520154A6AA5753D-8ZTw5gFVCTjVH5byLeRTJxkTb7+GphCuwzqs5ZKRSiY@public.gmane.org>
2012-09-07 18:23                                 ` Oliver Neukum
     [not found]                                   ` <1609320.M17H7UceTZ-ugxBuEnWX9yG/4A2pS7c2Q@public.gmane.org>
2012-09-10 17:10                                     ` Alexey ORISHKO
2012-09-06  8:13   ` Alexey ORISHKO
2012-09-06  8:50     ` Oliver Neukum
     [not found]       ` <6556435.5o3fR8ZcBa-ugxBuEnWX9yG/4A2pS7c2Q@public.gmane.org>
2012-09-06  9:11         ` Eric Dumazet
2012-09-06  9:22           ` Eric Dumazet
2012-09-07 12:58     ` Ming Lei
2012-09-07 13:10       ` Alexey ORISHKO
2012-09-06  8:17 ` Bjørn Mork [this message]
     [not found]   ` <87ehmf36qd.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2012-09-07  7:40     ` MBIM (was: Re: changing usbnet's API to better deal with cdc-ncm) Oliver Neukum
2012-09-07  8:53       ` MBIM Bjørn Mork
     [not found]         ` <87392u1afl.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2012-09-07 17:02           ` MBIM Dan Williams

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=87ehmf36qd.fsf@nemi.mork.no \
    --to=bjorn@mork.no \
    --cc=alexey.orishko@stericsson.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.