net: ipa: don't assume one channel per event ring
In gsi_evt_ring_rx_update(), use gsi_event_trans() repeatedly to find the transaction associated with an event, rather than assuming consecutive events are associated with the same channel. This removes the only caller of gsi_trans_pool_next(), so get rid of it. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
6c0d09d937
commit
dd5a046cbb
@ -1366,15 +1366,11 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_ring *evt_ring, u32 index)
|
|||||||
{
|
{
|
||||||
struct gsi_channel *channel = evt_ring->channel;
|
struct gsi_channel *channel = evt_ring->channel;
|
||||||
struct gsi_ring *ring = &evt_ring->ring;
|
struct gsi_ring *ring = &evt_ring->ring;
|
||||||
struct gsi_trans_info *trans_info;
|
|
||||||
struct gsi_event *event_done;
|
struct gsi_event *event_done;
|
||||||
struct gsi_event *event;
|
struct gsi_event *event;
|
||||||
struct gsi_trans *trans;
|
|
||||||
u32 event_avail;
|
u32 event_avail;
|
||||||
u32 old_index;
|
u32 old_index;
|
||||||
|
|
||||||
trans_info = &channel->trans_info;
|
|
||||||
|
|
||||||
/* We'll start with the oldest un-processed event. RX channels
|
/* We'll start with the oldest un-processed event. RX channels
|
||||||
* replenish receive buffers in single-TRE transactions, so we
|
* replenish receive buffers in single-TRE transactions, so we
|
||||||
* can just map that event to its transaction. Transactions
|
* can just map that event to its transaction. Transactions
|
||||||
@ -1382,9 +1378,6 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_ring *evt_ring, u32 index)
|
|||||||
*/
|
*/
|
||||||
old_index = ring->index;
|
old_index = ring->index;
|
||||||
event = gsi_ring_virt(ring, old_index);
|
event = gsi_ring_virt(ring, old_index);
|
||||||
trans = gsi_event_trans(channel->gsi, event);
|
|
||||||
if (!trans)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Compute the number of events to process before we wrap,
|
/* Compute the number of events to process before we wrap,
|
||||||
* and determine when we'll be done processing events.
|
* and determine when we'll be done processing events.
|
||||||
@ -1392,6 +1385,12 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_ring *evt_ring, u32 index)
|
|||||||
event_avail = ring->count - old_index % ring->count;
|
event_avail = ring->count - old_index % ring->count;
|
||||||
event_done = gsi_ring_virt(ring, index);
|
event_done = gsi_ring_virt(ring, index);
|
||||||
do {
|
do {
|
||||||
|
struct gsi_trans *trans;
|
||||||
|
|
||||||
|
trans = gsi_event_trans(channel->gsi, event);
|
||||||
|
if (!trans)
|
||||||
|
return;
|
||||||
|
|
||||||
trans->len = __le16_to_cpu(event->len);
|
trans->len = __le16_to_cpu(event->len);
|
||||||
|
|
||||||
/* Move on to the next event and transaction */
|
/* Move on to the next event and transaction */
|
||||||
@ -1399,7 +1398,6 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_ring *evt_ring, u32 index)
|
|||||||
event++;
|
event++;
|
||||||
else
|
else
|
||||||
event = gsi_ring_virt(ring, 0);
|
event = gsi_ring_virt(ring, 0);
|
||||||
trans = gsi_trans_pool_next(&trans_info->pool, trans);
|
|
||||||
} while (event != event_done);
|
} while (event != event_done);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,9 +16,6 @@ struct gsi_channel;
|
|||||||
|
|
||||||
#define GSI_RING_ELEMENT_SIZE 16 /* bytes; must be a power of 2 */
|
#define GSI_RING_ELEMENT_SIZE 16 /* bytes; must be a power of 2 */
|
||||||
|
|
||||||
/* Return the entry that follows one provided in a transaction pool */
|
|
||||||
void *gsi_trans_pool_next(struct gsi_trans_pool *pool, void *element);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gsi_trans_move_complete() - Mark a GSI transaction completed
|
* gsi_trans_move_complete() - Mark a GSI transaction completed
|
||||||
* @trans: Transaction to commit
|
* @trans: Transaction to commit
|
||||||
|
@ -214,22 +214,6 @@ void *gsi_trans_pool_alloc_dma(struct gsi_trans_pool *pool, dma_addr_t *addr)
|
|||||||
return pool->base + offset;
|
return pool->base + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the pool element that immediately follows the one given.
|
|
||||||
* This only works done if elements are allocated one at a time.
|
|
||||||
*/
|
|
||||||
void *gsi_trans_pool_next(struct gsi_trans_pool *pool, void *element)
|
|
||||||
{
|
|
||||||
void *end = pool->base + pool->count * pool->size;
|
|
||||||
|
|
||||||
WARN_ON(element < pool->base);
|
|
||||||
WARN_ON(element >= end);
|
|
||||||
WARN_ON(pool->max_alloc != 1);
|
|
||||||
|
|
||||||
element += pool->size;
|
|
||||||
|
|
||||||
return element < end ? element : pool->base;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Map a given ring entry index to the transaction associated with it */
|
/* Map a given ring entry index to the transaction associated with it */
|
||||||
static void gsi_channel_trans_map(struct gsi_channel *channel, u32 index,
|
static void gsi_channel_trans_map(struct gsi_channel *channel, u32 index,
|
||||||
struct gsi_trans *trans)
|
struct gsi_trans *trans)
|
||||||
|
Loading…
Reference in New Issue
Block a user