diff options
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/fw.c | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/main.c | 24 | ||||
-rw-r--r-- | include/linux/mlx4/device.h | 5 |
3 files changed, 31 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index d2f594fadfbf..4251f81a0275 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -143,7 +143,8 @@ static void dump_dev_cap_flags2(struct mlx4_dev *dev, u64 flags) | |||
143 | [14] = "Ethernet protocol control support", | 143 | [14] = "Ethernet protocol control support", |
144 | [15] = "Ethernet Backplane autoneg support", | 144 | [15] = "Ethernet Backplane autoneg support", |
145 | [16] = "CONFIG DEV support", | 145 | [16] = "CONFIG DEV support", |
146 | [17] = "Asymmetric EQs support" | 146 | [17] = "Asymmetric EQs support", |
147 | [18] = "More than 80 VFs support" | ||
147 | }; | 148 | }; |
148 | int i; | 149 | int i; |
149 | 150 | ||
@@ -860,6 +861,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
860 | dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_VLAN_CONTROL; | 861 | dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_VLAN_CONTROL; |
861 | if (field32 & (1 << 20)) | 862 | if (field32 & (1 << 20)) |
862 | dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_FSM; | 863 | dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_FSM; |
864 | if (field32 & (1 << 21)) | ||
865 | dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_80_VFS; | ||
863 | 866 | ||
864 | if (dev->flags & MLX4_FLAG_OLD_PORT_CMDS) { | 867 | if (dev->flags & MLX4_FLAG_OLD_PORT_CMDS) { |
865 | for (i = 1; i <= dev_cap->num_ports; ++i) { | 868 | for (i = 1; i <= dev_cap->num_ports; ++i) { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index ebb279060a25..3044f9e623cb 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -2373,6 +2373,24 @@ disable_sriov: | |||
2373 | return dev_flags & ~MLX4_FLAG_MASTER; | 2373 | return dev_flags & ~MLX4_FLAG_MASTER; |
2374 | } | 2374 | } |
2375 | 2375 | ||
2376 | enum { | ||
2377 | MLX4_DEV_CAP_CHECK_NUM_VFS_ABOVE_64 = -1, | ||
2378 | }; | ||
2379 | |||
2380 | static int mlx4_check_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap, | ||
2381 | int *nvfs) | ||
2382 | { | ||
2383 | int requested_vfs = nvfs[0] + nvfs[1] + nvfs[2]; | ||
2384 | /* Checking for 64 VFs as a limitation of CX2 */ | ||
2385 | if (!(dev_cap->flags2 & MLX4_DEV_CAP_FLAG2_80_VFS) && | ||
2386 | requested_vfs >= 64) { | ||
2387 | mlx4_err(dev, "Requested %d VFs, but FW does not support more than 64\n", | ||
2388 | requested_vfs); | ||
2389 | return MLX4_DEV_CAP_CHECK_NUM_VFS_ABOVE_64; | ||
2390 | } | ||
2391 | return 0; | ||
2392 | } | ||
2393 | |||
2376 | static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data, | 2394 | static int mlx4_load_one(struct pci_dev *pdev, int pci_dev_data, |
2377 | int total_vfs, int *nvfs, struct mlx4_priv *priv) | 2395 | int total_vfs, int *nvfs, struct mlx4_priv *priv) |
2378 | { | 2396 | { |
@@ -2484,6 +2502,9 @@ slave_start: | |||
2484 | goto err_fw; | 2502 | goto err_fw; |
2485 | } | 2503 | } |
2486 | 2504 | ||
2505 | if (mlx4_check_dev_cap(dev, dev_cap, nvfs)) | ||
2506 | goto err_fw; | ||
2507 | |||
2487 | if (!(dev_cap->flags2 & MLX4_DEV_CAP_FLAG2_SYS_EQS)) { | 2508 | if (!(dev_cap->flags2 & MLX4_DEV_CAP_FLAG2_SYS_EQS)) { |
2488 | u64 dev_flags = mlx4_enable_sriov(dev, pdev, total_vfs, | 2509 | u64 dev_flags = mlx4_enable_sriov(dev, pdev, total_vfs, |
2489 | existing_vfs); | 2510 | existing_vfs); |
@@ -2512,6 +2533,9 @@ slave_start: | |||
2512 | mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting.\n"); | 2533 | mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting.\n"); |
2513 | goto err_fw; | 2534 | goto err_fw; |
2514 | } | 2535 | } |
2536 | |||
2537 | if (mlx4_check_dev_cap(dev, dev_cap, nvfs)) | ||
2538 | goto err_fw; | ||
2515 | } | 2539 | } |
2516 | } | 2540 | } |
2517 | 2541 | ||
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 1c560eb870ad..cf09e65c2901 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -95,7 +95,7 @@ enum { | |||
95 | 95 | ||
96 | enum { | 96 | enum { |
97 | MLX4_MAX_NUM_PF = 16, | 97 | MLX4_MAX_NUM_PF = 16, |
98 | MLX4_MAX_NUM_VF = 64, | 98 | MLX4_MAX_NUM_VF = 126, |
99 | MLX4_MAX_NUM_VF_P_PORT = 64, | 99 | MLX4_MAX_NUM_VF_P_PORT = 64, |
100 | MLX4_MFUNC_MAX = 80, | 100 | MLX4_MFUNC_MAX = 80, |
101 | MLX4_MAX_EQ_NUM = 1024, | 101 | MLX4_MAX_EQ_NUM = 1024, |
@@ -190,7 +190,8 @@ enum { | |||
190 | MLX4_DEV_CAP_FLAG2_ETH_PROT_CTRL = 1LL << 14, | 190 | MLX4_DEV_CAP_FLAG2_ETH_PROT_CTRL = 1LL << 14, |
191 | MLX4_DEV_CAP_FLAG2_ETH_BACKPL_AN_REP = 1LL << 15, | 191 | MLX4_DEV_CAP_FLAG2_ETH_BACKPL_AN_REP = 1LL << 15, |
192 | MLX4_DEV_CAP_FLAG2_CONFIG_DEV = 1LL << 16, | 192 | MLX4_DEV_CAP_FLAG2_CONFIG_DEV = 1LL << 16, |
193 | MLX4_DEV_CAP_FLAG2_SYS_EQS = 1LL << 17 | 193 | MLX4_DEV_CAP_FLAG2_SYS_EQS = 1LL << 17, |
194 | MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18 | ||
194 | }; | 195 | }; |
195 | 196 | ||
196 | enum { | 197 | enum { |