DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: support Generic Segmentation Offload
@ 2017-11-28  5:28 Jiayu Hu
  2017-12-06  8:33 ` Maxime Coquelin
  2017-12-25  1:53 ` Yao, Lei A
  0 siblings, 2 replies; 5+ messages in thread
From: Jiayu Hu @ 2017-11-28  5:28 UTC (permalink / raw)
  To: dev; +Cc: yliu, jianfeng.tan, Jiayu Hu

In virtio, Generic Segmentation Offload (GSO) is the feature for the
backend, which means the backend can receive packets with any GSO
type.

Virtio-net enables the GSO feature by default, and vhost-net supports it.
To make live migration from vhost-net to vhost-user possible, this patch
enables GSO for vhost-user.

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
---
 lib/librte_vhost/vhost.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
index 1cc81c1..04f54cb 100644
--- a/lib/librte_vhost/vhost.h
+++ b/lib/librte_vhost/vhost.h
@@ -204,6 +204,7 @@ struct vhost_msg {
 				(1ULL << VIRTIO_F_VERSION_1)   | \
 				(1ULL << VHOST_F_LOG_ALL)      | \
 				(1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
+				(1ULL << VIRTIO_NET_F_GSO) | \
 				(1ULL << VIRTIO_NET_F_HOST_TSO4) | \
 				(1ULL << VIRTIO_NET_F_HOST_TSO6) | \
 				(1ULL << VIRTIO_NET_F_CSUM)    | \
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH] vhost: support Generic Segmentation Offload
  2017-11-28  5:28 [dpdk-dev] [PATCH] vhost: support Generic Segmentation Offload Jiayu Hu
@ 2017-12-06  8:33 ` Maxime Coquelin
  2017-12-07  6:30   ` Hu, Jiayu
  2017-12-25  1:53 ` Yao, Lei A
  1 sibling, 1 reply; 5+ messages in thread
From: Maxime Coquelin @ 2017-12-06  8:33 UTC (permalink / raw)
  To: Jiayu Hu, dev; +Cc: yliu, jianfeng.tan

Hi Jiayu,

On 11/28/2017 06:28 AM, Jiayu Hu wrote:
> In virtio, Generic Segmentation Offload (GSO) is the feature for the
> backend, which means the backend can receive packets with any GSO
> type.
> 
> Virtio-net enables the GSO feature by default, and vhost-net supports it.
> To make live migration from vhost-net to vhost-user possible, this patch
> enables GSO for vhost-user.

Please note that the application relying on Vhost library may disable
some features, breaking the migration from vhost-net to vhost-user even
if all features are supported in the vhost-user lib.

For example, ovs-dpdk disables the following features:
     err = rte_vhost_driver_disable_features(dev->vhost_id,
                                 1ULL << VIRTIO_NET_F_HOST_TSO4
                                 | 1ULL << VIRTIO_NET_F_HOST_TSO6
                                 | 1ULL << VIRTIO_NET_F_CSUM);


> Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> ---
>   lib/librte_vhost/vhost.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> index 1cc81c1..04f54cb 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -204,6 +204,7 @@ struct vhost_msg {
>   				(1ULL << VIRTIO_F_VERSION_1)   | \
>   				(1ULL << VHOST_F_LOG_ALL)      | \
>   				(1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
> +				(1ULL << VIRTIO_NET_F_GSO) | \

This feature is also enabled by default in QEMU, and seems also to be
acked by default in the virtio-net kernel driver.

Does it have an impact on performance? Be it good or bad.

How to test it?

>   				(1ULL << VIRTIO_NET_F_HOST_TSO4) | \
>   				(1ULL << VIRTIO_NET_F_HOST_TSO6) | \
>   				(1ULL << VIRTIO_NET_F_CSUM)    | \
> 

Thanks,
Maxime

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

* Re: [dpdk-dev] [PATCH] vhost: support Generic Segmentation Offload
  2017-12-06  8:33 ` Maxime Coquelin
@ 2017-12-07  6:30   ` Hu, Jiayu
  0 siblings, 0 replies; 5+ messages in thread
From: Hu, Jiayu @ 2017-12-07  6:30 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:34 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 Generic Segmentation
> Offload
> 
> Hi Jiayu,
> 
> On 11/28/2017 06:28 AM, Jiayu Hu wrote:
> > In virtio, Generic Segmentation Offload (GSO) is the feature for the
> > backend, which means the backend can receive packets with any GSO
> > type.
> >
> > Virtio-net enables the GSO feature by default, and vhost-net supports it.
> > To make live migration from vhost-net to vhost-user possible, this patch
> > enables GSO for vhost-user.
> 
> Please note that the application relying on Vhost library may disable
> some features, breaking the migration from vhost-net to vhost-user even
> if all features are supported in the vhost-user lib.
> 
> For example, ovs-dpdk disables the following features:
>      err = rte_vhost_driver_disable_features(dev->vhost_id,
>                                  1ULL << VIRTIO_NET_F_HOST_TSO4
>                                  | 1ULL << VIRTIO_NET_F_HOST_TSO6
>                                  | 1ULL << VIRTIO_NET_F_CSUM);
> 
> 
> > Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> > ---
> >   lib/librte_vhost/vhost.h | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> > index 1cc81c1..04f54cb 100644
> > --- a/lib/librte_vhost/vhost.h
> > +++ b/lib/librte_vhost/vhost.h
> > @@ -204,6 +204,7 @@ struct vhost_msg {
> >   				(1ULL << VIRTIO_F_VERSION_1)   | \
> >   				(1ULL << VHOST_F_LOG_ALL)      | \
> >   				(1ULL <<
> VHOST_USER_F_PROTOCOL_FEATURES) | \
> > +				(1ULL << VIRTIO_NET_F_GSO) | \
> 
> This feature is also enabled by default in QEMU, and seems also to be
> acked by default in the virtio-net kernel driver.
> 
> Does it have an impact on performance? Be it good or bad.
> 
> How to test it?

VIRTIO_NET_F_GSO is the combination of all backend GSO types, like
VIRTIO_NET_F_HOST_UFO and VIRTIO_NET_F_HOST_ECN. Supporting
VIRTIO_NET_F_GSO equals to supporting all backend GSO types.

In the virtio-net driver, VIRTIO_NET_F_GSO influences the offloading abilities of
virtio-net devices. When VIRTIO_NET_F_GSO is negotiated, the virtio-net device has
TSO(_ECN) and UFO turned on by default. It equals to enabling "host_ufo", "host_tso4/6"
and "host_ecn".
 
About the performance, when VIRTIO_NET_F_GSO is enabled, the device
can send large TCP/UDP packets (exceeding MTU) to the backend. Large packets
can reduce the per-packet overhead. Therefore, I think it's good for performance.

We can test this feature with the following configuration:
Environment:
- one server with two physical interfaces (p1 and p2).
- p1 and p2 are connected physically. p1 is assigned to DPDK and p2 is to kernel.

Steps:
- launch testpmd with p1 and one vhost-user port
- launching qemu with command "gso=on, csum=on". In the VM, you can see
  TSO_ECN and UFO of the virtio-net port are enabled by default.
- Run "iperf -u -s ..." on p2
- run "iperf -u -c ... -l 7000B" in the VM. Therefore, iperf client will send large
   UDP packets
- "show port xstats all" in testpmd. You can see the vhost-user port receives
   large UDP packets from the frontend.

You can also use the above steps to test the vhost-user host_ufo feature.

Thanks,
Jiayu
> 
> >   				(1ULL << VIRTIO_NET_F_HOST_TSO4) | \
> >   				(1ULL << VIRTIO_NET_F_HOST_TSO6) | \
> >   				(1ULL << VIRTIO_NET_F_CSUM)    | \
> >
> 
> Thanks,
> Maxime

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

* Re: [dpdk-dev] [PATCH] vhost: support Generic Segmentation Offload
  2017-11-28  5:28 [dpdk-dev] [PATCH] vhost: support Generic Segmentation Offload Jiayu Hu
  2017-12-06  8:33 ` Maxime Coquelin
@ 2017-12-25  1:53 ` Yao, Lei A
  2017-12-27 14:39   ` Yuanhan Liu
  1 sibling, 1 reply; 5+ messages in thread
From: Yao, Lei A @ 2017-12-25  1:53 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 28, 2017 1:29 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 Generic Segmentation Offload
> 
> In virtio, Generic Segmentation Offload (GSO) is the feature for the
> backend, which means the backend can receive packets with any GSO
> type.
> 
> Virtio-net enables the GSO feature by default, and vhost-net supports it.
> To make live migration from vhost-net to vhost-user possible, this patch
> enables GSO 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, after add csum=on, gso=on to qemu cmdline,
Following offload are active in vm:
udp-fragmentation-offload: on
tx-tcp-segmentation: on
 tx-tcp-ecn-segmentation: on
 tx-tcp6-segmentation: on

> ---
>  lib/librte_vhost/vhost.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> index 1cc81c1..04f54cb 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -204,6 +204,7 @@ struct vhost_msg {
>  				(1ULL << VIRTIO_F_VERSION_1)   | \
>  				(1ULL << VHOST_F_LOG_ALL)      | \
>  				(1ULL <<
> VHOST_USER_F_PROTOCOL_FEATURES) | \
> +				(1ULL << VIRTIO_NET_F_GSO) | \
>  				(1ULL << VIRTIO_NET_F_HOST_TSO4) | \
>  				(1ULL << VIRTIO_NET_F_HOST_TSO6) | \
>  				(1ULL << VIRTIO_NET_F_CSUM)    | \
> --
> 2.7.4

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

* Re: [dpdk-dev] [PATCH] vhost: support Generic Segmentation Offload
  2017-12-25  1:53 ` Yao, Lei A
@ 2017-12-27 14:39   ` Yuanhan Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Yuanhan Liu @ 2017-12-27 14:39 UTC (permalink / raw)
  To: Yao, Lei A; +Cc: Hu, Jiayu, dev, Tan, Jianfeng

On Mon, Dec 25, 2017 at 01:53:29AM +0000, Yao, Lei A wrote:
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jiayu Hu
> > Sent: Tuesday, November 28, 2017 1:29 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 Generic Segmentation Offload
> > 
> > In virtio, Generic Segmentation Offload (GSO) is the feature for the
> > backend, which means the backend can receive packets with any GSO
> > type.
> > 
> > Virtio-net enables the GSO feature by default, and vhost-net supports it.
> > To make live migration from vhost-net to vhost-user possible, this patch
> > enables GSO for vhost-user.
> > 
> > Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
> Tested-by: Lei Yao<lei.a.yao@intel.com>

Applied to dpdk-next-virtio.

Thanks.

	--yliu

> This patch has been tested on my server, after add csum=on, gso=on to qemu cmdline,
> Following offload are active in vm:
> udp-fragmentation-offload: on
> tx-tcp-segmentation: on
>  tx-tcp-ecn-segmentation: on
>  tx-tcp6-segmentation: on
> 
> > ---
> >  lib/librte_vhost/vhost.h | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> > index 1cc81c1..04f54cb 100644
> > --- a/lib/librte_vhost/vhost.h
> > +++ b/lib/librte_vhost/vhost.h
> > @@ -204,6 +204,7 @@ struct vhost_msg {
> >  				(1ULL << VIRTIO_F_VERSION_1)   | \
> >  				(1ULL << VHOST_F_LOG_ALL)      | \
> >  				(1ULL <<
> > VHOST_USER_F_PROTOCOL_FEATURES) | \
> > +				(1ULL << VIRTIO_NET_F_GSO) | \
> >  				(1ULL << VIRTIO_NET_F_HOST_TSO4) | \
> >  				(1ULL << VIRTIO_NET_F_HOST_TSO6) | \
> >  				(1ULL << VIRTIO_NET_F_CSUM)    | \
> > --
> > 2.7.4

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

end of thread, other threads:[~2017-12-27 14:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28  5:28 [dpdk-dev] [PATCH] vhost: support Generic Segmentation Offload Jiayu Hu
2017-12-06  8:33 ` Maxime Coquelin
2017-12-07  6:30   ` Hu, Jiayu
2017-12-25  1:53 ` Yao, Lei A
2017-12-27 14:39   ` Yuanhan Liu

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