OpenCloudOS-Kernel/drivers/net/wireguard
Jason A. Donenfeld dcfea72e79 net: introduce skb_list_walk_safe for skb segment walking
As part of the continual effort to remove direct usage of skb->next and
skb->prev, this patch adds a helper for iterating through the
singly-linked variant of skb lists, which are used for lists of GSO
packet. The name "skb_list_..." has been chosen to match the existing
function, "kfree_skb_list, which also operates on these singly-linked
lists, and the "..._walk_safe" part is the same idiom as elsewhere in
the kernel.

This patch removes the helper from wireguard and puts it into
linux/skbuff.h, while making it a bit more robust for general usage. In
particular, parenthesis are added around the macro argument usage, and it
now accounts for trying to iterate through an already-null skb pointer,
which will simply run the iteration zero times. This latter enhancement
means it can be used to replace both do { ... } while and while (...)
open-coded idioms.

This should take care of these three possible usages, which match all
current methods of iterations.

skb_list_walk_safe(segs, skb, next) { ... }
skb_list_walk_safe(skb, skb, next) { ... }
skb_list_walk_safe(segs, skb, segs) { ... }

Gcc appears to generate efficient code for each of these.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-08 15:19:54 -08:00
..
selftest
Makefile
allowedips.c wireguard: allowedips: use kfree_rcu() instead of call_rcu() 2019-12-16 19:22:22 -08:00
allowedips.h
cookie.c
cookie.h
device.c
device.h net: introduce skb_list_walk_safe for skb segment walking 2020-01-08 15:19:54 -08:00
main.c wireguard: main: remove unused include <linux/version.h> 2019-12-16 19:22:22 -08:00
messages.h
netlink.c
netlink.h
noise.c
noise.h
peer.c
peer.h
peerlookup.c
peerlookup.h
queueing.c
queueing.h wireguard: queueing: do not account for pfmemalloc when clearing skb header 2020-01-05 14:08:32 -08:00
ratelimiter.c
ratelimiter.h
receive.c
send.c
socket.c wireguard: socket: mark skbs as not on list when receiving via gro 2020-01-05 14:08:32 -08:00
socket.h
timers.c
timers.h
version.h