From: Santoshkumar Karanappa Rastapur Date: Thu, 10 Oct 2019 01:41:43 +0000 (-0700) Subject: net/bnxt: free default completion ring before VF config X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6d178ea04082101d9e75997927403fd8b0af7854;p=dpdk.git net/bnxt: free default completion ring before VF config 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 --- 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);