From: Jakub Kicinski <kuba@kernel.org>
To: nagadheeraj.rottela@amd.com
Cc: Jakub Kicinski <kuba@kernel.org>,
srinivas.neeli@amd.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
richardcochran@gmail.com, michal.simek@amd.com, andrew@lunn.ch,
olteanv@gmail.com, horms@kernel.org, linux@armlinux.org.uk,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, git-dev@amd.com
Subject: Re: [PATCH 05/20] net: xilinx: tsn: bring up the endpoint MCDMA channels
Date: Sat, 8 Aug 2026 12:48:21 -0700 [thread overview]
Message-ID: <20260808194821.132723-1-kuba@kernel.org> (raw)
In-Reply-To: <20260807104431.157230-6-nagadheeraj.rottela@amd.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
net: xilinx: tsn: bring up the endpoint MCDMA channels
This patch requests the TX and RX MCDMA channels named in the device tree
when the endpoint interface is opened, gives each channel a ring of
preallocated SKB descriptor slots, resets the controller through tx_chan0,
and releases the channels on stop. It also adds a XILINX_DMA dependency to
the Kconfig entry.
No Link: tags are present in the commit header.
> diff --git a/drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ep.c b/drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ep.c
> index 062cb94c2153..fa21d59ade16 100644
> --- a/drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ep.c
> +++ b/drivers/net/ethernet/xilinx/tsn/xilinx_tsn_ep.c
[ ... ]
> @@ -59,8 +122,27 @@ static netdev_tx_t ep_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> return NETDEV_TX_OK;
> }
>
> +static int ep_reset_dma_controller(struct xlnx_tsn_ep *ep);
> +static int ep_init_dmaengine(struct xlnx_tsn_ep *ep);
> +static void ep_exit_dmaengine(struct xlnx_tsn_ep *ep);
> +
> static int ep_open(struct net_device *ndev)
> {
> + struct xlnx_tsn_ep *ep = netdev_priv(ndev);
> + int ret;
> +
> + WRITE_ONCE(ep->closing, false);
> +
> + ret = ep_reset_dma_controller(ep);
> + if (ret)
> + return ret;
> +
> + ret = ep_init_dmaengine(ep);
> + if (ret) {
> + netdev_err(ndev, "failed to initialize DMA engine\n");
> + return ret;
> + }
> +
> netif_tx_start_all_queues(ndev);
>
> return 0;
[ ... ]
> @@ -90,6 +176,194 @@ static const struct ethtool_ops ep_ethtool_ops = {
> .get_drvinfo = ep_get_drvinfo,
> };
>
> +static struct xlnx_tsn_ep_dma_chan *
> +ep_alloc_dma_chan(struct xlnx_tsn_ep *ep, const char *name, bool is_tx,
> + int ring_size)
> +{
> + struct xlnx_tsn_ep_dma_chan *chan;
> + struct dma_chan *err_chan;
> + int i;
> +
> + chan = kzalloc_obj(*chan);
> + if (!chan)
> + return ERR_PTR(-ENOMEM);
> +
> + chan->chan = dma_request_chan(ep->dev, name);
> + if (IS_ERR(chan->chan)) {
> + err_chan = chan->chan;
> + kfree(chan);
> + return ERR_CAST(err_chan);
> + }
> +
[ ... ]
> +static int ep_init_dmaengine(struct xlnx_tsn_ep *ep)
> +{
> + int tx_allocated = 0, rx_allocated = 0;
> + char name[16];
> + int i, ret;
> +
[ ... ]
> + for (i = 0; i < ep->num_tx_queues; i++) {
> + snprintf(name, sizeof(name), "tx_chan%d", i);
> + ep->tx_chans[i] = ep_alloc_dma_chan(ep, name, true,
> + TX_BD_NUM_DEFAULT);
> + if (IS_ERR(ep->tx_chans[i])) {
> + ret = PTR_ERR(ep->tx_chans[i]);
> + ep->tx_chans[i] = NULL;
> + goto err_free_chans;
> + }
> + tx_allocated++;
> + }
> +
> + for (i = 0; i < ep->num_rx_queues; i++) {
> + snprintf(name, sizeof(name), "rx_chan%d", i);
> + ep->rx_chans[i] = ep_alloc_dma_chan(ep, name, false,
> + RX_BD_NUM_DEFAULT);
[Severity: Medium]
The channel names are re-invented here as a dense 0..N-1 sequence, but is
that what the binding in this series promises?
The dma-names schema in
Documentation/devicetree/bindings/net/xlnx,tsn-endpoint-ethernet-mac.yaml
allows any subset of tx_chan0..15 / rx_chan0..15:
dma-names:
minItems: 2
maxItems: 32
items:
pattern: "^(tx|rx)_chan(1[0-5]|[0-9])$"
and ep_count_dma_queues() only counts the prefixes, discarding the indices:
if (str_has_prefix(name, "tx_chan"))
tx++;
else if (str_has_prefix(name, "rx_chan"))
rx++;
So for a device tree that validates against the binding, for example
dma-names = "tx_chan2", "tx_chan3", "rx_chan4", "rx_chan5";
probe succeeds, but ep_open()->ep_reset_dma_controller() asks for a channel
literally named "tx_chan0" and ep_init_dmaengine() asks for "tx_chan0" and
"tx_chan1". Does dma_request_chan() not return -ENODEV in that case,
leaving the interface impossible to bring up?
There is a second mismatch in the other direction: the binding permits up to
16 tx_chan entries, while ep_count_dma_queues() rejects anything above
TSN_MAX_TX_QUEUE (8) with -EINVAL at probe.
Would it be better to use the actual strings from dma-names, or to narrow the
binding to the dense, at-most-8-TX form the driver implements? Both the
binding pattern and these two functions are unchanged through the end of the
series.
[ ... ]
> +static int ep_reset_dma_controller(struct xlnx_tsn_ep *ep)
> +{
> + struct xilinx_vdma_config cfg = { .reset = 1 };
> + struct dma_chan *tx_chan0;
> + int ret;
> +
> + tx_chan0 = dma_request_chan(ep->dev, "tx_chan0");
> + if (IS_ERR(tx_chan0))
> + return dev_err_probe(ep->dev, PTR_ERR(tx_chan0),
> + "failed to request tx_chan0 for reset\n");
[Severity: Medium]
Can -EPROBE_DEFER reach userspace through ndo_open here?
dma_request_chan() forwards that code verbatim:
drivers/dma/dmaengine.c:dma_request_chan() {
...
if (PTR_ERR(chan) == -EPROBE_DEFER)
return chan;
...
}
and of_dma_request_slave_channel() returns -EPROBE_DEFER when no of_dma
controller has registered for the phandle yet. Since probe() requests no DMA
channel, the netdev exists before the MCDMA provider is bound, and
XILINX_DMA is a tristate that can be loaded later:
ip link set ep up -> __dev_open() -> ep_open() -> ep_reset_dma_controller()
__dev_open() returns ops->ndo_open()'s value unchanged, so would
SIOCSIFFLAGS report errno 517 to userspace?
ep_alloc_dma_chan() has the same path: return ERR_CAST(err_chan) is turned
into ret = PTR_ERR(...) by ep_init_dmaengine() and returned from ep_open().
Separately, dev_err_probe() is being used outside a probe path. For
-EPROBE_DEFER it logs only at dev_dbg() level and overwrites the device's
deferred-probe reason string, so this open failure would be silent for the
operator. Would dev_err()/netdev_err() be more appropriate in ndo_open?
Both ep_reset_dma_controller() and ep_open() are unchanged at the end of the
series.
> +
> + ret = xilinx_vdma_channel_set_config(tx_chan0, &cfg);
> + dma_release_channel(tx_chan0);
> + if (ret < 0)
> + return dev_err_probe(ep->dev, ret,
> + "failed to reset DMA controller\n");
> +
> + return 0;
> +}
[ ... ]
next prev parent reply other threads:[~2026-08-08 19:48 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 10:44 [PATCH 00/20] xilinx: tsn: Add TSN Endpoint Ethernet MAC driver support Nagadheeraj Rottela
2026-08-07 10:44 ` [PATCH 01/20] dt-bindings: net: add Xilinx TSN Endpoint Ethernet MAC Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 02/20] net: xilinx: tsn: add TSN endpoint wrapper driver Nagadheeraj Rottela
2026-08-07 20:58 ` Uwe Kleine-König
2026-08-08 12:27 ` Neeli, Srinivas
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 03/20] net: xilinx: tsn: add endpoint MAC driver skeleton Nagadheeraj Rottela
2026-08-07 21:00 ` Uwe Kleine-König
2026-08-08 12:28 ` Neeli, Srinivas
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 04/20] net: xilinx: tsn: parse endpoint DMA channel configuration Nagadheeraj Rottela
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 05/20] net: xilinx: tsn: bring up the endpoint MCDMA channels Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski [this message]
2026-08-07 10:44 ` [PATCH 06/20] net: xilinx: tsn: add the endpoint RX data path Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 07/20] net: xilinx: tsn: add the endpoint TX " Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 08/20] net: xilinx: tsn: deliver endpoint RX frames to DSA user ports Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 09/20] net: dsa: tag_xlnx_tsn: add skeleton tag protocol Nagadheeraj Rottela
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 10/20] net: dsa: xilinx: add skeleton driver for TSN switch Nagadheeraj Rottela
2026-08-07 10:44 ` [PATCH 11/20] net: dsa: xilinx: implement port_stp_state_set Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 12/20] net: dsa: xilinx: register per-MAC MDIO buses Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 13/20] net: dsa: xilinx: wire up phylink for the switch ports Nagadheeraj Rottela
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 14/20] net: dsa: xilinx: program MAC frame filter and per-port nibbles Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 15/20] net: dsa: xilinx: register PHC backed by the RTC timer block Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 16/20] net: dsa: xilinx: drive per-MAC PTP TX/RX hardware paths Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 17/20] net: dsa: xilinx: opt into TX forwarding offload on bridge join Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 18/20] net: dsa: xilinx: offload the bridge FDB to the switch CAM Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 19/20] net: dsa: xilinx: offload bridge VLAN filtering to the switch Nagadheeraj Rottela
2026-08-08 10:46 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 10:44 ` [PATCH 20/20] net: dsa: xilinx: trap link-local control frames to the CPU port Nagadheeraj Rottela
2026-08-08 10:47 ` sashiko-bot
2026-08-08 19:48 ` Jakub Kicinski
2026-08-07 22:28 ` [PATCH 00/20] xilinx: tsn: Add TSN Endpoint Ethernet MAC driver support Jakub Kicinski
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=20260808194821.132723-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=git-dev@amd.com \
--cc=horms@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=michal.simek@amd.com \
--cc=nagadheeraj.rottela@amd.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=srinivas.neeli@amd.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 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.