All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Felipe Ferreri Tonello <eu@felipetonello.com>, linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Felipe Balbi <balbi@ti.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Robert Baldyga <r.baldyga@samsung.com>
Subject: Re: [PATCH v5 7/7] usb: gadget: f_midi: pre-allocate IN requests
Date: Fri, 27 Nov 2015 20:52:15 +0100	[thread overview]
Message-ID: <5658B46F.6030601@ladisch.de> (raw)
In-Reply-To: <56589AFD.6010405@felipetonello.com>

Felipe Ferreri Tonello wrote:
> One thing to consider is that the ALSA rawmidi device buffer is
> sequential and our USB request buffer is not. This means that our 32
> (qlen) * 256 (buflen) = 8KB of data is non-linear. Some requests might
> have 3 or 4 bytes (average size of a normal MIDI message) of data and
> some others might contain the full 256 bytes (for SysEx messages).

f_midi_transmit() always fills up the USB packet as much as possible, so
the number of MIDI messages per request will increase automatically when
the ALSA buffer fills up faster that it is emptied by f_midi.

> == Conclusion ==
>
> Based on our conversation and your suggestions, I think that to just
> ignore if an overrun occurs to the USB requests is fine. Upon completion
> the request will be reused.
> Important to note that if the overrun occurs, it will cause user-space
> to block until a) the completion function is called successfully or b)
> snd_rawmidi_write() times out. Which I think this is expected by ALSA users.
>
> Does that make sense?

Yes.


Regards,
Clemens

  reply	other threads:[~2015-11-27 19:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 17:52 [PATCH v5 0/7] USB MIDI Gadget improvements and bug fixes Felipe F. Tonello
2015-11-10 17:52 ` [PATCH v5 1/7] usb: gadget: f_midi: Transmit data only when IN ep is enabled Felipe F. Tonello
2015-11-13  8:08   ` Robert Baldyga
2015-11-10 17:52 ` [PATCH v5 2/7] usb: gadget: f_midi: remove duplicated code Felipe F. Tonello
2015-11-13  8:09   ` Robert Baldyga
2015-11-10 17:52 ` [PATCH v5 3/7] usb: gadget: define free_ep_req as universal function Felipe F. Tonello
2015-11-13  8:11   ` Robert Baldyga
2015-11-10 17:52 ` [PATCH v5 4/7] usb: gadget: f_midi: fix leak on failed to enqueue out requests Felipe F. Tonello
2015-11-13  8:31   ` Robert Baldyga
2015-11-16 11:08     ` Felipe Ferreri Tonello
2015-11-16 11:43       ` Robert Baldyga
2015-11-25 13:02         ` Felipe Ferreri Tonello
2015-11-10 17:52 ` [PATCH v5 5/7] usb: gadget: gmidi: Cleanup legacy code Felipe F. Tonello
2015-11-13  8:34   ` Robert Baldyga
2015-11-10 17:52 ` [PATCH v5 6/7] usb: gadget: f_midi: set altsettings only for MIDIStreaming interface Felipe F. Tonello
2015-11-10 18:43   ` Sergei Shtylyov
2015-11-11  9:38     ` Felipe Ferreri Tonello
2015-11-11 18:02       ` Sergei Shtylyov
2015-11-13  8:11       ` Clemens Ladisch
2015-11-16 11:41         ` Felipe Ferreri Tonello
2015-11-13  8:14   ` Clemens Ladisch
2015-11-10 17:52 ` [PATCH v5 7/7] usb: gadget: f_midi: pre-allocate IN requests Felipe F. Tonello
2015-11-13  8:55   ` Clemens Ladisch
2015-11-25 17:22     ` Felipe Ferreri Tonello
2015-11-27  9:05       ` Clemens Ladisch
2015-11-27 18:03         ` Felipe Ferreri Tonello
2015-11-27 19:52           ` Clemens Ladisch [this message]
2015-11-13 12:38   ` Robert Baldyga
2015-11-25 16:54     ` Felipe Ferreri Tonello

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=5658B46F.6030601@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=balbi@ti.com \
    --cc=eu@felipetonello.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=r.baldyga@samsung.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.