From: Gilad Naaman <gnaaman@drivenets.com>
To: netdev <netdev@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Gilad Naaman <gnaaman@drivenets.com>,
Kuniyuki Iwashima <kuniyu@amazon.com>
Subject: [PATCH net-next v7 2/6] neighbour: Define neigh_for_each_in_bucket
Date: Tue, 22 Oct 2024 13:43:37 +0000 [thread overview]
Message-ID: <20241022134343.3354111-3-gnaaman@drivenets.com> (raw)
In-Reply-To: <20241022134343.3354111-1-gnaaman@drivenets.com>
Introduce neigh_for_each_in_bucket in neighbour.h, to help iterate over
the neighbour table more succinctly.
Signed-off-by: Gilad Naaman <gnaaman@drivenets.com>
---
include/net/neighbour.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 0402447854c7..69aaacd1419f 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -277,6 +277,10 @@ static inline void *neighbour_priv(const struct neighbour *n)
extern const struct nla_policy nda_policy[];
+#define neigh_for_each_in_bucket(pos, head) hlist_for_each_entry(pos, head, hash)
+#define neigh_for_each_in_bucket_safe(pos, tmp, head) \
+ hlist_for_each_entry_safe(pos, tmp, head, hash)
+
static inline bool neigh_key_eq32(const struct neighbour *n, const void *pkey)
{
return *(const u32 *)n->primary_key == *(const u32 *)pkey;
--
2.46.0
next prev parent reply other threads:[~2024-10-22 13:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 13:43 [PATCH net-next v7 0/6] neighbour: Improve neigh_flush_dev performance Gilad Naaman
2024-10-22 13:43 ` [PATCH net-next v7 1/6] neighbour: Add hlist_node to struct neighbour Gilad Naaman
2024-10-22 14:40 ` Eric Dumazet
2024-10-23 5:16 ` Gilad Naaman
2024-10-22 13:43 ` Gilad Naaman [this message]
2024-10-22 13:43 ` [PATCH net-next v7 3/6] neighbour: Convert seq_file functions to use hlist Gilad Naaman
2024-10-22 13:43 ` [PATCH net-next v7 4/6] neighbour: Convert iteration to use hlist+macro Gilad Naaman
2024-10-22 13:43 ` [PATCH net-next v7 5/6] neighbour: Remove bare neighbour::next pointer Gilad Naaman
2024-10-22 13:43 ` [PATCH net-next v7 6/6] neighbour: Create netdev->neighbour association Gilad Naaman
2024-10-22 23:48 ` [PATCH net-next v7 0/6] neighbour: Improve neigh_flush_dev performance Stanislav Fomichev
2024-10-23 5:01 ` Gilad Naaman
2024-10-23 5:18 ` Kuniyuki Iwashima
2024-10-23 5:38 ` Gilad Naaman
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=20241022134343.3354111-3-gnaaman@drivenets.com \
--to=gnaaman@drivenets.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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).