On Fri, Mar 23, 2018 at 03:39:13PM -0700, Saeed Mahameed wrote: > From: Inbar Karmy <inb...@mellanox.com> > > Implement set/get functions to configure PFC stall prevention > timeout by tunables api through ethtool. > By default the stall prevention timeout is configured to 8 sec. > Timeout range is: 80-8000 msec. > Enabling stall prevention without a specific timeout will set > the timeout to 100 msec.
Hi Inbar I think this last sentence should be talking about auto, not without a specific timeout. > > Signed-off-by: Inbar Karmy <inb...@mellanox.com> > Signed-off-by: Saeed Mahameed <sae...@mellanox.com> > --- > .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 57 +++++++++++++++++++ > drivers/net/ethernet/mellanox/mlx5/core/port.c | 64 > +++++++++++++++++++--- > include/linux/mlx5/mlx5_ifc.h | 17 ++++-- > include/linux/mlx5/port.h | 6 ++ > 4 files changed, 132 insertions(+), 12 deletions(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c > b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c > index cc8048f68f11..62061fd23143 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c > @@ -1066,6 +1066,57 @@ static int mlx5e_get_rxnfc(struct net_device *netdev, > return err; > } > > +#define MLX5E_PFC_PREVEN_AUTO_TOUT_MSEC 100 > +#define MLX5E_PFC_PREVEN_TOUT_MAX_MSEC 8000 > +#define MLX5E_PFC_PREVEN_MINOR_PRECENT 85 > +#define MLX5E_PFC_PREVEN_TOUT_MIN_MSEC 80 > +#define MLX5E_DEVICE_STALL_MINOR_WATERMARK(critical_tout) \ > + max_t(u16, MLX5E_PFC_PREVEN_TOUT_MIN_MSEC, \ > + (critical_tout * MLX5E_PFC_PREVEN_MINOR_PRECENT) / 100) > + > +static int mlx5e_get_pfc_prevention_tout(struct net_device *netdev, > + u16 *pfc_prevention_tout) > +{ > + struct mlx5e_priv *priv = netdev_priv(netdev); > + struct mlx5_core_dev *mdev = priv->mdev; > + > + if (!MLX5_CAP_PCAM_FEATURE((priv)->mdev, pfcc_mask) || > + !MLX5_CAP_DEBUG((priv)->mdev, stall_detect)) > + return -EOPNOTSUPP; > + > + return mlx5_query_port_stall_watermark(mdev, pfc_prevention_tout, NULL); Shouldn't you map a value of MLX5E_PFC_PREVEN_AUTO_TOUT_MSEC back to PFC_STORM_PREVENTION_AUTO? Andrew