Re: [PATCH v5 5/5] usb: gadget: f_uac2: send reasonably sized packets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/27/2014 04:18 PM, Alan Stern wrote:
> On Wed, 27 Aug 2014, Daniel Mack wrote:

>> +		/*
>> +		 * Whenever there are more bytes in the accumulator than we
>> +		 * need to add one more sample frame, increase this packet's
>> +		 * size and decrease the accumulator.
>> +		 */
>> +		if (uac2->p_residue / uac2->p_interval >= fsz) {
>> +			req->length += fsz;
>> +			uac2->p_residue -= fsz * uac2->p_interval;
>> +		}
> 
> One thing I didn't mention about the algorithm I posted earlier: The
> individual packet calculations don't contain any multiplications or
> divisions.
> 
> The code here is in the hottest part of the driver, so you might want
> to optimize it a little.  For instance, several of the operations could 
> be precomputed and stored for later use.

Yeah, well. I did tests with that, and at least the difference in load
is not measureable on BBB. But you're right of course, and it even leads
to nicer code. Will send that as v6.


Thanks,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux