Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754996AbbK0TwX (ORCPT ); Fri, 27 Nov 2015 14:52:23 -0500 Received: from dehamd003.servertools24.de ([31.47.254.18]:47953 "EHLO dehamd003.servertools24.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754791AbbK0TwW (ORCPT ); Fri, 27 Nov 2015 14:52:22 -0500 Subject: Re: [PATCH v5 7/7] usb: gadget: f_midi: pre-allocate IN requests To: Felipe Ferreri Tonello , linux-usb@vger.kernel.org References: <1447177929-22252-1-git-send-email-eu@felipetonello.com> <1447177929-22252-8-git-send-email-eu@felipetonello.com> <5645A58F.9030902@ladisch.de> <5655EE70.8040502@felipetonello.com> <56581CC8.9080405@ladisch.de> <56589AFD.6010405@felipetonello.com> Cc: linux-kernel@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , Robert Baldyga From: Clemens Ladisch Message-ID: <5658B46F.6030601@ladisch.de> Date: Fri, 27 Nov 2015 20:52:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <56589AFD.6010405@felipetonello.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-PPP-Message-ID: <20151127195219.463182.28454@dehamd003.servertools24.de> X-PPP-Vhost: ladisch.de Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1309 Lines: 32 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/