All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Lorenzo Colitti <lorenzo@google.com>
Cc: linux-usb@vger.kernel.org, "Greg KH" <gregkh@linuxfoundation.org>,
	"Maciej Żenczykowski" <zenczykowski@gmail.com>
Subject: Re: [PATCH] usb: gadget: f_ncm: allow using NCM in SuperSpeed Plus gadgets.
Date: Mon, 17 Aug 2020 16:05:22 +0300	[thread overview]
Message-ID: <87ft8lzalp.fsf@kernel.org> (raw)
In-Reply-To: <CAKD1Yr17hFju=xvDHWWcLjwj=nuSBBVJn9xQ5ocHHXQm6PAw_A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2488 bytes --]

Lorenzo Colitti <lorenzo@google.com> writes:

> On Wed, Aug 5, 2020 at 7:21 PM Felipe Balbi <balbi@kernel.org> wrote:
>> But anyway, if we change 13 to 16, then we 1Gbps. How did you get
>> 1.7Gbps? I think we should really update ncm_bitrate() to contain the
>> correct equations for bitrate on different speeds.
>
> I got 1.7 Gbps because that's what I measured in iperf. :-)
>
> But actually after reading the spec I think that for SuperSpeed and
> above that calculation is meaningless, because bulk transfers are no
> longer limited by a set number of packets per microframe. The USB 3.2
> spec has mostly replaced the words "microframe" with "bus interval",
> but I don't see any place in the spec that says the number of packets
> per bus interval is limited. Section 8.12.1.2 (Bulk IN Transactions)
> just says that "when the host is ready to receive bulk data, it sends
> an ACK TP" saying how many packets it's willing to accept, where the
> maximum is the burst size supported by the endpoint. After that, the
> host has to respond with an ACK to every data packet received, and
> every ACK specifies the number of data packets it expects from then
> on.
>
> It seems more correct that for SS and above the driver should simply
> just report the link speed minus theoretical bus overhead? Section
> 4.4.11 suggests that's about 10%, so it would announce 4.5 Gbps.

makes sense to me :-)

>> > +static struct usb_ss_ep_comp_descriptor ssp_ncm_bulk_comp_desc = {
>> > +     .bLength =              sizeof(ssp_ncm_bulk_comp_desc),
>> > +     .bDescriptorType =      USB_DT_SS_ENDPOINT_COMP,
>> > +
>> > +     /* the following 2 values can be tweaked if necessary */
>> > +     /* .bMaxBurst =         0, */
>>
>> should you add bMaxBurst = 15 here?
>
> I'm not sure. On my setup, it provides a fair performance boost (goes
> from ~1.7Gbps to ~2.3Gbps in, and ~620Mbps to ~720Mbps out). But I
> don't know whether there might be any compatibility constraints or
> hardware dependencies. I do see that the f_mass_storage driver sets it
> to 15:

there shouldn't be any compatibility issues, no.

>          /* Calculate bMaxBurst, we know packet size is 1024 */
>         max_burst = min_t(unsigned, FSG_BUFLEN / 1024, 15);
>
> so perhaps this is fine to do in NCM too? If we want to set bMaxBurst
> to 15, should that be in this patch, or in a separate patch?

yup, should be fine. A separate patch is okay too :-)

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]

  parent reply	other threads:[~2020-08-17 13:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-05  7:58 [PATCH] usb: gadget: f_ncm: allow using NCM in SuperSpeed Plus gadgets Lorenzo Colitti
2020-08-05 10:21 ` Felipe Balbi
2020-08-05 15:49   ` Lorenzo Colitti
2020-08-05 18:04     ` Maciej Żenczykowski
2020-08-17 13:07       ` Felipe Balbi
2020-08-18 17:02       ` Lorenzo Colitti
2020-08-17 13:05     ` Felipe Balbi [this message]
2020-08-18 17:03       ` Lorenzo Colitti

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=87ft8lzalp.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lorenzo@google.com \
    --cc=zenczykowski@gmail.com \
    /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.