thread safe, lock free AF_XDP setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all

I am missing a full understanding of what really is thread safe and
what is not, when using AF_XDP.

RX and TX operations look obvious as every xsk socket has its own RX
and TX rings and so I can have multiple threads, as long as they don't
try to use the same ring of the same socket concurrently, that's the
only limitation (Am I correct yet?). So I can have for example 1:1
mapping of thread to xsk socket to avoid locking.

However what about UMEM rings, i.e. Completion and Fill queue?
About ring operations as __peek, __reserve ..., it is written (for ex.
here: https://www.kernel.org/doc/html/latest/networking/af_xdp.html#rings),
that they are not thread safe.
So it seems that I should use mutex to access them.
But I can see in:
https://github.com/xdp-project/bpf-examples/blob/master/AF_XDP-forwarding/xsk_fwd.c#L526
That they are filled / drained without locking, how is it then?

Does it make a difference if the socket is created by
xsk_socket__create_shared or xsk_socket__create?

What is the limitation that cannot be broken, as I described it for RX
/ TX? (if correctly)

Best Regards
Julius



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux