diff options
author | Sriharsha Basavapatna <sriharsha.basavapatna@emulex.com> | 2015-01-15 05:38:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-15 01:55:05 -0500 |
commit | 16dde0d6ac159531a5e03cd3f8bc8a401d9f3fb6 (patch) | |
tree | 5f71beea0b4386379b339bd72d4203d76f4b34d0 | |
parent | a6391a924cf5a16761ccd6b45094a7d5b9aeebac (diff) |
be2net: Allow GRE to work concurrently while a VxLAN tunnel is configured
Other tunnels like GRE break while VxLAN offloads are enabled in Skyhawk-R. To
avoid this, we should restrict offload features on a per-packet basis in such
conditions.
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 41a0a5498da7..d48806b5cd88 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -4383,8 +4383,9 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, | |||
4383 | * distinguish various types of transports (VxLAN, GRE, NVGRE ..). So, offload | 4383 | * distinguish various types of transports (VxLAN, GRE, NVGRE ..). So, offload |
4384 | * is expected to work across all types of IP tunnels once exported. Skyhawk | 4384 | * is expected to work across all types of IP tunnels once exported. Skyhawk |
4385 | * supports offloads for either VxLAN or NVGRE, exclusively. So we export VxLAN | 4385 | * supports offloads for either VxLAN or NVGRE, exclusively. So we export VxLAN |
4386 | * offloads in hw_enc_features only when a VxLAN port is added. Note this only | 4386 | * offloads in hw_enc_features only when a VxLAN port is added. If other (non |
4387 | * ensures that other tunnels work fine while VxLAN offloads are not enabled. | 4387 | * VxLAN) tunnels are configured while VxLAN offloads are enabled, offloads for |
4388 | * those other tunnels are unexported on the fly through ndo_features_check(). | ||
4388 | * | 4389 | * |
4389 | * Skyhawk supports VxLAN offloads only for one UDP dport. So, if the stack | 4390 | * Skyhawk supports VxLAN offloads only for one UDP dport. So, if the stack |
4390 | * adds more than one port, disable offloads and don't re-enable them again | 4391 | * adds more than one port, disable offloads and don't re-enable them again |
@@ -4463,7 +4464,41 @@ static netdev_features_t be_features_check(struct sk_buff *skb, | |||
4463 | struct net_device *dev, | 4464 | struct net_device *dev, |
4464 | netdev_features_t features) | 4465 | netdev_features_t features) |
4465 | { | 4466 | { |
4466 | return vxlan_features_check(skb, features); | 4467 | struct be_adapter *adapter = netdev_priv(dev); |
4468 | u8 l4_hdr = 0; | ||
4469 | |||
4470 | /* The code below restricts offload features for some tunneled packets. | ||
4471 | * Offload features for normal (non tunnel) packets are unchanged. | ||
4472 | */ | ||
4473 | if (!skb->encapsulation || | ||
4474 | !(adapter->flags & BE_FLAGS_VXLAN_OFFLOADS)) | ||
4475 | return features; | ||
4476 | |||
4477 | /* It's an encapsulated packet and VxLAN offloads are enabled. We | ||
4478 | * should disable tunnel offload features if it's not a VxLAN packet, | ||
4479 | * as tunnel offloads have been enabled only for VxLAN. This is done to | ||
4480 | * allow other tunneled traffic like GRE work fine while VxLAN | ||
4481 | * offloads are configured in Skyhawk-R. | ||
4482 | */ | ||
4483 | switch (vlan_get_protocol(skb)) { | ||
4484 | case htons(ETH_P_IP): | ||
4485 | l4_hdr = ip_hdr(skb)->protocol; | ||
4486 | break; | ||
4487 | case htons(ETH_P_IPV6): | ||
4488 | l4_hdr = ipv6_hdr(skb)->nexthdr; | ||
4489 | break; | ||
4490 | default: | ||
4491 | return features; | ||
4492 | } | ||
4493 | |||
4494 | if (l4_hdr != IPPROTO_UDP || | ||
4495 | skb->inner_protocol_type != ENCAP_TYPE_ETHER || | ||
4496 | skb->inner_protocol != htons(ETH_P_TEB) || | ||
4497 | skb_inner_mac_header(skb) - skb_transport_header(skb) != | ||
4498 | sizeof(struct udphdr) + sizeof(struct vxlanhdr)) | ||
4499 | return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK); | ||
4500 | |||
4501 | return features; | ||
4467 | } | 4502 | } |
4468 | #endif | 4503 | #endif |
4469 | 4504 | ||