netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] bonding: enhance L2 hash helper with packet type
@ 2014-07-15  7:41 Xie Jianhua
  2014-07-15  8:05 ` Eric Dumazet
  2014-07-15  8:20 ` Veaceslav Falico
  0 siblings, 2 replies; 4+ messages in thread
From: Xie Jianhua @ 2014-07-15  7:41 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 hash factors, which can help to
distribute different types of packets like IPv4/IPv6 packets
to different slave devices while only BOND_XMIT_POLICY_LAYER2
is applied.

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>

Suggested-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jianhua Xie <jianhua.xie@freescale.com>
---

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

* Re: [PATCH net v2] bonding: enhance L2 hash helper with packet type
  2014-07-15  7:41 [PATCH net v2] bonding: enhance L2 hash helper with packet type Xie Jianhua
@ 2014-07-15  8:05 ` Eric Dumazet
  2014-07-15  8:20 ` Veaceslav Falico
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2014-07-15  8:05 UTC (permalink / raw)
  To: Xie Jianhua
  Cc: netdev, Jay Vosburgh, Veaceslav Falico, Andy Gospodarek,
	David S. Miller, Pan Jiafei

On Tue, 2014-07-15 at 15:41 +0800, Xie Jianhua wrote:
> 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 hash factors, which can help to
> distribute different types of packets like IPv4/IPv6 packets
> to different slave devices while only BOND_XMIT_POLICY_LAYER2
> is applied.
> 
> 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>
> 
> Suggested-by: David S. Miller <davem@davemloft.net>

I do not think this patch was suggested by David.

He suggested to use skb_header_pointer() which is an implementation
detail.

Anyway, patch looks fine, even if bond_eth_hash() is no longer a leaf
function.

Acked-by: Eric Dumazet <edumazet@google.com>

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

* Re: [PATCH net v2] bonding: enhance L2 hash helper with packet type
  2014-07-15  7:41 [PATCH net v2] bonding: enhance L2 hash helper with packet type Xie Jianhua
  2014-07-15  8:05 ` Eric Dumazet
@ 2014-07-15  8:20 ` Veaceslav Falico
  2014-07-16 22:23   ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Veaceslav Falico @ 2014-07-15  8:20 UTC (permalink / raw)
  To: Xie Jianhua
  Cc: netdev, Jay Vosburgh, Andy Gospodarek, David S. Miller, Pan Jiafei

On Tue, Jul 15, 2014 at 03:41:23PM +0800, Xie Jianhua wrote:
>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 hash factors, which can help to
>distribute different types of packets like IPv4/IPv6 packets
>to different slave devices while only BOND_XMIT_POLICY_LAYER2
>is applied.

1) It's also used in BOND_XMIT_POLICY_{LAYER|ENCAP}23, for the 2nd level
hash.
2) The documentation (D/networking/bonding.txt) also needs an update.

Otherwise, looks good.

>
>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>
>
>Suggested-by: David S. Miller <davem@davemloft.net>
>Signed-off-by: Jianhua Xie <jianhua.xie@freescale.com>
>---
>
>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	[flat|nested] 4+ messages in thread

* Re: [PATCH net v2] bonding: enhance L2 hash helper with packet type
  2014-07-15  8:20 ` Veaceslav Falico
@ 2014-07-16 22:23   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-07-16 22:23 UTC (permalink / raw)
  To: vfalico; +Cc: Jianhua.Xie, netdev, j.vosburgh, andy, Jiafei.Pan

From: Veaceslav Falico <vfalico@gmail.com>
Date: Tue, 15 Jul 2014 10:20:28 +0200

> On Tue, Jul 15, 2014 at 03:41:23PM +0800, Xie Jianhua wrote:
>>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 hash factors, which can help to
>>distribute different types of packets like IPv4/IPv6 packets
>>to different slave devices while only BOND_XMIT_POLICY_LAYER2
>>is applied.
> 
> 1) It's also used in BOND_XMIT_POLICY_{LAYER|ENCAP}23, for the 2nd
> level
> hash.
> 2) The documentation (D/networking/bonding.txt) also needs an update.
> 
> Otherwise, looks good.

Please make these adjustments and resubmit this patch, thank you.

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-15  7:41 [PATCH net v2] bonding: enhance L2 hash helper with packet type Xie Jianhua
2014-07-15  8:05 ` Eric Dumazet
2014-07-15  8:20 ` Veaceslav Falico
2014-07-16 22:23   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).