eventdev: add element offset to event vector

Add `rte_event_vector:elem_offset:12` bit field event vector
structure the bits are taken from `rte_event_vector::rsvd:15`.
The element offset defines the offset into the vector array
at which valid elements start.

The valid elements count will be equal to
`rte_event_vector::nb_elem`.

Update Rx/Tx adapter SW implementation to use elem_offset.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
This commit is contained in:
Pavan Nikhilesh 2022-09-21 22:13:40 +05:30 committed by Jerin Jacob
parent a6d13f59e6
commit 0fbb55efa5
3 changed files with 10 additions and 5 deletions

View File

@ -857,6 +857,7 @@ rxa_init_vector(struct event_eth_rx_adapter *rx_adapter,
vec->vector_ev->port = vec->port;
vec->vector_ev->queue = vec->queue;
vec->vector_ev->attr_valid = true;
vec->vector_ev->elem_offset = 0;
TAILQ_INSERT_TAIL(&rx_adapter->vector_list, vec, next);
}

View File

@ -557,16 +557,18 @@ txa_process_event_vector(struct txa_service_data *txa,
queue = vec->queue;
tqi = txa_service_queue(txa, port, queue);
if (unlikely(tqi == NULL || !tqi->added)) {
rte_pktmbuf_free_bulk(mbufs, vec->nb_elem);
rte_pktmbuf_free_bulk(&mbufs[vec->elem_offset],
vec->nb_elem);
rte_mempool_put(rte_mempool_from_obj(vec), vec);
return 0;
}
for (i = 0; i < vec->nb_elem; i++) {
nb_tx += rte_eth_tx_buffer(port, queue, tqi->tx_buf,
mbufs[i]);
mbufs[i + vec->elem_offset]);
}
} else {
for (i = 0; i < vec->nb_elem; i++) {
for (i = vec->elem_offset; i < vec->elem_offset + vec->nb_elem;
i++) {
port = mbufs[i]->port;
queue = rte_event_eth_tx_adapter_txq_get(mbufs[i]);
tqi = txa_service_queue(txa, port, queue);

View File

@ -1076,8 +1076,10 @@ rte_event_dev_close(uint8_t dev_id);
*/
struct rte_event_vector {
uint16_t nb_elem;
/**< Number of elements in this event vector. */
uint16_t rsvd : 15;
/**< Number of elements valid in this event vector. */
uint16_t elem_offset : 12;
/**< Offset into the vector array where valid elements start from. */
uint16_t rsvd : 3;
/**< Reserved for future use */
uint16_t attr_valid : 1;
/**< Indicates that the below union attributes have valid information.