Skip to content

Commit fc8bcaa

Browse files
keesdavem330
authored andcommitted
net: LLC: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <edumazet@google.com> Cc: Hans Liljestrand <ishkamiel@gmail.com> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Cc: "Reshetova, Elena" <elena.reshetova@intel.com> Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8dbd05f commit fc8bcaa

3 files changed

Lines changed: 25 additions & 22 deletions

File tree

‎include/net/llc_c_ac.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ int llc_conn_ac_rst_sendack_flag(struct sock *sk, struct sk_buff *skb);
171171
int llc_conn_ac_send_i_rsp_as_ack(struct sock *sk, struct sk_buff *skb);
172172
int llc_conn_ac_send_i_as_ack(struct sock *sk, struct sk_buff *skb);
173173

174-
void llc_conn_busy_tmr_cb(unsigned long timeout_data);
175-
void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data);
176-
void llc_conn_ack_tmr_cb(unsigned long timeout_data);
177-
void llc_conn_rej_tmr_cb(unsigned long timeout_data);
174+
void llc_conn_busy_tmr_cb(struct timer_list *t);
175+
void llc_conn_pf_cycle_tmr_cb(struct timer_list *t);
176+
void llc_conn_ack_tmr_cb(struct timer_list *t);
177+
void llc_conn_rej_tmr_cb(struct timer_list *t);
178178

179179
void llc_conn_set_p_flag(struct sock *sk, u8 value);
180180
#endif /* LLC_C_AC_H */

‎net/llc/llc_c_ac.c‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,9 +1318,8 @@ static int llc_conn_ac_inc_vs_by_1(struct sock *sk, struct sk_buff *skb)
13181318
return 0;
13191319
}
13201320

1321-
static void llc_conn_tmr_common_cb(unsigned long timeout_data, u8 type)
1321+
static void llc_conn_tmr_common_cb(struct sock *sk, u8 type)
13221322
{
1323-
struct sock *sk = (struct sock *)timeout_data;
13241323
struct sk_buff *skb = alloc_skb(0, GFP_ATOMIC);
13251324

13261325
bh_lock_sock(sk);
@@ -1334,24 +1333,32 @@ static void llc_conn_tmr_common_cb(unsigned long timeout_data, u8 type)
13341333
bh_unlock_sock(sk);
13351334
}
13361335

1337-
void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data)
1336+
void llc_conn_pf_cycle_tmr_cb(struct timer_list *t)
13381337
{
1339-
llc_conn_tmr_common_cb(timeout_data, LLC_CONN_EV_TYPE_P_TMR);
1338+
struct llc_sock *llc = from_timer(llc, t, pf_cycle_timer.timer);
1339+
1340+
llc_conn_tmr_common_cb(&llc->sk, LLC_CONN_EV_TYPE_P_TMR);
13401341
}
13411342

1342-
void llc_conn_busy_tmr_cb(unsigned long timeout_data)
1343+
void llc_conn_busy_tmr_cb(struct timer_list *t)
13431344
{
1344-
llc_conn_tmr_common_cb(timeout_data, LLC_CONN_EV_TYPE_BUSY_TMR);
1345+
struct llc_sock *llc = from_timer(llc, t, busy_state_timer.timer);
1346+
1347+
llc_conn_tmr_common_cb(&llc->sk, LLC_CONN_EV_TYPE_BUSY_TMR);
13451348
}
13461349

1347-
void llc_conn_ack_tmr_cb(unsigned long timeout_data)
1350+
void llc_conn_ack_tmr_cb(struct timer_list *t)
13481351
{
1349-
llc_conn_tmr_common_cb(timeout_data, LLC_CONN_EV_TYPE_ACK_TMR);
1352+
struct llc_sock *llc = from_timer(llc, t, ack_timer.timer);
1353+
1354+
llc_conn_tmr_common_cb(&llc->sk, LLC_CONN_EV_TYPE_ACK_TMR);
13501355
}
13511356

1352-
void llc_conn_rej_tmr_cb(unsigned long timeout_data)
1357+
void llc_conn_rej_tmr_cb(struct timer_list *t)
13531358
{
1354-
llc_conn_tmr_common_cb(timeout_data, LLC_CONN_EV_TYPE_REJ_TMR);
1359+
struct llc_sock *llc = from_timer(llc, t, rej_sent_timer.timer);
1360+
1361+
llc_conn_tmr_common_cb(&llc->sk, LLC_CONN_EV_TYPE_REJ_TMR);
13551362
}
13561363

13571364
int llc_conn_ac_rst_vs(struct sock *sk, struct sk_buff *skb)

‎net/llc/llc_conn.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -902,20 +902,16 @@ static void llc_sk_init(struct sock *sk)
902902
llc->inc_cntr = llc->dec_cntr = 2;
903903
llc->dec_step = llc->connect_step = 1;
904904

905-
setup_timer(&llc->ack_timer.timer, llc_conn_ack_tmr_cb,
906-
(unsigned long)sk);
905+
timer_setup(&llc->ack_timer.timer, llc_conn_ack_tmr_cb, 0);
907906
llc->ack_timer.expire = sysctl_llc2_ack_timeout;
908907

909-
setup_timer(&llc->pf_cycle_timer.timer, llc_conn_pf_cycle_tmr_cb,
910-
(unsigned long)sk);
908+
timer_setup(&llc->pf_cycle_timer.timer, llc_conn_pf_cycle_tmr_cb, 0);
911909
llc->pf_cycle_timer.expire = sysctl_llc2_p_timeout;
912910

913-
setup_timer(&llc->rej_sent_timer.timer, llc_conn_rej_tmr_cb,
914-
(unsigned long)sk);
911+
timer_setup(&llc->rej_sent_timer.timer, llc_conn_rej_tmr_cb, 0);
915912
llc->rej_sent_timer.expire = sysctl_llc2_rej_timeout;
916913

917-
setup_timer(&llc->busy_state_timer.timer, llc_conn_busy_tmr_cb,
918-
(unsigned long)sk);
914+
timer_setup(&llc->busy_state_timer.timer, llc_conn_busy_tmr_cb, 0);
919915
llc->busy_state_timer.expire = sysctl_llc2_busy_timeout;
920916

921917
llc->n2 = 2; /* max retransmit */

0 commit comments

Comments
 (0)