mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 21:53:44 +00:00
19f572565e
Get rid of fib_hash_lock rwlock. The fn_zone hash table resize is the noticeable part of this patch. I added a seqlock per fn_zone, so that readers can restart their lookup in the (very rare) case a writer expanded the hash table. Add rcu heads in fib_alias and fib_node, use call_rcu() to defer their freeing, and use appropriate _rcu list manipulations. Stress test (160.000.000 udp frames sent, IP route cache disabled to mimic DDOS attack, FIB_HASH) Before: real 0m41.191s user 0m13.137s sys 8m55.241s After: real 0m38.091s user 0m13.189s sys 7m53.018s Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
51 lines
1.4 KiB
C
51 lines
1.4 KiB
C
#ifndef _FIB_LOOKUP_H
|
|
#define _FIB_LOOKUP_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/list.h>
|
|
#include <net/ip_fib.h>
|
|
|
|
struct fib_alias {
|
|
struct list_head fa_list;
|
|
struct fib_info *fa_info;
|
|
u8 fa_tos;
|
|
u8 fa_type;
|
|
u8 fa_scope;
|
|
u8 fa_state;
|
|
struct rcu_head rcu;
|
|
};
|
|
|
|
#define FA_S_ACCESSED 0x01
|
|
|
|
/* Exported by fib_semantics.c */
|
|
extern int fib_semantic_match(struct list_head *head,
|
|
const struct flowi *flp,
|
|
struct fib_result *res, int prefixlen, int fib_flags);
|
|
extern void fib_release_info(struct fib_info *);
|
|
extern struct fib_info *fib_create_info(struct fib_config *cfg);
|
|
extern int fib_nh_match(struct fib_config *cfg, struct fib_info *fi);
|
|
extern int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
|
|
u32 tb_id, u8 type, u8 scope, __be32 dst,
|
|
int dst_len, u8 tos, struct fib_info *fi,
|
|
unsigned int);
|
|
extern void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
|
|
int dst_len, u32 tb_id, struct nl_info *info,
|
|
unsigned int nlm_flags);
|
|
extern struct fib_alias *fib_find_alias(struct list_head *fah,
|
|
u8 tos, u32 prio);
|
|
extern int fib_detect_death(struct fib_info *fi, int order,
|
|
struct fib_info **last_resort,
|
|
int *last_idx, int dflt);
|
|
|
|
static inline void fib_result_assign(struct fib_result *res,
|
|
struct fib_info *fi)
|
|
{
|
|
if (res->fi != NULL)
|
|
fib_info_put(res->fi);
|
|
res->fi = fi;
|
|
if (fi != NULL)
|
|
atomic_inc(&fi->fib_clntref);
|
|
}
|
|
|
|
#endif /* _FIB_LOOKUP_H */
|