linux-stable/drivers/net/bonding
suresh kumar 49aefd1317 bonding: do not discard lowest hash bit for non layer3+4 hashing
Commit b5f862180d was introduced to discard lowest hash bit for layer3+4 hashing
but it also removes last bit from non layer3+4 hashing

Below script shows layer2+3 hashing will result in same slave to be used with above commit.
$ cat hash.py
#/usr/bin/python3.6

h_dests=[0xa0, 0xa1]
h_source=0xe3
hproto=0x8
saddr=0x1e7aa8c0
daddr=0x17aa8c0

for h_dest in h_dests:
    hash = (h_dest ^ h_source ^ hproto ^ saddr ^ daddr)
    hash ^= hash >> 16
    hash ^= hash >> 8
    print(hash)

print("with last bit removed")
for h_dest in h_dests:
    hash = (h_dest ^ h_source ^ hproto ^ saddr ^ daddr)
    hash ^= hash >> 16
    hash ^= hash >> 8
    hash = hash >> 1
    print(hash)

Output:
$ python3.6 hash.py
522133332
522133333   <-------------- will result in both slaves being used

with last bit removed
261066666
261066666   <-------------- only single slave used

Signed-off-by: suresh kumar <suresh2514@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-04-17 13:34:01 +01:00
..
bond_3ad.c bonding: fix data-races around agg_select_timer 2022-02-15 14:35:18 +00:00
bond_alb.c net: don't include ndisc.h from ipv6.h 2022-02-04 14:15:11 -08:00
bond_debugfs.c net: bonding: remove unnecessary braces 2021-05-20 15:43:24 -07:00
bond_main.c bonding: do not discard lowest hash bit for non layer3+4 hashing 2022-04-17 13:34:01 +01:00
bond_netlink.c bonding: add new option ns_ip6_target 2022-02-21 12:13:45 +00:00
bond_options.c bonding: add new option ns_ip6_target 2022-02-21 12:13:45 +00:00
bond_procfs.c bonding: switch bond_net_exit() to batch mode 2022-02-08 20:41:35 -08:00
bond_sysfs.c Bonding: add arp_missed_max option 2021-11-30 12:15:58 +00:00
bond_sysfs_slave.c bonding: helper macro __ATTR_RO to make code more clear 2022-03-06 12:10:16 +00:00
bonding_priv.h drivers: Remove inclusion of vermagic header 2020-04-21 13:27:37 -07:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00