diff options
author | Ying Xue <ying.xue@windriver.com> | 2015-01-13 04:07:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-13 16:45:55 -0500 |
commit | 3721e9c7c194f576fbd30926e98e0abb13c641b5 (patch) | |
tree | 94b82a63c7403ccc57932a92ff1b164a5e1cff90 /net/tipc/socket.c | |
parent | 49ff2d3f040c133a9caeb862c9c2cd58a561d2c3 (diff) |
tipc: remove redundant timer defined in tipc_sock struct
Remove the redundant timer defined in tipc_sock structure, instead we
can directly reuse the sk_timer defined in sock structure.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 2cec496ba691..c9c34a667921 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -69,7 +69,6 @@ | |||
69 | * @pub_count: total # of publications port has made during its lifetime | 69 | * @pub_count: total # of publications port has made during its lifetime |
70 | * @probing_state: | 70 | * @probing_state: |
71 | * @probing_intv: | 71 | * @probing_intv: |
72 | * @timer: | ||
73 | * @port: port - interacts with 'sk' and with the rest of the TIPC stack | 72 | * @port: port - interacts with 'sk' and with the rest of the TIPC stack |
74 | * @peer_name: the peer of the connection, if any | 73 | * @peer_name: the peer of the connection, if any |
75 | * @conn_timeout: the time we can wait for an unresponded setup request | 74 | * @conn_timeout: the time we can wait for an unresponded setup request |
@@ -94,7 +93,6 @@ struct tipc_sock { | |||
94 | u32 pub_count; | 93 | u32 pub_count; |
95 | u32 probing_state; | 94 | u32 probing_state; |
96 | unsigned long probing_intv; | 95 | unsigned long probing_intv; |
97 | struct timer_list timer; | ||
98 | uint conn_timeout; | 96 | uint conn_timeout; |
99 | atomic_t dupl_rcvcnt; | 97 | atomic_t dupl_rcvcnt; |
100 | bool link_cong; | 98 | bool link_cong; |
@@ -360,7 +358,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock, | |||
360 | return -EINVAL; | 358 | return -EINVAL; |
361 | } | 359 | } |
362 | msg_set_origport(msg, tsk->portid); | 360 | msg_set_origport(msg, tsk->portid); |
363 | setup_timer(&tsk->timer, tipc_sk_timeout, (unsigned long)tsk); | 361 | setup_timer(&sk->sk_timer, tipc_sk_timeout, (unsigned long)tsk); |
364 | sk->sk_backlog_rcv = tipc_backlog_rcv; | 362 | sk->sk_backlog_rcv = tipc_backlog_rcv; |
365 | sk->sk_rcvbuf = sysctl_tipc_rmem[1]; | 363 | sk->sk_rcvbuf = sysctl_tipc_rmem[1]; |
366 | sk->sk_data_ready = tipc_data_ready; | 364 | sk->sk_data_ready = tipc_data_ready; |
@@ -514,7 +512,8 @@ static int tipc_release(struct socket *sock) | |||
514 | 512 | ||
515 | tipc_sk_withdraw(tsk, 0, NULL); | 513 | tipc_sk_withdraw(tsk, 0, NULL); |
516 | probing_state = tsk->probing_state; | 514 | probing_state = tsk->probing_state; |
517 | if (del_timer_sync(&tsk->timer) && probing_state != TIPC_CONN_PROBING) | 515 | if (del_timer_sync(&sk->sk_timer) && |
516 | probing_state != TIPC_CONN_PROBING) | ||
518 | sock_put(sk); | 517 | sock_put(sk); |
519 | tipc_sk_remove(tsk); | 518 | tipc_sk_remove(tsk); |
520 | if (tsk->connected) { | 519 | if (tsk->connected) { |
@@ -1136,7 +1135,8 @@ static int tipc_send_packet(struct kiocb *iocb, struct socket *sock, | |||
1136 | static void tipc_sk_finish_conn(struct tipc_sock *tsk, u32 peer_port, | 1135 | static void tipc_sk_finish_conn(struct tipc_sock *tsk, u32 peer_port, |
1137 | u32 peer_node) | 1136 | u32 peer_node) |
1138 | { | 1137 | { |
1139 | struct net *net = sock_net(&tsk->sk); | 1138 | struct sock *sk = &tsk->sk; |
1139 | struct net *net = sock_net(sk); | ||
1140 | struct tipc_msg *msg = &tsk->phdr; | 1140 | struct tipc_msg *msg = &tsk->phdr; |
1141 | 1141 | ||
1142 | msg_set_destnode(msg, peer_node); | 1142 | msg_set_destnode(msg, peer_node); |
@@ -1148,8 +1148,7 @@ static void tipc_sk_finish_conn(struct tipc_sock *tsk, u32 peer_port, | |||
1148 | tsk->probing_intv = CONN_PROBING_INTERVAL; | 1148 | tsk->probing_intv = CONN_PROBING_INTERVAL; |
1149 | tsk->probing_state = TIPC_CONN_OK; | 1149 | tsk->probing_state = TIPC_CONN_OK; |
1150 | tsk->connected = 1; | 1150 | tsk->connected = 1; |
1151 | if (!mod_timer(&tsk->timer, jiffies + tsk->probing_intv)) | 1151 | sk_reset_timer(sk, &sk->sk_timer, jiffies + tsk->probing_intv); |
1152 | sock_hold(&tsk->sk); | ||
1153 | tipc_node_add_conn(net, peer_node, tsk->portid, peer_port); | 1152 | tipc_node_add_conn(net, peer_node, tsk->portid, peer_port); |
1154 | tsk->max_pkt = tipc_node_get_mtu(net, peer_node, tsk->portid); | 1153 | tsk->max_pkt = tipc_node_get_mtu(net, peer_node, tsk->portid); |
1155 | } | 1154 | } |
@@ -2141,8 +2140,7 @@ static void tipc_sk_timeout(unsigned long data) | |||
2141 | 0, peer_node, tn->own_addr, | 2140 | 0, peer_node, tn->own_addr, |
2142 | peer_port, tsk->portid, TIPC_OK); | 2141 | peer_port, tsk->portid, TIPC_OK); |
2143 | tsk->probing_state = TIPC_CONN_PROBING; | 2142 | tsk->probing_state = TIPC_CONN_PROBING; |
2144 | if (!mod_timer(&tsk->timer, jiffies + tsk->probing_intv)) | 2143 | sk_reset_timer(sk, &sk->sk_timer, jiffies + tsk->probing_intv); |
2145 | sock_hold(sk); | ||
2146 | } | 2144 | } |
2147 | bh_unlock_sock(sk); | 2145 | bh_unlock_sock(sk); |
2148 | if (skb) | 2146 | if (skb) |