Advertisement
Guest User

Untitled

a guest
Mar 14th, 2013
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. 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
  2. --- linux-2.6-2.6.32/drivers/net/bonding/bond_main.c 2009-12-03 06:51:21.000000000 +0300
  3. +++ linux-2.6-2.6.32_igorsd/drivers/net/bonding/bond_main.c 2012-09-22 00:09:25.000000000 +0400
  4. @@ -133,7 +133,10 @@ module_param(ad_select, charp, 0);
  5. MODULE_PARM_DESC(ad_select, "803.ad aggregation selection logic: stable (0, default), bandwidth (1), count (2)");
  6. module_param(xmit_hash_policy, charp, 0);
  7. MODULE_PARM_DESC(xmit_hash_policy, "XOR hashing method: 0 for layer 2 (default)"
  8. - ", 1 for layer 3+4");
  9. + ", 1 for layer 3+4"
  10. + ", 2 for layer 2+3"
  11. + ", 3 for layer 3_dst_only"
  12. + ", 4 for layer 3_src_only ");
  13. module_param(arp_interval, int, 0);
  14. MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds");
  15. module_param_array(arp_ip_target, charp, NULL, 0);
  16. @@ -182,6 +185,8 @@ const struct bond_parm_tbl xmit_hashtype
  17. { "layer2", BOND_XMIT_POLICY_LAYER2},
  18. { "layer3+4", BOND_XMIT_POLICY_LAYER34},
  19. { "layer2+3", BOND_XMIT_POLICY_LAYER23},
  20. +{ "layer3_dst_only", BOND_XMIT_POLICY_LAYER3_DST_ONLY},
  21. +{ "layer3_src_only", BOND_XMIT_POLICY_LAYER3_SRC_ONLY},
  22. { NULL, -1},
  23. };
  24.  
  25. @@ -3671,6 +3676,33 @@ static int bond_xmit_hash_policy_l23(str
  26. return (data->h_dest[5] ^ data->h_source[5]) % count;
  27. }
  28.  
  29. +static int bond_xmit_hash_policy_l3_dst_only(struct sk_buff *skb,
  30. + struct net_device *bond_dev, int count)
  31. +{
  32. + struct ethhdr *data = (struct ethhdr *)skb->data;
  33. + struct iphdr *iph = ip_hdr(skb);
  34. +
  35. + if (skb->protocol == htons(ETH_P_IP)) {
  36. + return (ntohl(iph->daddr) & 0xffff) % count;
  37. + }
  38. +
  39. + return (data->h_dest[5] ^ data->h_source[5]) % count;
  40. +}
  41. +
  42. +
  43. +static int bond_xmit_hash_policy_l3_src_only(struct sk_buff *skb,
  44. + struct net_device *bond_dev, int count)
  45. +{
  46. + struct ethhdr *data = (struct ethhdr *)skb->data;
  47. + struct iphdr *iph = ip_hdr(skb);
  48. +
  49. + if (skb->protocol == htons(ETH_P_IP)) {
  50. + return (ntohl(iph->saddr) & 0xffff) % count;
  51. + }
  52. +
  53. + return (data->h_dest[5] ^ data->h_source[5]) % count;
  54. +}
  55. +
  56. /*
  57. * Hash for the output device based upon layer 3 and layer 4 data. If
  58. * the packet is a frag or not TCP or UDP, just use layer 3 data. If it is
  59. @@ -4394,6 +4426,12 @@ static void bond_set_xmit_hash_policy(st
  60. case BOND_XMIT_POLICY_LAYER34:
  61. bond->xmit_hash_policy = bond_xmit_hash_policy_l34;
  62. break;
  63. + case BOND_XMIT_POLICY_LAYER3_DST_ONLY:
  64. + bond->xmit_hash_policy = bond_xmit_hash_policy_l3_dst_only;
  65. + break;
  66. + case BOND_XMIT_POLICY_LAYER3_SRC_ONLY:
  67. + bond->xmit_hash_policy = bond_xmit_hash_policy_l3_src_only;
  68. + break;
  69. case BOND_XMIT_POLICY_LAYER2:
  70. default:
  71. bond->xmit_hash_policy = bond_xmit_hash_policy_l2;
  72. 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
  73. --- linux-2.6-2.6.32/include/linux/if_bonding.h 2009-12-03 06:51:21.000000000 +0300
  74. +++ linux-2.6-2.6.32_igorsd/include/linux/if_bonding.h 2012-09-21 22:48:17.000000000 +0400
  75. @@ -87,6 +87,8 @@
  76. #define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */
  77. #define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */
  78. #define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */
  79. +#define BOND_XMIT_POLICY_LAYER3_DST_ONLY 3 /* layer 3 (IP_DST) */
  80. +#define BOND_XMIT_POLICY_LAYER3_SRC_ONLY 4 /* layer 3 (IP_SRC) */
  81.  
  82. typedef struct ifbond {
  83. __s32 bond_mode;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement