[openib-general] [PATCH][SDP][19/22] Whitespace cleanup in sdp_send.c

Tom Duffy Tom.Duffy at Sun.COM
Fri Feb 18 16:47:37 PST 2005


Signed-off-by: Tom Duffy <tduffy at sun.com>

Index: linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_send.c
===================================================================
--- linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_send.c	(revision 1836)
+++ linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_send.c	(working copy)
@@ -86,7 +86,6 @@ static int _sdp_send_buff_post(struct sd
 	 */
 	if (0 < (SDP_CONN_F_OOB_SEND & conn->flags) &&
 	    !(0xFFFF < conn->oob_offset)) {
-
 		SDP_BSDH_SET_OOB_PEND(buff->bsdh_hdr);
 		SDP_BUFF_F_SET_SE(buff);
 
@@ -98,13 +97,9 @@ static int _sdp_send_buff_post(struct sd
 	 * is set if this buffer has never had pending set.
 	 */
 	if (0 < (SDP_BUFF_F_OOB_PRES & buff->flags)) {
-
-		if (0 < conn->oob_offset) {
-
+		if (0 < conn->oob_offset)
 			SDP_BSDH_SET_OOB_PEND(buff->bsdh_hdr);
-		}
 		else {
-
 			SDP_EXPECT(!(0 > conn->oob_offset));
 			conn->oob_offset = -1;
 		}
@@ -115,21 +110,16 @@ static int _sdp_send_buff_post(struct sd
 	/*
 	 * solicite event bit.
 	 */
-	if (0 < SDP_BUFF_F_GET_SE(buff)) {
-
+	if (0 < SDP_BUFF_F_GET_SE(buff))
 		send_param.send_flags |= IB_SEND_SOLICITED;
-	}
 	/*
 	 * unsignalled event
 	 */
 	if (0 < SDP_BUFF_F_GET_UNSIG(buff) &&
 	    conn->usig_max > conn->send_cons) {
-
 		conn->send_usig++;
 		conn->send_cons++;
-	}
-	else {
-
+	} else {
 		SDP_BUFF_F_CLR_UNSIG(buff);
 		send_param.send_flags |= IB_SEND_SIGNALED;
 		conn->send_cons = 0;
@@ -138,7 +128,6 @@ static int _sdp_send_buff_post(struct sd
 	 * check queue membership. (first send attempt vs. flush)
 	 */
 	if (0 < sdp_desc_q_member((struct sdpc_desc *) buff)) {
-
 		result = sdp_desc_q_remove((struct sdpc_desc *) buff);
 		SDP_EXPECT(!(0 > result));
 	}
@@ -147,7 +136,6 @@ static int _sdp_send_buff_post(struct sd
 	 */
 	result = sdp_buff_q_put_tail(&conn->send_post, buff);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> queueing send buffer", result);
 		goto done;
 	}
@@ -167,7 +155,6 @@ static int _sdp_send_buff_post(struct sd
 
 	result = ib_post_send(conn->qp, &send_param, &bad_wr);
 	if (0 != result) {
-
 		sdp_dbg_warn(conn, 
 			     "Error <%d> posting send. <%d:%d> <%d:%d:%d>",
 			     result, conn->s_wq_cur, conn->s_wq_size,
@@ -182,13 +169,11 @@ static int _sdp_send_buff_post(struct sd
 	 * source cancels require us to save the sequence number
 	 * for validation of the cancel's completion.
 	 */
-	if (0 < (SDP_CONN_F_SRC_CANCEL_L & conn->flags)) {
-
+	if (0 < (SDP_CONN_F_SRC_CANCEL_L & conn->flags))
 		conn->src_cseq =
 		    ((SDP_MID_SRC_CANCEL ==
 		      buff->bsdh_hdr->mid) ? buff->bsdh_hdr->seq_num : conn->
 		     src_cseq);
-	}
 
 	return 0;
 done:
@@ -221,20 +206,17 @@ static int _sdp_send_data_buff_post(stru
 	 * 3) buffer from head of queue or as parameter
 	 * 4) nodelay check.
 	 */
-	if (3 > conn->r_recv_bf || 0 < conn->src_sent) {
-
+	if (3 > conn->r_recv_bf || 0 < conn->src_sent)
 		return ENOBUFS;
-	}
 	/*
 	 * The rest of the checks can proceed if there is a signalled event
 	 * in the pipe, otherwise we could stall...
 	 */
 	if (conn->send_usig < sdp_buff_q_size(&conn->send_post) ||
 	    0 < sdp_desc_q_size(&conn->w_snk)) {
-
 		if (buff->tail < buff->end &&
 		    0 == (SDP_BUFF_F_OOB_PRES & buff->flags) &&
-		    0 == conn->nodelay) {
+		    0 == conn->nodelay)
 			/*
 			 * If the buffer is not full, and there is already
 			 * data in the SDP pipe, then hold on to the buffer
@@ -243,7 +225,6 @@ static int _sdp_send_data_buff_post(stru
 			 * flush once it's full, which ever comes first.
 			 */
 			return ENOBUFS;
-		}
 		/*
 		 * slow start to give sink advertisments a chance for
 		 * asymmetric connections. This is desirable to offload
@@ -256,13 +237,9 @@ static int _sdp_send_data_buff_post(stru
 			 * sink advertisments.
 			 */
 			if (conn->send_cq_size > conn->s_wq_cur) {
-
-				if (SDP_SEND_POST_COUNT > conn->s_wq_par) {
-
+				if (SDP_SEND_POST_COUNT > conn->s_wq_par)
 					conn->s_wq_par++;
-				}
 				else {
-
 					conn->s_wq_cur++;
 					conn->s_wq_par = 0;
 				}
@@ -306,17 +283,13 @@ static int _sdp_send_data_buff_post(stru
 		 * update sink advertisments.
 		 */
 		conn->snk_recv--;
-	}
-	else {
-
+	} else
 		conn->nond_send++;
-	}
 	/*
 	 * transmision time
 	 */
 	result = _sdp_send_buff_post(conn, buff);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> posting send data buffer",
 			     result);
 		goto error;
@@ -346,17 +319,13 @@ static int _sdp_send_data_buff_snk(struc
 	 *
 	 * 1) sufficient send resources.
 	 */
-	if (!(conn->send_cq_size > conn->s_wq_size)) {
-
+	if (!(conn->send_cq_size > conn->s_wq_size))
 		return ENOBUFS;
-	}
 	/*
 	 * confirm type
 	 */
-	if (SDP_DESC_TYPE_BUFF != buff->type) {
-
+	if (SDP_DESC_TYPE_BUFF != buff->type)
 		return -ENOBUFS;
-	}
 	/*
 	 * nodelay buffering
 	 */
@@ -377,10 +346,8 @@ static int _sdp_send_data_buff_snk(struc
 	 * get advertisment.
 	 */
 	advt = sdp_advt_q_look(&conn->snk_pend);
-	if (NULL == advt) {
-
+	if (NULL == advt)
 		return ENOBUFS;
-	}
 	/*
 	 * signalled? With no delay turned off, data transmission may be
 	 * waiting for a send completion.
@@ -411,14 +378,12 @@ static int _sdp_send_data_buff_snk(struc
 	 * dequeue if needed and the queue buffer
 	 */
 	if (0 < sdp_desc_q_member((struct sdpc_desc *) buff)) {
-
 		result = sdp_desc_q_remove((struct sdpc_desc *) buff);
 		SDP_EXPECT(!(0 > result));
 	}
 
 	result = sdp_desc_q_put_tail(&conn->w_snk, (struct sdpc_desc *)buff);
         if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> queueing write buffer. <%d>",
 			     result, sdp_desc_q_size(&conn->w_snk));
 		goto error;
@@ -439,7 +404,6 @@ static int _sdp_send_data_buff_snk(struc
 
 	result = ib_post_send(conn->qp, &send_param, &bad_wr);
 	if (0 != result) {
-
 		sdp_dbg_warn(conn, "Error <%d> posting rdma write", result);
 
 		conn->s_wq_size--;
@@ -450,7 +414,6 @@ static int _sdp_send_data_buff_snk(struc
 	 * advertisment.
 	 */
 	if (conn->send_size > advt->size) {
-
 		advt = sdp_advt_q_get(&conn->snk_pend);
 		SDP_EXPECT((NULL != advt));
 
@@ -461,7 +424,6 @@ static int _sdp_send_data_buff_snk(struc
 
 		result = sdp_send_ctrl_rdma_wr(conn, zcopy);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> completing sink. <%d>",
 				     result, zcopy);
 			result = -ENODEV;
@@ -500,7 +462,6 @@ static int _sdp_send_data_iocb_snk(struc
 	 */
 	result = sdp_iocb_register(iocb, conn);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> registering IOCB. <%d:%d>",
 			     result, iocb->key, iocb->len);
 		goto error;
@@ -513,10 +474,8 @@ static int _sdp_send_data_iocb_snk(struc
 		 * get the pending sink advertisment.
 		 */
 		advt = sdp_advt_q_look(&conn->snk_pend);
-		if (NULL == advt) {
-
+		if (NULL == advt)
 			break;
-		}
 		/*
 		 * amount of data to zcopy.
 		 */
@@ -562,7 +521,6 @@ static int _sdp_send_data_iocb_snk(struc
 
 		result = ib_post_send(conn->qp, &send_param, &bad_wr);
 		if (0 != result) {
-
 			sdp_dbg_warn(conn, "Error <%d> posting rdma write",
 				     result);
 
@@ -576,14 +534,11 @@ static int _sdp_send_data_iocb_snk(struc
 		 * outstanding sink advertisment to see how the advt
 		 * size remaining is picked.)
 		 */
-		if (!(conn->send_size > advt->size)) {
-
+		if (!(conn->send_size > advt->size))
 			continue;
-		}
 
 		advt = sdp_advt_q_get(&conn->snk_pend);
 		if (NULL == advt) {
-
 			sdp_dbg_warn(conn, "sink advertisment disappeared.");
 			result = -ENODEV;
 			goto error;
@@ -596,7 +551,6 @@ static int _sdp_send_data_iocb_snk(struc
 
 		result = sdp_send_ctrl_rdma_wr(conn, zcopy);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> completing sink. <%d>",
 				     result, zcopy);
 			result = -ENODEV;
@@ -629,34 +583,22 @@ static int _sdp_send_data_iocb_src(struc
 	 * 1) local source cancel is pending
 	 * 2) sufficient send credits for buffered transmission.
 	 */
-	if (0 < (SDP_CONN_F_SRC_CANCEL_L & conn->flags) ||
-	    3 > conn->r_recv_bf) {
-
+	if (0 < (SDP_CONN_F_SRC_CANCEL_L & conn->flags) || 3 > conn->r_recv_bf)
 		return ENOBUFS;
-	}
 
 	switch (conn->send_mode) {
 	case SDP_MODE_PIPE:
-
-		if (!(conn->s_cur_adv > conn->src_sent)) {
-
+		if (!(conn->s_cur_adv > conn->src_sent))
 			return ENOBUFS;
-		}
 
 		if (conn->s_cur_adv < conn->r_max_adv) {
-
 			if (!(SDP_SEND_POST_FRACTION > conn->s_par_adv)) {
-
 				conn->s_cur_adv++;
 				conn->s_par_adv = 0;
 			}
-			else {
-
+			else
 				conn->s_par_adv++;
-			}
-		}
-		else {
-
+		} else {
 			conn->s_cur_adv = conn->r_max_adv;
 			conn->s_par_adv = 0;
 		}
@@ -667,15 +609,10 @@ static int _sdp_send_data_iocb_src(struc
 #endif
 		break;
 	case SDP_MODE_COMB:
-
-		if (0 < conn->src_sent) {
-
+		if (0 < conn->src_sent)
 			return ENOBUFS;
-		}
-
 		break;
 	default:
-
 		sdp_dbg_warn(conn, "Unexpected SrcAvail mode. <%d>",
 			     conn->send_mode);
 		return -EPROTO;
@@ -685,7 +622,6 @@ static int _sdp_send_data_iocb_src(struc
 	 */
 	buff = sdp_buff_pool_get();
 	if (NULL == buff) {
-
 		sdp_dbg_warn(conn, "Error allocating SrcAvail buffer. <%d>",
 			     iocb->key);
 		return -ENOMEM;
@@ -697,7 +633,6 @@ static int _sdp_send_data_iocb_src(struc
 	 */
 	result = sdp_iocb_register(iocb, conn);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> registering IOCB. <%d:%d>",
 			     result, iocb->key, iocb->len);
 		goto drop;
@@ -739,7 +674,6 @@ static int _sdp_send_data_iocb_src(struc
 		len = min(SDP_SRC_AVAIL_MIN, (int)(PAGE_SIZE - off));
 
 		if (len > iocb->len) {
-
 			sdp_dbg_warn(conn, "Data <%d:%d:%d> from IOCB <%d:%d>",
 				     len, pos, off,
 				     iocb->page_count, 
@@ -753,7 +687,6 @@ static int _sdp_send_data_iocb_src(struc
 		 */
 		addr = __sdp_kmap(iocb->page_array[pos]);
 		if (NULL == addr) {
-
 			result = -ENOMEM;
 			goto error;
 		}
@@ -782,7 +715,6 @@ static int _sdp_send_data_iocb_src(struc
 	 */
 	result = _sdp_send_buff_post(conn, buff);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> posting SrcAvail for IOCB <%d>",
 			     result, iocb->key);
 		goto release;
@@ -828,10 +760,8 @@ static int _sdp_send_iocb_buff_write(str
 		 * map correct page of iocb
 		 */
 		addr = __sdp_kmap(iocb->page_array[counter]);
-		if (NULL == addr) {
-
+		if (NULL == addr)
 			break;
-		}
 		
 		copy = min((PAGE_SIZE - offset),
 			   (unsigned long)(buff->end - buff->tail));
@@ -867,10 +797,8 @@ static int _sdp_send_data_iocb_buff(stru
 	SDP_CHECK_NULL(conn, -EINVAL);
 	SDP_CHECK_NULL(iocb, -EINVAL);
 
-	if (0 < conn->src_sent) {
-
+	if (0 < conn->src_sent)
 		return ENOBUFS;
-	}
 	/*
 	 * loop through queued buffers and copy them to the destination
 	 */
@@ -884,7 +812,6 @@ static int _sdp_send_data_iocb_buff(stru
 		 */
 		buff = sdp_buff_pool_get();
 		if (NULL == buff) {
-
 			result = -ENOMEM;
 			goto error;
 		}
@@ -906,7 +833,6 @@ static int _sdp_send_data_iocb_buff(stru
 		 */
 		result =_sdp_send_iocb_buff_write(iocb, buff);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> copy from IOCB <%d>.",
 				     result, iocb->key);
 			goto drop;
@@ -922,7 +848,6 @@ static int _sdp_send_data_iocb_buff(stru
 		 */
 		result = _sdp_send_buff_post(conn, buff);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> send queue buff post",
 				     result);
 			goto drop;
@@ -946,22 +871,17 @@ static int _sdp_send_data_iocb(struct sd
 	SDP_CHECK_NULL(conn, -EINVAL);
 	SDP_CHECK_NULL(iocb, -EINVAL);
 
-	if (!(conn->send_cq_size > conn->s_wq_size)) {
-
+	if (!(conn->send_cq_size > conn->s_wq_size))
 		goto done;
-	}
 	/*
 	 * confirm IOCB usage.
 	 */
-	if (SDP_DESC_TYPE_IOCB != iocb->type) {
-
+	if (SDP_DESC_TYPE_IOCB != iocb->type)
 		return -ENOBUFS;
-	}
 	/*
 	 * determin if we are sending Buffered, Source or Sink.
 	 */
 	if (0 < sdp_advt_q_size(&conn->snk_pend)) {
-
 		result = _sdp_send_data_iocb_snk(conn, iocb);
 		if (0 == result) {
 			/*
@@ -970,7 +890,6 @@ static int _sdp_send_data_iocb(struct sd
 			 * failure or partial processing.
 			 */
 			if (0 < sdp_desc_q_member((struct sdpc_desc *)iocb)) {
-
 				result =
 				    sdp_desc_q_remove((struct sdpc_desc *)
 							    iocb);
@@ -980,7 +899,6 @@ static int _sdp_send_data_iocb(struct sd
 			result = sdp_desc_q_put_tail(&conn->w_snk,
 						     (struct sdpc_desc *) iocb);
 			if (0 > result) {
-
 				sdp_dbg_warn(conn, 
 					     "Error <%d> queuing write IOCB.",
 					     result);
@@ -994,22 +912,18 @@ static int _sdp_send_data_iocb(struct sd
 	 * hope that a new sink advertisment will arrive, because 
 	 * sinks are more efficient.
 	 */
-	if (0 < sdp_desc_q_size(&conn->w_snk)) {
-
+	if (0 < sdp_desc_q_size(&conn->w_snk))
 		goto done;
-	}
 
 	if (conn->src_zthresh > iocb->len ||
 	    SDP_MODE_BUFF == conn->send_mode ||
 	    0 < (SDP_IOCB_F_BUFF & iocb->flags)) {
-
 		result = _sdp_send_data_iocb_buff(conn, iocb);
 		if (0 == result) {
 			/*
 			 * complete this IOCB
 			 */
 			if (0 < sdp_desc_q_member((struct sdpc_desc *) iocb)) {
-
 				result = sdp_desc_q_remove((struct sdpc_desc *) iocb);
 				SDP_EXPECT(!(0 > result));
 			}
@@ -1018,12 +932,10 @@ static int _sdp_send_data_iocb(struct sd
 			SDP_CONN_STAT_WQ_DEC(conn, iocb->size);
 
 			result = sdp_iocb_complete(iocb, 0);
-			if (0 > result) {
-
+			if (0 > result)
 				sdp_dbg_warn(conn, 
 					     "Error <%d> completing iocb <%d>",
 					     result, iocb->key);
-			}
 		}
 
 		goto done;
@@ -1035,18 +947,15 @@ static int _sdp_send_data_iocb(struct sd
 		 * queue IOCB
 		 */
 		if (0 < sdp_desc_q_member((struct sdpc_desc *) iocb)) {
-
 			result = sdp_desc_q_remove((struct sdpc_desc *)iocb);
 			SDP_EXPECT(!(0 > result));
 		}
 
 		result = sdp_iocb_q_put_tail(&conn->w_src, iocb);
-		if (0 > result) {
-
+		if (0 > result)
 			sdp_dbg_warn(conn, "Error <%d> queueing write <%d:%d>",
 				     result, iocb->key,
 				     sdp_iocb_q_size(&conn->w_src));
-		}
 	}
 
 done:
@@ -1069,27 +978,19 @@ static int _sdp_send_data_queue_test(str
 	 * 2) source advertisment cancel in progress.
 	 */
 	if (0 == (SDP_ST_MASK_SEND_OK & conn->state) ||
-	    0 < (SDP_CONN_F_SRC_CANCEL_L & conn->flags)) {
-
+	    0 < (SDP_CONN_F_SRC_CANCEL_L & conn->flags))
 		return ENOBUFS;
-	}
-
-	if (SDP_DESC_TYPE_IOCB == element->type) {
 
+	if (SDP_DESC_TYPE_IOCB == element->type)
 		return _sdp_send_data_iocb(conn, (struct sdpc_iocb *)element);
-	}
 
 	if (0 == sdp_advt_q_look(&conn->snk_pend) ||
-	    (SDP_BUFF_F_OOB_PRES & ((struct sdpc_buff *)element)->flags)) {
-
+	    (SDP_BUFF_F_OOB_PRES & ((struct sdpc_buff *)element)->flags))
 		result = _sdp_send_data_buff_post(conn,
 						  (struct sdpc_buff *)element);
-	}
-	else {
-
+	else
 		result = _sdp_send_data_buff_snk(conn,
 						 (struct sdpc_buff *)element);
-	}
 
 	return result;
 } /* _sdp_send_data_queue_test */
@@ -1108,22 +1009,17 @@ static int _sdp_send_data_queue_flush(st
 	 * non-zero result is generated.
 	 * (positive: no space; negative: error)
 	 */
-	while (!result &&
-	       0 < sdp_desc_q_size(&conn->send_queue)) {
-
+	while (!result && 0 < sdp_desc_q_size(&conn->send_queue)) {
 		element = sdp_desc_q_look_head(&conn->send_queue);
 		SDP_EXPECT((NULL != element));
 
 		result = _sdp_send_data_queue_test(conn, element);
-		if (!result) {
-
+		if (!result)
 			continue;
-		}
 		/*
 		 * error
 		 */
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> post data during flush",
 				     result);
 			/*
@@ -1132,7 +1028,6 @@ static int _sdp_send_data_queue_flush(st
 			 * element, and not know how to requeue it.
 			 */
 			if (0 == sdp_desc_q_member(element)) {
-
 				result = sdp_desc_q_put_head(&conn->send_queue,
 							     element);
 				SDP_EXPECT(!(0 > result));
@@ -1162,10 +1057,8 @@ static int _sdp_send_data_queue(struct s
 	 */
 	if (0 < sdp_desc_q_size(&conn->send_queue) ||
 	    0 < (result = _sdp_send_data_queue_test(conn, element))) {
-
 		result = sdp_desc_q_put_tail(&conn->send_queue, element);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> queueing data for send",
 				     result);
 			goto done;
@@ -1176,11 +1069,9 @@ static int _sdp_send_data_queue(struct s
 		if (SDP_MODE_COMB == conn->send_mode &&
 		    !(SDP_INET_SEND_MODE >
 		      sdp_desc_q_size(&conn->send_queue))) {
-
 			result = sdp_send_ctrl_mode_ch(conn,
 						       SDP_MSG_MCH_PIPE_RECV);
 			if (0 > result) {
-
 				sdp_dbg_warn(conn, 
 					     "Error <%d> posting mode change",
 					     result);
@@ -1190,7 +1081,6 @@ static int _sdp_send_data_queue(struct s
 	}
 
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> during data send posting",
 			     result);
 		goto done;
@@ -1218,10 +1108,8 @@ static __inline__ struct sdpc_buff *_sdp
 	if (NULL == buff ||
 	    buff->tail == buff->end ||
 	    0 < (SDP_BUFF_F_OOB_PRES & buff->flags)) {
-
 		buff = sdp_buff_pool_get();
 		if (NULL != buff) {
-
 			buff->tail = buff->end - conn->send_size;
 			buff->data = buff->tail;
 		}
@@ -1247,13 +1135,11 @@ static __inline__ int _sdp_send_data_buf
 	 * See note on send OOB implementation in SendBuffPost.
 	 */
 	if (0 < urg) {
-
 		buff->flags |= SDP_BUFF_F_OOB_PRES;
 		/*
 		 * The OOB PEND and PRES flags need to match up as pairs.
 		 */
 		if (0 > conn->oob_offset) {
-
 			conn->oob_offset = conn->send_pipe + size;
 			conn->flags |= SDP_CONN_F_OOB_SEND;
 		}
@@ -1263,13 +1149,10 @@ static __inline__ int _sdp_send_data_buf
 	 * buffer and dosn't need to be queued now.
 	 */
 	if (0 < (SDP_BUFF_F_QUEUED & buff->flags)) {
-
 		buff->data_size += size;
 		conn->send_qud += size;
 		conn->send_pipe += size;
-	}
-	else {
-
+	} else {
 		buff->data_size = buff->tail - buff->data;
 		conn->send_qud += buff->data_size;
 		conn->send_pipe += buff->data_size;
@@ -1280,7 +1163,6 @@ static __inline__ int _sdp_send_data_buf
 		 */
 		result = _sdp_send_data_queue(conn, (struct sdpc_desc *) buff);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> buffer to SEND queue.",
 				     result);
 
@@ -1310,16 +1192,13 @@ static int _sdp_send_ctrl_buff_test(stru
 	if (0 == (SDP_ST_MASK_CTRL_OK & conn->state) ||
 	    !(conn->send_cq_size > conn->s_wq_size) ||
 	    !(0 < conn->r_recv_bf) ||
-	    (conn->l_recv_bf == conn->l_advt_bf && 1 == conn->r_recv_bf)) {
-
+	    (conn->l_recv_bf == conn->l_advt_bf && 1 == conn->r_recv_bf))
 		return ENOBUFS;
-	}
 	/*
 	 * post the control buffer
 	 */
 	result = _sdp_send_buff_post(conn, buff);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> posting control send", result);
 		goto error;
 	}
@@ -1343,25 +1222,20 @@ static int _sdp_send_ctrl_buff_flush(str
 	 * result is generated. (positive: no space; negative: error)
 	 */
 	while (!result && 0 < sdp_desc_q_size(&conn->send_ctrl)) {
-		
 		element = sdp_desc_q_look_head(&conn->send_ctrl);
 		SDP_EXPECT((NULL != element));
 
 		result = _sdp_send_ctrl_buff_test(conn, 
 						  (struct sdpc_buff *)element);
-		if (!result) {
-
+		if (!result)
 			continue;
-		}
 
 		if (0 > result) {
-			
 			sdp_dbg_warn(conn,
 				     "Error <%d> failed to flush control msg",
 				     result);
 
 			if (0 == sdp_desc_q_member(element)) {
-
 				result = sdp_desc_q_put_head(&conn->send_ctrl,
 							     element);
 				SDP_EXPECT(!(0 > result));
@@ -1393,7 +1267,6 @@ static int _sdp_send_ctrl_buff_buffered(
 		result = sdp_desc_q_put_tail(&conn->send_ctrl,
 					     (struct sdpc_desc *)buff);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> queueing control buff",
 				     result);
 			goto error;
@@ -1401,7 +1274,6 @@ static int _sdp_send_ctrl_buff_buffered(
 	}
 
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> during control send posting",
 			     result);
 		goto error;
@@ -1430,7 +1302,6 @@ static int _sdp_send_ctrl_buff(struct sd
 	 */
 	buff = sdp_buff_pool_get();
 	if (NULL == buff) {
-
 		sdp_dbg_warn(conn, "Failed to allocate buffer for control");
 		result = -ENOMEM;
 		goto error;
@@ -1446,31 +1317,22 @@ static int _sdp_send_ctrl_buff(struct sd
 	/*
 	 * solicite event flag for IB sends.
 	 */
-	if (se) {
-
+	if (se)
 		SDP_BUFF_F_SET_SE(buff);
-	}
-	else {
-
+	else
 		SDP_BUFF_F_CLR_SE(buff);
-	}
 	/*
 	 * try for unsignalled?
 	 */
-	if (sig) {
-
+	if (sig)
 		SDP_BUFF_F_CLR_UNSIG(buff);
-	}
-	else {
-
+	else
 		SDP_BUFF_F_SET_UNSIG(buff);
-	}
 	/*
 	 * Either post a send, or buffer the packet in the tx queue
 	 */
 	result = _sdp_send_ctrl_buff_buffered(conn, buff);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> posting control message",
 			     result);
 		(void)sdp_buff_pool_put(buff);
@@ -1495,7 +1357,6 @@ static int _sdp_send_ctrl_disconnect(str
 	 */
 	buff = sdp_buff_pool_get();
 	if (NULL == buff) {
-
 		sdp_dbg_warn(conn, "Failed to allocate buffer for disconnect");
 		result = -ENOMEM;
 		goto error;
@@ -1521,7 +1382,6 @@ static int _sdp_send_ctrl_disconnect(str
 	 */
 	result = _sdp_send_ctrl_buff_buffered(conn, buff);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> posting control message",
 			     result);
 		goto error;
@@ -1548,26 +1408,19 @@ int sdp_send_ctrl_disconnect(struct sdp_
 	 * sent once data is flushed.
 	 */
 	if (0 < (SDP_ST_MASK_DIS_PEND & conn->state)) {
-
 		if (0 == (SDP_CONN_F_DIS_HOLD & conn->flags) &&
 		    0 == sdp_desc_q_size(&conn->send_queue) &&
-		    0 == conn->src_sent) {
-
+		    0 == conn->src_sent)
 			result = _sdp_send_ctrl_disconnect(conn);
-		}
 		else {
-
 			sdp_dbg_ctrl(conn, "defer disconnect <%d:%d> <%08x>",
 				     sdp_desc_q_size(&conn->send_queue),
 				     conn->src_sent, conn->flags);
 
 			result = 0;
 		}
-	}
-	else {
-
+	} else
 		result = -EPROTO;
-	}
 	return result;
 } /* sdp_send_ctrl_disconnect */
 
@@ -1588,10 +1441,8 @@ int sdp_send_ctrl_ack(struct sdp_opt *co
 	 */
 	if (0 < sdp_desc_q_size(&conn->send_ctrl) ||
 	    (0 < sdp_desc_q_size(&conn->send_queue) &&
-	     2 < conn->l_advt_bf)) {
-
+	     2 < conn->l_advt_bf))
 		return 0;
-	}
 
 	return _sdp_send_ctrl_buff(conn, SDP_MID_DATA, 0, 0);
 } /* sdp_send_ctrl_ack */
@@ -1656,7 +1507,6 @@ int sdp_send_ctrl_resize_buff_ack(struct
 	 */
 	buff = sdp_buff_pool_get();
 	if (NULL == buff) {
-
 		sdp_dbg_warn(conn, "Failed to allocate buffer for resize ack");
 		result = -ENOMEM;
 		goto error;
@@ -1684,7 +1534,6 @@ int sdp_send_ctrl_resize_buff_ack(struct
 	 */
 	result = _sdp_send_ctrl_buff_buffered(conn, buff);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> posting control message",
 			     result);
 		(void)sdp_buff_pool_put(buff);
@@ -1708,7 +1557,6 @@ int sdp_send_ctrl_rdma_rd(struct sdp_opt
 	 * check size
 	 */
 	if (0 > size) {
-
 		sdp_dbg_warn(conn, "RDMA read completion <%d> too small.",
 			     size);
 		return -ERANGE;
@@ -1719,7 +1567,6 @@ int sdp_send_ctrl_rdma_rd(struct sdp_opt
 	 */
 	buff = sdp_buff_pool_get();
 	if (NULL == buff) {
-
 		sdp_dbg_warn(conn, "Failed to allocate buffer for RDMA rd");
 		result = -ENOMEM;
 		goto error;
@@ -1757,7 +1604,6 @@ int sdp_send_ctrl_rdma_rd(struct sdp_opt
 	 */
 	result = _sdp_send_ctrl_buff_buffered(conn, buff);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> posting control message",
 			     result);
 		(void)sdp_buff_pool_put(buff);
@@ -1783,7 +1629,6 @@ int sdp_send_ctrl_rdma_wr(struct sdp_opt
 	 */
 	buff = sdp_buff_pool_get();
 	if (NULL == buff) {
-
 		sdp_dbg_warn(conn, "Failed to allocate buffer for RDMA wr");
 		result = -ENOMEM;
 		goto error;
@@ -1817,7 +1662,6 @@ int sdp_send_ctrl_rdma_wr(struct sdp_opt
 	 */
 	result = _sdp_send_ctrl_buff_buffered(conn, buff);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> posting control message",
 			     result);
 		(void)sdp_buff_pool_put(buff);
@@ -1844,7 +1688,6 @@ int sdp_send_ctrl_snk_avail(struct sdp_o
 	 * check mode
 	 */
 	if (SDP_MODE_PIPE != conn->recv_mode) {
-
 		result = -EPROTO;
 		goto error;
 	}
@@ -1854,7 +1697,6 @@ int sdp_send_ctrl_snk_avail(struct sdp_o
 	 */
 	buff = sdp_buff_pool_get();
 	if (NULL == buff) {
-
 		sdp_dbg_warn(conn, "Failed to allocate buffer for SnkAvail");
 		result = -ENOMEM;
 		goto error;
@@ -1886,7 +1728,6 @@ int sdp_send_ctrl_snk_avail(struct sdp_o
 	 */
 	result = _sdp_send_ctrl_buff_buffered(conn, buff);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> posting control message",
 			     result);
 		goto error;
@@ -1911,29 +1752,23 @@ int sdp_send_ctrl_mode_ch(struct sdp_opt
 	 * validate that the requested mode transition is OK.
 	 */
 	switch (mode) {
-
 	case SDP_MSG_MCH_BUFF_RECV:	/* source to sink */
-
 		conn->send_mode = ((SDP_MODE_COMB == conn->send_mode) ?
 				   SDP_MODE_BUFF : SDP_MODE_ERROR);
 		break;
 	case SDP_MSG_MCH_COMB_SEND:	/* sink to source */
-
 		conn->recv_mode = ((SDP_MODE_BUFF == conn->recv_mode) ?
 				   SDP_MODE_COMB : SDP_MODE_ERROR);
 		break;
 	case SDP_MSG_MCH_PIPE_RECV:	/* source to sink */
-
 		conn->send_mode = ((SDP_MODE_COMB == conn->send_mode) ?
 				   SDP_MODE_PIPE : SDP_MODE_ERROR);
 		break;
 	case SDP_MSG_MCH_COMB_RECV:	/* source to sink */
-
 		conn->send_mode = ((SDP_MODE_PIPE == conn->send_mode) ?
 				   SDP_MODE_COMB : SDP_MODE_ERROR);
 		break;
 	default:
-
 		sdp_dbg_warn(conn, "Invalid mode transition <%d:%d:%d>",
 			     mode, conn->send_mode, conn->recv_mode);
 		result = -EPROTO;
@@ -1942,7 +1777,6 @@ int sdp_send_ctrl_mode_ch(struct sdp_opt
 
 	if (SDP_MODE_ERROR == conn->send_mode ||
 	    SDP_MODE_ERROR == conn->recv_mode) {
-
 		sdp_dbg_warn(conn, "mode transition error <%d:%d:%d>",
 			     mode, conn->send_mode, conn->recv_mode);
 		result = -EPROTO;
@@ -1954,7 +1788,6 @@ int sdp_send_ctrl_mode_ch(struct sdp_opt
 	 */
 	buff = sdp_buff_pool_get();
 	if (NULL == buff) {
-
 		sdp_dbg_warn(conn, "Failed to allocate buffer for ModeChange");
 		result = -ENOMEM;
 		goto error;
@@ -1982,7 +1815,6 @@ int sdp_send_ctrl_mode_ch(struct sdp_opt
 	 */
 	result = _sdp_send_ctrl_buff_buffered(conn, buff);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> posting control message",
 			     result);
 		(void)sdp_buff_pool_put(buff);
@@ -2006,14 +1838,10 @@ static int _sdp_write_src_lookup(struct 
 
 	SDP_CHECK_NULL(element, -EINVAL);
 
-	if (SDP_DESC_TYPE_IOCB == element->type && iocb->key == req->ki_key) {
-
+	if (SDP_DESC_TYPE_IOCB == element->type && iocb->key == req->ki_key)
 		return 0;
-	}
-	else {
-
+	else
 		return -ERANGE;
-	}
 } /* _sdp_write_src_lookup */
 
 /*
@@ -2031,10 +1859,7 @@ static int _sdp_inet_write_cancel(struct
 	sdp_dbg_ctrl(NULL, "Cancel Write IOCB user <%d> key <%d> flag <%08lx>",
 		     req->ki_users, req->ki_key, req->ki_flags);
 	
-	if (NULL == si ||
-	    NULL == si->sock ||
-	    NULL == si->sock->sk) {
-		
+	if (NULL == si || NULL == si->sock || NULL == si->sock->sk) {
 		sdp_warn("Cancel empty write IOCB users <%d> flags <%d:%08lx>",
 			 req->ki_users, req->ki_key, req->ki_flags);
 		result = -EFAULT;
@@ -2065,36 +1890,28 @@ static int _sdp_inet_write_cancel(struct
 		SDP_EXPECT(!(0 > result));
 		
 		if (0 < (SDP_IOCB_F_ACTIVE & iocb->flags)) {
-
 			if (0 < (SDP_IOCB_F_RDMA_W & iocb->flags)) {
-				
 				result = sdp_desc_q_put_tail(&conn->w_snk,
 							     (struct sdpc_desc *)iocb);
 				SDP_EXPECT(!(0 > result));
-			}
-			else {
-
+			} else {
 				SDP_EXPECT((SDP_IOCB_F_RDMA_R & iocb->flags));
 
 				result = sdp_iocb_q_put_tail(&conn->w_src,
 							     iocb);
 				SDP_EXPECT(!(0 > result));
 			}
-		}
-		else {
+		} else {
 			/*
 			 * empty IOCBs can be deleted, while partials
 			 * needs to be compelted.
 			 */
 			if (0 < iocb->post) {
-
 				result = sdp_iocb_complete(iocb, 0);
 				SDP_EXPECT(!(0 > result));
 
 				result = -EAGAIN;
-			}
-			else {
-
+			} else {
 				result = sdp_iocb_destroy(iocb);
 				SDP_EXPECT(!(0 > result));
 				/*
@@ -2117,7 +1934,6 @@ static int _sdp_inet_write_cancel(struct
 						     req);
 
 	if (NULL != iocb) {
-
 		iocb->flags |= SDP_IOCB_F_CANCEL;
 		result = -EAGAIN;
 
@@ -2142,12 +1958,10 @@ static int _sdp_inet_write_cancel(struct
 		 */
 		if (0 == (SDP_CONN_F_SRC_CANCEL_L & conn->flags) &&
 		    0 == (SDP_IOCB_F_CANCEL & iocb->flags)) {
-
 			conn->src_cncl++;
 			iocb->flags |= SDP_IOCB_F_CANCEL;
 
 			if (conn->src_cncl == sdp_iocb_q_size(&conn->w_src)) {
-
 				result = sdp_send_ctrl_src_cancel(conn);
 				SDP_EXPECT(!(0 > result));
 
@@ -2196,7 +2010,6 @@ static int _sdp_send_flush_advt(struct s
 		 */
 		advt = sdp_advt_q_look(&conn->snk_pend);
 		if (NULL != advt && 0 < advt->post) {
-
 			advt = sdp_advt_q_get(&conn->snk_pend);
 			SDP_EXPECT((NULL != advt));
 
@@ -2230,7 +2043,6 @@ int sdp_send_flush(struct sdp_opt *conn)
 	 */
 	result = _sdp_send_ctrl_buff_flush(conn);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> flushing control", result);
 		goto done;
 	}
@@ -2239,7 +2051,6 @@ int sdp_send_flush(struct sdp_opt *conn)
 	 */
 	result = _sdp_send_data_queue_flush(conn);
 	if (0 > result) {
-
 		sdp_dbg_warn(conn, "Error <%d> flushing data queue", result);
 		goto done;
 	}
@@ -2247,10 +2058,8 @@ int sdp_send_flush(struct sdp_opt *conn)
 	 * Sink advertisment flush.
 	 */
 	if (0 < sdp_advt_q_size(&conn->snk_pend)) {
-
 		result = _sdp_send_flush_advt(conn);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn,
 				     "Error <%d> flushing sink advertisments",
 				     result);
@@ -2261,10 +2070,8 @@ int sdp_send_flush(struct sdp_opt *conn)
 	 * disconnect flush
 	 */
 	if (0 < (SDP_ST_MASK_DIS_PEND & conn->state)) {
-
 		result = sdp_send_ctrl_disconnect(conn);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> flushing disconnect",
 				     result);
 			goto done;
@@ -2322,7 +2129,6 @@ int sdp_inet_send(struct kiocb *req,
 	 * is opened on sucessful connect, or error on an unsucessful attempt.
 	 */
 	if (0 < (SDP_ST_MASK_CLOSED & conn->istate)) {
-
 		result = -EPIPE;
 		goto done;
 	}
@@ -2332,11 +2138,8 @@ int sdp_inet_send(struct kiocb *req,
 	 * they are smaller then the zopy threshold, but only if there is
 	 * no buffer write space.
 	 */
-	if (!(conn->src_zthresh > size) &&
-	    !is_sync_kiocb(req)) {
-		
+	if (!(conn->src_zthresh > size) && !is_sync_kiocb(req))
 		goto skip;
-	}
 	/*
 	 * clear ASYN space bit, it'll be reset if there is no space.
 	 */
@@ -2353,10 +2156,8 @@ int sdp_inet_send(struct kiocb *req,
 		 * data to allow some space for sending.
 		 */
 		while (0 < __sdp_inet_write_space(conn, oob)) {
-
 			buff = _sdp_send_data_buff_get(conn);
 			if (NULL == buff) {
-
 				result = -ENOMEM;
 				goto done;
 			}
@@ -2370,7 +2171,6 @@ int sdp_inet_send(struct kiocb *req,
 						  msg->msg_iov,
 						  copy);
 			if (0 > result) {
-
 				(void)sdp_buff_pool_put(buff);
 				goto done;
 			}
@@ -2383,15 +2183,11 @@ int sdp_inet_send(struct kiocb *req,
 			result = _sdp_send_data_buff_put(conn, buff, copy,
 							 ((copied ==
 							 size) ? oob : 0));
-			if (0 > result) {
-
+			if (0 > result)
 				goto done;
-			}
-
-			if (copied == size) {
 
+			if (copied == size)
 				goto done;
-			}
 		}
 		/*
 		 * set no space bits since this code path is taken
@@ -2408,39 +2204,32 @@ skip: /* entry point for IOCB based tran
 		/*
 		 * onetime setup of timeout, but only if it's needed.
 		 */
-		if (0 > timeout) {
-
+		if (0 > timeout)
 			timeout = sock_sndtimeo(sk, (MSG_DONTWAIT &
 						     msg->msg_flags));
-		}
 
 		if (0 != SDP_CONN_GET_ERR(conn)) {
-
 			result = (0 < copied) ? 0 : SDP_CONN_ERROR(conn);
 			break;
 		}
 
 		if (0 < (SEND_SHUTDOWN & conn->shutdown)) {
-
 			result = -EPIPE;
 			break;
 		}
 
 		if (SDP_SOCK_ST_ERROR == conn->istate) {
-
 			result = -EPROTO; /* error should always be set, but
 					     just in case */
 			break;
 		}
 
 		if (0 == timeout) {
-
 			result = -EAGAIN;
 			break;
 		}
 
 		if (signal_pending(current)) {
-
 			result =
 			    (0 < timeout) ? sock_intr_errno(timeout) : -EAGAIN;
 			break;
@@ -2451,7 +2240,6 @@ skip: /* entry point for IOCB based tran
 		 * call.
 		 */
 		if (is_sync_kiocb(req)) {
-
 			DECLARE_WAITQUEUE(wait, current);
 
 			add_wait_queue(sk->sk_sleep, &wait);
@@ -2465,10 +2253,8 @@ skip: /* entry point for IOCB based tran
 			clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
 
 			SDP_CONN_UNLOCK(conn);
-			if (!(0 < __sdp_inet_write_space(conn, oob))) {
-
+			if (!(0 < __sdp_inet_write_space(conn, oob)))
 				timeout = schedule_timeout(timeout);
-			}
 			SDP_CONN_LOCK(conn);
 
 			remove_wait_queue(sk->sk_sleep, &wait);
@@ -2481,7 +2267,6 @@ skip: /* entry point for IOCB based tran
 		 */
 		iocb = sdp_iocb_create();
 		if (NULL == iocb) {
-			
 			sdp_dbg_warn(conn, "Failed to allocate IOCB <%Zu:%d>",
 				     size, copied);
 			result = -ENOMEM;
@@ -2499,7 +2284,6 @@ skip: /* entry point for IOCB based tran
 
 		result = sdp_iocb_lock(iocb);
 		if (0 > result) {
-				
 			sdp_dbg_warn(conn, "Error <%d> locking IOCB <%Zu:%d>", 
 				     result, size, copied);
         
@@ -2513,7 +2297,6 @@ skip: /* entry point for IOCB based tran
 
 		result = _sdp_send_data_queue(conn, (struct sdpc_desc *)iocb);
 		if (0 > result) {
-
 			sdp_dbg_warn(conn, "Error <%d> queueing write IOCB",
 				     result);
 
@@ -2529,10 +2312,8 @@ done:
 	SDP_CONN_UNLOCK(conn);
 	result = ((0 < copied) ? copied : result);
 
-	if (-EPIPE == result && 0 == (MSG_NOSIGNAL & msg->msg_flags)) {
-
+	if (-EPIPE == result && 0 == (MSG_NOSIGNAL & msg->msg_flags))
 		send_sig(SIGPIPE, current, 0);
-	}
 
 	return result;
 } /* sdp_inet_send */




More information about the general mailing list