aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa/dsa_loop.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <[email protected]>2020-01-08 21:59:02 +0000
committerDavid S. Miller <[email protected]>2020-01-08 23:19:54 +0000
commitdcfea72e79b0aa7a057c8f6024169d86a1bbc84b (patch)
tree1a5a60c417ec5c29e22441f82264b2630937aa12 /drivers/net/dsa/dsa_loop.c
parentsocket: fix unused-function warning (diff)
downloadkernel-dcfea72e79b0aa7a057c8f6024169d86a1bbc84b.tar.gz
kernel-dcfea72e79b0aa7a057c8f6024169d86a1bbc84b.zip
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'drivers/net/dsa/dsa_loop.c')
0 files changed, 0 insertions, 0 deletions