netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] mlx4_core: Do not map BF area if capability is 0
@ 2012-02-20  7:38 Yevgeny Petrilin
  2012-02-21  0:26 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Yevgeny Petrilin @ 2012-02-20  7:38 UTC (permalink / raw)
  To: davem; +Cc: netdev, yevgenyp, jackm

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

BF can be disabled in some cases, the capability field, bf_reg_size is set
to zero in this case. Don't map the BF area in this case, it would cause 
failures.  In addition, leaving the BF area unmapped
also alerts the ETH driver to not use BF.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
---
 drivers/net/ethernet/mellanox/mlx4/main.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 678558b..9c5fbad 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -986,6 +986,9 @@ static int map_bf_area(struct mlx4_dev *dev)
 	resource_size_t bf_len;
 	int err = 0;
 
+	if (!dev->caps.bf_reg_size)
+		return -ENXIO;
+
 	bf_start = pci_resource_start(dev->pdev, 2) +
 			(dev->caps.num_uars << PAGE_SHIFT);
 	bf_len = pci_resource_len(dev->pdev, 2) -
-- 
1.5.4.3

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

* Re: [PATCH net] mlx4_core: Do not map BF area if capability is 0
  2012-02-20  7:38 [PATCH net] mlx4_core: Do not map BF area if capability is 0 Yevgeny Petrilin
@ 2012-02-21  0:26 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-02-21  0:26 UTC (permalink / raw)
  To: yevgenyp; +Cc: netdev, jackm

From: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Date: Mon, 20 Feb 2012 09:38:52 +0200

> From: Jack Morgenstein <jackm@dev.mellanox.co.il>
> 
> BF can be disabled in some cases, the capability field, bf_reg_size is set
> to zero in this case. Don't map the BF area in this case, it would cause 
> failures.  In addition, leaving the BF area unmapped
> also alerts the ETH driver to not use BF.
> 
> Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>

Applied, thanks.

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

end of thread, other threads:[~2012-02-21  0:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-20  7:38 [PATCH net] mlx4_core: Do not map BF area if capability is 0 Yevgeny Petrilin
2012-02-21  0:26 ` David Miller

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).