summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPeter Nørlund <pch@ordbogen.com>2015-09-30 10:12:21 +0200
committerDavid S. Miller <davem@davemloft.net>2015-10-05 02:59:21 -0700
commit0e884c78ee19e902f300ed147083c28a0c6302f0 (patch)
tree4a60b19eed14b18e7f5473cfd0df6cb6434a57c4 /include
parent2472186f58ee1e4b9ca194245fef03931f6de90a (diff)
downloadlinux-0e884c78ee19e902f300ed147083c28a0c6302f0.tar.bz2
ipv4: L3 hash-based multipath
Replaces the per-packet multipath with a hash-based multipath using source and destination address. Signed-off-by: Peter Nørlund <pch@ordbogen.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/ip_fib.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 727d6e9a9685..7a51fd8d99e4 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -79,7 +79,7 @@ struct fib_nh {
unsigned char nh_scope;
#ifdef CONFIG_IP_ROUTE_MULTIPATH
int nh_weight;
- int nh_power;
+ atomic_t nh_upper_bound;
#endif
#ifdef CONFIG_IP_ROUTE_CLASSID
__u32 nh_tclassid;
@@ -118,7 +118,7 @@ struct fib_info {
#define fib_advmss fib_metrics[RTAX_ADVMSS-1]
int fib_nhs;
#ifdef CONFIG_IP_ROUTE_MULTIPATH
- int fib_power;
+ int fib_weight;
#endif
struct rcu_head rcu;
struct fib_nh fib_nh[0];
@@ -320,7 +320,15 @@ int ip_fib_check_default(__be32 gw, struct net_device *dev);
int fib_sync_down_dev(struct net_device *dev, unsigned long event);
int fib_sync_down_addr(struct net *net, __be32 local);
int fib_sync_up(struct net_device *dev, unsigned int nh_flags);
-void fib_select_multipath(struct fib_result *res);
+
+extern u32 fib_multipath_secret __read_mostly;
+
+static inline int fib_multipath_hash(__be32 saddr, __be32 daddr)
+{
+ return jhash_2words(saddr, daddr, fib_multipath_secret) >> 1;
+}
+
+void fib_select_multipath(struct fib_result *res, int hash);
/* Exported by fib_trie.c */
void fib_trie_init(void);