[openib-general] [PATCH][SDP][18/22] Whitespace cleanup in sdp_recv.c
Tom Duffy
Tom.Duffy at Sun.COM
Fri Feb 18 16:47:27 PST 2005
Signed-off-by: Tom Duffy <tduffy at sun.com>
Index: linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_recv.c
===================================================================
--- linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_recv.c (revision 1836)
+++ linux-2.6.10-openib/drivers/infiniband/ulp/sdp/sdp_recv.c (working copy)
@@ -54,7 +54,6 @@ static int _sdp_post_recv_buff(struct sd
*/
buff = sdp_buff_pool_get();
if (NULL == buff) {
-
sdp_dbg_warn(conn, "failed to allocate buff for recv queue.");
result = -ENOMEM;
goto error;
@@ -78,7 +77,6 @@ static int _sdp_post_recv_buff(struct sd
*/
result = sdp_buff_q_put_tail(&conn->recv_post, buff);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> queuing recv buffer.", result);
goto drop;
}
@@ -101,7 +99,6 @@ static int _sdp_post_recv_buff(struct sd
result = ib_post_recv(conn->qp, &receive_param, &bad_wr);
if (0 != result) {
-
sdp_dbg_warn(conn, "Error <%d> posting receive buffer",
result);
(void)sdp_buff_q_get_tail(&conn->recv_post);
@@ -132,7 +129,6 @@ static int _sdp_post_rdma_buff(struct sd
* check queue depth
*/
if (!(conn->send_cq_size > conn->s_wq_size)) {
-
result = ENODEV;
goto done;
}
@@ -141,7 +137,6 @@ static int _sdp_post_rdma_buff(struct sd
*/
advt = sdp_advt_q_look(&conn->src_pend);
if (NULL == advt) {
-
result = ENODEV;
goto done;
}
@@ -150,7 +145,6 @@ static int _sdp_post_rdma_buff(struct sd
*/
buff = sdp_buff_pool_get();
if (NULL == buff) {
-
sdp_dbg_warn(conn, "failed to allocate buff for rdma read.");
result = -ENOMEM;
goto error;
@@ -181,10 +175,8 @@ static int _sdp_post_rdma_buff(struct sd
* active list, and match the WRID.
*/
if (!(0 < advt->size)) {
-
advt = sdp_advt_q_get(&conn->src_pend);
if (NULL == advt) {
-
sdp_dbg_warn(conn, "SrcAvail disappeared. <%d>",
sdp_advt_q_size(&conn->src_pend));
result = -ENODEV;
@@ -193,7 +185,6 @@ static int _sdp_post_rdma_buff(struct sd
result = sdp_advt_q_put(&conn->src_actv, advt);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> queuing active src",
result);
@@ -208,7 +199,6 @@ static int _sdp_post_rdma_buff(struct sd
*/
result = sdp_desc_q_put_tail(&conn->r_src, (struct sdpc_desc *) buff);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> queuing rdma read.", result);
goto drop;
}
@@ -229,7 +219,6 @@ static int _sdp_post_rdma_buff(struct sd
result = ib_post_send(conn->qp, &send_param, &bad_wr);
if (0 != result) {
-
sdp_dbg_warn(conn, "Error <%d> posting rdma read", result);
(void)sdp_desc_q_get_tail(&conn->r_src);
@@ -264,7 +253,6 @@ static int _sdp_post_rdma_iocb_src(struc
* check queue depth
*/
if (!(conn->send_cq_size > conn->s_wq_size)) {
-
result = ENODEV;
goto done;
}
@@ -273,7 +261,6 @@ static int _sdp_post_rdma_iocb_src(struc
*/
advt = sdp_advt_q_look(&conn->src_pend);
if (NULL == advt) {
-
result = ENODEV;
goto done;
}
@@ -285,7 +272,6 @@ static int _sdp_post_rdma_iocb_src(struc
*/
iocb = sdp_iocb_q_look(&conn->r_pend);
if (NULL == iocb) {
-
result = ENODEV;
goto done;
}
@@ -294,7 +280,6 @@ static int _sdp_post_rdma_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 error;
@@ -330,10 +315,8 @@ static int _sdp_post_rdma_iocb_src(struc
* advertisment for completion
*/
if (!(0 < advt->size)) {
-
advt = sdp_advt_q_get(&conn->src_pend);
if (NULL == advt) {
-
sdp_dbg_warn(conn, "SrcAvail disappeared. <%d>",
sdp_advt_q_size(&conn->src_pend));
result = -ENODEV;
@@ -342,7 +325,6 @@ static int _sdp_post_rdma_iocb_src(struc
result = sdp_advt_q_put(&conn->src_actv, advt);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> queuing active src",
result);
(void)sdp_advt_destroy(advt);
@@ -353,10 +335,8 @@ static int _sdp_post_rdma_iocb_src(struc
* if there is no more iocb space queue the it for completion
*/
if (!(0 < iocb->len)) {
-
iocb = sdp_iocb_q_get_head(&conn->r_pend);
if (NULL == iocb) {
-
sdp_dbg_warn(conn, "read IOCB disappeared. <%d>",
sdp_iocb_q_size(&conn->r_pend));
result = -ENODEV;
@@ -366,7 +346,6 @@ static int _sdp_post_rdma_iocb_src(struc
result = sdp_desc_q_put_tail(&conn->r_src,
(struct sdpc_desc *)iocb);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> queuing read IOCB",
result);
(void)sdp_iocb_destroy(iocb);
@@ -390,7 +369,6 @@ static int _sdp_post_rdma_iocb_src(struc
result = ib_post_send(conn->qp, &send_param, &bad_wr);
if (0 != result) {
-
sdp_dbg_warn(conn, "Error <%d> posting rdma read", result);
conn->s_wq_size--;
goto error;
@@ -415,7 +393,6 @@ static int _sdp_post_rdma_iocb_snk(struc
* check if sink cancel is pending
*/
if (0 < (SDP_CONN_F_SNK_CANCEL & conn->flags)) {
-
result = ENODEV;
goto error;
}
@@ -424,7 +401,6 @@ static int _sdp_post_rdma_iocb_snk(struc
*/
iocb = sdp_iocb_q_look(&conn->r_pend);
if (NULL == iocb) {
-
result = ENODEV;
goto error;
}
@@ -432,7 +408,6 @@ static int _sdp_post_rdma_iocb_snk(struc
* check zcopy threshold
*/
if (conn->snk_zthresh > iocb->len) {
-
result = ENODEV;
goto error;
}
@@ -440,7 +415,6 @@ static int _sdp_post_rdma_iocb_snk(struc
* check number of outstanding sink advertisments
*/
if (!(conn->r_max_adv > conn->snk_sent)) {
-
result = ENODEV;
goto error;
}
@@ -449,13 +423,10 @@ static int _sdp_post_rdma_iocb_snk(struc
*/
result = sdp_iocb_register(iocb, conn);
if (result) {
-
result = (-EAGAIN == result ? EAGAIN : result);
- if (0 > result) {
-
+ if (0 > result)
sdp_dbg_warn(conn, "Error <%d> registering IOCB",
result);
- }
goto error;
}
@@ -469,7 +440,6 @@ static int _sdp_post_rdma_iocb_snk(struc
*/
iocb = sdp_iocb_q_get_head(&conn->r_pend);
if (0 > result) {
-
sdp_dbg_warn(conn, "read IOCB missing from pending table <%d>",
sdp_iocb_q_size(&conn->r_pend));
goto release;
@@ -477,7 +447,6 @@ static int _sdp_post_rdma_iocb_snk(struc
result = sdp_iocb_q_put_tail(&conn->r_snk, iocb);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> queueing active write IOCB",
result);
goto re_q;
@@ -490,7 +459,6 @@ static int _sdp_post_rdma_iocb_snk(struc
iocb->r_key,
iocb->io_addr);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> sending SnkAvail message",
result);
goto de_q;
@@ -526,29 +494,23 @@ static int _sdp_post_rdma(struct sdp_opt
* the sink advertisment, something to explore, but SrcAvail
* slow start might make that unneccessart?
*/
- if (0 == (SDP_ST_MASK_SEND_OK & conn->state)) {
-
+ if (0 == (SDP_ST_MASK_SEND_OK & conn->state))
return 0;
- }
/*
* loop flushing IOCB RDMAs. Read sources, otherwise post sinks.
*/
if (0 < sdp_advt_q_size(&conn->src_pend)) {
-
if (0 == sdp_desc_q_types_size(&conn->r_src,
- SDP_DESC_TYPE_BUFF)) {
-
+ SDP_DESC_TYPE_BUFF))
while (0 == (result = _sdp_post_rdma_iocb_src(conn))) {
/*
* pass, nothing to do in loop.
*/
}
- }
/*
* check non-zero result
*/
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> posting RDMA IOCB read",
result);
goto done;
@@ -556,47 +518,37 @@ static int _sdp_post_rdma(struct sdp_opt
/*
* loop posting RDMA reads, if there is room.
*/
- if (0 == sdp_iocb_q_size(&conn->r_pend)) {
-
+ if (0 == sdp_iocb_q_size(&conn->r_pend))
while (0 < sdp_advt_q_size(&conn->src_pend) &&
conn->recv_max >
sdp_buff_q_size(&conn->recv_pool) &&
conn->rwin_max > conn->byte_strm) {
-
result = _sdp_post_rdma_buff(conn);
- if (result) {
+ if (result)
/*
* No more posts allowed.
*/
break;
- }
}
- }
/*
* check non-zero result
*/
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> posting RDMA BUFF read",
result);
goto done;
}
- }
- else {
-
+ } else {
if (0 < sdp_iocb_q_size(&conn->r_pend) &&
SDP_MODE_PIPE == conn->recv_mode &&
- 0 == sdp_advt_q_size(&conn->src_actv)) {
-
+ 0 == sdp_advt_q_size(&conn->src_actv))
while (0 == (result = _sdp_post_rdma_iocb_snk(conn))) {
/*
* pass
*/
}
- }
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> posting RDMA read sink",
result);
goto done;
@@ -620,10 +572,8 @@ int sdp_recv_flush(struct sdp_opt *conn)
/*
* verify that the connection is in a posting state
*/
- if (0 == (SDP_ST_MASK_RCV_POST & conn->state)) {
-
+ if (0 == (SDP_ST_MASK_RCV_POST & conn->state))
return 0;
- }
/*
* loop posting receive buffers onto the queue
*/
@@ -647,18 +597,15 @@ int sdp_recv_flush(struct sdp_opt *conn)
((s32)conn->recv_cq_size - (s32)conn->l_recv_bf));
while (0 < counter--) {
-
result = _sdp_post_recv_buff(conn);
- if (result) {
+ if (result)
/*
* No more recv buffers allowed.
*/
break;
- }
}
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> posting recv buff.", result);
goto done;
}
@@ -667,10 +614,8 @@ int sdp_recv_flush(struct sdp_opt *conn)
* been consumed, we can come out of sink processing.
*/
if (0 < (SDP_CONN_F_SNK_CANCEL & conn->flags) &&
- 0 == sdp_iocb_q_size(&conn->r_snk)) {
-
+ 0 == sdp_iocb_q_size(&conn->r_snk))
conn->flags &= ~SDP_CONN_F_SNK_CANCEL;
- }
/*
* Next the connection should consume RDMA Source advertisments or
* create RDMA Sink advertisments, either way setup for RDMA's for
@@ -679,7 +624,6 @@ int sdp_recv_flush(struct sdp_opt *conn)
*/
result = _sdp_post_rdma(conn);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> posting RDMAs.", result);
goto done;
}
@@ -703,10 +647,8 @@ int sdp_recv_flush(struct sdp_opt *conn)
conn->l_recv_bf > conn->l_advt_bf) ||
(SDP_RECV_POST_ACK < (conn->l_recv_bf - conn->l_advt_bf) &&
0 == ((u32)conn->snk_recv + (u32)conn->src_recv))) {
-
result = sdp_send_ctrl_ack(conn);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> posting gratuitous ACK",
result);
goto done;
@@ -759,10 +701,8 @@ static int _sdp_read_buff_iocb(struct sd
* 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->tail - buff->data));
@@ -804,7 +744,6 @@ static int _sdp_recv_buff_iocb_active(st
*/
iocb = sdp_iocb_q_get_head(&conn->r_snk);
if (NULL == iocb) {
-
sdp_dbg_warn(conn, "Empty active IOCB queue. <%d>",
sdp_iocb_q_size(&conn->r_snk));
return -EPROTO;
@@ -816,7 +755,6 @@ static int _sdp_recv_buff_iocb_active(st
*/
result = _sdp_read_buff_iocb(iocb, buff);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> data copy <%d:%u> to IOCB",
result, iocb->len,
(unsigned)(buff->tail - buff->data));
@@ -834,11 +772,9 @@ static int _sdp_recv_buff_iocb_active(st
* callback to complete IOCB
*/
result = sdp_iocb_complete(iocb, 0);
- if (0 > result) {
-
+ if (0 > result)
sdp_dbg_warn(conn, "Error <%d> completing iocb. <%d>",
result, iocb->key);
- }
return (buff->tail - buff->data);
} /* _sdp_recv_buff_iocb_active */
@@ -859,7 +795,6 @@ static int _sdp_recv_buff_iocb_pending(s
*/
iocb = sdp_iocb_q_look(&conn->r_pend);
if (NULL == iocb) {
-
sdp_dbg_warn(conn, "Empty pending IOCB queue. <%d>",
sdp_iocb_q_size(&conn->r_pend));
return -EPROTO;
@@ -869,7 +804,6 @@ static int _sdp_recv_buff_iocb_pending(s
*/
result = _sdp_read_buff_iocb(iocb, buff);
if (0 > result) {
-
sdp_dbg_warn(conn, "Error <%d> data copy <%d:%u> to IOCB",
result, iocb->len,
(unsigned)(buff->tail - buff->data));
@@ -899,11 +833,9 @@ static int _sdp_recv_buff_iocb_pending(s
* callback to complete IOCB
*/
result = sdp_iocb_complete(iocb, 0);
- if (0 > result) {
-
+ if (0 > result)
sdp_dbg_warn(conn, "Error <%d> completing iocb. <%d>",
result, iocb->key);
- }
}
return (buff->tail - buff->data);
@@ -928,7 +860,6 @@ int sdp_recv_buff(struct sdp_opt *conn,
* closed. This notifies the peer that the data was not received.
*/
if (0 < (RCV_SHUTDOWN & conn->shutdown)) {
-
sdp_dbg_warn(conn, "Receive data path closed. <%02x>",
conn->shutdown);
/*
@@ -946,7 +877,6 @@ int sdp_recv_buff(struct sdp_opt *conn,
* oob notification.
*/
if (0 < (SDP_BUFF_F_OOB_PEND & buff->flags)) {
-
conn->rcv_urg_cnt++;
sdp_inet_wake_urg(conn->sk);
}
@@ -965,33 +895,24 @@ int sdp_recv_buff(struct sdp_opt *conn,
* or a socket recv (regular or OOB) is called.
*/
if (0 < (SDP_BUFF_F_OOB_PRES & buff->flags) &&
- 1 == (buff->tail - buff->data)) {
-
+ 1 == (buff->tail - buff->data))
break;
- }
/*
* process either a sink available IOCB which needs to be
* discarded with exactly one buffer, or process a pending
* IOCB.
*/
- if (0 < conn->snk_sent) {
-
+ if (0 < conn->snk_sent)
result = _sdp_recv_buff_iocb_active(conn, buff);
- }
- else {
-
+ else
result = _sdp_recv_buff_iocb_pending(conn, buff);
- }
/*
* Check result. Postitive result is data left in the buffer
*/
- if (0 == result) {
-
+ if (0 == result)
break;
- }
if (0 > result) {
-
sdp_dbg_warn(conn,
"Error <%d> processing IOCB. <%d:%d:%d>",
result, conn->snk_sent,
@@ -1006,7 +927,6 @@ int sdp_recv_buff(struct sdp_opt *conn,
buffered = buff->tail - buff->data;
if (0 < buffered) {
-
result = sdp_buff_q_put_tail(&conn->recv_pool, buff);
SDP_EXPECT(!(0 > result));
}
@@ -1030,15 +950,10 @@ static int _sdp_read_src_lookup(struct s
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_read_src_lookup */
/*
@@ -1057,10 +972,7 @@ static int _sdp_inet_read_cancel(struct
sdp_dbg_ctrl(NULL, "Cancel Read 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 read IOCB. users <%d> flags <%d:%08lx>",
req->ki_users, req->ki_key, req->ki_flags);
result = -EFAULT;
@@ -1090,7 +1002,6 @@ static int _sdp_inet_read_cancel(struct
SDP_EXPECT(!(0 > result));
if (0 == (SDP_IOCB_F_ACTIVE & iocb->flags)) {
-
if (0 < iocb->post) {
/*
* callback to complete IOCB, or drop reference
@@ -1101,7 +1012,6 @@ static int _sdp_inet_read_cancel(struct
result = -EAGAIN;
}
else {
-
result = sdp_iocb_destroy(iocb);
SDP_EXPECT(!(0 > result));
/*
@@ -1116,12 +1026,10 @@ static int _sdp_inet_read_cancel(struct
}
if (0 < (SDP_IOCB_F_RDMA_W & iocb->flags)) {
-
result = sdp_iocb_q_put_tail(&conn->r_snk, iocb);
SDP_EXPECT(!(0 > result));
}
else {
-
SDP_EXPECT((SDP_IOCB_F_RDMA_R & iocb->flags));
result = sdp_desc_q_put_tail(&conn->r_src,
@@ -1137,7 +1045,6 @@ static int _sdp_inet_read_cancel(struct
_sdp_read_src_lookup,
req);
if (NULL != iocb) {
-
iocb->flags |= SDP_IOCB_F_CANCEL;
result = -EAGAIN;
@@ -1206,14 +1113,12 @@ static int _sdp_inet_recv_urg_trav(struc
SDP_CHECK_NULL(value, -EINVAL);
if (0 < (SDP_BUFF_F_OOB_PRES & buff->flags)) {
-
SDP_EXPECT((buff->tail > buff->data));
update = *value;
*value = *(u8 *) (buff->tail - 1);
if (0 < update) {
-
buff->tail--;
buff->flags &= ~SDP_BUFF_F_OOB_PRES;
}
@@ -1241,11 +1146,9 @@ static int _sdp_inet_recv_urg(struct soc
SDP_CHECK_NULL(msg, -EINVAL);
conn = SDP_GET_CONN(sk);
- if (sock_flag(sk, SOCK_URGINLINE) ||
- 0 == conn->rcv_urg_cnt) {
-
+ if (sock_flag(sk, SOCK_URGINLINE) || 0 == conn->rcv_urg_cnt)
return -EINVAL;
- }
+
/*
* don't cosume data on PEEK, but do consume data on TRUNC
*/
@@ -1259,24 +1162,19 @@ static int _sdp_inet_recv_urg(struct soc
_sdp_inet_recv_urg_trav,
(void *)&value);
if (-ERANGE != result) {
-
result = (0 != result) ? result : -EAGAIN;
goto done;
}
msg->msg_flags |= MSG_OOB;
if (0 < size) {
-
result = memcpy_toiovec(msg->msg_iov, &value, 1);
- if (0 != result) {
-
+ if (0 != result)
goto done;
- }
/*
* clear urgent pointer on consumption
*/
if (0 == (MSG_PEEK & flags)) {
-
conn->rcv_urg_cnt -= 1;
conn->byte_strm -= 1;
@@ -1290,7 +1188,6 @@ static int _sdp_inet_recv_urg(struct soc
_sdp_inet_recv_urg_test,
(void *)0);
if (NULL != buff) {
-
result = sdp_buff_pool_put(buff);
SDP_EXPECT(!(0 > result));
@@ -1300,9 +1197,7 @@ static int _sdp_inet_recv_urg(struct soc
result = 1;
}
- }
- else {
-
+ } else {
msg->msg_flags |= MSG_TRUNC;
result = 0;
}
@@ -1351,15 +1246,13 @@ int sdp_inet_recv(struct kiocb *req,
req->ki_key, msg->msg_iov->iov_base,
req->ki_users, req->ki_flags);
- if (0 < (MSG_TRUNC & flags)) {
- /*
- * TODO: unhandled, but need to be handled.
- */
+ /*
+ * TODO: unhandled, but need to be handled.
+ */
+ if (0 < (MSG_TRUNC & flags))
return -EOPNOTSUPP;
- }
if (0 < (MSG_PEEK & flags)) {
-
(void)sdp_buff_q_init(&peek_queue, 0);
msg->msg_flags |= MSG_PEEK;
}
@@ -1368,7 +1261,6 @@ int sdp_inet_recv(struct kiocb *req,
if (SDP_SOCK_ST_LISTEN == conn->istate ||
SDP_SOCK_ST_CLOSED == conn->istate) {
-
result = -ENOTCONN;
goto done;
}
@@ -1376,7 +1268,6 @@ int sdp_inet_recv(struct kiocb *req,
* process urgent data
*/
if (0 < (MSG_OOB & flags)) {
-
result = _sdp_inet_recv_urg(sk, msg, size, flags);
copied = (0 < result) ? result : 0;
result = (0 < result) ? 0 : result;
@@ -1396,7 +1287,6 @@ int sdp_inet_recv(struct kiocb *req,
*/
while (copied < size &&
(buff = sdp_buff_q_get_head(&conn->recv_pool))) {
-
length = buff->tail - buff->data;
update = 0;
@@ -1411,12 +1301,9 @@ int sdp_inet_recv(struct kiocb *req,
* or not, to ensure that the user has a
* chance to read the byte.
*/
- if (1 < length) {
-
+ if (1 < length)
length--;
- }
else {
-
if (0 < copied) {
/*
* update such that we pass
@@ -1427,9 +1314,7 @@ int sdp_inet_recv(struct kiocb *req,
length = 0;
update = 0;
oob = 1; /* break on oob */
- }
- else {
-
+ } else {
if (sock_flag(sk, SOCK_URGINLINE)) {
/*
* skip this byte, but
@@ -1454,7 +1339,6 @@ int sdp_inet_recv(struct kiocb *req,
buff->data,
copy);
if (0 > result) {
-
expect =
sdp_buff_q_put_head(&conn->
recv_pool,
@@ -1474,7 +1358,6 @@ int sdp_inet_recv(struct kiocb *req,
copied += copy;
if (0 < (buff->tail - buff->data)) {
-
expect = sdp_buff_q_put_head(&conn->recv_pool,
buff);
SDP_EXPECT(!(0 > expect));
@@ -1490,17 +1373,12 @@ int sdp_inet_recv(struct kiocb *req,
}
if (MSG_PEEK & flags) {
-
expect = sdp_buff_q_put_head(&peek_queue,
buff);
SDP_EXPECT(!(0 > expect));
- }
- else {
-
- if (SDP_BUFF_F_OOB_PRES & buff->flags) {
-
+ } else {
+ if (SDP_BUFF_F_OOB_PRES & buff->flags)
conn->rcv_urg_cnt -= 1;
- }
/*
* create a link of buffers which
* will be returned to the free pool
@@ -1517,12 +1395,9 @@ int sdp_inet_recv(struct kiocb *req,
* buffers...
*/
if (SDP_RECV_POST_FREQ < ++ack) {
-
result = sdp_recv_flush(conn);
- if (0 > result) {
-
+ if (0 > result)
goto done;
- }
ack = 0;
}
@@ -1533,7 +1408,6 @@ int sdp_inet_recv(struct kiocb *req,
* of low water mark, or whether there is room in the buffer.
*/
if (0 < oob) {
-
result = 0;
break;
}
@@ -1550,10 +1424,8 @@ int sdp_inet_recv(struct kiocb *req,
*/
SDP_CONN_RELOCK(conn);
- if (0 < sdp_buff_q_size(&conn->recv_pool)) {
-
+ if (0 < sdp_buff_q_size(&conn->recv_pool))
continue;
- }
}
/*
* If enough data has been copied to userspace break from
@@ -1564,7 +1436,6 @@ int sdp_inet_recv(struct kiocb *req,
*/
if (!(copied < low_water) &&
0 == conn->src_recv) {
-
#if 0 /* performance cheat. LM */
if (!(conn->snk_zthresh > size)) {
@@ -1588,26 +1459,22 @@ int sdp_inet_recv(struct kiocb *req,
* check status. POSIX 1003.1g order.
*/
if (0 != SDP_CONN_GET_ERR(conn)) {
-
result = (0 < copied) ? 0 : SDP_CONN_ERROR(conn);
break;
}
if (0 < (RCV_SHUTDOWN & conn->shutdown)) {
-
result = 0;
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;
}
@@ -1615,7 +1482,6 @@ int sdp_inet_recv(struct kiocb *req,
* Either wait or create IOCB for defered completion.
*/
if (is_sync_kiocb(req)) {
-
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(sk->sk_sleep, &wait);
@@ -1624,7 +1490,6 @@ int sdp_inet_recv(struct kiocb *req,
set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
if (0 == sdp_buff_q_size(&conn->recv_pool)) {
-
SDP_CONN_UNLOCK(conn);
timeout = schedule_timeout(timeout);
SDP_CONN_LOCK(conn);
@@ -1637,19 +1502,16 @@ int sdp_inet_recv(struct kiocb *req,
* check signal pending
*/
if (signal_pending(current)) {
-
result = ((0 < timeout) ?
sock_intr_errno(timeout) : -EAGAIN);
break;
}
- }
- else {
+ } else {
/*
* create IOCB with remaining space
*/
iocb = sdp_iocb_create();
if (NULL == iocb) {
-
sdp_dbg_warn(conn,
"Error allocating IOCB <%Zu:%d>",
size, copied);
@@ -1668,7 +1530,6 @@ int sdp_inet_recv(struct kiocb *req,
result = sdp_iocb_lock(iocb);
if (0 > result) {
-
sdp_dbg_warn(conn,
"Error <%d> IOCB lock <%Zu:%d>",
result, size, copied);
@@ -1681,7 +1542,6 @@ int sdp_inet_recv(struct kiocb *req,
result = sdp_iocb_q_put_tail(&conn->r_pend, iocb);
if (0 > result) {
-
sdp_dbg_warn(conn,
"Error <%d> IOCB queue <%Zu:%d>",
result, size, copied);
@@ -1703,13 +1563,10 @@ done:
* acknowledge moved data
*/
if (0 < ack) {
-
expect = sdp_recv_flush(conn);
- if (0 > expect) {
-
+ if (0 > expect)
sdp_dbg_warn(conn, "Error <%d> flushing recv queue.",
expect);
- }
}
(void)sdp_buff_pool_chain_put(head, free_count);
@@ -1717,9 +1574,7 @@ done:
* return any peeked buffers to the recv queue, in the correct order.
*/
if (0 < (MSG_PEEK & flags)) {
-
while (NULL != (buff = sdp_buff_q_get_tail(&peek_queue))) {
-
expect = sdp_buff_q_put_head(&conn->recv_pool, buff);
SDP_EXPECT(!(0 > expect));
}
More information about the general
mailing list