netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Amir Vadai <amirv@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Eugenia Emantayev <eugenia@mellanox.com>
Subject: Re: [PATCH net-next V1 1/4] net/mlx4_en: Disable global flow control when PFC enabled
Date: Tue, 20 Aug 2013 09:58:00 -0700	[thread overview]
Message-ID: <1377017880.2016.49.camel@joe-AO722> (raw)
In-Reply-To: <1377013369-14711-2-git-send-email-amirv@mellanox.com>

On Tue, 2013-08-20 at 18:42 +0300, Amir Vadai wrote:
> Fix a bug when FC and PFC are enabled/disabled at the same time.
> According to ConnectX-3 Programmer Manual these two features are mutial
> exclusive.  So make sure when enabling PFC to turn off global FC and
> vise versa.  Otherwise it hurts the performance.
[]
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
> index 9d4a1ea..fcef764 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
> @@ -169,7 +169,8 @@ static int mlx4_en_dcbnl_ieee_setpfc(struct net_device *dev,
>  			pfc->mbc,
>  			pfc->delay);
>  
> -	priv->prof->rx_pause = priv->prof->tx_pause = !!pfc->pfc_en;
> +	priv->prof->rx_pause = !pfc->pfc_en;
> +	priv->prof->tx_pause = !pfc->pfc_en;
>  	priv->prof->rx_ppp = priv->prof->tx_ppp = pfc->pfc_en;

Just do the minimal change.

Otherwise, because you're using separate sets for the
pause vars I think you should change the line below as
well so a single style is used.

Maybe I'd just go ahead and use a temporary for prof too.
---
 drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
index 9d4a1ea..45894c6 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
@@ -161,6 +161,7 @@ static int mlx4_en_dcbnl_ieee_setpfc(struct net_device *dev,
 {
 	struct mlx4_en_priv *priv = netdev_priv(dev);
 	struct mlx4_en_dev *mdev = priv->mdev;
+	struct mlx4_en_port_profile *prof = priv->prof;
 	int err;
 
 	en_dbg(DRV, priv, "cap: 0x%x en: 0x%x mbc: 0x%x delay: %d\n",
@@ -169,15 +170,17 @@ static int mlx4_en_dcbnl_ieee_setpfc(struct net_device *dev,
 			pfc->mbc,
 			pfc->delay);
 
-	priv->prof->rx_pause = priv->prof->tx_pause = !!pfc->pfc_en;
-	priv->prof->rx_ppp = priv->prof->tx_ppp = pfc->pfc_en;
+	prof->rx_pause = !pfc->pfc_en;
+	prof->tx_pause = !pfc->pfc_en;
+	prof->rx_ppp = pfc->pfc_en;
+	prof->tx_ppp = pfc->pfc_en;
 
 	err = mlx4_SET_PORT_general(mdev->dev, priv->port,
 				    priv->rx_skb_size + ETH_FCS_LEN,
-				    priv->prof->tx_pause,
-				    priv->prof->tx_ppp,
-				    priv->prof->rx_pause,
-				    priv->prof->rx_ppp);
+				    prof->tx_pause,
+				    prof->tx_ppp,
+				    prof->rx_pause,
+				    prof->rx_ppp);
 	if (err)
 		en_err(priv, "Failed setting pause params\n");
 

  reply	other threads:[~2013-08-20 16:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20 15:42 [PATCH net-next V1 0/4] Mellanox driver updates 2013-08-19 Amir Vadai
2013-08-20 15:42 ` [PATCH net-next V1 1/4] net/mlx4_en: Disable global flow control when PFC enabled Amir Vadai
2013-08-20 16:58   ` Joe Perches [this message]
2013-08-21  7:10     ` Amir Vadai
2013-08-20 15:42 ` [PATCH net-next V1 2/4] net/mlx4_en: Notify user when TX ring in error state Amir Vadai
2013-08-20 15:42 ` [PATCH net-next V1 3/4] net/mlx4_en: Fix handling of dma_map failure Amir Vadai
2013-08-20 15:42 ` [PATCH net-next V1 4/4] net/mlx4_en: Reduce scope of local variables in mlx4_en_xmit Amir Vadai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1377017880.2016.49.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=amirv@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=eugenia@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).