Commit 3720d40b authored by Florian Westphal's avatar Florian Westphal Committed by David S. Miller

tipc: add SO_RCVLOWAT support to stream socket receive path

Add support for the SO_RCVLOWAT socket option to TIPC's stream socket
type.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f8138092
...@@ -1026,9 +1026,8 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock, ...@@ -1026,9 +1026,8 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock,
struct sk_buff *buf; struct sk_buff *buf;
struct tipc_msg *msg; struct tipc_msg *msg;
unsigned int sz; unsigned int sz;
int sz_to_copy; int sz_to_copy, target, needed;
int sz_copied = 0; int sz_copied = 0;
int needed;
char __user *crs = m->msg_iov->iov_base; char __user *crs = m->msg_iov->iov_base;
unsigned char *buf_crs; unsigned char *buf_crs;
u32 err; u32 err;
...@@ -1050,6 +1049,8 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock, ...@@ -1050,6 +1049,8 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock,
goto exit; goto exit;
} }
target = sock_rcvlowat(sk, flags & MSG_WAITALL, buf_len);
restart: restart:
/* Look for a message in receive queue; wait if necessary */ /* Look for a message in receive queue; wait if necessary */
...@@ -1138,7 +1139,7 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock, ...@@ -1138,7 +1139,7 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock,
if ((sz_copied < buf_len) && /* didn't get all requested data */ if ((sz_copied < buf_len) && /* didn't get all requested data */
(!skb_queue_empty(&sk->sk_receive_queue) || (!skb_queue_empty(&sk->sk_receive_queue) ||
(flags & MSG_WAITALL)) && /* and more is ready or required */ (sz_copied < target)) && /* and more is ready or required */
(!(flags & MSG_PEEK)) && /* and aren't just peeking at data */ (!(flags & MSG_PEEK)) && /* and aren't just peeking at data */
(!err)) /* and haven't reached a FIN */ (!err)) /* and haven't reached a FIN */
goto restart; goto restart;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment