From patchwork Sat Feb 16 01:06:20 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: 220911 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 C119C2C0089 for ; Sat, 16 Feb 2013 12:04:42 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751494Ab3BPBEj (ORCPT ); Fri, 15 Feb 2013 20:04:39 -0500 Received: from na3sys009aog126.obsmtp.com ([74.125.149.155]:45283 "HELO na3sys009aog126.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1750797Ab3BPBEi (ORCPT ); Fri, 15 Feb 2013 20:04:38 -0500 Received: from mail-gh0-f197.google.com ([209.85.160.197]) (using TLSv1) by na3sys009aob126.postini.com ([74.125.148.12]) with SMTP ID DSNKUR7bJVVR12Vh3XO8yz48wowtklAe3BE6@postini.com; Fri, 15 Feb 2013 17:04:38 PST Received: by mail-gh0-f197.google.com with SMTP id f15so1535511ghb.8 for ; Fri, 15 Feb 2013 17:04:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=uWKGj9YLrujIB1b1QJAaiQd/73gyY+BewaWb1DAMWd8=; b=Izne974PELCF2/2JvxdQYamVGzgR2CxhYic3ar1URk8fq7P5O74fXsbMByb3D+uSuL gvbqt1sVSbptGEjtHF54Q0Khc6zlvKRJtE7VypiwBFeh0X8GoNq+WihOqGrWmbi0jtOR VZzuSXQs/rDrE7ePwMHutcBFPGVA8iD46Nvkpn9kWF4P2MvRd8ybtGuNXOZd5/Qdtigy Zhu4HiCO2C4UEmB7BsJz/YxLXWQFLr9o+XMxBX6spZ5jiPA6+7gsq24wGZe7YwBb5MoG K2mQxo0koycjQXSQ85gCR8aH7GpSffZoOmHhIDUf8SOrwLSqfqhw2o1g6qa6r1aylWqt p/OA== X-Received: by 10.236.120.101 with SMTP id o65mr5452995yhh.57.1360976677372; Fri, 15 Feb 2013 17:04:37 -0800 (PST) X-Received: by 10.236.120.101 with SMTP id o65mr5452981yhh.57.1360976677265; Fri, 15 Feb 2013 17:04:37 -0800 (PST) Received: from localhost ([64.125.181.92]) by mx.google.com with ESMTPS id d80sm65287419yhg.4.2013.02.15.17.04.36 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Fri, 15 Feb 2013 17:04:36 -0800 (PST) From: Pravin B Shelar To: netdev@vger.kernel.org Cc: edumazet@google.com, jesse@nicira.com, stephen@networkplumber.org, Pravin B Shelar Subject: [PATCH net-next 4/4] VXLAN: Use UDP Tunnel segmention. Date: Fri, 15 Feb 2013 17:06:20 -0800 Message-Id: <1360976780-1924-1-git-send-email-pshelar@nicira.com> X-Mailer: git-send-email 1.7.12.315.g682ce8b X-Gm-Message-State: ALoCoQmq5Lx7HeeDDv+d5xGAvt8F9Fmkn2zShZm0zCzZgJ0YBXLWLpqshfAc3Euj83QsWUTkR6cE+V5eeLfH2NJAR5gR0fyqFZdpvLtQsir0+Eq3Q5z3AajF+ebNHKw+hZ5LzovBZa5sqNk7BCpI5Eu5n7sPr7NGqw2n2stZJetYunJgnXzrBEg= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Enable TSO for VXLAN devices and use UDP_TUNNEL offload support. Signed-off-by: Pravin B Shelar --- drivers/net/vxlan.c | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 9d70421..61b7cd0 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -823,6 +823,20 @@ static u16 vxlan_src_port(const struct vxlan_dev *vxlan, struct sk_buff *skb) return (((u64) hash * range) >> 32) + vxlan->port_min; } +static int handle_offloads(struct sk_buff *skb) +{ + if (skb_is_gso(skb)) { + int err = skb_unclone(skb, GFP_ATOMIC); + if (unlikely(err)) + return err; + + skb_shinfo(skb)->gso_type |= (SKB_GSO_UDP_TUNNEL | SKB_GSO_UDP); + } else if (skb->ip_summed != CHECKSUM_PARTIAL) + skb->ip_summed = CHECKSUM_NONE; + + return 0; +} + /* Transmit local packets over Vxlan * * Outer IP header inherits ECN and DF from inner header. @@ -962,13 +976,12 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) iph->daddr = dst; iph->saddr = fl4.saddr; iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); + ip_select_ident(iph, &rt->dst, NULL); vxlan_set_owner(dev, skb); - /* See iptunnel_xmit() */ - if (skb->ip_summed != CHECKSUM_PARTIAL) - skb->ip_summed = CHECKSUM_NONE; - ip_select_ident(iph, &rt->dst, NULL); + if (handle_offloads(skb)) + goto drop; err = ip_local_out(skb); if (likely(net_xmit_eval(err) == 0)) { @@ -1190,8 +1203,10 @@ static void vxlan_setup(struct net_device *dev) dev->features |= NETIF_F_NETNS_LOCAL; dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM; dev->features |= NETIF_F_RXCSUM; + dev->features |= NETIF_F_GSO_SOFTWARE; 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; dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;