Re: [PATCH net-next 2/7] neighbor: Fold ___neigh_lookup_noref into __neigh_lookup_noref
From: David Ahern Date: Wed, 5 Dec 2018 17:46:37 -0700 > ok. patches 5-7 are not dependent on 1-4. Should I re-send outside of > this set? Yes, please respin. Thanks David.
Re: [PATCH net-next 2/7] neighbor: Fold ___neigh_lookup_noref into __neigh_lookup_noref
On 12/5/18 5:46 PM, David Ahern wrote: > ok. patches 5-7 are not dependent on 1-4. Should I re-send outside of > this set? bleh. 5 is. I'll re-send.
Re: [PATCH net-next 2/7] neighbor: Fold ___neigh_lookup_noref into __neigh_lookup_noref
On 12/5/18 5:44 PM, David Miller wrote: > From: David Ahern > Date: Wed, 5 Dec 2018 15:34:09 -0800 > >> @@ -270,37 +270,25 @@ static inline bool neigh_key_eq128(const struct >> neighbour *n, const void *pkey) >> (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0; >> } >> >> -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) >> +static inline struct neighbour *__neigh_lookup_noref(struct neigh_table >> *tbl, >> + const void *pkey, >> + struct net_device *dev) >> { > > Sorry, we can't do this. > > The whole point of how this is laid out is so that the entire hash traversal, > including the hash function, is expanded inline. > > This demux is extremely critical on the output side, it must be the > smallest number of cycles possible. It was the only way I could justify > not caching neigh entries in the routes any more when I wrote this code. > > Even before retpoline, putting an indirect call here is painful. With > retpoline it is deadly. > > Please avoid removing the full inline expansion of the neigh lookup in the > ipv6 > and ipv4 data paths. > ok. patches 5-7 are not dependent on 1-4. Should I re-send outside of this set?
Re: [PATCH net-next 2/7] neighbor: Fold ___neigh_lookup_noref into __neigh_lookup_noref
From: David Ahern Date: Wed, 5 Dec 2018 15:34:09 -0800 > @@ -270,37 +270,25 @@ static inline bool neigh_key_eq128(const struct > neighbour *n, const void *pkey) > (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0; > } > > -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) > +static inline struct neighbour *__neigh_lookup_noref(struct neigh_table *tbl, > + const void *pkey, > + struct net_device *dev) > { Sorry, we can't do this. The whole point of how this is laid out is so that the entire hash traversal, including the hash function, is expanded inline. This demux is extremely critical on the output side, it must be the smallest number of cycles possible. It was the only way I could justify not caching neigh entries in the routes any more when I wrote this code. Even before retpoline, putting an indirect call here is painful. With retpoline it is deadly. Please avoid removing the full inline expansion of the neigh lookup in the ipv6 and ipv4 data paths. Thank you.
[PATCH net-next 2/7] neighbor: Fold ___neigh_lookup_noref into __neigh_lookup_noref
From: David Ahern There are no more direct callers of ___neigh_lookup_noref so no need for it to be a standalone helper. Signed-off-by: David Ahern --- include/net/neighbour.h | 22 +- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/include/net/neighbour.h b/include/net/neighbour.h index f58b384aa6c9..aac87bc2d96b 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -270,37 +270,25 @@ static inline bool neigh_key_eq128(const struct neighbour *n, const void *pkey) (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0; } -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) +static inline struct neighbour *__neigh_lookup_noref(struct neigh_table *tbl, +const void *pkey, +struct net_device *dev) { struct neigh_hash_table *nht = rcu_dereference_bh(tbl->nht); 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_bh(nht->hash_buckets[hash_val]); n != NULL; n = rcu_dereference_bh(n->next)) { - if (n->dev == dev && key_eq(n, pkey)) + if (n->dev == dev && tbl->key_eq(n, pkey)) return n; } return NULL; } -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); -} - void neigh_table_init(int index, struct neigh_table *tbl); int neigh_table_clear(int index, struct neigh_table *tbl); struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey, -- 2.11.0