All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Vladislav Yasevich <vyasevich@gmail.com>
Cc: netdev@vger.kernel.org, ben@decadent.org.uk, stefanha@redhat.com,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 01/10] core: Split out UFO6 support
Date: Thu, 18 Dec 2014 00:45:53 +0200	[thread overview]
Message-ID: <20141217224553.GE30969@redhat.com> (raw)
In-Reply-To: <1418840455-22598-2-git-send-email-vyasevic@redhat.com>

On Wed, Dec 17, 2014 at 01:20:46PM -0500, Vladislav Yasevich wrote:
> Split IPv6 support for UFO into its own feature similiar to TSO.
> This will later allow us to re-enable UFO support for virtio-net
> devices.
> 
> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
> ---
>  include/linux/netdev_features.h |  7 +++++--
>  include/linux/netdevice.h       |  1 +
>  include/linux/skbuff.h          |  1 +
>  net/core/dev.c                  | 35 +++++++++++++++++++----------------
>  net/core/ethtool.c              |  2 +-
>  5 files changed, 27 insertions(+), 19 deletions(-)
> 
> diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
> index dcfdecb..a078945 100644
> --- a/include/linux/netdev_features.h
> +++ b/include/linux/netdev_features.h
> @@ -48,8 +48,9 @@ enum {
>  	NETIF_F_GSO_UDP_TUNNEL_BIT,	/* ... UDP TUNNEL with TSO */
>  	NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,/* ... UDP TUNNEL with TSO & CSUM */
>  	NETIF_F_GSO_MPLS_BIT,		/* ... MPLS segmentation */
> +	NETIF_F_UFO6_BIT,		/* ... UDPv6 fragmentation */
>  	/**/NETIF_F_GSO_LAST =		/* last bit, see GSO_MASK */
> -		NETIF_F_GSO_MPLS_BIT,
> +		NETIF_F_UFO6_BIT,
>  
>  	NETIF_F_FCOE_CRC_BIT,		/* FCoE CRC32 */
>  	NETIF_F_SCTP_CSUM_BIT,		/* SCTP checksum offload */
> @@ -109,6 +110,7 @@ enum {
>  #define NETIF_F_TSO_ECN		__NETIF_F(TSO_ECN)
>  #define NETIF_F_TSO		__NETIF_F(TSO)
>  #define NETIF_F_UFO		__NETIF_F(UFO)
> +#define NETIF_F_UFO6		__NETIF_F(UFO6)
>  #define NETIF_F_VLAN_CHALLENGED	__NETIF_F(VLAN_CHALLENGED)
>  #define NETIF_F_RXFCS		__NETIF_F(RXFCS)
>  #define NETIF_F_RXALL		__NETIF_F(RXALL)
> @@ -141,7 +143,7 @@ enum {
>  
>  /* List of features with software fallbacks. */
>  #define NETIF_F_GSO_SOFTWARE	(NETIF_F_TSO | NETIF_F_TSO_ECN | \
> -				 NETIF_F_TSO6 | NETIF_F_UFO)
> +				 NETIF_F_TSO6 | NETIF_F_UFO | NETIF_F_UFO6)
>  
>  #define NETIF_F_GEN_CSUM	NETIF_F_HW_CSUM
>  #define NETIF_F_V4_CSUM		(NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
> @@ -149,6 +151,7 @@ enum {
>  #define NETIF_F_ALL_CSUM	(NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
>  
>  #define NETIF_F_ALL_TSO 	(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
> +#define NETIF_F_ALL_UFO		(NETIF_F_UFO | NETIF_F_UFO6)
>  
>  #define NETIF_F_ALL_FCOE	(NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
>  				 NETIF_F_FSO)
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 74fd5d3..86af10a 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -3559,6 +3559,7 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)
>  	/* check flags correspondence */
>  	BUILD_BUG_ON(SKB_GSO_TCPV4   != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT));
>  	BUILD_BUG_ON(SKB_GSO_UDP     != (NETIF_F_UFO >> NETIF_F_GSO_SHIFT));
> +	BUILD_BUG_ON(SKB_GSO_UDP6    != (NETIF_F_UFO6 >> NETIF_F_GSO_SHIFT));
>  	BUILD_BUG_ON(SKB_GSO_DODGY   != (NETIF_F_GSO_ROBUST >> NETIF_F_GSO_SHIFT));
>  	BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT));
>  	BUILD_BUG_ON(SKB_GSO_TCPV6   != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT));
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index 6c8b6f6..8538b67 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -372,6 +372,7 @@ enum {
>  
>  	SKB_GSO_MPLS = 1 << 12,
>  
> +	SKB_GSO_UDP6 = 1 << 13
>  };
>  
>  #if BITS_PER_LONG > 32

So this implies anything getting GSO packets e.g.
from userspace now needs to check IP version to
set GSO type correctly.

I think you missed some places that do this, e.g. af_packet
sockets.


> diff --git a/net/core/dev.c b/net/core/dev.c
> index 945bbd0..fa4d2ee 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5929,6 +5929,12 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
>  		features &= ~NETIF_F_ALL_TSO;
>  	}
>  
> +	/* UFO requires that SG is present as well */
> +	if ((features & NETIF_F_ALL_UFO) && !(features & NETIF_F_SG)) {
> +		netdev_dbg(dev, "Dropping UFO features since no SG feature.\n");
> +		features &= ~NETIF_F_ALL_UFO;
> +	}
> +
>  	if ((features & NETIF_F_TSO) && !(features & NETIF_F_HW_CSUM) &&
>  					!(features & NETIF_F_IP_CSUM)) {
>  		netdev_dbg(dev, "Dropping TSO features since no CSUM feature.\n");
> @@ -5952,24 +5958,21 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
>  		features &= ~NETIF_F_GSO;
>  	}
>  
> -	/* UFO needs SG and checksumming */
> -	if (features & NETIF_F_UFO) {
> -		/* maybe split UFO into V4 and V6? */
> -		if (!((features & NETIF_F_GEN_CSUM) ||
> -		    (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
> -			    == (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
> -			netdev_dbg(dev,
> -				"Dropping NETIF_F_UFO since no checksum offload features.\n");
> -			features &= ~NETIF_F_UFO;
> -		}
> -
> -		if (!(features & NETIF_F_SG)) {
> -			netdev_dbg(dev,
> -				"Dropping NETIF_F_UFO since no NETIF_F_SG feature.\n");
> -			features &= ~NETIF_F_UFO;
> -		}
> +	/* UFO also needs checksumming */
> +	if ((features & NETIF_F_UFO) && !(features & NETIF_F_GEN_CSUM) &&
> +					!(features & NETIF_F_IP_CSUM)) {
> +		netdev_dbg(dev,
> +			   "Dropping NETIF_F_UFO since no checksum offload features.\n");
> +		features &= ~NETIF_F_UFO;
> +	}
> +	if ((features & NETIF_F_UFO6) && !(features & NETIF_F_GEN_CSUM) &&
> +					 !(features & NETIF_F_IPV6_CSUM)) {
> +		netdev_dbg(dev,
> +			   "Dropping NETIF_F_UFO6 since no checksum offload features.\n");
> +		features &= ~NETIF_F_UFO6;
>  	}
>  
> +
>  #ifdef CONFIG_NET_RX_BUSY_POLL
>  	if (dev->netdev_ops->ndo_busy_poll)
>  		features |= NETIF_F_BUSY_POLL;
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index 06dfb29..93eff41 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -223,7 +223,7 @@ static netdev_features_t ethtool_get_feature_mask(u32 eth_cmd)
>  		return NETIF_F_ALL_TSO;
>  	case ETHTOOL_GUFO:
>  	case ETHTOOL_SUFO:
> -		return NETIF_F_UFO;
> +		return NETIF_F_ALL_UFO;
>  	case ETHTOOL_GGSO:
>  	case ETHTOOL_SGSO:
>  		return NETIF_F_GSO;
> -- 
> 1.9.3

  parent reply	other threads:[~2014-12-17 22:45 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 18:20 [PATCH 00/10] Split UFO into v4 and v6 versions Vladislav Yasevich
2014-12-17 18:20 ` [PATCH 01/10] core: Split out UFO6 support Vladislav Yasevich
2014-12-17 18:20 ` Vladislav Yasevich
2014-12-17 20:10   ` Ben Hutchings
2014-12-17 20:43     ` Vlad Yasevich
2014-12-17 20:10   ` Ben Hutchings
2014-12-17 22:45   ` Michael S. Tsirkin [this message]
2014-12-17 23:31     ` Vlad Yasevich
2014-12-18  7:54       ` Michael S. Tsirkin
2014-12-18 15:01         ` Vlad Yasevich
2014-12-18 17:35           ` Michael S. Tsirkin
2014-12-18 17:50             ` Michael S. Tsirkin
2014-12-19 20:13               ` Vlad Yasevich
2014-12-20 21:03                 ` Michael S. Tsirkin
2014-12-22  4:06                   ` Vlad Yasevich
2014-12-19 19:55             ` Vlad Yasevich
2014-12-17 18:20 ` [PATCH 02/10] net: Correctly mark IPv6 UFO offload type Vladislav Yasevich
2014-12-17 18:20 ` Vladislav Yasevich
2014-12-17 18:20 ` [PATCH 03/10] ovs: Enable handling of UFO6 packets Vladislav Yasevich
2014-12-17 20:17   ` Sergei Shtylyov
2014-12-17 20:44     ` Vlad Yasevich
2014-12-17 22:26   ` Michael S. Tsirkin
2014-12-17 18:20 ` [PATCH 04/10] loopback: Turn on UFO6 support Vladislav Yasevich
2014-12-17 18:20 ` Vladislav Yasevich
2014-12-17 18:20 ` [PATCH 05/10] veth: Enable " Vladislav Yasevich
2014-12-17 18:20 ` Vladislav Yasevich
2014-12-17 18:20 ` [PATCH 06/10] macvlan: " Vladislav Yasevich
2014-12-17 18:20 ` Vladislav Yasevich
2014-12-17 18:20 ` [PATCH 07/10] s2io: " Vladislav Yasevich
2014-12-17 18:20 ` Vladislav Yasevich
2014-12-17 18:20 ` [PATCH 08/10] tun: Re-uanble UFO support Vladislav Yasevich
2014-12-17 18:20 ` Vladislav Yasevich
2014-12-17 22:33   ` Michael S. Tsirkin
2014-12-18  5:51   ` Jason Wang
2014-12-18 15:12     ` Vlad Yasevich
2014-12-19  4:37       ` Jason Wang
2014-12-17 18:20 ` [PATCH 09/10] macvtap: Re-enable " Vladislav Yasevich
2014-12-17 18:20 ` Vladislav Yasevich
2014-12-17 22:41   ` Michael S. Tsirkin
2014-12-18  2:43     ` Vlad Yasevich
2014-12-18  7:55       ` Michael S. Tsirkin
2014-12-18 15:15         ` Vlad Yasevich
2014-12-18 15:15         ` Vlad Yasevich
2014-12-17 18:20 ` [PATCH 10/10] Revert "drivers/net: Disable UFO through virtio" Vladislav Yasevich
2014-12-17 18:20 ` Vladislav Yasevich
2014-12-17 22:44   ` Michael S. Tsirkin
2014-12-18  5:28 ` [PATCH 00/10] Split UFO into v4 and v6 versions Jason Wang
2014-12-18  5:28 ` Jason Wang
2014-12-24 18:11   ` Ben Hutchings
2014-12-24 18:59     ` Michael S. Tsirkin
2014-12-25  3:02       ` Jason Wang
2014-12-25  7:14         ` Michael S. Tsirkin
2014-12-25  9:50           ` Jason Wang

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=20141217224553.GE30969@redhat.com \
    --to=mst@redhat.com \
    --cc=ben@decadent.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=vyasevich@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.