Subject: Re: [PATCH net] be2net: Allow GRE to work concurrently while a VxLAN tunnel is configured

From: Sergei Shtylyov <[email-masked]>
Date: Wed, 14 Jan 2015 15:55:42 +0300

Hello.

On 1/15/2015 6:37 AM, Sriharsha Basavapatna wrote:

> 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 <[email-masked]>
> ---
>   drivers/net/ethernet/emulex/benet/be_main.c |   41 +++++++++++++++++++++++++--
>   1 file changed, 38 insertions(+), 3 deletions(-)

    Some nitpicking, mostly grammatical...

> diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
> index 41a0a54..726a4a4 100644
> --- a/drivers/net/ethernet/emulex/benet/be_main.c
> +++ b/drivers/net/ethernet/emulex/benet/be_main.c
[...]
> @@ -4463,7 +4464,41 @@ static netdev_features_t be_features_check(struct sk_buff *skb,
>   					   struct net_device *dev,
>   					   netdev_features_t features)
>   {
> -	return vxlan_features_check(skb, features);
> +	struct be_adapter *adapter = netdev_priv(dev);
> +	u8 l4_hdr = 0;
> +
> +	/* The code below restricts offload features for some tunneled packets.
> +	 * Offload features for normal(non tunnel) packets are unchanged.

    You forgot space before (.

> +	 */
> +	if (!skb->encapsulation ||
> +	    !(adapter->flags & BE_FLAGS_VXLAN_OFFLOADS))
> +		return features;
> +
> +	/* It's an encapsulated packet and VxLAN offloads are enabled. We
> +	 * should disable tunnel offload features if it's not a VxLAN packet,
> +	 * as tunnel offloads have been enabled only for VxLAN. This is done to
> +	 * allow other tunneled trafffic like GRE work fine while VxLAN

    Just "traffic", too many f's.

> +	 * offloads are configured in Skyhawk-R.
> +	 */
> +	switch (vlan_get_protocol(skb)) {
> +	case htons(ETH_P_IP):
> +		l4_hdr = ip_hdr(skb)->protocol;
> +		break;
> +	case htons(ETH_P_IPV6):
> +		l4_hdr = ipv6_hdr(skb)->nexthdr;
> +		break;
> +	default:
> +		return features;
> +	}
> +
> +	if (l4_hdr != IPPROTO_UDP ||
> +	    skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
> +	    skb->inner_protocol != htons(ETH_P_TEB) ||
> +	    (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
> +	    sizeof(struct udphdr) + sizeof(struct vxlanhdr)))

    () not needed around !=.

[...]

WBR, Sergei