net: thunderx: Introduce BGX_ID_MASK macro to extract bgx_id
authorRadha Mohan Chintakuntla <rchintakuntla@cavium.com>
Tue, 15 Nov 2016 12:07:16 +0000 (17:37 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Nov 2016 18:28:33 +0000 (13:28 -0500)
This patch fixes the 'bgx_id' determination on 83xx where there are
4 BGX blocks instead of 2 on other platforms.

Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla@cavium.com>
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/thunder/thunder_bgx.c
drivers/net/ethernet/cavium/thunder/thunder_bgx.h

index 8bbaedbb7b946353470f4bb57138f542025b068b..050e21fbb1471d5fa86f735386d90491660cce43 100644 (file)
@@ -1242,8 +1242,8 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        pci_read_config_word(pdev, PCI_DEVICE_ID, &sdevid);
        if (sdevid != PCI_DEVICE_ID_THUNDER_RGX) {
-               bgx->bgx_id =
-                   (pci_resource_start(pdev, PCI_CFG_REG_BAR_NUM) >> 24) & 1;
+               bgx->bgx_id = (pci_resource_start(pdev,
+                       PCI_CFG_REG_BAR_NUM) >> 24) & BGX_ID_MASK;
                bgx->bgx_id += nic_get_node_id(pdev) * MAX_BGX_PER_NODE;
                bgx->max_lmac = MAX_LMAC_PER_BGX;
                bgx_vnic[bgx->bgx_id] = bgx;
index d59c71e4a0008bb576c1c3a6e192eb225381c82a..01cc7c8591313fca033a7e791bc57ccd9adb776b 100644 (file)
@@ -28,6 +28,8 @@
 #define    MAX_DMAC_PER_LMAC                   8
 #define    MAX_FRAME_SIZE                      9216
 
+#define           BGX_ID_MASK                          0x3
+
 #define    MAX_DMAC_PER_LMAC_TNS_BYPASS_MODE   2
 
 /* Registers */