diff mbox series

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

Message ID 1544605748-20791-4-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:37 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 93dd35e2a69e..a5a7de29fe93 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -723,7 +723,8 @@ struct ib_ah *bnxt_re_create_ah(struct ib_pd *ib_pd,
>         }
>
>         memcpy(ah->qplib_ah.dmac, ah_attr->roce.dmac, ETH_ALEN);
> -       rc = bnxt_qplib_create_ah(&rdev->qplib_res, &ah->qplib_ah);
> +       rc = bnxt_qplib_create_ah(&rdev->qplib_res, &ah->qplib_ah,
> +                                 !(flags & RDMA_CREATE_AH_SLEEPABLE));
>         if (rc) {
>                 dev_err(rdev_to_dev(rdev), "Failed to allocate HW AH");
>                 goto fail;
> @@ -959,7 +960,7 @@ static struct bnxt_re_ah *bnxt_re_create_shadow_qp_ah
>         /* Have DMAC same as SMAC */
>         ether_addr_copy(ah->qplib_ah.dmac, rdev->netdev->dev_addr);
>
> -       rc = bnxt_qplib_create_ah(&rdev->qplib_res, &ah->qplib_ah);
> +       rc = bnxt_qplib_create_ah(&rdev->qplib_res, &ah->qplib_ah, false);
>         if (rc) {
>                 dev_err(rdev_to_dev(rdev),
>                         "Failed to allocate 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 5216b5f844cc..8f4b19ea409c 100644
> --- a/drivers/infiniband/hw/bnxt_re/qplib_sp.c
> +++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
> @@ -488,7 +488,8 @@ int bnxt_qplib_add_pkey(struct bnxt_qplib_res *res,
>  }
>
>  /* AH */
> -int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah)
> +int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
> +                        bool block)
>  {
>         struct bnxt_qplib_rcfw *rcfw = res->rcfw;
>         struct cmdq_create_ah req;
> @@ -522,7 +523,7 @@ int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah)
>         req.dest_mac[2] = cpu_to_le16(temp16[2]);
>
>         rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
> -                                         NULL, 1);
> +                                         NULL, block);
>         if (rc)
>                 return rc;
>
> diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.h b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
> index 8079d7f5a008..53145aa1e7ff 100644
> --- a/drivers/infiniband/hw/bnxt_re/qplib_sp.h
> +++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
> @@ -241,7 +241,8 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
>  int bnxt_qplib_set_func_resources(struct bnxt_qplib_res *res,
>                                   struct bnxt_qplib_rcfw *rcfw,
>                                   struct bnxt_qplib_ctx *ctx);
> -int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah);
> +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_alloc_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 93dd35e2a69e..a5a7de29fe93 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -723,7 +723,8 @@  struct ib_ah *bnxt_re_create_ah(struct ib_pd *ib_pd,
 	}
 
 	memcpy(ah->qplib_ah.dmac, ah_attr->roce.dmac, ETH_ALEN);
-	rc = bnxt_qplib_create_ah(&rdev->qplib_res, &ah->qplib_ah);
+	rc = bnxt_qplib_create_ah(&rdev->qplib_res, &ah->qplib_ah,
+				  !(flags & RDMA_CREATE_AH_SLEEPABLE));
 	if (rc) {
 		dev_err(rdev_to_dev(rdev), "Failed to allocate HW AH");
 		goto fail;
@@ -959,7 +960,7 @@  static struct bnxt_re_ah *bnxt_re_create_shadow_qp_ah
 	/* Have DMAC same as SMAC */
 	ether_addr_copy(ah->qplib_ah.dmac, rdev->netdev->dev_addr);
 
-	rc = bnxt_qplib_create_ah(&rdev->qplib_res, &ah->qplib_ah);
+	rc = bnxt_qplib_create_ah(&rdev->qplib_res, &ah->qplib_ah, false);
 	if (rc) {
 		dev_err(rdev_to_dev(rdev),
 			"Failed to allocate 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 5216b5f844cc..8f4b19ea409c 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_sp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
@@ -488,7 +488,8 @@  int bnxt_qplib_add_pkey(struct bnxt_qplib_res *res,
 }
 
 /* AH */
-int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah)
+int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
+			 bool block)
 {
 	struct bnxt_qplib_rcfw *rcfw = res->rcfw;
 	struct cmdq_create_ah req;
@@ -522,7 +523,7 @@  int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah)
 	req.dest_mac[2] = cpu_to_le16(temp16[2]);
 
 	rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
-					  NULL, 1);
+					  NULL, block);
 	if (rc)
 		return rc;
 
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.h b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
index 8079d7f5a008..53145aa1e7ff 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_sp.h
+++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
@@ -241,7 +241,8 @@  int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
 int bnxt_qplib_set_func_resources(struct bnxt_qplib_res *res,
 				  struct bnxt_qplib_rcfw *rcfw,
 				  struct bnxt_qplib_ctx *ctx);
-int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah);
+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_alloc_mrw(struct bnxt_qplib_res *res,
 			 struct bnxt_qplib_mrw *mrw);