Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -uprN linux-2.6-2.6.32/drivers/net/bonding/bond_main.c linux-2.6-2.6.32_igorsd/drivers/net/bonding/bond_main.c
- --- linux-2.6-2.6.32/drivers/net/bonding/bond_main.c 2009-12-03 06:51:21.000000000 +0300
- +++ linux-2.6-2.6.32_igorsd/drivers/net/bonding/bond_main.c 2012-09-22 00:09:25.000000000 +0400
- @@ -133,7 +133,10 @@ module_param(ad_select, charp, 0);
- MODULE_PARM_DESC(ad_select, "803.ad aggregation selection logic: stable (0, default), bandwidth (1), count (2)");
- module_param(xmit_hash_policy, charp, 0);
- MODULE_PARM_DESC(xmit_hash_policy, "XOR hashing method: 0 for layer 2 (default)"
- - ", 1 for layer 3+4");
- + ", 1 for layer 3+4"
- + ", 2 for layer 2+3"
- + ", 3 for layer 3_dst_only"
- + ", 4 for layer 3_src_only ");
- module_param(arp_interval, int, 0);
- MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds");
- module_param_array(arp_ip_target, charp, NULL, 0);
- @@ -182,6 +185,8 @@ const struct bond_parm_tbl xmit_hashtype
- { "layer2", BOND_XMIT_POLICY_LAYER2},
- { "layer3+4", BOND_XMIT_POLICY_LAYER34},
- { "layer2+3", BOND_XMIT_POLICY_LAYER23},
- +{ "layer3_dst_only", BOND_XMIT_POLICY_LAYER3_DST_ONLY},
- +{ "layer3_src_only", BOND_XMIT_POLICY_LAYER3_SRC_ONLY},
- { NULL, -1},
- };
- @@ -3671,6 +3676,33 @@ static int bond_xmit_hash_policy_l23(str
- return (data->h_dest[5] ^ data->h_source[5]) % count;
- }
- +static int bond_xmit_hash_policy_l3_dst_only(struct sk_buff *skb,
- + struct net_device *bond_dev, int count)
- +{
- + struct ethhdr *data = (struct ethhdr *)skb->data;
- + struct iphdr *iph = ip_hdr(skb);
- +
- + if (skb->protocol == htons(ETH_P_IP)) {
- + return (ntohl(iph->daddr) & 0xffff) % count;
- + }
- +
- + return (data->h_dest[5] ^ data->h_source[5]) % count;
- +}
- +
- +
- +static int bond_xmit_hash_policy_l3_src_only(struct sk_buff *skb,
- + struct net_device *bond_dev, int count)
- +{
- + struct ethhdr *data = (struct ethhdr *)skb->data;
- + struct iphdr *iph = ip_hdr(skb);
- +
- + if (skb->protocol == htons(ETH_P_IP)) {
- + return (ntohl(iph->saddr) & 0xffff) % count;
- + }
- +
- + return (data->h_dest[5] ^ data->h_source[5]) % count;
- +}
- +
- /*
- * Hash for the output device based upon layer 3 and layer 4 data. If
- * the packet is a frag or not TCP or UDP, just use layer 3 data. If it is
- @@ -4394,6 +4426,12 @@ static void bond_set_xmit_hash_policy(st
- case BOND_XMIT_POLICY_LAYER34:
- bond->xmit_hash_policy = bond_xmit_hash_policy_l34;
- break;
- + case BOND_XMIT_POLICY_LAYER3_DST_ONLY:
- + bond->xmit_hash_policy = bond_xmit_hash_policy_l3_dst_only;
- + break;
- + case BOND_XMIT_POLICY_LAYER3_SRC_ONLY:
- + bond->xmit_hash_policy = bond_xmit_hash_policy_l3_src_only;
- + break;
- case BOND_XMIT_POLICY_LAYER2:
- default:
- bond->xmit_hash_policy = bond_xmit_hash_policy_l2;
- diff -uprN linux-2.6-2.6.32/include/linux/if_bonding.h linux-2.6-2.6.32_igorsd/include/linux/if_bonding.h
- --- linux-2.6-2.6.32/include/linux/if_bonding.h 2009-12-03 06:51:21.000000000 +0300
- +++ linux-2.6-2.6.32_igorsd/include/linux/if_bonding.h 2012-09-21 22:48:17.000000000 +0400
- @@ -87,6 +87,8 @@
- #define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */
- #define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */
- #define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */
- +#define BOND_XMIT_POLICY_LAYER3_DST_ONLY 3 /* layer 3 (IP_DST) */
- +#define BOND_XMIT_POLICY_LAYER3_SRC_ONLY 4 /* layer 3 (IP_SRC) */
- typedef struct ifbond {
- __s32 bond_mode;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement