Skip to content

Commit 25bf7d7

Browse files
committed
Merge branch 'neighbour-convert-rtm_getneigh-to-rcu-and-make-pneigh-rtnl-free'
Kuniyuki Iwashima says: ==================== neighbour: Convert RTM_GETNEIGH to RCU and make pneigh RTNL-free. This is kind of v3 of the series below [0] but without NEIGHTBL patches. Patch 1 ~ 4 and 9 come from the series to convert RTM_GETNEIGH to RCU. Other patches clean up pneigh_lookup() and convert the pneigh code to RCU + private mutex so that we can easily remove RTNL from RTM_NEWNEIGH in the later series. [0]: https://lore.kernel.org/netdev/[email protected]/ v2: https://lore.kernel.org/[email protected] v1: https://lore.kernel.org/[email protected] ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 7f7f3e1 + dc2a27e commit 25bf7d7

File tree

5 files changed

+207
-210
lines changed

5 files changed

+207
-210
lines changed

include/net/neighbour.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,14 @@ struct neigh_ops {
176176
};
177177

178178
struct pneigh_entry {
179-
struct pneigh_entry *next;
179+
struct pneigh_entry __rcu *next;
180180
possible_net_t net;
181181
struct net_device *dev;
182182
netdevice_tracker dev_tracker;
183+
union {
184+
struct list_head free_node;
185+
struct rcu_head rcu;
186+
};
183187
u32 flags;
184188
u8 protocol;
185189
bool permanent;
@@ -236,7 +240,8 @@ struct neigh_table {
236240
unsigned long last_rand;
237241
struct neigh_statistics __percpu *stats;
238242
struct neigh_hash_table __rcu *nht;
239-
struct pneigh_entry **phash_buckets;
243+
struct mutex phash_lock;
244+
struct pneigh_entry __rcu **phash_buckets;
240245
};
241246

242247
static inline int neigh_parms_family(struct neigh_parms *p)
@@ -376,10 +381,10 @@ unsigned long neigh_rand_reach_time(unsigned long base);
376381
void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
377382
struct sk_buff *skb);
378383
struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net,
379-
const void *key, struct net_device *dev,
380-
int creat);
381-
struct pneigh_entry *__pneigh_lookup(struct neigh_table *tbl, struct net *net,
382-
const void *key, struct net_device *dev);
384+
const void *key, struct net_device *dev);
385+
int pneigh_create(struct neigh_table *tbl, struct net *net, const void *key,
386+
struct net_device *dev, u32 flags, u8 protocol,
387+
bool permanent);
383388
int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key,
384389
struct net_device *dev);
385390

0 commit comments

Comments
 (0)