mirror of https://gitee.com/openkylin/linux.git
net/mlx5e: Support ethtool get/set_pauseparam
Only rx/tx pause settings. Autoneg setting is currently not supported. Signed-off-by: Achiad Shochat <achiad@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6fa1bcab6b
commit
3c2d18ef22
|
@ -820,6 +820,42 @@ static int mlx5e_set_tunable(struct net_device *dev,
|
|||
return err;
|
||||
}
|
||||
|
||||
static void mlx5e_get_pauseparam(struct net_device *netdev,
|
||||
struct ethtool_pauseparam *pauseparam)
|
||||
{
|
||||
struct mlx5e_priv *priv = netdev_priv(netdev);
|
||||
struct mlx5_core_dev *mdev = priv->mdev;
|
||||
int err;
|
||||
|
||||
err = mlx5_query_port_pause(mdev, &pauseparam->rx_pause,
|
||||
&pauseparam->tx_pause);
|
||||
if (err) {
|
||||
netdev_err(netdev, "%s: mlx5_query_port_pause failed:0x%x\n",
|
||||
__func__, err);
|
||||
}
|
||||
}
|
||||
|
||||
static int mlx5e_set_pauseparam(struct net_device *netdev,
|
||||
struct ethtool_pauseparam *pauseparam)
|
||||
{
|
||||
struct mlx5e_priv *priv = netdev_priv(netdev);
|
||||
struct mlx5_core_dev *mdev = priv->mdev;
|
||||
int err;
|
||||
|
||||
if (pauseparam->autoneg)
|
||||
return -EINVAL;
|
||||
|
||||
err = mlx5_set_port_pause(mdev,
|
||||
pauseparam->rx_pause ? 1 : 0,
|
||||
pauseparam->tx_pause ? 1 : 0);
|
||||
if (err) {
|
||||
netdev_err(netdev, "%s: mlx5_set_port_pause failed:0x%x\n",
|
||||
__func__, err);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
const struct ethtool_ops mlx5e_ethtool_ops = {
|
||||
.get_drvinfo = mlx5e_get_drvinfo,
|
||||
.get_link = ethtool_op_get_link,
|
||||
|
@ -841,4 +877,6 @@ const struct ethtool_ops mlx5e_ethtool_ops = {
|
|||
.get_rxnfc = mlx5e_get_rxnfc,
|
||||
.get_tunable = mlx5e_get_tunable,
|
||||
.set_tunable = mlx5e_set_tunable,
|
||||
.get_pauseparam = mlx5e_get_pauseparam,
|
||||
.set_pauseparam = mlx5e_set_pauseparam,
|
||||
};
|
||||
|
|
|
@ -334,3 +334,45 @@ int mlx5_query_port_vl_hw_cap(struct mlx5_core_dev *dev,
|
|||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_query_port_vl_hw_cap);
|
||||
|
||||
int mlx5_set_port_pause(struct mlx5_core_dev *dev, u32 rx_pause, u32 tx_pause)
|
||||
{
|
||||
u32 in[MLX5_ST_SZ_DW(pfcc_reg)];
|
||||
u32 out[MLX5_ST_SZ_DW(pfcc_reg)];
|
||||
int err;
|
||||
|
||||
memset(in, 0, sizeof(in));
|
||||
MLX5_SET(pfcc_reg, in, local_port, 1);
|
||||
MLX5_SET(pfcc_reg, in, pptx, tx_pause);
|
||||
MLX5_SET(pfcc_reg, in, pprx, rx_pause);
|
||||
|
||||
err = mlx5_core_access_reg(dev, in, sizeof(in), out,
|
||||
sizeof(out), MLX5_REG_PFCC, 0, 1);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_set_port_pause);
|
||||
|
||||
int mlx5_query_port_pause(struct mlx5_core_dev *dev,
|
||||
u32 *rx_pause, u32 *tx_pause)
|
||||
{
|
||||
u32 in[MLX5_ST_SZ_DW(pfcc_reg)];
|
||||
u32 out[MLX5_ST_SZ_DW(pfcc_reg)];
|
||||
int err;
|
||||
|
||||
memset(in, 0, sizeof(in));
|
||||
MLX5_SET(pfcc_reg, in, local_port, 1);
|
||||
|
||||
err = mlx5_core_access_reg(dev, in, sizeof(in), out,
|
||||
sizeof(out), MLX5_REG_PFCC, 0, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (rx_pause)
|
||||
*rx_pause = MLX5_GET(pfcc_reg, out, pprx);
|
||||
|
||||
if (tx_pause)
|
||||
*tx_pause = MLX5_GET(pfcc_reg, out, pptx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mlx5_query_port_pause);
|
||||
|
|
|
@ -103,6 +103,7 @@ enum {
|
|||
MLX5_REG_PMTU = 0x5003,
|
||||
MLX5_REG_PTYS = 0x5004,
|
||||
MLX5_REG_PAOS = 0x5006,
|
||||
MLX5_REG_PFCC = 0x5007,
|
||||
MLX5_REG_PPCNT = 0x5008,
|
||||
MLX5_REG_PMAOS = 0x5012,
|
||||
MLX5_REG_PUDE = 0x5009,
|
||||
|
@ -774,6 +775,10 @@ void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, int *oper_mtu,
|
|||
int mlx5_query_port_vl_hw_cap(struct mlx5_core_dev *dev,
|
||||
u8 *vl_hw_cap, u8 local_port);
|
||||
|
||||
int mlx5_set_port_pause(struct mlx5_core_dev *dev, u32 rx_pause, u32 tx_pause);
|
||||
int mlx5_query_port_pause(struct mlx5_core_dev *dev,
|
||||
u32 *rx_pause, u32 *tx_pause);
|
||||
|
||||
int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
|
||||
void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
|
||||
int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
|
||||
|
|
Loading…
Reference in New Issue