From patchwork Tue Mar 19 08:10:27 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: 228940 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 443AA2C00C4 for ; Tue, 19 Mar 2013 19:10:56 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934199Ab3CSIKt (ORCPT ); Tue, 19 Mar 2013 04:10:49 -0400 Received: from na3sys009aog105.obsmtp.com ([74.125.149.75]:53892 "HELO na3sys009aog105.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S934194Ab3CSIKq (ORCPT ); Tue, 19 Mar 2013 04:10:46 -0400 Received: from mail-pb0-f72.google.com ([209.85.160.72]) (using TLSv1) by na3sys009aob105.postini.com ([74.125.148.12]) with SMTP ID DSNKUUgdhiUUDOAkP/fxZGmvBGQ2+G2P6948@postini.com; Tue, 19 Mar 2013 01:10:46 PDT Received: by mail-pb0-f72.google.com with SMTP id wz12so303333pbc.7 for ; Tue, 19 Mar 2013 01:10:46 -0700 (PDT) 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=noF0PYp9NTh5ITO22yjI4pJVtiiUsPUPUDFPTSHnY9M=; b=ctd+EC/VqkMWBopVT58e94sSHvXVD0ZpBOv8poyvAF1MZybnGpZEilcNsOxOqOf8do snnTUx30bvFUfjIkMcrZjOq7++MYSc8s0+rLDJ2xAsg5gYh2Lqa0hEs+cjs+HN7wKZ20 YBjGrpDkq+Rt9wOCZBiFP8fdvyR0wTSRvN+4DA0ULSXPvE9LRXouHX1ByBmNp5XO7xlF 9v49HC34gKgznAKygx5LGebR/uToXD2HH8TZtIdYdMUi7w2snqFZ3eTqoG/J8IlDndu7 2s0nLVnjxVSsKLPcn+s6g3/85ErXBbUyC7z6ULRW8HWKBaXOrfy5M4Nu53X8kMD53gaK HoQA== X-Received: by 10.68.217.202 with SMTP id pa10mr1741387pbc.11.1363680646077; Tue, 19 Mar 2013 01:10:46 -0700 (PDT) X-Received: by 10.68.217.202 with SMTP id pa10mr1741376pbc.11.1363680645999; Tue, 19 Mar 2013 01:10:45 -0700 (PDT) Received: from localhost (c-76-126-241-147.hsd1.ca.comcast.net. [76.126.241.147]) by mx.google.com with ESMTPS id ti8sm23376493pbc.12.2013.03.19.01.10.43 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Tue, 19 Mar 2013 01:10:44 -0700 (PDT) From: Pravin B Shelar To: davem@davemloft.net Cc: stephen@networkplumber.org, netdev@vger.kernel.org, jesse@nicira.com, Pravin B Shelar Subject: [PATCH v3 net-next 4/5] VXLAN: Use IP Tunnels tunnel ENC encap API Date: Tue, 19 Mar 2013 01:10:27 -0700 Message-Id: <1363680627-1847-1-git-send-email-pshelar@nicira.com> X-Mailer: git-send-email 1.7.12.315.g682ce8b X-Gm-Message-State: ALoCoQlIFZfCrR2Oy2X44G1177n1Tf+B2SvCMBWfmMKeZizOwOM3PfsBBrGI2JlRjLFw9ZpJrAvFHgV1JBws3MdOCn0ZESqFXD8r8Ozz2Bqs959Qj9Q7kligB20WxYWz/iJHQMyrAohPZ+mkhB/FJVyKyyxDxQ7MybpjHVC4kRmTNBhOPEtG6nI= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use common ecn_encap functions from ip_tunnel module. Signed-off-by: Pravin B Shelar Acked-by: Stephen Hemminger --- drivers/net/vxlan.c | 26 ++------------------------ 1 files changed, 2 insertions(+), 24 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index e532b2a..7624ab1 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -864,28 +864,6 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) return false; } -/* Extract dsfield from inner protocol */ -static inline u8 vxlan_get_dsfield(const struct iphdr *iph, - const struct sk_buff *skb) -{ - if (skb->protocol == htons(ETH_P_IP)) - return iph->tos; - else if (skb->protocol == htons(ETH_P_IPV6)) - return ipv6_get_dsfield((const struct ipv6hdr *)iph); - else - return 0; -} - -/* Propogate ECN bits out */ -static inline u8 vxlan_ecn_encap(u8 tos, - const struct iphdr *iph, - const struct sk_buff *skb) -{ - u8 inner = vxlan_get_dsfield(iph, skb); - - return INET_ECN_encapsulate(tos, inner); -} - static void vxlan_sock_free(struct sk_buff *skb) { sock_put(skb->sk); @@ -996,7 +974,7 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, tos = vxlan->tos; if (tos == 1) - tos = vxlan_get_dsfield(old_iph, skb); + tos = ip_tunnel_get_dsfield(old_iph, skb); src_port = vxlan_src_port(vxlan, skb); @@ -1047,7 +1025,7 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, iph->ihl = sizeof(struct iphdr) >> 2; iph->frag_off = df; iph->protocol = IPPROTO_UDP; - iph->tos = vxlan_ecn_encap(tos, old_iph, skb); + iph->tos = ip_tunnel_ecn_encap(tos, old_iph, skb); iph->daddr = dst; iph->saddr = fl4.saddr; iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);