33 #include <linux/kernel.h>
34 #include <linux/slab.h>
37 #include <linux/export.h>
45 INIT_LIST_HEAD(&inc->
i_item);
64 inc->
i_conn->c_trans->inc_free(inc);
69 static void rds_recv_rcvbuf_delta(
struct rds_sock *rs,
struct sock *
sk,
70 struct rds_cong_map *
map,
81 rdsdebug(
"rs %p (%pI4:%u) recv bytes %d buf %d "
82 "now_cong %d delta %d\n",
85 rds_sk_rcvbuf(rs), now_congested, delta);
167 rdsdebug(
"conn %p next %llu inc %p seq %llu len %u sport %u dport %u "
168 "flags 0x%x rx_jiffies %lu\n", conn,
218 rds_recv_incoming_exthdrs(inc, rs);
221 sk = rds_rs_to_sk(rs);
226 rdsdebug(
"adding inc %p to rs %p's recv queue\n", inc, rs);
228 rds_recv_rcvbuf_delta(rs, sk, inc->
i_conn->c_lcong,
233 __rds_wake_sk_sleep(sk);
259 rds_inc_addref(*inc);
270 struct sock *sk = rds_rs_to_sk(rs);
275 if (!list_empty(&inc->
i_item)) {
279 rds_recv_rcvbuf_delta(rs, sk, inc->
i_conn->c_lcong,
282 list_del_init(&inc->
i_item);
288 rdsdebug(
"inc %p rs %p still %d dropped %d\n", inc, rs, ret, drop);
300 unsigned int count = 0, max_messages = ~0
U;
323 list_move(¬ifier->
n_list, ©);
326 spin_unlock_irqrestore(&rs->
rs_lock, flags);
331 while (!list_empty(©)) {
339 sizeof(cmsg), &cmsg);
344 list_del_init(¬ifier->
n_list);
351 if (!list_empty(©)) {
354 spin_unlock_irqrestore(&rs->
rs_lock, flags);
370 sizeof(notify), ¬ify);
376 spin_unlock_irqrestore(&rs->
rs_lock, flags);
399 size_t size,
int msg_flags)
401 struct sock *sk = sock->
sk;
402 struct rds_sock *rs = rds_sk_to_rs(sk);
409 timeo = sock_rcvtimeo(sk, nonblock);
411 rdsdebug(
"size %zu flags 0x%x timeo %ld\n", size, msg_flags, timeo);
426 ret = rds_notify_cong(rs, msg);
430 if (!rds_next_incoming(rs, &inc)) {
439 rds_next_incoming(rs, &inc)), timeo);
440 rdsdebug(
"recvmsg woke inc %p timeo %ld\n", inc,
451 rdsdebug(
"copying inc %p from %pI4:%u to user\n", inc,
454 ret = inc->
i_conn->c_trans->inc_copy_to_user(inc, msg->
msg_iov,
464 if (!rds_still_queued(rs, inc, !(msg_flags &
MSG_PEEK))) {
477 if (rds_cmsg_recv(inc, msg)) {
489 memset(sin->sin_zero, 0,
sizeof(sin->sin_zero));
509 struct sock *sk = rds_rs_to_sk(rs);
515 rds_recv_rcvbuf_delta(rs, sk, inc->
i_conn->c_lcong,
518 list_del_init(&inc->
i_item);