diff options
Diffstat (limited to 'net/ipv4/multipath_rr.c')
-rw-r--r-- | net/ipv4/multipath_rr.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/net/ipv4/multipath_rr.c b/net/ipv4/multipath_rr.c index 554a82568160..b6cd2870478f 100644 --- a/net/ipv4/multipath_rr.c +++ b/net/ipv4/multipath_rr.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/igmp.h> | 31 | #include <linux/igmp.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/module.h> | ||
34 | #include <linux/mroute.h> | 35 | #include <linux/mroute.h> |
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
36 | #include <net/ip.h> | 37 | #include <net/ip.h> |
@@ -47,29 +48,12 @@ | |||
47 | #include <net/checksum.h> | 48 | #include <net/checksum.h> |
48 | #include <net/ip_mp_alg.h> | 49 | #include <net/ip_mp_alg.h> |
49 | 50 | ||
50 | #define MULTIPATH_MAX_CANDIDATES 40 | ||
51 | |||
52 | static struct rtable* last_used = NULL; | ||
53 | |||
54 | static void rr_remove(struct rtable *rt) | ||
55 | { | ||
56 | if (last_used == rt) | ||
57 | last_used = NULL; | ||
58 | } | ||
59 | |||
60 | static void rr_select_route(const struct flowi *flp, | 51 | static void rr_select_route(const struct flowi *flp, |
61 | struct rtable *first, struct rtable **rp) | 52 | struct rtable *first, struct rtable **rp) |
62 | { | 53 | { |
63 | struct rtable *nh, *result, *min_use_cand = NULL; | 54 | struct rtable *nh, *result, *min_use_cand = NULL; |
64 | int min_use = -1; | 55 | int min_use = -1; |
65 | 56 | ||
66 | /* if necessary and possible utilize the old alternative */ | ||
67 | if ((flp->flags & FLOWI_FLAG_MULTIPATHOLDROUTE) != 0 && | ||
68 | last_used != NULL) { | ||
69 | result = last_used; | ||
70 | goto out; | ||
71 | } | ||
72 | |||
73 | /* 1. make sure all alt. nexthops have the same GC related data | 57 | /* 1. make sure all alt. nexthops have the same GC related data |
74 | * 2. determine the new candidate to be returned | 58 | * 2. determine the new candidate to be returned |
75 | */ | 59 | */ |
@@ -90,15 +74,12 @@ static void rr_select_route(const struct flowi *flp, | |||
90 | if (!result) | 74 | if (!result) |
91 | result = first; | 75 | result = first; |
92 | 76 | ||
93 | out: | ||
94 | last_used = result; | ||
95 | result->u.dst.__use++; | 77 | result->u.dst.__use++; |
96 | *rp = result; | 78 | *rp = result; |
97 | } | 79 | } |
98 | 80 | ||
99 | static struct ip_mp_alg_ops rr_ops = { | 81 | static struct ip_mp_alg_ops rr_ops = { |
100 | .mp_alg_select_route = rr_select_route, | 82 | .mp_alg_select_route = rr_select_route, |
101 | .mp_alg_remove = rr_remove, | ||
102 | }; | 83 | }; |
103 | 84 | ||
104 | static int __init rr_init(void) | 85 | static int __init rr_init(void) |
@@ -113,3 +94,4 @@ static void __exit rr_exit(void) | |||
113 | 94 | ||
114 | module_init(rr_init); | 95 | module_init(rr_init); |
115 | module_exit(rr_exit); | 96 | module_exit(rr_exit); |
97 | MODULE_LICENSE("GPL"); | ||