lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1366419435.16391.70.camel@edumazet-glaptop>
Date:	Fri, 19 Apr 2013 17:57:15 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Nikolay Aleksandrov <nikolay@...hat.com>
Cc:	netdev@...r.kernel.org, fubar@...ibm.com, andy@...yhouse.net,
	davem@...emloft.net
Subject: Re: [PATCH net-next] bonding: change xmit hash functions to use
 skb_flow_dissect

On Sat, 2013-04-20 at 01:02 +0200, Nikolay Aleksandrov wrote:
> As Eric suggested earlier, bonding hash functions can make good use of
> skb_flow_dissect. The old use cases should have the same results, but
> there should be good improvement for tunnel users mostly over IPv4.
> I've kept the IPv6 address hashing algorithm and thus if a tunnel is
> used over IPv6 then the addresses will be the same but there still can be
> improvement because the ports from skb_flow_dissect will be mixed in.
> This also fixes a problem with protocol == ETH_P_8021Q load balancing.

Are you sure ? we don't look at skb->vlan_tci

> In case of non-dissectable packet, the algorithms fall back to L2
> hashing.
> 
> Signed-off-by: Nikolay Aleksandrov <nikolay@...hat.com>
> ---
>  drivers/net/bonding/bond_main.c | 114 ++++++++++++++++++----------------------
>  1 file changed, 50 insertions(+), 64 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 5e22126..722d8c1 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -77,6 +77,7 @@
>  #include <net/net_namespace.h>
>  #include <net/netns/generic.h>
>  #include <net/pkt_sched.h>
> +#include <net/flow_keys.h>
>  #include "bonding.h"
>  #include "bond_3ad.h"
>  #include "bond_alb.h"
> @@ -3271,94 +3272,79 @@ static struct notifier_block bond_netdev_notifier = {
>  

> +
> +	layer4_xor = ntohs(flow.port16[0] ^ flow.port16[1]);
> +
> +	if (skb->protocol == htons(ETH_P_IPV6))
> +		return (layer4_xor ^ bond_ipv6_hash(skb)) % count;
> +	else
> +		return (layer4_xor ^ bond_ipv4_hash(&flow)) % count;
>  }
>  

Not sure its worth doing this test, as IPv6 addresses are mixed already.

So just

hash = (__force u32)flow.ports ^
       (__force u32)keys.dst ^
       (__force u32)keys.src;

hash ^= (hash >> 16);
hash ^= (hash >> 8);

return hash % count;


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ