From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subject: [PATCH] net: bond: skip vlan header when do layer 3+4 hash policy Date: Sat, 31 Mar 2018 17:14:30 +0800 Message-ID: <1522487670-15796-1-git-send-email-liujian56@huawei.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , To: , , , Return-path: Received: from szxga04-in.huawei.com ([45.249.212.190]:7142 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751560AbeCaJPK (ORCPT ); Sat, 31 Mar 2018 05:15:10 -0400 Sender: netdev-owner@vger.kernel.org List-ID: From: liujian 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 --- 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