Setting tag linux-2.6-22-50
[linux-2.6.git] / linux-2.6-722-bonding-rr.patch
1 diff -Nurp linux-2.6.22.19-vs2.3.0.34.bond2/drivers/net/bonding/bond_main.c linux-2.6.22.19-vs2.3.0.34.bonding/drivers/net/bonding/bond_main.c
2 --- linux-2.6.22.19-vs2.3.0.34.bond2/drivers/net/bonding/bond_main.c    2009-06-23 01:02:56.000000000 +0200
3 +++ linux-2.6.22.19-vs2.3.0.34.bonding/drivers/net/bonding/bond_main.c  2009-06-15 21:52:30.000000000 +0200
4 @@ -172,6 +172,7 @@ struct bond_parm_tbl xmit_hashtype_tbl[]
5  {      "layer3+4",             BOND_XMIT_POLICY_LAYER34},
6  {      "layer2+3",             BOND_XMIT_POLICY_LAYER23},
7  {      "layer3",               BOND_XMIT_POLICY_LAYER3},
8 +{      "rr",                   BOND_XMIT_POLICY_RR},
9  {      NULL,                   -1},
10  };
11  
12 @@ -3522,6 +3523,16 @@ static int bond_xmit_hash_policy_l2(stru
13         return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count;
14  }
15  
16 +/*
17 + * Round-robin "hashing" algorithm
18 + */
19 +static int bond_xmit_hash_policy_rr(struct sk_buff *skb,
20 +                                   struct net_device *bond_dev, int count)
21 +{
22 +       static atomic_t packets;
23 +       return atomic_inc_return(&packets) % count;
24 +}
25 +
26  /*-------------------------- Device entry points ----------------------------*/
27  
28  static int bond_open(struct net_device *bond_dev)
29 @@ -4223,6 +4234,8 @@ void bond_set_mode_ops(struct bonding *b
30                         bond->xmit_hash_policy = bond_xmit_hash_policy_l23;
31                 else if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER3)
32                         bond->xmit_hash_policy = bond_xmit_hash_policy_l3;
33 +               else if (bond->params.xmit_policy == BOND_XMIT_POLICY_RR)
34 +                       bond->xmit_hash_policy = bond_xmit_hash_policy_rr;
35                 else
36                         bond->xmit_hash_policy = bond_xmit_hash_policy_l2;
37                 break;
38 @@ -4238,6 +4251,8 @@ void bond_set_mode_ops(struct bonding *b
39                         bond->xmit_hash_policy = bond_xmit_hash_policy_l23;
40                 else if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER3)
41                         bond->xmit_hash_policy = bond_xmit_hash_policy_l3;
42 +               else if (bond->params.xmit_policy == BOND_XMIT_POLICY_RR)
43 +                       bond->xmit_hash_policy = bond_xmit_hash_policy_rr;
44                 else
45                         bond->xmit_hash_policy = bond_xmit_hash_policy_l2;
46                 break;
47 diff -Nurp linux-2.6.22.19-vs2.3.0.34.bond2/include/linux/if_bonding.h linux-2.6.22.19-vs2.3.0.34.bonding/include/linux/if_bonding.h
48 --- linux-2.6.22.19-vs2.3.0.34.bond2/include/linux/if_bonding.h 2009-06-23 01:02:07.000000000 +0200
49 +++ linux-2.6.22.19-vs2.3.0.34.bonding/include/linux/if_bonding.h       2009-06-15 22:02:09.000000000 +0200
50 @@ -88,6 +88,7 @@
51  #define BOND_XMIT_POLICY_LAYER34       1 /* layer 3+4 (IP ^ MAC) */
52  #define BOND_XMIT_POLICY_LAYER23       2 /* layer 2+3 (IP ^ MAC) */
53  #define BOND_XMIT_POLICY_LAYER3                3 /* layer3 (IP only) */
54 +#define BOND_XMIT_POLICY_RR            255 /* round-robin */
55  
56  typedef struct ifbond {
57         __s32 bond_mode;