From: Meghana Malladi <m-malladi@ti.com>
To: Simon Horman <horms@kernel.org>
Cc: <namcao@linutronix.de>, <vadim.fedorenko@linux.dev>,
<jacob.e.keller@intel.com>, <christian.koenig@amd.com>,
<sumit.semwal@linaro.org>, <sdf@fomichev.me>,
<john.fastabend@gmail.com>, <hawk@kernel.org>,
<daniel@iogearbox.net>, <ast@kernel.org>, <pabeni@redhat.com>,
<kuba@kernel.org>, <edumazet@google.com>, <davem@davemloft.net>,
<andrew+netdev@lunn.ch>, <linaro-mm-sig@lists.linaro.org>,
<dri-devel@lists.freedesktop.org>, <linux-media@vger.kernel.org>,
<bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>,
<srk@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>,
Roger Quadros <rogerq@kernel.org>, <danishanwar@ti.com>
Subject: Re: [PATCH net-next v5 1/6] net: ti: icssg-prueth: Add functions to create and destroy Rx/Tx queues
Date: Fri, 14 Nov 2025 16:43:21 +0530 [thread overview]
Message-ID: <3737a9bf-e95b-4ea8-b16b-418b777f407c@ti.com> (raw)
In-Reply-To: <aRcGMTRzDFwe23NV@horms.kernel.org>
Hi Simon,
On 11/14/25 16:06, Simon Horman wrote:
> On Tue, Nov 11, 2025 at 03:45:18PM +0530, Meghana Malladi wrote:
>
> ...
>
>> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>> index 57a7d1ceab08..b66ffbfb499c 100644
>> --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>> +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
>> @@ -735,6 +735,114 @@ static int icssg_update_vlan_mcast(struct net_device *vdev, int vid,
>> return 0;
>> }
>>
>> +static void prueth_destroy_txq(struct prueth_emac *emac)
>> +{
>> + int ret, i;
>> +
>> + atomic_set(&emac->tdown_cnt, emac->tx_ch_num);
>> + /* ensure new tdown_cnt value is visible */
>> + smp_mb__after_atomic();
>> + /* tear down and disable UDMA channels */
>> + reinit_completion(&emac->tdown_complete);
>> + for (i = 0; i < emac->tx_ch_num; i++)
>> + k3_udma_glue_tdown_tx_chn(emac->tx_chns[i].tx_chn, false);
>> +
>> + ret = wait_for_completion_timeout(&emac->tdown_complete,
>> + msecs_to_jiffies(1000));
>> + if (!ret)
>> + netdev_err(emac->ndev, "tx teardown timeout\n");
>> +
>> + for (i = 0; i < emac->tx_ch_num; i++) {
>> + napi_disable(&emac->tx_chns[i].napi_tx);
>> + hrtimer_cancel(&emac->tx_chns[i].tx_hrtimer);
>> + k3_udma_glue_reset_tx_chn(emac->tx_chns[i].tx_chn,
>> + &emac->tx_chns[i],
>> + prueth_tx_cleanup);
>> + k3_udma_glue_disable_tx_chn(emac->tx_chns[i].tx_chn);
>> + }
>> +}
>> +
>> +static void prueth_destroy_rxq(struct prueth_emac *emac)
>> +{
>> + int i, ret;
>> +
>> + /* tear down and disable UDMA channels */
>> + reinit_completion(&emac->tdown_complete);
>> + k3_udma_glue_tdown_rx_chn(emac->rx_chns.rx_chn, true);
>> +
>> + /* When RX DMA Channel Teardown is initiated, it will result in an
>> + * interrupt and a Teardown Completion Marker (TDCM) is queued into
>> + * the RX Completion queue. Acknowledging the interrupt involves
>> + * popping the TDCM descriptor from the RX Completion queue via the
>> + * RX NAPI Handler. To avoid timing out when waiting for the TDCM to
>> + * be popped, schedule the RX NAPI handler to run immediately.
>> + */
>> + if (!napi_if_scheduled_mark_missed(&emac->napi_rx)) {
>> + if (napi_schedule_prep(&emac->napi_rx))
>> + __napi_schedule(&emac->napi_rx);
>> + }
>> +
>> + ret = wait_for_completion_timeout(&emac->tdown_complete,
>> + msecs_to_jiffies(1000));
>> + if (!ret)
>> + netdev_err(emac->ndev, "rx teardown timeout\n");
>> +
>> + for (i = 0; i < PRUETH_MAX_RX_FLOWS; i++) {
>> + napi_disable(&emac->napi_rx);
>> + hrtimer_cancel(&emac->rx_hrtimer);
>
> Hi Meghana,
>
> Is it intentional that the napi_disable() and hrtimer_cancel()
> are made once for each (possible) flow, rather than just once
> as was the case before this patch?
>
> Maybe the tx code, which does the same, was used as a template here
> in error?
>
Currently there is only one flow per Rx channel. But we can enable
support to add multiple flows to a given given channel. In that case
napi_disable() and hrtimer_cancel() will be invoked per flow. That being
said, though right now this for loop is redundant this is a intentional
change for multiple flows.
> Flagged by Claude Code with https://github.com/masoncl/review-prompts/
>
>> + k3_udma_glue_reset_rx_chn(emac->rx_chns.rx_chn, i,
>> + &emac->rx_chns,
>> + prueth_rx_cleanup);
>> + }
>> +
>> + prueth_destroy_xdp_rxqs(emac);
>> + k3_udma_glue_disable_rx_chn(emac->rx_chns.rx_chn);
>> +}
>
> ...
>
>> @@ -905,32 +988,8 @@ static int emac_ndo_stop(struct net_device *ndev)
>> else
>> __dev_mc_unsync(ndev, icssg_prueth_del_mcast);
>>
>> - atomic_set(&emac->tdown_cnt, emac->tx_ch_num);
>> - /* ensure new tdown_cnt value is visible */
>> - smp_mb__after_atomic();
>> - /* tear down and disable UDMA channels */
>> - reinit_completion(&emac->tdown_complete);
>> - for (i = 0; i < emac->tx_ch_num; i++)
>> - k3_udma_glue_tdown_tx_chn(emac->tx_chns[i].tx_chn, false);
>> -
>> - ret = wait_for_completion_timeout(&emac->tdown_complete,
>> - msecs_to_jiffies(1000));
>> - if (!ret)
>> - netdev_err(ndev, "tx teardown timeout\n");
>> -
>> - prueth_reset_tx_chan(emac, emac->tx_ch_num, true);
>> - for (i = 0; i < emac->tx_ch_num; i++) {
>> - napi_disable(&emac->tx_chns[i].napi_tx);
>> - hrtimer_cancel(&emac->tx_chns[i].tx_hrtimer);
>> - }
>> -
>> - max_rx_flows = PRUETH_MAX_RX_FLOWS;
>> - k3_udma_glue_tdown_rx_chn(emac->rx_chns.rx_chn, true);
>> -
>> - prueth_reset_rx_chan(&emac->rx_chns, max_rx_flows, true);
>> - prueth_destroy_xdp_rxqs(emac);
>> - napi_disable(&emac->napi_rx);
>> - hrtimer_cancel(&emac->rx_hrtimer);
>> + prueth_destroy_txq(emac);
>> + prueth_destroy_rxq(emac);
>>
>> cancel_work_sync(&emac->rx_mode_work);
>>
>> @@ -943,10 +1002,10 @@ static int emac_ndo_stop(struct net_device *ndev)
>>
>> free_irq(emac->tx_ts_irq, emac);
>>
>> - free_irq(emac->rx_chns.irq[rx_flow], emac);
>> + free_irq(emac->rx_chns.irq[PRUETH_RX_FLOW_DATA], emac);
>> prueth_ndev_del_tx_napi(emac, emac->tx_ch_num);
>>
>> - prueth_cleanup_rx_chns(emac, &emac->rx_chns, max_rx_flows);
>> + prueth_cleanup_rx_chns(emac, &emac->rx_chns, PRUETH_MAX_RX_FLOWS);
>> prueth_cleanup_tx_chns(emac);
>>
>> prueth->emacs_initialized--;
>
> ...
next prev parent reply other threads:[~2025-11-14 11:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-11 10:15 [PATCH net-next v5 0/6] Add AF_XDP zero copy support Meghana Malladi
2025-11-11 10:15 ` [PATCH net-next v5 1/6] net: ti: icssg-prueth: Add functions to create and destroy Rx/Tx queues Meghana Malladi
2025-11-14 10:36 ` Simon Horman
2025-11-14 11:13 ` Meghana Malladi [this message]
2025-11-11 10:15 ` [PATCH net-next v5 2/6] net: ti: icssg-prueth: Add XSK pool helpers Meghana Malladi
2025-11-11 10:15 ` [PATCH net-next v5 3/6] net: ti: icssg-prueth: Add AF_XDP zero copy for TX Meghana Malladi
2025-11-11 10:15 ` [PATCH net-next v5 4/6] net: ti: icssg-prueth: Make emac_run_xdp function independent of page Meghana Malladi
2025-11-11 10:15 ` [PATCH net-next v5 5/6] net: ti: icssg-prueth: Add AF_XDP zero copy for RX Meghana Malladi
2025-11-14 10:33 ` Simon Horman
2025-11-17 9:19 ` Meghana Malladi
2025-11-11 10:15 ` [PATCH net-next v5 6/6] net: ti: icssg-prueth: Enable zero copy in XDP features Meghana Malladi
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=3737a9bf-e95b-4ea8-b16b-418b777f407c@ti.com \
--to=m-malladi@ti.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=christian.koenig@amd.com \
--cc=daniel@iogearbox.net \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=namcao@linutronix.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rogerq@kernel.org \
--cc=sdf@fomichev.me \
--cc=srk@ti.com \
--cc=sumit.semwal@linaro.org \
--cc=vadim.fedorenko@linux.dev \
--cc=vigneshr@ti.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).