Re: [PATCH net-next v24 09/23] ovpn: implement packet processing

From: Qingfang Deng
Date: Wed Mar 26 2025 - 08:44:03 EST


On Wed, Mar 26, 2025 at 6:22 PM Antonio Quartulli <antonio@xxxxxxxxxxx> wrote:
> >> This is not what we want.
> >
> > Got it. You could replace it with
> > atomic_fetch_add_unless(&pid->seq_num, 1, 0) and check if it wraps
> > around to zero.
>
> What about the first time when seq_num is 0? It will already stop, no?

The initial value of seq_num is 1.

> +void ovpn_pktid_xmit_init(struct ovpn_pktid_xmit *pid)
> +{
> + atomic64_set(&pid->seq_num, 1);
> +}