Skip to contentSkip to conversation

mlx4_core: Do not map BF area if capability is 0

PATCH Applied Yevgeny Petrilin 2 participants 2 messages Feb 20, 2012 – Feb 21, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mlx4_core: Do not map BF area if capability is 0

From: Jack Morgenstein <[email protected]>

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.

---
 drivers/net/ethernet/mellanox/mlx4/main.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/ethernet/mellanox/mlx4/main.c +3 -0
index 678558b..9c5fbad 100644
@@ -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) -
Signature · 1 line
1.5.4.3
maintainer Applied
#1 lore raw

From: Yevgeny Petrilin <[email protected]>
Date: Mon, 20 Feb 2012 09:38:52 +0200

Quoted 8 lines

From: Jack Morgenstein <[email protected]>

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.

Applied, thanks.