From: wei.fang@oss.nxp.com
To: xiaoning.wang@nxp.com, andrew@lunn.ch, olteanv@gmail.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, richardcochran@gmail.com
Cc: wei.fang@nxp.com, imx@lists.linux.dev, netdev@vger.kernel.org
Subject: [PATCH net-next] net: dsa: netc: break tstamp_queue walk on first non-expired skb
Date: Mon, 30 Nov 2026 16:29:08 +0800 [thread overview]
Message-ID: <20261130082908.3251260-1-wei.fang@oss.nxp.com> (raw)
From: Wei Fang <wei.fang@nxp.com>
Replace the continue with break in netc_port_tstamp_timeout_work().
The tstamp_queue is a bounded (max 16) skb queue. New SKBs are appended
at the tail, and each SKB’s ptp_tx_time is later than the timestamps of
earlier entries. skb_queue_walk_safe() walks from the head, so when the
first non-expired SKB is reached all following SKBs are guaranteed to be
non-expired. Normally, the queue rarely contains expired SKBs, stopping
the walk early avoids unnecessary checks and improves efficiency.
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
drivers/net/dsa/netc/netc_ptp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/netc/netc_ptp.c b/drivers/net/dsa/netc/netc_ptp.c
index a7ab62f76e35..46aa3b7ba2d2 100644
--- a/drivers/net/dsa/netc/netc_ptp.c
+++ b/drivers/net/dsa/netc/netc_ptp.c
@@ -37,7 +37,7 @@ static void netc_port_tstamp_timeout_work(struct work_struct *work)
skb_queue_walk_safe(&np->tstamp_queue, skb, skb_tmp) {
if (time_is_after_jiffies64(NETC_SKB_CB(skb)->ptp_tx_time +
NETC_TSTAMP_TIMEOUT))
- continue;
+ break;
dev_dbg_ratelimited(np->switch_priv->dev,
"Port %d ts_req_id %u which seems lost\n",
--
2.34.1
reply other threads:[~2026-11-30 8:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261130082908.3251260-1-wei.fang@oss.nxp.com \
--to=wei.fang@oss.nxp.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=imx@lists.linux.dev \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.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