Patchwork net: mvneta: enable features before registering the driver

login
register
mail settings
Submitter willy tarreau
Date April 6, 2013, 6:47 p.m.
Message ID <20130406184701.GA16142@1wt.eu>
Download mbox | patch
Permalink /patch/234451/
State Accepted
Delegated to: David Miller
Headers show

Comments

willy tarreau - April 6, 2013, 6:47 p.m.
Hi,

I noticed that mvneta's tx-csum/sg were off until disabled then
enabled, which led me to think that something was not made in the
correct sequence. And indeed, setting the dev features _before_
registering the device works much better :-)

This patch is for master but may be backported to 3.8-stable as well,
which is where I first experienced the issue.

Thanks,
Willy

From 005eb7594a4304eed5e9b427ca6b745260c9eded Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w@1wt.eu>
Date: Mon, 11 Mar 2013 07:56:58 +0100
Subject: [PATCH] net: mvneta: enable features before registering the driver,
 not after

It seems that the reason why the dev features were ignored was because
they were enabled after registeration.

Signed-off-by: Willy Tarreau <w@1wt.eu>
---
 drivers/net/ethernet/marvell/mvneta.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Thomas Petazzoni - April 7, 2013, 10:11 a.m.
Dear Willy Tarreau,

On Sat, 6 Apr 2013 20:47:01 +0200, Willy Tarreau wrote:

> From 005eb7594a4304eed5e9b427ca6b745260c9eded Mon Sep 17 00:00:00 2001
> From: Willy Tarreau <w@1wt.eu>
> Date: Mon, 11 Mar 2013 07:56:58 +0100
> Subject: [PATCH] net: mvneta: enable features before registering the
> driver, not after
> 
> It seems that the reason why the dev features were ignored was because
> they were enabled after registeration.
> 
> Signed-off-by: Willy Tarreau <w@1wt.eu>

Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
David Miller - April 8, 2013, 4:16 p.m.
From: Willy Tarreau <w@1wt.eu>
Date: Sat, 6 Apr 2013 20:47:01 +0200

> Hi,
> 
> I noticed that mvneta's tx-csum/sg were off until disabled then
> enabled, which led me to think that something was not made in the
> correct sequence. And indeed, setting the dev features _before_
> registering the device works much better :-)
> 
> This patch is for master but may be backported to 3.8-stable as well,
> which is where I first experienced the issue.

Please don't post patches like this, you make extra work for the
maintainer by having to edit out this commentary.

You put such commentary after the "---" seperator the delineates
your commit message in the email body, not before.

Anyways, applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
willy tarreau - April 9, 2013, 5:46 a.m.
On Mon, Apr 08, 2013 at 12:16:04PM -0400, David Miller wrote:
> From: Willy Tarreau <w@1wt.eu>
> Date: Sat, 6 Apr 2013 20:47:01 +0200
> 
> > Hi,
> > 
> > I noticed that mvneta's tx-csum/sg were off until disabled then
> > enabled, which led me to think that something was not made in the
> > correct sequence. And indeed, setting the dev features _before_
> > registering the device works much better :-)
> > 
> > This patch is for master but may be backported to 3.8-stable as well,
> > which is where I first experienced the issue.
> 
> Please don't post patches like this, you make extra work for the
> maintainer by having to edit out this commentary.
> 
> You put such commentary after the "---" seperator the delineates
> your commit message in the email body, not before.

Sorry for this David, I'll take care of this next time.

> Anyways, applied.

Thank you.

Willy

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index cd345b8..1e628ce 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2771,16 +2771,17 @@  static int mvneta_probe(struct platform_device *pdev)
 
 	netif_napi_add(dev, &pp->napi, mvneta_poll, pp->weight);
 
+	dev->features = NETIF_F_SG | NETIF_F_IP_CSUM;
+	dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM;
+	dev->vlan_features |= NETIF_F_SG | NETIF_F_IP_CSUM;
+	dev->priv_flags |= IFF_UNICAST_FLT;
+
 	err = register_netdev(dev);
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to register\n");
 		goto err_deinit;
 	}
 
-	dev->features = NETIF_F_SG | NETIF_F_IP_CSUM;
-	dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM;
-	dev->priv_flags |= IFF_UNICAST_FLT;
-
 	netdev_info(dev, "mac: %pM\n", dev->dev_addr);
 
 	platform_set_drvdata(pdev, pp->dev);