diff mbox series

[rdma-next,v2,4/4] RDMA/bnxt_re: Make use of destroy AH sleepable flag

Message ID 1544605748-20791-5-git-send-email-galpress@amazon.com (mailing list archive)
State Accepted
Headers show
Series Mark create/destroy address handle calls as atomic/sleepable | expand

Commit Message

Gal Pressman Dec. 12, 2018, 9:09 a.m. UTC
When in a sleepable (non-atomic) context, wait for firmware completion
instead of polling for it.

Cc: Selvin Xavier <selvin.xavier@broadcom.com>
Cc: Devesh Sharma <devesh.sharma@broadcom.com>
Cc: Somnath Kotur <somnath.kotur@broadcom.com>
Cc: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: Gal Pressman <galpress@amazon.com>
---
 drivers/infiniband/hw/bnxt_re/ib_verbs.c | 5 +++--
 drivers/infiniband/hw/bnxt_re/qplib_sp.c | 5 +++--
 drivers/infiniband/hw/bnxt_re/qplib_sp.h | 3 ++-
 3 files changed, 8 insertions(+), 5 deletions(-)

Comments

Selvin Xavier Dec. 17, 2018, 10:36 a.m. UTC | #1
On Wed, Dec 12, 2018 at 2:39 PM Gal Pressman <galpress@amazon.com> wrote:
>
> When in a sleepable (non-atomic) context, wait for firmware completion
> instead of polling for it.
>
> Cc: Selvin Xavier <selvin.xavier@broadcom.com>
> Cc: Devesh Sharma <devesh.sharma@broadcom.com>
> Cc: Somnath Kotur <somnath.kotur@broadcom.com>
> Cc: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
> Signed-off-by: Gal Pressman <galpress@amazon.com>

Acked-by: Selvin Xavier <selvin.xavier@broadcom.com>

Thanks,
Selvin
> ---
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c | 5 +++--
>  drivers/infiniband/hw/bnxt_re/qplib_sp.c | 5 +++--
>  drivers/infiniband/hw/bnxt_re/qplib_sp.h | 3 ++-
>  3 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index a5a7de29fe93..43af18f6ca51 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -653,7 +653,8 @@ int bnxt_re_destroy_ah(struct ib_ah *ib_ah, u32 flags)
>         struct bnxt_re_dev *rdev = ah->rdev;
>         int rc;
>
> -       rc = bnxt_qplib_destroy_ah(&rdev->qplib_res, &ah->qplib_ah);
> +       rc = bnxt_qplib_destroy_ah(&rdev->qplib_res, &ah->qplib_ah,
> +                                  !(flags & RDMA_DESTROY_AH_SLEEPABLE));
>         if (rc) {
>                 dev_err(rdev_to_dev(rdev), "Failed to destroy HW AH");
>                 return rc;
> @@ -820,7 +821,7 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp)
>
>         if (ib_qp->qp_type == IB_QPT_GSI && rdev->qp1_sqp) {
>                 rc = bnxt_qplib_destroy_ah(&rdev->qplib_res,
> -                                          &rdev->sqp_ah->qplib_ah);
> +                                          &rdev->sqp_ah->qplib_ah, false);
>                 if (rc) {
>                         dev_err(rdev_to_dev(rdev),
>                                 "Failed to destroy HW AH for shadow QP");
> diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.c b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
> index 8f4b19ea409c..be03b5738f71 100644
> --- a/drivers/infiniband/hw/bnxt_re/qplib_sp.c
> +++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
> @@ -531,7 +531,8 @@ int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
>         return 0;
>  }
>
> -int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah)
> +int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
> +                         bool block)
>  {
>         struct bnxt_qplib_rcfw *rcfw = res->rcfw;
>         struct cmdq_destroy_ah req;
> @@ -545,7 +546,7 @@ int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah)
>         req.ah_cid = cpu_to_le32(ah->id);
>
>         rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
> -                                         NULL, 1);
> +                                         NULL, block);
>         if (rc)
>                 return rc;
>         return 0;
> diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.h b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
> index 53145aa1e7ff..39454b3f738d 100644
> --- a/drivers/infiniband/hw/bnxt_re/qplib_sp.h
> +++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
> @@ -243,7 +243,8 @@ int bnxt_qplib_set_func_resources(struct bnxt_qplib_res *res,
>                                   struct bnxt_qplib_ctx *ctx);
>  int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
>                          bool block);
> -int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah);
> +int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
> +                         bool block);
>  int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res,
>                          struct bnxt_qplib_mrw *mrw);
>  int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw,
> --
> 2.7.4
>
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index a5a7de29fe93..43af18f6ca51 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -653,7 +653,8 @@  int bnxt_re_destroy_ah(struct ib_ah *ib_ah, u32 flags)
 	struct bnxt_re_dev *rdev = ah->rdev;
 	int rc;
 
-	rc = bnxt_qplib_destroy_ah(&rdev->qplib_res, &ah->qplib_ah);
+	rc = bnxt_qplib_destroy_ah(&rdev->qplib_res, &ah->qplib_ah,
+				   !(flags & RDMA_DESTROY_AH_SLEEPABLE));
 	if (rc) {
 		dev_err(rdev_to_dev(rdev), "Failed to destroy HW AH");
 		return rc;
@@ -820,7 +821,7 @@  int bnxt_re_destroy_qp(struct ib_qp *ib_qp)
 
 	if (ib_qp->qp_type == IB_QPT_GSI && rdev->qp1_sqp) {
 		rc = bnxt_qplib_destroy_ah(&rdev->qplib_res,
-					   &rdev->sqp_ah->qplib_ah);
+					   &rdev->sqp_ah->qplib_ah, false);
 		if (rc) {
 			dev_err(rdev_to_dev(rdev),
 				"Failed to destroy HW AH for shadow QP");
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.c b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
index 8f4b19ea409c..be03b5738f71 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_sp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
@@ -531,7 +531,8 @@  int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
 	return 0;
 }
 
-int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah)
+int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
+			  bool block)
 {
 	struct bnxt_qplib_rcfw *rcfw = res->rcfw;
 	struct cmdq_destroy_ah req;
@@ -545,7 +546,7 @@  int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah)
 	req.ah_cid = cpu_to_le32(ah->id);
 
 	rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
-					  NULL, 1);
+					  NULL, block);
 	if (rc)
 		return rc;
 	return 0;
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.h b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
index 53145aa1e7ff..39454b3f738d 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_sp.h
+++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
@@ -243,7 +243,8 @@  int bnxt_qplib_set_func_resources(struct bnxt_qplib_res *res,
 				  struct bnxt_qplib_ctx *ctx);
 int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
 			 bool block);
-int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah);
+int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
+			  bool block);
 int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res,
 			 struct bnxt_qplib_mrw *mrw);
 int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw,