From: Andrew Lunn <andrew@lunn.ch>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: davem@davemloft.net, Rob Herring <robh+dt@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
linux-arm-kernel@lists.infradead.org,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Luka Perkov <luka.perkov@sartura.hr>,
Robert Marko <robert.marko@sartura.hr>
Subject: Re: [PATCH net-next 1/5] net: ipqess: introduce the Qualcomm IPQESS driver
Date: Fri, 22 Apr 2022 22:19:43 +0200 [thread overview]
Message-ID: <YmMN37VjQNwhLDuX@lunn.ch> (raw)
In-Reply-To: <20220422180305.301882-2-maxime.chevallier@bootlin.com>
> +static int ipqess_axi_probe(struct platform_device *pdev)
> +{
> + struct device_node *np = pdev->dev.of_node;
> + struct net_device *netdev;
> + phy_interface_t phy_mode;
> + struct resource *res;
> + struct ipqess *ess;
> + int i, err = 0;
> +
> + netdev = devm_alloc_etherdev_mqs(&pdev->dev, sizeof(struct ipqess),
> + IPQESS_NETDEV_QUEUES,
> + IPQESS_NETDEV_QUEUES);
> + if (!netdev)
> + return -ENOMEM;
> +
> + ess = netdev_priv(netdev);
> + ess->netdev = netdev;
> + ess->pdev = pdev;
> + spin_lock_init(&ess->stats_lock);
> + SET_NETDEV_DEV(netdev, &pdev->dev);
> + platform_set_drvdata(pdev, netdev);
....
> +
> + ipqess_set_ethtool_ops(netdev);
> +
> + err = register_netdev(netdev);
> + if (err)
> + goto err_out;
Before register_netdev() even returns, your devices can be in use, the
open callback called and packets sent. This is particularly true for
NFS root. Which means any setup done after this is probably wrong.
> +
> + err = ipqess_hw_init(ess);
> + if (err)
> + goto err_out;
> +
> + for (i = 0; i < IPQESS_NETDEV_QUEUES; i++) {
> + int qid;
> +
> + netif_tx_napi_add(netdev, &ess->tx_ring[i].napi_tx,
> + ipqess_tx_napi, 64);
> + netif_napi_add(netdev,
> + &ess->rx_ring[i].napi_rx,
> + ipqess_rx_napi, 64);
> +
> + qid = ess->tx_ring[i].idx;
> + err = devm_request_irq(&ess->netdev->dev, ess->tx_irq[qid],
> + ipqess_interrupt_tx, 0,
> + ess->tx_irq_names[qid],
> + &ess->tx_ring[i]);
> + if (err)
> + goto err_out;
> +
> + qid = ess->rx_ring[i].idx;
> + err = devm_request_irq(&ess->netdev->dev, ess->rx_irq[qid],
> + ipqess_interrupt_rx, 0,
> + ess->rx_irq_names[qid],
> + &ess->rx_ring[i]);
> + if (err)
> + goto err_out;
> + }
All this should probably go before netdev_register().
> +static int ipqess_get_strset_count(struct net_device *netdev, int sset)
> +{
> + switch (sset) {
> + case ETH_SS_STATS:
> + return ARRAY_SIZE(ipqess_stats);
> + default:
> + netdev_dbg(netdev, "%s: Invalid string set", __func__);
Unsupported would be better than invalid.
> + return -EOPNOTSUPP;
> + }
> +}
Andrew
next prev parent reply other threads:[~2022-04-22 21:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-22 18:03 [PATCH net-next 0/5] net: ipqess: introduce Qualcomm IPQESS driver Maxime Chevallier
2022-04-22 18:03 ` [PATCH net-next 1/5] net: ipqess: introduce the " Maxime Chevallier
2022-04-22 20:19 ` Andrew Lunn [this message]
2022-04-26 13:59 ` Maxime Chevallier
2022-04-22 18:03 ` [PATCH net-next 2/5] net: dsa: add out-of-band tagging protocol Maxime Chevallier
2022-04-22 18:28 ` Florian Fainelli
2022-04-26 13:57 ` Maxime Chevallier
2022-04-26 18:52 ` Vladimir Oltean
2022-04-22 18:03 ` [PATCH net-next 3/5] net: ipqess: Add out-of-band DSA tagging support Maxime Chevallier
2022-04-22 18:03 ` [PATCH net-next 4/5] net: dt-bindings: Introduce the Qualcomm IPQESS Ethernet controller Maxime Chevallier
2022-04-22 21:10 ` Rob Herring
2022-04-23 17:49 ` Krzysztof Kozlowski
2022-04-26 14:02 ` Maxime Chevallier
2022-04-22 18:03 ` [PATCH net-next 5/5] ARM: dts: qcom: ipq4019: Add description for the " Maxime Chevallier
2022-04-22 20:29 ` [PATCH net-next 0/5] net: ipqess: introduce Qualcomm IPQESS driver Andrew Lunn
2022-04-26 12:12 ` Robert Marko
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=YmMN37VjQNwhLDuX@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=luka.perkov@sartura.hr \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=robert.marko@sartura.hr \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=vladimir.oltean@nxp.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).