Yuri Benditovich
2021-May-11 04:42 UTC
[PATCH 2/4] virtio-net: add support of UDP segmentation (USO) on the host
Large UDP packet provided by the guest with GSO type set to VIRTIO_NET_HDR_GSO_UDP_L4 will be divided to several UDP packets according to the gso_size field. Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com> --- include/linux/virtio_net.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index b465f8f3e554..4ecf9a1ca912 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -51,6 +51,11 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, ip_proto = IPPROTO_UDP; thlen = sizeof(struct udphdr); break; + case VIRTIO_NET_HDR_GSO_UDP_L4: + gso_type = SKB_GSO_UDP_L4; + ip_proto = IPPROTO_UDP; + thlen = sizeof(struct udphdr); + break; default: return -EINVAL; } -- 2.26.3
Jason Wang
2021-May-11 06:47 UTC
[PATCH 2/4] virtio-net: add support of UDP segmentation (USO) on the host
? 2021/5/11 ??12:42, Yuri Benditovich ??:> Large UDP packet provided by the guest with GSO type set to > VIRTIO_NET_HDR_GSO_UDP_L4 will be divided to several UDP > packets according to the gso_size field. > > Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com> > --- > include/linux/virtio_net.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h > index b465f8f3e554..4ecf9a1ca912 100644 > --- a/include/linux/virtio_net.h > +++ b/include/linux/virtio_net.h > @@ -51,6 +51,11 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, > ip_proto = IPPROTO_UDP; > thlen = sizeof(struct udphdr); > break; > + case VIRTIO_NET_HDR_GSO_UDP_L4: > + gso_type = SKB_GSO_UDP_L4; > + ip_proto = IPPROTO_UDP; > + thlen = sizeof(struct udphdr); > + break;This is only for rx, how about tx? Thanks> default: > return -EINVAL; > }
Willem de Bruijn
2021-May-11 17:47 UTC
[PATCH 2/4] virtio-net: add support of UDP segmentation (USO) on the host
On Tue, May 11, 2021 at 12:43 AM Yuri Benditovich <yuri.benditovich at daynix.com> wrote:> > Large UDP packet provided by the guest with GSO type set to > VIRTIO_NET_HDR_GSO_UDP_L4 will be divided to several UDP > packets according to the gso_size field. > > Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com> > --- > include/linux/virtio_net.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h > index b465f8f3e554..4ecf9a1ca912 100644 > --- a/include/linux/virtio_net.h > +++ b/include/linux/virtio_net.h > @@ -51,6 +51,11 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, > ip_proto = IPPROTO_UDP; > thlen = sizeof(struct udphdr); > break; > + case VIRTIO_NET_HDR_GSO_UDP_L4: > + gso_type = SKB_GSO_UDP_L4; > + ip_proto = IPPROTO_UDP; > + thlen = sizeof(struct udphdr); > + break;If adding a new VIRTIO_NET_HDR type I suggest adding separate IPv4 and IPv6 variants, analogous to VIRTIO_NET_HDR_GSO_TCPV[46]. To avoid having to infer protocol again, as for UDP fragmentation offload (the retry case below this code).