mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Gasparakis <joseph.gasparakis@intel.com>
To: davem@davemloft.net, shemminger@vyatta.com, chrisw@sous-sol.org,
	gospo@redhat.com
Cc: Joseph Gasparakis <joseph.gasparakis@intel.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	dmitry@broadcom.com, saeed.bishara@gmail.com,
	bhutchings@solarflare.com
Subject: [PATCH v4 5/5] vxlan: Add capability of Rx checksum offload for inner packet
Date: Fri,  7 Dec 2012 16:14:18 -0800	[thread overview]
Message-ID: <1354925658-24115-6-git-send-email-joseph.gasparakis@intel.com> (raw)
In-Reply-To: <1354925658-24115-1-git-send-email-joseph.gasparakis@intel.com>

This patch adds capability in vxlan to identify received
checksummed inner packets and signal them to the upper layers of
the stack. The driver needs to set the skb->encapsulation bit
and also set the skb->ip_summed to CHECKSUM_UNNECESSARY.

Signed-off-by: Joseph Gasparakis <joseph.gasparakis@intel.com>
---
 drivers/net/vxlan.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 88b31f2..3b3fdf6 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -607,7 +607,17 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 
 	__skb_tunnel_rx(skb, vxlan->dev);
 	skb_reset_network_header(skb);
-	skb->ip_summed = CHECKSUM_NONE;
+
+	/* If the NIC driver gave us an encapsulated packet with
+	 * CHECKSUM_UNNECESSARY and Rx checksum feature is enabled,
+	 * leave the CHECKSUM_UNNECESSARY, the device checksummed it
+	 * for us. Otherwise force the upper layers to verify it.
+	 */
+	if (skb->ip_summed != CHECKSUM_UNNECESSARY || !skb->encapsulation ||
+	    !(vxlan->dev->features & NETIF_F_RXCSUM))
+		skb->ip_summed = CHECKSUM_NONE;
+
+	skb->encapsulation = 0;
 
 	err = IP_ECN_decapsulate(oip, skb);
 	if (unlikely(err)) {
@@ -1175,7 +1185,9 @@ static void vxlan_setup(struct net_device *dev)
 	dev->features	|= NETIF_F_LLTX;
 	dev->features	|= NETIF_F_NETNS_LOCAL;
 	dev->features	|= NETIF_F_SG | NETIF_F_HW_CSUM;
-	dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM;
+	dev->features   |= NETIF_F_RXCSUM;
+
+	dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
 	dev->priv_flags	&= ~IFF_XMIT_DST_RELEASE;
 
 	spin_lock_init(&vxlan->hash_lock);
-- 
1.7.11.7


  parent reply	other threads:[~2012-12-08  0:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-08  0:14 [PATCH v4 net-next 0/5] tunneling: Add support for hardware-offloaded encapsulation Joseph Gasparakis
2012-12-08  0:14 ` [PATCH v4 1/5] net: " Joseph Gasparakis
2012-12-10 10:04   ` saeed bishara
2012-12-10 16:22     ` Alexander Duyck
2012-12-10 19:58     ` Dmitry Kravkov
2012-12-11  8:11       ` saeed bishara
2012-12-11 16:46         ` Alexander Duyck
2012-12-08  0:14 ` [PATCH v4 2/5] net: Handle encapsulated offloads before fragmentation or handing to lower dev Joseph Gasparakis
2012-12-08  0:14 ` [PATCH v4 3/5] vxlan: capture inner headers during encapsulation Joseph Gasparakis
2012-12-08  0:14 ` [PATCH v4 4/5] ixgbe: Adding tx encapsulation capability Joseph Gasparakis
2012-12-08  0:14 ` Joseph Gasparakis [this message]
2012-12-09  5:21 ` [PATCH v4 net-next 0/5] tunneling: Add support for hardware-offloaded encapsulation David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354925658-24115-6-git-send-email-joseph.gasparakis@intel.com \
    --to=joseph.gasparakis@intel.com \
    --cc=bhutchings@solarflare.com \
    --cc=chrisw@sous-sol.org \
    --cc=davem@davemloft.net \
    --cc=dmitry@broadcom.com \
    --cc=gospo@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeed.bishara@gmail.com \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®