Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0afb1666 authored by Joseph Gasparakis's avatar Joseph Gasparakis Committed by David S. Miller
Browse files

vxlan: Add capability of Rx checksum offload for inner packet



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: default avatarJoseph Gasparakis <joseph.gasparakis@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d6727fe3
Loading
Loading
Loading
Loading
+14 −2
Original line number Original line Diff line number Diff line
@@ -607,8 +607,18 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)


	__skb_tunnel_rx(skb, vxlan->dev);
	__skb_tunnel_rx(skb, vxlan->dev);
	skb_reset_network_header(skb);
	skb_reset_network_header(skb);

	/* 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->ip_summed = CHECKSUM_NONE;


	skb->encapsulation = 0;

	err = IP_ECN_decapsulate(oip, skb);
	err = IP_ECN_decapsulate(oip, skb);
	if (unlikely(err)) {
	if (unlikely(err)) {
		if (log_ecn_error)
		if (log_ecn_error)
@@ -1175,7 +1185,9 @@ static void vxlan_setup(struct net_device *dev)
	dev->features	|= NETIF_F_LLTX;
	dev->features	|= NETIF_F_LLTX;
	dev->features	|= NETIF_F_NETNS_LOCAL;
	dev->features	|= NETIF_F_NETNS_LOCAL;
	dev->features	|= NETIF_F_SG | NETIF_F_HW_CSUM;
	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;
	dev->priv_flags	&= ~IFF_XMIT_DST_RELEASE;


	spin_lock_init(&vxlan->hash_lock);
	spin_lock_init(&vxlan->hash_lock);