Skip to content

Commit 96a8395

Browse files
Tariq ToukanPaolo Abeni
authored andcommitted
net/mlx5e: Update XDP features in switch channels
The XDP features state might depend of the state of other features, like HW-LRO / HW-GRO. In general, move the re-evaluation announcement of the XDP features (xdp_set_features_flag_locked) into the flow where configuration gets changed. There's no point in updating them elsewhere. This is a more appropriate place, as this modifies the announced features while channels are inactive, which avoids the small interval between channel activation and the proper setting of the XDP features. Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com> Reviewed-by: William Tu <witu@nvidia.com> Link: https://patch.msgid.link/1764497617-1326331-2-git-send-email-tariqt@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 31a3ed4 commit 96a8395

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,7 @@ void mlx5e_netdev_attach_nic_profile(struct mlx5e_priv *priv);
12491249
void mlx5e_set_netdev_mtu_boundaries(struct mlx5e_priv *priv);
12501250
void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16 mtu);
12511251

1252-
void mlx5e_set_xdp_feature(struct net_device *netdev);
1252+
void mlx5e_set_xdp_feature(struct mlx5e_priv *priv);
12531253
netdev_features_t mlx5e_features_check(struct sk_buff *skb,
12541254
struct net_device *netdev,
12551255
netdev_features_t features);

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2294,7 +2294,6 @@ static int set_pflag_rx_striding_rq(struct net_device *netdev, bool enable)
22942294
struct mlx5e_priv *priv = netdev_priv(netdev);
22952295
struct mlx5_core_dev *mdev = priv->mdev;
22962296
struct mlx5e_params new_params;
2297-
int err;
22982297

22992298
if (enable) {
23002299
/* Checking the regular RQ here; mlx5e_validate_xsk_param called
@@ -2315,14 +2314,7 @@ static int set_pflag_rx_striding_rq(struct net_device *netdev, bool enable)
23152314
MLX5E_SET_PFLAG(&new_params, MLX5E_PFLAG_RX_STRIDING_RQ, enable);
23162315
mlx5e_set_rq_type(mdev, &new_params);
23172316

2318-
err = mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true);
2319-
if (err)
2320-
return err;
2321-
2322-
/* update XDP supported features */
2323-
mlx5e_set_xdp_feature(netdev);
2324-
2325-
return 0;
2317+
return mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true);
23262318
}
23272319

23282320
static int set_pflag_rx_no_csum_complete(struct net_device *netdev, bool enable)

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3365,6 +3365,7 @@ static int mlx5e_switch_priv_params(struct mlx5e_priv *priv,
33653365
}
33663366
}
33673367

3368+
mlx5e_set_xdp_feature(priv);
33683369
return 0;
33693370
}
33703371

@@ -3396,6 +3397,7 @@ static int mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
33963397
}
33973398
}
33983399

3400+
mlx5e_set_xdp_feature(priv);
33993401
if (!MLX5_CAP_GEN(priv->mdev, tis_tir_td_order))
34003402
mlx5e_close_channels(old_chs);
34013403
priv->profile->update_rx(priv);
@@ -4409,10 +4411,10 @@ static int mlx5e_handle_feature(struct net_device *netdev,
44094411
return 0;
44104412
}
44114413

4412-
void mlx5e_set_xdp_feature(struct net_device *netdev)
4414+
void mlx5e_set_xdp_feature(struct mlx5e_priv *priv)
44134415
{
4414-
struct mlx5e_priv *priv = netdev_priv(netdev);
44154416
struct mlx5e_params *params = &priv->channels.params;
4417+
struct net_device *netdev = priv->netdev;
44164418
xdp_features_t val;
44174419

44184420
if (!netdev->netdev_ops->ndo_bpf ||
@@ -4461,9 +4463,6 @@ int mlx5e_set_features(struct net_device *netdev, netdev_features_t features)
44614463
return -EINVAL;
44624464
}
44634465

4464-
/* update XDP supported features */
4465-
mlx5e_set_xdp_feature(netdev);
4466-
44674466
return 0;
44684467
}
44694468

@@ -5859,7 +5858,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
58595858
netdev->netmem_tx = true;
58605859

58615860
netif_set_tso_max_size(netdev, GSO_MAX_SIZE);
5862-
mlx5e_set_xdp_feature(netdev);
5861+
mlx5e_set_xdp_feature(priv);
58635862
mlx5e_set_netdev_dev_addr(netdev);
58645863
mlx5e_macsec_build_netdev(priv);
58655864
mlx5e_ipsec_build_netdev(priv);
@@ -5957,7 +5956,7 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
59575956

59585957
mlx5e_psp_register(priv);
59595958
/* update XDP supported features */
5960-
mlx5e_set_xdp_feature(netdev);
5959+
mlx5e_set_xdp_feature(priv);
59615960

59625961
if (take_rtnl)
59635962
rtnl_unlock();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ static void mlx5e_build_rep_params(struct net_device *netdev)
867867
if (take_rtnl)
868868
rtnl_lock();
869869
/* update XDP supported features */
870-
mlx5e_set_xdp_feature(netdev);
870+
mlx5e_set_xdp_feature(priv);
871871
if (take_rtnl)
872872
rtnl_unlock();
873873

0 commit comments

Comments
 (0)