Patchwork bonding: L2L3 xmit doesn't support IPv6

login
register
mail settings
Submitter Yinglin Sun
Date Oct. 8, 2011, 5:36 a.m.
Message ID <1318052205-21991-1-git-send-email-Yinglin.Sun@emc.com>
Download mbox | patch
Permalink /patch/118409/
State Deferred
Delegated to: David Miller
Headers show

Comments

Yinglin Sun - Oct. 8, 2011, 5:36 a.m.
Add IPv6 support in L2L3 xmit policy.
L3L4 doesn't support IPv6 either, and I'll try to fix that later.

Signed-off-by: Yinglin Sun <Yinglin.Sun@emc.com>
---
 drivers/net/bonding/bond_main.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
Yinglin Sun - Oct. 10, 2011, 7:35 p.m.
On Fri, Oct 7, 2011 at 10:36 PM, Yinglin Sun <Yinglin.Sun@emc.com> wrote:
> Add IPv6 support in L2L3 xmit policy.
> L3L4 doesn't support IPv6 either, and I'll try to fix that later.
>
> Signed-off-by: Yinglin Sun <Yinglin.Sun@emc.com>
> ---
>  drivers/net/bonding/bond_main.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 6d79b78..d6fd282 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -41,8 +41,10 @@
>  #include <linux/ptrace.h>
>  #include <linux/ioport.h>
>  #include <linux/in.h>
> +#include <linux/in6.h>
>  #include <net/ip.h>
>  #include <linux/ip.h>
> +#include <linux/ipv6.h>
>  #include <linux/tcp.h>
>  #include <linux/udp.h>
>  #include <linux/slab.h>
> @@ -3372,10 +3374,15 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
>  {
>        struct ethhdr *data = (struct ethhdr *)skb->data;
>        struct iphdr *iph = ip_hdr(skb);
> +       struct ipv6hdr *ipv6h = ipv6_hdr(skb);
>
>        if (skb->protocol == htons(ETH_P_IP)) {
>                return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
>                        (data->h_dest[5] ^ data->h_source[5])) % count;
> +       } else if (skb->protocol == htons(ETH_P_IPV6)) {
> +               return ((ntohl(ipv6h->saddr.s6_addr32[3] ^
> +                              ipv6h->daddr.s6_addr32[3]) & 0xffff) ^
> +                       (data->h_dest[5] ^ data->h_source[5])) % count;
>        }
>
>        return (data->h_dest[5] ^ data->h_source[5]) % count;
> --
> 1.7.4.1
>
>

Any comment on this patch? Thanks.

Yinglin
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Gospodarek - Oct. 11, 2011, 2:33 p.m.
On Fri, Oct 07, 2011 at 10:36:45PM -0700, Yinglin Sun wrote:
> Add IPv6 support in L2L3 xmit policy.
> L3L4 doesn't support IPv6 either, and I'll try to fix that later.
> 
> Signed-off-by: Yinglin Sun <Yinglin.Sun@emc.com>
> ---
>  drivers/net/bonding/bond_main.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 6d79b78..d6fd282 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -41,8 +41,10 @@
>  #include <linux/ptrace.h>
>  #include <linux/ioport.h>
>  #include <linux/in.h>
> +#include <linux/in6.h>
>  #include <net/ip.h>
>  #include <linux/ip.h>
> +#include <linux/ipv6.h>
>  #include <linux/tcp.h>
>  #include <linux/udp.h>
>  #include <linux/slab.h>
> @@ -3372,10 +3374,15 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
>  {
>  	struct ethhdr *data = (struct ethhdr *)skb->data;
>  	struct iphdr *iph = ip_hdr(skb);
> +	struct ipv6hdr *ipv6h = ipv6_hdr(skb);
>  
>  	if (skb->protocol == htons(ETH_P_IP)) {
>  		return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
>  			(data->h_dest[5] ^ data->h_source[5])) % count;
> +	} else if (skb->protocol == htons(ETH_P_IPV6)) {
> +		return ((ntohl(ipv6h->saddr.s6_addr32[3] ^
> +			       ipv6h->daddr.s6_addr32[3]) & 0xffff) ^
> +			(data->h_dest[5] ^ data->h_source[5])) % count;
>  	}
>  

There have been some attempts to add support for ipv6 hashing this in
the past, but none have been committed.  The best one I had seen was one
that did some extensive testing one a wide variety of ipv6 traffic and
it showed nice traffic distribution.  I'm not sure if it was ever posted
upstream, so I will see if I can dig it up.

Can you quantify how traffic was distributed with this algorithm?

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jay Vosburgh - Oct. 11, 2011, 3:58 p.m.
Andy Gospodarek <andy@greyhouse.net> wrote:

>On Fri, Oct 07, 2011 at 10:36:45PM -0700, Yinglin Sun wrote:
>> Add IPv6 support in L2L3 xmit policy.
>> L3L4 doesn't support IPv6 either, and I'll try to fix that later.
>> 
>> Signed-off-by: Yinglin Sun <Yinglin.Sun@emc.com>
>> ---
>>  drivers/net/bonding/bond_main.c |    7 +++++++
>>  1 files changed, 7 insertions(+), 0 deletions(-)
>> 
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index 6d79b78..d6fd282 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -41,8 +41,10 @@
>>  #include <linux/ptrace.h>
>>  #include <linux/ioport.h>
>>  #include <linux/in.h>
>> +#include <linux/in6.h>
>>  #include <net/ip.h>
>>  #include <linux/ip.h>
>> +#include <linux/ipv6.h>
>>  #include <linux/tcp.h>
>>  #include <linux/udp.h>
>>  #include <linux/slab.h>
>> @@ -3372,10 +3374,15 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
>>  {
>>  	struct ethhdr *data = (struct ethhdr *)skb->data;
>>  	struct iphdr *iph = ip_hdr(skb);
>> +	struct ipv6hdr *ipv6h = ipv6_hdr(skb);
>>  
>>  	if (skb->protocol == htons(ETH_P_IP)) {
>>  		return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
>>  			(data->h_dest[5] ^ data->h_source[5])) % count;
>> +	} else if (skb->protocol == htons(ETH_P_IPV6)) {
>> +		return ((ntohl(ipv6h->saddr.s6_addr32[3] ^
>> +			       ipv6h->daddr.s6_addr32[3]) & 0xffff) ^
>> +			(data->h_dest[5] ^ data->h_source[5])) % count;
>>  	}
>>  
>
>There have been some attempts to add support for ipv6 hashing this in
>the past, but none have been committed.  The best one I had seen was one
>that did some extensive testing one a wide variety of ipv6 traffic and
>it showed nice traffic distribution.  I'm not sure if it was ever posted
>upstream, so I will see if I can dig it up.
>
>Can you quantify how traffic was distributed with this algorithm?

	As I recall, the IPv6 issues had to do with the "layer3+4" hash,
because the IPv6 TCP or UDP port numbers can be harder to get at than in
IPv4 (which typically has a fixed size header).  The above is just for
layer 2, so it only hits the IPv6 addresses, which don't move around.

	That said, I believe that many IPv6 addresses are derived from
the MAC address, the autoconf addresses in particular, so s6_addr32[3]
may not show a lot more variation than just the MAC address.  I don't
know for sure though, since I haven't tested it.

	I don't recall seeing the patch you mention, Andy, that checks
ipv6 traffic; can you post it?

	-J

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yinglin Sun - Oct. 12, 2011, 3:27 a.m.
On Tue, Oct 11, 2011 at 7:33 AM, Andy Gospodarek <andy@greyhouse.net> wrote:
> On Fri, Oct 07, 2011 at 10:36:45PM -0700, Yinglin Sun wrote:
>> Add IPv6 support in L2L3 xmit policy.
>> L3L4 doesn't support IPv6 either, and I'll try to fix that later.
>>
>> Signed-off-by: Yinglin Sun <Yinglin.Sun@emc.com>
>> ---
>>  drivers/net/bonding/bond_main.c |    7 +++++++
>>  1 files changed, 7 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index 6d79b78..d6fd282 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -41,8 +41,10 @@
>>  #include <linux/ptrace.h>
>>  #include <linux/ioport.h>
>>  #include <linux/in.h>
>> +#include <linux/in6.h>
>>  #include <net/ip.h>
>>  #include <linux/ip.h>
>> +#include <linux/ipv6.h>
>>  #include <linux/tcp.h>
>>  #include <linux/udp.h>
>>  #include <linux/slab.h>
>> @@ -3372,10 +3374,15 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
>>  {
>>       struct ethhdr *data = (struct ethhdr *)skb->data;
>>       struct iphdr *iph = ip_hdr(skb);
>> +     struct ipv6hdr *ipv6h = ipv6_hdr(skb);
>>
>>       if (skb->protocol == htons(ETH_P_IP)) {
>>               return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
>>                       (data->h_dest[5] ^ data->h_source[5])) % count;
>> +     } else if (skb->protocol == htons(ETH_P_IPV6)) {
>> +             return ((ntohl(ipv6h->saddr.s6_addr32[3] ^
>> +                            ipv6h->daddr.s6_addr32[3]) & 0xffff) ^
>> +                     (data->h_dest[5] ^ data->h_source[5])) % count;
>>       }
>>
>
> There have been some attempts to add support for ipv6 hashing this in
> the past, but none have been committed.  The best one I had seen was one
> that did some extensive testing one a wide variety of ipv6 traffic and
> it showed nice traffic distribution.  I'm not sure if it was ever posted
> upstream, so I will see if I can dig it up.
>
> Can you quantify how traffic was distributed with this algorithm?
>

My test was not extensive. I manually set some addresses which vary by
the last 32bit portion, and the traffic was distributed evenly across
slaves.

I agree that the real world IPv6 traffic should be used for more extensive test.

Yinglin
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yinglin Sun - Oct. 12, 2011, 3:30 a.m.
On Tue, Oct 11, 2011 at 8:58 AM, Jay Vosburgh <fubar@us.ibm.com> wrote:
> Andy Gospodarek <andy@greyhouse.net> wrote:
>
>>On Fri, Oct 07, 2011 at 10:36:45PM -0700, Yinglin Sun wrote:
>>> Add IPv6 support in L2L3 xmit policy.
>>> L3L4 doesn't support IPv6 either, and I'll try to fix that later.
>>>
>>> Signed-off-by: Yinglin Sun <Yinglin.Sun@emc.com>
>>> ---
>>>  drivers/net/bonding/bond_main.c |    7 +++++++
>>>  1 files changed, 7 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>>> index 6d79b78..d6fd282 100644
>>> --- a/drivers/net/bonding/bond_main.c
>>> +++ b/drivers/net/bonding/bond_main.c
>>> @@ -41,8 +41,10 @@
>>>  #include <linux/ptrace.h>
>>>  #include <linux/ioport.h>
>>>  #include <linux/in.h>
>>> +#include <linux/in6.h>
>>>  #include <net/ip.h>
>>>  #include <linux/ip.h>
>>> +#include <linux/ipv6.h>
>>>  #include <linux/tcp.h>
>>>  #include <linux/udp.h>
>>>  #include <linux/slab.h>
>>> @@ -3372,10 +3374,15 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
>>>  {
>>>      struct ethhdr *data = (struct ethhdr *)skb->data;
>>>      struct iphdr *iph = ip_hdr(skb);
>>> +    struct ipv6hdr *ipv6h = ipv6_hdr(skb);
>>>
>>>      if (skb->protocol == htons(ETH_P_IP)) {
>>>              return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
>>>                      (data->h_dest[5] ^ data->h_source[5])) % count;
>>> +    } else if (skb->protocol == htons(ETH_P_IPV6)) {
>>> +            return ((ntohl(ipv6h->saddr.s6_addr32[3] ^
>>> +                           ipv6h->daddr.s6_addr32[3]) & 0xffff) ^
>>> +                    (data->h_dest[5] ^ data->h_source[5])) % count;
>>>      }
>>>
>>
>>There have been some attempts to add support for ipv6 hashing this in
>>the past, but none have been committed.  The best one I had seen was one
>>that did some extensive testing one a wide variety of ipv6 traffic and
>>it showed nice traffic distribution.  I'm not sure if it was ever posted
>>upstream, so I will see if I can dig it up.
>>
>>Can you quantify how traffic was distributed with this algorithm?
>
>        As I recall, the IPv6 issues had to do with the "layer3+4" hash,
> because the IPv6 TCP or UDP port numbers can be harder to get at than in
> IPv4 (which typically has a fixed size header).  The above is just for
> layer 2, so it only hits the IPv6 addresses, which don't move around.
>
>        That said, I believe that many IPv6 addresses are derived from
> the MAC address, the autoconf addresses in particular, so s6_addr32[3]
> may not show a lot more variation than just the MAC address.  I don't
> know for sure though, since I haven't tested it.
>

This is a good point. The last 32bit portion is not enough for some cases.

Yinglin
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 6d79b78..d6fd282 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -41,8 +41,10 @@ 
 #include <linux/ptrace.h>
 #include <linux/ioport.h>
 #include <linux/in.h>
+#include <linux/in6.h>
 #include <net/ip.h>
 #include <linux/ip.h>
+#include <linux/ipv6.h>
 #include <linux/tcp.h>
 #include <linux/udp.h>
 #include <linux/slab.h>
@@ -3372,10 +3374,15 @@  static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
 {
 	struct ethhdr *data = (struct ethhdr *)skb->data;
 	struct iphdr *iph = ip_hdr(skb);
+	struct ipv6hdr *ipv6h = ipv6_hdr(skb);
 
 	if (skb->protocol == htons(ETH_P_IP)) {
 		return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
 			(data->h_dest[5] ^ data->h_source[5])) % count;
+	} else if (skb->protocol == htons(ETH_P_IPV6)) {
+		return ((ntohl(ipv6h->saddr.s6_addr32[3] ^
+			       ipv6h->daddr.s6_addr32[3]) & 0xffff) ^
+			(data->h_dest[5] ^ data->h_source[5])) % count;
 	}
 
 	return (data->h_dest[5] ^ data->h_source[5]) % count;