Lines Matching refs:tsk

152 static int tipc_sk_publish(struct tipc_sock *tsk, struct tipc_uaddr *ua);
153 static int tipc_sk_withdraw(struct tipc_sock *tsk, struct tipc_uaddr *ua);
154 static int tipc_sk_leave(struct tipc_sock *tsk);
156 static int tipc_sk_insert(struct tipc_sock *tsk);
157 static void tipc_sk_remove(struct tipc_sock *tsk);
160 static void tipc_sk_push_backlog(struct tipc_sock *tsk, bool nagle_ack);
169 static u32 tsk_own_node(struct tipc_sock *tsk) in tsk_own_node() argument
171 return msg_prevnode(&tsk->phdr); in tsk_own_node()
174 static u32 tsk_peer_node(struct tipc_sock *tsk) in tsk_peer_node() argument
176 return msg_destnode(&tsk->phdr); in tsk_peer_node()
179 static u32 tsk_peer_port(struct tipc_sock *tsk) in tsk_peer_port() argument
181 return msg_destport(&tsk->phdr); in tsk_peer_port()
184 static bool tsk_unreliable(struct tipc_sock *tsk) in tsk_unreliable() argument
186 return msg_src_droppable(&tsk->phdr) != 0; in tsk_unreliable()
189 static void tsk_set_unreliable(struct tipc_sock *tsk, bool unreliable) in tsk_set_unreliable() argument
191 msg_set_src_droppable(&tsk->phdr, unreliable ? 1 : 0); in tsk_set_unreliable()
194 static bool tsk_unreturnable(struct tipc_sock *tsk) in tsk_unreturnable() argument
196 return msg_dest_droppable(&tsk->phdr) != 0; in tsk_unreturnable()
199 static void tsk_set_unreturnable(struct tipc_sock *tsk, bool unreturnable) in tsk_set_unreturnable() argument
201 msg_set_dest_droppable(&tsk->phdr, unreturnable ? 1 : 0); in tsk_set_unreturnable()
204 static int tsk_importance(struct tipc_sock *tsk) in tsk_importance() argument
206 return msg_importance(&tsk->phdr); in tsk_importance()
222 static bool tsk_conn_cong(struct tipc_sock *tsk) in tsk_conn_cong() argument
224 return tsk->snt_unacked > tsk->snd_win; in tsk_conn_cong()
245 static u16 tsk_inc(struct tipc_sock *tsk, int msglen) in tsk_inc() argument
247 if (likely(tsk->peer_caps & TIPC_BLOCK_FLOWCTL)) in tsk_inc()
254 static void tsk_set_nagle(struct tipc_sock *tsk) in tsk_set_nagle() argument
256 struct sock *sk = &tsk->sk; in tsk_set_nagle()
258 tsk->maxnagle = 0; in tsk_set_nagle()
261 if (tsk->nodelay) in tsk_set_nagle()
263 if (!(tsk->peer_caps & TIPC_NAGLE)) in tsk_set_nagle()
266 if (tsk->max_pkt == MAX_MSG_SIZE) in tsk_set_nagle()
267 tsk->maxnagle = 1500; in tsk_set_nagle()
269 tsk->maxnagle = tsk->max_pkt; in tsk_set_nagle()
336 static bool tsk_peer_msg(struct tipc_sock *tsk, struct tipc_msg *msg) in tsk_peer_msg() argument
338 struct sock *sk = &tsk->sk; in tsk_peer_msg()
340 u32 peer_port = tsk_peer_port(tsk); in tsk_peer_msg()
350 peer_node = tsk_peer_node(tsk); in tsk_peer_msg()
465 struct tipc_sock *tsk; in tipc_sk_create() local
492 tsk = tipc_sk(sk); in tipc_sk_create()
493 tsk->max_pkt = MAX_PKT_DEFAULT; in tipc_sk_create()
494 tsk->maxnagle = 0; in tipc_sk_create()
495 tsk->nagle_start = NAGLE_START_INIT; in tipc_sk_create()
496 INIT_LIST_HEAD(&tsk->publications); in tipc_sk_create()
497 INIT_LIST_HEAD(&tsk->cong_links); in tipc_sk_create()
498 msg = &tsk->phdr; in tipc_sk_create()
504 if (tipc_sk_insert(tsk)) { in tipc_sk_create()
515 msg_set_origport(msg, tsk->portid); in tipc_sk_create()
523 tsk->conn_timeout = CONN_TIMEOUT_DEFAULT; in tipc_sk_create()
524 tsk->group_is_open = true; in tipc_sk_create()
525 atomic_set(&tsk->dupl_rcvcnt, 0); in tipc_sk_create()
528 tsk->snd_win = tsk_adv_blocks(RCVBUF_MIN); in tipc_sk_create()
529 tsk->rcv_win = tsk->snd_win; in tipc_sk_create()
532 tsk_set_unreturnable(tsk, true); in tipc_sk_create()
534 tsk_set_unreliable(tsk, true); in tipc_sk_create()
536 __skb_queue_head_init(&tsk->mc_method.deferredq); in tipc_sk_create()
543 struct tipc_sock *tsk = container_of(head, struct tipc_sock, rcu); in tipc_sk_callback() local
545 sock_put(&tsk->sk); in tipc_sk_callback()
552 struct tipc_sock *tsk = tipc_sk(sk); in __tipc_shutdown() local
555 u32 dnode = tsk_peer_node(tsk); in __tipc_shutdown()
559 tipc_wait_for_cond(sock, &timeout, (!tsk->cong_link_cnt && in __tipc_shutdown()
560 !tsk_conn_cong(tsk))); in __tipc_shutdown()
563 tipc_sk_push_backlog(tsk, false); in __tipc_shutdown()
584 tipc_node_remove_conn(net, dnode, tsk->portid); in __tipc_shutdown()
594 tsk_own_node(tsk), tsk_peer_port(tsk), in __tipc_shutdown()
595 tsk->portid, error); in __tipc_shutdown()
597 tipc_node_xmit_skb(net, skb, dnode, tsk->portid); in __tipc_shutdown()
628 struct tipc_sock *tsk; in tipc_release() local
637 tsk = tipc_sk(sk); in tipc_release()
643 tipc_sk_leave(tsk); in tipc_release()
644 tipc_sk_withdraw(tsk, NULL); in tipc_release()
645 __skb_queue_purge(&tsk->mc_method.deferredq); in tipc_release()
647 tipc_sk_remove(tsk); in tipc_release()
652 tipc_dest_list_purge(&tsk->cong_links); in tipc_release()
653 tsk->cong_link_cnt = 0; in tipc_release()
654 call_rcu(&tsk->rcu, tipc_sk_callback); in tipc_release()
678 struct tipc_sock *tsk = tipc_sk(sock->sk); in __tipc_bind() local
682 return tipc_sk_withdraw(tsk, NULL); in __tipc_bind()
696 if (tsk->group) in __tipc_bind()
700 return tipc_sk_withdraw(tsk, ua); in __tipc_bind()
701 return tipc_sk_publish(tsk, ua); in __tipc_bind()
750 struct tipc_sock *tsk = tipc_sk(sk); in tipc_getname() local
757 addr->addr.id.ref = tsk_peer_port(tsk); in tipc_getname()
758 addr->addr.id.node = tsk_peer_node(tsk); in tipc_getname()
760 addr->addr.id.ref = tsk->portid; in tipc_getname()
794 struct tipc_sock *tsk = tipc_sk(sk); in tipc_poll() local
807 if (!tsk->cong_link_cnt && !tsk_conn_cong(tsk)) in tipc_poll()
816 if (tsk->group_is_open && !tsk->cong_link_cnt) in tipc_poll()
846 struct tipc_sock *tsk = tipc_sk(sk); in tipc_sendmcast() local
847 struct tipc_msg *hdr = &tsk->phdr; in tipc_sendmcast()
854 if (tsk->group) in tipc_sendmcast()
858 rc = tipc_wait_for_cond(sock, &timeout, !tsk->cong_link_cnt); in tipc_sendmcast()
886 rc = tipc_mcast_xmit(net, &pkts, &tsk->mc_method, &dsts, in tipc_sendmcast()
887 &tsk->cong_link_cnt); in tipc_sendmcast()
905 static int tipc_send_group_msg(struct net *net, struct tipc_sock *tsk, in tipc_send_group_msg() argument
909 u16 bc_snd_nxt = tipc_group_bc_snd_nxt(tsk->group); in tipc_send_group_msg()
910 struct tipc_mc_method *method = &tsk->mc_method; in tipc_send_group_msg()
912 struct tipc_msg *hdr = &tsk->phdr; in tipc_send_group_msg()
925 mtu = tipc_node_get_mtu(net, dnode, tsk->portid, false); in tipc_send_group_msg()
931 rc = tipc_node_xmit(net, &pkts, dnode, tsk->portid); in tipc_send_group_msg()
933 tipc_dest_push(&tsk->cong_links, dnode, 0); in tipc_send_group_msg()
934 tsk->cong_link_cnt++; in tipc_send_group_msg()
962 struct tipc_sock *tsk = tipc_sk(sk); in tipc_send_group_unicast() local
975 !tipc_dest_find(&tsk->cong_links, node, 0) && in tipc_send_group_unicast()
976 tsk->group && in tipc_send_group_unicast()
977 !tipc_group_cong(tsk->group, node, port, blks, in tipc_send_group_unicast()
985 rc = tipc_send_group_msg(net, tsk, m, mb, node, port, dlen); in tipc_send_group_unicast()
1005 struct tipc_sock *tsk = tipc_sk(sk); in tipc_send_group_anycast() local
1006 struct list_head *cong_links = &tsk->cong_links; in tipc_send_group_anycast()
1008 struct tipc_msg *hdr = &tsk->phdr; in tipc_send_group_anycast()
1023 exclude = tipc_group_exclude(tsk->group); in tipc_send_group_anycast()
1033 cong = tipc_group_cong(tsk->group, node, port, blks, in tipc_send_group_anycast()
1053 tsk->group && in tipc_send_group_anycast()
1054 !tipc_group_cong(tsk->group, node, port, in tipc_send_group_anycast()
1067 rc = tipc_send_group_msg(net, tsk, m, mbr, node, port, dlen); in tipc_send_group_anycast()
1088 struct tipc_sock *tsk = tipc_sk(sk); in tipc_send_group_bcast() local
1090 struct tipc_mc_method *method = &tsk->mc_method; in tipc_send_group_bcast()
1093 struct tipc_msg *hdr = &tsk->phdr; in tipc_send_group_bcast()
1100 !tsk->cong_link_cnt && tsk->group && in tipc_send_group_bcast()
1101 !tipc_group_bc_cong(tsk->group, blks)); in tipc_send_group_bcast()
1105 dsts = tipc_group_dests(tsk->group); in tipc_send_group_bcast()
1120 msg_set_grp_bc_seqno(hdr, tipc_group_bc_snd_nxt(tsk->group)); in tipc_send_group_bcast()
1132 rc = tipc_mcast_xmit(net, &pkts, method, dsts, &tsk->cong_link_cnt); in tipc_send_group_bcast()
1137 tipc_group_update_bc_members(tsk->group, blks, ack); in tipc_send_group_bcast()
1161 struct tipc_sock *tsk = tipc_sk(sk); in tipc_send_group_mcast() local
1162 struct tipc_group *grp = tsk->group; in tipc_send_group_mcast()
1163 struct tipc_msg *hdr = &tsk->phdr; in tipc_send_group_mcast()
1273 static void tipc_sk_push_backlog(struct tipc_sock *tsk, bool nagle_ack) in tipc_sk_push_backlog() argument
1275 struct sk_buff_head *txq = &tsk->sk.sk_write_queue; in tipc_sk_push_backlog()
1277 struct net *net = sock_net(&tsk->sk); in tipc_sk_push_backlog()
1278 u32 dnode = tsk_peer_node(tsk); in tipc_sk_push_backlog()
1282 tsk->pkt_cnt += skb_queue_len(txq); in tipc_sk_push_backlog()
1283 if (!tsk->pkt_cnt || tsk->msg_acc / tsk->pkt_cnt < 2) { in tipc_sk_push_backlog()
1284 tsk->oneway = 0; in tipc_sk_push_backlog()
1285 if (tsk->nagle_start < NAGLE_START_MAX) in tipc_sk_push_backlog()
1286 tsk->nagle_start *= 2; in tipc_sk_push_backlog()
1287 tsk->expect_ack = false; in tipc_sk_push_backlog()
1289 tsk->portid, tsk->msg_acc, tsk->pkt_cnt, in tipc_sk_push_backlog()
1290 tsk->nagle_start); in tipc_sk_push_backlog()
1292 tsk->nagle_start = NAGLE_START_INIT; in tipc_sk_push_backlog()
1295 tsk->expect_ack = true; in tipc_sk_push_backlog()
1297 tsk->expect_ack = false; in tipc_sk_push_backlog()
1300 tsk->msg_acc = 0; in tipc_sk_push_backlog()
1301 tsk->pkt_cnt = 0; in tipc_sk_push_backlog()
1304 if (!skb || tsk->cong_link_cnt) in tipc_sk_push_backlog()
1311 if (tsk->msg_acc) in tipc_sk_push_backlog()
1312 tsk->pkt_cnt += skb_queue_len(txq); in tipc_sk_push_backlog()
1313 tsk->snt_unacked += tsk->snd_backlog; in tipc_sk_push_backlog()
1314 tsk->snd_backlog = 0; in tipc_sk_push_backlog()
1315 rc = tipc_node_xmit(net, txq, dnode, tsk->portid); in tipc_sk_push_backlog()
1317 tsk->cong_link_cnt = 1; in tipc_sk_push_backlog()
1327 static void tipc_sk_conn_proto_rcv(struct tipc_sock *tsk, struct sk_buff *skb, in tipc_sk_conn_proto_rcv() argument
1332 u32 onode = tsk_own_node(tsk); in tipc_sk_conn_proto_rcv()
1333 struct sock *sk = &tsk->sk; in tipc_sk_conn_proto_rcv()
1338 if (!tsk_peer_msg(tsk, hdr)) { in tipc_sk_conn_proto_rcv()
1345 tipc_node_remove_conn(sock_net(sk), tsk_peer_node(tsk), in tipc_sk_conn_proto_rcv()
1346 tsk_peer_port(tsk)); in tipc_sk_conn_proto_rcv()
1360 tsk->probe_unacked = false; in tipc_sk_conn_proto_rcv()
1368 was_cong = tsk_conn_cong(tsk); in tipc_sk_conn_proto_rcv()
1369 tipc_sk_push_backlog(tsk, msg_nagle_ack(hdr)); in tipc_sk_conn_proto_rcv()
1370 tsk->snt_unacked -= msg_conn_ack(hdr); in tipc_sk_conn_proto_rcv()
1371 if (tsk->peer_caps & TIPC_BLOCK_FLOWCTL) in tipc_sk_conn_proto_rcv()
1372 tsk->snd_win = msg_adv_win(hdr); in tipc_sk_conn_proto_rcv()
1373 if (was_cong && !tsk_conn_cong(tsk)) in tipc_sk_conn_proto_rcv()
1412 struct tipc_sock *tsk = tipc_sk(sk); in __tipc_sendmsg() local
1415 struct list_head *clinks = &tsk->cong_links; in __tipc_sendmsg()
1417 struct tipc_group *grp = tsk->group; in __tipc_sendmsg()
1418 struct tipc_msg *hdr = &tsk->phdr; in __tipc_sendmsg()
1446 ua = (struct tipc_uaddr *)&tsk->peer; in __tipc_sendmsg()
1457 if (tsk->published) in __tipc_sendmsg()
1460 tsk->conn_addrtype = atype; in __tipc_sendmsg()
1503 mtu = tipc_node_get_mtu(net, skaddr.node, tsk->portid, true); in __tipc_sendmsg()
1514 rc = tipc_node_xmit(net, &pkts, skaddr.node, tsk->portid); in __tipc_sendmsg()
1517 tsk->cong_link_cnt++; in __tipc_sendmsg()
1561 struct tipc_sock *tsk = tipc_sk(sk); in __tipc_sendstream() local
1562 struct tipc_msg *hdr = &tsk->phdr; in __tipc_sendstream()
1565 u32 dnode = tsk_peer_node(tsk); in __tipc_sendstream()
1566 int maxnagle = tsk->maxnagle; in __tipc_sendstream()
1567 int maxpkt = tsk->max_pkt; in __tipc_sendstream()
1578 tsk->peer_caps = tipc_node_get_capabilities(net, dnode); in __tipc_sendstream()
1579 tsk->snt_unacked = tsk_inc(tsk, dlen + msg_hdr_sz(hdr)); in __tipc_sendstream()
1586 (!tsk->cong_link_cnt && in __tipc_sendstream()
1587 !tsk_conn_cong(tsk) && in __tipc_sendstream()
1592 blocks = tsk->snd_backlog; in __tipc_sendstream()
1593 if (tsk->oneway++ >= tsk->nagle_start && maxnagle && in __tipc_sendstream()
1599 tsk->msg_acc++; in __tipc_sendstream()
1600 if (blocks <= 64 && tsk->expect_ack) { in __tipc_sendstream()
1601 tsk->snd_backlog = blocks; in __tipc_sendstream()
1605 tsk->pkt_cnt += skb_queue_len(txq); in __tipc_sendstream()
1610 tsk->expect_ack = true; in __tipc_sendstream()
1612 tsk->expect_ack = false; in __tipc_sendstream()
1614 tsk->msg_acc = 0; in __tipc_sendstream()
1615 tsk->pkt_cnt = 0; in __tipc_sendstream()
1621 blocks += tsk_inc(tsk, send + MIN_H_SIZE); in __tipc_sendstream()
1625 rc = tipc_node_xmit(net, txq, dnode, tsk->portid); in __tipc_sendstream()
1627 tsk->cong_link_cnt = 1; in __tipc_sendstream()
1631 tsk->snt_unacked += blocks; in __tipc_sendstream()
1632 tsk->snd_backlog = 0; in __tipc_sendstream()
1660 static void tipc_sk_finish_conn(struct tipc_sock *tsk, u32 peer_port, in tipc_sk_finish_conn() argument
1663 struct sock *sk = &tsk->sk; in tipc_sk_finish_conn()
1665 struct tipc_msg *msg = &tsk->phdr; in tipc_sk_finish_conn()
1676 tipc_node_add_conn(net, peer_node, tsk->portid, peer_port); in tipc_sk_finish_conn()
1677 tsk->max_pkt = tipc_node_get_mtu(net, peer_node, tsk->portid, true); in tipc_sk_finish_conn()
1678 tsk->peer_caps = tipc_node_get_capabilities(net, peer_node); in tipc_sk_finish_conn()
1679 tsk_set_nagle(tsk); in tipc_sk_finish_conn()
1681 if (tsk->peer_caps & TIPC_BLOCK_FLOWCTL) in tipc_sk_finish_conn()
1685 tsk->rcv_win = FLOWCTL_MSG_WIN; in tipc_sk_finish_conn()
1686 tsk->snd_win = FLOWCTL_MSG_WIN; in tipc_sk_finish_conn()
1736 struct tipc_sock *tsk) in tipc_sk_anc_data_recv() argument
1779 has_addr = !!tsk->conn_addrtype; in tipc_sk_anc_data_recv()
1780 data[0] = msg_nametype(&tsk->phdr); in tipc_sk_anc_data_recv()
1781 data[1] = msg_nameinst(&tsk->phdr); in tipc_sk_anc_data_recv()
1792 static struct sk_buff *tipc_sk_build_ack(struct tipc_sock *tsk) in tipc_sk_build_ack() argument
1794 struct sock *sk = &tsk->sk; in tipc_sk_build_ack()
1797 u32 peer_port = tsk_peer_port(tsk); in tipc_sk_build_ack()
1798 u32 dnode = tsk_peer_node(tsk); in tipc_sk_build_ack()
1803 dnode, tsk_own_node(tsk), peer_port, in tipc_sk_build_ack()
1804 tsk->portid, TIPC_OK); in tipc_sk_build_ack()
1808 msg_set_conn_ack(msg, tsk->rcv_unacked); in tipc_sk_build_ack()
1809 tsk->rcv_unacked = 0; in tipc_sk_build_ack()
1812 if (tsk->peer_caps & TIPC_BLOCK_FLOWCTL) { in tipc_sk_build_ack()
1813 tsk->rcv_win = tsk_adv_blocks(tsk->sk.sk_rcvbuf); in tipc_sk_build_ack()
1814 msg_set_adv_win(msg, tsk->rcv_win); in tipc_sk_build_ack()
1819 static void tipc_sk_send_ack(struct tipc_sock *tsk) in tipc_sk_send_ack() argument
1823 skb = tipc_sk_build_ack(tsk); in tipc_sk_send_ack()
1827 tipc_node_xmit_skb(sock_net(&tsk->sk), skb, tsk_peer_node(tsk), in tipc_sk_send_ack()
1889 struct tipc_sock *tsk = tipc_sk(sk); in tipc_recvmsg() local
1928 rc = tipc_sk_anc_data_recv(m, skb, tsk); in tipc_recvmsg()
1976 if (tsk->group && msg_in_group(hdr) && !grp_evt) { in tipc_recvmsg()
1978 tipc_group_update_rcv_win(tsk->group, tsk_blocks(hlen + dlen), in tipc_recvmsg()
1993 tsk->rcv_unacked += tsk_inc(tsk, hlen + dlen); in tipc_recvmsg()
1994 if (tsk->rcv_unacked >= tsk->rcv_win / TIPC_ACK_RATE) in tipc_recvmsg()
1995 tipc_sk_send_ack(tsk); in tipc_recvmsg()
2017 struct tipc_sock *tsk = tipc_sk(sk); in tipc_recvstream() local
2060 rc = tipc_sk_anc_data_recv(m, skb, tsk); in tipc_recvstream()
2094 tsk->rcv_unacked += tsk_inc(tsk, hlen + dlen); in tipc_recvstream()
2095 if (tsk->rcv_unacked >= tsk->rcv_win / TIPC_ACK_RATE) in tipc_recvstream()
2096 tipc_sk_send_ack(tsk); in tipc_recvstream()
2150 struct tipc_sock *tsk = tipc_sk(sk); in tipc_sk_proto_rcv() local
2152 struct tipc_group *grp = tsk->group; in tipc_sk_proto_rcv()
2157 tipc_sk_conn_proto_rcv(tsk, skb, inputq, xmitq); in tipc_sk_proto_rcv()
2160 tipc_dest_del(&tsk->cong_links, msg_orignode(hdr), 0); in tipc_sk_proto_rcv()
2163 tsk->cong_link_cnt--; in tipc_sk_proto_rcv()
2165 tipc_sk_push_backlog(tsk, false); in tipc_sk_proto_rcv()
2171 tipc_group_member_evt(tsk->group, &wakeup, &sk->sk_rcvbuf, in tipc_sk_proto_rcv()
2191 static bool tipc_sk_filter_connect(struct tipc_sock *tsk, struct sk_buff *skb, in tipc_sk_filter_connect() argument
2194 struct sock *sk = &tsk->sk; in tipc_sk_filter_connect()
2198 u32 pport = tsk_peer_port(tsk); in tipc_sk_filter_connect()
2199 u32 pnode = tsk_peer_node(tsk); in tipc_sk_filter_connect()
2207 tsk->oneway = 0; in tipc_sk_filter_connect()
2215 tipc_sk_finish_conn(tsk, oport, onode); in tipc_sk_filter_connect()
2216 msg_set_importance(&tsk->phdr, msg_importance(hdr)); in tipc_sk_filter_connect()
2237 delay %= (tsk->conn_timeout / 4); in tipc_sk_filter_connect()
2254 tipc_sk_push_backlog(tsk, false); in tipc_sk_filter_connect()
2261 skb = tipc_sk_build_ack(tsk); in tipc_sk_filter_connect()
2269 if (!tsk_peer_msg(tsk, hdr)) in tipc_sk_filter_connect()
2274 tipc_node_remove_conn(net, pnode, tsk->portid); in tipc_sk_filter_connect()
2307 struct tipc_sock *tsk = tipc_sk(sk); in rcvbuf_limit() local
2316 if (likely(tsk->peer_caps & TIPC_BLOCK_FLOWCTL)) in rcvbuf_limit()
2337 struct tipc_sock *tsk = tipc_sk(sk); in tipc_sk_filter_rcv() local
2338 struct tipc_group *grp = tsk->group; in tipc_sk_filter_rcv()
2357 tipc_mcast_filter_msg(net, &tsk->mc_method.deferredq, &inputq); in tipc_sk_filter_rcv()
2363 if ((sk_conn && !tipc_sk_filter_connect(tsk, skb, xmitq)) || in tipc_sk_filter_rcv()
2484 struct tipc_sock *tsk; in tipc_sk_rcv() local
2491 tsk = tipc_sk_lookup(net, dport); in tipc_sk_rcv()
2493 if (likely(tsk)) { in tipc_sk_rcv()
2494 sk = &tsk->sk; in tipc_sk_rcv()
2573 struct tipc_sock *tsk = tipc_sk(sk); in tipc_connect() local
2576 long timeout = (flags & O_NONBLOCK) ? 0 : tsk->conn_timeout; in tipc_connect()
2585 if (tsk->group) { in tipc_connect()
2591 memset(&tsk->peer, 0, sizeof(struct sockaddr_tipc)); in tipc_connect()
2602 memcpy(&tsk->peer, dest, destlen); in tipc_connect()
2826 struct tipc_sock *tsk = tipc_sk(sk); in tipc_sk_check_probing_state() local
2827 u32 pnode = tsk_peer_node(tsk); in tipc_sk_check_probing_state()
2828 u32 pport = tsk_peer_port(tsk); in tipc_sk_check_probing_state()
2829 u32 self = tsk_own_node(tsk); in tipc_sk_check_probing_state()
2830 u32 oport = tsk->portid; in tipc_sk_check_probing_state()
2833 if (tsk->probe_unacked) { in tipc_sk_check_probing_state()
2845 tsk->probe_unacked = true; in tipc_sk_check_probing_state()
2851 struct tipc_sock *tsk = tipc_sk(sk); in tipc_sk_retry_connect() local
2854 if (tsk->cong_link_cnt) { in tipc_sk_retry_connect()
2865 struct tipc_sock *tsk = tipc_sk(sk); in tipc_sk_timeout() local
2866 u32 pnode = tsk_peer_node(tsk); in tipc_sk_timeout()
2889 rc = tipc_node_xmit(sock_net(sk), &list, pnode, tsk->portid); in tipc_sk_timeout()
2893 tipc_dest_push(&tsk->cong_links, pnode, 0); in tipc_sk_timeout()
2894 tsk->cong_link_cnt = 1; in tipc_sk_timeout()
2899 static int tipc_sk_publish(struct tipc_sock *tsk, struct tipc_uaddr *ua) in tipc_sk_publish() argument
2901 struct sock *sk = &tsk->sk; in tipc_sk_publish()
2909 key = tsk->portid + tsk->pub_count + 1; in tipc_sk_publish()
2910 if (key == tsk->portid) in tipc_sk_publish()
2912 skaddr.ref = tsk->portid; in tipc_sk_publish()
2918 list_add(&p->binding_sock, &tsk->publications); in tipc_sk_publish()
2919 tsk->pub_count++; in tipc_sk_publish()
2920 tsk->published = true; in tipc_sk_publish()
2924 static int tipc_sk_withdraw(struct tipc_sock *tsk, struct tipc_uaddr *ua) in tipc_sk_withdraw() argument
2926 struct net *net = sock_net(&tsk->sk); in tipc_sk_withdraw()
2931 list_for_each_entry_safe(p, safe, &tsk->publications, binding_sock) { in tipc_sk_withdraw()
2951 if (list_empty(&tsk->publications)) { in tipc_sk_withdraw()
2952 tsk->published = 0; in tipc_sk_withdraw()
2965 struct tipc_sock *tsk; in tipc_sk_reinit() local
2973 while ((tsk = rhashtable_walk_next(&iter)) && !IS_ERR(tsk)) { in tipc_sk_reinit()
2974 sock_hold(&tsk->sk); in tipc_sk_reinit()
2976 lock_sock(&tsk->sk); in tipc_sk_reinit()
2977 msg = &tsk->phdr; in tipc_sk_reinit()
2980 release_sock(&tsk->sk); in tipc_sk_reinit()
2982 sock_put(&tsk->sk); in tipc_sk_reinit()
2986 } while (tsk == ERR_PTR(-EAGAIN)); in tipc_sk_reinit()
2994 struct tipc_sock *tsk; in tipc_sk_lookup() local
2997 tsk = rhashtable_lookup(&tn->sk_rht, &portid, tsk_rht_params); in tipc_sk_lookup()
2998 if (tsk) in tipc_sk_lookup()
2999 sock_hold(&tsk->sk); in tipc_sk_lookup()
3002 return tsk; in tipc_sk_lookup()
3005 static int tipc_sk_insert(struct tipc_sock *tsk) in tipc_sk_insert() argument
3007 struct sock *sk = &tsk->sk; in tipc_sk_insert()
3017 tsk->portid = portid; in tipc_sk_insert()
3018 sock_hold(&tsk->sk); in tipc_sk_insert()
3019 if (!rhashtable_lookup_insert_fast(&tn->sk_rht, &tsk->node, in tipc_sk_insert()
3022 sock_put(&tsk->sk); in tipc_sk_insert()
3028 static void tipc_sk_remove(struct tipc_sock *tsk) in tipc_sk_remove() argument
3030 struct sock *sk = &tsk->sk; in tipc_sk_remove()
3033 if (!rhashtable_remove_fast(&tn->sk_rht, &tsk->node, tsk_rht_params)) { in tipc_sk_remove()
3066 static int tipc_sk_join(struct tipc_sock *tsk, struct tipc_group_req *mreq) in tipc_sk_join() argument
3068 struct net *net = sock_net(&tsk->sk); in tipc_sk_join()
3069 struct tipc_group *grp = tsk->group; in tipc_sk_join()
3070 struct tipc_msg *hdr = &tsk->phdr; in tipc_sk_join()
3082 grp = tipc_group_create(net, tsk->portid, mreq, &tsk->group_is_open); in tipc_sk_join()
3085 tsk->group = grp; in tipc_sk_join()
3092 rc = tipc_sk_publish(tsk, &ua); in tipc_sk_join()
3095 tsk->group = NULL; in tipc_sk_join()
3099 tsk->mc_method.rcast = true; in tipc_sk_join()
3100 tsk->mc_method.mandatory = true; in tipc_sk_join()
3101 tipc_group_join(net, grp, &tsk->sk.sk_rcvbuf); in tipc_sk_join()
3105 static int tipc_sk_leave(struct tipc_sock *tsk) in tipc_sk_leave() argument
3107 struct net *net = sock_net(&tsk->sk); in tipc_sk_leave()
3108 struct tipc_group *grp = tsk->group; in tipc_sk_leave()
3118 tsk->group = NULL; in tipc_sk_leave()
3119 tipc_sk_withdraw(tsk, &ua); in tipc_sk_leave()
3140 struct tipc_sock *tsk = tipc_sk(sk); in tipc_setsockopt() local
3180 tsk_set_unreliable(tsk, value); in tipc_setsockopt()
3185 tsk_set_unreturnable(tsk, value); in tipc_setsockopt()
3191 tsk->mc_method.rcast = false; in tipc_setsockopt()
3192 tsk->mc_method.mandatory = true; in tipc_setsockopt()
3195 tsk->mc_method.rcast = true; in tipc_setsockopt()
3196 tsk->mc_method.mandatory = true; in tipc_setsockopt()
3199 res = tipc_sk_join(tsk, &mreq); in tipc_setsockopt()
3202 res = tipc_sk_leave(tsk); in tipc_setsockopt()
3205 tsk->nodelay = !!value; in tipc_setsockopt()
3206 tsk_set_nagle(tsk); in tipc_setsockopt()
3234 struct tipc_sock *tsk = tipc_sk(sk); in tipc_getsockopt() local
3252 value = tsk_importance(tsk); in tipc_getsockopt()
3255 value = tsk_unreliable(tsk); in tipc_getsockopt()
3258 value = tsk_unreturnable(tsk); in tipc_getsockopt()
3261 value = tsk->conn_timeout; in tipc_getsockopt()
3275 if (tsk->group) in tipc_getsockopt()
3276 tipc_group_self(tsk->group, &seq, &scope); in tipc_getsockopt()
3464 static int __tipc_nl_add_sk_con(struct sk_buff *skb, struct tipc_sock *tsk) in __tipc_nl_add_sk_con() argument
3470 peer_node = tsk_peer_node(tsk); in __tipc_nl_add_sk_con()
3471 peer_port = tsk_peer_port(tsk); in __tipc_nl_add_sk_con()
3472 conn_type = msg_nametype(&tsk->phdr); in __tipc_nl_add_sk_con()
3473 conn_instance = msg_nameinst(&tsk->phdr); in __tipc_nl_add_sk_con()
3483 if (tsk->conn_addrtype != 0) { in __tipc_nl_add_sk_con()
3502 *tsk) in __tipc_nl_add_sk_info()
3505 struct sock *sk = &tsk->sk; in __tipc_nl_add_sk_info()
3507 if (nla_put_u32(skb, TIPC_NLA_SOCK_REF, tsk->portid) || in __tipc_nl_add_sk_info()
3512 if (__tipc_nl_add_sk_con(skb, tsk)) in __tipc_nl_add_sk_info()
3514 } else if (!list_empty(&tsk->publications)) { in __tipc_nl_add_sk_info()
3523 struct tipc_sock *tsk) in __tipc_nl_add_sk() argument
3537 if (__tipc_nl_add_sk_info(skb, tsk)) in __tipc_nl_add_sk()
3556 struct tipc_sock *tsk)) in tipc_nl_sk_walk() argument
3559 struct tipc_sock *tsk; in tipc_nl_sk_walk() local
3563 while ((tsk = rhashtable_walk_next(iter)) != NULL) { in tipc_nl_sk_walk()
3564 if (IS_ERR(tsk)) { in tipc_nl_sk_walk()
3565 err = PTR_ERR(tsk); in tipc_nl_sk_walk()
3573 sock_hold(&tsk->sk); in tipc_nl_sk_walk()
3575 lock_sock(&tsk->sk); in tipc_nl_sk_walk()
3576 err = skb_handler(skb, cb, tsk); in tipc_nl_sk_walk()
3578 release_sock(&tsk->sk); in tipc_nl_sk_walk()
3579 sock_put(&tsk->sk); in tipc_nl_sk_walk()
3582 release_sock(&tsk->sk); in tipc_nl_sk_walk()
3584 sock_put(&tsk->sk); in tipc_nl_sk_walk()
3627 struct tipc_sock *tsk, u32 sk_filter_state, in tipc_sk_fill_sock_diag() argument
3630 struct sock *sk = &tsk->sk; in tipc_sk_fill_sock_diag()
3642 if (__tipc_nl_add_sk_info(skb, tsk)) in tipc_sk_fill_sock_diag()
3668 if (tsk->cong_link_cnt && in tipc_sk_fill_sock_diag()
3672 if (tsk_conn_cong(tsk) && in tipc_sk_fill_sock_diag()
3678 if (tsk->group) in tipc_sk_fill_sock_diag()
3679 if (tipc_group_fill_sock_diag(tsk->group, skb)) in tipc_sk_fill_sock_diag()
3742 struct tipc_sock *tsk, u32 *last_publ) in __tipc_nl_list_sk_publ() argument
3748 list_for_each_entry(p, &tsk->publications, binding_sock) { in __tipc_nl_list_sk_publ()
3764 p = list_first_entry(&tsk->publications, struct publication, in __tipc_nl_list_sk_publ()
3768 list_for_each_entry_from(p, &tsk->publications, binding_sock) { in __tipc_nl_list_sk_publ()
3787 struct tipc_sock *tsk; in tipc_nl_publ_dump() local
3811 tsk = tipc_sk_lookup(net, tsk_portid); in tipc_nl_publ_dump()
3812 if (!tsk) in tipc_nl_publ_dump()
3815 lock_sock(&tsk->sk); in tipc_nl_publ_dump()
3816 err = __tipc_nl_list_sk_publ(skb, cb, tsk, &last_publ); in tipc_nl_publ_dump()
3819 release_sock(&tsk->sk); in tipc_nl_publ_dump()
3820 sock_put(&tsk->sk); in tipc_nl_publ_dump()
3842 struct tipc_sock *tsk; in tipc_sk_filtering() local
3850 tsk = tipc_sk(sk); in tipc_sk_filtering()
3862 return (_port == tsk->portid); in tipc_sk_filtering()
3867 if (tsk->published) { in tipc_sk_filtering()
3868 p = list_first_entry_or_null(&tsk->publications, in tipc_sk_filtering()
3878 type = msg_nametype(&tsk->phdr); in tipc_sk_filtering()
3879 lower = msg_nameinst(&tsk->phdr); in tipc_sk_filtering()
3946 struct tipc_sock *tsk; in tipc_sk_dump() local
3955 tsk = tipc_sk(sk); in tipc_sk_dump()
3960 i += scnprintf(buf + i, sz - i, " %x", tsk_own_node(tsk)); in tipc_sk_dump()
3961 i += scnprintf(buf + i, sz - i, " %u", tsk->portid); in tipc_sk_dump()
3964 i += scnprintf(buf + i, sz - i, " %x", tsk_peer_node(tsk)); in tipc_sk_dump()
3965 i += scnprintf(buf + i, sz - i, " %u", tsk_peer_port(tsk)); in tipc_sk_dump()
3966 conn_type = msg_nametype(&tsk->phdr); in tipc_sk_dump()
3967 conn_instance = msg_nameinst(&tsk->phdr); in tipc_sk_dump()
3971 i += scnprintf(buf + i, sz - i, " | %u", tsk->published); in tipc_sk_dump()
3972 if (tsk->published) { in tipc_sk_dump()
3973 p = list_first_entry_or_null(&tsk->publications, in tipc_sk_dump()
3979 i += scnprintf(buf + i, sz - i, " | %u", tsk->snd_win); in tipc_sk_dump()
3980 i += scnprintf(buf + i, sz - i, " %u", tsk->rcv_win); in tipc_sk_dump()
3981 i += scnprintf(buf + i, sz - i, " %u", tsk->max_pkt); in tipc_sk_dump()
3982 i += scnprintf(buf + i, sz - i, " %x", tsk->peer_caps); in tipc_sk_dump()
3983 i += scnprintf(buf + i, sz - i, " %u", tsk->cong_link_cnt); in tipc_sk_dump()
3984 i += scnprintf(buf + i, sz - i, " %u", tsk->snt_unacked); in tipc_sk_dump()
3985 i += scnprintf(buf + i, sz - i, " %u", tsk->rcv_unacked); in tipc_sk_dump()
3986 i += scnprintf(buf + i, sz - i, " %u", atomic_read(&tsk->dupl_rcvcnt)); in tipc_sk_dump()