net/bnxt: add wrapper function for Thor device check
authorKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Thu, 24 Oct 2019 07:44:30 +0000 (13:14 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 25 Oct 2019 17:23:23 +0000 (19:23 +0200)
This patch adds a wrapper function bnxt_thor_device() which checks
for the pci device is Thor family.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
drivers/net/bnxt/bnxt_ethdev.c

index 0bed4a2..013b968 100644 (file)
@@ -4074,6 +4074,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;
@@ -4716,11 +4734,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 ||