diff options
-rw-r--r-- | net/tipc/core.h | 67 | ||||
-rw-r--r-- | net/tipc/discover.c | 32 | ||||
-rw-r--r-- | net/tipc/link.c | 27 | ||||
-rw-r--r-- | net/tipc/link.h | 4 | ||||
-rw-r--r-- | net/tipc/msg.h | 2 | ||||
-rw-r--r-- | net/tipc/socket.c | 17 | ||||
-rw-r--r-- | net/tipc/subscr.c | 17 | ||||
-rw-r--r-- | net/tipc/subscr.h | 2 |
8 files changed, 50 insertions, 118 deletions
diff --git a/net/tipc/core.h b/net/tipc/core.h index 56fe4229fc5e..d57068961d4c 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
@@ -107,73 +107,6 @@ void tipc_unregister_sysctl(void); | |||
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * TIPC timer code | ||
111 | */ | ||
112 | typedef void (*Handler) (unsigned long); | ||
113 | |||
114 | /** | ||
115 | * k_init_timer - initialize a timer | ||
116 | * @timer: pointer to timer structure | ||
117 | * @routine: pointer to routine to invoke when timer expires | ||
118 | * @argument: value to pass to routine when timer expires | ||
119 | * | ||
120 | * Timer must be initialized before use (and terminated when no longer needed). | ||
121 | */ | ||
122 | static inline void k_init_timer(struct timer_list *timer, Handler routine, | ||
123 | unsigned long argument) | ||
124 | { | ||
125 | setup_timer(timer, routine, argument); | ||
126 | } | ||
127 | |||
128 | /** | ||
129 | * k_start_timer - start a timer | ||
130 | * @timer: pointer to timer structure | ||
131 | * @msec: time to delay (in ms) | ||
132 | * | ||
133 | * Schedules a previously initialized timer for later execution. | ||
134 | * If timer is already running, the new timeout overrides the previous request. | ||
135 | * | ||
136 | * To ensure the timer doesn't expire before the specified delay elapses, | ||
137 | * the amount of delay is rounded up when converting to the jiffies | ||
138 | * then an additional jiffy is added to account for the fact that | ||
139 | * the starting time may be in the middle of the current jiffy. | ||
140 | */ | ||
141 | static inline void k_start_timer(struct timer_list *timer, unsigned long msec) | ||
142 | { | ||
143 | mod_timer(timer, jiffies + msecs_to_jiffies(msec) + 1); | ||
144 | } | ||
145 | |||
146 | /** | ||
147 | * k_cancel_timer - cancel a timer | ||
148 | * @timer: pointer to timer structure | ||
149 | * | ||
150 | * Cancels a previously initialized timer. | ||
151 | * Can be called safely even if the timer is already inactive. | ||
152 | * | ||
153 | * WARNING: Must not be called when holding locks required by the timer's | ||
154 | * timeout routine, otherwise deadlock can occur on SMP systems! | ||
155 | */ | ||
156 | static inline void k_cancel_timer(struct timer_list *timer) | ||
157 | { | ||
158 | del_timer_sync(timer); | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * k_term_timer - terminate a timer | ||
163 | * @timer: pointer to timer structure | ||
164 | * | ||
165 | * Prevents further use of a previously initialized timer. | ||
166 | * | ||
167 | * WARNING: Caller must ensure timer isn't currently running. | ||
168 | * | ||
169 | * (Do not "enhance" this routine to automatically cancel an active timer, | ||
170 | * otherwise deadlock can arise when a timeout routine calls k_term_timer.) | ||
171 | */ | ||
172 | static inline void k_term_timer(struct timer_list *timer) | ||
173 | { | ||
174 | } | ||
175 | |||
176 | /* | ||
177 | * TIPC message buffer code | 110 | * TIPC message buffer code |
178 | * | 111 | * |
179 | * TIPC message buffer headroom reserves space for the worst-case | 112 | * TIPC message buffer headroom reserves space for the worst-case |
diff --git a/net/tipc/discover.c b/net/tipc/discover.c index aa722a42ef8b..1a3a98582034 100644 --- a/net/tipc/discover.c +++ b/net/tipc/discover.c | |||
@@ -38,10 +38,14 @@ | |||
38 | #include "link.h" | 38 | #include "link.h" |
39 | #include "discover.h" | 39 | #include "discover.h" |
40 | 40 | ||
41 | #define TIPC_LINK_REQ_INIT 125 /* min delay during bearer start up */ | 41 | /* min delay during bearer start up */ |
42 | #define TIPC_LINK_REQ_FAST 1000 /* max delay if bearer has no links */ | 42 | #define TIPC_LINK_REQ_INIT msecs_to_jiffies(125) |
43 | #define TIPC_LINK_REQ_SLOW 60000 /* max delay if bearer has links */ | 43 | /* max delay if bearer has no links */ |
44 | #define TIPC_LINK_REQ_INACTIVE 0xffffffff /* indicates no timer in use */ | 44 | #define TIPC_LINK_REQ_FAST msecs_to_jiffies(1000) |
45 | /* max delay if bearer has links */ | ||
46 | #define TIPC_LINK_REQ_SLOW msecs_to_jiffies(60000) | ||
47 | /* indicates no timer in use */ | ||
48 | #define TIPC_LINK_REQ_INACTIVE 0xffffffff | ||
45 | 49 | ||
46 | 50 | ||
47 | /** | 51 | /** |
@@ -63,7 +67,7 @@ struct tipc_link_req { | |||
63 | spinlock_t lock; | 67 | spinlock_t lock; |
64 | struct sk_buff *buf; | 68 | struct sk_buff *buf; |
65 | struct timer_list timer; | 69 | struct timer_list timer; |
66 | unsigned int timer_intv; | 70 | unsigned long timer_intv; |
67 | }; | 71 | }; |
68 | 72 | ||
69 | /** | 73 | /** |
@@ -265,7 +269,7 @@ static void disc_update(struct tipc_link_req *req) | |||
265 | if ((req->timer_intv == TIPC_LINK_REQ_INACTIVE) || | 269 | if ((req->timer_intv == TIPC_LINK_REQ_INACTIVE) || |
266 | (req->timer_intv > TIPC_LINK_REQ_FAST)) { | 270 | (req->timer_intv > TIPC_LINK_REQ_FAST)) { |
267 | req->timer_intv = TIPC_LINK_REQ_INIT; | 271 | req->timer_intv = TIPC_LINK_REQ_INIT; |
268 | k_start_timer(&req->timer, req->timer_intv); | 272 | mod_timer(&req->timer, jiffies + req->timer_intv); |
269 | } | 273 | } |
270 | } | 274 | } |
271 | } | 275 | } |
@@ -295,12 +299,13 @@ void tipc_disc_remove_dest(struct tipc_link_req *req) | |||
295 | 299 | ||
296 | /** | 300 | /** |
297 | * disc_timeout - send a periodic link setup request | 301 | * disc_timeout - send a periodic link setup request |
298 | * @req: ptr to link request structure | 302 | * @data: ptr to link request structure |
299 | * | 303 | * |
300 | * Called whenever a link setup request timer associated with a bearer expires. | 304 | * Called whenever a link setup request timer associated with a bearer expires. |
301 | */ | 305 | */ |
302 | static void disc_timeout(struct tipc_link_req *req) | 306 | static void disc_timeout(unsigned long data) |
303 | { | 307 | { |
308 | struct tipc_link_req *req = (struct tipc_link_req *)data; | ||
304 | int max_delay; | 309 | int max_delay; |
305 | 310 | ||
306 | spin_lock_bh(&req->lock); | 311 | spin_lock_bh(&req->lock); |
@@ -329,7 +334,7 @@ static void disc_timeout(struct tipc_link_req *req) | |||
329 | if (req->timer_intv > max_delay) | 334 | if (req->timer_intv > max_delay) |
330 | req->timer_intv = max_delay; | 335 | req->timer_intv = max_delay; |
331 | 336 | ||
332 | k_start_timer(&req->timer, req->timer_intv); | 337 | mod_timer(&req->timer, jiffies + req->timer_intv); |
333 | exit: | 338 | exit: |
334 | spin_unlock_bh(&req->lock); | 339 | spin_unlock_bh(&req->lock); |
335 | } | 340 | } |
@@ -363,8 +368,8 @@ int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest) | |||
363 | req->num_nodes = 0; | 368 | req->num_nodes = 0; |
364 | req->timer_intv = TIPC_LINK_REQ_INIT; | 369 | req->timer_intv = TIPC_LINK_REQ_INIT; |
365 | spin_lock_init(&req->lock); | 370 | spin_lock_init(&req->lock); |
366 | k_init_timer(&req->timer, (Handler)disc_timeout, (unsigned long)req); | 371 | setup_timer(&req->timer, disc_timeout, (unsigned long)req); |
367 | k_start_timer(&req->timer, req->timer_intv); | 372 | mod_timer(&req->timer, jiffies + req->timer_intv); |
368 | b_ptr->link_req = req; | 373 | b_ptr->link_req = req; |
369 | tipc_bearer_send(req->bearer_id, req->buf, &req->dest); | 374 | tipc_bearer_send(req->bearer_id, req->buf, &req->dest); |
370 | return 0; | 375 | return 0; |
@@ -376,8 +381,7 @@ int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest) | |||
376 | */ | 381 | */ |
377 | void tipc_disc_delete(struct tipc_link_req *req) | 382 | void tipc_disc_delete(struct tipc_link_req *req) |
378 | { | 383 | { |
379 | k_cancel_timer(&req->timer); | 384 | del_timer_sync(&req->timer); |
380 | k_term_timer(&req->timer); | ||
381 | kfree_skb(req->buf); | 385 | kfree_skb(req->buf); |
382 | kfree(req); | 386 | kfree(req); |
383 | } | 387 | } |
@@ -397,7 +401,7 @@ void tipc_disc_reset(struct tipc_bearer *b_ptr) | |||
397 | req->domain = b_ptr->domain; | 401 | req->domain = b_ptr->domain; |
398 | req->num_nodes = 0; | 402 | req->num_nodes = 0; |
399 | req->timer_intv = TIPC_LINK_REQ_INIT; | 403 | req->timer_intv = TIPC_LINK_REQ_INIT; |
400 | k_start_timer(&req->timer, req->timer_intv); | 404 | mod_timer(&req->timer, jiffies + req->timer_intv); |
401 | tipc_bearer_send(req->bearer_id, req->buf, &req->dest); | 405 | tipc_bearer_send(req->bearer_id, req->buf, &req->dest); |
402 | spin_unlock_bh(&req->lock); | 406 | spin_unlock_bh(&req->lock); |
403 | } | 407 | } |
diff --git a/net/tipc/link.c b/net/tipc/link.c index 082c3b5b32a1..f2531a8efa54 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -106,7 +106,7 @@ static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr, | |||
106 | static void tipc_link_proto_rcv(struct tipc_link *l_ptr, struct sk_buff *buf); | 106 | static void tipc_link_proto_rcv(struct tipc_link *l_ptr, struct sk_buff *buf); |
107 | static int tipc_link_tunnel_rcv(struct tipc_node *n_ptr, | 107 | static int tipc_link_tunnel_rcv(struct tipc_node *n_ptr, |
108 | struct sk_buff **buf); | 108 | struct sk_buff **buf); |
109 | static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance); | 109 | static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tol); |
110 | static void link_state_event(struct tipc_link *l_ptr, u32 event); | 110 | static void link_state_event(struct tipc_link *l_ptr, u32 event); |
111 | static void link_reset_statistics(struct tipc_link *l_ptr); | 111 | static void link_reset_statistics(struct tipc_link *l_ptr); |
112 | static void link_print(struct tipc_link *l_ptr, const char *str); | 112 | static void link_print(struct tipc_link *l_ptr, const char *str); |
@@ -169,8 +169,9 @@ int tipc_link_is_active(struct tipc_link *l_ptr) | |||
169 | * link_timeout - handle expiration of link timer | 169 | * link_timeout - handle expiration of link timer |
170 | * @l_ptr: pointer to link | 170 | * @l_ptr: pointer to link |
171 | */ | 171 | */ |
172 | static void link_timeout(struct tipc_link *l_ptr) | 172 | static void link_timeout(unsigned long data) |
173 | { | 173 | { |
174 | struct tipc_link *l_ptr = (struct tipc_link *)data; | ||
174 | struct sk_buff *skb; | 175 | struct sk_buff *skb; |
175 | 176 | ||
176 | tipc_node_lock(l_ptr->owner); | 177 | tipc_node_lock(l_ptr->owner); |
@@ -217,9 +218,9 @@ static void link_timeout(struct tipc_link *l_ptr) | |||
217 | tipc_node_unlock(l_ptr->owner); | 218 | tipc_node_unlock(l_ptr->owner); |
218 | } | 219 | } |
219 | 220 | ||
220 | static void link_set_timer(struct tipc_link *l_ptr, u32 time) | 221 | static void link_set_timer(struct tipc_link *link, unsigned long time) |
221 | { | 222 | { |
222 | k_start_timer(&l_ptr->timer, time); | 223 | mod_timer(&link->timer, jiffies + time); |
223 | } | 224 | } |
224 | 225 | ||
225 | /** | 226 | /** |
@@ -299,8 +300,7 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr, | |||
299 | 300 | ||
300 | tipc_node_attach_link(n_ptr, l_ptr); | 301 | tipc_node_attach_link(n_ptr, l_ptr); |
301 | 302 | ||
302 | k_init_timer(&l_ptr->timer, (Handler)link_timeout, | 303 | setup_timer(&l_ptr->timer, link_timeout, (unsigned long)l_ptr); |
303 | (unsigned long)l_ptr); | ||
304 | 304 | ||
305 | link_state_event(l_ptr, STARTING_EVT); | 305 | link_state_event(l_ptr, STARTING_EVT); |
306 | 306 | ||
@@ -479,7 +479,7 @@ static void link_activate(struct tipc_link *l_ptr) | |||
479 | static void link_state_event(struct tipc_link *l_ptr, unsigned int event) | 479 | static void link_state_event(struct tipc_link *l_ptr, unsigned int event) |
480 | { | 480 | { |
481 | struct tipc_link *other; | 481 | struct tipc_link *other; |
482 | u32 cont_intv = l_ptr->continuity_interval; | 482 | unsigned long cont_intv = l_ptr->cont_intv; |
483 | 483 | ||
484 | if (l_ptr->flags & LINK_STOPPED) | 484 | if (l_ptr->flags & LINK_STOPPED) |
485 | return; | 485 | return; |
@@ -1880,15 +1880,16 @@ void tipc_link_bundle_rcv(struct sk_buff *buf) | |||
1880 | kfree_skb(buf); | 1880 | kfree_skb(buf); |
1881 | } | 1881 | } |
1882 | 1882 | ||
1883 | static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tolerance) | 1883 | static void link_set_supervision_props(struct tipc_link *l_ptr, u32 tol) |
1884 | { | 1884 | { |
1885 | if ((tolerance < TIPC_MIN_LINK_TOL) || (tolerance > TIPC_MAX_LINK_TOL)) | 1885 | unsigned long intv = ((tol / 4) > 500) ? 500 : tol / 4; |
1886 | |||
1887 | if ((tol < TIPC_MIN_LINK_TOL) || (tol > TIPC_MAX_LINK_TOL)) | ||
1886 | return; | 1888 | return; |
1887 | 1889 | ||
1888 | l_ptr->tolerance = tolerance; | 1890 | l_ptr->tolerance = tol; |
1889 | l_ptr->continuity_interval = | 1891 | l_ptr->cont_intv = msecs_to_jiffies(intv); |
1890 | ((tolerance / 4) > 500) ? 500 : tolerance / 4; | 1892 | l_ptr->abort_limit = tol / (jiffies_to_msecs(l_ptr->cont_intv) / 4); |
1891 | l_ptr->abort_limit = tolerance / (l_ptr->continuity_interval / 4); | ||
1892 | } | 1893 | } |
1893 | 1894 | ||
1894 | void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window) | 1895 | void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window) |
diff --git a/net/tipc/link.h b/net/tipc/link.h index 55812e87ca1e..15ca850391df 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h | |||
@@ -105,7 +105,7 @@ struct tipc_stats { | |||
105 | * @peer_bearer_id: bearer id used by link's peer endpoint | 105 | * @peer_bearer_id: bearer id used by link's peer endpoint |
106 | * @bearer_id: local bearer id used by link | 106 | * @bearer_id: local bearer id used by link |
107 | * @tolerance: minimum link continuity loss needed to reset link [in ms] | 107 | * @tolerance: minimum link continuity loss needed to reset link [in ms] |
108 | * @continuity_interval: link continuity testing interval [in ms] | 108 | * @cont_intv: link continuity testing interval |
109 | * @abort_limit: # of unacknowledged continuity probes needed to reset link | 109 | * @abort_limit: # of unacknowledged continuity probes needed to reset link |
110 | * @state: current state of link FSM | 110 | * @state: current state of link FSM |
111 | * @fsm_msg_cnt: # of protocol messages link FSM has sent in current state | 111 | * @fsm_msg_cnt: # of protocol messages link FSM has sent in current state |
@@ -146,7 +146,7 @@ struct tipc_link { | |||
146 | u32 peer_bearer_id; | 146 | u32 peer_bearer_id; |
147 | u32 bearer_id; | 147 | u32 bearer_id; |
148 | u32 tolerance; | 148 | u32 tolerance; |
149 | u32 continuity_interval; | 149 | unsigned long cont_intv; |
150 | u32 abort_limit; | 150 | u32 abort_limit; |
151 | int state; | 151 | int state; |
152 | u32 fsm_msg_cnt; | 152 | u32 fsm_msg_cnt; |
diff --git a/net/tipc/msg.h b/net/tipc/msg.h index d5c83d7ecb47..1a52f7cf3cd3 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h | |||
@@ -77,12 +77,10 @@ | |||
77 | 77 | ||
78 | #define TIPC_MEDIA_ADDR_OFFSET 5 | 78 | #define TIPC_MEDIA_ADDR_OFFSET 5 |
79 | 79 | ||
80 | |||
81 | struct tipc_msg { | 80 | struct tipc_msg { |
82 | __be32 hdr[15]; | 81 | __be32 hdr[15]; |
83 | }; | 82 | }; |
84 | 83 | ||
85 | |||
86 | static inline u32 msg_word(struct tipc_msg *m, u32 pos) | 84 | static inline u32 msg_word(struct tipc_msg *m, u32 pos) |
87 | { | 85 | { |
88 | return ntohl(m->hdr[pos]); | 86 | return ntohl(m->hdr[pos]); |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 701f31bbbbfb..e16197eb7b9f 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -47,7 +47,7 @@ | |||
47 | #define SS_READY -2 /* socket is connectionless */ | 47 | #define SS_READY -2 /* socket is connectionless */ |
48 | 48 | ||
49 | #define CONN_TIMEOUT_DEFAULT 8000 /* default connect timeout = 8s */ | 49 | #define CONN_TIMEOUT_DEFAULT 8000 /* default connect timeout = 8s */ |
50 | #define CONN_PROBING_INTERVAL 3600000 /* [ms] => 1 h */ | 50 | #define CONN_PROBING_INTERVAL msecs_to_jiffies(3600000) /* [ms] => 1 h */ |
51 | #define TIPC_FWD_MSG 1 | 51 | #define TIPC_FWD_MSG 1 |
52 | #define TIPC_CONN_OK 0 | 52 | #define TIPC_CONN_OK 0 |
53 | #define TIPC_CONN_PROBING 1 | 53 | #define TIPC_CONN_PROBING 1 |
@@ -68,7 +68,7 @@ | |||
68 | * @publications: list of publications for port | 68 | * @publications: list of publications for port |
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_interval: | 71 | * @probing_intv: |
72 | * @timer: | 72 | * @timer: |
73 | * @port: port - interacts with 'sk' and with the rest of the TIPC stack | 73 | * @port: port - interacts with 'sk' and with the rest of the TIPC stack |
74 | * @peer_name: the peer of the connection, if any | 74 | * @peer_name: the peer of the connection, if any |
@@ -93,7 +93,7 @@ struct tipc_sock { | |||
93 | struct list_head publications; | 93 | struct list_head publications; |
94 | u32 pub_count; | 94 | u32 pub_count; |
95 | u32 probing_state; | 95 | u32 probing_state; |
96 | u32 probing_interval; | 96 | unsigned long probing_intv; |
97 | struct timer_list timer; | 97 | struct timer_list timer; |
98 | uint conn_timeout; | 98 | uint conn_timeout; |
99 | atomic_t dupl_rcvcnt; | 99 | atomic_t dupl_rcvcnt; |
@@ -361,7 +361,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock, | |||
361 | return -EINVAL; | 361 | return -EINVAL; |
362 | } | 362 | } |
363 | msg_set_origport(msg, tsk->portid); | 363 | msg_set_origport(msg, tsk->portid); |
364 | k_init_timer(&tsk->timer, (Handler)tipc_sk_timeout, tsk->portid); | 364 | setup_timer(&tsk->timer, tipc_sk_timeout, tsk->portid); |
365 | sk->sk_backlog_rcv = tipc_backlog_rcv; | 365 | sk->sk_backlog_rcv = tipc_backlog_rcv; |
366 | sk->sk_rcvbuf = sysctl_tipc_rmem[1]; | 366 | sk->sk_rcvbuf = sysctl_tipc_rmem[1]; |
367 | sk->sk_data_ready = tipc_data_ready; | 367 | sk->sk_data_ready = tipc_data_ready; |
@@ -511,7 +511,7 @@ static int tipc_release(struct socket *sock) | |||
511 | } | 511 | } |
512 | 512 | ||
513 | tipc_sk_withdraw(tsk, 0, NULL); | 513 | tipc_sk_withdraw(tsk, 0, NULL); |
514 | k_cancel_timer(&tsk->timer); | 514 | del_timer_sync(&tsk->timer); |
515 | tipc_sk_remove(tsk); | 515 | tipc_sk_remove(tsk); |
516 | if (tsk->connected) { | 516 | if (tsk->connected) { |
517 | skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, TIPC_CONN_MSG, | 517 | skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, TIPC_CONN_MSG, |
@@ -522,7 +522,6 @@ static int tipc_release(struct socket *sock) | |||
522 | tipc_link_xmit_skb(skb, dnode, tsk->portid); | 522 | tipc_link_xmit_skb(skb, dnode, tsk->portid); |
523 | tipc_node_remove_conn(dnode, tsk->portid); | 523 | tipc_node_remove_conn(dnode, tsk->portid); |
524 | } | 524 | } |
525 | k_term_timer(&tsk->timer); | ||
526 | 525 | ||
527 | /* Discard any remaining (connection-based) messages in receive queue */ | 526 | /* Discard any remaining (connection-based) messages in receive queue */ |
528 | __skb_queue_purge(&sk->sk_receive_queue); | 527 | __skb_queue_purge(&sk->sk_receive_queue); |
@@ -1139,10 +1138,10 @@ static void tipc_sk_finish_conn(struct tipc_sock *tsk, u32 peer_port, | |||
1139 | msg_set_lookup_scope(msg, 0); | 1138 | msg_set_lookup_scope(msg, 0); |
1140 | msg_set_hdr_sz(msg, SHORT_H_SIZE); | 1139 | msg_set_hdr_sz(msg, SHORT_H_SIZE); |
1141 | 1140 | ||
1142 | tsk->probing_interval = CONN_PROBING_INTERVAL; | 1141 | tsk->probing_intv = CONN_PROBING_INTERVAL; |
1143 | tsk->probing_state = TIPC_CONN_OK; | 1142 | tsk->probing_state = TIPC_CONN_OK; |
1144 | tsk->connected = 1; | 1143 | tsk->connected = 1; |
1145 | k_start_timer(&tsk->timer, tsk->probing_interval); | 1144 | mod_timer(&tsk->timer, jiffies + tsk->probing_intv); |
1146 | tipc_node_add_conn(peer_node, tsk->portid, peer_port); | 1145 | tipc_node_add_conn(peer_node, tsk->portid, peer_port); |
1147 | tsk->max_pkt = tipc_node_get_mtu(peer_node, tsk->portid); | 1146 | tsk->max_pkt = tipc_node_get_mtu(peer_node, tsk->portid); |
1148 | } | 1147 | } |
@@ -2128,7 +2127,7 @@ static void tipc_sk_timeout(unsigned long portid) | |||
2128 | 0, peer_node, tipc_own_addr, | 2127 | 0, peer_node, tipc_own_addr, |
2129 | peer_port, portid, TIPC_OK); | 2128 | peer_port, portid, TIPC_OK); |
2130 | tsk->probing_state = TIPC_CONN_PROBING; | 2129 | tsk->probing_state = TIPC_CONN_PROBING; |
2131 | k_start_timer(&tsk->timer, tsk->probing_interval); | 2130 | mod_timer(&tsk->timer, jiffies + tsk->probing_intv); |
2132 | } | 2131 | } |
2133 | bh_unlock_sock(sk); | 2132 | bh_unlock_sock(sk); |
2134 | if (skb) | 2133 | if (skb) |
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index 0344206b984f..e6cb959371dc 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c | |||
@@ -141,8 +141,9 @@ void tipc_subscr_report_overlap(struct tipc_subscription *sub, u32 found_lower, | |||
141 | subscr_send_event(sub, found_lower, found_upper, event, port_ref, node); | 141 | subscr_send_event(sub, found_lower, found_upper, event, port_ref, node); |
142 | } | 142 | } |
143 | 143 | ||
144 | static void subscr_timeout(struct tipc_subscription *sub) | 144 | static void subscr_timeout(unsigned long data) |
145 | { | 145 | { |
146 | struct tipc_subscription *sub = (struct tipc_subscription *)data; | ||
146 | struct tipc_subscriber *subscriber = sub->subscriber; | 147 | struct tipc_subscriber *subscriber = sub->subscriber; |
147 | 148 | ||
148 | /* The spin lock per subscriber is used to protect its members */ | 149 | /* The spin lock per subscriber is used to protect its members */ |
@@ -167,7 +168,6 @@ static void subscr_timeout(struct tipc_subscription *sub) | |||
167 | TIPC_SUBSCR_TIMEOUT, 0, 0); | 168 | TIPC_SUBSCR_TIMEOUT, 0, 0); |
168 | 169 | ||
169 | /* Now destroy subscription */ | 170 | /* Now destroy subscription */ |
170 | k_term_timer(&sub->timer); | ||
171 | kfree(sub); | 171 | kfree(sub); |
172 | atomic_dec(&subscription_count); | 172 | atomic_dec(&subscription_count); |
173 | } | 173 | } |
@@ -207,8 +207,7 @@ static void subscr_release(struct tipc_subscriber *subscriber) | |||
207 | subscription_list) { | 207 | subscription_list) { |
208 | if (sub->timeout != TIPC_WAIT_FOREVER) { | 208 | if (sub->timeout != TIPC_WAIT_FOREVER) { |
209 | spin_unlock_bh(&subscriber->lock); | 209 | spin_unlock_bh(&subscriber->lock); |
210 | k_cancel_timer(&sub->timer); | 210 | del_timer_sync(&sub->timer); |
211 | k_term_timer(&sub->timer); | ||
212 | spin_lock_bh(&subscriber->lock); | 211 | spin_lock_bh(&subscriber->lock); |
213 | } | 212 | } |
214 | subscr_del(sub); | 213 | subscr_del(sub); |
@@ -250,8 +249,7 @@ static void subscr_cancel(struct tipc_subscr *s, | |||
250 | if (sub->timeout != TIPC_WAIT_FOREVER) { | 249 | if (sub->timeout != TIPC_WAIT_FOREVER) { |
251 | sub->timeout = TIPC_WAIT_FOREVER; | 250 | sub->timeout = TIPC_WAIT_FOREVER; |
252 | spin_unlock_bh(&subscriber->lock); | 251 | spin_unlock_bh(&subscriber->lock); |
253 | k_cancel_timer(&sub->timer); | 252 | del_timer_sync(&sub->timer); |
254 | k_term_timer(&sub->timer); | ||
255 | spin_lock_bh(&subscriber->lock); | 253 | spin_lock_bh(&subscriber->lock); |
256 | } | 254 | } |
257 | subscr_del(sub); | 255 | subscr_del(sub); |
@@ -296,7 +294,7 @@ static int subscr_subscribe(struct tipc_subscr *s, | |||
296 | sub->seq.type = htohl(s->seq.type, swap); | 294 | sub->seq.type = htohl(s->seq.type, swap); |
297 | sub->seq.lower = htohl(s->seq.lower, swap); | 295 | sub->seq.lower = htohl(s->seq.lower, swap); |
298 | sub->seq.upper = htohl(s->seq.upper, swap); | 296 | sub->seq.upper = htohl(s->seq.upper, swap); |
299 | sub->timeout = htohl(s->timeout, swap); | 297 | sub->timeout = msecs_to_jiffies(htohl(s->timeout, swap)); |
300 | sub->filter = htohl(s->filter, swap); | 298 | sub->filter = htohl(s->filter, swap); |
301 | if ((!(sub->filter & TIPC_SUB_PORTS) == | 299 | if ((!(sub->filter & TIPC_SUB_PORTS) == |
302 | !(sub->filter & TIPC_SUB_SERVICE)) || | 300 | !(sub->filter & TIPC_SUB_SERVICE)) || |
@@ -311,9 +309,8 @@ static int subscr_subscribe(struct tipc_subscr *s, | |||
311 | memcpy(&sub->evt.s, s, sizeof(struct tipc_subscr)); | 309 | memcpy(&sub->evt.s, s, sizeof(struct tipc_subscr)); |
312 | atomic_inc(&subscription_count); | 310 | atomic_inc(&subscription_count); |
313 | if (sub->timeout != TIPC_WAIT_FOREVER) { | 311 | if (sub->timeout != TIPC_WAIT_FOREVER) { |
314 | k_init_timer(&sub->timer, | 312 | setup_timer(&sub->timer, subscr_timeout, (unsigned long)sub); |
315 | (Handler)subscr_timeout, (unsigned long)sub); | 313 | mod_timer(&sub->timer, jiffies + sub->timeout); |
316 | k_start_timer(&sub->timer, sub->timeout); | ||
317 | } | 314 | } |
318 | *sub_p = sub; | 315 | *sub_p = sub; |
319 | return 0; | 316 | return 0; |
diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h index 393e417bee3f..ab01713bfe32 100644 --- a/net/tipc/subscr.h +++ b/net/tipc/subscr.h | |||
@@ -58,7 +58,7 @@ struct tipc_subscriber; | |||
58 | struct tipc_subscription { | 58 | struct tipc_subscription { |
59 | struct tipc_subscriber *subscriber; | 59 | struct tipc_subscriber *subscriber; |
60 | struct tipc_name_seq seq; | 60 | struct tipc_name_seq seq; |
61 | u32 timeout; | 61 | unsigned long timeout; |
62 | u32 filter; | 62 | u32 filter; |
63 | struct timer_list timer; | 63 | struct timer_list timer; |
64 | struct list_head nameseq_list; | 64 | struct list_head nameseq_list; |