aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox
diff options
context:
space:
mode:
authorShani Michaeli <shanim@mellanox.com>2013-02-06 11:19:09 -0500
committerRoland Dreier <roland@purestorage.com>2013-02-21 14:38:43 -0500
commit61083720702a329ed5952e32bda384e3bbc9093c (patch)
treee31fb437442c23fdab04f94b69d0c612b870478d /drivers/net/ethernet/mellanox
parentb20e519a81d648aebfbb90811743cc86cd469a48 (diff)
mlx4_core: Propagate MR deregistration failures to caller
MR deregistration fails when memory windows are bound to the MR. Handle such failures by propagating them to the caller ULP. Signed-off-by: Haggai Eran <haggaie@mellanox.com> Signed-off-by: Shani Michaeli <shanim@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_main.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mr.c29
2 files changed, 24 insertions, 9 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_main.c b/drivers/net/ethernet/mellanox/mlx4/en_main.c
index 3a2b8c65642d..a2987142734d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_main.c
@@ -176,7 +176,7 @@ static void mlx4_en_remove(struct mlx4_dev *dev, void *endev_ptr)
176 176
177 flush_workqueue(mdev->workqueue); 177 flush_workqueue(mdev->workqueue);
178 destroy_workqueue(mdev->workqueue); 178 destroy_workqueue(mdev->workqueue);
179 mlx4_mr_free(dev, &mdev->mr); 179 (void) mlx4_mr_free(dev, &mdev->mr);
180 iounmap(mdev->uar_map); 180 iounmap(mdev->uar_map);
181 mlx4_uar_free(dev, &mdev->priv_uar); 181 mlx4_uar_free(dev, &mdev->priv_uar);
182 mlx4_pd_free(dev, mdev->priv_pdn); 182 mlx4_pd_free(dev, mdev->priv_pdn);
@@ -283,7 +283,7 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
283 return mdev; 283 return mdev;
284 284
285err_mr: 285err_mr:
286 mlx4_mr_free(dev, &mdev->mr); 286 (void) mlx4_mr_free(dev, &mdev->mr);
287err_map: 287err_map:
288 if (!mdev->uar_map) 288 if (!mdev->uar_map)
289 iounmap(mdev->uar_map); 289 iounmap(mdev->uar_map);
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index 49705cf860c6..06b16e4ace80 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -442,7 +442,7 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access,
442} 442}
443EXPORT_SYMBOL_GPL(mlx4_mr_alloc); 443EXPORT_SYMBOL_GPL(mlx4_mr_alloc);
444 444
445static void mlx4_mr_free_reserved(struct mlx4_dev *dev, struct mlx4_mr *mr) 445static int mlx4_mr_free_reserved(struct mlx4_dev *dev, struct mlx4_mr *mr)
446{ 446{
447 int err; 447 int err;
448 448
@@ -450,20 +450,31 @@ static void mlx4_mr_free_reserved(struct mlx4_dev *dev, struct mlx4_mr *mr)
450 err = mlx4_HW2SW_MPT(dev, NULL, 450 err = mlx4_HW2SW_MPT(dev, NULL,
451 key_to_hw_index(mr->key) & 451 key_to_hw_index(mr->key) &
452 (dev->caps.num_mpts - 1)); 452 (dev->caps.num_mpts - 1));
453 if (err) 453 if (err) {
454 mlx4_warn(dev, "xxx HW2SW_MPT failed (%d)\n", err); 454 mlx4_warn(dev, "HW2SW_MPT failed (%d),", err);
455 mlx4_warn(dev, "MR has MWs bound to it.\n");
456 return err;
457 }
455 458
456 mr->enabled = MLX4_MPT_EN_SW; 459 mr->enabled = MLX4_MPT_EN_SW;
457 } 460 }
458 mlx4_mtt_cleanup(dev, &mr->mtt); 461 mlx4_mtt_cleanup(dev, &mr->mtt);
462
463 return 0;
459} 464}
460 465
461void mlx4_mr_free(struct mlx4_dev *dev, struct mlx4_mr *mr) 466int mlx4_mr_free(struct mlx4_dev *dev, struct mlx4_mr *mr)
462{ 467{
463 mlx4_mr_free_reserved(dev, mr); 468 int ret;
469
470 ret = mlx4_mr_free_reserved(dev, mr);
471 if (ret)
472 return ret;
464 if (mr->enabled) 473 if (mr->enabled)
465 mlx4_mpt_free_icm(dev, key_to_hw_index(mr->key)); 474 mlx4_mpt_free_icm(dev, key_to_hw_index(mr->key));
466 mlx4_mpt_release(dev, key_to_hw_index(mr->key)); 475 mlx4_mpt_release(dev, key_to_hw_index(mr->key));
476
477 return 0;
467} 478}
468EXPORT_SYMBOL_GPL(mlx4_mr_free); 479EXPORT_SYMBOL_GPL(mlx4_mr_free);
469 480
@@ -831,7 +842,7 @@ int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages,
831 return 0; 842 return 0;
832 843
833err_free: 844err_free:
834 mlx4_mr_free(dev, &fmr->mr); 845 (void) mlx4_mr_free(dev, &fmr->mr);
835 return err; 846 return err;
836} 847}
837EXPORT_SYMBOL_GPL(mlx4_fmr_alloc); 848EXPORT_SYMBOL_GPL(mlx4_fmr_alloc);
@@ -888,10 +899,14 @@ EXPORT_SYMBOL_GPL(mlx4_fmr_unmap);
888 899
889int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr) 900int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr)
890{ 901{
902 int ret;
903
891 if (fmr->maps) 904 if (fmr->maps)
892 return -EBUSY; 905 return -EBUSY;
893 906
894 mlx4_mr_free(dev, &fmr->mr); 907 ret = mlx4_mr_free(dev, &fmr->mr);
908 if (ret)
909 return ret;
895 fmr->mr.enabled = MLX4_MPT_DISABLED; 910 fmr->mr.enabled = MLX4_MPT_DISABLED;
896 911
897 return 0; 912 return 0;