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 462B4A2F63 for ; Fri, 4 Oct 2019 07:03:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E4D911C1C2; Fri, 4 Oct 2019 07:03:04 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (unknown [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 7722E1C199 for ; Fri, 4 Oct 2019 07:02:54 +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 AFDDE30C2BA; Thu, 3 Oct 2019 22:01:33 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com AFDDE30C2BA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1570165293; bh=SOAKI/VKJVcgxtXXaUACyeSVFiwU5QdEHdLu840E7S4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=URHcjq9h/uExj7EK0THPRO7LwAug8ADOdkaUt9oxnPL6VCy28/9hX/xJzD288ySy7 EMEKuoBN4cKKKW/fTUbW98OSF28mVgXH6Z2aylGOSy1KsT6dmYqfu1JxkmJDLVPNyb KF/1dCiKWcHOpfQWGzrLK3yf9W1Fx63UM1M1ToMs= Received: from localhost.localdomain (unknown [10.230.30.225]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id B2E4514008C; Thu, 3 Oct 2019 22:02:49 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Santoshkumar Karanappa Rastapur Date: Thu, 3 Oct 2019 22:02:38 -0700 Message-Id: <20191004050246.90165-3-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20191004050246.90165-1-ajit.khaparde@broadcom.com> References: <20191004050246.90165-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 02/10] 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. 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 533c6a07fd..2a9b7e5459 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -662,11 +662,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)