Skip to content

Commit 7aa4865

Browse files
Vadim Lomovtsevdavem330
authored andcommitted
net: thunderx: acpi: fix LMAC initialization
While probing BGX we requesting appropriate QLM for it's configuration and get LMAC count by that request. Then, while reading configured MAC values from SSDT table we need to save them in proper mapping: BGX[i]->lmac[j].mac = <MAC value> to later provide for initialization stuff. In order to fill such mapping properly we need to add lmac index to be used while acpi initialization since at this moment bgx->lmac_count already contains actual value. Signed-off-by: Vadim Lomovtsev <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8a430ed commit 7aa4865

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/net/ethernet/cavium/thunder/thunder_bgx.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ struct lmac {
4747
struct bgx {
4848
u8 bgx_id;
4949
struct lmac lmac[MAX_LMAC_PER_BGX];
50-
int lmac_count;
50+
u8 lmac_count;
5151
u8 max_lmac;
52+
u8 acpi_lmac_idx;
5253
void __iomem *reg_base;
5354
struct pci_dev *pdev;
5455
bool is_dlm;
@@ -1143,13 +1144,13 @@ static acpi_status bgx_acpi_register_phy(acpi_handle handle,
11431144
if (acpi_bus_get_device(handle, &adev))
11441145
goto out;
11451146

1146-
acpi_get_mac_address(dev, adev, bgx->lmac[bgx->lmac_count].mac);
1147+
acpi_get_mac_address(dev, adev, bgx->lmac[bgx->acpi_lmac_idx].mac);
11471148

1148-
SET_NETDEV_DEV(&bgx->lmac[bgx->lmac_count].netdev, dev);
1149+
SET_NETDEV_DEV(&bgx->lmac[bgx->acpi_lmac_idx].netdev, dev);
11491150

1150-
bgx->lmac[bgx->lmac_count].lmacid = bgx->lmac_count;
1151+
bgx->lmac[bgx->acpi_lmac_idx].lmacid = bgx->acpi_lmac_idx;
1152+
bgx->acpi_lmac_idx++; /* move to next LMAC */
11511153
out:
1152-
bgx->lmac_count++;
11531154
return AE_OK;
11541155
}
11551156

0 commit comments

Comments
 (0)