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.
Fixes: fff24885f70a ("net/sxe2: support custom UDP tunnel ports")
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Jie Liu <[email protected]>
---
drivers/net/sxe2/sxe2_ethdev.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/net/sxe2/sxe2_ethdev.c b/drivers/net/sxe2/sxe2_ethdev.c
index 77a31eb8a1..8c60c9cfde 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;
}
@@ -669,6 +674,9 @@ int32_t sxe2_udp_tunnel_port_del_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)
+ return -ENOTSUP;
+
rte_spinlock_lock(&ad->udp_tunnel_ctx.lock);
tunnel_config = &ad->udp_tunnel_ctx.tunnel_conf[tunnel_proto];
@@ -703,6 +711,9 @@ static int32_t sxe2_udp_tunnel_port_clear(struct
rte_eth_dev *dev)
int32_t ret = 0;
uint16_t tunnel_proto = 0;
+ if (ad->dev_type != SXE2_DEV_T_PF || ad->is_dev_repr)
+ return -ENOTSUP;
+
rte_spinlock_lock(&ad->udp_tunnel_ctx.lock);
for (tunnel_proto = 0; tunnel_proto < SXE2_UDP_TUNNEL_MAX;
tunnel_proto++) {
--
2.52.0