1 diff -Nurp linux-2.6.22.19-vs2.3.0.34.bond1/drivers/net/bonding/bond_main.c linux-2.6.22.19-vs2.3.0.34.bond2/drivers/net/bonding/bond_main.c
2 --- linux-2.6.22.19-vs2.3.0.34.bond1/drivers/net/bonding/bond_main.c 2009-06-23 00:51:24.000000000 +0200
3 +++ linux-2.6.22.19-vs2.3.0.34.bond2/drivers/net/bonding/bond_main.c 2009-06-23 01:02:56.000000000 +0200
4 @@ -171,6 +171,7 @@ struct bond_parm_tbl xmit_hashtype_tbl[]
5 { "layer2", BOND_XMIT_POLICY_LAYER2},
6 { "layer3+4", BOND_XMIT_POLICY_LAYER34},
7 { "layer2+3", BOND_XMIT_POLICY_LAYER23},
8 +{ "layer3", BOND_XMIT_POLICY_LAYER3},
12 @@ -3450,6 +3451,22 @@ void bond_unregister_arp(struct bonding
13 /*---------------------------- Hashing Policies -----------------------------*/
16 + * Hash for the output device based upon layer 3 data. If the packet
17 + * is not IP mimic bond_xmit_hash_policy_l2()
19 +static int bond_xmit_hash_policy_l3(struct sk_buff *skb,
20 + struct net_device *bond_dev, int count)
22 + struct ethhdr *data = (struct ethhdr *)skb->data;
23 + struct iphdr *iph = ip_hdr(skb);
25 + if (skb->protocol == __constant_htons(ETH_P_IP))
26 + return (ntohl(iph->saddr ^ iph->daddr) & 0xffff) % count;
28 + return (data->h_dest[5] ^ bond_dev->dev_addr[5]) % count;
32 * Hash for the output device based upon layer 2 and layer 3 data. If
33 * the packet is not IP mimic bond_xmit_hash_policy_l2()
35 @@ -4204,6 +4221,8 @@ void bond_set_mode_ops(struct bonding *b
36 bond->xmit_hash_policy = bond_xmit_hash_policy_l34;
37 else if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER23)
38 bond->xmit_hash_policy = bond_xmit_hash_policy_l23;
39 + else if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER3)
40 + bond->xmit_hash_policy = bond_xmit_hash_policy_l3;
42 bond->xmit_hash_policy = bond_xmit_hash_policy_l2;
44 @@ -4217,6 +4236,8 @@ void bond_set_mode_ops(struct bonding *b
45 bond->xmit_hash_policy = bond_xmit_hash_policy_l34;
46 else if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER23)
47 bond->xmit_hash_policy = bond_xmit_hash_policy_l23;
48 + else if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER3)
49 + bond->xmit_hash_policy = bond_xmit_hash_policy_l3;
51 bond->xmit_hash_policy = bond_xmit_hash_policy_l2;
53 diff -Nurp linux-2.6.22.19-vs2.3.0.34.bond1/include/linux/if_bonding.h linux-2.6.22.19-vs2.3.0.34.bond2/include/linux/if_bonding.h
54 --- linux-2.6.22.19-vs2.3.0.34.bond1/include/linux/if_bonding.h 2009-06-23 00:49:47.000000000 +0200
55 +++ linux-2.6.22.19-vs2.3.0.34.bond2/include/linux/if_bonding.h 2009-06-23 01:02:07.000000000 +0200
57 #define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */
58 #define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ MAC) */
59 #define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */
60 +#define BOND_XMIT_POLICY_LAYER3 3 /* layer3 (IP only) */
62 typedef struct ifbond {