From: YangXin <yx.0xffff@gmail.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] net: ___neigh_lookup_noref(): remove redundant parameters
Date: Tue, 5 Dec 2023 02:59:43 +0800 [thread overview]
Message-ID: <20231204185943.68-1-yx.0xffff@gmail.com> (raw)
key_eq() and hash() are functions of struct neigh_table, so we just need to call tbl->key_eq() and tbl->hash(), instead of passing them in as parameters.
Signed-off-by: YangXin <yx.0xffff@gmail.com>
diff --git a/include/net/arp.h b/include/net/arp.h
index e8747e0713c7..c3a329f759af 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -24,7 +24,7 @@ static inline struct neighbour *__ipv4_neigh_lookup_noref(struct net_device *dev
if (dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT))
key = INADDR_ANY;
- return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, arp_hashfn, &key, dev);
+ return ___neigh_lookup_noref(&arp_tbl, neigh_key_eq32, &key, dev);
}
#else
static inline
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 9bbdf6eaa942..023fb7ebb63c 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -380,15 +380,14 @@ static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, _
static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey)
{
- return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, ndisc_hashfn, pkey, dev);
+ return ___neigh_lookup_noref(&nd_tbl, neigh_key_eq128, pkey, dev);
}
static inline
struct neighbour *__ipv6_neigh_lookup_noref_stub(struct net_device *dev,
const void *pkey)
{
- return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128,
- ndisc_hashfn, pkey, dev);
+ return ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128, pkey, dev);
}
static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey)
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 0d28172193fa..e21dbfc612b4 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -292,10 +292,6 @@ static inline bool neigh_key_eq128(const struct neighbour *n, const void *pkey)
static inline struct neighbour *___neigh_lookup_noref(
struct neigh_table *tbl,
- bool (*key_eq)(const struct neighbour *n, const void *pkey),
- __u32 (*hash)(const void *pkey,
- const struct net_device *dev,
- __u32 *hash_rnd),
const void *pkey,
struct net_device *dev)
{
@@ -303,11 +299,11 @@ static inline struct neighbour *___neigh_lookup_noref(
struct neighbour *n;
u32 hash_val;
- hash_val = hash(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
+ hash_val = tbl->hash(pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift);
for (n = rcu_dereference(nht->hash_buckets[hash_val]);
n != NULL;
n = rcu_dereference(n->next)) {
- if (n->dev == dev && key_eq(n, pkey))
+ if (n->dev == dev && tbl->key_eq(n, pkey))
return n;
}
@@ -318,7 +314,7 @@ static inline struct neighbour *__neigh_lookup_noref(struct neigh_table *tbl,
const void *pkey,
struct net_device *dev)
{
- return ___neigh_lookup_noref(tbl, tbl->key_eq, tbl->hash, pkey, dev);
+ return ___neigh_lookup_noref(tbl, pkey, dev);
}
static inline void neigh_confirm(struct neighbour *n)
--
2.33.0
next reply other threads:[~2023-12-04 18:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 18:59 YangXin [this message]
2023-12-04 19:54 ` [PATCH] net: ___neigh_lookup_noref(): remove redundant parameters Eric Dumazet
2023-12-05 8:23 ` kernel test robot
2023-12-05 12:40 ` kernel test robot
2023-12-05 13:11 ` kernel test robot
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=20231204185943.68-1-yx.0xffff@gmail.com \
--to=yx.0xffff@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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