[Pkg-ofed-commits] [libfabric] 27/123: usnic: usdf_rdm.c: Track number of entries in tx/rx free queue.

Ana Beatriz Guerrero López ana at moszumanska.debian.org
Sat Oct 22 12:28:26 UTC 2016


This is an automated email from the git hooks/post-receive script.

ana pushed a commit to annotated tag v1.1.1
in repository libfabric.

commit 3057e46c75911cd12b14c593fba99ec79d34b5ba
Author: Ben Turrubiates <bturrubi at cisco.com>
Date:   Thu Aug 27 14:46:08 2015 -0700

    usnic: usdf_rdm.c: Track number of entries in tx/rx free queue.
    
    Add new helper functions to keep count of entries in tx/rq free queue
    when performing insertions and removals. Fixes issue where num_free_*
    entries were modified for EP_MSG rather than EP_RDM.
    
    Signed-off-by: Ben Turrubiates <bturrubi at cisco.com>
---
 prov/usnic/src/usdf_rdm.c | 54 +++++++++++++++++++++++++++++++++++++----------
 1 file changed, 43 insertions(+), 11 deletions(-)

diff --git a/prov/usnic/src/usdf_rdm.c b/prov/usnic/src/usdf_rdm.c
index 9a21fad..ab96e31 100644
--- a/prov/usnic/src/usdf_rdm.c
+++ b/prov/usnic/src/usdf_rdm.c
@@ -67,6 +67,45 @@
 #include "usdf_av.h"
 #include "usdf_progress.h"
 
+/* Functions to add and remove entries from the free list for the transmit and
+ * receive work queues.
+ */
+static struct usdf_rdm_qe *usdf_rdm_get_tx_wqe(struct usdf_tx *tx)
+{
+	struct usdf_rdm_qe *entry;
+
+	entry = TAILQ_FIRST(&tx->t.rdm.tx_free_wqe);
+	TAILQ_REMOVE(&tx->t.rdm.tx_free_wqe, entry, rd_link);
+	tx->t.rdm.tx_num_free_wqe -= 1;
+
+	return entry;
+}
+
+static void usdf_rdm_put_tx_wqe(struct usdf_tx *tx, struct usdf_rdm_qe *wqe)
+{
+	TAILQ_INSERT_HEAD(&tx->t.rdm.tx_free_wqe, wqe, rd_link);
+	tx->t.rdm.tx_num_free_wqe += 1;
+}
+
+static struct usdf_rdm_qe *usdf_rdm_get_rx_rqe(struct usdf_rx *rx)
+{
+	struct usdf_rdm_qe *entry;
+
+	entry = TAILQ_FIRST(&rx->r.rdm.rx_free_rqe);
+	TAILQ_REMOVE(&rx->r.rdm.rx_free_rqe, entry, rd_link);
+	rx->r.rdm.rx_num_free_rqe -= 1;
+
+	return entry;
+}
+
+static void usdf_rdm_put_rx_rqe(struct usdf_rx *rx, struct usdf_rdm_qe *rqe)
+{
+	TAILQ_INSERT_HEAD(&rx->r.rdm.rx_free_rqe, rqe, rd_link);
+	rx->r.rdm.rx_num_free_rqe += 1;
+}
+
+/******************************************************************************/
+
 static inline void
 usdf_rdm_rdc_ready(struct usdf_rdm_connection *rdc, struct usdf_tx *tx)
 {
@@ -433,9 +472,7 @@ usdf_rdm_recv(struct fid_ep *fep, void *buf, size_t len,
 
 	pthread_spin_lock(&udp->dom_progress_lock);
 
-	rqe = TAILQ_FIRST(&rx->r.rdm.rx_free_rqe);
-	TAILQ_REMOVE(&rx->r.rdm.rx_free_rqe, rqe, rd_link);
-	--rx->r.msg.rx_num_free_rqe;
+	rqe = usdf_rdm_get_rx_rqe(rx);
 
 	rqe->rd_context = context;
 	rqe->rd_iov[0].iov_base = buf;
@@ -493,9 +530,7 @@ usdf_rdm_send(struct fid_ep *fep, const void *buf, size_t len, void *desc,
 		return -FI_EAGAIN;
 	}
 
-	wqe = TAILQ_FIRST(&tx->t.rdm.tx_free_wqe);
-	TAILQ_REMOVE(&tx->t.rdm.tx_free_wqe, wqe, rd_link);
-	--tx->t.rdm.tx_num_free_wqe;
+	wqe = usdf_rdm_get_tx_wqe(tx);
 
 	wqe->rd_context = context;
 
@@ -1112,8 +1147,7 @@ usdf_rdm_recv_complete(struct usdf_rx *rx, struct usdf_rdm_connection *rdc,
 	hcq = rx->r.rdm.rx_hcq;
 	hcq->cqh_post(hcq, rqe->rd_context, rqe->rd_length, FI_SUCCESS);
 
-	TAILQ_INSERT_HEAD(&rx->r.rdm.rx_free_rqe, rqe, rd_link);
-	++rx->r.msg.rx_num_free_rqe;
+	usdf_rdm_put_rx_rqe(rx, rqe);
 
 	rdc->dc_cur_rqe = NULL;
 }
@@ -1287,9 +1321,7 @@ usdf_rdm_process_ack(struct usdf_rdm_connection *rdc,
 					hcq->cqh_post(hcq, wqe->rd_context,
 							wqe->rd_length, FI_SUCCESS);
 
-				TAILQ_INSERT_HEAD(&tx->t.rdm.tx_free_wqe,
-					wqe, rd_link);
-				++tx->t.rdm.tx_num_free_wqe;
+				usdf_rdm_put_tx_wqe(tx, wqe);
 
 				/* prepare for next message */
 				rdc->dc_next_tx_seq = 0;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ofed/libfabric.git



More information about the Pkg-ofed-commits mailing list