Thread (13 messages) 13 messages, 3 authors, 18d ago

Re: [PATCH net-next 7/7] net: pktgen: add support for SO_TXTIME

From: Paolo Abeni <pabeni@redhat.com>
Date: 2026-07-10 15:20:09

On 7/6/26 3:34 PM, Willem de Bruijn wrote:
quoted hunk ↗ jump to hunk
@@ -1141,6 +1157,49 @@ static ssize_t pktgen_if_write(struct file *file,
 			(unsigned long long) pkt_dev->delay);
 		return count;
 	}
+	if (!strcmp(name, "txtime_delay")) {
+		max = min(10, count - i);
+		len = num_arg(&user_buffer[i], max, &value);
+		if (len < 0)
+			return len;
+
+		/* in queue_xmit mode fq may clear tstamp, do not reuse skb */
+		if (value > 0 && pkt_dev->clone_skb > 0)
+			return -EINVAL;
+
+		pkt_dev->txtime_delay = (u64)value;
It looks like `pkt_dev->txtime_delay` access pattern is the same way as
`pkt_dev->txtime_clockid,`. I think WRITE_ONCE() is needed here, and
READ_ONCE() in pktgen_xmit().
quoted hunk ↗ jump to hunk
@@ -3557,6 +3633,14 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
 		}
 		pkt_dev->last_pkt_size = pkt_dev->skb->len;
 		pkt_dev->clone_count = 0;	/* reset counter */
+
+		if (pkt_dev->flags & F_TXTIME && pkt_dev->txtime_delay) {
`pkt_dev->flags` is accessed at the beginning of this function with a
READ_ONCE. I think it should be better to consolidate the two reads.

/P
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help