[PATCH v3 47/51] net/sxe2: harden ACL flow count resource handling
liujie5 at linkdatatechnology.com
liujie5 at linkdatatechnology.com
Wed Aug 26 10:58:13 CEST 2026
From: Jie Liu <liujie5 at linkdatatechnology.com>
Fix issues found in the ACL flow count (statistics) support:
- sxe2_flow_free_mgr(): when the flow engine type is neither ACL nor
FNAV, the code skipped the TAILQ_REMOVE but still called rte_free()
on the manager, leaving a freed pointer on the list. Return -ENOTSUP
for an unknown engine type instead.
- sxe2_flow_cid_mgr.stat_index is uint16_t while the firmware returns
and consumes a uint32_t stat id; widen it to uint32_t to avoid silent
truncation.
- sxe2_drv_cmd_code: write the ACL STAT_ALLOC/STAT_FREE entries with an
explicit SXE2_MK_DRV_CMD() value instead of relying on implicit
increment over the encoded QUERY value.
Cc: stable at dpdk.org
Cc: stephen at networkplumber.org
Signed-off-by: Jie Liu <liujie5 at linkdatatechnology.com>
---
drivers/net/sxe2/sxe2_drv_cmd.h | 6 ++++--
drivers/net/sxe2/sxe2_flow.c | 6 ++++++
drivers/net/sxe2/sxe2_flow_define.h | 2 +-
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/net/sxe2/sxe2_drv_cmd.h b/drivers/net/sxe2/sxe2_drv_cmd.h
index f66b574e83..8d907b3843 100644
--- a/drivers/net/sxe2/sxe2_drv_cmd.h
+++ b/drivers/net/sxe2/sxe2_drv_cmd.h
@@ -836,8 +836,10 @@ enum sxe2_drv_cmd_code {
SXE2_DRV_CMD_FLOW_ACL_STAT_QUERY =
SXE2_MK_DRV_CMD(SXE2_DRV_CMD_MODULE_ACL, 1),
- SXE2_DRV_CMD_FLOW_ACL_STAT_ALLOC,
- SXE2_DRV_CMD_FLOW_ACL_STAT_FREE,
+ SXE2_DRV_CMD_FLOW_ACL_STAT_ALLOC =
+ SXE2_MK_DRV_CMD(SXE2_DRV_CMD_MODULE_ACL, 2),
+ SXE2_DRV_CMD_FLOW_ACL_STAT_FREE =
+ SXE2_MK_DRV_CMD(SXE2_DRV_CMD_MODULE_ACL, 3),
};
diff --git a/drivers/net/sxe2/sxe2_flow.c b/drivers/net/sxe2/sxe2_flow.c
index 037d9e6f9c..45ace5b848 100644
--- a/drivers/net/sxe2/sxe2_flow.c
+++ b/drivers/net/sxe2/sxe2_flow.c
@@ -1288,6 +1288,12 @@ int32_t sxe2_flow_free_mgr(struct sxe2_adapter *adapter,
cid_mgr_list = &adapter->flow_ctxt.fnav_hw_res.flow_cid_mgr_list;
TAILQ_REMOVE(cid_mgr_list, mgr, next);
ret = sxe2_drv_flow_fnav_free_stat(adapter, mgr->stat_index);
+ } else {
+ PMD_LOG_ERR(DRV,
+ "Failed to free flow count, unknown engine type: %d.",
+ flow->engine_type);
+ ret = -ENOTSUP;
+ return ret;
}
if (ret) {
rte_flow_error_set(error, EIO,
diff --git a/drivers/net/sxe2/sxe2_flow_define.h b/drivers/net/sxe2/sxe2_flow_define.h
index f56f687dc7..d04499f5cb 100644
--- a/drivers/net/sxe2/sxe2_flow_define.h
+++ b/drivers/net/sxe2/sxe2_flow_define.h
@@ -100,7 +100,7 @@ TAILQ_HEAD(rte_flow_list_t, rte_flow);
struct sxe2_flow_cid_mgr {
TAILQ_ENTRY(sxe2_flow_cid_mgr) next;
- uint16_t stat_index;
+ uint32_t stat_index;
uint32_t user_id;
uint32_t driver_id;
uint32_t count_type;
--
2.52.0
More information about the dev
mailing list