public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Yuval Mintz <Yuval.Mintz@cavium.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: Michal.Kalderon@cavium.com, linux-rdma@vger.kernel.org,
	Yuval Mintz <Yuval.Mintz@cavium.com>
Subject: [PATCH v4 net-next 6/7] qed: Wait for resources before FUNC_CLOSE
Date: Tue, 20 Jun 2017 16:00:05 +0300	[thread overview]
Message-ID: <20170620130006.307-7-Yuval.Mintz@cavium.com> (raw)
In-Reply-To: <20170620130006.307-1-Yuval.Mintz@cavium.com>

From: Michal Kalderon <Michal.Kalderon@cavium.com>

Driver needs to wait for all resources to return from FW before it can send
the FUNC_CLOSE ramrod.

Signed-off-by: Michal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
---
 drivers/net/ethernet/qlogic/qed/qed_roce.c | 35 +++++++++++++++++-------------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c
index 8419dcc..7482905 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
@@ -372,22 +372,7 @@ static void qed_rdma_bmap_free(struct qed_hwfn *p_hwfn,
 
 static void qed_rdma_resc_free(struct qed_hwfn *p_hwfn)
 {
-	struct qed_bmap *rcid_map = &p_hwfn->p_rdma_info->real_cid_map;
 	struct qed_rdma_info *p_rdma_info = p_hwfn->p_rdma_info;
-	int wait_count = 0;
-
-	/* when destroying a_RoCE QP the control is returned to the user after
-	 * the synchronous part. The asynchronous part may take a little longer.
-	 * We delay for a short while if an async destroy QP is still expected.
-	 * Beyond the added delay we clear the bitmap anyway.
-	 */
-	while (bitmap_weight(rcid_map->bitmap, rcid_map->max_count)) {
-		msleep(100);
-		if (wait_count++ > 20) {
-			DP_NOTICE(p_hwfn, "cid bitmap wait timed out\n");
-			break;
-		}
-	}
 
 	qed_rdma_bmap_free(p_hwfn, &p_hwfn->p_rdma_info->cid_map, 1);
 	qed_rdma_bmap_free(p_hwfn, &p_hwfn->p_rdma_info->pd_map, 1);
@@ -704,6 +689,25 @@ static int qed_rdma_setup(struct qed_hwfn *p_hwfn,
 	return qed_rdma_start_fw(p_hwfn, params, p_ptt);
 }
 
+void qed_roce_stop(struct qed_hwfn *p_hwfn)
+{
+	struct qed_bmap *rcid_map = &p_hwfn->p_rdma_info->real_cid_map;
+	int wait_count = 0;
+
+	/* when destroying a_RoCE QP the control is returned to the user after
+	 * the synchronous part. The asynchronous part may take a little longer.
+	 * We delay for a short while if an async destroy QP is still expected.
+	 * Beyond the added delay we clear the bitmap anyway.
+	 */
+	while (bitmap_weight(rcid_map->bitmap, rcid_map->max_count)) {
+		msleep(100);
+		if (wait_count++ > 20) {
+			DP_NOTICE(p_hwfn, "cid bitmap wait timed out\n");
+			break;
+		}
+	}
+}
+
 static int qed_rdma_stop(void *rdma_cxt)
 {
 	struct qed_hwfn *p_hwfn = (struct qed_hwfn *)rdma_cxt;
@@ -733,6 +737,7 @@ static int qed_rdma_stop(void *rdma_cxt)
 	qed_wr(p_hwfn, p_ptt, PRS_REG_LIGHT_L2_ETHERTYPE_EN,
 	       (ll2_ethertype_en & 0xFFFE));
 
+	qed_roce_stop(p_hwfn);
 	qed_ptt_release(p_hwfn, p_ptt);
 
 	/* Get SPQ entry */
-- 
2.9.4

  parent reply	other threads:[~2017-06-20 13:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20 12:59 [PATCH v4 net-next 0/7] qed*: RDMA and infrastructure for iWARP Yuval Mintz
2017-06-20 13:00 ` [PATCH v4 net-next 2/7] qed: RoCE EDPM to honor PFC Yuval Mintz
2017-06-20 13:00 ` [PATCH v4 net-next 3/7] qed: Disable RoCE dpm when DCBx change occurs Yuval Mintz
     [not found] ` <20170620130006.307-1-Yuval.Mintz-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2017-06-20 13:00   ` [PATCH v4 net-next 1/7] qed: Chain support for external PBL Yuval Mintz
2017-06-20 13:00   ` [PATCH v4 net-next 4/7] qed*: qede_roce.[ch] -> qede_rdma.[ch] Yuval Mintz
2017-06-20 13:00   ` [PATCH v4 net-next 5/7] qed*: Set rdma generic functions prefix Yuval Mintz
2017-06-20 13:00   ` [PATCH v4 net-next 7/7] qed: SPQ async callback registration Yuval Mintz
2017-06-20 13:00 ` Yuval Mintz [this message]
2017-06-20 16:35 ` [PATCH v4 net-next 0/7] qed*: RDMA and infrastructure for iWARP David Miller
     [not found]   ` <20170620.123551.765657502957371421.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2017-06-21  9:56     ` Or Gerlitz
     [not found]       ` <CAJ3xEMjyHidoAV9_VPkTM9dPdaXRFt8LmpcV_5iEvYEB+ujSmA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-21  9:57         ` Or Gerlitz
2017-06-21 10:10           ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170620130006.307-7-Yuval.Mintz@cavium.com \
    --to=yuval.mintz@cavium.com \
    --cc=Michal.Kalderon@cavium.com \
    --cc=davem@davemloft.net \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox