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 1A038A04FF; Tue, 24 May 2022 05:36:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 049F342B7F; Tue, 24 May 2022 05:35:46 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 3AE8342B7A for ; Tue, 24 May 2022 05:35:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653363344; x=1684899344; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=EBPfx3LVHhAxsh8f83KDraPWghNdi4wlu0FOqf3a6XI=; b=hyGplbK972bvv2/MXfpgyD/iAeUxnnoXbrxyGn94rMU+ow0h/kVRepz0 NXRmLN4ZEE03/LRJLmsc8d9Zs9BmS+jqHwfm63KlXSrDttgvg3O1Y82qJ re3R5QNNw6H7p8sfY4Eo2TIIM6kUg96tQ+oUjEz5NbyTTezX8PZBiaaBN f1gfsCz0PKvezJeQxzvycyHmhbW2SOptp3H5ASNc150Ho8yiBdQ9Ke7YS 2vDQ8LJO/dduYIYIxtU+1RHJL6EtTaQoZc/tgYR2/YAhIYQSdf/DzONJ7 hrXgNDAp1qFW1/y58671DICMlmrq6posytK7AUEYUAxxVnE0qyJjoSQ9O w==; X-IronPort-AV: E=McAfee;i="6400,9594,10356"; a="273533631" X-IronPort-AV: E=Sophos;i="5.91,247,1647327600"; d="scan'208";a="273533631" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2022 20:35:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,247,1647327600"; d="scan'208";a="745047007" Received: from dpdk-dipei.sh.intel.com ([10.67.110.238]) by orsmga005.jf.intel.com with ESMTP; 23 May 2022 20:35: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 v10 08/13] vdpa/ifc: add get device type ops to ifc driver Date: Tue, 24 May 2022 10:48:12 +0800 Message-Id: <1653360497-18080-9-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1653360497-18080-1-git-send-email-andy.pei@intel.com> References: <1643093258-47258-2-git-send-email-andy.pei@intel.com> <1653360497-18080-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 Reviewed-by: Chenbo Xia --- 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 0f9db8a..f4c6198 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 = RTE_VHOST_VDPA_DEVICE_TYPE_BLK; + else + *type = RTE_VHOST_VDPA_DEVICE_TYPE_NET; + + return 0; +} + static struct rte_vdpa_dev_ops ifcvf_net_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 @@ -1332,6 +1356,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