Lines Matching refs:tsk

153 static int tipc_sk_publish(struct tipc_sock *tsk, struct tipc_uaddr *ua);
154 static int tipc_sk_withdraw(struct tipc_sock *tsk, struct tipc_uaddr *ua);
155 static int tipc_sk_leave(struct tipc_sock *tsk);
157 static int tipc_sk_insert(struct tipc_sock *tsk);
158 static void tipc_sk_remove(struct tipc_sock *tsk);
161 static void tipc_sk_push_backlog(struct tipc_sock *tsk, bool nagle_ack);
170 static u32 tsk_own_node(struct tipc_sock *tsk) in tsk_own_node() argument
172 return msg_prevnode(&tsk->phdr); in tsk_own_node()
175 static u32 tsk_peer_node(struct tipc_sock *tsk) in tsk_peer_node() argument
177 return msg_destnode(&tsk->phdr); in tsk_peer_node()
180 static u32 tsk_peer_port(struct tipc_sock *tsk) in tsk_peer_port() argument
182 return msg_destport(&tsk->phdr); in tsk_peer_port()
185 static bool tsk_unreliable(struct tipc_sock *tsk) in tsk_unreliable() argument
187 return msg_src_droppable(&tsk->phdr) != 0; in tsk_unreliable()
190 static void tsk_set_unreliable(struct tipc_sock *tsk, bool unreliable) in tsk_set_unreliable() argument
192 msg_set_src_droppable(&tsk->phdr, unreliable ? 1 : 0); in tsk_set_unreliable()
195 static bool tsk_unreturnable(struct tipc_sock *tsk) in tsk_unreturnable() argument
197 return msg_dest_droppable(&tsk->phdr) != 0; in tsk_unreturnable()
200 static void tsk_set_unreturnable(struct tipc_sock *tsk, bool unreturnable) in tsk_set_unreturnable() argument
202 msg_set_dest_droppable(&tsk->phdr, unreturnable ? 1 : 0); in tsk_set_unreturnable()
205 static int tsk_importance(struct tipc_sock *tsk) in tsk_importance() argument
207 return msg_importance(&tsk->phdr); in tsk_importance()
223 static bool tsk_conn_cong(struct tipc_sock *tsk) in tsk_conn_cong() argument
225 return tsk->snt_unacked > tsk->snd_win; in tsk_conn_cong()
246 static u16 tsk_inc(struct tipc_sock *tsk, int msglen) in tsk_inc() argument
248 if (likely(tsk->peer_caps & TIPC_BLOCK_FLOWCTL)) in tsk_inc()
255 static void tsk_set_nagle(struct tipc_sock *tsk) in tsk_set_nagle() argument
257 struct sock *sk = &tsk->sk; in tsk_set_nagle()
259 tsk->maxnagle = 0; in tsk_set_nagle()
262 if (tsk->nodelay) in tsk_set_nagle()
264 if (!(tsk->peer_caps & TIPC_NAGLE)) in tsk_set_nagle()
267 if (tsk->max_pkt == MAX_MSG_SIZE) in tsk_set_nagle()
268 tsk->maxnagle = 1500; in tsk_set_nagle()
270 tsk->maxnagle = tsk->max_pkt; in tsk_set_nagle()
337 static bool tsk_peer_msg(struct tipc_sock *tsk, struct tipc_msg *msg) in tsk_peer_msg() argument
339 struct sock *sk = &tsk->sk; in tsk_peer_msg()
341 u32 peer_port = tsk_peer_port(tsk); in tsk_peer_msg()
351 peer_node = tsk_peer_node(tsk); in tsk_peer_msg()
466 struct tipc_sock *tsk; in tipc_sk_create() local
493 tsk = tipc_sk(sk); in tipc_sk_create()
494 tsk->max_pkt = MAX_PKT_DEFAULT; in tipc_sk_create()
495 tsk->maxnagle = 0; in tipc_sk_create()
496 tsk->nagle_start = NAGLE_START_INIT; in tipc_sk_create()
497 INIT_LIST_HEAD(&tsk->publications); in tipc_sk_create()
498 INIT_LIST_HEAD(&tsk->cong_links); in tipc_sk_create()
499 msg = &tsk->phdr; in tipc_sk_create()
505 if (tipc_sk_insert(tsk)) { in tipc_sk_create()
517 msg_set_origport(msg, tsk->portid); in tipc_sk_create()
525 tsk->conn_timeout = CONN_TIMEOUT_DEFAULT; in tipc_sk_create()
526 tsk->group_is_open = true; in tipc_sk_create()
527 atomic_set(&tsk->dupl_rcvcnt, 0); in tipc_sk_create()
530 tsk->snd_win = tsk_adv_blocks(RCVBUF_MIN); in tipc_sk_create()
531 tsk->rcv_win = tsk->snd_win; in tipc_sk_create()
534 tsk_set_unreturnable(tsk, true); in tipc_sk_create()
536 tsk_set_unreliable(tsk, true); in tipc_sk_create()
538 __skb_queue_head_init(&tsk->mc_method.deferredq); in tipc_sk_create()
545 struct tipc_sock *tsk = container_of(head, struct tipc_sock, rcu); in tipc_sk_callback() local
547 sock_put(&tsk->sk); in tipc_sk_callback()
554 struct tipc_sock *tsk = tipc_sk(sk); in __tipc_shutdown() local
557 u32 dnode = tsk_peer_node(tsk); in __tipc_shutdown()
561 tipc_wait_for_cond(sock, &timeout, (!tsk->cong_link_cnt && in __tipc_shutdown()
562 !tsk_conn_cong(tsk))); in __tipc_shutdown()
565 tipc_sk_push_backlog(tsk, false); in __tipc_shutdown()
586 tipc_node_remove_conn(net, dnode, tsk->portid); in __tipc_shutdown()
596 tsk_own_node(tsk), tsk_peer_port(tsk), in __tipc_shutdown()
597 tsk->portid, error); in __tipc_shutdown()
599 tipc_node_xmit_skb(net, skb, dnode, tsk->portid); in __tipc_shutdown()
630 struct tipc_sock *tsk; in tipc_release() local
639 tsk = tipc_sk(sk); in tipc_release()
645 tipc_sk_leave(tsk); in tipc_release()
646 tipc_sk_withdraw(tsk, NULL); in tipc_release()
647 __skb_queue_purge(&tsk->mc_method.deferredq); in tipc_release()
649 tipc_sk_remove(tsk); in tipc_release()
654 tipc_dest_list_purge(&tsk->cong_links); in tipc_release()
655 tsk->cong_link_cnt = 0; in tipc_release()
656 call_rcu(&tsk->rcu, tipc_sk_callback); in tipc_release()
680 struct tipc_sock *tsk = tipc_sk(sock->sk); in __tipc_bind() local
684 return tipc_sk_withdraw(tsk, NULL); in __tipc_bind()
698 if (tsk->group) in __tipc_bind()
702 return tipc_sk_withdraw(tsk, ua); in __tipc_bind()
703 return tipc_sk_publish(tsk, ua); in __tipc_bind()
752 struct tipc_sock *tsk = tipc_sk(sk); in tipc_getname() local
759 addr->addr.id.ref = tsk_peer_port(tsk); in tipc_getname()
760 addr->addr.id.node = tsk_peer_node(tsk); in tipc_getname()
762 addr->addr.id.ref = tsk->portid; in tipc_getname()
796 struct tipc_sock *tsk = tipc_sk(sk); in tipc_poll() local
809 if (!tsk->cong_link_cnt && !tsk_conn_cong(tsk)) in tipc_poll()
818 if (tsk->group_is_open && !tsk->cong_link_cnt) in tipc_poll()
848 struct tipc_sock *tsk = tipc_sk(sk); in tipc_sendmcast() local
849 struct tipc_msg *hdr = &tsk->phdr; in tipc_sendmcast()
856 if (tsk->group) in tipc_sendmcast()
860 rc = tipc_wait_for_cond(sock, &timeout, !tsk->cong_link_cnt); in tipc_sendmcast()
888 rc = tipc_mcast_xmit(net, &pkts, &tsk->mc_method, &dsts, in tipc_sendmcast()
889 &tsk->cong_link_cnt); in tipc_sendmcast()
907 static int tipc_send_group_msg(struct net *net, struct tipc_sock *tsk, in tipc_send_group_msg() argument
911 u16 bc_snd_nxt = tipc_group_bc_snd_nxt(tsk->group); in tipc_send_group_msg()
912 struct tipc_mc_method *method = &tsk->mc_method; in tipc_send_group_msg()
914 struct tipc_msg *hdr = &tsk->phdr; in tipc_send_group_msg()
927 mtu = tipc_node_get_mtu(net, dnode, tsk->portid, false); in tipc_send_group_msg()
933 rc = tipc_node_xmit(net, &pkts, dnode, tsk->portid); in tipc_send_group_msg()
935 tipc_dest_push(&tsk->cong_links, dnode, 0); in tipc_send_group_msg()
936 tsk->cong_link_cnt++; in tipc_send_group_msg()
964 struct tipc_sock *tsk = tipc_sk(sk); in tipc_send_group_unicast() local
977 !tipc_dest_find(&tsk->cong_links, node, 0) && in tipc_send_group_unicast()
978 tsk->group && in tipc_send_group_unicast()
979 !tipc_group_cong(tsk->group, node, port, blks, in tipc_send_group_unicast()
987 rc = tipc_send_group_msg(net, tsk, m, mb, node, port, dlen); in tipc_send_group_unicast()
1007 struct tipc_sock *tsk = tipc_sk(sk); in tipc_send_group_anycast() local
1008 struct list_head *cong_links = &tsk->cong_links; in tipc_send_group_anycast()
1010 struct tipc_msg *hdr = &tsk->phdr; in tipc_send_group_anycast()
1025 exclude = tipc_group_exclude(tsk->group); in tipc_send_group_anycast()
1035 cong = tipc_group_cong(tsk->group, node, port, blks, in tipc_send_group_anycast()
1055 tsk->group && in tipc_send_group_anycast()
1056 !tipc_group_cong(tsk->group, node, port, in tipc_send_group_anycast()
1069 rc = tipc_send_group_msg(net, tsk, m, mbr, node, port, dlen); in tipc_send_group_anycast()
1090 struct tipc_sock *tsk = tipc_sk(sk); in tipc_send_group_bcast() local
1092 struct tipc_mc_method *method = &tsk->mc_method; in tipc_send_group_bcast()
1095 struct tipc_msg *hdr = &tsk->phdr; in tipc_send_group_bcast()
1102 !tsk->cong_link_cnt && tsk->group && in tipc_send_group_bcast()
1103 !tipc_group_bc_cong(tsk->group, blks)); in tipc_send_group_bcast()
1107 dsts = tipc_group_dests(tsk->group); in tipc_send_group_bcast()
1122 msg_set_grp_bc_seqno(hdr, tipc_group_bc_snd_nxt(tsk->group)); in tipc_send_group_bcast()
1134 rc = tipc_mcast_xmit(net, &pkts, method, dsts, &tsk->cong_link_cnt); in tipc_send_group_bcast()
1139 tipc_group_update_bc_members(tsk->group, blks, ack); in tipc_send_group_bcast()
1163 struct tipc_sock *tsk = tipc_sk(sk); in tipc_send_group_mcast() local
1164 struct tipc_group *grp = tsk->group; in tipc_send_group_mcast()
1165 struct tipc_msg *hdr = &tsk->phdr; in tipc_send_group_mcast()
1275 static void tipc_sk_push_backlog(struct tipc_sock *tsk, bool nagle_ack) in tipc_sk_push_backlog() argument
1277 struct sk_buff_head *txq = &tsk->sk.sk_write_queue; in tipc_sk_push_backlog()
1279 struct net *net = sock_net(&tsk->sk); in tipc_sk_push_backlog()
1280 u32 dnode = tsk_peer_node(tsk); in tipc_sk_push_backlog()
1284 tsk->pkt_cnt += skb_queue_len(txq); in tipc_sk_push_backlog()
1285 if (!tsk->pkt_cnt || tsk->msg_acc / tsk->pkt_cnt < 2) { in tipc_sk_push_backlog()
1286 tsk->oneway = 0; in tipc_sk_push_backlog()
1287 if (tsk->nagle_start < NAGLE_START_MAX) in tipc_sk_push_backlog()
1288 tsk->nagle_start *= 2; in tipc_sk_push_backlog()
1289 tsk->expect_ack = false; in tipc_sk_push_backlog()
1291 tsk->portid, tsk->msg_acc, tsk->pkt_cnt, in tipc_sk_push_backlog()
1292 tsk->nagle_start); in tipc_sk_push_backlog()
1294 tsk->nagle_start = NAGLE_START_INIT; in tipc_sk_push_backlog()
1297 tsk->expect_ack = true; in tipc_sk_push_backlog()
1299 tsk->expect_ack = false; in tipc_sk_push_backlog()
1302 tsk->msg_acc = 0; in tipc_sk_push_backlog()
1303 tsk->pkt_cnt = 0; in tipc_sk_push_backlog()
1306 if (!skb || tsk->cong_link_cnt) in tipc_sk_push_backlog()
1313 if (tsk->msg_acc) in tipc_sk_push_backlog()
1314 tsk->pkt_cnt += skb_queue_len(txq); in tipc_sk_push_backlog()
1315 tsk->snt_unacked += tsk->snd_backlog; in tipc_sk_push_backlog()
1316 tsk->snd_backlog = 0; in tipc_sk_push_backlog()
1317 rc = tipc_node_xmit(net, txq, dnode, tsk->portid); in tipc_sk_push_backlog()
1319 tsk->cong_link_cnt = 1; in tipc_sk_push_backlog()
1329 static void tipc_sk_conn_proto_rcv(struct tipc_sock *tsk, struct sk_buff *skb, in tipc_sk_conn_proto_rcv() argument
1334 u32 onode = tsk_own_node(tsk); in tipc_sk_conn_proto_rcv()
1335 struct sock *sk = &tsk->sk; in tipc_sk_conn_proto_rcv()
1340 if (!tsk_peer_msg(tsk, hdr)) { in tipc_sk_conn_proto_rcv()
1347 tipc_node_remove_conn(sock_net(sk), tsk_peer_node(tsk), in tipc_sk_conn_proto_rcv()
1348 tsk_peer_port(tsk)); in tipc_sk_conn_proto_rcv()
1362 tsk->probe_unacked = false; in tipc_sk_conn_proto_rcv()
1370 was_cong = tsk_conn_cong(tsk); in tipc_sk_conn_proto_rcv()
1371 tipc_sk_push_backlog(tsk, msg_nagle_ack(hdr)); in tipc_sk_conn_proto_rcv()
1372 tsk->snt_unacked -= msg_conn_ack(hdr); in tipc_sk_conn_proto_rcv()
1373 if (tsk->peer_caps & TIPC_BLOCK_FLOWCTL) in tipc_sk_conn_proto_rcv()
1374 tsk->snd_win = msg_adv_win(hdr); in tipc_sk_conn_proto_rcv()
1375 if (was_cong && !tsk_conn_cong(tsk)) in tipc_sk_conn_proto_rcv()
1414 struct tipc_sock *tsk = tipc_sk(sk); in __tipc_sendmsg() local
1417 struct list_head *clinks = &tsk->cong_links; in __tipc_sendmsg()
1419 struct tipc_group *grp = tsk->group; in __tipc_sendmsg()
1420 struct tipc_msg *hdr = &tsk->phdr; in __tipc_sendmsg()
1448 ua = (struct tipc_uaddr *)&tsk->peer; in __tipc_sendmsg()
1459 if (tsk->published) in __tipc_sendmsg()
1462 tsk->conn_addrtype = atype; in __tipc_sendmsg()
1505 mtu = tipc_node_get_mtu(net, skaddr.node, tsk->portid, true); in __tipc_sendmsg()
1516 rc = tipc_node_xmit(net, &pkts, skaddr.node, tsk->portid); in __tipc_sendmsg()
1519 tsk->cong_link_cnt++; in __tipc_sendmsg()
1563 struct tipc_sock *tsk = tipc_sk(sk); in __tipc_sendstream() local
1564 struct tipc_msg *hdr = &tsk->phdr; in __tipc_sendstream()
1567 u32 dnode = tsk_peer_node(tsk); in __tipc_sendstream()
1568 int maxnagle = tsk->maxnagle; in __tipc_sendstream()
1569 int maxpkt = tsk->max_pkt; in __tipc_sendstream()
1580 tsk->peer_caps = tipc_node_get_capabilities(net, dnode); in __tipc_sendstream()
1581 tsk->snt_unacked = tsk_inc(tsk, dlen + msg_hdr_sz(hdr)); in __tipc_sendstream()
1588 (!tsk->cong_link_cnt && in __tipc_sendstream()
1589 !tsk_conn_cong(tsk) && in __tipc_sendstream()
1594 blocks = tsk->snd_backlog; in __tipc_sendstream()
1595 if (tsk->oneway++ >= tsk->nagle_start && maxnagle && in __tipc_sendstream()
1601 tsk->msg_acc++; in __tipc_sendstream()
1602 if (blocks <= 64 && tsk->expect_ack) { in __tipc_sendstream()
1603 tsk->snd_backlog = blocks; in __tipc_sendstream()
1607 tsk->pkt_cnt += skb_queue_len(txq); in __tipc_sendstream()
1612 tsk->expect_ack = true; in __tipc_sendstream()
1614 tsk->expect_ack = false; in __tipc_sendstream()
1616 tsk->msg_acc = 0; in __tipc_sendstream()
1617 tsk->pkt_cnt = 0; in __tipc_sendstream()
1623 blocks += tsk_inc(tsk, send + MIN_H_SIZE); in __tipc_sendstream()
1627 rc = tipc_node_xmit(net, txq, dnode, tsk->portid); in __tipc_sendstream()
1629 tsk->cong_link_cnt = 1; in __tipc_sendstream()
1633 tsk->snt_unacked += blocks; in __tipc_sendstream()
1634 tsk->snd_backlog = 0; in __tipc_sendstream()
1662 static void tipc_sk_finish_conn(struct tipc_sock *tsk, u32 peer_port, in tipc_sk_finish_conn() argument
1665 struct sock *sk = &tsk->sk; in tipc_sk_finish_conn()
1667 struct tipc_msg *msg = &tsk->phdr; in tipc_sk_finish_conn()
1678 tipc_node_add_conn(net, peer_node, tsk->portid, peer_port); in tipc_sk_finish_conn()
1679 tsk->max_pkt = tipc_node_get_mtu(net, peer_node, tsk->portid, true); in tipc_sk_finish_conn()
1680 tsk->peer_caps = tipc_node_get_capabilities(net, peer_node); in tipc_sk_finish_conn()
1681 tsk_set_nagle(tsk); in tipc_sk_finish_conn()
1683 if (tsk->peer_caps & TIPC_BLOCK_FLOWCTL) in tipc_sk_finish_conn()
1687 tsk->rcv_win = FLOWCTL_MSG_WIN; in tipc_sk_finish_conn()
1688 tsk->snd_win = FLOWCTL_MSG_WIN; in tipc_sk_finish_conn()
1738 struct tipc_sock *tsk) in tipc_sk_anc_data_recv() argument
1781 has_addr = !!tsk->conn_addrtype; in tipc_sk_anc_data_recv()
1782 data[0] = msg_nametype(&tsk->phdr); in tipc_sk_anc_data_recv()
1783 data[1] = msg_nameinst(&tsk->phdr); in tipc_sk_anc_data_recv()
1794 static struct sk_buff *tipc_sk_build_ack(struct tipc_sock *tsk) in tipc_sk_build_ack() argument
1796 struct sock *sk = &tsk->sk; in tipc_sk_build_ack()
1799 u32 peer_port = tsk_peer_port(tsk); in tipc_sk_build_ack()
1800 u32 dnode = tsk_peer_node(tsk); in tipc_sk_build_ack()
1805 dnode, tsk_own_node(tsk), peer_port, in tipc_sk_build_ack()
1806 tsk->portid, TIPC_OK); in tipc_sk_build_ack()
1810 msg_set_conn_ack(msg, tsk->rcv_unacked); in tipc_sk_build_ack()
1811 tsk->rcv_unacked = 0; in tipc_sk_build_ack()
1814 if (tsk->peer_caps & TIPC_BLOCK_FLOWCTL) { in tipc_sk_build_ack()
1815 tsk->rcv_win = tsk_adv_blocks(tsk->sk.sk_rcvbuf); in tipc_sk_build_ack()
1816 msg_set_adv_win(msg, tsk->rcv_win); in tipc_sk_build_ack()
1821 static void tipc_sk_send_ack(struct tipc_sock *tsk) in tipc_sk_send_ack() argument
1825 skb = tipc_sk_build_ack(tsk); in tipc_sk_send_ack()
1829 tipc_node_xmit_skb(sock_net(&tsk->sk), skb, tsk_peer_node(tsk), in tipc_sk_send_ack()
1891 struct tipc_sock *tsk = tipc_sk(sk); in tipc_recvmsg() local
1930 rc = tipc_sk_anc_data_recv(m, skb, tsk); in tipc_recvmsg()
1978 if (tsk->group && msg_in_group(hdr) && !grp_evt) { in tipc_recvmsg()
1980 tipc_group_update_rcv_win(tsk->group, tsk_blocks(hlen + dlen), in tipc_recvmsg()
1995 tsk->rcv_unacked += tsk_inc(tsk, hlen + dlen); in tipc_recvmsg()
1996 if (tsk->rcv_unacked >= tsk->rcv_win / TIPC_ACK_RATE) in tipc_recvmsg()
1997 tipc_sk_send_ack(tsk); in tipc_recvmsg()
2019 struct tipc_sock *tsk = tipc_sk(sk); in tipc_recvstream() local
2062 rc = tipc_sk_anc_data_recv(m, skb, tsk); in tipc_recvstream()
2096 tsk->rcv_unacked += tsk_inc(tsk, hlen + dlen); in tipc_recvstream()
2097 if (tsk->rcv_unacked >= tsk->rcv_win / TIPC_ACK_RATE) in tipc_recvstream()
2098 tipc_sk_send_ack(tsk); in tipc_recvstream()
2154 struct tipc_sock *tsk = tipc_sk(sk); in tipc_sk_proto_rcv() local
2156 struct tipc_group *grp = tsk->group; in tipc_sk_proto_rcv()
2161 tipc_sk_conn_proto_rcv(tsk, skb, inputq, xmitq); in tipc_sk_proto_rcv()
2164 tipc_dest_del(&tsk->cong_links, msg_orignode(hdr), 0); in tipc_sk_proto_rcv()
2167 tsk->cong_link_cnt--; in tipc_sk_proto_rcv()
2169 tipc_sk_push_backlog(tsk, false); in tipc_sk_proto_rcv()
2175 tipc_group_member_evt(tsk->group, &wakeup, &sk->sk_rcvbuf, in tipc_sk_proto_rcv()
2195 static bool tipc_sk_filter_connect(struct tipc_sock *tsk, struct sk_buff *skb, in tipc_sk_filter_connect() argument
2198 struct sock *sk = &tsk->sk; in tipc_sk_filter_connect()
2202 u32 pport = tsk_peer_port(tsk); in tipc_sk_filter_connect()
2203 u32 pnode = tsk_peer_node(tsk); in tipc_sk_filter_connect()
2211 tsk->oneway = 0; in tipc_sk_filter_connect()
2219 tipc_sk_finish_conn(tsk, oport, onode); in tipc_sk_filter_connect()
2220 msg_set_importance(&tsk->phdr, msg_importance(hdr)); in tipc_sk_filter_connect()
2241 delay %= (tsk->conn_timeout / 4); in tipc_sk_filter_connect()
2258 tipc_sk_push_backlog(tsk, false); in tipc_sk_filter_connect()
2265 skb = tipc_sk_build_ack(tsk); in tipc_sk_filter_connect()
2273 if (!tsk_peer_msg(tsk, hdr)) in tipc_sk_filter_connect()
2278 tipc_node_remove_conn(net, pnode, tsk->portid); in tipc_sk_filter_connect()
2311 struct tipc_sock *tsk = tipc_sk(sk); in rcvbuf_limit() local
2320 if (likely(tsk->peer_caps & TIPC_BLOCK_FLOWCTL)) in rcvbuf_limit()
2341 struct tipc_sock *tsk = tipc_sk(sk); in tipc_sk_filter_rcv() local
2342 struct tipc_group *grp = tsk->group; in tipc_sk_filter_rcv()
2361 tipc_mcast_filter_msg(net, &tsk->mc_method.deferredq, &inputq); in tipc_sk_filter_rcv()
2367 if ((sk_conn && !tipc_sk_filter_connect(tsk, skb, xmitq)) || in tipc_sk_filter_rcv()
2488 struct tipc_sock *tsk; in tipc_sk_rcv() local
2495 tsk = tipc_sk_lookup(net, dport); in tipc_sk_rcv()
2497 if (likely(tsk)) { in tipc_sk_rcv()
2498 sk = &tsk->sk; in tipc_sk_rcv()
2577 struct tipc_sock *tsk = tipc_sk(sk); in tipc_connect() local
2580 long timeout = (flags & O_NONBLOCK) ? 0 : tsk->conn_timeout; in tipc_connect()
2589 if (tsk->group) { in tipc_connect()
2595 memset(&tsk->peer, 0, sizeof(struct sockaddr_tipc)); in tipc_connect()
2606 memcpy(&tsk->peer, dest, destlen); in tipc_connect()
2832 struct tipc_sock *tsk = tipc_sk(sk); in tipc_sk_check_probing_state() local
2833 u32 pnode = tsk_peer_node(tsk); in tipc_sk_check_probing_state()
2834 u32 pport = tsk_peer_port(tsk); in tipc_sk_check_probing_state()
2835 u32 self = tsk_own_node(tsk); in tipc_sk_check_probing_state()
2836 u32 oport = tsk->portid; in tipc_sk_check_probing_state()
2839 if (tsk->probe_unacked) { in tipc_sk_check_probing_state()
2851 tsk->probe_unacked = true; in tipc_sk_check_probing_state()
2857 struct tipc_sock *tsk = tipc_sk(sk); in tipc_sk_retry_connect() local
2860 if (tsk->cong_link_cnt) { in tipc_sk_retry_connect()
2872 struct tipc_sock *tsk = tipc_sk(sk); in tipc_sk_timeout() local
2873 u32 pnode = tsk_peer_node(tsk); in tipc_sk_timeout()
2896 rc = tipc_node_xmit(sock_net(sk), &list, pnode, tsk->portid); in tipc_sk_timeout()
2900 tipc_dest_push(&tsk->cong_links, pnode, 0); in tipc_sk_timeout()
2901 tsk->cong_link_cnt = 1; in tipc_sk_timeout()
2906 static int tipc_sk_publish(struct tipc_sock *tsk, struct tipc_uaddr *ua) in tipc_sk_publish() argument
2908 struct sock *sk = &tsk->sk; in tipc_sk_publish()
2916 key = tsk->portid + tsk->pub_count + 1; in tipc_sk_publish()
2917 if (key == tsk->portid) in tipc_sk_publish()
2919 skaddr.ref = tsk->portid; in tipc_sk_publish()
2925 list_add(&p->binding_sock, &tsk->publications); in tipc_sk_publish()
2926 tsk->pub_count++; in tipc_sk_publish()
2927 tsk->published = true; in tipc_sk_publish()
2931 static int tipc_sk_withdraw(struct tipc_sock *tsk, struct tipc_uaddr *ua) in tipc_sk_withdraw() argument
2933 struct net *net = sock_net(&tsk->sk); in tipc_sk_withdraw()
2938 list_for_each_entry_safe(p, safe, &tsk->publications, binding_sock) { in tipc_sk_withdraw()
2958 if (list_empty(&tsk->publications)) { in tipc_sk_withdraw()
2959 tsk->published = 0; in tipc_sk_withdraw()
2972 struct tipc_sock *tsk; in tipc_sk_reinit() local
2980 while ((tsk = rhashtable_walk_next(&iter)) && !IS_ERR(tsk)) { in tipc_sk_reinit()
2981 sock_hold(&tsk->sk); in tipc_sk_reinit()
2983 lock_sock(&tsk->sk); in tipc_sk_reinit()
2984 msg = &tsk->phdr; in tipc_sk_reinit()
2987 release_sock(&tsk->sk); in tipc_sk_reinit()
2989 sock_put(&tsk->sk); in tipc_sk_reinit()
2993 } while (tsk == ERR_PTR(-EAGAIN)); in tipc_sk_reinit()
3001 struct tipc_sock *tsk; in tipc_sk_lookup() local
3004 tsk = rhashtable_lookup(&tn->sk_rht, &portid, tsk_rht_params); in tipc_sk_lookup()
3005 if (tsk) in tipc_sk_lookup()
3006 sock_hold(&tsk->sk); in tipc_sk_lookup()
3009 return tsk; in tipc_sk_lookup()
3012 static int tipc_sk_insert(struct tipc_sock *tsk) in tipc_sk_insert() argument
3014 struct sock *sk = &tsk->sk; in tipc_sk_insert()
3024 tsk->portid = portid; in tipc_sk_insert()
3025 sock_hold(&tsk->sk); in tipc_sk_insert()
3026 if (!rhashtable_lookup_insert_fast(&tn->sk_rht, &tsk->node, in tipc_sk_insert()
3029 sock_put(&tsk->sk); in tipc_sk_insert()
3035 static void tipc_sk_remove(struct tipc_sock *tsk) in tipc_sk_remove() argument
3037 struct sock *sk = &tsk->sk; in tipc_sk_remove()
3040 if (!rhashtable_remove_fast(&tn->sk_rht, &tsk->node, tsk_rht_params)) { in tipc_sk_remove()
3073 static int tipc_sk_join(struct tipc_sock *tsk, struct tipc_group_req *mreq) in tipc_sk_join() argument
3075 struct net *net = sock_net(&tsk->sk); in tipc_sk_join()
3076 struct tipc_group *grp = tsk->group; in tipc_sk_join()
3077 struct tipc_msg *hdr = &tsk->phdr; in tipc_sk_join()
3089 grp = tipc_group_create(net, tsk->portid, mreq, &tsk->group_is_open); in tipc_sk_join()
3092 tsk->group = grp; in tipc_sk_join()
3099 rc = tipc_sk_publish(tsk, &ua); in tipc_sk_join()
3102 tsk->group = NULL; in tipc_sk_join()
3106 tsk->mc_method.rcast = true; in tipc_sk_join()
3107 tsk->mc_method.mandatory = true; in tipc_sk_join()
3108 tipc_group_join(net, grp, &tsk->sk.sk_rcvbuf); in tipc_sk_join()
3112 static int tipc_sk_leave(struct tipc_sock *tsk) in tipc_sk_leave() argument
3114 struct net *net = sock_net(&tsk->sk); in tipc_sk_leave()
3115 struct tipc_group *grp = tsk->group; in tipc_sk_leave()
3125 tsk->group = NULL; in tipc_sk_leave()
3126 tipc_sk_withdraw(tsk, &ua); in tipc_sk_leave()
3147 struct tipc_sock *tsk = tipc_sk(sk); in tipc_setsockopt() local
3187 tsk_set_unreliable(tsk, value); in tipc_setsockopt()
3192 tsk_set_unreturnable(tsk, value); in tipc_setsockopt()
3198 tsk->mc_method.rcast = false; in tipc_setsockopt()
3199 tsk->mc_method.mandatory = true; in tipc_setsockopt()
3202 tsk->mc_method.rcast = true; in tipc_setsockopt()
3203 tsk->mc_method.mandatory = true; in tipc_setsockopt()
3206 res = tipc_sk_join(tsk, &mreq); in tipc_setsockopt()
3209 res = tipc_sk_leave(tsk); in tipc_setsockopt()
3212 tsk->nodelay = !!value; in tipc_setsockopt()
3213 tsk_set_nagle(tsk); in tipc_setsockopt()
3241 struct tipc_sock *tsk = tipc_sk(sk); in tipc_getsockopt() local
3259 value = tsk_importance(tsk); in tipc_getsockopt()
3262 value = tsk_unreliable(tsk); in tipc_getsockopt()
3265 value = tsk_unreturnable(tsk); in tipc_getsockopt()
3268 value = tsk->conn_timeout; in tipc_getsockopt()
3282 if (tsk->group) in tipc_getsockopt()
3283 tipc_group_self(tsk->group, &seq, &scope); in tipc_getsockopt()
3468 static int __tipc_nl_add_sk_con(struct sk_buff *skb, struct tipc_sock *tsk) in __tipc_nl_add_sk_con() argument
3474 peer_node = tsk_peer_node(tsk); in __tipc_nl_add_sk_con()
3475 peer_port = tsk_peer_port(tsk); in __tipc_nl_add_sk_con()
3476 conn_type = msg_nametype(&tsk->phdr); in __tipc_nl_add_sk_con()
3477 conn_instance = msg_nameinst(&tsk->phdr); in __tipc_nl_add_sk_con()
3487 if (tsk->conn_addrtype != 0) { in __tipc_nl_add_sk_con()
3506 *tsk) in __tipc_nl_add_sk_info()
3509 struct sock *sk = &tsk->sk; in __tipc_nl_add_sk_info()
3511 if (nla_put_u32(skb, TIPC_NLA_SOCK_REF, tsk->portid) || in __tipc_nl_add_sk_info()
3516 if (__tipc_nl_add_sk_con(skb, tsk)) in __tipc_nl_add_sk_info()
3518 } else if (!list_empty(&tsk->publications)) { in __tipc_nl_add_sk_info()
3527 struct tipc_sock *tsk) in __tipc_nl_add_sk() argument
3541 if (__tipc_nl_add_sk_info(skb, tsk)) in __tipc_nl_add_sk()
3560 struct tipc_sock *tsk)) in tipc_nl_sk_walk() argument
3563 struct tipc_sock *tsk; in tipc_nl_sk_walk() local
3567 while ((tsk = rhashtable_walk_next(iter)) != NULL) { in tipc_nl_sk_walk()
3568 if (IS_ERR(tsk)) { in tipc_nl_sk_walk()
3569 err = PTR_ERR(tsk); in tipc_nl_sk_walk()
3577 sock_hold(&tsk->sk); in tipc_nl_sk_walk()
3579 lock_sock(&tsk->sk); in tipc_nl_sk_walk()
3580 err = skb_handler(skb, cb, tsk); in tipc_nl_sk_walk()
3582 release_sock(&tsk->sk); in tipc_nl_sk_walk()
3583 sock_put(&tsk->sk); in tipc_nl_sk_walk()
3586 release_sock(&tsk->sk); in tipc_nl_sk_walk()
3588 sock_put(&tsk->sk); in tipc_nl_sk_walk()
3631 struct tipc_sock *tsk, u32 sk_filter_state, in tipc_sk_fill_sock_diag() argument
3634 struct sock *sk = &tsk->sk; in tipc_sk_fill_sock_diag()
3646 if (__tipc_nl_add_sk_info(skb, tsk)) in tipc_sk_fill_sock_diag()
3672 if (tsk->cong_link_cnt && in tipc_sk_fill_sock_diag()
3676 if (tsk_conn_cong(tsk) && in tipc_sk_fill_sock_diag()
3682 if (tsk->group) in tipc_sk_fill_sock_diag()
3683 if (tipc_group_fill_sock_diag(tsk->group, skb)) in tipc_sk_fill_sock_diag()
3746 struct tipc_sock *tsk, u32 *last_publ) in __tipc_nl_list_sk_publ() argument
3752 list_for_each_entry(p, &tsk->publications, binding_sock) { in __tipc_nl_list_sk_publ()
3756 if (list_entry_is_head(p, &tsk->publications, binding_sock)) { in __tipc_nl_list_sk_publ()
3768 p = list_first_entry(&tsk->publications, struct publication, in __tipc_nl_list_sk_publ()
3772 list_for_each_entry_from(p, &tsk->publications, binding_sock) { in __tipc_nl_list_sk_publ()
3791 struct tipc_sock *tsk; in tipc_nl_publ_dump() local
3815 tsk = tipc_sk_lookup(net, tsk_portid); in tipc_nl_publ_dump()
3816 if (!tsk) in tipc_nl_publ_dump()
3819 lock_sock(&tsk->sk); in tipc_nl_publ_dump()
3820 err = __tipc_nl_list_sk_publ(skb, cb, tsk, &last_publ); in tipc_nl_publ_dump()
3823 release_sock(&tsk->sk); in tipc_nl_publ_dump()
3824 sock_put(&tsk->sk); in tipc_nl_publ_dump()
3846 struct tipc_sock *tsk; in tipc_sk_filtering() local
3854 tsk = tipc_sk(sk); in tipc_sk_filtering()
3866 return (_port == tsk->portid); in tipc_sk_filtering()
3871 if (tsk->published) { in tipc_sk_filtering()
3872 p = list_first_entry_or_null(&tsk->publications, in tipc_sk_filtering()
3882 type = msg_nametype(&tsk->phdr); in tipc_sk_filtering()
3883 lower = msg_nameinst(&tsk->phdr); in tipc_sk_filtering()
3950 struct tipc_sock *tsk; in tipc_sk_dump() local
3959 tsk = tipc_sk(sk); in tipc_sk_dump()
3964 i += scnprintf(buf + i, sz - i, " %x", tsk_own_node(tsk)); in tipc_sk_dump()
3965 i += scnprintf(buf + i, sz - i, " %u", tsk->portid); in tipc_sk_dump()
3968 i += scnprintf(buf + i, sz - i, " %x", tsk_peer_node(tsk)); in tipc_sk_dump()
3969 i += scnprintf(buf + i, sz - i, " %u", tsk_peer_port(tsk)); in tipc_sk_dump()
3970 conn_type = msg_nametype(&tsk->phdr); in tipc_sk_dump()
3971 conn_instance = msg_nameinst(&tsk->phdr); in tipc_sk_dump()
3975 i += scnprintf(buf + i, sz - i, " | %u", tsk->published); in tipc_sk_dump()
3976 if (tsk->published) { in tipc_sk_dump()
3977 p = list_first_entry_or_null(&tsk->publications, in tipc_sk_dump()
3983 i += scnprintf(buf + i, sz - i, " | %u", tsk->snd_win); in tipc_sk_dump()
3984 i += scnprintf(buf + i, sz - i, " %u", tsk->rcv_win); in tipc_sk_dump()
3985 i += scnprintf(buf + i, sz - i, " %u", tsk->max_pkt); in tipc_sk_dump()
3986 i += scnprintf(buf + i, sz - i, " %x", tsk->peer_caps); in tipc_sk_dump()
3987 i += scnprintf(buf + i, sz - i, " %u", tsk->cong_link_cnt); in tipc_sk_dump()
3988 i += scnprintf(buf + i, sz - i, " %u", tsk->snt_unacked); in tipc_sk_dump()
3989 i += scnprintf(buf + i, sz - i, " %u", tsk->rcv_unacked); in tipc_sk_dump()
3990 i += scnprintf(buf + i, sz - i, " %u", atomic_read(&tsk->dupl_rcvcnt)); in tipc_sk_dump()