From: Jakub Kicinski <kuba@kernel.org>
To: Biao Huang <biao.huang@mediatek.com>
Cc: David Miller <davem@davemloft.net>,
Rob Herring <robh+dt@kernel.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Fabien Parent <fparent@baylibre.com>,
Felix Fietkau <nbd@nbd.name>, "John Crispin" <john@phrozen.org>,
Sean Wang <sean.wang@mediatek.com>,
Mark Lee <Mark-MC.Lee@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
<netdev@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
Yinghua Pan <ot_yinghua.pan@mediatek.com>,
<srv_heupstream@mediatek.com>,
Macpaul Lin <macpaul.lin@mediatek.com>
Subject: Re: [PATCH net-next v3 09/10] net: ethernet: mtk-star-emac: separate tx/rx handling with two NAPIs
Date: Thu, 23 Jun 2022 21:34:31 -0700 [thread overview]
Message-ID: <20220623213431.23528544@kernel.org> (raw)
In-Reply-To: <20220622090545.23612-10-biao.huang@mediatek.com>
On Wed, 22 Jun 2022 17:05:44 +0800 Biao Huang wrote:
> + if (rx || tx) {
> + spin_lock_irqsave(&priv->lock, flags);
> + /* mask Rx and TX Complete interrupt */
> + mtk_star_disable_dma_irq(priv, rx, tx);
> + spin_unlock_irqrestore(&priv->lock, flags);
You do _irqsave / _irqrestore here
> + if (rx)
> + __napi_schedule_irqoff(&priv->rx_napi);
> + if (tx)
> + __napi_schedule_irqoff(&priv->tx_napi);
Yet assume _irqoff here.
So can this be run from non-IRQ context or not?
> - if (mtk_star_ring_full(ring))
> + if (unlikely(mtk_star_tx_ring_avail(ring) < MAX_SKB_FRAGS + 1))
> netif_stop_queue(ndev);
Please look around other drivers (like ixgbe) and copy the way they
handle safe stopping of the queues. You need to add some barriers and
re-check after disabling.
> - spin_unlock_bh(&priv->lock);
> -
> mtk_star_dma_resume_tx(priv);
>
> return NETDEV_TX_OK;
> + while ((entry != head) && (count < MTK_STAR_RING_NUM_DESCS - 1)) {
>
Parenthesis unnecessary, so is the empty line after the while ().
> ret = mtk_star_tx_complete_one(priv);
> if (ret < 0)
> break;
> +
> + count++;
> + pkts_compl++;
> + bytes_compl += ret;
> + entry = ring->tail;
> }
>
> + __netif_tx_lock_bh(netdev_get_tx_queue(priv->ndev, 0));
> netdev_completed_queue(ndev, pkts_compl, bytes_compl);
> + __netif_tx_unlock_bh(netdev_get_tx_queue(priv->ndev, 0));
what are you taking this lock for?
> - if (wake && netif_queue_stopped(ndev))
> + if (unlikely(netif_queue_stopped(ndev)) &&
> + (mtk_star_tx_ring_avail(ring) > MTK_STAR_TX_THRESH))
> netif_wake_queue(ndev);
>
> - spin_unlock(&priv->lock);
> + if (napi_complete(napi)) {
> + spin_lock_irqsave(&priv->lock, flags);
> + mtk_star_enable_dma_irq(priv, false, true);
> + spin_unlock_irqrestore(&priv->lock, flags);
> + }
> +
> + return 0;
> }
> @@ -1475,6 +1514,7 @@ static int mtk_star_set_timing(struct mtk_star_priv *priv)
>
> return regmap_write(priv->regs, MTK_STAR_REG_TEST0, delay_val);
> }
> +
> static int mtk_star_probe(struct platform_device *pdev)
> {
> struct device_node *of_node;
spurious whitespace change
next prev parent reply other threads:[~2022-06-24 4:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-22 9:05 [PATCH net-next v3 00/10] add more features for mtk-star-emac Biao Huang
2022-06-22 9:05 ` [PATCH net-next v3 01/10] net: ethernet: mtk-star-emac: store bit_clk_div in compat structure Biao Huang
2022-06-22 9:05 ` [PATCH net-next v3 02/10] net: ethernet: mtk-star-emac: modify IRQ trigger flags Biao Huang
2022-06-22 9:05 ` [PATCH net-next v3 03/10] net: ethernet: mtk-star-emac: add support for MT8365 SoC Biao Huang
2022-06-22 9:05 ` [PATCH net-next v3 04/10] dt-bindings: net: mtk-star-emac: add support for MT8365 Biao Huang
2022-06-22 9:05 ` [PATCH net-next v3 05/10] net: ethernet: mtk-star-emac: add clock pad selection for RMII Biao Huang
2022-06-22 9:05 ` [PATCH net-next v3 06/10] net: ethernet: mtk-star-emac: add timing adjustment support Biao Huang
2022-06-22 9:05 ` [PATCH net-next v3 07/10] dt-bindings: net: mtk-star-emac: add description for new properties Biao Huang
2022-06-22 9:05 ` [PATCH net-next v3 08/10] net: ethernet: mtk-star-emac: add support for MII interface Biao Huang
2022-06-22 9:05 ` [PATCH net-next v3 09/10] net: ethernet: mtk-star-emac: separate tx/rx handling with two NAPIs Biao Huang
2022-06-24 4:34 ` Jakub Kicinski [this message]
2022-06-28 5:44 ` Biao Huang
2022-06-22 9:05 ` [PATCH net-next v3 10/10] net: ethernet: mtk-star-emac: enable half duplex hardware support Biao Huang
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=20220623213431.23528544@kernel.org \
--to=kuba@kernel.org \
--cc=Mark-MC.Lee@mediatek.com \
--cc=biao.huang@mediatek.com \
--cc=brgl@bgdev.pl \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=fparent@baylibre.com \
--cc=john@phrozen.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=macpaul.lin@mediatek.com \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=ot_yinghua.pan@mediatek.com \
--cc=robh+dt@kernel.org \
--cc=sean.wang@mediatek.com \
--cc=srv_heupstream@mediatek.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).