From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: "Clément Léger" <clement.leger@bootlin.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
Andrew Lunn <andrew@lunn.ch>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Denis Kirjanov <dkirjanov@suse.de>,
Julian Wiedmann <jwi@linux.ibm.com>
Subject: Re: [PATCH net-next v4 4/4] net: ocelot: add FDMA support
Date: Sat, 4 Dec 2021 11:51:52 +0000 [thread overview]
Message-ID: <20211204115151.6na4cb3tspxbtt36@skbuf> (raw)
In-Reply-To: <20211204075206.0f942fb1@fixe.home>
On Sat, Dec 04, 2021 at 07:52:06AM +0100, Clément Léger wrote:
> > +void ocelot_fdma_netdev_init(struct ocelot *ocelot, struct net_device *dev)
> > +{
> > + struct ocelot_fdma *fdma = ocelot->fdma;
> > +
> > + dev->needed_headroom = OCELOT_TAG_LEN;
> > + dev->needed_tailroom = ETH_FCS_LEN;
> > +
> > + if (fdma->napi_init)
> > + return;
> > +
> > + fdma->napi_init = true;
> > + netif_napi_add(dev, &ocelot->napi, ocelot_fdma_napi_poll,
> > + OCELOT_FDMA_WEIGHT);
> > +}
> > +
> > +void ocelot_fdma_netdev_deinit(struct ocelot *ocelot, struct net_device *dev)
> > +{
> > + struct ocelot_fdma *fdma = ocelot->fdma;
> > +
> > + if (fdma->napi_init) {
> > + netif_napi_del(&ocelot->napi);
> > + fdma->napi_init = false;
> > + }
>
> Using a boolean is acutally a bad idea, if the last netdev
> registration fails in ocelot, then the napi context will be deleted.
> The net_device should actually be used.
I think that you could try to call netif_napi_del() only if dev == napi->dev.
Because, as you say, if the NAPI structure has been added to the first
net device, and the registration of subsequent net devices fails, that
NAPI might actually even be in use by now, we should not disturb it.
next prev parent reply other threads:[~2021-12-04 11:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-03 17:19 [PATCH net-next v4 0/4] Add FDMA support on ocelot switch driver Clément Léger
2021-12-03 17:19 ` [PATCH net-next v4 1/4] net: ocelot: export ocelot_ifh_port_set() to setup IFH Clément Léger
2021-12-04 13:08 ` Vladimir Oltean
2021-12-03 17:19 ` [PATCH net-next v4 2/4] net: ocelot: add and export ocelot_ptp_rx_timestamp() Clément Léger
2021-12-04 13:45 ` Vladimir Oltean
2021-12-03 17:19 ` [PATCH net-next v4 3/4] net: ocelot: add support for ndo_change_mtu Clément Léger
2021-12-04 13:45 ` Vladimir Oltean
2021-12-03 17:19 ` [PATCH net-next v4 4/4] net: ocelot: add FDMA support Clément Léger
2021-12-04 6:52 ` Clément Léger
2021-12-04 11:51 ` Vladimir Oltean [this message]
2021-12-04 13:43 ` Vladimir Oltean
2021-12-06 9:28 ` Clément Léger
2021-12-06 17:07 ` Vladimir Oltean
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=20211204115151.6na4cb3tspxbtt36@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=clement.leger@bootlin.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dkirjanov@suse.de \
--cc=jwi@linux.ibm.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/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).