Skip to content

Commit 1ad9a00

Browse files
Paul Blakeydavem330
authored andcommitted
net/mlx5e: Avoid supporting udp tunnel port ndo for VF reps
This was added to allow the TC offloading code to identify offloading encap/decap vxlan rules. The VF reps are effectively related to the same mlx5 PCI device as the PF. Since the kernel invokes the (say) delete ndo for each netdev, the FW erred on multiple vxlan dst port deletes when the port was deleted from the system. We fix that by keeping the registration to be carried out only by the PF. Since the PF serves as the uplink device, the VF reps will look up a port there and realize if they are ok to offload that. Tested: <SETUP VFS> <SETUP switchdev mode to have representors> ip link add vxlan1 type vxlan id 44 dev ens5f0 dstport 9999 ip link set vxlan1 up ip link del dev vxlan1 Fixes: 4a25730 ('net/mlx5e: Add ndo_udp_tunnel_add to VF representors') Signed-off-by: Paul Blakey <[email protected]> Reviewed-by: Or Gerlitz <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 09c91dd commit 1ad9a00

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -928,10 +928,6 @@ void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv);
928928
int mlx5e_attach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev);
929929
void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev);
930930
u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout);
931-
void mlx5e_add_vxlan_port(struct net_device *netdev,
932-
struct udp_tunnel_info *ti);
933-
void mlx5e_del_vxlan_port(struct net_device *netdev,
934-
struct udp_tunnel_info *ti);
935931

936932
int mlx5e_get_offload_stats(int attr_id, const struct net_device *dev,
937933
void *sp);

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3100,8 +3100,8 @@ static int mlx5e_get_vf_stats(struct net_device *dev,
31003100
vf_stats);
31013101
}
31023102

3103-
void mlx5e_add_vxlan_port(struct net_device *netdev,
3104-
struct udp_tunnel_info *ti)
3103+
static void mlx5e_add_vxlan_port(struct net_device *netdev,
3104+
struct udp_tunnel_info *ti)
31053105
{
31063106
struct mlx5e_priv *priv = netdev_priv(netdev);
31073107

@@ -3114,8 +3114,8 @@ void mlx5e_add_vxlan_port(struct net_device *netdev,
31143114
mlx5e_vxlan_queue_work(priv, ti->sa_family, be16_to_cpu(ti->port), 1);
31153115
}
31163116

3117-
void mlx5e_del_vxlan_port(struct net_device *netdev,
3118-
struct udp_tunnel_info *ti)
3117+
static void mlx5e_del_vxlan_port(struct net_device *netdev,
3118+
struct udp_tunnel_info *ti)
31193119
{
31203120
struct mlx5e_priv *priv = netdev_priv(netdev);
31213121

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,6 @@ static const struct net_device_ops mlx5e_netdev_ops_rep = {
393393
.ndo_get_phys_port_name = mlx5e_rep_get_phys_port_name,
394394
.ndo_setup_tc = mlx5e_rep_ndo_setup_tc,
395395
.ndo_get_stats64 = mlx5e_rep_get_stats,
396-
.ndo_udp_tunnel_add = mlx5e_add_vxlan_port,
397-
.ndo_udp_tunnel_del = mlx5e_del_vxlan_port,
398396
.ndo_has_offload_stats = mlx5e_has_offload_stats,
399397
.ndo_get_offload_stats = mlx5e_get_offload_stats,
400398
};

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,15 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv,
267267
skb_flow_dissector_target(f->dissector,
268268
FLOW_DISSECTOR_KEY_ENC_PORTS,
269269
f->mask);
270+
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
271+
struct net_device *up_dev = mlx5_eswitch_get_uplink_netdev(esw);
272+
struct mlx5e_priv *up_priv = netdev_priv(up_dev);
270273

271274
/* Full udp dst port must be given */
272275
if (memchr_inv(&mask->dst, 0xff, sizeof(mask->dst)))
273276
goto vxlan_match_offload_err;
274277

275-
if (mlx5e_vxlan_lookup_port(priv, be16_to_cpu(key->dst)) &&
278+
if (mlx5e_vxlan_lookup_port(up_priv, be16_to_cpu(key->dst)) &&
276279
MLX5_CAP_ESW(priv->mdev, vxlan_encap_decap))
277280
parse_vxlan_attr(spec, f);
278281
else {
@@ -995,6 +998,8 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv,
995998
struct mlx5_esw_flow_attr *attr)
996999
{
9971000
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
1001+
struct net_device *up_dev = mlx5_eswitch_get_uplink_netdev(esw);
1002+
struct mlx5e_priv *up_priv = netdev_priv(up_dev);
9981003
unsigned short family = ip_tunnel_info_af(tun_info);
9991004
struct ip_tunnel_key *key = &tun_info->key;
10001005
struct mlx5_encap_entry *e;
@@ -1015,7 +1020,7 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv,
10151020
return -EOPNOTSUPP;
10161021
}
10171022

1018-
if (mlx5e_vxlan_lookup_port(priv, be16_to_cpu(key->tp_dst)) &&
1023+
if (mlx5e_vxlan_lookup_port(up_priv, be16_to_cpu(key->tp_dst)) &&
10191024
MLX5_CAP_ESW(priv->mdev, vxlan_encap_decap)) {
10201025
tunnel_type = MLX5_HEADER_TYPE_VXLAN;
10211026
} else {

0 commit comments

Comments
 (0)