diff mbox series

[net-next,4/5] tun: Add support for SCTP checksum offload

Message ID 20180402134006.10111-5-vyasevic@redhat.com
State Deferred, archived
Delegated to: David Miller
Headers show
Series [net-next,1/5] virtio: Add support for SCTP checksum offloading | expand

Commit Message

Vladislav Yasevich April 2, 2018, 1:40 p.m. UTC
Adds a new tun offload flag to allow for SCTP checksum offload.
The flag has to be set by the user and defaults to "no offload".

Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
---
 drivers/net/tun.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

kernel test robot April 3, 2018, 12:49 a.m. UTC | #1
Hi Vladislav,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Vladislav-Yasevich/virtio-net-Add-SCTP-checksum-offload-support/20180402-221407
config: m68k-hp300_defconfig (attached as .config)
compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=m68k 

Note: the linux-review/Vladislav-Yasevich/virtio-net-Add-SCTP-checksum-offload-support/20180402-221407 HEAD 5e0497a085e70055a1981959802173f4ff05c86b builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers/net/tun.c: In function 'set_offload':
>> drivers/net/tun.c:2722:12: error: 'TUN_F_SCTP_CSUM' undeclared (first use in this function); did you mean 'TUN_F_CSUM'?
     if (arg & TUN_F_SCTP_CSUM) {
               ^~~~~~~~~~~~~~~
               TUN_F_CSUM
   drivers/net/tun.c:2722:12: note: each undeclared identifier is reported only once for each function it appears in

vim +2722 drivers/net/tun.c

  2696	
  2697	/* This is like a cut-down ethtool ops, except done via tun fd so no
  2698	 * privs required. */
  2699	static int set_offload(struct tun_struct *tun, unsigned long arg)
  2700	{
  2701		netdev_features_t features = 0;
  2702	
  2703		if (arg & TUN_F_CSUM) {
  2704			features |= NETIF_F_HW_CSUM;
  2705			arg &= ~TUN_F_CSUM;
  2706	
  2707			if (arg & (TUN_F_TSO4|TUN_F_TSO6)) {
  2708				if (arg & TUN_F_TSO_ECN) {
  2709					features |= NETIF_F_TSO_ECN;
  2710					arg &= ~TUN_F_TSO_ECN;
  2711				}
  2712				if (arg & TUN_F_TSO4)
  2713					features |= NETIF_F_TSO;
  2714				if (arg & TUN_F_TSO6)
  2715					features |= NETIF_F_TSO6;
  2716				arg &= ~(TUN_F_TSO4|TUN_F_TSO6);
  2717			}
  2718	
  2719			arg &= ~TUN_F_UFO;
  2720		}
  2721	
> 2722		if (arg & TUN_F_SCTP_CSUM) {
  2723			features |= NETIF_F_SCTP_CRC;
  2724			arg &= ~TUN_F_SCTP_CSUM;
  2725		}
  2726	
  2727		/* This gives the user a way to test for new features in future by
  2728		 * trying to set them. */
  2729		if (arg)
  2730			return -EINVAL;
  2731	
  2732		tun->set_features = features;
  2733		tun->dev->wanted_features &= ~TUN_USER_FEATURES;
  2734		tun->dev->wanted_features |= features;
  2735		netdev_update_features(tun->dev);
  2736	
  2737		return 0;
  2738	}
  2739	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Michael S. Tsirkin April 16, 2018, 5:12 p.m. UTC | #2
On Mon, Apr 02, 2018 at 09:40:05AM -0400, Vladislav Yasevich wrote:
> Adds a new tun offload flag to allow for SCTP checksum offload.
> The flag has to be set by the user and defaults to "no offload".
> 
> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>

When would user set this flag? Wouldn't that be when
userspace is ready to get SCTP packets without a checksum?
Seems to be this is an indication that when userspace
is qemu running a guest, said guest needs to communicate
the new ability to qemu.

> ---
>  drivers/net/tun.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index a1ba262..263bcbe 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -2719,6 +2719,11 @@ static int set_offload(struct tun_struct *tun, unsigned long arg)
>  		arg &= ~TUN_F_UFO;
>  	}
>  
> +	if (arg & TUN_F_SCTP_CSUM) {
> +		features |= NETIF_F_SCTP_CRC;
> +		arg &= ~TUN_F_SCTP_CSUM;
> +	}
> +
>  	/* This gives the user a way to test for new features in future by
>  	 * trying to set them. */
>  	if (arg)
> -- 
> 2.9.5
diff mbox series

Patch

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index a1ba262..263bcbe 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2719,6 +2719,11 @@  static int set_offload(struct tun_struct *tun, unsigned long arg)
 		arg &= ~TUN_F_UFO;
 	}
 
+	if (arg & TUN_F_SCTP_CSUM) {
+		features |= NETIF_F_SCTP_CRC;
+		arg &= ~TUN_F_SCTP_CSUM;
+	}
+
 	/* This gives the user a way to test for new features in future by
 	 * trying to set them. */
 	if (arg)