USB: gadget: u_ether: Optimize TX interrupt on completion

Though dl aggregation is enabled and set to more than 3 packets,
still most of the time single packets are queued to the DCD.
Sending single packet adds extra penalty, as for every transfer
complete controller may do some clean up before fetching new
request to the HW.

In the current Tx aggregation logic, on receiving packet from
network layer, after preparing the usb_req checks if number of
packets aggregated is max aggregated value or if packets queued
to DCD is less than TX_FIFO_THRESHOLD, then it immediately
queues the packet to DCD, otherwise, it parks the packet for
further aggregation. On any tx completion handler, checks if
there is any parked tx packet, if yes, then queues the parked tx
packet to DCD in completion handler. In high throughput test
cases, there may be back to back completion handlers being
called, due to any rx or tx endpoint completions. This may cause
tx completion handler being called frequency and this may cause,
tx completion handler may queue the parked packet to DCD before
it gets aggregated with the multiple packets.

With this new tx aggregation logic, instead of queuing the parked
aggregated packet on every tx completion handler, checks the
completed request no_interrupt flag, if it is zero, then only
allow queuing the parked packet to DCD. With this logic, giving
sufficient time for more aggregation. To make this logic to work,
require to have synchronization between when to start aggregation
and how many packets can be queued with no_interrupt flag set
sequentially, hence adding new flag MAX_TX_REQ_WITH_NO_INT that
is being used in aggregation logic and no_interrupt logic.

Change-Id: I84fb4a4d3d20bb3ddb2f33c64cb4b65373b363ea
Signed-off-by: Sujeet Kumar <ksujeet@codeaurora.org>
Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
1 file changed