netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matteo Croce <mcroce@linux.microsoft.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Julia Lawall <julia.lawall@inria.fr>
Subject: [PATCH net-next 1/3] skbuff: add helper to walk over the fraglist
Date: Fri,  9 Apr 2021 20:06:03 +0200	[thread overview]
Message-ID: <20210409180605.78599-2-mcroce@linux.microsoft.com> (raw)
In-Reply-To: <20210409180605.78599-1-mcroce@linux.microsoft.com>

From: Matteo Croce <mcroce@microsoft.com>

Add an skb_for_each_frag() macro to iterate on SKB fragments.

Signed-off-by: Matteo Croce <mcroce@microsoft.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


  reply	other threads:[~2021-04-09 18:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 18:06 [PATCH net-next 0/3] introduce skb_for_each_frag() Matteo Croce
2021-04-09 18:06 ` Matteo Croce [this message]
2021-04-09 18:06 ` [PATCH net-next 2/3] net: use skb_for_each_frag() helper where possible Matteo Croce
2021-04-09 18:54   ` Jakub Kicinski
2021-04-09 20:44     ` Matteo Croce
2021-04-09 21:28       ` Jakub Kicinski
2021-04-10  0:53         ` Matteo Croce
2021-04-09 21:21   ` kernel test robot
2021-04-10  0:27   ` kernel test robot
2021-04-09 18:06 ` [PATCH net-next 3/3] net: use skb_for_each_frag() in illegal_highdma() Matteo Croce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210409180605.78599-2-mcroce@linux.microsoft.com \
    --to=mcroce@linux.microsoft.com \
    --cc=davem@davemloft.net \
    --cc=julia.lawall@inria.fr \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).