summaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
authorJianhua Xie2014-07-17 08:16:25 +0200
committerDavid S. Miller2014-07-18 01:03:27 +0200
commitce04d63502ca7ec30ef07336a0fd6f1165fd486b (patch)
treee8c2535833ba5467c2b2a872323d6e33f81f0e56 /drivers/net/bonding/bond_main.c
parentUpdate setapp/getapp prototypes in dcbnl_rtnl_ops to return int instead of u8 (diff)
downloadkernel-qcow2-linux-ce04d63502ca7ec30ef07336a0fd6f1165fd486b.tar.gz
kernel-qcow2-linux-ce04d63502ca7ec30ef07336a0fd6f1165fd486b.tar.xz
kernel-qcow2-linux-ce04d63502ca7ec30ef07336a0fd6f1165fd486b.zip
bonding: enhance L2 hash helper with packet type
Current L2 hash helper calculates destination eth addr and source ether addr as L2 hash factors. This patch is adding packet type ID field into L2 hash factors. While one of BOND_XMIT_POLICY_LAYER2 or BOND_XMIT_POLICY_{LAYER|ENCAP}23 is applied, for the 2nd level hash, enhanced hash method can help to distribute different types of packets like IPv4/IPv6 packets to different slave devices. CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Veaceslav Falico <vfalico@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> CC: David S. Miller <davem@davemloft.net> CC: Pan Jiafei <Jiafei.Pan@freescale.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jianhua Xie <jianhua.xie@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 1ff676caa9cd..a2c4e8d4a955 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2977,11 +2977,11 @@ static struct notifier_block bond_netdev_notifier = {
/* L2 hash helper */
static inline u32 bond_eth_hash(struct sk_buff *skb)
{
- struct ethhdr *data = (struct ethhdr *)skb->data;
-
- if (skb_headlen(skb) >= offsetof(struct ethhdr, h_proto))
- return data->h_dest[5] ^ data->h_source[5];
+ struct ethhdr *ep, hdr_tmp;
+ ep = skb_header_pointer(skb, 0, sizeof(hdr_tmp), &hdr_tmp);
+ if (ep)
+ return ep->h_dest[5] ^ ep->h_source[5] ^ ep->h_proto;
return 0;
}