All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v3 1/2] bonding: enhance L2 hash helper with packet type
@ 2014-07-17  6:16 Xie Jianhua
  2014-07-17  6:16 ` [PATCH net v3 2/2] bonding: update bonding.txt for Layer2 hash factors Xie Jianhua
  2014-07-17 23:03 ` [PATCH net v3 1/2] bonding: enhance L2 hash helper with packet type David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Xie Jianhua @ 2014-07-17  6:16 UTC (permalink / raw)
  To: netdev
  Cc: Jianhua Xie, Jay Vosburgh, Veaceslav Falico, Andy Gospodarek,
	David S. Miller, Pan Jiafei

From: Jianhua Xie <jianhua.xie@freescale.com>

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>
---

v3-changes:
 Create another patch for updating bonding.txt.

v2-changes:
 Use the appropriate interface skb_header_pointer()
 to check skb headlen, fragmented packet or not is
 not distinguished any more.

 drivers/net/bonding/bond_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3a451b6..bcff90c 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2999,11 +2999,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;
 }
 
-- 
1.8.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net v3 2/2] bonding: update bonding.txt for Layer2 hash factors
  2014-07-17  6:16 [PATCH net v3 1/2] bonding: enhance L2 hash helper with packet type Xie Jianhua
@ 2014-07-17  6:16 ` Xie Jianhua
  2014-07-17 23:03   ` David Miller
  2014-07-17 23:03 ` [PATCH net v3 1/2] bonding: enhance L2 hash helper with packet type David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Xie Jianhua @ 2014-07-17  6:16 UTC (permalink / raw)
  To: netdev
  Cc: Jianhua Xie, Jay Vosburgh, Veaceslav Falico, Andy Gospodarek,
	David S. Miller, Pan Jiafei

From: Jianhua Xie <jianhua.xie@freescale.com>

Document the Layer 2 hash factors with packet type ID field.

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>

Signed-off-by: Jianhua Xie <jianhua.xie@freescale.com>
---
 Documentation/networking/bonding.txt | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
index 9c723ec..eeb5b2e 100644
--- a/Documentation/networking/bonding.txt
+++ b/Documentation/networking/bonding.txt
@@ -542,10 +542,10 @@ mode
 
 		XOR policy: Transmit based on the selected transmit
 		hash policy.  The default policy is a simple [(source
-		MAC address XOR'd with destination MAC address) modulo
-		slave count].  Alternate transmit policies may be
-		selected via the xmit_hash_policy option, described
-		below.
+		MAC address XOR'd with destination MAC address XOR
+		packet type ID) modulo slave count].  Alternate transmit
+		policies may be	selected via the xmit_hash_policy option,
+		described below.
 
 		This mode provides load balancing and fault tolerance.
 
@@ -801,10 +801,11 @@ xmit_hash_policy
 
 	layer2
 
-		Uses XOR of hardware MAC addresses to generate the
-		hash.  The formula is
+		Uses XOR of hardware MAC addresses and packet type ID
+		field to generate the hash. The formula is
 
-		(source MAC XOR destination MAC) modulo slave count
+		hash = source MAC XOR destination MAC XOR packet type ID
+		slave number = hash modulo slave count
 
 		This algorithm will place all traffic to a particular
 		network peer on the same slave.
@@ -819,7 +820,7 @@ xmit_hash_policy
 		Uses XOR of hardware MAC addresses and IP addresses to
 		generate the hash.  The formula is
 
-		hash = source MAC XOR destination MAC
+		hash = source MAC XOR destination MAC XOR packet type ID
 		hash = hash XOR source IP XOR destination IP
 		hash = hash XOR (hash RSHIFT 16)
 		hash = hash XOR (hash RSHIFT 8)
@@ -2301,13 +2302,13 @@ broadcast: Like active-backup, there is not much advantage to this
 	bandwidth.  
 
 	Additionally, the linux bonding 802.3ad implementation
-	distributes traffic by peer (using an XOR of MAC addresses),
-	so in a "gatewayed" configuration, all outgoing traffic will
-	generally use the same device.  Incoming traffic may also end
-	up on a single device, but that is dependent upon the
-	balancing policy of the peer's 8023.ad implementation.  In a
-	"local" configuration, traffic will be distributed across the
-	devices in the bond.
+	distributes traffic by peer (using an XOR of MAC addresses
+	and packet type ID), so in a "gatewayed" configuration, all
+	outgoing traffic will generally use the same device.  Incoming
+	traffic may also end up on a single device, but that is
+	dependent upon the balancing policy of the peer's 8023.ad
+	implementation.  In a "local" configuration, traffic will be
+	distributed across the devices in the bond.
 
 	Finally, the 802.3ad mode mandates the use of the MII monitor,
 	therefore, the ARP monitor is not available in this mode.
-- 
1.8.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net v3 1/2] bonding: enhance L2 hash helper with packet type
  2014-07-17  6:16 [PATCH net v3 1/2] bonding: enhance L2 hash helper with packet type Xie Jianhua
  2014-07-17  6:16 ` [PATCH net v3 2/2] bonding: update bonding.txt for Layer2 hash factors Xie Jianhua
@ 2014-07-17 23:03 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2014-07-17 23:03 UTC (permalink / raw)
  To: Jianhua.Xie; +Cc: netdev, j.vosburgh, vfalico, andy, Jiafei.Pan

From: Xie Jianhua <Jianhua.Xie@freescale.com>
Date: Thu, 17 Jul 2014 14:16:25 +0800

> From: Jianhua Xie <jianhua.xie@freescale.com>
> 
> 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>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net v3 2/2] bonding: update bonding.txt for Layer2 hash factors
  2014-07-17  6:16 ` [PATCH net v3 2/2] bonding: update bonding.txt for Layer2 hash factors Xie Jianhua
@ 2014-07-17 23:03   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-07-17 23:03 UTC (permalink / raw)
  To: Jianhua.Xie; +Cc: netdev, j.vosburgh, vfalico, andy, Jiafei.Pan

From: Xie Jianhua <Jianhua.Xie@freescale.com>
Date: Thu, 17 Jul 2014 14:16:26 +0800

> From: Jianhua Xie <jianhua.xie@freescale.com>
> 
> Document the Layer 2 hash factors with packet type ID field.
> 
> 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>
> 
> Signed-off-by: Jianhua Xie <jianhua.xie@freescale.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-17 23:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-17  6:16 [PATCH net v3 1/2] bonding: enhance L2 hash helper with packet type Xie Jianhua
2014-07-17  6:16 ` [PATCH net v3 2/2] bonding: update bonding.txt for Layer2 hash factors Xie Jianhua
2014-07-17 23:03   ` David Miller
2014-07-17 23:03 ` [PATCH net v3 1/2] bonding: enhance L2 hash helper with packet type David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.