[PATCH v3 42/51] net/sxe2: skip flow id assignment on filter add failure

liujie5 at linkdatatechnology.com liujie5 at linkdatatechnology.com
Wed Aug 26 10:57:44 CEST 2026


From: Jie Liu <liujie5 at linkdatatechnology.com>

sxe2_drv_flow_filter_add() assigns flow->flow_id from the response
even when the firmware command fails, overwriting any previously
set flow id with the zero-initialized response value.

Return early on command failure so flow->flow_id is preserved, and
set flow->create_err on both the success and error paths.

Cc: stable at dpdk.org
Cc: stephen at networkplumber.org
Signed-off-by: Jie Liu <liujie5 at linkdatatechnology.com>
---
 drivers/net/sxe2/sxe2_cmd_chnl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/sxe2/sxe2_cmd_chnl.c b/drivers/net/sxe2/sxe2_cmd_chnl.c
index 8c45554637..e0c45ae0e3 100644
--- a/drivers/net/sxe2/sxe2_cmd_chnl.c
+++ b/drivers/net/sxe2/sxe2_cmd_chnl.c
@@ -1837,9 +1837,13 @@ int32_t sxe2_drv_flow_filter_add(struct sxe2_adapter *adapter, struct sxe2_flow
 	sxe2_drv_cmd_params_fill(adapter, &cmd, SXE2_DRV_CMD_FLOW_FILTER_ADD, &req,
 			   sizeof(req), &resp, sizeof(resp));
 	ret = sxe2_drv_cmd_exec(cdev, &cmd);
-	if (ret)
+	if (ret) {
 		PMD_DEV_LOG_ERR(adapter, DRV, "Failed to add flow filter, ret: %d.", ret);
+		goto l_end;
+	}
 	flow->flow_id = resp.flow_id;
+
+l_end:
 	flow->create_err = ret;
 	return ret;
 }
-- 
2.52.0



More information about the dev mailing list