From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 04A2DA0503; Wed, 18 May 2022 15:01:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DC4EE42BA0; Wed, 18 May 2022 15:00:47 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id C4C9942BA0 for ; Wed, 18 May 2022 15:00:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652878846; x=1684414846; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=E9kVVt2fL4gabkH9b4/OD50ieIC+2mM5FYMd0NvIPNg=; b=dm8cjBZbevw7Woo6tLSQ7CCrlXeaGXHim5qrbLZVh0UUjIZIEEl8RfzW kr6H3x2od986c9zvDl9fPxsYXo6KFJ4X3iwyYN9qCNeqjS8aibiqhGVni JRIrMgued2g2gDs07Z673hNBzACni57nnHIyLOBQ9EaSELYqUlTM32KHZ T+9abWe5HUs0NpfellJD1b92tvF9jcvuQOIQx7xnU6sBuq7SeO9kyx20R hmDocND6j8r1SoqNjTMzEUvM88H/OuSK+rLCi1AhQLR8H5PLLM48JN1iz DQ7HTd9elCfd3tad9gUzN9aiSGwVtJvnqY7ZoYlXzqWLBCdTHG16gPYpX Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10350"; a="271353738" X-IronPort-AV: E=Sophos;i="5.91,234,1647327600"; d="scan'208";a="271353738" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2022 06:00:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,234,1647327600"; d="scan'208";a="556312336" Received: from dpdk-dipei.sh.intel.com ([10.67.110.238]) by orsmga002.jf.intel.com with ESMTP; 18 May 2022 06:00:42 -0700 From: Andy Pei To: dev@dpdk.org Cc: chenbo.xia@intel.com, maxime.coquelin@redhat.com, gang.cao@intel.com, changpeng.liu@intel.com, rosen.xu@intel.com, qimaix.xiao@intel.com Subject: [PATCH v8 08/13] vdpa/ifc: add get device type ops to ifc driver Date: Wed, 18 May 2022 20:13:50 +0800 Message-Id: <1652876035-70513-9-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1652876035-70513-1-git-send-email-andy.pei@intel.com> References: <1643093258-47258-2-git-send-email-andy.pei@intel.com> <1652876035-70513-1-git-send-email-andy.pei@intel.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add get device type ops to ifc driver. Signed-off-by: Andy Pei --- drivers/vdpa/ifc/ifcvf_vdpa.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 3e78c7d..0acfa8c 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -1189,6 +1189,29 @@ struct rte_vdpa_dev_info { return 0; } +static int +ifcvf_get_device_type(struct rte_vdpa_device *vdev, + uint32_t *type) +{ + struct ifcvf_internal *internal; + struct internal_list *list; + + list = find_internal_resource_by_vdev(vdev); + if (list == NULL) { + DRV_LOG(ERR, "Invalid vDPA device: %p", vdev); + return -1; + } + + internal = list->internal; + + if (internal->hw.device_type == IFCVF_BLK) + *type = VDPA_DEVICE_TYPE_BLK; + else + *type = VDPA_DEVICE_TYPE_NET; + + return 0; +} + static struct rte_vdpa_dev_ops ifcvf_ops = { .get_queue_num = ifcvf_get_queue_num, .get_features = ifcvf_get_vdpa_features, @@ -1201,6 +1224,7 @@ struct rte_vdpa_dev_info { .get_vfio_group_fd = ifcvf_get_vfio_group_fd, .get_vfio_device_fd = ifcvf_get_vfio_device_fd, .get_notify_area = ifcvf_get_notify_area, + .get_dev_type = ifcvf_get_device_type, }; static inline int @@ -1327,6 +1351,7 @@ struct rte_vdpa_dev_info { .get_vfio_device_fd = ifcvf_get_vfio_device_fd, .get_notify_area = ifcvf_get_notify_area, .get_config = ifcvf_blk_get_config, + .get_dev_type = ifcvf_get_device_type, }; struct rte_vdpa_dev_info dev_info[] = { -- 1.8.3.1