Netdev List
 help / color / mirror / Atom feed
* [PATCH] net: bond: skip vlan header when do layer 3+4 hash policy
@ 2018-03-31  9:14 liujian56
  2018-03-31  9:22 ` Nikolay Aleksandrov
  2018-03-31 23:59 ` kbuild test robot
  0 siblings, 2 replies; 4+ messages in thread
From: liujian56 @ 2018-03-31  9:14 UTC (permalink / raw)
  To: davem, j.vosburgh, vfalico, andy; +Cc: netdev, weiyongjun1, liujian56

From: liujian <liujian56@huawei.com>

When the hash policy is BOND_XMIT_POLICY_LAYER34 mode and skb protocol 
is 802.1q VLAN, the policy will be degenerated to LAYER2 mode; Now, 
change it to get the next layer protocol to ensure that it worked in 
BOND_XMIT_POLICY_LAYER34 mode.

Signed-off-by: liujian <liujian56@huawei.com>
---
 drivers/net/bonding/bond_main.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c669554..d9f58819 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3206,14 +3206,19 @@ static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb,
 {
 	const struct ipv6hdr *iph6;
 	const struct iphdr *iph;
-	int noff, proto = -1;
+	int noff, proto = -1, skbproto;
 
 	if (bond->params.xmit_policy > BOND_XMIT_POLICY_LAYER23)
 		return skb_flow_dissect_flow_keys(skb, fk, 0);
 
 	fk->ports.ports = 0;
 	noff = skb_network_offset(skb);
-	if (skb->protocol == htons(ETH_P_IP)) {
+
+	skbproto = skb->protocol;
+	if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34)
+		skbproto = vlan_get_protocol(skb);
+
+	if (skbproto == htons(ETH_P_IP)) {
 		if (unlikely(!pskb_may_pull(skb, noff + sizeof(*iph))))
 			return false;
 		iph = ip_hdr(skb);
@@ -3221,7 +3226,7 @@ static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb,
 		noff += iph->ihl << 2;
 		if (!ip_is_fragment(iph))
 			proto = iph->protocol;
-	} else if (skb->protocol == htons(ETH_P_IPV6)) {
+	} else if (skbproto == htons(ETH_P_IPV6)) {
 		if (unlikely(!pskb_may_pull(skb, noff + sizeof(*iph6))))
 			return false;
 		iph6 = ipv6_hdr(skb);
-- 
2.7.4

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

end of thread, other threads:[~2018-04-02 10:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-31  9:14 [PATCH] net: bond: skip vlan header when do layer 3+4 hash policy liujian56
2018-03-31  9:22 ` Nikolay Aleksandrov
2018-04-02 10:53   ` liujian (CE)
2018-03-31 23:59 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox