Lines Matching refs:rs
62 struct rds_sock *rs; in rds_release() local
67 rs = rds_sk_to_rs(sk); in rds_release()
73 rds_clear_recv_queue(rs); in rds_release()
74 rds_cong_remove_socket(rs); in rds_release()
76 rds_remove_bound(rs); in rds_release()
78 rds_send_drop_to(rs, NULL); in rds_release()
79 rds_rdma_drop_keys(rs); in rds_release()
80 rds_notify_queue_get(rs, NULL); in rds_release()
81 rds_notify_msg_zcopy_purge(&rs->rs_zcookie_queue); in rds_release()
84 list_del_init(&rs->rs_item); in rds_release()
88 rds_trans_put(rs->rs_transport); in rds_release()
105 void rds_wake_sk_sleep(struct rds_sock *rs) in rds_wake_sk_sleep() argument
109 read_lock_irqsave(&rs->rs_recv_lock, flags); in rds_wake_sk_sleep()
110 __rds_wake_sk_sleep(rds_rs_to_sk(rs)); in rds_wake_sk_sleep()
111 read_unlock_irqrestore(&rs->rs_recv_lock, flags); in rds_wake_sk_sleep()
117 struct rds_sock *rs = rds_sk_to_rs(sock->sk); in rds_getname() local
124 if (ipv6_addr_any(&rs->rs_conn_addr)) in rds_getname()
127 if (ipv6_addr_v4mapped(&rs->rs_conn_addr)) { in rds_getname()
131 sin->sin_port = rs->rs_conn_port; in rds_getname()
132 sin->sin_addr.s_addr = rs->rs_conn_addr_v4; in rds_getname()
137 sin6->sin6_port = rs->rs_conn_port; in rds_getname()
138 sin6->sin6_addr = rs->rs_conn_addr; in rds_getname()
141 sin6->sin6_scope_id = rs->rs_bound_scope_id; in rds_getname()
151 if (ipv6_addr_any(&rs->rs_bound_addr)) { in rds_getname()
152 if (ipv6_addr_any(&rs->rs_conn_addr)) { in rds_getname()
160 if (!(ipv6_addr_type(&rs->rs_conn_addr) & in rds_getname()
174 if (ipv6_addr_v4mapped(&rs->rs_bound_addr)) { in rds_getname()
178 sin->sin_port = rs->rs_bound_port; in rds_getname()
179 sin->sin_addr.s_addr = rs->rs_bound_addr_v4; in rds_getname()
184 sin6->sin6_port = rs->rs_bound_port; in rds_getname()
185 sin6->sin6_addr = rs->rs_bound_addr; in rds_getname()
187 sin6->sin6_scope_id = rs->rs_bound_scope_id; in rds_getname()
216 struct rds_sock *rs = rds_sk_to_rs(sk); in rds_poll() local
222 if (rs->rs_seen_congestion) in rds_poll()
225 read_lock_irqsave(&rs->rs_recv_lock, flags); in rds_poll()
226 if (!rs->rs_cong_monitor) { in rds_poll()
230 if (rds_cong_updated_since(&rs->rs_cong_track)) in rds_poll()
233 spin_lock(&rs->rs_lock); in rds_poll()
234 if (rs->rs_cong_notify) in rds_poll()
236 spin_unlock(&rs->rs_lock); in rds_poll()
238 if (!list_empty(&rs->rs_recv_queue) || in rds_poll()
239 !list_empty(&rs->rs_notify_queue) || in rds_poll()
240 !list_empty(&rs->rs_zcookie_queue.zcookie_head)) in rds_poll()
242 if (rs->rs_snd_bytes < rds_sk_sndbuf(rs)) in rds_poll()
246 read_unlock_irqrestore(&rs->rs_recv_lock, flags); in rds_poll()
250 rs->rs_seen_congestion = 0; in rds_poll()
257 struct rds_sock *rs = rds_sk_to_rs(sock->sk); in rds_ioctl() local
265 if (rs->rs_transport && in rds_ioctl()
266 rs->rs_transport->get_tos_map) in rds_ioctl()
267 tos = rs->rs_transport->get_tos_map(utos); in rds_ioctl()
272 if (rs->rs_tos || rs->rs_conn) { in rds_ioctl()
276 rs->rs_tos = tos; in rds_ioctl()
281 tos = rs->rs_tos; in rds_ioctl()
293 static int rds_cancel_sent_to(struct rds_sock *rs, sockptr_t optval, int len) in rds_cancel_sent_to() argument
300 if (ipv6_addr_any(&rs->rs_bound_addr)) { in rds_cancel_sent_to()
325 rds_send_drop_to(rs, &sin6); in rds_cancel_sent_to()
343 static int rds_cong_monitor(struct rds_sock *rs, sockptr_t optval, int optlen) in rds_cong_monitor() argument
347 ret = rds_set_bool_option(&rs->rs_cong_monitor, optval, optlen); in rds_cong_monitor()
349 if (rs->rs_cong_monitor) { in rds_cong_monitor()
350 rds_cong_add_socket(rs); in rds_cong_monitor()
352 rds_cong_remove_socket(rs); in rds_cong_monitor()
353 rs->rs_cong_mask = 0; in rds_cong_monitor()
354 rs->rs_cong_notify = 0; in rds_cong_monitor()
360 static int rds_set_transport(struct rds_sock *rs, sockptr_t optval, int optlen) in rds_set_transport() argument
364 if (rs->rs_transport) in rds_set_transport()
376 rs->rs_transport = rds_trans_get(t_type); in rds_set_transport()
378 return rs->rs_transport ? 0 : -ENOPROTOOPT; in rds_set_transport()
405 static int rds_recv_track_latency(struct rds_sock *rs, sockptr_t optval, in rds_recv_track_latency() argument
420 rs->rs_rx_traces = trace.rx_traces; in rds_recv_track_latency()
421 for (i = 0; i < rs->rs_rx_traces; i++) { in rds_recv_track_latency()
423 rs->rs_rx_traces = 0; in rds_recv_track_latency()
426 rs->rs_rx_trace[i] = trace.rx_trace_pos[i]; in rds_recv_track_latency()
435 struct rds_sock *rs = rds_sk_to_rs(sock->sk); in rds_setsockopt() local
445 ret = rds_cancel_sent_to(rs, optval, optlen); in rds_setsockopt()
448 ret = rds_get_mr(rs, optval, optlen); in rds_setsockopt()
451 ret = rds_get_mr_for_dest(rs, optval, optlen); in rds_setsockopt()
454 ret = rds_free_mr(rs, optval, optlen); in rds_setsockopt()
457 ret = rds_set_bool_option(&rs->rs_recverr, optval, optlen); in rds_setsockopt()
460 ret = rds_cong_monitor(rs, optval, optlen); in rds_setsockopt()
464 ret = rds_set_transport(rs, optval, optlen); in rds_setsockopt()
474 ret = rds_recv_track_latency(rs, optval, optlen); in rds_setsockopt()
486 struct rds_sock *rs = rds_sk_to_rs(sock->sk); in rds_getsockopt() local
508 if (put_user(rs->rs_recverr, (int __user *) optval) || in rds_getsockopt()
519 trans = (rs->rs_transport ? rs->rs_transport->t_type : in rds_getsockopt()
541 struct rds_sock *rs = rds_sk_to_rs(sk); in rds_connect() local
565 ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &rs->rs_conn_addr); in rds_connect()
566 rs->rs_conn_port = sin->sin_port; in rds_connect()
605 (!ipv6_addr_any(&rs->rs_bound_addr) && in rds_connect()
606 rs->rs_bound_scope_id && in rds_connect()
607 sin6->sin6_scope_id != rs->rs_bound_scope_id)) { in rds_connect()
615 rs->rs_bound_scope_id = sin6->sin6_scope_id; in rds_connect()
617 rs->rs_conn_addr = sin6->sin6_addr; in rds_connect()
618 rs->rs_conn_port = sin6->sin6_port; in rds_connect()
660 struct rds_sock *rs = rds_sk_to_rs(sk); in rds_sock_destruct() local
662 WARN_ON((&rs->rs_item != rs->rs_item.next || in rds_sock_destruct()
663 &rs->rs_item != rs->rs_item.prev)); in rds_sock_destruct()
668 struct rds_sock *rs; in __rds_create() local
675 rs = rds_sk_to_rs(sk); in __rds_create()
676 spin_lock_init(&rs->rs_lock); in __rds_create()
677 rwlock_init(&rs->rs_recv_lock); in __rds_create()
678 INIT_LIST_HEAD(&rs->rs_send_queue); in __rds_create()
679 INIT_LIST_HEAD(&rs->rs_recv_queue); in __rds_create()
680 INIT_LIST_HEAD(&rs->rs_notify_queue); in __rds_create()
681 INIT_LIST_HEAD(&rs->rs_cong_list); in __rds_create()
682 rds_message_zcopy_queue_init(&rs->rs_zcookie_queue); in __rds_create()
683 spin_lock_init(&rs->rs_rdma_lock); in __rds_create()
684 rs->rs_rdma_keys = RB_ROOT; in __rds_create()
685 rs->rs_rx_traces = 0; in __rds_create()
686 rs->rs_tos = 0; in __rds_create()
687 rs->rs_conn = NULL; in __rds_create()
690 list_add_tail(&rs->rs_item, &rds_sock_list); in __rds_create()
712 void rds_sock_addref(struct rds_sock *rs) in rds_sock_addref() argument
714 sock_hold(rds_rs_to_sk(rs)); in rds_sock_addref()
717 void rds_sock_put(struct rds_sock *rs) in rds_sock_put() argument
719 sock_put(rds_rs_to_sk(rs)); in rds_sock_put()
732 struct rds_sock *rs; in rds_sock_inc_info() local
740 list_for_each_entry(rs, &rds_sock_list, rs_item) { in rds_sock_inc_info()
742 if (!ipv6_addr_v4mapped(&rs->rs_bound_addr)) in rds_sock_inc_info()
745 read_lock(&rs->rs_recv_lock); in rds_sock_inc_info()
748 list_for_each_entry(inc, &rs->rs_recv_queue, i_item) { in rds_sock_inc_info()
753 rs->rs_bound_addr_v4, in rds_sock_inc_info()
757 read_unlock(&rs->rs_recv_lock); in rds_sock_inc_info()
773 struct rds_sock *rs; in rds6_sock_inc_info() local
779 list_for_each_entry(rs, &rds_sock_list, rs_item) { in rds6_sock_inc_info()
780 read_lock(&rs->rs_recv_lock); in rds6_sock_inc_info()
782 list_for_each_entry(inc, &rs->rs_recv_queue, i_item) { in rds6_sock_inc_info()
786 &rs->rs_bound_addr, 1); in rds6_sock_inc_info()
789 read_unlock(&rs->rs_recv_lock); in rds6_sock_inc_info()
805 struct rds_sock *rs; in rds_sock_info() local
816 list_for_each_entry(rs, &rds_sock_list, rs_item) { in rds_sock_info()
818 if (!ipv6_addr_v4mapped(&rs->rs_bound_addr)) in rds_sock_info()
820 sinfo.sndbuf = rds_sk_sndbuf(rs); in rds_sock_info()
821 sinfo.rcvbuf = rds_sk_rcvbuf(rs); in rds_sock_info()
822 sinfo.bound_addr = rs->rs_bound_addr_v4; in rds_sock_info()
823 sinfo.connected_addr = rs->rs_conn_addr_v4; in rds_sock_info()
824 sinfo.bound_port = rs->rs_bound_port; in rds_sock_info()
825 sinfo.connected_port = rs->rs_conn_port; in rds_sock_info()
826 sinfo.inum = sock_i_ino(rds_rs_to_sk(rs)); in rds_sock_info()
845 struct rds_sock *rs; in rds6_sock_info() local
854 list_for_each_entry(rs, &rds_sock_list, rs_item) { in rds6_sock_info()
855 sinfo6.sndbuf = rds_sk_sndbuf(rs); in rds6_sock_info()
856 sinfo6.rcvbuf = rds_sk_rcvbuf(rs); in rds6_sock_info()
857 sinfo6.bound_addr = rs->rs_bound_addr; in rds6_sock_info()
858 sinfo6.connected_addr = rs->rs_conn_addr; in rds6_sock_info()
859 sinfo6.bound_port = rs->rs_bound_port; in rds6_sock_info()
860 sinfo6.connected_port = rs->rs_conn_port; in rds6_sock_info()
861 sinfo6.inum = sock_i_ino(rds_rs_to_sk(rs)); in rds6_sock_info()