virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Vladislav Yasevich <vyasevich@gmail.com>
Cc: nhorman@tuxdriver.com, netdev@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-sctp@vger.kernel.org
Subject: Re: [PATCH net-next 5/5] macvlan/macvtap: Add support for SCTP checksum offload.
Date: Mon, 16 Apr 2018 20:14:33 +0300	[thread overview]
Message-ID: <20180416201234-mutt-send-email-mst__33256.7426063635$1523898772$gmane$org@kernel.org> (raw)
In-Reply-To: <20180402134006.10111-6-vyasevic@redhat.com>

On Mon, Apr 02, 2018 at 09:40:06AM -0400, Vladislav Yasevich wrote:
> Since we now have support for software CRC32c offload, turn it on
> for macvlan and macvtap devices so that guests can take advantage
> of offload SCTP checksums to the host or host hardware.
> 
> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
> ---
>  drivers/net/macvlan.c       | 5 +++--
>  drivers/net/tap.c           | 8 +++++---
>  include/uapi/linux/if_tun.h | 1 +
>  3 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
> index 725f4b4..646b730 100644
> --- a/drivers/net/macvlan.c
> +++ b/drivers/net/macvlan.c
> @@ -834,7 +834,7 @@ static struct lock_class_key macvlan_netdev_addr_lock_key;
>  
>  #define ALWAYS_ON_OFFLOADS \
>  	(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE | \
> -	 NETIF_F_GSO_ROBUST | NETIF_F_GSO_ENCAP_ALL)
> +	 NETIF_F_GSO_ROBUST | NETIF_F_GSO_ENCAP_ALL | NETIF_F_SCTP_CRC)
>  
>  #define ALWAYS_ON_FEATURES (ALWAYS_ON_OFFLOADS | NETIF_F_LLTX)
>  
> @@ -842,7 +842,8 @@ static struct lock_class_key macvlan_netdev_addr_lock_key;
>  	(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
>  	 NETIF_F_GSO | NETIF_F_TSO | NETIF_F_LRO | \
>  	 NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM | \
> -	 NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER)
> +	 NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER | \
> +	 NETIF_F_SCTP_CRC)
>  
>  #define MACVLAN_STATE_MASK \
>  	((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
> diff --git a/drivers/net/tap.c b/drivers/net/tap.c
> index 9b6cb78..2c8512b 100644
> --- a/drivers/net/tap.c
> +++ b/drivers/net/tap.c
> @@ -369,8 +369,7 @@ rx_handler_result_t tap_handle_frame(struct sk_buff **pskb)
>  		 *	  check, we either support them all or none.
>  		 */
>  		if (skb->ip_summed == CHECKSUM_PARTIAL &&
> -		    !(features & NETIF_F_CSUM_MASK) &&
> -		    skb_checksum_help(skb))
> +		    skb_csum_hwoffload_help(skb, features))
>  			goto drop;
>  		if (ptr_ring_produce(&q->ring, skb))
>  			goto drop;
> @@ -945,6 +944,9 @@ static int set_offload(struct tap_queue *q, unsigned long arg)
>  		}
>  	}
>  
> +	if (arg & TUN_F_SCTP_CSUM)
> +		feature_mask |= NETIF_F_SCTP_CRC;
> +
>  	/* tun/tap driver inverts the usage for TSO offloads, where
>  	 * setting the TSO bit means that the userspace wants to
>  	 * accept TSO frames and turning it off means that user space

Does not the above comment apply to the new flag too?  It seems that
it's value should be inverted for macvtap, and isn't, here.


> @@ -1077,7 +1079,7 @@ static long tap_ioctl(struct file *file, unsigned int cmd,
>  	case TUNSETOFFLOAD:
>  		/* let the user check for future flags */
>  		if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 |
> -			    TUN_F_TSO_ECN | TUN_F_UFO))
> +			    TUN_F_TSO_ECN | TUN_F_UFO | TUN_F_SCTP_CSUM))
>  			return -EINVAL;
>  
>  		rtnl_lock();
> diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
> index ee432cd..c3bb282 100644
> --- a/include/uapi/linux/if_tun.h
> +++ b/include/uapi/linux/if_tun.h
> @@ -86,6 +86,7 @@
>  #define TUN_F_TSO6	0x04	/* I can handle TSO for IPv6 packets */
>  #define TUN_F_TSO_ECN	0x08	/* I can handle TSO with ECN bits. */
>  #define TUN_F_UFO	0x10	/* I can handle UFO packets */
> +#define TUN_F_SCTP_CSUM 0x20	/* I can handle SCTP checksum offload */
>  
>  /* Protocol info prepended to the packets (when IFF_NO_PI is not set) */
>  #define TUN_PKT_STRIP	0x0001

Doesn't this belong in the previous patch?

> 2.9.5

  parent reply	other threads:[~2018-04-16 17:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02 13:40 [PATCH net-next 0/5] virtio-net: Add SCTP checksum offload support Vladislav Yasevich
2018-04-02 13:40 ` [PATCH net-next 1/5] virtio: Add support for SCTP checksum offloading Vladislav Yasevich
2018-04-02 13:40 ` [PATCH net-next 2/5] sctp: Handle sctp packets with CHECKSUM_PARTIAL Vladislav Yasevich
2018-04-02 13:40 ` [PATCH net-next 3/5] sctp: Build sctp offload support into the base kernel Vladislav Yasevich
2018-04-02 13:40 ` [PATCH net-next 4/5] tun: Add support for SCTP checksum offload Vladislav Yasevich
2018-04-02 13:40 ` [PATCH net-next 5/5] macvlan/macvtap: " Vladislav Yasevich
2018-04-02 14:16 ` [PATCH net-next 0/5] virtio-net: Add SCTP checksum offload support David Miller
     [not found] ` <20180402134006.10111-2-vyasevic@redhat.com>
2018-04-10  3:17   ` [PATCH net-next 1/5] virtio: Add support for SCTP checksum offloading Jason Wang
2018-04-11 22:49   ` Michael S. Tsirkin
     [not found]   ` <20180412014548-mutt-send-email-mst@kernel.org>
2018-04-16 13:45     ` Vlad Yasevich
     [not found]     ` <f5655ab8-f24f-a5a5-d000-2bbb90ecc552@redhat.com>
2018-04-16 15:52       ` Michael S. Tsirkin
2018-04-16 17:09       ` Michael S. Tsirkin
     [not found]       ` <20180416200743-mutt-send-email-mst@kernel.org>
2018-04-17 19:06         ` Vlad Yasevich
2018-04-16 17:07   ` Michael S. Tsirkin
     [not found] ` <20180402134006.10111-5-vyasevic@redhat.com>
2018-04-03  0:49   ` [PATCH net-next 4/5] tun: Add support for SCTP checksum offload kbuild test robot
2018-04-16 17:12   ` Michael S. Tsirkin
     [not found] ` <20180402134006.10111-6-vyasevic@redhat.com>
2018-04-16 17:14   ` Michael S. Tsirkin [this message]
     [not found] ` <20180402144730.GA6001@localhost.localdomain>
2018-04-17 20:35   ` [PATCH net-next 0/5] virtio-net: Add SCTP checksum offload support Vlad Yasevich
     [not found]   ` <6bc762f6-d6fb-5471-2893-a888cce199f9@redhat.com>
     [not found]     ` <20180418013333.GO4716@localhost.localdomain>
2018-04-18  6:57       ` Xin Long
2018-04-18 14:06     ` Michael S. Tsirkin
     [not found]     ` <20180418162633-mutt-send-email-mst@kernel.org>
     [not found]       ` <20180420172219.GR4716@localhost.localdomain>
2018-04-20 18:32         ` Michael S. Tsirkin
2018-04-23 13:17         ` Vlad Yasevich

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='20180416201234-mutt-send-email-mst__33256.7426063635$1523898772$gmane$org@kernel.org' \
    --to=mst@redhat.com \
    --cc=linux-sctp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).