Skip to content

Commit dcc23e3

Browse files
ethan.zhaodavem330
authored andcommitted
ixgbe: define IXGBE_MAX_VFS_DRV_LIMIT macro and cleanup const 63
Because ixgbe driver limit the max number of VF functions could be enabled to 63, so define one macro IXGBE_MAX_VFS_DRV_LIMIT and cleanup the const 63 in code. v3: revised for net-next tree. Signed-off-by: Ethan Zhao <[email protected]> Tested-by: Phil Schmitt <[email protected]> Signed-off-by: Aaron Brown <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6c7e761 commit dcc23e3

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5067,7 +5067,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter)
50675067

50685068
/* assign number of SR-IOV VFs */
50695069
if (hw->mac.type != ixgbe_mac_82598EB) {
5070-
if (max_vfs > 63) {
5070+
if (max_vfs > IXGBE_MAX_VFS_DRV_LIMIT) {
50715071
adapter->num_vfs = 0;
50725072
e_dev_warn("max_vfs parameter out of range. Not assigning any SR-IOV VFs\n");
50735073
} else {
@@ -8020,7 +8020,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
80208020
ixgbe_init_mbx_params_pf(hw);
80218021
memcpy(&hw->mbx.ops, ii->mbx_ops, sizeof(hw->mbx.ops));
80228022
ixgbe_enable_sriov(adapter);
8023-
pci_sriov_set_totalvfs(pdev, 63);
8023+
pci_sriov_set_totalvfs(pdev, IXGBE_MAX_VFS_DRV_LIMIT);
80248024
skip_sriov:
80258025

80268026
#endif

drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void ixgbe_enable_sriov(struct ixgbe_adapter *adapter)
148148
* physical function. If the user requests greater thn
149149
* 63 VFs then it is an error - reset to default of zero.
150150
*/
151-
adapter->num_vfs = min_t(unsigned int, adapter->num_vfs, 63);
151+
adapter->num_vfs = min_t(unsigned int, adapter->num_vfs, IXGBE_MAX_VFS_DRV_LIMIT);
152152

153153
err = pci_enable_sriov(adapter->pdev, adapter->num_vfs);
154154
if (err) {
@@ -257,7 +257,7 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs)
257257
* PF. The PCI bus driver already checks for other values out of
258258
* range.
259259
*/
260-
if (num_vfs > 63) {
260+
if (num_vfs > IXGBE_MAX_VFS_DRV_LIMIT) {
261261
err = -EPERM;
262262
goto err_out;
263263
}

drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
#ifndef _IXGBE_SRIOV_H_
2929
#define _IXGBE_SRIOV_H_
3030

31+
/* ixgbe driver limit the max number of VFs could be enabled to
32+
* 63 (IXGBE_MAX_VF_FUNCTIONS - 1)
33+
*/
34+
#define IXGBE_MAX_VFS_DRV_LIMIT (IXGBE_MAX_VF_FUNCTIONS - 1)
35+
3136
void ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter);
3237
void ixgbe_msg_task(struct ixgbe_adapter *adapter);
3338
int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask);

0 commit comments

Comments
 (0)