OSDN Git Service

xsk: Simplify the consumer ring access functions
authorMagnus Karlsson <magnus.karlsson@intel.com>
Thu, 19 Dec 2019 12:39:26 +0000 (13:39 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 21 Dec 2019 00:00:09 +0000 (16:00 -0800)
commitc5ed924b54c892ee637d2e6889ef83341835a560
tree344a4394b00e50605ff67be098e8ac856ac5647b
parentdf0ae6f78a45e5696427779fc3379c5d75f5d4a5
xsk: Simplify the consumer ring access functions

Simplify and refactor consumer ring functions. The consumer first
"peeks" to find descriptors or addresses that are available to
read from the ring, then reads them and finally "releases" these
descriptors once it is done. The two local variables cons_tail
and cons_head are turned into one single variable called
cached_cons. cached_tail referred to the cached value of the
global consumer pointer and will be stored in cached_cons. For
cached_head, we just use cached_prod instead as it was not used
for a consumer queue before. It also better reflects what it
really is now: a cached copy of the producer pointer.

The names of the functions are also renamed in the same manner as
the producer functions. The new functions are called xskq_cons_
followed by what it does.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/1576759171-28550-8-git-send-email-magnus.karlsson@intel.com
net/xdp/xsk.c
net/xdp/xsk_queue.h