From: Chris Babroski <cbabroski@nvidia.com>
To: <bryan.whitehead@microchip.com>, <UNGLinuxDriver@microchip.com>,
<andrew+netdev@lunn.ch>, <davem@davemloft.net>,
<edumazet@kernel.org>, <kuba@kernel.org>, <pabeni@redhat.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<richardcochran@gmail.com>, <linux@armlinux.org.uk>
Cc: <maxime.chevallier@bootlin.com>, <Raju.Lakkaraju@microchip.com>,
<cbabroski@nvidia.com>, <davthompson@nvidia.com>
Subject: [PATCH net-next v1 5/5] net: lan743x: add byte queue limits support
Date: Thu, 15 Oct 2026 11:00:44 -0400 [thread overview]
Message-ID: <1e42bb2a36f305d8b3ba805e85d18c3dcda14887.1792008404.git.cbabroski@nvidia.com> (raw)
In-Reply-To: <cover.1792008404.git.cbabroski@nvidia.com>
Report the bytes queued to and completed by each TX ring to BQL.
Besides limiting how much data sits in the TX ring, this lets the stack
stop a queue once the bytes in flight exceed the BQL limit. Without it,
a queue is only stopped when its 128 entry ring is full, and the TX
watchdog only looks at stopped queues. With light traffic it can take
tens of seconds after a TX hang to fill the ring, before the watchdog
timeout even starts counting.
lan743x_tx_close() frees pending descriptors without completing them,
so reset the BQL state there.
Assisted-by: LLM
Signed-off-by: Chris Babroski <cbabroski@nvidia.com>
---
drivers/net/ethernet/microchip/lan743x_main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 2545a846478d..7739fa49fc44 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -1708,10 +1708,23 @@ static int lan743x_tx_next_index(struct lan743x_tx *tx, int index)
static void lan743x_tx_release_completed_descriptors(struct lan743x_tx *tx)
{
+ struct lan743x_tx_buffer_info *buffer_info;
+ unsigned int bytes = 0;
+ unsigned int pkts = 0;
+
while (le32_to_cpu(*tx->head_cpu_ptr) != (tx->last_head)) {
+ buffer_info = &tx->buffer_info[tx->last_head];
+ if (buffer_info->skb) {
+ bytes += buffer_info->skb->len;
+ pkts++;
+ }
lan743x_tx_release_desc(tx, tx->last_head, false);
tx->last_head = lan743x_tx_next_index(tx, tx->last_head);
}
+
+ netdev_tx_completed_queue(netdev_get_tx_queue(tx->adapter->netdev,
+ tx->channel_number),
+ pkts, bytes);
}
static void lan743x_tx_release_all_descriptors(struct lan743x_tx *tx)
@@ -2003,6 +2016,10 @@ static void lan743x_tx_frame_end(struct lan743x_tx *tx,
if (ignore_sync)
buffer_info->flags |= TX_BUFFER_INFO_FLAG_IGNORE_SYNC;
+ netdev_tx_sent_queue(netdev_get_tx_queue(adapter->netdev,
+ tx->channel_number),
+ skb->len);
+
tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
tx_descriptor->data0 = cpu_to_le32(tx->frame_data0);
tx->frame_tail = lan743x_tx_next_index(tx, tx->frame_tail);
@@ -2276,6 +2293,8 @@ static void lan743x_tx_close(struct lan743x_tx *tx)
0, 1000, 20000, 100);
lan743x_tx_release_all_descriptors(tx);
+ netdev_tx_reset_queue(netdev_get_tx_queue(adapter->netdev,
+ tx->channel_number));
tx->rqd_descriptors = 0;
--
2.34.1
prev parent reply other threads:[~2026-10-15 15:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 15:00 [PATCH net-next v1 0/5] net: lan743x: automatically recover from TX hang Chris Babroski
2026-10-15 15:00 ` [PATCH net-next v1 1/5] net: lan743x: reset DMA channels that fail to stop Chris Babroski
2026-10-15 15:00 ` [PATCH net-next v1 2/5] net: lan743x: start phylink last and stop it first Chris Babroski
2026-10-15 15:00 ` [PATCH net-next v1 3/5] net: lan743x: quiesce TX before freeing the rings Chris Babroski
2026-10-15 15:00 ` [PATCH net-next v1 4/5] net: lan743x: reset the device on TX timeout Chris Babroski
2026-10-15 15:00 ` Chris Babroski [this message]
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=1e42bb2a36f305d8b3ba805e85d18c3dcda14887.1792008404.git.cbabroski@nvidia.com \
--to=cbabroski@nvidia.com \
--cc=Raju.Lakkaraju@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=bryan.whitehead@microchip.com \
--cc=davem@davemloft.net \
--cc=davthompson@nvidia.com \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.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
all inboxes | Powered by JetHome®