On Tue, Sep 23, 2025 at 12:15:50AM +0200, Simon Schippers wrote: > The wrappers tun_ring_consume_batched/tap_ring_consume_batched are similar > to the wrappers tun_ring_consume/tap_ring_consume. They deal with > consuming a batch of entries of the ptr_ring and then waking the > netdev queue whenever entries get invalidated to be used again by the > producer. > To avoid waking the netdev queue when the ptr_ring is full, it is checked > if the netdev queue is stopped before invalidating entries. Like that the > netdev queue can be safely woken after invalidating entries. > > The READ_ONCE in __ptr_ring_peek, paired with the smp_wmb() in > __ptr_ring_produce within tun_net_xmit guarantees that the information > about the netdev queue being stopped is visible after __ptr_ring_peek is > called. READ_ONCE generally can't pair with smp_wmb