[PATCH v6 39/45] net/sxe2: skip tunnel config fill on get failure

liujie5 at linkdatatechnology.com liujie5 at linkdatatechnology.com
Fri Aug 28 09:40:21 CEST 2026


From: Jie Liu <liujie5 at linkdatatechnology.com>

sxe2_drv_udp_tunnel_get() fills tunnel_config fields even when the
firmware command fails, so a failed get overwrites the config with
the (zero-initialized) response data instead of leaving it intact.

Return early with the error code when sxe2_drv_cmd_exec() fails,
matching the V3 implementation.

Fixes: fff24885f70a ("net/sxe2: support custom UDP tunnel ports")
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, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sxe2/sxe2_cmd_chnl.c b/drivers/net/sxe2/sxe2_cmd_chnl.c
index 3998309bb1..581026e81d 100644
--- a/drivers/net/sxe2/sxe2_cmd_chnl.c
+++ b/drivers/net/sxe2/sxe2_cmd_chnl.c
@@ -1650,15 +1650,17 @@ int32_t sxe2_drv_udp_tunnel_get(struct sxe2_adapter *adapter,
 				 &req, sizeof(req),
 				 &resp, sizeof(resp));
 	ret = sxe2_drv_cmd_exec(cdev, &cmd);
-	if (ret)
+	if (ret) {
 		PMD_LOG_ERR(DRV, "Failed to get udp proto %d port, ret=%d", req.type, ret);
+		goto l_end;
+	}
 
 	tunnel_config->fw_port   = resp.port;
 	tunnel_config->fw_status = resp.enable;
 	tunnel_config->fw_dst_en = resp.dst;
 	tunnel_config->fw_src_en = resp.src;
 	tunnel_config->fw_used   = resp.fw_used;
-
+l_end:
 	return ret;
 }
 
-- 
2.52.0



More information about the dev mailing list