From: <liujian56@huawei.com>
To: <davem@davemloft.net>, <j.vosburgh@gmail.com>,
<vfalico@gmail.com>, <andy@greyhouse.net>
Cc: <netdev@vger.kernel.org>, <weiyongjun1@huawei.com>,
<liujian56@huawei.com>
Subject: [PATCH] net: bond: skip vlan header when do layer 3+4 hash policy
Date: Sat, 31 Mar 2018 17:14:30 +0800 [thread overview]
Message-ID: <1522487670-15796-1-git-send-email-liujian56@huawei.com> (raw)
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
next reply other threads:[~2018-03-31 9:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-31 9:14 liujian56 [this message]
2018-03-31 9:22 ` [PATCH] net: bond: skip vlan header when do layer 3+4 hash policy Nikolay Aleksandrov
2018-04-02 10:53 ` liujian (CE)
2018-03-31 23:59 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1522487670-15796-1-git-send-email-liujian56@huawei.com \
--to=liujian56@huawei.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=j.vosburgh@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=vfalico@gmail.com \
--cc=weiyongjun1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox