net/bnxt: uninit locks during resource cleanup
[dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index 4187247..7d9459f 100644 (file)
@@ -83,6 +83,12 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
        { RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57502) },
        { RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57500_VF1) },
        { RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57500_VF2) },
+       { RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57508_MF1) },
+       { RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57504_MF1) },
+       { RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57502_MF1) },
+       { RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57508_MF2) },
+       { RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57504_MF2) },
+       { RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57502_MF2) },
        { .vendor_id = 0, /* sentinel */ },
 };
 
@@ -177,6 +183,9 @@ static void bnxt_free_mem(struct bnxt *bp, bool reconfig)
        }
        bnxt_free_async_cp_ring(bp);
        bnxt_free_rxtx_nq_ring(bp);
+
+       rte_free(bp->grp_info);
+       bp->grp_info = NULL;
 }
 
 static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig)
@@ -4068,6 +4077,24 @@ static bool bnxt_vf_pciid(uint16_t id)
        return false;
 }
 
+static bool bnxt_thor_device(uint16_t id)
+{
+       if (id == BROADCOM_DEV_ID_57508 ||
+           id == BROADCOM_DEV_ID_57504 ||
+           id == BROADCOM_DEV_ID_57502 ||
+           id == BROADCOM_DEV_ID_57508_MF1 ||
+           id == BROADCOM_DEV_ID_57504_MF1 ||
+           id == BROADCOM_DEV_ID_57502_MF1 ||
+           id == BROADCOM_DEV_ID_57508_MF2 ||
+           id == BROADCOM_DEV_ID_57504_MF2 ||
+           id == BROADCOM_DEV_ID_57502_MF2 ||
+           id == BROADCOM_DEV_ID_57500_VF1 ||
+           id == BROADCOM_DEV_ID_57500_VF2)
+               return true;
+
+       return false;
+}
+
 bool bnxt_stratus_device(struct bnxt *bp)
 {
        uint16_t id = bp->pdev->id.device_id;
@@ -4710,11 +4737,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
        if (bnxt_vf_pciid(pci_dev->id.device_id))
                bp->flags |= BNXT_FLAG_VF;
 
-       if (pci_dev->id.device_id == BROADCOM_DEV_ID_57508 ||
-           pci_dev->id.device_id == BROADCOM_DEV_ID_57504 ||
-           pci_dev->id.device_id == BROADCOM_DEV_ID_57502 ||
-           pci_dev->id.device_id == BROADCOM_DEV_ID_57500_VF1 ||
-           pci_dev->id.device_id == BROADCOM_DEV_ID_57500_VF2)
+       if (bnxt_thor_device(pci_dev->id.device_id))
                bp->flags |= BNXT_FLAG_THOR_CHIP;
 
        if (pci_dev->id.device_id == BROADCOM_DEV_ID_58802 ||
@@ -4783,6 +4806,7 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
                }
        }
 
+       bnxt_uninit_locks(bp);
        rte_free(bp->ptp_cfg);
        bp->ptp_cfg = NULL;
        return rc;
@@ -4801,11 +4825,6 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev)
 
        rc = bnxt_uninit_resources(bp, false);
 
-       if (bp->grp_info != NULL) {
-               rte_free(bp->grp_info);
-               bp->grp_info = NULL;
-       }
-
        if (bp->tx_mem_zone) {
                rte_memzone_free((const struct rte_memzone *)bp->tx_mem_zone);
                bp->tx_mem_zone = NULL;
@@ -4824,8 +4843,6 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev)
        eth_dev->rx_pkt_burst = NULL;
        eth_dev->tx_pkt_burst = NULL;
 
-       bnxt_uninit_locks(bp);
-
        return rc;
 }