public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: frank zago <fzago-klaOcWyJdxkshyMvu7JE4pqQE7yCjDx5@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [patch 2/8] ehca - ib_post_send fixes, Updated
Date: Wed, 25 Nov 2009 10:44:41 -0600	[thread overview]
Message-ID: <4B0D5EF9.4060405@systemfabricworks.com> (raw)
In-Reply-To: <20091125023315.027350384-klaOcWyJdxkshyMvu7JE4pqQE7yCjDx5@public.gmane.org>

Always set ib_post_send()'s bad_wr.
Do not report success if an error occurred.

Signed-off-by: Frank Zago <fzago-klaOcWyJdxkshyMvu7JE4pqQE7yCjDx5@public.gmane.org>
Index: linux-2.6.31/drivers/infiniband/hw/ehca/ehca_reqs.c
===================================================================
--- linux-2.6.31.orig/drivers/infiniband/hw/ehca/ehca_reqs.c	2009-11-24 
18:59:31.000000000 -0600
+++ linux-2.6.31/drivers/infiniband/hw/ehca/ehca_reqs.c	2009-11-24 
19:49:19.000000000 -0600
@@ -400,7 +400,6 @@

  static inline int post_one_send(struct ehca_qp *my_qp,
  			 struct ib_send_wr *cur_send_wr,
-			 struct ib_send_wr **bad_send_wr,
  			 int hidden)
  {
  	struct ehca_wqe *wqe_p;
@@ -412,8 +411,6 @@
  	wqe_p = ipz_qeit_get_inc(&my_qp->ipz_squeue);
  	if (unlikely(!wqe_p)) {
  		/* too many posted work requests: queue overflow */
-		if (bad_send_wr)
-			*bad_send_wr = cur_send_wr;
  		ehca_err(my_qp->ib_qp.device, "Too many posted WQEs "
  			 "qp_num=%x", my_qp->ib_qp.qp_num);
  		return -ENOMEM;
@@ -433,8 +430,6 @@
  	 */
  	if (unlikely(ret)) {
  		my_qp->ipz_squeue.current_q_offset = start_offset;
-		if (bad_send_wr)
-			*bad_send_wr = cur_send_wr;
  		ehca_err(my_qp->ib_qp.device, "Could not write WQE "
  			 "qp_num=%x", my_qp->ib_qp.qp_num);
  		return -EINVAL;
@@ -448,7 +443,6 @@
  		   struct ib_send_wr **bad_send_wr)
  {
  	struct ehca_qp *my_qp = container_of(qp, struct ehca_qp, ib_qp);
-	struct ib_send_wr *cur_send_wr;
  	int wqe_cnt = 0;
  	int ret = 0;
  	unsigned long flags;
@@ -457,7 +451,8 @@
  	if (unlikely(my_qp->state < IB_QPS_RTS)) {
  		ehca_err(qp->device, "Invalid QP state  qp_state=%d qpn=%x",
  			 my_qp->state, qp->qp_num);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto out;
  	}

  	/* LOCK the QUEUE */
@@ -476,24 +471,21 @@
  		struct ib_send_wr circ_wr;
  		memset(&circ_wr, 0, sizeof(circ_wr));
  		circ_wr.opcode = IB_WR_RDMA_READ;
-		post_one_send(my_qp, &circ_wr, NULL, 1); /* ignore retcode */
+		post_one_send(my_qp, &circ_wr, 1); /* ignore retcode */
  		wqe_cnt++;
  		ehca_dbg(qp->device, "posted circ wr  qp_num=%x", qp->qp_num);
  		my_qp->message_count = my_qp->packet_count = 0;
  	}

  	/* loop processes list of send reqs */
-	for (cur_send_wr = send_wr; cur_send_wr != NULL;
-	     cur_send_wr = cur_send_wr->next) {
-		ret = post_one_send(my_qp, cur_send_wr, bad_send_wr, 0);
+	while(send_wr) {
+		ret = post_one_send(my_qp, send_wr, 0);
  		if (unlikely(ret)) {
-			/* if one or more WQEs were successful, don't fail */
-			if (wqe_cnt)
-				ret = 0;
  			goto post_send_exit0;
  		}
  		wqe_cnt++;
-	} /* eof for cur_send_wr */
+		send_wr = send_wr->next;
+	}

  post_send_exit0:
  	iosync(); /* serialize GAL register access */
@@ -503,6 +495,10 @@
  			 my_qp, qp->qp_num, wqe_cnt, ret);
  	my_qp->message_count += wqe_cnt;
  	spin_unlock_irqrestore(&my_qp->spinlock_s, flags);
+
+out:
+	if (ret)
+		*bad_send_wr = send_wr;
  	return ret;
  }


-- 

--
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

       reply	other threads:[~2009-11-25 16:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20091125023315.027350384@systemfabricworks.com>
     [not found] ` <20091125023315.027350384-klaOcWyJdxkshyMvu7JE4pqQE7yCjDx5@public.gmane.org>
2009-11-25 16:44   ` frank zago [this message]
2009-11-25 16:45   ` [patch 5/8] ehca - ib_post_recv fixes, Updated frank zago

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=4B0D5EF9.4060405@systemfabricworks.com \
    --to=fzago-klaocwyjdxkshymvu7je4pqqe7ycjdx5@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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