cxgb4: number of VFs supported is not always 16
authorGanesh Goudar <ganeshgr@chelsio.com>
Tue, 27 Nov 2018 09:29:06 +0000 (14:59 +0530)
committerDavid S. Miller <davem@davemloft.net>
Fri, 30 Nov 2018 21:09:36 +0000 (13:09 -0800)
Total number of VFs supported by PF is used to determine the last
byte of VF's mac address. Number of VFs supported is not always
16, use the variable nvfs to get the number of VFs supported
rather than hard coding it to 16.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

index 7f76ad9e1ad6e24af5d192c39b051264470be423..6ba9099ca7fe4f27ca60302865b4b0443f70a448 100644 (file)
@@ -2646,7 +2646,7 @@ static void cxgb4_mgmt_fill_vf_station_mac_addr(struct adapter *adap)
 
        for (vf = 0, nvfs = pci_sriov_get_totalvfs(adap->pdev);
                vf < nvfs; vf++) {
-               macaddr[5] = adap->pf * 16 + vf;
+               macaddr[5] = adap->pf * nvfs + vf;
                ether_addr_copy(adap->vfinfo[vf].vf_mac_addr, macaddr);
        }
 }