summaryrefslogtreecommitdiffstats
path: root/drivers/net/mlx4
diff options
context:
space:
mode:
authorEli Cohen <eli@dev.mellanox.co.il>2010-11-10 12:52:37 +0000
committerRoland Dreier <rolandd@cisco.com>2010-12-01 16:08:47 -0800
commit58d74bb1d9f79bb56b2ea51d2ca06a28fa0fce02 (patch)
tree9b8055c1cad7cd9a428fcc0dfd0d0947b37f35b0 /drivers/net/mlx4
parente27535b9c6e071d461be33b75a33047c9bb4c0ce (diff)
mlx4_core: Workaround firmware bug in query dev cap
ConnectX firmware is supposed to report the number blue flame registers per page as log2 of the value. However, due to a firmware bug, it reports actual number. This patch works around this by checking if the number of registers calculated fits within a page. If it does not, we use 8 registers per page. Signed-off-by: Eli Cohen <eli@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/net/mlx4')
-rw-r--r--drivers/net/mlx4/fw.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c
index b68eee2414c..7a7e18ba278 100644
--- a/drivers/net/mlx4/fw.c
+++ b/drivers/net/mlx4/fw.c
@@ -289,6 +289,10 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
MLX4_GET(field, outbox, QUERY_DEV_CAP_LOG_BF_REG_SZ_OFFSET);
dev_cap->bf_reg_size = 1 << (field & 0x1f);
MLX4_GET(field, outbox, QUERY_DEV_CAP_LOG_MAX_BF_REGS_PER_PAGE_OFFSET);
+ if ((1 << (field & 0x3f)) > (PAGE_SIZE / dev_cap->bf_reg_size)) {
+ mlx4_warn(dev, "firmware bug: log2 # of blue flame regs is invalid (%d), forcing 3\n", field & 0x1f);
+ field = 3;
+ }
dev_cap->bf_regs_per_page = 1 << (field & 0x3f);
mlx4_dbg(dev, "BlueFlame available (reg size %d, regs/page %d)\n",
dev_cap->bf_reg_size, dev_cap->bf_regs_per_page);