From: David Ahern <dsahern@kernel.org>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, David Ahern <dsahern@gmail.com>
Subject: [PATCH net-next 1/7] neighbor: Remove open coding of key and hash functions
Date: Wed, 5 Dec 2018 15:34:08 -0800 [thread overview]
Message-ID: <20181205233414.1386-2-dsahern@kernel.org> (raw)
In-Reply-To: <20181205233414.1386-1-dsahern@kernel.org>
From: David Ahern <dsahern@gmail.com>
___neigh_lookup_noref takes the key and hash functions as inputs, yet
those are part of the operations listed in the neigh_table which is
also passed as an arugment. Remove the open coding of these internal
implementations by converting uses of ___neigh_lookup_noref to
__neigh_lookup_noref.
For IPv4, arp_key_eq is essentially a call to neigh_key_eq32 and
arp_hash is a call to arp_hashfn. Similarly for IPv6, ndisc_key_eq
calls neigh_key_eq128 and ndisc_hash calls ndisc_hashfn. So the change
in helpers is a no-op.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
include/net/arp.h | 2 +-
include/net/ndisc.h | 2 +-
net/core/filter.c | 3 +--
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/include/net/arp.h b/include/net/arp.h
index 977aabfcdc03..a5091f13cd3e 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -23,7 +23,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, &key, dev);
}
static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 key)
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index ddfbb591e2c5..c354345c679b 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -376,7 +376,7 @@ 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, pkey, dev);
}
static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, const void *pkey)
diff --git a/net/core/filter.c b/net/core/filter.c
index bd0df75dc7b6..f10cc675783c 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4668,8 +4668,7 @@ static int bpf_ipv6_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
* not needed here. Can not use __ipv6_neigh_lookup_noref here
* because we need to get nd_tbl via the stub
*/
- neigh = ___neigh_lookup_noref(ipv6_stub->nd_tbl, neigh_key_eq128,
- ndisc_hashfn, dst, dev);
+ neigh = __neigh_lookup_noref(ipv6_stub->nd_tbl, dst, dev);
if (!neigh)
return BPF_FIB_LKUP_RET_NO_NEIGH;
--
2.11.0
next prev parent reply other threads:[~2018-12-05 23:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-05 23:34 [PATCH net-next 0/7] neighbor: cleanups plus extack for add and delete David Ahern
2018-12-05 23:34 ` David Ahern [this message]
2018-12-05 23:34 ` [PATCH net-next 2/7] neighbor: Fold ___neigh_lookup_noref into __neigh_lookup_noref David Ahern
2018-12-06 0:44 ` David Miller
2018-12-06 0:46 ` David Ahern
2018-12-06 0:48 ` David Ahern
2018-12-06 0:50 ` David Miller
2018-12-05 23:34 ` [PATCH net-next 3/7] net/ipv4: Move arp_hashfn into arp_hash David Ahern
2018-12-05 23:34 ` [PATCH net-next 4/7] net/ipv6: Move ndisc_hashfn to ndisc_hash David Ahern
2018-12-05 23:34 ` [PATCH net-next 5/7] neighbor: Create a neigh_hash helper David Ahern
2018-12-05 23:34 ` [PATCH net-next 6/7] neighbor: Skip the duplicate lookup in neigh_add David Ahern
2018-12-05 23:34 ` [PATCH net-next 7/7] neighbor: Add extack messages for add and delete commands David Ahern
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=20181205233414.1386-2-dsahern@kernel.org \
--to=dsahern@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--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).