From patchwork Sun Oct 18 10:34:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xu, Ting" X-Patchwork-Id: 81249 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 75015A04B0; Sun, 18 Oct 2020 12:46:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9BB72D01D; Sun, 18 Oct 2020 12:45:01 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id C46B2CFB9 for ; Sun, 18 Oct 2020 12:44:54 +0200 (CEST) IronPort-SDR: I8FzvzzwZwDF36TD0sRM7hIAhlsckMIc/TncpFRU+z65VDOjyps4sVimMH9GNR8h+1GVsuvZmd 8PC6/L7l2Jzg== X-IronPort-AV: E=McAfee;i="6000,8403,9777"; a="153826031" X-IronPort-AV: E=Sophos;i="5.77,390,1596524400"; d="scan'208";a="153826031" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2020 03:44:52 -0700 IronPort-SDR: wrJoUZ47keIIRcmXMl1tq9UAELgxEr2W8VVRfIUF8JZKwLLYyuU6Law8HOGgeh1Szh8xft1bls DGWS6XXuJPmA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,390,1596524400"; d="scan'208";a="347087275" Received: from dpdk-xuting-second.sh.intel.com ([10.67.116.154]) by fmsmga004.fm.intel.com with ESMTP; 18 Oct 2020 03:44:51 -0700 From: Ting Xu To: dev@dpdk.org Cc: qi.z.zhang@intel.com, beilei.xing@intel.com, jingjing.wu@intel.com, Ting Xu Date: Sun, 18 Oct 2020 18:34:28 +0800 Message-Id: <20201018103430.30997-5-ting.xu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201018103430.30997-1-ting.xu@intel.com> References: <20200909072028.16726-1-ting.xu@intel.com> <20201018103430.30997-1-ting.xu@intel.com> Subject: [dpdk-dev] [PATCH v7 4/6] net/iavf: enable multiple queues configurations for large VF 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" Since the adminq buffer size has a 4K limitation, the current virtchnl command VIRTCHNL_OP_CONFIG_VSI_QUEUES cannot send the message only once to configure up to 256 queues. In this patch, we send the messages multiple times to make sure that the buffer size is less than 4K each time. Signed-off-by: Ting Xu --- drivers/net/iavf/iavf.h | 4 +++- drivers/net/iavf/iavf_ethdev.c | 18 +++++++++++++++++- drivers/net/iavf/iavf_vchnl.c | 11 ++++++----- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 49ccfeece..1cdac1b10 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -21,6 +21,7 @@ #define IAVF_MAX_NUM_QUEUES_DFLT 16 #define IAVF_MAX_NUM_QUEUES_LV 256 +#define IAVF_CFG_Q_NUM_PER_BUF 32 #define IAVF_NUM_MACADDR_MAX 64 @@ -269,7 +270,8 @@ int iavf_enable_queues(struct iavf_adapter *adapter); int iavf_disable_queues(struct iavf_adapter *adapter); int iavf_configure_rss_lut(struct iavf_adapter *adapter); int iavf_configure_rss_key(struct iavf_adapter *adapter); -int iavf_configure_queues(struct iavf_adapter *adapter); +int iavf_configure_queues(struct iavf_adapter *adapter, + uint16_t num_queue_pairs, uint16_t index); int iavf_get_supported_rxdid(struct iavf_adapter *adapter); int iavf_config_irq_map(struct iavf_adapter *adapter); void iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add); diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index f41be2b7d..db334b390 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -550,6 +550,8 @@ iavf_dev_start(struct rte_eth_dev *dev) IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct rte_intr_handle *intr_handle = dev->intr_handle; + uint16_t num_queue_pairs; + uint16_t index = 0; PMD_INIT_FUNC_TRACE(); @@ -558,13 +560,27 @@ iavf_dev_start(struct rte_eth_dev *dev) vf->max_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len; vf->num_queue_pairs = RTE_MAX(dev->data->nb_rx_queues, dev->data->nb_tx_queues); + num_queue_pairs = vf->num_queue_pairs; if (iavf_init_queues(dev) != 0) { PMD_DRV_LOG(ERR, "failed to do Queue init"); return -1; } - if (iavf_configure_queues(adapter) != 0) { + /* If needed, send configure queues msg multiple times to make the + * adminq buffer length smaller than the 4K limitation. + */ + while (num_queue_pairs > IAVF_CFG_Q_NUM_PER_BUF) { + if (iavf_configure_queues(adapter, + IAVF_CFG_Q_NUM_PER_BUF, index) != 0) { + PMD_DRV_LOG(ERR, "configure queues failed"); + goto err_queue; + } + num_queue_pairs -= IAVF_CFG_Q_NUM_PER_BUF; + index += IAVF_CFG_Q_NUM_PER_BUF; + } + + if (iavf_configure_queues(adapter, num_queue_pairs, index) != 0) { PMD_DRV_LOG(ERR, "configure queues failed"); goto err_queue; } diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index e939b275a..829963434 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -673,7 +673,8 @@ iavf_configure_rss_key(struct iavf_adapter *adapter) } int -iavf_configure_queues(struct iavf_adapter *adapter) +iavf_configure_queues(struct iavf_adapter *adapter, + uint16_t num_queue_pairs, uint16_t index) { struct iavf_rx_queue **rxq = (struct iavf_rx_queue **)adapter->eth_dev->data->rx_queues; @@ -687,16 +688,16 @@ iavf_configure_queues(struct iavf_adapter *adapter) int err; size = sizeof(*vc_config) + - sizeof(vc_config->qpair[0]) * vf->num_queue_pairs; + sizeof(vc_config->qpair[0]) * num_queue_pairs; vc_config = rte_zmalloc("cfg_queue", size, 0); if (!vc_config) return -ENOMEM; vc_config->vsi_id = vf->vsi_res->vsi_id; - vc_config->num_queue_pairs = vf->num_queue_pairs; + vc_config->num_queue_pairs = num_queue_pairs; - for (i = 0, vc_qp = vc_config->qpair; - i < vf->num_queue_pairs; + for (i = index, vc_qp = vc_config->qpair; + i < index + num_queue_pairs; i++, vc_qp++) { vc_qp->txq.vsi_id = vf->vsi_res->vsi_id; vc_qp->txq.queue_id = i;