* [PATCH v2] virtio: Work around frames incorrectly marked as gso @ 2020-02-24 10:19 ` anton.ivanov 0 siblings, 0 replies; 10+ messages in thread From: anton.ivanov @ 2020-02-24 10:19 UTC (permalink / raw) To: netdev, virtualization, linux-um Cc: jasowang, Anton Ivanov, eric.dumazet, mst From: Anton Ivanov <anton.ivanov@cambridgegreys.com> Some of the locally generated frames marked as GSO which arrive at virtio_net_hdr_from_skb() have no GSO_TYPE, no fragments (data_len = 0) and length significantly shorter than the MTU (752 in my experiments). This is observed on raw sockets reading off vEth interfaces in all 4.x and 5.x kernels I tested. These frames are reported as invalid while they are in fact gso-less frames. This patch marks the vnet header as no-GSO for them instead of reporting it as invalid. Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com> --- include/linux/virtio_net.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index 0d1fe9297ac6..94fb78c3a2ab 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -100,8 +100,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, { memset(hdr, 0, sizeof(*hdr)); /* no info leak */ - if (skb_is_gso(skb)) { - struct skb_shared_info *sinfo = skb_shinfo(skb); + struct skb_shared_info *sinfo = skb_shinfo(skb); + if (skb_is_gso(skb) && sinfo->gso_type) { /* This is a hint as to how much should be linear. */ hdr->hdr_len = __cpu_to_virtio16(little_endian, -- 2.20.1 _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2] virtio: Work around frames incorrectly marked as gso @ 2020-02-24 10:19 ` anton.ivanov 0 siblings, 0 replies; 10+ messages in thread From: anton.ivanov @ 2020-02-24 10:19 UTC (permalink / raw) To: netdev, virtualization, linux-um Cc: mst, jasowang, eric.dumazet, Anton Ivanov From: Anton Ivanov <anton.ivanov@cambridgegreys.com> Some of the locally generated frames marked as GSO which arrive at virtio_net_hdr_from_skb() have no GSO_TYPE, no fragments (data_len = 0) and length significantly shorter than the MTU (752 in my experiments). This is observed on raw sockets reading off vEth interfaces in all 4.x and 5.x kernels I tested. These frames are reported as invalid while they are in fact gso-less frames. This patch marks the vnet header as no-GSO for them instead of reporting it as invalid. Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com> --- include/linux/virtio_net.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index 0d1fe9297ac6..94fb78c3a2ab 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -100,8 +100,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, { memset(hdr, 0, sizeof(*hdr)); /* no info leak */ - if (skb_is_gso(skb)) { - struct skb_shared_info *sinfo = skb_shinfo(skb); + struct skb_shared_info *sinfo = skb_shinfo(skb); + if (skb_is_gso(skb) && sinfo->gso_type) { /* This is a hint as to how much should be linear. */ hdr->hdr_len = __cpu_to_virtio16(little_endian, -- 2.20.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2] virtio: Work around frames incorrectly marked as gso 2020-02-24 10:19 ` anton.ivanov (?) (?) @ 2020-02-24 12:37 ` kbuild test robot -1 siblings, 0 replies; 10+ messages in thread From: kbuild test robot @ 2020-02-24 12:37 UTC (permalink / raw) To: anton.ivanov Cc: kbuild-all, eric.dumazet, mst, netdev, jasowang, linux-um, virtualization [-- Attachment #1: Type: text/plain, Size: 5230 bytes --] 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@intel.com> 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@linux.vnet.ibm.com> :::::: CC: David S. Miller <davem@davemloft.net> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 10726 bytes --] [-- Attachment #3: Type: text/plain, Size: 152 bytes --] _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] virtio: Work around frames incorrectly marked as gso @ 2020-02-24 12:37 ` kbuild test robot 0 siblings, 0 replies; 10+ messages in thread From: kbuild test robot @ 2020-02-24 12:37 UTC (permalink / raw) To: anton.ivanov Cc: kbuild-all, netdev, virtualization, linux-um, mst, jasowang, eric.dumazet, Anton Ivanov [-- Attachment #1: Type: text/plain, Size: 5230 bytes --] 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@intel.com> 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@linux.vnet.ibm.com> :::::: CC: David S. Miller <davem@davemloft.net> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 10726 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] virtio: Work around frames incorrectly marked as gso @ 2020-02-24 12:37 ` kbuild test robot 0 siblings, 0 replies; 10+ messages in thread From: kbuild test robot @ 2020-02-24 12:37 UTC (permalink / raw) Cc: kbuild-all, netdev, virtualization, linux-um, mst, jasowang, eric.dumazet, Anton Ivanov [-- Attachment #1: Type: text/plain, Size: 5230 bytes --] 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@intel.com> 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@linux.vnet.ibm.com> :::::: CC: David S. Miller <davem@davemloft.net> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 10726 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] virtio: Work around frames incorrectly marked as gso @ 2020-02-24 12:37 ` kbuild test robot 0 siblings, 0 replies; 10+ messages in thread From: kbuild test robot @ 2020-02-24 12:37 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 5317 bytes --] 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@intel.com> 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@linux.vnet.ibm.com> :::::: CC: David S. Miller <davem@davemloft.net> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org [-- Attachment #2: config.gz --] [-- Type: application/gzip, Size: 10726 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] virtio: Work around frames incorrectly marked as gso 2020-02-24 10:19 ` anton.ivanov @ 2020-02-24 12:46 ` Michael S. Tsirkin -1 siblings, 0 replies; 10+ messages in thread From: Michael S. Tsirkin @ 2020-02-24 12:46 UTC (permalink / raw) To: anton.ivanov; +Cc: netdev, jasowang, linux-um, eric.dumazet, virtualization On Mon, Feb 24, 2020 at 10:19:12AM +0000, anton.ivanov@cambridgegreys.com wrote: > From: Anton Ivanov <anton.ivanov@cambridgegreys.com> > > Some of the locally generated frames marked as GSO which > arrive at virtio_net_hdr_from_skb() have no GSO_TYPE, no > fragments (data_len = 0) and length significantly shorter > than the MTU (752 in my experiments). > > This is observed on raw sockets reading off vEth interfaces > in all 4.x and 5.x kernels I tested. A bit more info on how to reproduce couldn't hurt here. > > These frames are reported as invalid while they are in fact > gso-less frames. > > This patch marks the vnet header as no-GSO for them instead > of reporting it as invalid. > > Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Eric - as you looked at this in the past, would you mind acking please? > --- > include/linux/virtio_net.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h > index 0d1fe9297ac6..94fb78c3a2ab 100644 > --- a/include/linux/virtio_net.h > +++ b/include/linux/virtio_net.h > @@ -100,8 +100,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, > { > memset(hdr, 0, sizeof(*hdr)); /* no info leak */ > > - if (skb_is_gso(skb)) { > - struct skb_shared_info *sinfo = skb_shinfo(skb); > + struct skb_shared_info *sinfo = skb_shinfo(skb); > + if (skb_is_gso(skb) && sinfo->gso_type) { > > /* This is a hint as to how much should be linear. */ > hdr->hdr_len = __cpu_to_virtio16(little_endian, > -- > 2.20.1 _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] virtio: Work around frames incorrectly marked as gso @ 2020-02-24 12:46 ` Michael S. Tsirkin 0 siblings, 0 replies; 10+ messages in thread From: Michael S. Tsirkin @ 2020-02-24 12:46 UTC (permalink / raw) To: anton.ivanov; +Cc: netdev, virtualization, linux-um, jasowang, eric.dumazet On Mon, Feb 24, 2020 at 10:19:12AM +0000, anton.ivanov@cambridgegreys.com wrote: > From: Anton Ivanov <anton.ivanov@cambridgegreys.com> > > Some of the locally generated frames marked as GSO which > arrive at virtio_net_hdr_from_skb() have no GSO_TYPE, no > fragments (data_len = 0) and length significantly shorter > than the MTU (752 in my experiments). > > This is observed on raw sockets reading off vEth interfaces > in all 4.x and 5.x kernels I tested. A bit more info on how to reproduce couldn't hurt here. > > These frames are reported as invalid while they are in fact > gso-less frames. > > This patch marks the vnet header as no-GSO for them instead > of reporting it as invalid. > > Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Eric - as you looked at this in the past, would you mind acking please? > --- > include/linux/virtio_net.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h > index 0d1fe9297ac6..94fb78c3a2ab 100644 > --- a/include/linux/virtio_net.h > +++ b/include/linux/virtio_net.h > @@ -100,8 +100,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, > { > memset(hdr, 0, sizeof(*hdr)); /* no info leak */ > > - if (skb_is_gso(skb)) { > - struct skb_shared_info *sinfo = skb_shinfo(skb); > + struct skb_shared_info *sinfo = skb_shinfo(skb); > + if (skb_is_gso(skb) && sinfo->gso_type) { > > /* This is a hint as to how much should be linear. */ > hdr->hdr_len = __cpu_to_virtio16(little_endian, > -- > 2.20.1 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] virtio: Work around frames incorrectly marked as gso 2020-02-24 12:46 ` Michael S. Tsirkin @ 2020-02-24 12:51 ` Anton Ivanov -1 siblings, 0 replies; 10+ messages in thread From: Anton Ivanov @ 2020-02-24 12:51 UTC (permalink / raw) To: Michael S. Tsirkin Cc: netdev, jasowang, linux-um, eric.dumazet, virtualization On 24/02/2020 12:46, Michael S. Tsirkin wrote: > On Mon, Feb 24, 2020 at 10:19:12AM +0000, anton.ivanov@cambridgegreys.com wrote: >> From: Anton Ivanov <anton.ivanov@cambridgegreys.com> >> >> Some of the locally generated frames marked as GSO which >> arrive at virtio_net_hdr_from_skb() have no GSO_TYPE, no >> fragments (data_len = 0) and length significantly shorter >> than the MTU (752 in my experiments). >> >> This is observed on raw sockets reading off vEth interfaces >> in all 4.x and 5.x kernels I tested. > > A bit more info on how to reproduce couldn't hurt here. Will do, a v3 will follow shortly. > >> >> These frames are reported as invalid while they are in fact >> gso-less frames. >> >> This patch marks the vnet header as no-GSO for them instead >> of reporting it as invalid. >> >> Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com> > > Acked-by: Michael S. Tsirkin <mst@redhat.com> > > Eric - as you looked at this in the past, would you mind acking please? > >> --- >> include/linux/virtio_net.h | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h >> index 0d1fe9297ac6..94fb78c3a2ab 100644 >> --- a/include/linux/virtio_net.h >> +++ b/include/linux/virtio_net.h >> @@ -100,8 +100,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, >> { >> memset(hdr, 0, sizeof(*hdr)); /* no info leak */ >> >> - if (skb_is_gso(skb)) { >> - struct skb_shared_info *sinfo = skb_shinfo(skb); >> + struct skb_shared_info *sinfo = skb_shinfo(skb); I need to move this a few lines up - the kernel build robot is quite rightfully complaining. >> + if (skb_is_gso(skb) && sinfo->gso_type) { >> >> /* This is a hint as to how much should be linear. */ >> hdr->hdr_len = __cpu_to_virtio16(little_endian, >> -- >> 2.20.1 > > -- Anton R. Ivanov Cambridgegreys Limited. Registered in England. Company Number 10273661 https://www.cambridgegreys.com/ _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] virtio: Work around frames incorrectly marked as gso @ 2020-02-24 12:51 ` Anton Ivanov 0 siblings, 0 replies; 10+ messages in thread From: Anton Ivanov @ 2020-02-24 12:51 UTC (permalink / raw) To: Michael S. Tsirkin Cc: netdev, virtualization, linux-um, jasowang, eric.dumazet On 24/02/2020 12:46, Michael S. Tsirkin wrote: > On Mon, Feb 24, 2020 at 10:19:12AM +0000, anton.ivanov@cambridgegreys.com wrote: >> From: Anton Ivanov <anton.ivanov@cambridgegreys.com> >> >> Some of the locally generated frames marked as GSO which >> arrive at virtio_net_hdr_from_skb() have no GSO_TYPE, no >> fragments (data_len = 0) and length significantly shorter >> than the MTU (752 in my experiments). >> >> This is observed on raw sockets reading off vEth interfaces >> in all 4.x and 5.x kernels I tested. > > A bit more info on how to reproduce couldn't hurt here. Will do, a v3 will follow shortly. > >> >> These frames are reported as invalid while they are in fact >> gso-less frames. >> >> This patch marks the vnet header as no-GSO for them instead >> of reporting it as invalid. >> >> Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com> > > Acked-by: Michael S. Tsirkin <mst@redhat.com> > > Eric - as you looked at this in the past, would you mind acking please? > >> --- >> include/linux/virtio_net.h | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h >> index 0d1fe9297ac6..94fb78c3a2ab 100644 >> --- a/include/linux/virtio_net.h >> +++ b/include/linux/virtio_net.h >> @@ -100,8 +100,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, >> { >> memset(hdr, 0, sizeof(*hdr)); /* no info leak */ >> >> - if (skb_is_gso(skb)) { >> - struct skb_shared_info *sinfo = skb_shinfo(skb); >> + struct skb_shared_info *sinfo = skb_shinfo(skb); I need to move this a few lines up - the kernel build robot is quite rightfully complaining. >> + if (skb_is_gso(skb) && sinfo->gso_type) { >> >> /* This is a hint as to how much should be linear. */ >> hdr->hdr_len = __cpu_to_virtio16(little_endian, >> -- >> 2.20.1 > > -- Anton R. Ivanov Cambridgegreys Limited. Registered in England. Company Number 10273661 https://www.cambridgegreys.com/ ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2020-02-24 12:51 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-02-24 10:19 [PATCH v2] virtio: Work around frames incorrectly marked as gso anton.ivanov 2020-02-24 10:19 ` anton.ivanov 2020-02-24 12:37 ` kbuild test robot 2020-02-24 12:37 ` kbuild test robot 2020-02-24 12:37 ` kbuild test robot 2020-02-24 12:37 ` kbuild test robot 2020-02-24 12:46 ` Michael S. Tsirkin 2020-02-24 12:46 ` Michael S. Tsirkin 2020-02-24 12:51 ` Anton Ivanov 2020-02-24 12:51 ` Anton Ivanov
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.