[openib-general] [PATCH][SDP][16/22] Whitespace cleanup in sdp_rcvd.c
Tom Duffy
Tom.Duffy at Sun.COM
Fri Feb 18 16:47:06 PST 2005
Signed-off-by: Tom Duffy <tduffy at sun.com>
Index: linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_rcvd.c
===================================================================
--- linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_rcvd.c (revision 1836)
+++ linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_rcvd.c (working copy)
@@ -58,7 +58,6 @@ static int _sdp_rcvd_disconnect(struct s
*/
result = sdp_wall_recv_close(conn);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> closing connection",
result);
goto error;
@@ -66,14 +65,10 @@ static int _sdp_rcvd_disconnect(struct s
break;
case SDP_CONN_ST_DIS_PEND_1:
-
SDP_CONN_ST_SET(conn, SDP_CONN_ST_DIS_PEND_R);
-
break;
case SDP_CONN_ST_DIS_SEND_1:
-
SDP_CONN_ST_SET(conn, SDP_CONN_ST_DIS_RECV_R);
-
break;
case SDP_CONN_ST_DIS_SENT_1:
/*
@@ -88,7 +83,6 @@ static int _sdp_rcvd_disconnect(struct s
*/
result = sdp_wall_recv_closing(conn);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> confirming conn close",
result);
goto error;
@@ -102,18 +96,14 @@ static int _sdp_rcvd_disconnect(struct s
* do not treat it as an error
*/
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> CM disconnect", result);
- if (-EPROTO != result) {
-
+ if (-EPROTO != result)
goto error;
- }
}
break;
default:
-
sdp_warn("Unexpected conn state. conn <%d> state <%04x:%04x>",
conn->hashent, conn->istate, conn->state);
@@ -146,16 +136,12 @@ static int _sdp_rcvd_abort(struct sdp_op
case SDP_CONN_ST_DIS_PEND_2:
case SDP_CONN_ST_DIS_SEND_2:
case SDP_CONN_ST_DIS_SENT_2:
-
result = sdp_wall_abort(conn);
- if (0 > result) {
-
+ if (0 > result)
sdp_dbg_warn(conn, "Error <%d> during abort", result);
- }
break;
default:
-
sdp_warn("Unexpected abort. conn <%d> state <%04x:%04x>",
conn->hashent, conn->istate, conn->state);
result = -EPROTO;
@@ -191,7 +177,6 @@ static int _sdp_rcvd_send_sm(struct sdp_
* drain the active source queue
*/
while (NULL != (iocb = sdp_iocb_q_get_tail(&conn->w_src))) {
-
SDP_EXPECT((0 < (SDP_IOCB_F_ACTIVE & iocb->flags)));
SDP_EXPECT((0 < (SDP_IOCB_F_CANCEL & iocb->flags)));
@@ -228,7 +213,6 @@ static int _sdp_rcvd_rdma_wr(struct sdp_
*/
iocb = sdp_iocb_q_look(&conn->r_snk);
if (NULL == iocb) {
-
sdp_dbg_warn(conn, "Cannot find IOCB for Write Completion.");
result = -EPROTO;
goto error;
@@ -243,7 +227,6 @@ static int _sdp_rcvd_rdma_wr(struct sdp_
* update IOCB
*/
if (rwch->size > iocb->len) {
-
sdp_dbg_warn(conn, "IOCB and Write size mismatch. <%d:%d>",
rwch->size, iocb->len);
result = -EPROTO;
@@ -266,7 +249,6 @@ static int _sdp_rcvd_rdma_wr(struct sdp_
result = sdp_iocb_complete(iocb, 0);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> completing iocb. <%d>",
result, iocb->key);
goto error;
@@ -295,7 +277,6 @@ static int _sdp_rcvd_rdma_rd(struct sdp_
*/
iocb = sdp_iocb_q_look(&conn->w_src);
if (NULL == iocb) {
-
sdp_dbg_warn(conn, "Cannot find IOCB for Read Completion.");
result = -EPROTO;
goto error;
@@ -310,7 +291,6 @@ static int _sdp_rcvd_rdma_rd(struct sdp_
* update IOCB
*/
if (rrch->size > iocb->len) {
-
sdp_dbg_warn(conn, "IOCB and Read size mismatch. <%d:%d>",
rrch->size, iocb->len);
result = -EPROTO;
@@ -334,7 +314,6 @@ static int _sdp_rcvd_rdma_rd(struct sdp_
* If iocb is done, deregister memory, and generate completion.
*/
if (!(0 < iocb->len)) {
-
iocb = sdp_iocb_q_get_head(&conn->w_src);
SDP_EXPECT((NULL != iocb));
@@ -345,7 +324,6 @@ static int _sdp_rcvd_rdma_rd(struct sdp_
result = sdp_iocb_complete(iocb, 0);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> completing iocb. <%d>",
result, iocb->key);
goto error;
@@ -357,7 +335,6 @@ static int _sdp_rcvd_rdma_rd(struct sdp_
*/
if (0 < (SDP_CONN_F_SRC_CANCEL_L & conn->flags) &&
0 == sdp_iocb_q_size(&conn->w_src)) {
-
conn->src_cncl = 0;
conn->flags &= ~(SDP_CONN_F_SRC_CANCEL_L);
}
@@ -389,7 +366,6 @@ static int _sdp_rcvd_mode_change(struct
if (((SDP_MSG_MCH_GET_MODE(mch) & 0x7) ==
((0 < (SDP_MSG_MCH_GET_MODE(mch) & 0x8)) ?
conn->send_mode : conn->recv_mode))) {
-
sdp_dbg_warn(conn, "Mode transition <%d> is a nop. <%d:%d>",
SDP_MSG_MCH_GET_MODE(mch), conn->recv_mode,
conn->send_mode);
@@ -400,17 +376,13 @@ static int _sdp_rcvd_mode_change(struct
* process mode change requests based on which state we're in
*/
switch (SDP_MSG_MCH_GET_MODE(mch)) {
-
case SDP_MSG_MCH_BUFF_RECV: /* source to sink */
-
if (SDP_MODE_COMB != conn->recv_mode) {
-
result = -EPROTO;
goto mode_error;
}
if (0 < conn->src_recv) {
-
sdp_dbg_warn(conn, "mode error <%d> src pending <%d>",
SDP_MSG_MCH_GET_MODE(mch),
conn->src_recv);
@@ -420,27 +392,21 @@ static int _sdp_rcvd_mode_change(struct
break;
case SDP_MSG_MCH_COMB_SEND: /* sink to source */
-
if (SDP_MODE_BUFF != conn->send_mode) {
-
result = -EPROTO;
goto mode_error;
}
break;
case SDP_MSG_MCH_PIPE_RECV: /* source to sink */
-
if (SDP_MODE_COMB != conn->recv_mode) {
-
result = -EPROTO;
goto mode_error;
}
break;
case SDP_MSG_MCH_COMB_RECV: /* source to sink */
-
if (SDP_MODE_PIPE != conn->recv_mode) {
-
result = -EPROTO;
goto mode_error;
}
@@ -454,7 +420,6 @@ static int _sdp_rcvd_mode_change(struct
*/
break;
default:
-
sdp_dbg_warn(conn, "Invalid mode transition <%d> requested.",
SDP_MSG_MCH_GET_MODE(mch));
result = -EPROTO;
@@ -463,14 +428,10 @@ static int _sdp_rcvd_mode_change(struct
/*
* assign new mode
*/
- if (0 < (SDP_MSG_MCH_GET_MODE(mch) & 0x8)) {
-
+ if (0 < (SDP_MSG_MCH_GET_MODE(mch) & 0x8))
conn->send_mode = SDP_MSG_MCH_GET_MODE(mch) & 0x7;
- }
- else {
-
+ else
conn->recv_mode = SDP_MSG_MCH_GET_MODE(mch) & 0x7;
- }
return 0;
@@ -498,7 +459,6 @@ static int _sdp_rcvd_src_cancel(struct s
* to do.
*/
if (!(0 < conn->src_recv)) {
-
sdp_dbg_warn(conn, "No SrcAvail advertisments to cancel.");
result = 0;
goto done;
@@ -514,7 +474,6 @@ static int _sdp_rcvd_src_cancel(struct s
* immediate completion
*/
if (0 < (SDP_ADVT_F_READ & advt->flag)) {
-
advt = sdp_advt_q_get(&conn->src_pend);
SDP_EXPECT((NULL != advt));
@@ -524,12 +483,9 @@ static int _sdp_rcvd_src_cancel(struct s
* keep track of cancellations
*/
conn->flags |= SDP_CONN_F_SRC_CANCEL_C;
- }
- else {
-
+ } else {
result = sdp_send_ctrl_rdma_rd(conn, advt->post);
if (0 > result) {
-
sdp_dbg_warn(conn,
"Error <%d> read completion",
result);
@@ -541,7 +497,6 @@ static int _sdp_rcvd_src_cancel(struct s
* drop the pending advertisment queue.
*/
while (NULL != (advt = sdp_advt_q_get(&conn->src_pend))) {
-
conn->flags |= SDP_CONN_F_SRC_CANCEL_C;
conn->src_recv--;
@@ -562,16 +517,13 @@ static int _sdp_rcvd_src_cancel(struct s
*/
conn->flags |= SDP_CONN_F_SRC_CANCEL_R;
conn->advt_seq--;
- }
- else {
+ } else {
/*
* If a source was dropped, generate an ack.
*/
if (0 < (SDP_CONN_F_SRC_CANCEL_C & conn->flags)) {
-
result = sdp_send_ctrl_send_sm(conn);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error<%d> posting SendSm",
result);
goto done;
@@ -602,7 +554,6 @@ static int _sdp_rcvd_snk_cancel(struct s
* since the message was sent, and there is nothing to do.
*/
if (!(0 < conn->snk_recv)) {
-
sdp_dbg_warn(conn, "No SnkAvail advertisments to cancel.");
result = 0;
goto done;
@@ -620,7 +571,6 @@ static int _sdp_rcvd_snk_cancel(struct s
*/
result = sdp_send_ctrl_rdma_wr(conn, advt->post);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> write completion",
result);
goto done;
@@ -629,18 +579,15 @@ static int _sdp_rcvd_snk_cancel(struct s
* reduce cancel counter
*/
counter = -1;
- }
- else {
+ } else
/*
* cancel count.
*/
counter = 0;
- }
/*
* drain the advertisments which have yet to be processed.
*/
while (NULL != (advt = sdp_advt_q_get(&conn->snk_pend))) {
-
counter++;
conn->snk_recv--;
@@ -652,10 +599,8 @@ static int _sdp_rcvd_snk_cancel(struct s
* sending a completion
*/
if (0 < counter) {
-
result = sdp_send_ctrl_snk_cancel_ack(conn);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> SnkCacelAck response",
result);
goto done;
@@ -683,7 +628,6 @@ static int _sdp_rcvd_snk_cancel_ack(stru
conn->snk_sent, conn->recv_mode, conn->flags);
if (0 == (SDP_CONN_F_SNK_CANCEL & conn->flags)) {
-
sdp_dbg_warn(conn, "Connection not in sink cancel mode <%08x>",
conn->flags);
result = -EPROTO;
@@ -693,12 +637,10 @@ static int _sdp_rcvd_snk_cancel_ack(stru
* drain and complete all active IOCBs
*/
while (NULL != (iocb = sdp_iocb_q_get_head(&conn->r_snk))) {
-
conn->snk_sent--;
result = sdp_iocb_complete(iocb, 0);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> completing iocb. <%d>",
result, iocb->key);
goto done;
@@ -738,7 +680,6 @@ static int _sdp_rcvd_resize_buff_ack(str
result = sdp_send_ctrl_resize_buff_ack(conn, conn->recv_size);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> acking size change request",
result);
goto error;
@@ -793,7 +734,6 @@ static int _sdp_rcvd_snk_avail(struct sd
* check our send mode, and make sure parameters are within reason.
*/
if (SDP_MODE_PIPE != conn->send_mode) {
-
sdp_dbg_warn(conn, "SinkAvail, incorrect source mode <%d>",
conn->send_mode);
result = -EPROTO;
@@ -801,7 +741,6 @@ static int _sdp_rcvd_snk_avail(struct sd
}
if (SDP_MSG_MAX_ADVS == (conn->src_recv + conn->snk_recv)) {
-
sdp_dbg_warn(conn, "SinkAvail, too many advertisments. <%d>",
(conn->src_recv + conn->snk_recv));
result = -EPROTO;
@@ -809,7 +748,6 @@ static int _sdp_rcvd_snk_avail(struct sd
}
if (snkah->size < conn->send_size) {
-
sdp_dbg_warn(conn, "SinkAvail too small. <%d:%d>",
snkah->size, conn->send_size);
result = -EPROTO;
@@ -820,7 +758,6 @@ static int _sdp_rcvd_snk_avail(struct sd
* discard and skip to data processing.
*/
if (conn->nond_send != snkah->non_disc) {
-
conn->nond_send--;
goto consume;
}
@@ -829,9 +766,7 @@ static int _sdp_rcvd_snk_avail(struct sd
* invalid and the queue needs to be fixed up.
*/
if (0 < conn->src_sent) {
-
while (NULL != (iocb = sdp_iocb_q_get_tail(&conn->w_src))) {
-
SDP_EXPECT((0 < (SDP_IOCB_F_ACTIVE & iocb->flags)));
iocb->flags &= ~SDP_IOCB_F_ACTIVE;
@@ -843,14 +778,11 @@ static int _sdp_rcvd_snk_avail(struct sd
* completed.
*/
if (0 == (SDP_IOCB_F_CANCEL & iocb->flags)) {
-
result = sdp_desc_q_put_head(&conn->send_queue,
(struct sdpc_desc *)
iocb);
SDP_EXPECT(!(0 > result));
- }
- else {
-
+ } else {
result = sdp_iocb_complete(iocb, 0);
SDP_EXPECT(!(0 > result));
}
@@ -860,7 +792,6 @@ static int _sdp_rcvd_snk_avail(struct sd
* be cleared.
*/
if (0 < (SDP_CONN_F_SRC_CANCEL_L & conn->flags)) {
-
conn->src_cncl = 0;
conn->flags &= ~(SDP_CONN_F_SRC_CANCEL_L);
}
@@ -870,7 +801,6 @@ static int _sdp_rcvd_snk_avail(struct sd
*/
advt = sdp_advt_create();
if (NULL == advt) {
-
sdp_dbg_warn(conn, "SrcAvail cannot be copied.");
result = -ENOMEM;
goto error;
@@ -888,7 +818,6 @@ static int _sdp_rcvd_snk_avail(struct sd
result = sdp_advt_q_put(&conn->snk_pend, advt);
if (0 > result) {
-
sdp_dbg_warn(conn, "SnkAvail cannot be saved. <%d>", result);
goto advt_error;
}
@@ -900,29 +829,21 @@ consume:
* consume any data in the advertisment for the other direction.
*/
if (0 < (buff->tail - buff->data)) {
-
result = sdp_recv_buff(conn, buff);
- if (0 < result) {
+ if (0 < result)
/*
* count number of bytes buffered by the connection,
* zero byte buffers or errors can be returned, the
* buffer will be dispossed of by the caller.
*/
conn->byte_strm += result;
- }
- else {
-
- if (0 > result) {
-
+ else
+ if (0 > result)
sdp_dbg_warn(conn, "Error <%d> buffer recv",
result);
- }
- }
- }
- else {
-
+ } else
result = 0;
- }
+
/*
* PostRecv will take care of consuming this advertisment, based
* on result.
@@ -967,7 +888,6 @@ static int _sdp_rcvd_src_avail(struct sd
}
if (0 < (SDP_CONN_F_SRC_CANCEL_R & conn->flags)) {
-
sdp_dbg_warn(conn, "SrcAvail during SrcAvailCancel. <%d>",
conn->src_recv);
result = -EFAULT;
@@ -979,7 +899,6 @@ static int _sdp_rcvd_src_avail(struct sd
* closed. This notifies the peer that the data was not received.
*/
if (0 < (RCV_SHUTDOWN & conn->shutdown)) {
-
sdp_dbg_warn(conn, "SrcAvail, receive path closed <%02x>",
conn->shutdown);
/*
@@ -998,7 +917,6 @@ static int _sdp_rcvd_src_avail(struct sd
*/
advt = sdp_advt_create();
if (NULL == advt) {
-
sdp_dbg_warn(conn, "SrcAvail cannot be copied.");
result = -ENOMEM;
goto done;
@@ -1008,9 +926,7 @@ static int _sdp_rcvd_src_avail(struct sd
* path mode to determine if all is cool for the advertisment.
*/
switch (conn->recv_mode) {
-
case SDP_MODE_BUFF:
-
sdp_dbg_warn(conn, "SrcAvail in bad mode. <%d>",
conn->recv_mode);
result = -EPROTO;
@@ -1018,11 +934,9 @@ static int _sdp_rcvd_src_avail(struct sd
break;
case SDP_MODE_COMB:
-
if (0 < conn->src_recv ||
!(0 < size) ||
!(srcah->size > size)) {
-
sdp_dbg_warn(conn,
"SrcAvail mode <%d> mismatch. <%d:%d:%d>",
conn->recv_mode, conn->src_recv,
@@ -1043,10 +957,8 @@ static int _sdp_rcvd_src_avail(struct sd
break;
case SDP_MODE_PIPE:
-
if (SDP_MSG_MAX_ADVS == (conn->src_recv + conn->snk_recv) ||
0 != size) {
-
sdp_dbg_warn(conn,
"SrcAvail mode <%d> mismatch. <%d:%d>",
conn->recv_mode,
@@ -1063,7 +975,6 @@ static int _sdp_rcvd_src_avail(struct sd
break;
default:
-
sdp_dbg_warn(conn, "SrcAvail message in unknown mode. <%d>",
conn->recv_mode);
result = -EPROTO;
@@ -1076,26 +987,22 @@ static int _sdp_rcvd_src_avail(struct sd
result = sdp_advt_q_put(&conn->src_pend, advt);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> queuing SrcAvail", result);
goto advt_error;
}
/*
* process any ULP data in the message
*/
- if (0 == size) {
-
+ if (0 == size)
goto done;
- }
/*
* update non-discard for sink advertisment management
*/
conn->nond_recv++;
if (!(SDP_SRC_AVAIL_RECV > size)) {
-
result = sdp_recv_buff(conn, buff);
- if (0 < result) {
+ if (0 < result)
/*
* count number of bytes buffered by the
* connection, zero byte buffers or errors
@@ -1103,20 +1010,12 @@ static int _sdp_rcvd_src_avail(struct sd
* dispossed of by the caller.
*/
conn->byte_strm += result;
- }
- else {
-
- if (0 > result) {
-
+ else
+ if (0 > result)
sdp_dbg_warn(conn, "Error <%d> buffer recv",
result);
- }
- }
- }
- else {
-
+ } else
result = 0;
- }
/*
* PostRecv will take care of consuming this advertisment.
*/
@@ -1138,16 +1037,13 @@ static int _sdp_rcvd_data(struct sdp_opt
SDP_CHECK_NULL(conn, -EINVAL);
SDP_CHECK_NULL(buff, -EINVAL);
- if (buff->tail == buff->data) {
-
+ if (buff->tail == buff->data)
return 0;
- }
/*
* If we are processing a SrcAvail, there should be no
* buffered data
*/
if (0 < conn->src_recv) {
-
sdp_dbg_warn(conn, "Error, recv'd data with SrcAvail active.");
return -EPROTO;
}
@@ -1156,25 +1052,19 @@ static int _sdp_rcvd_data(struct sdp_opt
* is a pending urgent message. If the OOB data is in this
* buffer, pull it out.
*/
- if (SDP_BSDH_GET_OOB_PEND(buff->bsdh_hdr)) {
-
+ if (SDP_BSDH_GET_OOB_PEND(buff->bsdh_hdr))
buff->flags |= SDP_BUFF_F_OOB_PEND;
- }
-
- if (SDP_BSDH_GET_OOB_PRES(buff->bsdh_hdr)) {
+ if (SDP_BSDH_GET_OOB_PRES(buff->bsdh_hdr))
buff->flags |= SDP_BUFF_F_OOB_PRES;
- }
/*
* update non-discard for sink advertisment management
*/
conn->nond_recv++;
ret_val = sdp_recv_buff(conn, buff);
- if (0 > ret_val) {
-
+ if (0 > ret_val)
sdp_dbg_warn(conn, "Error <%d> processing buff recv", ret_val);
- }
/*
* result contains the number of bytes in the buffer which
* are being kept by the connection. (zero buffered means
@@ -1267,7 +1157,6 @@ int sdp_event_recv(struct sdp_opt *conn,
* error handling
*/
if (IB_WC_SUCCESS != comp->status) {
-
switch (comp->status) {
case IB_WC_WR_FLUSH_ERR:
/*
@@ -1293,13 +1182,11 @@ int sdp_event_recv(struct sdp_opt *conn,
*/
buff = sdp_buff_q_get_head(&conn->recv_post);
if (NULL == buff) {
-
sdp_dbg_warn(conn, "receive event, but no posted receive?!");
result = -EINVAL;
goto done;
}
if (comp->wr_id != buff->wrid) {
-
sdp_dbg_warn(conn, "work request ID mismatch. <%llu:%llu>",
(unsigned long long)comp->wr_id,
(unsigned long long)buff->wrid);
@@ -1324,7 +1211,6 @@ int sdp_event_recv(struct sdp_opt *conn,
_sdp_msg_net_to_cpu_bsdh(buff->bsdh_hdr);
if (comp->byte_len != buff->bsdh_hdr->size) {
-
sdp_dbg_warn(conn,
"receive event, message size mismatch <%d:%d>",
comp->byte_len, buff->bsdh_hdr->size);
@@ -1362,17 +1248,13 @@ int sdp_event_recv(struct sdp_opt *conn,
/*
* fast path data messages
*/
- if (SDP_MID_DATA == buff->bsdh_hdr->mid) {
-
+ if (SDP_MID_DATA == buff->bsdh_hdr->mid)
result = _sdp_rcvd_data(conn, buff);
- }
else {
-
offset = buff->bsdh_hdr->mid & 0x1F;
if (!(offset < SDP_MSG_EVENT_TABLE_SIZE) ||
NULL == recv_event_funcs[offset]) {
-
sdp_dbg_warn(conn, "receive event, unknown MID <%d>",
buff->bsdh_hdr->mid);
result = -EINVAL;
@@ -1388,7 +1270,6 @@ int sdp_event_recv(struct sdp_opt *conn,
* process result.
*/
if (0 == result) {
-
result = sdp_buff_pool_put(buff);
SDP_EXPECT(!(0 > result));
/*
@@ -1398,37 +1279,29 @@ int sdp_event_recv(struct sdp_opt *conn,
*/
result = sdp_recv_flush(conn);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> flushing recv queue",
result);
goto done;
}
- }
- else {
-
+ } else
if (0 > result) {
-
sdp_dbg_warn(conn,
"receive event, dispatch error. <%d>",
result);
goto drop;
- }
- else {
+ } else
/*
* If data was consumed by the protocol, signal
* the user.
*/
sdp_inet_wake_recv(conn->sk, conn->byte_strm);
- }
- }
/*
* It's possible that a new recv buffer advertisment opened up the
* recv window and we can flush buffered send data
*/
result = sdp_send_flush(conn);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> flushing send queue",
result);
goto done;
More information about the general
mailing list