From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vps0.lunn.ch ([185.16.172.187]:41080 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752048AbeCXPHL (ORCPT ); Sat, 24 Mar 2018 11:07:11 -0400 Date: Sat, 24 Mar 2018 16:07:09 +0100 From: Andrew Lunn To: Saeed Mahameed Cc: "David S. Miller" , netdev@vger.kernel.org, Inbar Karmy Subject: Re: [net-next 03/15] net/mlx5e: PFC stall prevention support Message-ID: <20180324150709.GD31941@lunn.ch> References: <20180323223925.21678-1-saeedm@mellanox.com> <20180323223925.21678-4-saeedm@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180323223925.21678-4-saeedm@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: On Fri, Mar 23, 2018 at 03:39:13PM -0700, Saeed Mahameed wrote: > From: Inbar Karmy > > 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 > Signed-off-by: Saeed Mahameed > --- > .../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