Skip to contentSkip to conversation

net: dsa: netc: break tstamp_queue walk on first non-expired skb

PATCH New [email protected] 1 participant 1 message Nov 30

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: netc: break tstamp_queue walk on first non-expired skb

From: Wei Fang <[email protected]>

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.

---
 drivers/net/dsa/netc/netc_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/netc/netc_ptp.c +1 -1
index a7ab62f76e35..46aa3b7ba2d2 100644
@@ -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",
Signature · 1 line
2.34.1