linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mlx4_core: Workaround firmware bug in query dev cap
@ 2010-11-10 12:52 Eli Cohen
  2010-12-02  0:12 ` Roland Dreier
  0 siblings, 1 reply; 2+ messages in thread
From: Eli Cohen @ 2010-11-10 12:52 UTC (permalink / raw)
  To: Roland Dreier; +Cc: RDMA list

CX firmware reports the number blue flame registers per page as log2 based
number. However, due to a firmware bug, it reports the native number. This
patch workaround this by checking if the number of calcualted fits within a
page. If it does not, it set the value to 3 which means 8 registers per page.

Signed-off-by: Eli Cohen <eli-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
---
 drivers/net/mlx4/fw.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c
index 2327f9e..f1bfa8d 100644
--- a/drivers/net/mlx4/fw.c
+++ b/drivers/net/mlx4/fw.c
@@ -299,6 +299,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, "log blue flame 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);
-- 
1.6.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mlx4_core: Workaround firmware bug in query dev cap
  2010-11-10 12:52 [PATCH] mlx4_core: Workaround firmware bug in query dev cap Eli Cohen
@ 2010-12-02  0:12 ` Roland Dreier
  0 siblings, 0 replies; 2+ messages in thread
From: Roland Dreier @ 2010-12-02  0:12 UTC (permalink / raw)
  To: Eli Cohen; +Cc: RDMA list

thanks, applied
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-02  0:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-10 12:52 [PATCH] mlx4_core: Workaround firmware bug in query dev cap Eli Cohen
2010-12-02  0:12 ` Roland Dreier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).