[PATCH v1 24/25] net/ntnic: avoid possible deadlock
Oleksandr Kolomeiets
okl-plv at napatech.com
Wed Apr 30 15:48:36 CEST 2025
From: Danylo Vodopianov <dvo-plv at napatech.com>
Sometimes during high flow learn performance two threads
could cause deadlock using queue and mutex.
learn_ignored variable sets when flow learn and gets
when flow removes. Hence, learn_ignore should not be protected
as far as two thread could not access to the same flow
at the same time.
Signed-off-by: Danylo Vodopianov <dvo-plv at napatech.com>
---
drivers/net/ntnic/include/flow_api_engine.h | 2 +-
.../nthw/flow_api/profile_inline/flow_api_profile_inline.c | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/ntnic/include/flow_api_engine.h b/drivers/net/ntnic/include/flow_api_engine.h
index 859c76656a..10b09f0297 100644
--- a/drivers/net/ntnic/include/flow_api_engine.h
+++ b/drivers/net/ntnic/include/flow_api_engine.h
@@ -297,7 +297,7 @@ struct flow_handle {
enum flow_handle_type type;
uint32_t flm_id;
uint16_t caller_id;
- uint16_t learn_ignored;
+ RTE_ATOMIC(uint16_t)learn_ignored;
struct flow_eth_dev *dev;
struct flow_handle *next;
diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c
index 3133464675..d12bd5a4af 100644
--- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c
+++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c
@@ -518,9 +518,7 @@ static void flm_mtr_read_sta_records(struct flow_eth_dev *dev, uint32_t *data, u
uint8_t port;
bool remote_caller = is_remote_caller(caller_id, &port);
- rte_spinlock_lock(&dev->ndev->mtx);
((struct flow_handle *)flm_h.p)->learn_ignored = 1;
- rte_spinlock_unlock(&dev->ndev->mtx);
struct flm_status_event_s data = {
.flow = flm_h.p,
.learn_ignore = sta_data->lis,
--
2.47.1
More information about the dev
mailing list