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 D54C8A2EFC for ; Tue, 17 Sep 2019 11:24:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 60A5A1C08D; Tue, 17 Sep 2019 11:23:59 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 1A6C41C07C for ; Tue, 17 Sep 2019 11:23:57 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Sep 2019 02:23:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,515,1559545200"; d="scan'208";a="387501561" Received: from dpdk-dipei.sh.intel.com ([10.67.110.224]) by fmsmga006.fm.intel.com with ESMTP; 17 Sep 2019 02:23:56 -0700 From: Andy Pei To: dev@dpdk.org Cc: rosen.xu@intel.com, xiaolong.ye@intel.com, tiwei.bie@intel.com, xiao.w.wang@intel.com Date: Tue, 17 Sep 2019 17:09:48 +0800 Message-Id: <1568711388-257817-3-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568711388-257817-1-git-send-email-andy.pei@intel.com> References: <1568711388-257817-1-git-send-email-andy.pei@intel.com> Subject: [dpdk-dev] [PATCH v2 3/3] net/ifcvf: enable mutliqueue support 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" Enable mutliqueue support for ifcvf devices by setting the mutliqueue configuration space. Signed-off-by: Xiaolong Ye Signed-off-by: Andy Pei --- drivers/net/ifc/base/ifcvf.c | 8 ++++++++ drivers/net/ifc/base/ifcvf.h | 5 ++++- drivers/net/ifc/ifcvf_vdpa.c | 30 ++++++++++++++++++++++++++++-- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/drivers/net/ifc/base/ifcvf.c b/drivers/net/ifc/base/ifcvf.c index 6462281..ac09537 100644 --- a/drivers/net/ifc/base/ifcvf.c +++ b/drivers/net/ifc/base/ifcvf.c @@ -310,6 +310,14 @@ *(u32 *)(lm_cfg + IFCVF_LM_LOGGING_CTRL) = IFCVF_LM_DISABLE; } +void ifcvf_enable_multiqueue(struct ifcvf_hw *hw, u16 nr_queue_pair) +{ + u8 *mq_cfg; + + mq_cfg = hw->mq_cfg; + *(u32 *)mq_cfg = nr_queue_pair; +} + void ifcvf_notify_queue(struct ifcvf_hw *hw, u16 qid) { diff --git a/drivers/net/ifc/base/ifcvf.h b/drivers/net/ifc/base/ifcvf.h index a4cb1a4..3eb0bf3 100644 --- a/drivers/net/ifc/base/ifcvf.h +++ b/drivers/net/ifc/base/ifcvf.h @@ -12,7 +12,7 @@ #define IFCVF_SUBSYS_VENDOR_ID 0x8086 #define IFCVF_SUBSYS_DEVICE_ID 0x001A -#define IFCVF_MAX_QUEUES 1 +#define IFCVF_MAX_QUEUES 32 #define VIRTIO_F_IOMMU_PLATFORM 33 /* Common configuration */ @@ -153,6 +153,9 @@ struct ifcvf_hw { ifcvf_disable_logging(struct ifcvf_hw *hw); void +ifcvf_enable_multiqueue(struct ifcvf_hw *hw, u16 nr_queue_pair); + +void ifcvf_notify_queue(struct ifcvf_hw *hw, u16 qid); u8 diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c index 8de9ef1..b3f71c4 100644 --- a/drivers/net/ifc/ifcvf_vdpa.c +++ b/drivers/net/ifc/ifcvf_vdpa.c @@ -994,6 +994,30 @@ struct internal_list { } static int +ifcvf_set_vring_state(int vid, int nr_active_vring) +{ + int did, nr_queue_pair; + struct internal_list *list; + + if (nr_active_vring == 0) { + DRV_LOG(ERR, "No enabled vring"); + return -1; + } + nr_queue_pair = (nr_active_vring + 1) / 2; + + did = rte_vhost_get_vdpa_device_id(vid); + list = find_internal_resource_by_did(did); + if (list == NULL) { + DRV_LOG(ERR, "Invalid device id: %d", did); + return -1; + } + + ifcvf_enable_multiqueue(&list->internal->hw, nr_queue_pair); + + return 0; +} + +static int ifcvf_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size) { int did; @@ -1062,7 +1086,9 @@ struct internal_list { 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ | \ 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD | \ 1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER | \ - 1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD) + 1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD | \ + 1ULL << VHOST_USER_PROTOCOL_F_MQ) + static int ifcvf_get_protocol_features(int did __rte_unused, uint64_t *features) { @@ -1076,7 +1102,7 @@ struct internal_list { .get_protocol_features = ifcvf_get_protocol_features, .dev_conf = ifcvf_dev_config, .dev_close = ifcvf_dev_close, - .set_vring_state = NULL, + .set_vring_state = ifcvf_set_vring_state, .set_features = ifcvf_set_features, .migration_done = NULL, .get_vfio_group_fd = ifcvf_get_vfio_group_fd, -- 1.8.3.1