linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Subject: [PATCH v2 08/17] staging/rdma/hfi1: Add a credit push on diagpkt allocate fail
Date: Tue,  1 Dec 2015 15:38:17 -0500	[thread overview]
Message-ID: <1449002306-15180-9-git-send-email-jubin.john@intel.com> (raw)
In-Reply-To: <1449002306-15180-1-git-send-email-jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

From: Dean Luick <dean.luick-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

When sending a diagnostic packet, if the send context does not
have enough room, force a credit return and try again.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dean Luick <dean.luick-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
Changes in v2:
	- No changes

 drivers/staging/rdma/hfi1/diag.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c
index 0aaad74..e4cd333 100644
--- a/drivers/staging/rdma/hfi1/diag.c
+++ b/drivers/staging/rdma/hfi1/diag.c
@@ -379,6 +379,7 @@ static ssize_t diagpkt_send(struct diag_pkt *dp)
 	pio_release_cb credit_cb = NULL;
 	void *credit_arg = NULL;
 	struct diagpkt_wait *wait = NULL;
+	int trycount = 0;
 
 	dd = hfi1_lookup(dp->unit);
 	if (!dd || !(dd->flags & HFI1_PRESENT) || !dd->kregbase) {
@@ -493,8 +494,15 @@ static ssize_t diagpkt_send(struct diag_pkt *dp)
 		credit_arg = wait;
 	}
 
+retry:
 	pbuf = sc_buffer_alloc(sc, total_len, credit_cb, credit_arg);
 	if (!pbuf) {
+		if (trycount == 0) {
+			/* force a credit return and try again */
+			sc_return_credits(sc);
+			trycount = 1;
+			goto retry;
+		}
 		/*
 		 * No send buffer means no credit callback.  Undo
 		 * the wait set-up that was done above.  We free wait
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-12-01 20:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01 20:38 [PATCH v2 00/17] Driver cleanup and misc fixes series 3 Jubin John
2015-12-01 20:38 ` [PATCH v2 02/17] staging/rdma/hfi1: Decode CNP opcode Jubin John
2015-12-01 20:38 ` [PATCH v2 03/17] staging/rdma/hfi1: Add aeth name syndrome decode Jubin John
     [not found] ` <1449002306-15180-1-git-send-email-jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-12-01 20:38   ` [PATCH v2 01/17] staging/rdma/hfi1: Support alternate firmware names Jubin John
2015-12-01 20:38   ` [PATCH v2 04/17] staging/rdma/hfi1: Fix qp.h comments Jubin John
     [not found]     ` <1449002306-15180-5-git-send-email-jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-12-01 21:30       ` Jason Gunthorpe
2015-12-01 20:38   ` [PATCH v2 05/17] staging/rdma/hfi1: Clean up comments Jubin John
     [not found]     ` <1449002306-15180-6-git-send-email-jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-12-21 21:52       ` Greg KH
2015-12-01 20:38   ` [PATCH v2 06/17] staging/rdma/hfi1: Add one-time LCB reset Jubin John
2015-12-01 20:38   ` [PATCH v2 07/17] staging/rdma/hfi1: Extend quiet timeout Jubin John
2015-12-01 20:38   ` Jubin John [this message]
2015-12-01 20:38   ` [PATCH v2 09/17] staging/rdma/hfi1: Correctly limit VLs against SDMA engines Jubin John
2015-12-01 20:38   ` [PATCH v2 10/17] staging/rdma/hfi1: Adds software counters for bitfields within various error status fields Jubin John
2015-12-01 20:38   ` [PATCH v2 11/17] staging/rdma/hfi1: Destroy workqueues if hfi1_register_ib_device() call returns error Jubin John
2015-12-01 20:38   ` [PATCH v2 12/17] staging/rdma/hfi1: Unexpected link up pkey values are not an error Jubin John
2015-12-01 20:38   ` [PATCH v2 13/17] staging/rdma/hfi1: remove SPC freeze error messages Jubin John
2015-12-01 20:38   ` [PATCH v2 14/17] staging/rdma/hfi1: unknown frame messages are not errors Jubin John
2015-12-01 20:38   ` [PATCH v2 15/17] staging/rdma/hfi1: Consider VL15 MTU also when calculating the maximum VL MTU Jubin John
2015-12-01 20:38   ` [PATCH v2 16/17] staging/rdma/hfi1: Fix Xmit Wait calculation Jubin John
2015-12-01 20:38   ` [PATCH v2 17/17] staging/rdma/hfi1: Adding counter resolutions for DataPortCounters Jubin John

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=1449002306-15180-9-git-send-email-jubin.john@intel.com \
    --to=jubin.john-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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;
as well as URLs for NNTP newsgroup(s).