From: Jie Liu <[email protected]>

sxe2_udp_tunnel_port_add_common() lost the check that restricts
UDP tunnel port configuration to PF devices (not VF or
representor), so VF/representor devices can now attempt to add
UDP tunnel ports, which the hardware does not support.

Restore the PF-only guard returning -ENOTSUP, matching the V3
implementation.

Cc: [email protected]
Cc: [email protected]
Signed-off-by: Jie Liu <[email protected]>
---
 drivers/net/sxe2/sxe2_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/sxe2/sxe2_ethdev.c b/drivers/net/sxe2/sxe2_ethdev.c
index 5735dd0ff3..88fe43298a 100644
--- a/drivers/net/sxe2/sxe2_ethdev.c
+++ b/drivers/net/sxe2/sxe2_ethdev.c
@@ -630,6 +630,10 @@ int32_t sxe2_udp_tunnel_port_add_common(struct 
sxe2_adapter *ad,
        struct sxe2_udp_tunnel_cfg *tunnel_config;
        int32_t ret = -1;
 
+       if (ad->dev_type != SXE2_DEV_T_PF || ad->is_dev_repr) {
+               ret = -ENOTSUP;
+               goto l_end;
+       }
        rte_spinlock_lock(&ad->udp_tunnel_ctx.lock);
 
        tunnel_config = &ad->udp_tunnel_ctx.tunnel_conf[tunnel_proto];
@@ -659,6 +663,7 @@ int32_t sxe2_udp_tunnel_port_add_common(struct sxe2_adapter 
*ad,
 
 l_unlock_end:
        rte_spinlock_unlock(&ad->udp_tunnel_ctx.lock);
+l_end:
        return ret;
 }
 
-- 
2.52.0

Reply via email to