From patchwork Thu Jun 28 03:19:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "John Daley (johndale)" X-Patchwork-Id: 41773 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 59AA91B05A; Thu, 28 Jun 2018 05:20:48 +0200 (CEST) Received: from rcdn-iport-1.cisco.com (rcdn-iport-1.cisco.com [173.37.86.72]) by dpdk.org (Postfix) with ESMTP id 321061B000 for ; Thu, 28 Jun 2018 05:20:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3734; q=dns/txt; s=iport; t=1530156047; x=1531365647; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=SGfGJDEmX6ucf0xzKaYwyLNvkxD9cNDYr5Gj2IzsEng=; b=Bf86RWcvmKPKwIfaRgyh0LZ6GNlWWMNrW3urDinyJBshNErOkdEAtgFZ D3ZZXjNKkmyUupYSlFqybO5vTKcvpni5I/uBNvpa31AMDHJ/o3i4P2zgh oT0XnfrHk8B6vn74LVSa5OPuiYfD6J/joWamRQYlZUqtYNrlyuoRikT/y s=; X-IronPort-AV: E=Sophos;i="5.51,281,1526342400"; d="scan'208";a="416306956" Received: from rcdn-core-11.cisco.com ([173.37.93.147]) by rcdn-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2018 03:20:46 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-11.cisco.com (8.14.5/8.14.5) with ESMTP id w5S3KkZW029203; Thu, 28 Jun 2018 03:20:46 GMT Received: by cisco.com (Postfix, from userid 392789) id 0855120F2001; Wed, 27 Jun 2018 20:20:46 -0700 (PDT) From: John Daley To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Hyong Youb Kim Date: Wed, 27 Jun 2018 20:19:29 -0700 Message-Id: <20180628031940.17397-3-johndale@cisco.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180628031940.17397-1-johndale@cisco.com> References: <20180628031940.17397-1-johndale@cisco.com> Subject: [dpdk-dev] [PATCH 03/14] net/enic: do not overwrite admin Tx queue limit 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" From: Hyong Youb Kim Currently, enic_alloc_wq (via rte_eth_tx_queue_setup) may overwrite the admin limit with a lower value. This is wrong as seen in the following sequence. 1. UCS admin-set Tx queue limit (config.wq_desc_count) = 4096 2. Set up tx queue with 512 descriptors The admin limit (config.wq_desc_count) becomes 512. 3. Stop ports and now set up Tx queue with 1024 descriptors. This fails because 1024 is greater than the admin limit (512). Do not modify the admin limit, and when queried, report the current number of descriptors instead of the admin limit. The rx queue setup (enic_alloc_rq) does not this problem. Fixes: fefed3d1e62c ("enic: new driver") Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- drivers/net/enic/enic_ethdev.c | 5 +++-- drivers/net/enic/enic_main.c | 30 ++++++++++++++---------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 286308924..6ebad8d96 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -731,13 +731,14 @@ static void enicpmd_dev_rxq_info_get(struct rte_eth_dev *dev, } static void enicpmd_dev_txq_info_get(struct rte_eth_dev *dev, - __rte_unused uint16_t tx_queue_id, + uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo) { struct enic *enic = pmd_priv(dev); + struct vnic_wq *wq = &enic->wq[tx_queue_id]; ENICPMD_FUNC_TRACE(); - qinfo->nb_desc = enic->config.wq_desc_count; + qinfo->nb_desc = wq->ring.desc_count; memset(&qinfo->conf, 0, sizeof(qinfo->conf)); qinfo->conf.offloads = enic->tx_offload_capa; /* tx_thresh, and all the other fields are not applicable for enic */ diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 899603fa7..aba2ff5a7 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -869,25 +869,23 @@ int enic_alloc_wq(struct enic *enic, uint16_t queue_idx, static int instance; wq->socket_id = socket_id; - if (nb_desc) { - if (nb_desc > enic->config.wq_desc_count) { - dev_warning(enic, - "WQ %d - number of tx desc in cmd line (%d)"\ - "is greater than that in the UCSM/CIMC adapter"\ - "policy. Applying the value in the adapter "\ - "policy (%d)\n", - queue_idx, nb_desc, enic->config.wq_desc_count); - } else if (nb_desc != enic->config.wq_desc_count) { - enic->config.wq_desc_count = nb_desc; - dev_info(enic, - "TX Queues - effective number of descs:%d\n", - nb_desc); - } + if (nb_desc > enic->config.wq_desc_count) { + dev_warning(enic, + "WQ %d - number of tx desc in cmd line (%d) " + "is greater than that in the UCSM/CIMC adapter " + "policy. Applying the value in the adapter " + "policy (%d)\n", + queue_idx, nb_desc, enic->config.wq_desc_count); + nb_desc = enic->config.wq_desc_count; + } else if (nb_desc != enic->config.wq_desc_count) { + dev_info(enic, + "TX Queues - effective number of descs:%d\n", + nb_desc); } /* Allocate queue resources */ err = vnic_wq_alloc(enic->vdev, &enic->wq[queue_idx], queue_idx, - enic->config.wq_desc_count, + nb_desc, sizeof(struct wq_enet_desc)); if (err) { dev_err(enic, "error in allocation of wq\n"); @@ -895,7 +893,7 @@ int enic_alloc_wq(struct enic *enic, uint16_t queue_idx, } err = vnic_cq_alloc(enic->vdev, &enic->cq[cq_index], cq_index, - socket_id, enic->config.wq_desc_count, + socket_id, nb_desc, sizeof(struct cq_enet_wq_desc)); if (err) { vnic_wq_free(wq);