Hi liujian, Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master] [also build test WARNING on v4.16-rc7 next-20180329] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/liujian56-huawei-com/net-bond-skip-vlan-header-when-do-layer-3-4-hash-policy/20180401-045327 reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) drivers/net/bonding/bond_main.c:2343:26: sparse: restricted __be16 degrades to integer drivers/net/bonding/bond_main.c:2349:20: sparse: restricted __be16 degrades to integer drivers/net/bonding/bond_main.c:2396:40: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] vlan_proto @@ got e] vlan_proto @@ drivers/net/bonding/bond_main.c:2396:40: expected restricted __be16 [usertype] vlan_proto drivers/net/bonding/bond_main.c:2396:40: got int >> drivers/net/bonding/bond_main.c:3217:18: sparse: incorrect type in >> assignment (different base types) @@ expected int [signed] skbproto @@ >> got restricted __be1int [signed] skbproto @@ drivers/net/bonding/bond_main.c:3217:18: expected int [signed] skbproto drivers/net/bonding/bond_main.c:3217:18: got restricted __be16 [usertype] protocol >> drivers/net/bonding/bond_main.c:3219:26: sparse: incorrect type in >> assignment (different base types) @@ expected int [signed] skbproto @@ >> got restint [signed] skbproto @@ drivers/net/bonding/bond_main.c:3219:26: expected int [signed] skbproto drivers/net/bonding/bond_main.c:3219:26: got restricted __be16 drivers/net/bonding/bond_main.c:3221:25: sparse: restricted __be16 degrades to integer drivers/net/bonding/bond_main.c:3229:32: sparse: restricted __be16 degrades to integer drivers/net/bonding/bond_main.c:3199:60: sparse: restricted __be16 degrades to integer drivers/net/bonding/bond_main.c:3199:60: sparse: restricted __be16 degrades to integer vim +3217 drivers/net/bonding/bond_main.c 3202 3203 /* Extract the appropriate headers based on bond's xmit policy */ 3204 static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb, 3205 struct flow_keys *fk) 3206 { 3207 const struct ipv6hdr *iph6; 3208 const struct iphdr *iph; 3209 int noff, proto = -1, skbproto; 3210 3211 if (bond->params.xmit_policy > BOND_XMIT_POLICY_LAYER23) 3212 return skb_flow_dissect_flow_keys(skb, fk, 0); 3213 3214 fk->ports.ports = 0; 3215 noff = skb_network_offset(skb); 3216 > 3217 skbproto = skb->protocol; 3218 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34) > 3219 skbproto = vlan_get_protocol(skb); 3220 3221 if (skbproto == htons(ETH_P_IP)) { 3222 if (unlikely(!pskb_may_pull(skb, noff + sizeof(*iph)))) 3223 return false; 3224 iph = ip_hdr(skb); 3225 iph_to_flow_copy_v4addrs(fk, iph); 3226 noff += iph->ihl << 2; 3227 if (!ip_is_fragment(iph)) 3228 proto = iph->protocol; 3229 } else if (skbproto == htons(ETH_P_IPV6)) { 3230 if (unlikely(!pskb_may_pull(skb, noff + sizeof(*iph6)))) 3231 return false; 3232 iph6 = ipv6_hdr(skb); 3233 iph_to_flow_copy_v6addrs(fk, iph6); 3234 noff += sizeof(*iph6); 3235 proto = iph6->nexthdr; 3236 } else { 3237 return false; 3238 } 3239 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34 && proto >= 0) 3240 fk->ports.ports = skb_flow_get_ports(skb, noff, proto); 3241 3242 return true; 3243 } 3244 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation