net/mlx5e: Support configurable MTU for vport representors
The representor MTU was hard coded to 1500 bytes. Allow setting arbitrary MTU values up to the max supported by the FW. Signed-off-by: Adi Nissim <adin@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
93edcb3a75
commit
250a42b6a7
@ -1102,6 +1102,10 @@ void mlx5e_update_stats_work(struct work_struct *work);
|
|||||||
|
|
||||||
int mlx5e_bits_invert(unsigned long a, int size);
|
int mlx5e_bits_invert(unsigned long a, int size);
|
||||||
|
|
||||||
|
typedef int (*change_hw_mtu_cb)(struct mlx5e_priv *priv);
|
||||||
|
int mlx5e_change_mtu(struct net_device *netdev, int new_mtu,
|
||||||
|
change_hw_mtu_cb set_mtu_cb);
|
||||||
|
|
||||||
/* ethtool helpers */
|
/* ethtool helpers */
|
||||||
void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv,
|
void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv,
|
||||||
struct ethtool_drvinfo *drvinfo);
|
struct ethtool_drvinfo *drvinfo);
|
||||||
|
@ -3495,7 +3495,8 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
|
|||||||
return features;
|
return features;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu)
|
int mlx5e_change_mtu(struct net_device *netdev, int new_mtu,
|
||||||
|
change_hw_mtu_cb set_mtu_cb)
|
||||||
{
|
{
|
||||||
struct mlx5e_priv *priv = netdev_priv(netdev);
|
struct mlx5e_priv *priv = netdev_priv(netdev);
|
||||||
struct mlx5e_channels new_channels = {};
|
struct mlx5e_channels new_channels = {};
|
||||||
@ -3522,7 +3523,7 @@ static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu)
|
|||||||
|
|
||||||
if (!reset) {
|
if (!reset) {
|
||||||
params->sw_mtu = new_mtu;
|
params->sw_mtu = new_mtu;
|
||||||
mlx5e_set_dev_port_mtu(priv);
|
set_mtu_cb(priv);
|
||||||
netdev->mtu = params->sw_mtu;
|
netdev->mtu = params->sw_mtu;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -3531,7 +3532,7 @@ static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu)
|
|||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
mlx5e_switch_priv_channels(priv, &new_channels, mlx5e_set_dev_port_mtu);
|
mlx5e_switch_priv_channels(priv, &new_channels, set_mtu_cb);
|
||||||
netdev->mtu = new_channels.params.sw_mtu;
|
netdev->mtu = new_channels.params.sw_mtu;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@ -3539,6 +3540,11 @@ out:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mlx5e_change_nic_mtu(struct net_device *netdev, int new_mtu)
|
||||||
|
{
|
||||||
|
return mlx5e_change_mtu(netdev, new_mtu, mlx5e_set_dev_port_mtu);
|
||||||
|
}
|
||||||
|
|
||||||
int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
|
int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
|
||||||
{
|
{
|
||||||
struct hwtstamp_config config;
|
struct hwtstamp_config config;
|
||||||
@ -4033,7 +4039,7 @@ static const struct net_device_ops mlx5e_netdev_ops = {
|
|||||||
.ndo_vlan_rx_kill_vid = mlx5e_vlan_rx_kill_vid,
|
.ndo_vlan_rx_kill_vid = mlx5e_vlan_rx_kill_vid,
|
||||||
.ndo_set_features = mlx5e_set_features,
|
.ndo_set_features = mlx5e_set_features,
|
||||||
.ndo_fix_features = mlx5e_fix_features,
|
.ndo_fix_features = mlx5e_fix_features,
|
||||||
.ndo_change_mtu = mlx5e_change_mtu,
|
.ndo_change_mtu = mlx5e_change_nic_mtu,
|
||||||
.ndo_do_ioctl = mlx5e_ioctl,
|
.ndo_do_ioctl = mlx5e_ioctl,
|
||||||
.ndo_set_tx_maxrate = mlx5e_set_tx_maxrate,
|
.ndo_set_tx_maxrate = mlx5e_set_tx_maxrate,
|
||||||
.ndo_udp_tunnel_add = mlx5e_add_vxlan_port,
|
.ndo_udp_tunnel_add = mlx5e_add_vxlan_port,
|
||||||
|
@ -900,6 +900,11 @@ static const struct switchdev_ops mlx5e_rep_switchdev_ops = {
|
|||||||
.switchdev_port_attr_get = mlx5e_attr_get,
|
.switchdev_port_attr_get = mlx5e_attr_get,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int mlx5e_change_rep_mtu(struct net_device *netdev, int new_mtu)
|
||||||
|
{
|
||||||
|
return mlx5e_change_mtu(netdev, new_mtu, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct net_device_ops mlx5e_netdev_ops_rep = {
|
static const struct net_device_ops mlx5e_netdev_ops_rep = {
|
||||||
.ndo_open = mlx5e_rep_open,
|
.ndo_open = mlx5e_rep_open,
|
||||||
.ndo_stop = mlx5e_rep_close,
|
.ndo_stop = mlx5e_rep_close,
|
||||||
@ -909,6 +914,7 @@ static const struct net_device_ops mlx5e_netdev_ops_rep = {
|
|||||||
.ndo_get_stats64 = mlx5e_rep_get_stats,
|
.ndo_get_stats64 = mlx5e_rep_get_stats,
|
||||||
.ndo_has_offload_stats = mlx5e_has_offload_stats,
|
.ndo_has_offload_stats = mlx5e_has_offload_stats,
|
||||||
.ndo_get_offload_stats = mlx5e_get_offload_stats,
|
.ndo_get_offload_stats = mlx5e_get_offload_stats,
|
||||||
|
.ndo_change_mtu = mlx5e_change_rep_mtu,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev,
|
static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev,
|
||||||
@ -935,6 +941,10 @@ static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev,
|
|||||||
|
|
||||||
static void mlx5e_build_rep_netdev(struct net_device *netdev)
|
static void mlx5e_build_rep_netdev(struct net_device *netdev)
|
||||||
{
|
{
|
||||||
|
struct mlx5e_priv *priv = netdev_priv(netdev);
|
||||||
|
struct mlx5_core_dev *mdev = priv->mdev;
|
||||||
|
u16 max_mtu;
|
||||||
|
|
||||||
netdev->netdev_ops = &mlx5e_netdev_ops_rep;
|
netdev->netdev_ops = &mlx5e_netdev_ops_rep;
|
||||||
|
|
||||||
netdev->watchdog_timeo = 15 * HZ;
|
netdev->watchdog_timeo = 15 * HZ;
|
||||||
@ -947,6 +957,10 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
|
|||||||
netdev->hw_features |= NETIF_F_HW_TC;
|
netdev->hw_features |= NETIF_F_HW_TC;
|
||||||
|
|
||||||
eth_hw_addr_random(netdev);
|
eth_hw_addr_random(netdev);
|
||||||
|
|
||||||
|
netdev->min_mtu = ETH_MIN_MTU;
|
||||||
|
mlx5_query_port_max_mtu(mdev, &max_mtu, 1);
|
||||||
|
netdev->max_mtu = MLX5E_HW2SW_MTU(&priv->channels.params, max_mtu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mlx5e_init_rep(struct mlx5_core_dev *mdev,
|
static void mlx5e_init_rep(struct mlx5_core_dev *mdev,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user