[dpdk-dev,v4,3/8] virtio/lib:add vhost TX checksum support capabilities

Message ID 1447224046-1169-4-git-send-email-jijiang.liu@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Jijiang Liu Nov. 11, 2015, 6:40 a.m. UTC
  Add vhost TX offload(CSUM and TSO) support capabilities.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
---
 lib/librte_vhost/virtio-net.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
  

Comments

Yuanhan Liu Nov. 11, 2015, 8:26 a.m. UTC | #1
On Wed, Nov 11, 2015 at 02:40:41PM +0800, Jijiang Liu wrote:
> Add vhost TX offload(CSUM and TSO) support capabilities.

Claiming first that we support something, and then actually implementing
in a later patch is wrong, as at this stage, we actually does not support
that, hence, the functionality is broken.

	--yliu

> 
> Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
> ---
>  lib/librte_vhost/virtio-net.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
> index 14278de..81bd309 100644
> --- a/lib/librte_vhost/virtio-net.c
> +++ b/lib/librte_vhost/virtio-net.c
> @@ -77,7 +77,11 @@ static struct virtio_net_config_ll *ll_root;
>  				(VHOST_SUPPORTS_MQ)            | \
>  				(1ULL << VIRTIO_F_VERSION_1)   | \
>  				(1ULL << VHOST_F_LOG_ALL)      | \
> -				(1ULL << VHOST_USER_F_PROTOCOL_FEATURES))
> +				(1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
> +				(1ULL << VIRTIO_NET_F_HOST_TSO4) | \
> +				(1ULL << VIRTIO_NET_F_HOST_TSO6) | \
> +				(1ULL << VIRTIO_NET_F_CSUM))
> +
>  static uint64_t VHOST_FEATURES = VHOST_SUPPORTED_FEATURES;
>  
>  
> -- 
> 1.7.7.6
  
Stephen Hemminger Nov. 11, 2015, 5:31 p.m. UTC | #2
On Wed, 11 Nov 2015 16:26:57 +0800
Yuanhan Liu <yuanhan.liu@linux.intel.com> wrote:

> On Wed, Nov 11, 2015 at 02:40:41PM +0800, Jijiang Liu wrote:
> > Add vhost TX offload(CSUM and TSO) support capabilities.
> 
> Claiming first that we support something, and then actually implementing
> in a later patch is wrong, as at this stage, we actually does not support
> that, hence, the functionality is broken.
> 
> 	--yliu

Actually in this case it is okay to claim that driver "might" use offload
cabability but never do it. But agree in general better to keep both together.
  
Yuanhan Liu Nov. 12, 2015, 1:41 a.m. UTC | #3
On Wed, Nov 11, 2015 at 09:31:14AM -0800, Stephen Hemminger wrote:
> On Wed, 11 Nov 2015 16:26:57 +0800
> Yuanhan Liu <yuanhan.liu@linux.intel.com> wrote:
> 
> > On Wed, Nov 11, 2015 at 02:40:41PM +0800, Jijiang Liu wrote:
> > > Add vhost TX offload(CSUM and TSO) support capabilities.
> > 
> > Claiming first that we support something, and then actually implementing
> > in a later patch is wrong, as at this stage, we actually does not support
> > that, hence, the functionality is broken.
> > 
> > 	--yliu
> 
> Actually in this case it is okay to claim that driver "might" use offload
> cabability but never do it.

But it will not work once it does use it, right?

	--yliu

> But agree in general better to keep both together.
  

Patch

diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index 14278de..81bd309 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -77,7 +77,11 @@  static struct virtio_net_config_ll *ll_root;
 				(VHOST_SUPPORTS_MQ)            | \
 				(1ULL << VIRTIO_F_VERSION_1)   | \
 				(1ULL << VHOST_F_LOG_ALL)      | \
-				(1ULL << VHOST_USER_F_PROTOCOL_FEATURES))
+				(1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
+				(1ULL << VIRTIO_NET_F_HOST_TSO4) | \
+				(1ULL << VIRTIO_NET_F_HOST_TSO6) | \
+				(1ULL << VIRTIO_NET_F_CSUM))
+
 static uint64_t VHOST_FEATURES = VHOST_SUPPORTED_FEATURES;