[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210409180605.78599-2-mcroce@linux.microsoft.com>
Date: Fri, 9 Apr 2021 20:06:03 +0200
From: Matteo Croce <mcroce@...ux.microsoft.com>
To: netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Julia Lawall <julia.lawall@...ia.fr>
Subject: [PATCH net-next 1/3] skbuff: add helper to walk over the fraglist
From: Matteo Croce <mcroce@...rosoft.com>
Add an skb_for_each_frag() macro to iterate on SKB fragments.
Signed-off-by: Matteo Croce <mcroce@...rosoft.com>
---
include/linux/skbuff.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index dbf820a50a39..a8d4ccacdda5 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1528,6 +1528,10 @@ static inline void skb_mark_not_on_list(struct sk_buff *skb)
for ((skb) = (first), (next_skb) = (skb) ? (skb)->next : NULL; (skb); \
(skb) = (next_skb), (next_skb) = (skb) ? (skb)->next : NULL)
+/* Iterate through skb fragments. */
+#define skb_for_each_frag(skb, __i) \
+ for (__i = 0; __i < skb_shinfo(skb)->nr_frags; __i++)
+
static inline void skb_list_del_init(struct sk_buff *skb)
{
__list_del_entry(&skb->list);
--
2.30.2
Powered by blists - more mailing lists