[rds-devel] [PATCH] RDS - get completions for solicited events only on receive side.

Vladimir Sokolovsky vlad at mellanox.co.il
Tue Sep 4 08:54:39 PDT 2007


RDS: get completions for solicited events only on the receive side.
 
Signed-off-by: Vladimir Sokolovsky <vlad at mellanox.co.il>
---
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index b15d357..3c0782a 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -654,13 +654,16 @@ void rds_ib_recv_cq_comp_handler(struct ib_cq *cq,
void *context)
 	struct ib_wc wc;
 	struct rds_ib_recv_work *recv;
 	u64 next_rx;
+	u32 completed;
+	u32 oldest;
+	u32 i;
 	int ret = 0;
 
 	rdsdebug("conn %p cq %p\n", conn, cq);
 
 	rds_ib_stats_inc(s_ib_rx_cq_call);
 
-	ib_req_notify_cq(cq, IB_CQ_NEXT_COMP);
+	ib_req_notify_cq(cq, IB_CQ_SOLICITED);
 
 	next_rx = conn->c_next_rx_seq;
 
@@ -670,17 +673,25 @@ void rds_ib_recv_cq_comp_handler(struct ib_cq *cq,
void *context)
 			 be32_to_cpu(wc.imm_data));
 		rds_ib_stats_inc(s_ib_rx_cq_event);
 
-		recv =
&ic->i_recvs[rds_ib_ring_oldest(&ic->i_recv_ring)];
-		rds_ib_recv_unmap_page(ic, recv);
+		oldest = rds_ib_ring_oldest(&ic->i_recv_ring);
+		recv = &ic->i_recvs[oldest];
+		completed = rds_ib_ring_completed(&ic->i_recv_ring,
wc.wr_id, oldest);
+
+		for (i = 0; i < completed; i++) {
+		    rds_ib_recv_unmap_page(ic, recv);
+
+		    if (wc.status == IB_WC_SUCCESS && !ic->i_wc_err) {
+		    	if (wc.byte_len == sizeof(struct rds_ib_ack))
+		    		rds_ib_recv_ack(conn, recv);
+		    	else
+		    		rds_ib_process_recv(conn, recv,
wc.byte_len);
+		    }
 
-		if (wc.status == IB_WC_SUCCESS && !ic->i_wc_err) {
-			if (wc.byte_len == sizeof(struct rds_ib_ack))
-				rds_ib_recv_ack(conn, recv);
-			else
-				rds_ib_process_recv(conn, recv,
wc.byte_len);
+			if (++recv ==
&ic->i_recvs[ic->i_recv_ring.w_nr])
+				recv = ic->i_recvs;
 		}
 
-		rds_ib_ring_free(&ic->i_recv_ring, 1);
+		rds_ib_ring_free(&ic->i_recv_ring, completed);
 
 		/* We expect errors as the qp is drained during shutdown
*/
 		if (wc.status != IB_WC_SUCCESS && !ic->i_wc_err) {



More information about the rds-devel mailing list