[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1522487670-15796-1-git-send-email-liujian56@huawei.com>
Date: Sat, 31 Mar 2018 17:14:30 +0800
From: <liujian56@...wei.com>
To: <davem@...emloft.net>, <j.vosburgh@...il.com>, <vfalico@...il.com>,
<andy@...yhouse.net>
CC: <netdev@...r.kernel.org>, <weiyongjun1@...wei.com>,
<liujian56@...wei.com>
Subject: [PATCH] net: bond: skip vlan header when do layer 3+4 hash policy
From: liujian <liujian56@...wei.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@...wei.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
Powered by blists - more mailing lists