From: Jakub Kicinski <kuba@kernel.org>
To: Lukasz Majewski <lukma@denx.de>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
davem@davemloft.net, Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Richard Cochran <richardcochran@gmail.com>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
Stefan Wahren <wahrenst@gmx.net>, Simon Horman <horms@kernel.org>
Subject: Re: [net-next v16 06/12] net: mtip: Add net_device_ops functions to the L2 switch driver
Date: Fri, 25 Jul 2025 15:16:18 -0700 [thread overview]
Message-ID: <20250725151618.0bc84bdb@kernel.org> (raw)
In-Reply-To: <20250724223318.3068984-7-lukma@denx.de>
On Fri, 25 Jul 2025 00:33:12 +0200 Lukasz Majewski wrote:
> +static void swap_buffer(void *bufaddr, int len)
> +{
> + int i;
> + unsigned int *buf = bufaddr;
> +
nit: reverse xmas tree
> + if (status & BD_ENET_TX_READY) {
> + /* All transmit buffers are full. Bail out.
> + * This should not happen, since dev->tbusy should be set.
> + */
> + netif_stop_queue(dev);
> + dev_err_ratelimited(&fep->pdev->dev, "%s: tx queue full!.\n",
> + dev->name);
> + spin_unlock(&fep->hw_lock);
As we discussed on previous revision you have many to one mapping
of netdevs to queues. I think the warning should only be printed
if the drivers is in "single netdev" mode. Otherwise it _will_
trigger.
BTW you should put the print after the unlock, console writes are slow.
> +static void mtip_timeout(struct net_device *dev, unsigned int txqueue)
> +{
> + struct mtip_ndev_priv *priv = netdev_priv(dev);
> + struct switch_enet_private *fep = priv->fep;
> + struct cbd_t *bdp;
> + int i;
> +
> + dev->stats.tx_errors++;
> +
> + if (IS_ENABLED(CONFIG_SWITCH_DEBUG)) {
why are you hiding the debug info under a CONFIG_ ?
(which BTW appears not to be defined at all)
Seems useful to know the state of the HW when the queue hung.
You can use a DO_ONCE() if you want to avoid spamming logs
> + /* Set buffer length and buffer pointer */
> + bufaddr = skb->data;
You should call skb_cow_data() if you want to write to the skb data.
> +static void mtip_timeout(struct net_device *dev, unsigned int txqueue)
> +{
> + struct mtip_ndev_priv *priv = netdev_priv(dev);
> + struct switch_enet_private *fep = priv->fep;
> + struct cbd_t *bdp;
> + int i;
> +
> + dev->stats.tx_errors++;
timeouts are already counted by the stack, I think the statistic
is exposed per-queue in sysfs
> + spin_lock_bh(&fep->hw_lock);
> + dev_info(&dev->dev, "%s: transmit timed out.\n", dev->name);
> + dev_info(&dev->dev,
> + "Ring data: cur_tx %lx%s, dirty_tx %lx cur_rx: %lx\n",
> + (unsigned long)fep->cur_tx,
> + fep->tx_full ? " (full)" : "",
> + (unsigned long)fep->dirty_tx,
> + (unsigned long)fep->cur_rx);
> +
> + bdp = fep->tx_bd_base;
> + dev_info(&dev->dev, " tx: %u buffers\n", TX_RING_SIZE);
> + for (i = 0; i < TX_RING_SIZE; i++) {
> + dev_info(&dev->dev, " %08lx: %04x %04x %08x\n",
> + (kernel_ulong_t)bdp, bdp->cbd_sc,
> + bdp->cbd_datlen, (int)bdp->cbd_bufaddr);
> + bdp++;
> + }
> +
> + bdp = fep->rx_bd_base;
> + dev_info(&dev->dev, " rx: %lu buffers\n",
> + (unsigned long)RX_RING_SIZE);
> + for (i = 0 ; i < RX_RING_SIZE; i++) {
> + dev_info(&dev->dev, " %08lx: %04x %04x %08x\n",
> + (kernel_ulong_t)bdp,
> + bdp->cbd_sc, bdp->cbd_datlen,
> + (int)bdp->cbd_bufaddr);
> + bdp++;
> + }
> + spin_unlock_bh(&fep->hw_lock);
next prev parent reply other threads:[~2025-07-25 22:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 22:33 [net-next v16 00/12] net: mtip: Add support for MTIP imx287 L2 switch driver Lukasz Majewski
2025-07-24 22:33 ` [net-next v16 01/12] dt-bindings: net: Add MTIP L2 switch description Lukasz Majewski
2025-07-24 22:33 ` [net-next v16 02/12] ARM: dts: nxp: mxs: Adjust the imx28.dtsi " Lukasz Majewski
2025-07-24 22:33 ` [net-next v16 03/12] ARM: dts: nxp: mxs: Adjust XEA board's DTS to support L2 switch Lukasz Majewski
2025-07-24 22:33 ` [net-next v16 04/12] net: mtip: The L2 switch driver for imx287 Lukasz Majewski
2025-07-25 22:18 ` Jakub Kicinski
2025-07-26 20:13 ` Lukasz Majewski
2025-07-26 20:38 ` Jakub Kicinski
2025-07-27 8:05 ` Lukasz Majewski
2025-07-24 22:33 ` [net-next v16 05/12] net: mtip: Add buffers management functions to the L2 switch driver Lukasz Majewski
2025-07-24 22:33 ` [net-next v16 06/12] net: mtip: Add net_device_ops " Lukasz Majewski
2025-07-25 15:54 ` Simon Horman
2025-07-25 17:27 ` Lukasz Majewski
2025-07-25 22:16 ` Jakub Kicinski [this message]
2025-07-26 21:09 ` Lukasz Majewski
2025-07-24 22:33 ` [net-next v16 07/12] net: mtip: Add mtip_switch_{rx|tx} " Lukasz Majewski
2025-07-24 22:33 ` [net-next v16 08/12] net: mtip: Extend the L2 switch driver with management operations Lukasz Majewski
2025-07-24 22:33 ` [net-next v16 09/12] net: mtip: Extend the L2 switch driver for imx287 with bridge operations Lukasz Majewski
2025-07-24 22:33 ` [net-next v16 10/12] ARM: mxs_defconfig: Enable CONFIG_NFS_FSCACHE Lukasz Majewski
2025-07-24 22:33 ` [net-next v16 11/12] ARM: mxs_defconfig: Update mxs_defconfig to 6.16-rc5 Lukasz Majewski
2025-07-24 22:33 ` [net-next v16 12/12] ARM: mxs_defconfig: Enable CONFIG_FEC_MTIP_L2SW to support MTIP L2 switch Lukasz Majewski
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=20250725151618.0bc84bdb@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=festevam@gmail.com \
--cc=horms@kernel.org \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukma@denx.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=wahrenst@gmx.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.