From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yuanhan.liu@linux.intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id A0C5F36E
 for <dev@dpdk.org>; Thu, 16 Mar 2017 08:44:56 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=intel;
 t=1489650297; x=1521186297;
 h=date:from:to:cc:subject:message-id:references:
 mime-version:in-reply-to;
 bh=TRYTvHN9ozVgaauARJr7IlIakSekwLt5L6btTxvhG9g=;
 b=sXx8bgIssFhhafFtfLyvAcOtdTMS526eBpcqRt327N85DDCLtuDY9zNI
 e+GswCNBvN8B81QjHQer36l0hodHTA==;
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 16 Mar 2017 00:44:54 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.36,170,1486454400"; d="scan'208";a="236826624"
Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162])
 by fmsmga004.fm.intel.com with ESMTP; 16 Mar 2017 00:44:53 -0700
Date: Thu, 16 Mar 2017 15:43:11 +0800
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: dev@dpdk.org, Harris James R <james.r.harris@intel.com>,
 Liu Changpeng <changpeng.liu@intel.com>
Message-ID: <20170316074311.GR18844@yliu-dev.sh.intel.com>
References: <1488534682-3494-1-git-send-email-yuanhan.liu@linux.intel.com>
 <1488534682-3494-4-git-send-email-yuanhan.liu@linux.intel.com>
 <b9b581b0-efd1-51a0-e3f7-4fec7460ea50@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <b9b581b0-efd1-51a0-e3f7-4fec7460ea50@redhat.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
Subject: Re: [dpdk-dev] [PATCH 03/17] vhost: use new APIs to handle features
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 16 Mar 2017 07:44:57 -0000

On Tue, Mar 14, 2017 at 11:43:44AM +0100, Maxime Coquelin wrote:
> >diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> >index 8433a54..f7227bf 100644
> >--- a/lib/librte_vhost/vhost_user.c
> >+++ b/lib/librte_vhost/vhost_user.c
> >@@ -143,9 +143,9 @@
> >  * The features that we support are requested.
> >  */
> > static uint64_t
> >-vhost_user_get_features(void)
> >+vhost_user_get_features(struct virtio_net *dev)
> > {
> >-	return VHOST_FEATURES;
> >+	return rte_vhost_driver_get_features(dev->ifname);
> > }
> >
> > /*
> >@@ -154,7 +154,7 @@
> > static int
> > vhost_user_set_features(struct virtio_net *dev, uint64_t features)
> > {
> >-	if (features & ~VHOST_FEATURES)
> >+	if (features & ~rte_vhost_driver_get_features(dev->ifname))
> 
> rte_vhost_driver_get_features() returns -1 if the socket is not found.
> It would result in accepting any feature trying to be set.

If we have gone here, I think rte_vhost_driver_get_features() should not
return -1. The only exception is user unregistered such socket during
the negotiation?

	--yliu