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 7E640A3160 for ; Thu, 10 Oct 2019 03:42:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 741781DFEB; Thu, 10 Oct 2019 03:42:03 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id D2F8A1DFEB; Thu, 10 Oct 2019 03:42:00 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id E90AC30C144; Wed, 9 Oct 2019 18:40:24 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com E90AC30C144 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1570671624; bh=dnbgXNkTTK7Z4+ua4OGz7Gbq31+CJCygkXAYtD26ewk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aXuAYQ1mOIMLYYGeOPTRH5HXeLP8+A6PqiPop7MXgbDwyVIKMWbh38MBlNM54R2q2 vSMR/VJwa4A9HuJqebrTSaz77HhIeC5LkCjx7FMDgXqlJT6lw0jFVnLgCgxkxfwsN3 DGKxaL35SrvrCH+/CulsimG3/0PwCcPsyT+QmH7Y= Received: from localhost.localdomain (unknown [10.230.30.225]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 3E196140069; Wed, 9 Oct 2019 18:41:57 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Santoshkumar Karanappa Rastapur , stable@dpdk.org Date: Wed, 9 Oct 2019 18:41:43 -0700 Message-Id: <20191010014153.64908-3-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20191010014153.64908-1-ajit.khaparde@broadcom.com> References: <167a2652-7ad6-e02a-8a02-01f828bcba8c@intel.com> <20191010014153.64908-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 02/12] net/bnxt: free default completion ring before VF configuration 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: Santoshkumar Karanappa Rastapur If the VF resources need to be reconfigured using the bnxt_hwrm_func_reserve_vf_resc, make sure that the default completion ring is freed first before the resources are reserved. Reallocate the ring once the VF resources are configured. Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification") Cc: stable@dpdk.org Signed-off-by: Santoshkumar Karanappa Rastapur Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 5160ac002b..294a9505f9 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -669,11 +669,28 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev) return -ENOSPC; } + /* If a resource has already been allocated - in this case + * it is the async completion ring, free it. Reallocate it after + * resource reservation. This will ensure the resource counts + * are calculated correctly. + */ + if (!BNXT_HAS_NQ(bp) && bp->async_cp_ring) { + bnxt_disable_int(bp); + bnxt_free_cp_ring(bp, bp->async_cp_ring); + } + rc = bnxt_hwrm_func_reserve_vf_resc(bp, false); if (rc) { PMD_DRV_LOG(ERR, "HWRM resource alloc fail:%x\n", rc); return -ENOSPC; } + + if (!BNXT_HAS_NQ(bp) && bp->async_cp_ring) { + rc = bnxt_alloc_async_cp_ring(bp); + if (rc) + return rc; + bnxt_enable_int(bp); + } } else { /* legacy driver needs to get updated values */ rc = bnxt_hwrm_func_qcaps(bp); -- 2.20.1 (Apple Git-117)