[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160217.234321.1202099534402079240.davem@davemloft.net>
Date: Wed, 17 Feb 2016 23:43:21 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: gregory.clement@...e-electrons.com
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
thomas.petazzoni@...e-electrons.com, f.fainelli@...il.com,
jason@...edaemon.net, andrew@...n.ch,
sebastian.hesselbarth@...il.com,
linux-arm-kernel@...ts.infradead.org, alior@...vell.com,
nadavh@...vell.com, mw@...ihalf.com, simon.guinot@...uanux.org,
linux@....linux.org.uk, w@....eu, timork@...vell.com,
nitroshift@...oo.com
Subject: Re: [PATCH v2 net-next 6/8] net: mvneta: bm: add support for
hardware buffer management
From: Gregory CLEMENT <gregory.clement@...e-electrons.com>
Date: Tue, 16 Feb 2016 16:33:41 +0100
> pp->dev = dev;
> SET_NETDEV_DEV(dev, &pdev->dev);
>
> + dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
> + dev->hw_features |= dev->features;
> + dev->vlan_features |= dev->features;
> + dev->priv_flags |= IFF_UNICAST_FLT;
> + dev->gso_max_segs = MVNETA_MAX_TSO_SEGS;
> +
> + err = register_netdev(dev);
> + if (err < 0) {
> + dev_err(&pdev->dev, "failed to register\n");
> + goto err_free_stats;
> + }
> +
> + pp->id = dev->ifindex;
> +
> + /* Obtain access to BM resources if enabled and already initialized */
> + bm_node = of_parse_phandle(dn, "buffer-manager", 0);
> + if (bm_node && bm_node->data) {
This set of changes has a lot of problems.
First, the exact moment you call register_netdev() your device must be
fully initialized because ->open() can be invoked immediately. This
means you must take care of all of this buffer manager stuff before
calling register_netdev().
It must precisely be the last thing you invoke in your probe function
for this reason.
Also you are now adding conditionalized code to every fastpath in your
driver, that is rediculous and is going to hurt performance.
Add seperate code paths for the HWBM vs SWBM, and register a unique
set of netdev_ops as appropriate.
Powered by blists - more mailing lists