[PATCH v5 40/45] net/sxe2: skip flow id assignment on filter add failure

liujie5 at linkdatatechnology.com liujie5 at linkdatatechnology.com
Fri Aug 28 05:27:02 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.

Fixes: 635084db5d57 ("net/sxe2: support VF representors")
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 581026e81d..89829f29be 100644
--- a/drivers/net/sxe2/sxe2_cmd_chnl.c
+++ b/drivers/net/sxe2/sxe2_cmd_chnl.c
@@ -1818,9 +1818,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