# 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 
- List: netdev
- Page: https://ratatoskr.run/netdev/2026/07/17243108
- Thread: https://ratatoskr.run/netdev/2026/07/17219260/t.md

```text
On 7/6/26 3:34 PM, Willem de Bruijn wrote:
> @@ -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().

> @@ -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

```
