diff options
author | Jack Morgenstein <jackm@dev.mellanox.co.il> | 2008-02-14 06:41:29 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-02-14 13:43:48 -0500 |
commit | 11e75a7455a7bc73e752c0c985986c2b1f8c930a (patch) | |
tree | 6d3b43ccaeb1b6fc2c8e91f25874baa2ec224bdb /drivers/net/mlx4 | |
parent | e6028c0e004d334bb9ed75d4c918f4c763af1b9f (diff) |
mlx4_core: Move table_find from fmr_alloc to fmr_enable
mlx4_table_find (for FMR MPTs) requires that ICM memory already be
mapped. Before this fix, FMR allocation depended on ICM memory
already being mapped for the MPT entry. If all currently mapped
entries are taken, the find operation fails (even if the MPT ICM table
still had more entries, which were just not mapped yet).
This fix moves the mpt find operation to fmr_enable, to guarantee that
any required ICM memory mapping has already occurred.
Found by Oren Duer of Mellanox.
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/net/mlx4')
-rw-r--r-- | drivers/net/mlx4/mr.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c index 679dfdb6807f..79b317b88c86 100644 --- a/drivers/net/mlx4/mr.c +++ b/drivers/net/mlx4/mr.c | |||
@@ -578,13 +578,6 @@ int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages, | |||
578 | goto err_free; | 578 | goto err_free; |
579 | } | 579 | } |
580 | 580 | ||
581 | fmr->mpt = mlx4_table_find(&priv->mr_table.dmpt_table, | ||
582 | key_to_hw_index(fmr->mr.key), NULL); | ||
583 | if (!fmr->mpt) { | ||
584 | err = -ENOMEM; | ||
585 | goto err_free; | ||
586 | } | ||
587 | |||
588 | return 0; | 581 | return 0; |
589 | 582 | ||
590 | err_free: | 583 | err_free: |
@@ -595,7 +588,19 @@ EXPORT_SYMBOL_GPL(mlx4_fmr_alloc); | |||
595 | 588 | ||
596 | int mlx4_fmr_enable(struct mlx4_dev *dev, struct mlx4_fmr *fmr) | 589 | int mlx4_fmr_enable(struct mlx4_dev *dev, struct mlx4_fmr *fmr) |
597 | { | 590 | { |
598 | return mlx4_mr_enable(dev, &fmr->mr); | 591 | struct mlx4_priv *priv = mlx4_priv(dev); |
592 | int err; | ||
593 | |||
594 | err = mlx4_mr_enable(dev, &fmr->mr); | ||
595 | if (err) | ||
596 | return err; | ||
597 | |||
598 | fmr->mpt = mlx4_table_find(&priv->mr_table.dmpt_table, | ||
599 | key_to_hw_index(fmr->mr.key), NULL); | ||
600 | if (!fmr->mpt) | ||
601 | return -ENOMEM; | ||
602 | |||
603 | return 0; | ||
599 | } | 604 | } |
600 | EXPORT_SYMBOL_GPL(mlx4_fmr_enable); | 605 | EXPORT_SYMBOL_GPL(mlx4_fmr_enable); |
601 | 606 | ||