Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[linux-drm-fsl-dcu.git] / net / ipv4 / multipath_wrandom.c
index 342d0b9098f5f8ca9bdd5a019b6a7a0660ace097..7e22f15d13dfecb562b58adadc409282835faba3 100644 (file)
@@ -12,7 +12,6 @@
  *             2 of the License, or (at your option) any later version.
  */
 
-#include <linux/config.h>
 #include <asm/system.h>
 #include <asm/uaccess.h>
 #include <linux/types.h>
@@ -61,8 +60,8 @@ struct multipath_dest {
        struct list_head        list;
 
        const struct fib_nh     *nh_info;
-       __u32                   netmask;
-       __u32                   network;
+       __be32                  netmask;
+       __be32                  network;
        unsigned char           prefixlen;
 
        struct rcu_head         rcu;
@@ -77,7 +76,7 @@ struct multipath_route {
        struct list_head        list;
 
        int                     oif;
-       __u32                   gw;
+       __be32                  gw;
        struct list_head        dests;
 
        struct rcu_head         rcu;
@@ -129,8 +128,8 @@ static unsigned char __multipath_lookup_weight(const struct flowi *fl,
 
        /* find state entry for destination */
        list_for_each_entry_rcu(d, &target_route->dests, list) {
-               __u32 targetnetwork = fl->fl4_dst & 
-                       (0xFFFFFFFF >> (32 - d->prefixlen));
+               __be32 targetnetwork = fl->fl4_dst &
+                       inet_make_mask(d->prefixlen);
 
                if ((targetnetwork & d->netmask) == d->network) {
                        weight = d->nh_info->nh_weight;
@@ -143,7 +142,7 @@ out:
        return weight;
 }
 
-static void wrandom_init_state(void) 
+static void wrandom_init_state(void)
 {
        int i;
 
@@ -168,7 +167,7 @@ static void wrandom_select_route(const struct flowi *flp,
 
        /* collect all candidates and identify their weights */
        for (rt = rcu_dereference(first); rt;
-            rt = rcu_dereference(rt->u.rt_next)) {
+            rt = rcu_dereference(rt->u.dst.rt_next)) {
                if ((rt->u.dst.flags & DST_BALANCED) != 0 &&
                    multipath_comparekeys(&rt->fl, flp)) {
                        struct multipath_candidate* mpc =
@@ -218,8 +217,8 @@ static void wrandom_select_route(const struct flowi *flp,
        *rp = decision;
 }
 
-static void wrandom_set_nhinfo(__u32 network,
-                              __u32 netmask,
+static void wrandom_set_nhinfo(__be32 network,
+                              __be32 netmask,
                               unsigned char prefixlen,
                               const struct fib_nh *nh)
 {
@@ -288,7 +287,7 @@ static void __multipath_free(struct rcu_head *head)
 
 static void __multipath_free_dst(struct rcu_head *head)
 {
-       struct multipath_dest *dst = container_of(head,
+       struct multipath_dest *dst = container_of(head,
                                                  struct multipath_dest,
                                                  rcu);
        kfree(dst);