DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
@ 2017-11-21  6:56 Jiayu Hu
  2017-11-21  7:12 ` Stephen Hemminger
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Jiayu Hu @ 2017-11-21  6:56 UTC (permalink / raw)
  To: dev; +Cc: yliu, jianfeng.tan, Jiayu Hu

In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO
and guest UFO. Guest UFO means the frontend can receive large UDP packets,
and host UFO means the backend can receive large UDP packets. This patch
supports host UFO and guest UFO for vhost-user.

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
---
 lib/librte_mbuf/rte_mbuf.h    |  7 +++++++
 lib/librte_vhost/vhost.h      |  2 ++
 lib/librte_vhost/virtio_net.c | 10 ++++++++++
 3 files changed, 19 insertions(+)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index ce8a05d..3d8cfc9 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -209,6 +209,13 @@ extern "C" {
 /* add new TX flags here */
 
 /**
+ * UDP Fragmentation Offload flag. This flag is used for enabling UDP
+ * fragmentation in SW or in HW. When use UFO, mbuf->tso_segsz is used
+ * to store the MSS of UDP fragments.
+ */
+#define PKT_TX_UDP_SEG	(1ULL << 42)
+
+/**
  * Request security offload processing on the TX packet.
  */
 #define PKT_TX_SEC_OFFLOAD 		(1ULL << 43)
diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
index 1cc81c1..fc109ef 100644
--- a/lib/librte_vhost/vhost.h
+++ b/lib/librte_vhost/vhost.h
@@ -206,10 +206,12 @@ struct vhost_msg {
 				(1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
 				(1ULL << VIRTIO_NET_F_HOST_TSO4) | \
 				(1ULL << VIRTIO_NET_F_HOST_TSO6) | \
+				(1ULL << VIRTIO_NET_F_HOST_UFO) | \
 				(1ULL << VIRTIO_NET_F_CSUM)    | \
 				(1ULL << VIRTIO_NET_F_GUEST_CSUM) | \
 				(1ULL << VIRTIO_NET_F_GUEST_TSO4) | \
 				(1ULL << VIRTIO_NET_F_GUEST_TSO6) | \
+				(1ULL << VIRTIO_NET_F_GUEST_UFO) | \
 				(1ULL << VIRTIO_RING_F_INDIRECT_DESC) | \
 				(1ULL << VIRTIO_NET_F_MTU) | \
 				(1ULL << VIRTIO_F_IOMMU_PLATFORM))
diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 6fee16e..3a3a0ad 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -188,6 +188,11 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr)
 		net_hdr->gso_size = m_buf->tso_segsz;
 		net_hdr->hdr_len = m_buf->l2_len + m_buf->l3_len
 					+ m_buf->l4_len;
+	} else if (m_buf->ol_flags & PKT_TX_UDP_SEG) {
+		net_hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP;
+		net_hdr->gso_size = m_buf->tso_segsz;
+		net_hdr->hdr_len = m_buf->l2_len + m_buf->l3_len +
+			m_buf->l4_len;
 	} else {
 		ASSIGN_UNLESS_EQUAL(net_hdr->gso_type, 0);
 		ASSIGN_UNLESS_EQUAL(net_hdr->gso_size, 0);
@@ -834,6 +839,11 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m)
 			m->tso_segsz = hdr->gso_size;
 			m->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;
 			break;
+		case VIRTIO_NET_HDR_GSO_UDP:
+			m->ol_flags |= PKT_TX_UDP_SEG;
+			m->tso_segsz = hdr->gso_size;
+			m->l4_len = sizeof(struct udp_hdr);
+			break;
 		default:
 			RTE_LOG(WARNING, VHOST_DATA,
 				"unsupported gso type %u.\n", hdr->gso_type);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
  2017-11-21  6:56 [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload Jiayu Hu
@ 2017-11-21  7:12 ` Stephen Hemminger
  2017-11-21  7:41   ` Hu, Jiayu
  2017-12-05 14:57 ` Maxime Coquelin
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Stephen Hemminger @ 2017-11-21  7:12 UTC (permalink / raw)
  To: Jiayu Hu; +Cc: dev, yliu, jianfeng.tan

On Tue, 21 Nov 2017 14:56:52 +0800
Jiayu Hu <jiayu.hu@intel.com> wrote:

> In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO
> and guest UFO. Guest UFO means the frontend can receive large UDP packets,
> and host UFO means the backend can receive large UDP packets. This patch
> supports host UFO and guest UFO for vhost-user.
> 
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>

This may no longer be a desirable feature to implement.
UFO was just deprecated and removed from Linux.
It had no useful benefit.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
  2017-11-21  7:12 ` Stephen Hemminger
@ 2017-11-21  7:41   ` Hu, Jiayu
  2017-11-21 14:33     ` Neil Horman
  0 siblings, 1 reply; 12+ messages in thread
From: Hu, Jiayu @ 2017-11-21  7:41 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, yliu, Tan, Jianfeng

Hi Stephen,

> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Tuesday, November 21, 2017 3:13 PM
> To: Hu, Jiayu <jiayu.hu@intel.com>
> Cc: dev@dpdk.org; yliu@fridaylinux.org; Tan, Jianfeng
> <jianfeng.tan@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
> 
> On Tue, 21 Nov 2017 14:56:52 +0800
> Jiayu Hu <jiayu.hu@intel.com> wrote:
> 
> > In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO
> > and guest UFO. Guest UFO means the frontend can receive large UDP
> packets,
> > and host UFO means the backend can receive large UDP packets. This patch
> > supports host UFO and guest UFO for vhost-user.
> >
> > Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> 
> This may no longer be a desirable feature to implement.
> UFO was just deprecated and removed from Linux.
> It had no useful benefit.

The main reason of supporting UFO is to make the backend live migration from
vhost-net to vhost-user possible. Host and guest UFO are default features for virtio-net,
and vhost-net supports both. But vhosy-user doesn't support them. If we want to
migrate from vhost-net to vhost-user, this features gap would cause live migration fail.

Thanks,
Jiayu

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
  2017-11-21  7:41   ` Hu, Jiayu
@ 2017-11-21 14:33     ` Neil Horman
  0 siblings, 0 replies; 12+ messages in thread
From: Neil Horman @ 2017-11-21 14:33 UTC (permalink / raw)
  To: Hu, Jiayu; +Cc: Stephen Hemminger, dev, yliu, Tan, Jianfeng

On Tue, Nov 21, 2017 at 07:41:00AM +0000, Hu, Jiayu wrote:
> Hi Stephen,
> 
> > -----Original Message-----
> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > Sent: Tuesday, November 21, 2017 3:13 PM
> > To: Hu, Jiayu <jiayu.hu@intel.com>
> > Cc: dev@dpdk.org; yliu@fridaylinux.org; Tan, Jianfeng
> > <jianfeng.tan@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
> > 
> > On Tue, 21 Nov 2017 14:56:52 +0800
> > Jiayu Hu <jiayu.hu@intel.com> wrote:
> > 
> > > In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO
> > > and guest UFO. Guest UFO means the frontend can receive large UDP
> > packets,
> > > and host UFO means the backend can receive large UDP packets. This patch
> > > supports host UFO and guest UFO for vhost-user.
> > >
> > > Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> > 
> > This may no longer be a desirable feature to implement.
> > UFO was just deprecated and removed from Linux.
> > It had no useful benefit.
> 
> The main reason of supporting UFO is to make the backend live migration from
> vhost-net to vhost-user possible. Host and guest UFO are default features for virtio-net,
> and vhost-net supports both. But vhosy-user doesn't support them. If we want to
> migrate from vhost-net to vhost-user, this features gap would cause live migration fail.
> 
> Thanks,
> Jiayu
> 

Its not a widely used feature, but if it helps migrage people, its not a hard
feature to support

Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
  2017-11-21  6:56 [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload Jiayu Hu
  2017-11-21  7:12 ` Stephen Hemminger
@ 2017-12-05 14:57 ` Maxime Coquelin
  2017-12-06  8:36 ` Maxime Coquelin
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Maxime Coquelin @ 2017-12-05 14:57 UTC (permalink / raw)
  To: Jiayu Hu, dev; +Cc: yliu, jianfeng.tan



On 11/21/2017 07:56 AM, Jiayu Hu wrote:
> In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO
> and guest UFO. Guest UFO means the frontend can receive large UDP packets,
> and host UFO means the backend can receive large UDP packets. This patch
> supports host UFO and guest UFO for vhost-user.
> 
> Signed-off-by: Jiayu Hu<jiayu.hu@intel.com>
> ---
>   lib/librte_mbuf/rte_mbuf.h    |  7 +++++++
>   lib/librte_vhost/vhost.h      |  2 ++
>   lib/librte_vhost/virtio_net.c | 10 ++++++++++
>   3 files changed, 19 insertions(+)

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
  2017-11-21  6:56 [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload Jiayu Hu
  2017-11-21  7:12 ` Stephen Hemminger
  2017-12-05 14:57 ` Maxime Coquelin
@ 2017-12-06  8:36 ` Maxime Coquelin
  2017-12-07 13:14   ` Hu, Jiayu
  2017-12-25  1:48 ` Yao, Lei A
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Maxime Coquelin @ 2017-12-06  8:36 UTC (permalink / raw)
  To: Jiayu Hu, dev; +Cc: yliu, jianfeng.tan



On 11/21/2017 07:56 AM, Jiayu Hu wrote:
> In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO
> and guest UFO. Guest UFO means the frontend can receive large UDP packets,
> and host UFO means the backend can receive large UDP packets. This patch
> supports host UFO and guest UFO for vhost-user.
> 
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> ---
>   lib/librte_mbuf/rte_mbuf.h    |  7 +++++++
>   lib/librte_vhost/vhost.h      |  2 ++
>   lib/librte_vhost/virtio_net.c | 10 ++++++++++
>   3 files changed, 19 insertions(+)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index ce8a05d..3d8cfc9 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -209,6 +209,13 @@ extern "C" {
>   /* add new TX flags here */
>   
>   /**
> + * UDP Fragmentation Offload flag. This flag is used for enabling UDP
> + * fragmentation in SW or in HW. When use UFO, mbuf->tso_segsz is used
> + * to store the MSS of UDP fragments.
> + */
> +#define PKT_TX_UDP_SEG	(1ULL << 42)
> +
> +/**
>    * Request security offload processing on the TX packet.
>    */
>   #define PKT_TX_SEC_OFFLOAD 		(1ULL << 43)
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> index 1cc81c1..fc109ef 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -206,10 +206,12 @@ struct vhost_msg {
>   				(1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
>   				(1ULL << VIRTIO_NET_F_HOST_TSO4) | \
>   				(1ULL << VIRTIO_NET_F_HOST_TSO6) | \
> +				(1ULL << VIRTIO_NET_F_HOST_UFO) | \
>   				(1ULL << VIRTIO_NET_F_CSUM)    | \
>   				(1ULL << VIRTIO_NET_F_GUEST_CSUM) | \
>   				(1ULL << VIRTIO_NET_F_GUEST_TSO4) | \
>   				(1ULL << VIRTIO_NET_F_GUEST_TSO6) | \
> +				(1ULL << VIRTIO_NET_F_GUEST_UFO) | \

I actually have the same question as for GSO.
Dos it impact performance as it seems enabled by default in QEMU?
How do you test it?

Thanks,
Maxime

>   				(1ULL << VIRTIO_RING_F_INDIRECT_DESC) | \
>   				(1ULL << VIRTIO_NET_F_MTU) | \
>   				(1ULL << VIRTIO_F_IOMMU_PLATFORM))
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 6fee16e..3a3a0ad 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -188,6 +188,11 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr)
>   		net_hdr->gso_size = m_buf->tso_segsz;
>   		net_hdr->hdr_len = m_buf->l2_len + m_buf->l3_len
>   					+ m_buf->l4_len;
> +	} else if (m_buf->ol_flags & PKT_TX_UDP_SEG) {
> +		net_hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP;
> +		net_hdr->gso_size = m_buf->tso_segsz;
> +		net_hdr->hdr_len = m_buf->l2_len + m_buf->l3_len +
> +			m_buf->l4_len;
>   	} else {
>   		ASSIGN_UNLESS_EQUAL(net_hdr->gso_type, 0);
>   		ASSIGN_UNLESS_EQUAL(net_hdr->gso_size, 0);
> @@ -834,6 +839,11 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m)
>   			m->tso_segsz = hdr->gso_size;
>   			m->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;
>   			break;
> +		case VIRTIO_NET_HDR_GSO_UDP:
> +			m->ol_flags |= PKT_TX_UDP_SEG;
> +			m->tso_segsz = hdr->gso_size;
> +			m->l4_len = sizeof(struct udp_hdr);
> +			break;
>   		default:
>   			RTE_LOG(WARNING, VHOST_DATA,
>   				"unsupported gso type %u.\n", hdr->gso_type);
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
  2017-12-06  8:36 ` Maxime Coquelin
@ 2017-12-07 13:14   ` Hu, Jiayu
  0 siblings, 0 replies; 12+ messages in thread
From: Hu, Jiayu @ 2017-12-07 13:14 UTC (permalink / raw)
  To: Maxime Coquelin, dev; +Cc: yliu, Tan, Jianfeng

Hi Maxime,

> -----Original Message-----
> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> Sent: Wednesday, December 6, 2017 4:37 PM
> To: Hu, Jiayu <jiayu.hu@intel.com>; dev@dpdk.org
> Cc: yliu@fridaylinux.org; Tan, Jianfeng <jianfeng.tan@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
> 
> 
> 
> On 11/21/2017 07:56 AM, Jiayu Hu wrote:
> > In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO
> > and guest UFO. Guest UFO means the frontend can receive large UDP
> packets,
> > and host UFO means the backend can receive large UDP packets. This patch
> > supports host UFO and guest UFO for vhost-user.
> >
> > Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> > ---
> >   lib/librte_mbuf/rte_mbuf.h    |  7 +++++++
> >   lib/librte_vhost/vhost.h      |  2 ++
> >   lib/librte_vhost/virtio_net.c | 10 ++++++++++
> >   3 files changed, 19 insertions(+)
> >
> > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> > index ce8a05d..3d8cfc9 100644
> > --- a/lib/librte_mbuf/rte_mbuf.h
> > +++ b/lib/librte_mbuf/rte_mbuf.h
> > @@ -209,6 +209,13 @@ extern "C" {
> >   /* add new TX flags here */
> >
> >   /**
> > + * UDP Fragmentation Offload flag. This flag is used for enabling UDP
> > + * fragmentation in SW or in HW. When use UFO, mbuf->tso_segsz is used
> > + * to store the MSS of UDP fragments.
> > + */
> > +#define PKT_TX_UDP_SEG	(1ULL << 42)
> > +
> > +/**
> >    * Request security offload processing on the TX packet.
> >    */
> >   #define PKT_TX_SEC_OFFLOAD 		(1ULL << 43)
> > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> > index 1cc81c1..fc109ef 100644
> > --- a/lib/librte_vhost/vhost.h
> > +++ b/lib/librte_vhost/vhost.h
> > @@ -206,10 +206,12 @@ struct vhost_msg {
> >   				(1ULL <<
> VHOST_USER_F_PROTOCOL_FEATURES) | \
> >   				(1ULL << VIRTIO_NET_F_HOST_TSO4) | \
> >   				(1ULL << VIRTIO_NET_F_HOST_TSO6) | \
> > +				(1ULL << VIRTIO_NET_F_HOST_UFO) | \
> >   				(1ULL << VIRTIO_NET_F_CSUM)    | \
> >   				(1ULL << VIRTIO_NET_F_GUEST_CSUM) | \
> >   				(1ULL << VIRTIO_NET_F_GUEST_TSO4) | \
> >   				(1ULL << VIRTIO_NET_F_GUEST_TSO6) | \
> > +				(1ULL << VIRTIO_NET_F_GUEST_UFO) | \
> 
> I actually have the same question as for GSO.
> Dos it impact performance as it seems enabled by default in QEMU?

When enable host/guest UFO, the frontend and the backend can communicate
via large UDP packets, thus reducing the number of packets to be processed.
It's similar with TSO for virtio. Therefore, I think host/guest UFO can bring
performance gains.

> How do you test it?

We launch testpmd with two vhost-user ports, which connect to two VMs in one
server. When launch qemu, we enable host and guest UFO with command "host_ufo=on,
guest_ufo=on,csum=on". Then we run iperf in the two VMs to send large UDP packets.
If you use "show port xstats all" in testpmd, you can see the vhost-user port can receive
large UDP packets, which means host_ufo works. Additionally, if the forwarded large UDP
packets can be received by the VM, it means guest_ufo also works.

Thanks,
Jiayu
> 
> Thanks,
> Maxime
> 
> >   				(1ULL << VIRTIO_RING_F_INDIRECT_DESC)
> | \
> >   				(1ULL << VIRTIO_NET_F_MTU) | \
> >   				(1ULL << VIRTIO_F_IOMMU_PLATFORM))
> > diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> > index 6fee16e..3a3a0ad 100644
> > --- a/lib/librte_vhost/virtio_net.c
> > +++ b/lib/librte_vhost/virtio_net.c
> > @@ -188,6 +188,11 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf,
> struct virtio_net_hdr *net_hdr)
> >   		net_hdr->gso_size = m_buf->tso_segsz;
> >   		net_hdr->hdr_len = m_buf->l2_len + m_buf->l3_len
> >   					+ m_buf->l4_len;
> > +	} else if (m_buf->ol_flags & PKT_TX_UDP_SEG) {
> > +		net_hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP;
> > +		net_hdr->gso_size = m_buf->tso_segsz;
> > +		net_hdr->hdr_len = m_buf->l2_len + m_buf->l3_len +
> > +			m_buf->l4_len;
> >   	} else {
> >   		ASSIGN_UNLESS_EQUAL(net_hdr->gso_type, 0);
> >   		ASSIGN_UNLESS_EQUAL(net_hdr->gso_size, 0);
> > @@ -834,6 +839,11 @@ vhost_dequeue_offload(struct virtio_net_hdr
> *hdr, struct rte_mbuf *m)
> >   			m->tso_segsz = hdr->gso_size;
> >   			m->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;
> >   			break;
> > +		case VIRTIO_NET_HDR_GSO_UDP:
> > +			m->ol_flags |= PKT_TX_UDP_SEG;
> > +			m->tso_segsz = hdr->gso_size;
> > +			m->l4_len = sizeof(struct udp_hdr);
> > +			break;
> >   		default:
> >   			RTE_LOG(WARNING, VHOST_DATA,
> >   				"unsupported gso type %u.\n", hdr-
> >gso_type);
> >

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
  2017-11-21  6:56 [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload Jiayu Hu
                   ` (2 preceding siblings ...)
  2017-12-06  8:36 ` Maxime Coquelin
@ 2017-12-25  1:48 ` Yao, Lei A
  2017-12-27 14:34 ` Yuanhan Liu
  2018-01-08 14:27 ` Yuanhan Liu
  5 siblings, 0 replies; 12+ messages in thread
From: Yao, Lei A @ 2017-12-25  1:48 UTC (permalink / raw)
  To: Hu, Jiayu, dev; +Cc: yliu, Tan, Jianfeng, Hu, Jiayu



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jiayu Hu
> Sent: Tuesday, November 21, 2017 2:57 PM
> To: dev@dpdk.org
> Cc: yliu@fridaylinux.org; Tan, Jianfeng <jianfeng.tan@intel.com>; Hu, Jiayu
> <jiayu.hu@intel.com>
> Subject: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
> 
> In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO
> and guest UFO. Guest UFO means the frontend can receive large UDP
> packets,
> and host UFO means the backend can receive large UDP packets. This patch
> supports host UFO and guest UFO for vhost-user.
> 
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Tested-by: Lei Yao<lei.a.yao@intel.com>
This patch has been tested on my server,  with guest_ufo=on,host_ufo=on are
added to the qemu cmdlind, using vhost-user as backend, vm can send and receive  
big UDP packets.
> ---
>  lib/librte_mbuf/rte_mbuf.h    |  7 +++++++
>  lib/librte_vhost/vhost.h      |  2 ++
>  lib/librte_vhost/virtio_net.c | 10 ++++++++++
>  3 files changed, 19 insertions(+)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index ce8a05d..3d8cfc9 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -209,6 +209,13 @@ extern "C" {
>  /* add new TX flags here */
> 
>  /**
> + * UDP Fragmentation Offload flag. This flag is used for enabling UDP
> + * fragmentation in SW or in HW. When use UFO, mbuf->tso_segsz is used
> + * to store the MSS of UDP fragments.
> + */
> +#define PKT_TX_UDP_SEG	(1ULL << 42)
> +
> +/**
>   * Request security offload processing on the TX packet.
>   */
>  #define PKT_TX_SEC_OFFLOAD 		(1ULL << 43)
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> index 1cc81c1..fc109ef 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -206,10 +206,12 @@ struct vhost_msg {
>  				(1ULL <<
> VHOST_USER_F_PROTOCOL_FEATURES) | \
>  				(1ULL << VIRTIO_NET_F_HOST_TSO4) | \
>  				(1ULL << VIRTIO_NET_F_HOST_TSO6) | \
> +				(1ULL << VIRTIO_NET_F_HOST_UFO) | \
>  				(1ULL << VIRTIO_NET_F_CSUM)    | \
>  				(1ULL << VIRTIO_NET_F_GUEST_CSUM) | \
>  				(1ULL << VIRTIO_NET_F_GUEST_TSO4) | \
>  				(1ULL << VIRTIO_NET_F_GUEST_TSO6) | \
> +				(1ULL << VIRTIO_NET_F_GUEST_UFO) | \
>  				(1ULL << VIRTIO_RING_F_INDIRECT_DESC) |
> \
>  				(1ULL << VIRTIO_NET_F_MTU) | \
>  				(1ULL << VIRTIO_F_IOMMU_PLATFORM))
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 6fee16e..3a3a0ad 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -188,6 +188,11 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf,
> struct virtio_net_hdr *net_hdr)
>  		net_hdr->gso_size = m_buf->tso_segsz;
>  		net_hdr->hdr_len = m_buf->l2_len + m_buf->l3_len
>  					+ m_buf->l4_len;
> +	} else if (m_buf->ol_flags & PKT_TX_UDP_SEG) {
> +		net_hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP;
> +		net_hdr->gso_size = m_buf->tso_segsz;
> +		net_hdr->hdr_len = m_buf->l2_len + m_buf->l3_len +
> +			m_buf->l4_len;
>  	} else {
>  		ASSIGN_UNLESS_EQUAL(net_hdr->gso_type, 0);
>  		ASSIGN_UNLESS_EQUAL(net_hdr->gso_size, 0);
> @@ -834,6 +839,11 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr,
> struct rte_mbuf *m)
>  			m->tso_segsz = hdr->gso_size;
>  			m->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;
>  			break;
> +		case VIRTIO_NET_HDR_GSO_UDP:
> +			m->ol_flags |= PKT_TX_UDP_SEG;
> +			m->tso_segsz = hdr->gso_size;
> +			m->l4_len = sizeof(struct udp_hdr);
> +			break;
>  		default:
>  			RTE_LOG(WARNING, VHOST_DATA,
>  				"unsupported gso type %u.\n", hdr-
> >gso_type);
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
  2017-11-21  6:56 [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload Jiayu Hu
                   ` (3 preceding siblings ...)
  2017-12-25  1:48 ` Yao, Lei A
@ 2017-12-27 14:34 ` Yuanhan Liu
  2018-01-08 14:27 ` Yuanhan Liu
  5 siblings, 0 replies; 12+ messages in thread
From: Yuanhan Liu @ 2017-12-27 14:34 UTC (permalink / raw)
  To: Jiayu Hu, Olivier MATZ; +Cc: dev, jianfeng.tan

On Tue, Nov 21, 2017 at 02:56:52PM +0800, Jiayu Hu wrote:
> In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO
> and guest UFO. Guest UFO means the frontend can receive large UDP packets,
> and host UFO means the backend can receive large UDP packets. This patch
> supports host UFO and guest UFO for vhost-user.
> 
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> ---
>  lib/librte_mbuf/rte_mbuf.h    |  7 +++++++
>  lib/librte_vhost/vhost.h      |  2 ++
>  lib/librte_vhost/virtio_net.c | 10 ++++++++++
>  3 files changed, 19 insertions(+)
> 
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index ce8a05d..3d8cfc9 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -209,6 +209,13 @@ extern "C" {
>  /* add new TX flags here */
>  
>  /**
> + * UDP Fragmentation Offload flag. This flag is used for enabling UDP
> + * fragmentation in SW or in HW. When use UFO, mbuf->tso_segsz is used
> + * to store the MSS of UDP fragments.
> + */
> +#define PKT_TX_UDP_SEG	(1ULL << 42)

This patch added a new mbuf flag, Olivier, do you have objections?

	--yliu

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
  2017-11-21  6:56 [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload Jiayu Hu
                   ` (4 preceding siblings ...)
  2017-12-27 14:34 ` Yuanhan Liu
@ 2018-01-08 14:27 ` Yuanhan Liu
  2018-01-16 11:20   ` Thomas Monjalon
  5 siblings, 1 reply; 12+ messages in thread
From: Yuanhan Liu @ 2018-01-08 14:27 UTC (permalink / raw)
  To: Jiayu Hu; +Cc: dev, jianfeng.tan

On Tue, Nov 21, 2017 at 02:56:52PM +0800, Jiayu Hu wrote:
> In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO
> and guest UFO. Guest UFO means the frontend can receive large UDP packets,
> and host UFO means the backend can receive large UDP packets. This patch
> supports host UFO and guest UFO for vhost-user.
> 
> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>

Applied to dpdk-next-virtio.

Thanks.

	--yliu

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
  2018-01-08 14:27 ` Yuanhan Liu
@ 2018-01-16 11:20   ` Thomas Monjalon
  2018-01-16 12:21     ` Olivier Matz
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas Monjalon @ 2018-01-16 11:20 UTC (permalink / raw)
  To: Jiayu Hu, olivier.matz; +Cc: dev, Yuanhan Liu, jianfeng.tan

08/01/2018 15:27, Yuanhan Liu:
> On Tue, Nov 21, 2017 at 02:56:52PM +0800, Jiayu Hu wrote:
> > In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO
> > and guest UFO. Guest UFO means the frontend can receive large UDP packets,
> > and host UFO means the backend can receive large UDP packets. This patch
> > supports host UFO and guest UFO for vhost-user.
> > 
> > Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> 
> Applied to dpdk-next-virtio.

Olivier Matz, mbuf maintainer, was not Cc'ed in this patch.
Olivier, can you confirm this new mbuf flag is OK?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload
  2018-01-16 11:20   ` Thomas Monjalon
@ 2018-01-16 12:21     ` Olivier Matz
  0 siblings, 0 replies; 12+ messages in thread
From: Olivier Matz @ 2018-01-16 12:21 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Jiayu Hu, dev, Yuanhan Liu, jianfeng.tan

On Tue, Jan 16, 2018 at 12:20:48PM +0100, Thomas Monjalon wrote:
> 08/01/2018 15:27, Yuanhan Liu:
> > On Tue, Nov 21, 2017 at 02:56:52PM +0800, Jiayu Hu wrote:
> > > In virtio, UDP Fragmentation Offload (UFO) includes two parts: host UFO
> > > and guest UFO. Guest UFO means the frontend can receive large UDP packets,
> > > and host UFO means the backend can receive large UDP packets. This patch
> > > supports host UFO and guest UFO for vhost-user.
> > > 
> > > Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> > 
> > Applied to dpdk-next-virtio.
> 
> Olivier Matz, mbuf maintainer, was not Cc'ed in this patch.
> Olivier, can you confirm this new mbuf flag is OK?

Yuanhan CC'ed me, but I was quite busy at that time.

Even if it's to late:
Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-01-16 12:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-21  6:56 [dpdk-dev] [PATCH] vhost: support UDP Fragmentation Offload Jiayu Hu
2017-11-21  7:12 ` Stephen Hemminger
2017-11-21  7:41   ` Hu, Jiayu
2017-11-21 14:33     ` Neil Horman
2017-12-05 14:57 ` Maxime Coquelin
2017-12-06  8:36 ` Maxime Coquelin
2017-12-07 13:14   ` Hu, Jiayu
2017-12-25  1:48 ` Yao, Lei A
2017-12-27 14:34 ` Yuanhan Liu
2018-01-08 14:27 ` Yuanhan Liu
2018-01-16 11:20   ` Thomas Monjalon
2018-01-16 12:21     ` Olivier Matz

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).