From: Jie Liu <[email protected]>
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: [email protected]
Cc: [email protected]
Signed-off-by: Jie Liu <[email protected]>
---
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 c5bd73244b..fa73b8a8b7 100644
--- a/drivers/net/sxe2/sxe2_cmd_chnl.c
+++ b/drivers/net/sxe2/sxe2_cmd_chnl.c
@@ -1819,9 +1819,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