Skip to content

Commit 073caf5

Browse files
ogerlitzSaeed Mahameed
authored andcommitted
net/mlx5e: Add sriov and udp tunnel ndo support for the uplink rep
Some of the sriov ndo calls are needed also on the switchdev mode - e.g setup VF mac and reading vport stats. Add them to the uplink rep netdev ops. Same for the UDP tunnel ones, need them there to identify offloaded udp tunnel ports. Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent b36cdb4 commit 073caf5

File tree

3 files changed

+31
-14
lines changed

3 files changed

+31
-14
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,4 +1004,16 @@ void mlx5e_build_rss_params(struct mlx5e_rss_params *rss_params,
10041004
u8 mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev);
10051005
void mlx5e_rx_dim_work(struct work_struct *work);
10061006
void mlx5e_tx_dim_work(struct work_struct *work);
1007+
1008+
void mlx5e_add_vxlan_port(struct net_device *netdev, struct udp_tunnel_info *ti);
1009+
void mlx5e_del_vxlan_port(struct net_device *netdev, struct udp_tunnel_info *ti);
1010+
netdev_features_t mlx5e_features_check(struct sk_buff *skb,
1011+
struct net_device *netdev,
1012+
netdev_features_t features);
1013+
#ifdef CONFIG_MLX5_ESWITCH
1014+
int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac);
1015+
int mlx5e_set_vf_rate(struct net_device *dev, int vf, int min_tx_rate, int max_tx_rate);
1016+
int mlx5e_get_vf_config(struct net_device *dev, int vf, struct ifla_vf_info *ivi);
1017+
int mlx5e_get_vf_stats(struct net_device *dev, int vf, struct ifla_vf_stats *vf_stats);
1018+
#endif
10071019
#endif /* __MLX5_EN_H__ */

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

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3899,7 +3899,7 @@ static int mlx5e_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
38993899
}
39003900

39013901
#ifdef CONFIG_MLX5_ESWITCH
3902-
static int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
3902+
int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
39033903
{
39043904
struct mlx5e_priv *priv = netdev_priv(dev);
39053905
struct mlx5_core_dev *mdev = priv->mdev;
@@ -3936,8 +3936,8 @@ static int mlx5e_set_vf_trust(struct net_device *dev, int vf, bool setting)
39363936
return mlx5_eswitch_set_vport_trust(mdev->priv.eswitch, vf + 1, setting);
39373937
}
39383938

3939-
static int mlx5e_set_vf_rate(struct net_device *dev, int vf, int min_tx_rate,
3940-
int max_tx_rate)
3939+
int mlx5e_set_vf_rate(struct net_device *dev, int vf, int min_tx_rate,
3940+
int max_tx_rate)
39413941
{
39423942
struct mlx5e_priv *priv = netdev_priv(dev);
39433943
struct mlx5_core_dev *mdev = priv->mdev;
@@ -3978,8 +3978,8 @@ static int mlx5e_set_vf_link_state(struct net_device *dev, int vf,
39783978
mlx5_ifla_link2vport(link_state));
39793979
}
39803980

3981-
static int mlx5e_get_vf_config(struct net_device *dev,
3982-
int vf, struct ifla_vf_info *ivi)
3981+
int mlx5e_get_vf_config(struct net_device *dev,
3982+
int vf, struct ifla_vf_info *ivi)
39833983
{
39843984
struct mlx5e_priv *priv = netdev_priv(dev);
39853985
struct mlx5_core_dev *mdev = priv->mdev;
@@ -3992,8 +3992,8 @@ static int mlx5e_get_vf_config(struct net_device *dev,
39923992
return 0;
39933993
}
39943994

3995-
static int mlx5e_get_vf_stats(struct net_device *dev,
3996-
int vf, struct ifla_vf_stats *vf_stats)
3995+
int mlx5e_get_vf_stats(struct net_device *dev,
3996+
int vf, struct ifla_vf_stats *vf_stats)
39973997
{
39983998
struct mlx5e_priv *priv = netdev_priv(dev);
39993999
struct mlx5_core_dev *mdev = priv->mdev;
@@ -4054,8 +4054,7 @@ static void mlx5e_vxlan_queue_work(struct mlx5e_priv *priv, u16 port, int add)
40544054
queue_work(priv->wq, &vxlan_work->work);
40554055
}
40564056

4057-
static void mlx5e_add_vxlan_port(struct net_device *netdev,
4058-
struct udp_tunnel_info *ti)
4057+
void mlx5e_add_vxlan_port(struct net_device *netdev, struct udp_tunnel_info *ti)
40594058
{
40604059
struct mlx5e_priv *priv = netdev_priv(netdev);
40614060

@@ -4068,8 +4067,7 @@ static void mlx5e_add_vxlan_port(struct net_device *netdev,
40684067
mlx5e_vxlan_queue_work(priv, be16_to_cpu(ti->port), 1);
40694068
}
40704069

4071-
static void mlx5e_del_vxlan_port(struct net_device *netdev,
4072-
struct udp_tunnel_info *ti)
4070+
void mlx5e_del_vxlan_port(struct net_device *netdev, struct udp_tunnel_info *ti)
40734071
{
40744072
struct mlx5e_priv *priv = netdev_priv(netdev);
40754073

@@ -4119,9 +4117,9 @@ static netdev_features_t mlx5e_tunnel_features_check(struct mlx5e_priv *priv,
41194117
return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
41204118
}
41214119

4122-
static netdev_features_t mlx5e_features_check(struct sk_buff *skb,
4123-
struct net_device *netdev,
4124-
netdev_features_t features)
4120+
netdev_features_t mlx5e_features_check(struct sk_buff *skb,
4121+
struct net_device *netdev,
4122+
netdev_features_t features)
41254123
{
41264124
struct mlx5e_priv *priv = netdev_priv(netdev);
41274125

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,13 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = {
12371237
.ndo_has_offload_stats = mlx5e_rep_has_offload_stats,
12381238
.ndo_get_offload_stats = mlx5e_rep_get_offload_stats,
12391239
.ndo_change_mtu = mlx5e_uplink_rep_change_mtu,
1240+
.ndo_udp_tunnel_add = mlx5e_add_vxlan_port,
1241+
.ndo_udp_tunnel_del = mlx5e_del_vxlan_port,
1242+
.ndo_features_check = mlx5e_features_check,
1243+
.ndo_set_vf_mac = mlx5e_set_vf_mac,
1244+
.ndo_set_vf_rate = mlx5e_set_vf_rate,
1245+
.ndo_get_vf_config = mlx5e_get_vf_config,
1246+
.ndo_get_vf_stats = mlx5e_get_vf_stats,
12401247
};
12411248

12421249
static void mlx5e_build_rep_params(struct net_device *netdev)

0 commit comments

Comments
 (0)