aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2017-10-13 05:04:22 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-13 11:46:00 -0400
commita80ae5306a7346d4e52f59462878beb8362f4bbd (patch)
treec81696b3bf35b844513994379571f954e0d631e8 /net/tipc/socket.c
parentf70d37b796241f617107d5585ee96a7e1b660b63 (diff)
tipc: improve destination linked list
We often see a need for a linked list of destination identities, sometimes containing a port number, sometimes a node identity, and sometimes both. The currently defined struct u32_list is not generic enough to cover all cases, so we extend it to contain two u32 integers and rename it to struct tipc_dest_list. Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Acked-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index c7c674934474..daf7c4df4531 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -565,7 +565,7 @@ static int tipc_release(struct socket *sock)
565 565
566 /* Reject any messages that accumulated in backlog queue */ 566 /* Reject any messages that accumulated in backlog queue */
567 release_sock(sk); 567 release_sock(sk);
568 u32_list_purge(&tsk->cong_links); 568 tipc_dest_list_purge(&tsk->cong_links);
569 tsk->cong_link_cnt = 0; 569 tsk->cong_link_cnt = 0;
570 call_rcu(&tsk->rcu, tipc_sk_callback); 570 call_rcu(&tsk->rcu, tipc_sk_callback);
571 sock->sk = NULL; 571 sock->sk = NULL;
@@ -826,8 +826,7 @@ void tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq,
826 tipc_nametbl_mc_translate(net, 826 tipc_nametbl_mc_translate(net,
827 msg_nametype(msg), msg_namelower(msg), 827 msg_nametype(msg), msg_namelower(msg),
828 msg_nameupper(msg), scope, &dports); 828 msg_nameupper(msg), scope, &dports);
829 portid = u32_pop(&dports); 829 while (tipc_dest_pop(&dports, NULL, &portid)) {
830 for (; portid; portid = u32_pop(&dports)) {
831 _skb = __pskb_copy(skb, hsz, GFP_ATOMIC); 830 _skb = __pskb_copy(skb, hsz, GFP_ATOMIC);
832 if (_skb) { 831 if (_skb) {
833 msg_set_destport(buf_msg(_skb), portid); 832 msg_set_destport(buf_msg(_skb), portid);
@@ -1000,7 +999,8 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
1000 } 999 }
1001 1000
1002 /* Block or return if destination link is congested */ 1001 /* Block or return if destination link is congested */
1003 rc = tipc_wait_for_cond(sock, &timeout, !u32_find(clinks, dnode)); 1002 rc = tipc_wait_for_cond(sock, &timeout,
1003 !tipc_dest_find(clinks, dnode, 0));
1004 if (unlikely(rc)) 1004 if (unlikely(rc))
1005 return rc; 1005 return rc;
1006 1006
@@ -1012,7 +1012,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
1012 1012
1013 rc = tipc_node_xmit(net, &pkts, dnode, tsk->portid); 1013 rc = tipc_node_xmit(net, &pkts, dnode, tsk->portid);
1014 if (unlikely(rc == -ELINKCONG)) { 1014 if (unlikely(rc == -ELINKCONG)) {
1015 u32_push(clinks, dnode); 1015 tipc_dest_push(clinks, dnode, 0);
1016 tsk->cong_link_cnt++; 1016 tsk->cong_link_cnt++;
1017 rc = 0; 1017 rc = 0;
1018 } 1018 }
@@ -1549,7 +1549,7 @@ static void tipc_sk_proto_rcv(struct sock *sk,
1549 tipc_sk_conn_proto_rcv(tsk, skb, xmitq); 1549 tipc_sk_conn_proto_rcv(tsk, skb, xmitq);
1550 return; 1550 return;
1551 case SOCK_WAKEUP: 1551 case SOCK_WAKEUP:
1552 u32_del(&tsk->cong_links, msg_orignode(hdr)); 1552 tipc_dest_del(&tsk->cong_links, msg_orignode(hdr), 0);
1553 tsk->cong_link_cnt--; 1553 tsk->cong_link_cnt--;
1554 sk->sk_write_space(sk); 1554 sk->sk_write_space(sk);
1555 break; 1555 break;