When an RX transaction completes, we update the trans->len field to
contain the actual number of bytes received. This is done in a loop
in gsi_evt_ring_rx_update().
Change that function so it checks the data transfer direction
recorded in the transaction, and only updates trans->len for RX
transfers.
Then call it unconditionally. This means events for TX endpoints
will run through the loop without otherwise doing anything, but
this will change shortly.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
if (!trans)
return;
- trans->len = __le16_to_cpu(event->len);
+ if (trans->direction == DMA_FROM_DEVICE)
+ trans->len = __le16_to_cpu(event->len);
/* Move on to the next event and transaction */
if (--event_avail)
*/
if (channel->toward_ipa)
gsi_trans_tx_completed(trans);
- else
- gsi_evt_ring_rx_update(gsi, evt_ring_id, index);
+ gsi_evt_ring_rx_update(gsi, evt_ring_id, index);
gsi_trans_move_complete(trans);