diff options
author | Jack Morgenstein <jackm@dev.mellanox.co.il> | 2012-06-19 04:21:33 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-07-08 21:05:05 -0400 |
commit | 752a50cab600c6d46c5a1921c6a6d2fb116c8a4b (patch) | |
tree | b6b4fac3ff771523c737eeb0ad922903977b2ec8 /drivers/net/ethernet/mellanox/mlx4 | |
parent | 6887a4131da3adaab011613776d865f4bcfb5678 (diff) |
mlx4_core: Pass an invalid PCI id number to VFs
Currently, VFs have 0 in their dev->caps.function field. This is a
valid pci id (usually of the PF). Instead, pass an invalid PCI id to
the VF via QUERY_FW, so that if the value gets accessed in the VF
driver, we'll catch the problem.
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/fw.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index 9c83bb8151ea..4281ce09add8 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -881,11 +881,12 @@ int mlx4_QUERY_FW(struct mlx4_dev *dev) | |||
881 | ((fw_ver & 0xffff0000ull) >> 16) | | 881 | ((fw_ver & 0xffff0000ull) >> 16) | |
882 | ((fw_ver & 0x0000ffffull) << 16); | 882 | ((fw_ver & 0x0000ffffull) << 16); |
883 | 883 | ||
884 | MLX4_GET(lg, outbox, QUERY_FW_PPF_ID); | ||
885 | dev->caps.function = lg; | ||
886 | |||
884 | if (mlx4_is_slave(dev)) | 887 | if (mlx4_is_slave(dev)) |
885 | goto out; | 888 | goto out; |
886 | 889 | ||
887 | MLX4_GET(lg, outbox, QUERY_FW_PPF_ID); | ||
888 | dev->caps.function = lg; | ||
889 | 890 | ||
890 | MLX4_GET(cmd_if_rev, outbox, QUERY_FW_CMD_IF_REV_OFFSET); | 891 | MLX4_GET(cmd_if_rev, outbox, QUERY_FW_CMD_IF_REV_OFFSET); |
891 | if (cmd_if_rev < MLX4_COMMAND_INTERFACE_MIN_REV || | 892 | if (cmd_if_rev < MLX4_COMMAND_INTERFACE_MIN_REV || |
@@ -966,9 +967,12 @@ int mlx4_QUERY_FW_wrapper(struct mlx4_dev *dev, int slave, | |||
966 | if (err) | 967 | if (err) |
967 | return err; | 968 | return err; |
968 | 969 | ||
969 | /* for slaves, zero out everything except FW version */ | 970 | /* for slaves, set pci PPF ID to invalid and zero out everything |
971 | * else except FW version */ | ||
970 | outbuf[0] = outbuf[1] = 0; | 972 | outbuf[0] = outbuf[1] = 0; |
971 | memset(&outbuf[8], 0, QUERY_FW_OUT_SIZE - 8); | 973 | memset(&outbuf[8], 0, QUERY_FW_OUT_SIZE - 8); |
974 | outbuf[QUERY_FW_PPF_ID] = MLX4_INVALID_SLAVE_ID; | ||
975 | |||
972 | return 0; | 976 | return 0; |
973 | } | 977 | } |
974 | 978 | ||