From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 314BFA00E6 for ; Mon, 2 Sep 2019 08:46:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3F0871BFFE; Mon, 2 Sep 2019 08:46:10 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 6207A1BFC5; Mon, 2 Sep 2019 08:46:09 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Sep 2019 23:46:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,457,1559545200"; d="scan'208";a="265945646" Received: from dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.71]) by orsmga001.jf.intel.com with ESMTP; 01 Sep 2019 23:46:06 -0700 Date: Mon, 2 Sep 2019 14:43:40 +0800 From: Tiwei Bie To: Maxime Coquelin Cc: zhihong.wang@intel.com, amorenoz@redhat.com, xiao.w.wang@intel.com, dev@dpdk.org, jfreimann@redhat.com, stable@dpdk.org Message-ID: <20190902064340.GA15111@___> References: <20190829080000.20806-1-maxime.coquelin@redhat.com> <20190829080000.20806-9-maxime.coquelin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190829080000.20806-9-maxime.coquelin@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH 08/15] net/virtio: add virtio vDPA op to get features X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Aug 29, 2019 at 09:59:53AM +0200, Maxime Coquelin wrote: > This patch implements the vDPA .get_features() callback. > > Signed-off-by: Maxime Coquelin > --- > drivers/net/virtio/virtio_vdpa.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/drivers/net/virtio/virtio_vdpa.c b/drivers/net/virtio/virtio_vdpa.c > index 07ff1e090..9e2af8313 100644 > --- a/drivers/net/virtio/virtio_vdpa.c > +++ b/drivers/net/virtio/virtio_vdpa.c > @@ -173,8 +173,40 @@ virtio_vdpa_get_queue_num(int did, uint32_t *queue_num) > return 0; > } > > +static int > +virtio_vdpa_get_features(int did, uint64_t *features) > +{ > + struct internal_list *list; > + struct virtio_vdpa_device *dev; > + > + list = find_internal_resource_by_did(did); > + if (list == NULL) { > + DRV_LOG(ERR, "Invalid device id: %d", did); > + return -1; > + } > + > + dev = list->dev; > + > + *features = VTPCI_OPS(&dev->hw)->get_features(&dev->hw); > + > + if (!(*features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) { > + DRV_LOG(ERR, "Device does not support IOMMU"); > + return -1; > + } > + > + if (*features & (1ULL << VIRTIO_NET_F_CTRL_VQ)) > + dev->has_ctrl_vq = true; > + else > + dev->has_ctrl_vq = false; > + > + *features |= (1ULL << VHOST_USER_F_PROTOCOL_FEATURES); We need to drop the VIRTIO_F_IOMMU_PLATFORM bit before reporting features to the upper layer as the vDPA backend doesn't support the vIOMMU yet. Regards, Tiwei > + > + return 0; > +} > + > static struct rte_vdpa_dev_ops virtio_vdpa_ops = { > .get_queue_num = virtio_vdpa_get_queue_num, > + .get_features = virtio_vdpa_get_features, > }; > > static inline int > -- > 2.21.0 >