From patchwork Wed Jun 26 20:14:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pravin B Shelar X-Patchwork-Id: 254858 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id F10C02C0096 for ; Thu, 27 Jun 2013 06:14:15 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752921Ab3FZUOM (ORCPT ); Wed, 26 Jun 2013 16:14:12 -0400 Received: from na3sys009aog137.obsmtp.com ([74.125.149.18]:37561 "HELO na3sys009aog137.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752452Ab3FZUOG (ORCPT ); Wed, 26 Jun 2013 16:14:06 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]) (using TLSv1) by na3sys009aob137.postini.com ([74.125.148.12]) with SMTP ID DSNKUctLjZ8cuRp5rZwt9efl/M/h0rwBP+QO@postini.com; Wed, 26 Jun 2013 13:14:06 PDT Received: by mail-pa0-f54.google.com with SMTP id kx10so31450pab.13 for ; Wed, 26 Jun 2013 13:14:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=NNULftopAfMHyQBQK90qShDBPIQhSwnMODRAD5CLRyg=; b=B552JVV/YwQmkMq5FdkBVSPYeIgmy0GPwYLrpQY3tXnk/mHngPOiKdvGEzYsNj70ZY WB+Ko66EbjoumaUjqDQHTuYDRn0Zht0uKqq92OdCHjSNdr0LKvHhrdGVk+6UYGWPVkO/ Cv67mHmIy+v7fdDWyheCBvkWbE48LYcM9Th7AYEPotRygThZffgnzzP5cm6+ZjRcV6/+ GL8BF3FOD4xQiWE+A4nVWJ+Eb9IX3VrJY/PEMCdpe7V0rxb5iFTE+PBgiq6M0hk37yiC muJhkiWyvyXu4dxWX+ZiSZkVkao+B1KruUmT/9Fl4ILE5jd4AR7/DEvpv0jmZqjkCqjb CiuA== X-Received: by 10.68.14.170 with SMTP id q10mr2429388pbc.102.1372277645752; Wed, 26 Jun 2013 13:14:05 -0700 (PDT) X-Received: by 10.68.14.170 with SMTP id q10mr2429378pbc.102.1372277645684; Wed, 26 Jun 2013 13:14:05 -0700 (PDT) Received: from localhost ([75.98.92.113]) by mx.google.com with ESMTPSA id xl3sm29737146pbb.17.2013.06.26.13.14.04 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 26 Jun 2013 13:14:05 -0700 (PDT) From: Pravin B Shelar To: netdev@vger.kernel.org, dev@openvswitch.org, stephen@networkplumber.org Cc: Pravin B Shelar Subject: [PATCH vxlan v2 7/8] vxlan: Add tx-vlan offload support. Date: Wed, 26 Jun 2013 13:14:03 -0700 Message-Id: <1372277643-17701-1-git-send-email-pshelar@nicira.com> X-Mailer: git-send-email 1.8.2.135.g7b592fa X-Gm-Message-State: ALoCoQlT5HC8DTCWrPeVocFQPlXz32CIcvLHmaIt4cImN/esZfxsdXeZIAfSSAwQuuNUJ+/4Cch0yb7Bd6Y0SHZKIicgssjcVlKdYP+vMhffs8FeZQUGl0xxFjrRb8FWArHC807+XfYFyiCLOX/Hmx4iRfq+J7SqzYjI2suA7ND2cFI+lfEChhY= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Following patch allows transmit side vlan offload for vxlan devices. Signed-off-by: Pravin B Shelar --- drivers/net/vxlan.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 0125c57..d573458 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -1078,13 +1079,23 @@ int vxlan_xmit_skb(struct net *net, struct vxlan_handler *vh, } min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len - + VXLAN_HLEN + sizeof(struct iphdr); + + VXLAN_HLEN + sizeof(struct iphdr) + + (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0); /* Need space for new headers (invalidates iph ptr) */ err = skb_cow_head(skb, min_headroom); if (unlikely(err)) return err; + if (vlan_tx_tag_present(skb)) { + if (unlikely(!__vlan_put_tag(skb, + skb->vlan_proto, + vlan_tx_tag_get(skb)))) + return -ENOMEM; + + skb->vlan_tci = 0; + } + vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh)); vxh->vx_flags = htonl(VXLAN_FLAGS); vxh->vx_vni = vni; @@ -1476,6 +1487,8 @@ static void vxlan_setup(struct net_device *dev) dev->features |= NETIF_F_RXCSUM; dev->features |= NETIF_F_GSO_SOFTWARE; + dev->vlan_features = dev->features; + dev->features |= NETIF_F_HW_VLAN_CTAG_TX; dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; dev->hw_features |= NETIF_F_GSO_SOFTWARE; dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;