diff mbox

[Vivid] net/mlx4_en: Disbale GRO for incoming loopback/selftest packets

Message ID 1435279556-29812-1-git-send-email-rafael.tinoco@canonical.com
State New
Headers show

Commit Message

Rafael David Tinoco June 26, 2015, 12:45 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1432848

Packets which are sent from the selftest (ethtool) flow,
should not be passed to GRO stack but rather dropped by
the driver after validation. To achieve that, we disable
GRO for the duration of the selftest.

Fixes: dd65beac48a5 ("net/mlx4_en: Extend usage of napi_gro_frags")
Reported-by: Carol Soto <clsoto@linux.vnet.ibm.com>
OriginalAuthor: Ido Shamay <idos@mellanox.com>
(backported from commit 1037ebbbd262227a91dfdd558159e345d4edf6b7 upstream)
Signed-off-by: Ido Shamay <idos@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Rafael David Tinoco <rafael.tinoco@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_selftest.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Brad Figg June 26, 2015, 4:30 p.m. UTC | #1
On Thu, Jun 25, 2015 at 09:45:56PM -0300, Rafael David Tinoco wrote:
> BugLink: https://bugs.launchpad.net/bugs/1432848
> 
> Packets which are sent from the selftest (ethtool) flow,
> should not be passed to GRO stack but rather dropped by
> the driver after validation. To achieve that, we disable
> GRO for the duration of the selftest.
> 
> Fixes: dd65beac48a5 ("net/mlx4_en: Extend usage of napi_gro_frags")
> Reported-by: Carol Soto <clsoto@linux.vnet.ibm.com>
> OriginalAuthor: Ido Shamay <idos@mellanox.com>
> (backported from commit 1037ebbbd262227a91dfdd558159e345d4edf6b7 upstream)
> Signed-off-by: Ido Shamay <idos@mellanox.com>
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Rafael David Tinoco <rafael.tinoco@canonical.com>
> ---
>  drivers/net/ethernet/mellanox/mlx4/en_selftest.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c
> index 2d8ee66..a61009f 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c
> @@ -81,12 +81,14 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)
>  {
>  	u32 loopback_ok = 0;
>  	int i;
> -
> +	bool gro_enabled;
>  
>          priv->loopback_ok = 0;
>  	priv->validate_loopback = 1;
> +	gro_enabled = priv->dev->features & NETIF_F_GRO;
>  
>  	mlx4_en_update_loopback_state(priv->dev, priv->dev->features);
> +	priv->dev->features &= ~NETIF_F_GRO;
>  
>  	/* xmit */
>  	if (mlx4_en_test_loopback_xmit(priv)) {
> @@ -108,6 +110,10 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)
>  mlx4_en_test_loopback_exit:
>  
>  	priv->validate_loopback = 0;
> +
> +	if (gro_enabled)
> +		priv->dev->features |= NETIF_F_GRO;
> +
>  	mlx4_en_update_loopback_state(priv->dev, priv->dev->features);
>  	return !loopback_ok;
>  }
> -- 
> 2.1.4
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

1. Clean backport.
2. Positive testing.
Chris J Arges June 26, 2015, 4:36 p.m. UTC | #2
Only affect 3.19 kernels, looks reasonable.
--chris

On Fri, Jun 26, 2015 at 09:30:56AM -0700, Brad Figg wrote:
> On Thu, Jun 25, 2015 at 09:45:56PM -0300, Rafael David Tinoco wrote:
> > BugLink: https://bugs.launchpad.net/bugs/1432848
> > 
> > Packets which are sent from the selftest (ethtool) flow,
> > should not be passed to GRO stack but rather dropped by
> > the driver after validation. To achieve that, we disable
> > GRO for the duration of the selftest.
> > 
> > Fixes: dd65beac48a5 ("net/mlx4_en: Extend usage of napi_gro_frags")
> > Reported-by: Carol Soto <clsoto@linux.vnet.ibm.com>
> > OriginalAuthor: Ido Shamay <idos@mellanox.com>
> > (backported from commit 1037ebbbd262227a91dfdd558159e345d4edf6b7 upstream)
> > Signed-off-by: Ido Shamay <idos@mellanox.com>
> > Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> > Signed-off-by: David S. Miller <davem@davemloft.net>
> > Signed-off-by: Rafael David Tinoco <rafael.tinoco@canonical.com>
> > ---
> >  drivers/net/ethernet/mellanox/mlx4/en_selftest.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c
> > index 2d8ee66..a61009f 100644
> > --- a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c
> > +++ b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c
> > @@ -81,12 +81,14 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)
> >  {
> >  	u32 loopback_ok = 0;
> >  	int i;
> > -
> > +	bool gro_enabled;
> >  
> >          priv->loopback_ok = 0;
> >  	priv->validate_loopback = 1;
> > +	gro_enabled = priv->dev->features & NETIF_F_GRO;
> >  
> >  	mlx4_en_update_loopback_state(priv->dev, priv->dev->features);
> > +	priv->dev->features &= ~NETIF_F_GRO;
> >  
> >  	/* xmit */
> >  	if (mlx4_en_test_loopback_xmit(priv)) {
> > @@ -108,6 +110,10 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)
> >  mlx4_en_test_loopback_exit:
> >  
> >  	priv->validate_loopback = 0;
> > +
> > +	if (gro_enabled)
> > +		priv->dev->features |= NETIF_F_GRO;
> > +
> >  	mlx4_en_update_loopback_state(priv->dev, priv->dev->features);
> >  	return !loopback_ok;
> >  }
> > -- 
> > 2.1.4
> > 
> > 
> > -- 
> > kernel-team mailing list
> > kernel-team@lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/kernel-team
> 
> 1. Clean backport.
> 2. Positive testing.
> 
> -- 
> Brad Figg brad.figg@canonical.com http://www.canonical.com
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
>
Seth Forshee June 26, 2015, 5 p.m. UTC | #3

Brad Figg June 27, 2015, 2:08 a.m. UTC | #4
Applied to the Vivid master-next branch.
diff mbox

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c
index 2d8ee66..a61009f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c
@@ -81,12 +81,14 @@  static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)
 {
 	u32 loopback_ok = 0;
 	int i;
-
+	bool gro_enabled;
 
         priv->loopback_ok = 0;
 	priv->validate_loopback = 1;
+	gro_enabled = priv->dev->features & NETIF_F_GRO;
 
 	mlx4_en_update_loopback_state(priv->dev, priv->dev->features);
+	priv->dev->features &= ~NETIF_F_GRO;
 
 	/* xmit */
 	if (mlx4_en_test_loopback_xmit(priv)) {
@@ -108,6 +110,10 @@  static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)
 mlx4_en_test_loopback_exit:
 
 	priv->validate_loopback = 0;
+
+	if (gro_enabled)
+		priv->dev->features |= NETIF_F_GRO;
+
 	mlx4_en_update_loopback_state(priv->dev, priv->dev->features);
 	return !loopback_ok;
 }