Skip to content

Commit

Permalink
eventdev/eth_tx: add spinlock for adapter start/stop
Browse files Browse the repository at this point in the history
[ upstream commit 2ab9869c01bbec4b0da0b806ef605b56ffed6e95 ]

Add spinlock protection for tx adapter stop and start APIs add
null check for tx adapter service pointer in adapter start/stop APIs.

Fixes: a3bbf2e ("eventdev: add eth Tx adapter implementation")

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
  • Loading branch information
svnagaha authored and cpaelzer committed Nov 11, 2022
1 parent d6cc3a3 commit 0cd85a2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/librte_eventdev/rte_event_eth_tx_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#define RTE_EVENT_ETH_TX_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) \
do { \
if (!txa_valid_id(id)) { \
RTE_EDEV_LOG_ERR("Invalid eth Rx adapter id = %d", id); \
RTE_EDEV_LOG_ERR("Invalid eth Tx adapter id = %d", id); \
return retval; \
} \
} while (0)
Expand Down Expand Up @@ -467,10 +467,13 @@ txa_service_ctrl(uint8_t id, int start)
struct txa_service_data *txa;

txa = txa_service_id_to_data(id);
if (txa->service_id == TXA_INVALID_SERVICE_ID)
if (txa == NULL || txa->service_id == TXA_INVALID_SERVICE_ID)
return 0;

rte_spinlock_lock(&txa->tx_lock);
ret = rte_service_runstate_set(txa->service_id, start);
rte_spinlock_unlock(&txa->tx_lock);

if (ret == 0 && !start) {
while (rte_service_may_be_active(txa->service_id))
rte_pause();
Expand Down

0 comments on commit 0cd85a2

Please sign in to comment.