Re: [PATCH v2] virtio: Work around frames incorrectly marked as gso

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I love your patch! Perhaps something to improve:

[auto build test WARNING on vhost/linux-next]
[also build test WARNING on linus/master ipvs/master v5.6-rc3 next-20200224]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/anton-ivanov-cambridgegreys-com/virtio-Work-around-frames-incorrectly-marked-as-gso/20200224-190342
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
config: nds32-defconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 9.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
        GCC_VERSION=9.2.0 make.cross ARCH=nds32 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   In file included from net/packet/af_packet.c:82:
   include/linux/virtio_net.h: In function 'virtio_net_hdr_from_skb':
>> include/linux/virtio_net.h:103:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     103 |  struct skb_shared_info *sinfo = skb_shinfo(skb);
         |  ^~~~~~

vim +103 include/linux/virtio_net.h

fd2a0437dc33b6 Mike Rapoport    2016-06-08   94  
fd2a0437dc33b6 Mike Rapoport    2016-06-08   95  static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
fd2a0437dc33b6 Mike Rapoport    2016-06-08   96  					  struct virtio_net_hdr *hdr,
6391a4481ba079 Jason Wang       2017-01-20   97  					  bool little_endian,
fd3a8862584490 Willem de Bruijn 2018-06-06   98  					  bool has_data_valid,
fd3a8862584490 Willem de Bruijn 2018-06-06   99  					  int vlan_hlen)
fd2a0437dc33b6 Mike Rapoport    2016-06-08  100  {
9403cd7cbb08aa Jarno Rajahalme  2016-11-18  101  	memset(hdr, 0, sizeof(*hdr));   /* no info leak */
fd2a0437dc33b6 Mike Rapoport    2016-06-08  102  
fd2a0437dc33b6 Mike Rapoport    2016-06-08 @103  	struct skb_shared_info *sinfo = skb_shinfo(skb);
3d2c1fd2739938 Anton Ivanov     2020-02-24  104  	if (skb_is_gso(skb) && sinfo->gso_type) {
fd2a0437dc33b6 Mike Rapoport    2016-06-08  105  
fd2a0437dc33b6 Mike Rapoport    2016-06-08  106  		/* This is a hint as to how much should be linear. */
fd2a0437dc33b6 Mike Rapoport    2016-06-08  107  		hdr->hdr_len = __cpu_to_virtio16(little_endian,
fd2a0437dc33b6 Mike Rapoport    2016-06-08  108  						 skb_headlen(skb));
fd2a0437dc33b6 Mike Rapoport    2016-06-08  109  		hdr->gso_size = __cpu_to_virtio16(little_endian,
fd2a0437dc33b6 Mike Rapoport    2016-06-08  110  						  sinfo->gso_size);
fd2a0437dc33b6 Mike Rapoport    2016-06-08  111  		if (sinfo->gso_type & SKB_GSO_TCPV4)
fd2a0437dc33b6 Mike Rapoport    2016-06-08  112  			hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
fd2a0437dc33b6 Mike Rapoport    2016-06-08  113  		else if (sinfo->gso_type & SKB_GSO_TCPV6)
fd2a0437dc33b6 Mike Rapoport    2016-06-08  114  			hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
fd2a0437dc33b6 Mike Rapoport    2016-06-08  115  		else
fd2a0437dc33b6 Mike Rapoport    2016-06-08  116  			return -EINVAL;
fd2a0437dc33b6 Mike Rapoport    2016-06-08  117  		if (sinfo->gso_type & SKB_GSO_TCP_ECN)
fd2a0437dc33b6 Mike Rapoport    2016-06-08  118  			hdr->gso_type |= VIRTIO_NET_HDR_GSO_ECN;
fd2a0437dc33b6 Mike Rapoport    2016-06-08  119  	} else
fd2a0437dc33b6 Mike Rapoport    2016-06-08  120  		hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE;
fd2a0437dc33b6 Mike Rapoport    2016-06-08  121  
fd2a0437dc33b6 Mike Rapoport    2016-06-08  122  	if (skb->ip_summed == CHECKSUM_PARTIAL) {
fd2a0437dc33b6 Mike Rapoport    2016-06-08  123  		hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
fd2a0437dc33b6 Mike Rapoport    2016-06-08  124  		hdr->csum_start = __cpu_to_virtio16(little_endian,
fd3a8862584490 Willem de Bruijn 2018-06-06  125  			skb_checksum_start_offset(skb) + vlan_hlen);
fd2a0437dc33b6 Mike Rapoport    2016-06-08  126  		hdr->csum_offset = __cpu_to_virtio16(little_endian,
fd2a0437dc33b6 Mike Rapoport    2016-06-08  127  				skb->csum_offset);
6391a4481ba079 Jason Wang       2017-01-20  128  	} else if (has_data_valid &&
6391a4481ba079 Jason Wang       2017-01-20  129  		   skb->ip_summed == CHECKSUM_UNNECESSARY) {
6391a4481ba079 Jason Wang       2017-01-20  130  		hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID;
fd2a0437dc33b6 Mike Rapoport    2016-06-08  131  	} /* else everything is zero */
fd2a0437dc33b6 Mike Rapoport    2016-06-08  132  
fd2a0437dc33b6 Mike Rapoport    2016-06-08  133  	return 0;
fd2a0437dc33b6 Mike Rapoport    2016-06-08  134  }
fd2a0437dc33b6 Mike Rapoport    2016-06-08  135  

:::::: The code at line 103 was first introduced by commit
:::::: fd2a0437dc33b6425cabf74cc7fc7fdba6d5903b virtio_net: introduce virtio_net_hdr_{from,to}_skb

:::::: TO: Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux