Skip to content

Commit

Permalink
mlx4_core: Improve error message when not enough UAR pages are available
Browse files Browse the repository at this point in the history
If an mlx4 device with default FW (which gives a UAR BAR size of 8 MB)
is used in a system with 64 KB pages, then there are only 8192/64==128
UAR pages available.  However, the first 128 UAR pages are reserved
for use with event queue doorbells, so no UAR pages are available to
do anything else with, which means that the driver cannot work.

The current driver fails with a fairly cryptic "Failed to allocate
driver access region, aborting" message in this situation.  Fix the
driver to detect the problem earlier and print out a clearer
description of the problem and a suggestion of how to fix it (use a
new firmware image).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Roland Dreier committed Jul 23, 2008
1 parent 95d04f0 commit 7644264
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/net/mlx4/pd.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ EXPORT_SYMBOL_GPL(mlx4_uar_free);

int mlx4_init_uar_table(struct mlx4_dev *dev)
{
if (dev->caps.num_uars <= 128) {
mlx4_err(dev, "Only %d UAR pages (need more than 128)\n",
dev->caps.num_uars);
mlx4_err(dev, "Increase firmware log2_uar_bar_megabytes?\n");
return -ENODEV;
}

return mlx4_bitmap_init(&mlx4_priv(dev)->uar_table.bitmap,
dev->caps.num_uars, dev->caps.num_uars - 1,
max(128, dev->caps.reserved_uars));
Expand Down

0 comments on commit 7644264

Please sign in to comment.