netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bjørn Mork" <bjorn@mork.no>
To: Alexey Orishko <alexey.orishko@gmail.com>
Cc: Oliver Neukum <oliver@neukum.org>,
	netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Greg Suarez <gpsuarez2512@gmail.com>,
	"Fangxiaozhi \(Franko\)" <fangxiaozhi@huawei.com>,
	Dan Williams <dcbw@redhat.com>,
	Aleksander Morgado <aleksander@lanedo.com>
Subject: Re: [PATCH net-next 02/14] net: cdc_ncm: use device rx_max value if update failed
Date: Fri, 19 Oct 2012 08:41:54 +0200	[thread overview]
Message-ID: <878vb3ufnx.fsf@nemi.mork.no> (raw)
In-Reply-To: <CAL_Kpj0j9umyQBFFDVqWqEjH1057EjR0cZRcScdZG30E54=M0w@mail.gmail.com> (Alexey Orishko's message of "Fri, 19 Oct 2012 01:30:01 +0200")

Alexey Orishko <alexey.orishko@gmail.com> writes:
> On Fri, Oct 19, 2012 at 12:09 AM, Bjørn Mork <bjorn@mork.no> wrote:
>> Oliver Neukum <oliver@neukum.org> writes:
>>> On Thursday 18 October 2012 22:40:55 Bjørn Mork wrote:
>>>> If the device refuses our updated value, then we must be prepared
>>>> to receive URBs as big as the device wants to send.  Set rx_max
>>>> to the device provided value on error.
>>>
>>> Problematic in principle. How do you allocate a buffer of arbitrary size?
>>
>> You cannot of course.  You can only try and give up if it doesn't work.
>> rx_submit would end up returning -ENOMEM, but we are not always checking
>> that so it will most likely fail silently.
>>
>> But I don't think we can just continue with the smaller buffer size
>> without having the device agree to that either.  That is also likely to
>> fail silently.  Note that this patch was added exactly because one of
>> the MBIM test devices did refuse the lower rx_max we tried to enforce.
>> The device insists on using 128kB buffers.
>>
>> Maybe we should cap it at some arbitrary reasonable value, and just bail
>> out from bind if the device insists on a larger buffer?  Would that be
>> OK?  How big buffers are (semi-)reasonable?
>>
>
> I recommend to drop this.

OK, will drop patch 01 (only necessary if some usbnet minidriver uses
buffers > 60 * 1518) and 02 from the next version of this series.

> Vendor has to fix firmware.

I agree in principle, and I'll report the problem to them.  But as usual
I believe we have to support any weird firmware we encounter, if at all
possible.

> Current version of the driver supports 16-bit NTB, which means you can address
> (64K only - NTB header). So, how do you plan to use 64K-128K buffer space,
> if it can't be addressed by 16 bit offset?

This is of course true.  The device does obey the 16bit header choice,
so I would hope that it does not send us buffers it can't use.  But it
does send buffers in the range 32K-64K, which makes the current driver
fail in a rather ugly way.

I assume the current CDC_NCM_NTB_MAX_SIZE_RX is set to 32K as a sane
default, but how about allowing up to 64K for devices which does not
accept this?  The other options are
 - silently failing, or
 - refusing to load with an error the user cannot do anything with,
and I don't think either of those are wanted, even if the NCM spec is
quite clear that the device is wrong here.

> Another angle to big buffers, even while using 64K buffers your TCP connection
> will suffer, so what's the point making huge buffers?

Agreed.  There is no point.  It's bloat.  Which makes you kind of wonder
why they bothered to define a separate 32bit header format at all,
complicating the protocol quite a lot...  Or why those writing the MBIM
spec didn't take their opportunity to remove this useless complication?
I am not holding it against you though ;-)

A nice side effect of the refactoring done to support MBIM is that most
of the 16bit header parsing has been isolated in separate functions,
making it trivial to implement the missing 32bit header support.  Maybe
we should do that?



Bjørn

  reply	other threads:[~2012-10-19  6:42 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18 20:40 [PATCH net-next 00/14] Adding a USB CDC MBIM driver Bjørn Mork
2012-10-18 20:40 ` [PATCH net-next 01/14] net: usbnet: make sure the queue lenght is at least 1 Bjørn Mork
2012-10-18 20:40 ` [PATCH net-next 02/14] net: cdc_ncm: use device rx_max value if update failed Bjørn Mork
     [not found]   ` <1350592867-25651-3-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2012-10-18 21:45     ` Oliver Neukum
2012-10-18 22:09       ` Bjørn Mork
2012-10-18 23:30         ` Alexey Orishko
2012-10-19  6:41           ` Bjørn Mork [this message]
2012-10-19  9:30             ` Bjørn Mork
     [not found]               ` <871uguvmfy.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2012-10-19 10:01                 ` Alexey Orishko
     [not found]                   ` <CAL_Kpj3QX_bpLh5yX5VXKaqq+TSO9+aVxt+1TrU9e1BamKdFkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-19 10:30                     ` Bjørn Mork
     [not found]                       ` <87vce6u52w.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2012-10-19 11:36                         ` [RFC] net: cdc_ncm: workaround NTB input size firmware bug Bjørn Mork
2012-10-19 12:18                     ` [PATCH net-next 02/14] net: cdc_ncm: use device rx_max value if update failed Bjørn Mork
     [not found]                       ` <878vb2u03g.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2012-10-19 13:53                         ` Alexey Orishko
     [not found]                           ` <CAL_Kpj3tT6qfcD-Tpeqgof-k-PX-EPv_cMFo_NeEdLHfyN8Qfw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-19 14:09                             ` Bjørn Mork
2012-10-18 20:40 ` [PATCH net-next 04/14] net: cdc_ncm: adding MBIM support to ncm_setup Bjørn Mork
     [not found] ` <1350592867-25651-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2012-10-18 20:40   ` [PATCH net-next 03/14] USB: cdc: add MBIM constants and structures Bjørn Mork
     [not found]     ` <1350592867-25651-4-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2012-10-18 21:14       ` Greg Kroah-Hartman
2012-10-18 20:40   ` [PATCH net-next 05/14] net: cdc_ncm: refactor bind preparing for MBIM support Bjørn Mork
2012-10-18 20:41   ` [PATCH net-next 07/14] net: cdc_ncm: splitting rx_fixup for code reuse Bjørn Mork
2012-10-18 20:41   ` [PATCH net-next 09/14] net: cdc_ncm: export shared symbols and definitions Bjørn Mork
2012-10-18 20:41   ` [PATCH net-next 10/14] net: cdc_mbim: adding MBIM driver Bjørn Mork
2012-10-18 20:41   ` [PATCH net-next 13/14] net: cdc_ncm: map MBIM IPS SessionID to VLAN ID Bjørn Mork
2012-10-18 21:04   ` [PATCH net-next 00/14] Adding a USB CDC MBIM driver David Miller
2012-10-18 21:08     ` Bjørn Mork
2012-10-18 20:40 ` [PATCH net-next 06/14] net: cdc_ncm: process chained NDPs Bjørn Mork
2012-10-18 20:41 ` [PATCH net-next 08/14] net: cdc_ncm: refactoring for tx multiplexing Bjørn Mork
2012-10-18 20:41 ` [PATCH net-next 11/14] net: cdc_mbim: build the MBIM driver Bjørn Mork
2012-10-18 20:41 ` [PATCH net-next 12/14] net: cdc_ncm: do not bind to NCM compatible MBIM devices Bjørn Mork
2012-10-18 20:41 ` [PATCH net-next 14/14] net: cdc_mbim: Device Service Stream support Bjørn Mork
2012-10-18 21:16 ` [PATCH net-next 00/14] Adding a USB CDC MBIM driver Greg Kroah-Hartman

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=878vb3ufnx.fsf@nemi.mork.no \
    --to=bjorn@mork.no \
    --cc=aleksander@lanedo.com \
    --cc=alexey.orishko@gmail.com \
    --cc=dcbw@redhat.com \
    --cc=fangxiaozhi@huawei.com \
    --cc=gpsuarez2512@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oliver@neukum.org \
    /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).