2 * llc_c_ac.c - actions performed during connection state transition.
5 * Functions in this module are implementation of connection component actions
6 * Details of actions can be found in IEEE-802.2 standard document.
7 * All functions have one connection and one event as input argument. All of
8 * them return 0 On success and 1 otherwise.
10 * Copyright (c) 1997 by Procom Technology, Inc.
11 * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
13 * This program can be redistributed or modified under the terms of the
14 * GNU General Public License as published by the Free Software Foundation.
15 * This program is distributed without any warranty or implied warranty
16 * of merchantability or fitness for a particular purpose.
18 * See the GNU General Public License for more details.
20 #include <linux/netdevice.h>
21 #include <net/llc_conn.h>
22 #include <net/llc_sap.h>
24 #include <net/llc_c_ev.h>
25 #include <net/llc_c_ac.h>
26 #include <net/llc_c_st.h>
27 #include <net/llc_pdu.h>
30 #include "llc_output.h"
32 static int llc_conn_ac_inc_vs_by_1(struct sock
*sk
, struct sk_buff
*skb
);
33 static void llc_process_tmr_ev(struct sock
*sk
, struct sk_buff
*skb
);
34 static int llc_conn_ac_data_confirm(struct sock
*sk
, struct sk_buff
*ev
);
36 static int llc_conn_ac_inc_npta_value(struct sock
*sk
, struct sk_buff
*skb
);
38 static int llc_conn_ac_send_rr_rsp_f_set_ackpf(struct sock
*sk
,
41 static int llc_conn_ac_set_p_flag_1(struct sock
*sk
, struct sk_buff
*skb
);
45 int llc_conn_ac_clear_remote_busy(struct sock
*sk
, struct sk_buff
*skb
)
47 struct llc_sock
*llc
= llc_sk(sk
);
49 if (llc
->remote_busy_flag
) {
51 struct llc_pdu_sn
*pdu
= llc_pdu_sn_hdr(skb
);
53 llc
->remote_busy_flag
= 0;
54 del_timer(&llc
->busy_state_timer
.timer
);
55 nr
= LLC_I_GET_NR(pdu
);
56 llc_conn_resend_i_pdu_as_cmd(sk
, nr
, 0);
61 int llc_conn_ac_conn_ind(struct sock
*sk
, struct sk_buff
*skb
)
67 llc_pdu_decode_dsap(skb
, &dsap
);
68 sap
= llc_sap_find(dsap
);
70 struct llc_conn_state_ev
*ev
= llc_conn_ev(skb
);
71 struct llc_sock
*llc
= llc_sk(sk
);
73 llc_pdu_decode_sa(skb
, llc
->daddr
.mac
);
74 llc_pdu_decode_da(skb
, llc
->laddr
.mac
);
76 ev
->ind_prim
= LLC_CONN_PRIM
;
82 int llc_conn_ac_conn_confirm(struct sock
*sk
, struct sk_buff
*skb
)
84 struct llc_conn_state_ev
*ev
= llc_conn_ev(skb
);
86 ev
->cfm_prim
= LLC_CONN_PRIM
;
90 static int llc_conn_ac_data_confirm(struct sock
*sk
, struct sk_buff
*skb
)
92 struct llc_conn_state_ev
*ev
= llc_conn_ev(skb
);
94 ev
->cfm_prim
= LLC_DATA_PRIM
;
98 int llc_conn_ac_data_ind(struct sock
*sk
, struct sk_buff
*skb
)
100 llc_conn_rtn_pdu(sk
, skb
);
104 int llc_conn_ac_disc_ind(struct sock
*sk
, struct sk_buff
*skb
)
106 struct llc_conn_state_ev
*ev
= llc_conn_ev(skb
);
110 if (ev
->type
== LLC_CONN_EV_TYPE_PDU
) {
111 struct llc_pdu_un
*pdu
= llc_pdu_un_hdr(skb
);
113 if (LLC_PDU_IS_RSP(pdu
) &&
114 LLC_PDU_TYPE_IS_U(pdu
) &&
115 LLC_U_PDU_RSP(pdu
) == LLC_2_PDU_RSP_DM
)
116 reason
= LLC_DISC_REASON_RX_DM_RSP_PDU
;
117 else if (LLC_PDU_IS_CMD(pdu
) &&
118 LLC_PDU_TYPE_IS_U(pdu
) &&
119 LLC_U_PDU_CMD(pdu
) == LLC_2_PDU_CMD_DISC
)
120 reason
= LLC_DISC_REASON_RX_DISC_CMD_PDU
;
121 } else if (ev
->type
== LLC_CONN_EV_TYPE_ACK_TMR
)
122 reason
= LLC_DISC_REASON_ACK_TMR_EXP
;
129 ev
->ind_prim
= LLC_DISC_PRIM
;
134 int llc_conn_ac_disc_confirm(struct sock
*sk
, struct sk_buff
*skb
)
136 struct llc_conn_state_ev
*ev
= llc_conn_ev(skb
);
138 ev
->reason
= ev
->status
;
139 ev
->cfm_prim
= LLC_DISC_PRIM
;
143 int llc_conn_ac_rst_ind(struct sock
*sk
, struct sk_buff
*skb
)
147 struct llc_conn_state_ev
*ev
= llc_conn_ev(skb
);
148 struct llc_pdu_un
*pdu
= llc_pdu_un_hdr(skb
);
149 struct llc_sock
*llc
= llc_sk(sk
);
152 case LLC_CONN_EV_TYPE_PDU
:
153 if (LLC_PDU_IS_RSP(pdu
) &&
154 LLC_PDU_TYPE_IS_U(pdu
) &&
155 LLC_U_PDU_RSP(pdu
) == LLC_2_PDU_RSP_FRMR
) {
156 reason
= LLC_RESET_REASON_LOCAL
;
158 } else if (LLC_PDU_IS_CMD(pdu
) &&
159 LLC_PDU_TYPE_IS_U(pdu
) &&
160 LLC_U_PDU_CMD(pdu
) == LLC_2_PDU_CMD_SABME
) {
161 reason
= LLC_RESET_REASON_REMOTE
;
168 case LLC_CONN_EV_TYPE_ACK_TMR
:
169 case LLC_CONN_EV_TYPE_P_TMR
:
170 case LLC_CONN_EV_TYPE_REJ_TMR
:
171 case LLC_CONN_EV_TYPE_BUSY_TMR
:
172 if (llc
->retry_count
> llc
->n2
) {
173 reason
= LLC_RESET_REASON_LOCAL
;
181 ev
->ind_prim
= LLC_RESET_PRIM
;
186 int llc_conn_ac_rst_confirm(struct sock
*sk
, struct sk_buff
*skb
)
188 struct llc_conn_state_ev
*ev
= llc_conn_ev(skb
);
191 ev
->cfm_prim
= LLC_RESET_PRIM
;
195 int llc_conn_ac_clear_remote_busy_if_f_eq_1(struct sock
*sk
,
198 struct llc_pdu_sn
*pdu
= llc_pdu_sn_hdr(skb
);
200 if (LLC_PDU_IS_RSP(pdu
) &&
201 LLC_PDU_TYPE_IS_I(pdu
) &&
202 LLC_I_PF_IS_1(pdu
) && llc_sk(sk
)->ack_pf
)
203 llc_conn_ac_clear_remote_busy(sk
, skb
);
207 int llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2(struct sock
*sk
,
210 struct llc_sock
*llc
= llc_sk(sk
);
212 if (llc
->data_flag
== 2)
213 del_timer(&llc
->rej_sent_timer
.timer
);
217 int llc_conn_ac_send_disc_cmd_p_set_x(struct sock
*sk
, struct sk_buff
*skb
)
220 struct sk_buff
*nskb
= llc_alloc_frame();
223 struct llc_sock
*llc
= llc_sk(sk
);
224 struct llc_sap
*sap
= llc
->sap
;
226 nskb
->dev
= llc
->dev
;
227 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_U
, sap
->laddr
.lsap
,
228 llc
->daddr
.lsap
, LLC_PDU_CMD
);
229 llc_pdu_init_as_disc_cmd(nskb
, 1);
230 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
233 llc_conn_send_pdu(sk
, nskb
);
234 llc_conn_ac_set_p_flag_1(sk
, skb
);
243 int llc_conn_ac_send_dm_rsp_f_set_p(struct sock
*sk
, struct sk_buff
*skb
)
246 struct sk_buff
*nskb
= llc_alloc_frame();
249 struct llc_sock
*llc
= llc_sk(sk
);
250 struct llc_sap
*sap
= llc
->sap
;
253 nskb
->dev
= llc
->dev
;
254 llc_pdu_decode_pf_bit(skb
, &f_bit
);
255 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_U
, sap
->laddr
.lsap
,
256 llc
->daddr
.lsap
, LLC_PDU_RSP
);
257 llc_pdu_init_as_dm_rsp(nskb
, f_bit
);
258 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
261 llc_conn_send_pdu(sk
, nskb
);
270 int llc_conn_ac_send_dm_rsp_f_set_1(struct sock
*sk
, struct sk_buff
*skb
)
273 struct sk_buff
*nskb
= llc_alloc_frame();
276 struct llc_sock
*llc
= llc_sk(sk
);
277 struct llc_sap
*sap
= llc
->sap
;
280 nskb
->dev
= llc
->dev
;
281 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_U
, sap
->laddr
.lsap
,
282 llc
->daddr
.lsap
, LLC_PDU_RSP
);
283 llc_pdu_init_as_dm_rsp(nskb
, f_bit
);
284 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
287 llc_conn_send_pdu(sk
, nskb
);
296 int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock
*sk
, struct sk_buff
*skb
)
300 struct sk_buff
*nskb
;
301 struct llc_pdu_sn
*pdu
= llc_pdu_sn_hdr(skb
);
302 struct llc_sock
*llc
= llc_sk(sk
);
304 llc
->rx_pdu_hdr
= *((u32
*)pdu
);
305 if (LLC_PDU_IS_CMD(pdu
))
306 llc_pdu_decode_pf_bit(skb
, &f_bit
);
309 nskb
= llc_alloc_frame();
311 struct llc_sap
*sap
= llc
->sap
;
313 nskb
->dev
= llc
->dev
;
314 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_U
, sap
->laddr
.lsap
,
315 llc
->daddr
.lsap
, LLC_PDU_RSP
);
316 llc_pdu_init_as_frmr_rsp(nskb
, pdu
, f_bit
, llc
->vS
,
318 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
321 llc_conn_send_pdu(sk
, nskb
);
330 int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock
*sk
, struct sk_buff
*skb
)
333 struct sk_buff
*nskb
= llc_alloc_frame();
337 struct llc_sock
*llc
= llc_sk(sk
);
338 struct llc_sap
*sap
= llc
->sap
;
339 struct llc_pdu_sn
*pdu
= (struct llc_pdu_sn
*)&llc
->rx_pdu_hdr
;
341 nskb
->dev
= llc
->dev
;
342 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_U
, sap
->laddr
.lsap
,
343 llc
->daddr
.lsap
, LLC_PDU_RSP
);
344 llc_pdu_init_as_frmr_rsp(nskb
, pdu
, f_bit
, llc
->vS
,
346 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
349 llc_conn_send_pdu(sk
, nskb
);
358 int llc_conn_ac_resend_frmr_rsp_f_set_p(struct sock
*sk
, struct sk_buff
*skb
)
362 struct sk_buff
*nskb
;
364 llc_pdu_decode_pf_bit(skb
, &f_bit
);
365 nskb
= llc_alloc_frame();
367 struct llc_sock
*llc
= llc_sk(sk
);
368 struct llc_sap
*sap
= llc
->sap
;
369 struct llc_pdu_sn
*pdu
= llc_pdu_sn_hdr(skb
);
371 nskb
->dev
= llc
->dev
;
372 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_U
, sap
->laddr
.lsap
,
373 llc
->daddr
.lsap
, LLC_PDU_RSP
);
374 llc_pdu_init_as_frmr_rsp(nskb
, pdu
, f_bit
, llc
->vS
,
376 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
379 llc_conn_send_pdu(sk
, nskb
);
388 int llc_conn_ac_send_i_cmd_p_set_1(struct sock
*sk
, struct sk_buff
*skb
)
391 struct llc_sock
*llc
= llc_sk(sk
);
392 struct llc_sap
*sap
= llc
->sap
;
394 llc_pdu_header_init(skb
, LLC_PDU_TYPE_I
, sap
->laddr
.lsap
,
395 llc
->daddr
.lsap
, LLC_PDU_CMD
);
396 llc_pdu_init_as_i_cmd(skb
, 1, llc
->vS
, llc
->vR
);
397 rc
= llc_mac_hdr_init(skb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
399 llc_conn_send_pdu(sk
, skb
);
400 llc_conn_ac_inc_vs_by_1(sk
, skb
);
405 static int llc_conn_ac_send_i_cmd_p_set_0(struct sock
*sk
, struct sk_buff
*skb
)
408 struct llc_sock
*llc
= llc_sk(sk
);
409 struct llc_sap
*sap
= llc
->sap
;
411 llc_pdu_header_init(skb
, LLC_PDU_TYPE_I
, sap
->laddr
.lsap
,
412 llc
->daddr
.lsap
, LLC_PDU_CMD
);
413 llc_pdu_init_as_i_cmd(skb
, 0, llc
->vS
, llc
->vR
);
414 rc
= llc_mac_hdr_init(skb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
416 llc_conn_send_pdu(sk
, skb
);
417 llc_conn_ac_inc_vs_by_1(sk
, skb
);
422 int llc_conn_ac_send_i_xxx_x_set_0(struct sock
*sk
, struct sk_buff
*skb
)
425 struct llc_sock
*llc
= llc_sk(sk
);
426 struct llc_sap
*sap
= llc
->sap
;
428 llc_pdu_header_init(skb
, LLC_PDU_TYPE_I
, sap
->laddr
.lsap
,
429 llc
->daddr
.lsap
, LLC_PDU_CMD
);
430 llc_pdu_init_as_i_cmd(skb
, 0, llc
->vS
, llc
->vR
);
431 rc
= llc_mac_hdr_init(skb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
433 llc_conn_send_pdu(sk
, skb
);
434 llc_conn_ac_inc_vs_by_1(sk
, skb
);
439 int llc_conn_ac_resend_i_xxx_x_set_0(struct sock
*sk
, struct sk_buff
*skb
)
441 struct llc_pdu_sn
*pdu
= llc_pdu_sn_hdr(skb
);
442 u8 nr
= LLC_I_GET_NR(pdu
);
444 llc_conn_resend_i_pdu_as_cmd(sk
, nr
, 0);
448 int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock
*sk
,
452 struct llc_pdu_sn
*pdu
= llc_pdu_sn_hdr(skb
);
454 struct sk_buff
*nskb
= llc_alloc_frame();
457 struct llc_sock
*llc
= llc_sk(sk
);
458 struct llc_sap
*sap
= llc
->sap
;
460 nskb
->dev
= llc
->dev
;
461 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_U
, sap
->laddr
.lsap
,
462 llc
->daddr
.lsap
, LLC_PDU_RSP
);
463 llc_pdu_init_as_rr_rsp(nskb
, 0, llc
->vR
);
464 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
466 llc_conn_send_pdu(sk
, nskb
);
471 nr
= LLC_I_GET_NR(pdu
);
473 llc_conn_resend_i_pdu_as_cmd(sk
, nr
, 0);
478 int llc_conn_ac_resend_i_rsp_f_set_1(struct sock
*sk
, struct sk_buff
*skb
)
480 struct llc_pdu_sn
*pdu
= llc_pdu_sn_hdr(skb
);
481 u8 nr
= LLC_I_GET_NR(pdu
);
483 llc_conn_resend_i_pdu_as_rsp(sk
, nr
, 1);
487 int llc_conn_ac_send_rej_cmd_p_set_1(struct sock
*sk
, struct sk_buff
*skb
)
490 struct sk_buff
*nskb
= llc_alloc_frame();
493 struct llc_sock
*llc
= llc_sk(sk
);
494 struct llc_sap
*sap
= llc
->sap
;
496 nskb
->dev
= llc
->dev
;
497 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
498 llc
->daddr
.lsap
, LLC_PDU_CMD
);
499 llc_pdu_init_as_rej_cmd(nskb
, 1, llc
->vR
);
500 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
503 llc_conn_send_pdu(sk
, nskb
);
512 int llc_conn_ac_send_rej_rsp_f_set_1(struct sock
*sk
, struct sk_buff
*skb
)
515 struct sk_buff
*nskb
= llc_alloc_frame();
519 struct llc_sock
*llc
= llc_sk(sk
);
520 struct llc_sap
*sap
= llc
->sap
;
522 nskb
->dev
= llc
->dev
;
523 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
524 llc
->daddr
.lsap
, LLC_PDU_RSP
);
525 llc_pdu_init_as_rej_rsp(nskb
, f_bit
, llc
->vR
);
526 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
529 llc_conn_send_pdu(sk
, nskb
);
538 int llc_conn_ac_send_rej_xxx_x_set_0(struct sock
*sk
, struct sk_buff
*skb
)
541 struct sk_buff
*nskb
= llc_alloc_frame();
544 struct llc_sock
*llc
= llc_sk(sk
);
545 struct llc_sap
*sap
= llc
->sap
;
548 nskb
->dev
= llc
->dev
;
549 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
550 llc
->daddr
.lsap
, LLC_PDU_RSP
);
551 llc_pdu_init_as_rej_rsp(nskb
, f_bit
, llc
->vR
);
552 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
555 llc_conn_send_pdu(sk
, nskb
);
564 int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock
*sk
, struct sk_buff
*skb
)
567 struct sk_buff
*nskb
= llc_alloc_frame();
570 struct llc_sock
*llc
= llc_sk(sk
);
571 struct llc_sap
*sap
= llc
->sap
;
573 nskb
->dev
= llc
->dev
;
574 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
575 llc
->daddr
.lsap
, LLC_PDU_CMD
);
576 llc_pdu_init_as_rnr_cmd(nskb
, 1, llc
->vR
);
577 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
580 llc_conn_send_pdu(sk
, nskb
);
589 int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock
*sk
, struct sk_buff
*skb
)
592 struct sk_buff
*nskb
= llc_alloc_frame();
595 struct llc_sock
*llc
= llc_sk(sk
);
596 struct llc_sap
*sap
= llc
->sap
;
599 nskb
->dev
= llc
->dev
;
600 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
601 llc
->daddr
.lsap
, LLC_PDU_RSP
);
602 llc_pdu_init_as_rnr_rsp(nskb
, f_bit
, llc
->vR
);
603 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
606 llc_conn_send_pdu(sk
, nskb
);
615 int llc_conn_ac_send_rnr_xxx_x_set_0(struct sock
*sk
, struct sk_buff
*skb
)
618 struct sk_buff
*nskb
= llc_alloc_frame();
622 struct llc_sock
*llc
= llc_sk(sk
);
623 struct llc_sap
*sap
= llc
->sap
;
625 nskb
->dev
= llc
->dev
;
626 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
627 llc
->daddr
.lsap
, LLC_PDU_RSP
);
628 llc_pdu_init_as_rnr_rsp(nskb
, f_bit
, llc
->vR
);
629 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
632 llc_conn_send_pdu(sk
, nskb
);
641 int llc_conn_ac_set_remote_busy(struct sock
*sk
, struct sk_buff
*skb
)
643 struct llc_sock
*llc
= llc_sk(sk
);
645 if (!llc
->remote_busy_flag
) {
646 llc
->remote_busy_flag
= 1;
647 mod_timer(&llc
->busy_state_timer
.timer
,
648 jiffies
+ llc
->busy_state_timer
.expire
* HZ
);
653 int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock
*sk
, struct sk_buff
*skb
)
656 struct sk_buff
*nskb
= llc_alloc_frame();
659 struct llc_sock
*llc
= llc_sk(sk
);
660 struct llc_sap
*sap
= llc
->sap
;
662 nskb
->dev
= llc
->dev
;
663 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
664 llc
->daddr
.lsap
, LLC_PDU_RSP
);
665 llc_pdu_init_as_rnr_rsp(nskb
, 0, llc
->vR
);
666 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
669 llc_conn_send_pdu(sk
, nskb
);
678 int llc_conn_ac_send_rr_cmd_p_set_1(struct sock
*sk
, struct sk_buff
*skb
)
681 struct sk_buff
*nskb
= llc_alloc_frame();
684 struct llc_sock
*llc
= llc_sk(sk
);
685 struct llc_sap
*sap
= llc
->sap
;
687 nskb
->dev
= llc
->dev
;
688 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
689 llc
->daddr
.lsap
, LLC_PDU_CMD
);
690 llc_pdu_init_as_rr_cmd(nskb
, 1, llc
->vR
);
691 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
694 llc_conn_send_pdu(sk
, nskb
);
703 int llc_conn_ac_send_rr_rsp_f_set_1(struct sock
*sk
, struct sk_buff
*skb
)
706 struct sk_buff
*nskb
= llc_alloc_frame();
709 struct llc_sock
*llc
= llc_sk(sk
);
710 struct llc_sap
*sap
= llc
->sap
;
713 nskb
->dev
= llc
->dev
;
714 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
715 llc
->daddr
.lsap
, LLC_PDU_RSP
);
716 llc_pdu_init_as_rr_rsp(nskb
, f_bit
, llc
->vR
);
717 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
720 llc_conn_send_pdu(sk
, nskb
);
729 int llc_conn_ac_send_ack_rsp_f_set_1(struct sock
*sk
, struct sk_buff
*skb
)
732 struct sk_buff
*nskb
= llc_alloc_frame();
735 struct llc_sock
*llc
= llc_sk(sk
);
736 struct llc_sap
*sap
= llc
->sap
;
739 nskb
->dev
= llc
->dev
;
740 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
741 llc
->daddr
.lsap
, LLC_PDU_RSP
);
742 llc_pdu_init_as_rr_rsp(nskb
, f_bit
, llc
->vR
);
743 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
746 llc_conn_send_pdu(sk
, nskb
);
755 int llc_conn_ac_send_rr_xxx_x_set_0(struct sock
*sk
, struct sk_buff
*skb
)
758 struct sk_buff
*nskb
= llc_alloc_frame();
761 struct llc_sock
*llc
= llc_sk(sk
);
762 struct llc_sap
*sap
= llc
->sap
;
764 nskb
->dev
= llc
->dev
;
765 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
766 llc
->daddr
.lsap
, LLC_PDU_RSP
);
767 llc_pdu_init_as_rr_rsp(nskb
, 0, llc
->vR
);
768 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
771 llc_conn_send_pdu(sk
, nskb
);
780 int llc_conn_ac_send_ack_xxx_x_set_0(struct sock
*sk
, struct sk_buff
*skb
)
783 struct sk_buff
*nskb
= llc_alloc_frame();
786 struct llc_sock
*llc
= llc_sk(sk
);
787 struct llc_sap
*sap
= llc
->sap
;
789 nskb
->dev
= llc
->dev
;
790 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
791 llc
->daddr
.lsap
, LLC_PDU_RSP
);
792 llc_pdu_init_as_rr_rsp(nskb
, 0, llc
->vR
);
793 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
796 llc_conn_send_pdu(sk
, nskb
);
805 void llc_conn_set_p_flag(struct sock
*sk
, u8 value
)
807 int state_changed
= llc_sk(sk
)->p_flag
&& !value
;
809 llc_sk(sk
)->p_flag
= value
;
812 sk
->sk_state_change(sk
);
815 int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock
*sk
, struct sk_buff
*skb
)
818 struct sk_buff
*nskb
= llc_alloc_frame();
819 struct llc_sock
*llc
= llc_sk(sk
);
822 struct llc_sap
*sap
= llc
->sap
;
823 u8
*dmac
= llc
->daddr
.mac
;
825 if (llc
->dev
->flags
& IFF_LOOPBACK
)
826 dmac
= llc
->dev
->dev_addr
;
827 nskb
->dev
= llc
->dev
;
828 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_U
, sap
->laddr
.lsap
,
829 llc
->daddr
.lsap
, LLC_PDU_CMD
);
830 llc_pdu_init_as_sabme_cmd(nskb
, 1);
831 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, dmac
);
834 llc_conn_send_pdu(sk
, nskb
);
835 llc_conn_set_p_flag(sk
, 1);
844 int llc_conn_ac_send_ua_rsp_f_set_p(struct sock
*sk
, struct sk_buff
*skb
)
848 struct sk_buff
*nskb
= llc_alloc_frame();
850 llc_pdu_decode_pf_bit(skb
, &f_bit
);
852 struct llc_sock
*llc
= llc_sk(sk
);
853 struct llc_sap
*sap
= llc
->sap
;
855 nskb
->dev
= llc
->dev
;
856 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_U
, sap
->laddr
.lsap
,
857 llc
->daddr
.lsap
, LLC_PDU_RSP
);
858 llc_pdu_init_as_ua_rsp(nskb
, f_bit
);
859 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
862 llc_conn_send_pdu(sk
, nskb
);
871 int llc_conn_ac_set_s_flag_0(struct sock
*sk
, struct sk_buff
*skb
)
873 llc_sk(sk
)->s_flag
= 0;
877 int llc_conn_ac_set_s_flag_1(struct sock
*sk
, struct sk_buff
*skb
)
879 llc_sk(sk
)->s_flag
= 1;
883 int llc_conn_ac_start_p_timer(struct sock
*sk
, struct sk_buff
*skb
)
885 struct llc_sock
*llc
= llc_sk(sk
);
887 llc_conn_set_p_flag(sk
, 1);
888 mod_timer(&llc
->pf_cycle_timer
.timer
,
889 jiffies
+ llc
->pf_cycle_timer
.expire
* HZ
);
894 * llc_conn_ac_send_ack_if_needed - check if ack is needed
895 * @sk: current connection structure
896 * @skb: current event
898 * Checks number of received PDUs which have not been acknowledged, yet,
899 * If number of them reaches to "npta"(Number of PDUs To Acknowledge) then
900 * sends an RR response as acknowledgement for them. Returns 0 for
901 * success, 1 otherwise.
903 int llc_conn_ac_send_ack_if_needed(struct sock
*sk
, struct sk_buff
*skb
)
906 struct llc_sock
*llc
= llc_sk(sk
);
908 llc_pdu_decode_pf_bit(skb
, &pf_bit
);
909 llc
->ack_pf
|= pf_bit
& 1;
910 if (!llc
->ack_must_be_send
) {
911 llc
->first_pdu_Ns
= llc
->vR
;
912 llc
->ack_must_be_send
= 1;
913 llc
->ack_pf
= pf_bit
& 1;
915 if (((llc
->vR
- llc
->first_pdu_Ns
+ 129) % 128) >= llc
->npta
) {
916 llc_conn_ac_send_rr_rsp_f_set_ackpf(sk
, skb
);
917 llc
->ack_must_be_send
= 0;
919 llc_conn_ac_inc_npta_value(sk
, skb
);
925 * llc_conn_ac_rst_sendack_flag - resets ack_must_be_send flag
926 * @sk: current connection structure
927 * @skb: current event
929 * This action resets ack_must_be_send flag of given connection, this flag
930 * indicates if there is any PDU which has not been acknowledged yet.
931 * Returns 0 for success, 1 otherwise.
933 int llc_conn_ac_rst_sendack_flag(struct sock
*sk
, struct sk_buff
*skb
)
935 llc_sk(sk
)->ack_must_be_send
= llc_sk(sk
)->ack_pf
= 0;
940 * llc_conn_ac_send_i_rsp_f_set_ackpf - acknowledge received PDUs
941 * @sk: current connection structure
942 * @skb: current event
944 * Sends an I response PDU with f-bit set to ack_pf flag as acknowledge to
945 * all received PDUs which have not been acknowledged, yet. ack_pf flag is
946 * set to one if one PDU with p-bit set to one is received. Returns 0 for
947 * success, 1 otherwise.
949 static int llc_conn_ac_send_i_rsp_f_set_ackpf(struct sock
*sk
,
953 struct llc_sock
*llc
= llc_sk(sk
);
954 struct llc_sap
*sap
= llc
->sap
;
956 llc_pdu_header_init(skb
, LLC_PDU_TYPE_I
, sap
->laddr
.lsap
,
957 llc
->daddr
.lsap
, LLC_PDU_RSP
);
958 llc_pdu_init_as_i_cmd(skb
, llc
->ack_pf
, llc
->vS
, llc
->vR
);
959 rc
= llc_mac_hdr_init(skb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
961 llc_conn_send_pdu(sk
, skb
);
962 llc_conn_ac_inc_vs_by_1(sk
, skb
);
968 * llc_conn_ac_send_i_as_ack - sends an I-format PDU to acknowledge rx PDUs
969 * @sk: current connection structure.
970 * @skb: current event.
972 * This action sends an I-format PDU as acknowledge to received PDUs which
973 * have not been acknowledged, yet, if there is any. By using of this
974 * action number of acknowledgements decreases, this technic is called
975 * piggy backing. Returns 0 for success, 1 otherwise.
977 int llc_conn_ac_send_i_as_ack(struct sock
*sk
, struct sk_buff
*skb
)
979 struct llc_sock
*llc
= llc_sk(sk
);
981 if (llc
->ack_must_be_send
) {
982 llc_conn_ac_send_i_rsp_f_set_ackpf(sk
, skb
);
983 llc
->ack_must_be_send
= 0 ;
986 llc_conn_ac_send_i_cmd_p_set_0(sk
, skb
);
991 * llc_conn_ac_send_rr_rsp_f_set_ackpf - ack all rx PDUs not yet acked
992 * @sk: current connection structure.
993 * @skb: current event.
995 * This action sends an RR response with f-bit set to ack_pf flag as
996 * acknowledge to all received PDUs which have not been acknowledged, yet,
997 * if there is any. ack_pf flag indicates if a PDU has been received with
998 * p-bit set to one. Returns 0 for success, 1 otherwise.
1000 static int llc_conn_ac_send_rr_rsp_f_set_ackpf(struct sock
*sk
,
1001 struct sk_buff
*skb
)
1004 struct sk_buff
*nskb
= llc_alloc_frame();
1007 struct llc_sock
*llc
= llc_sk(sk
);
1008 struct llc_sap
*sap
= llc
->sap
;
1010 nskb
->dev
= llc
->dev
;
1011 llc_pdu_header_init(nskb
, LLC_PDU_TYPE_S
, sap
->laddr
.lsap
,
1012 llc
->daddr
.lsap
, LLC_PDU_RSP
);
1013 llc_pdu_init_as_rr_rsp(nskb
, llc
->ack_pf
, llc
->vR
);
1014 rc
= llc_mac_hdr_init(nskb
, llc
->dev
->dev_addr
, llc
->daddr
.mac
);
1017 llc_conn_send_pdu(sk
, nskb
);
1027 * llc_conn_ac_inc_npta_value - tries to make value of npta greater
1028 * @sk: current connection structure.
1029 * @skb: current event.
1031 * After "inc_cntr" times calling of this action, "npta" increase by one.
1032 * this action tries to make vale of "npta" greater as possible; number of
1033 * acknowledgements decreases by increasing of "npta". Returns 0 for
1034 * success, 1 otherwise.
1036 static int llc_conn_ac_inc_npta_value(struct sock
*sk
, struct sk_buff
*skb
)
1038 struct llc_sock
*llc
= llc_sk(sk
);
1040 if (!llc
->inc_cntr
) {
1042 llc
->dec_cntr
= llc
->inc_cntr
= 2;
1044 if (llc
->npta
> 127)
1052 * llc_conn_ac_adjust_npta_by_rr - decreases "npta" by one
1053 * @sk: current connection structure.
1054 * @skb: current event.
1056 * After receiving "dec_cntr" times RR command, this action decreases
1057 * "npta" by one. Returns 0 for success, 1 otherwise.
1059 int llc_conn_ac_adjust_npta_by_rr(struct sock
*sk
, struct sk_buff
*skb
)
1061 struct llc_sock
*llc
= llc_sk(sk
);
1063 if (!llc
->connect_step
&& !llc
->remote_busy_flag
) {
1064 if (!llc
->dec_step
) {
1065 if (!llc
->dec_cntr
) {
1066 llc
->inc_cntr
= llc
->dec_cntr
= 2;
1068 llc
->npta
= llc
->npta
- 1;
1073 llc
->connect_step
= 0 ;
1078 * llc_conn_ac_adjust_npta_by_rnr - decreases "npta" by one
1079 * @sk: current connection structure.
1080 * @skb: current event.
1082 * After receiving "dec_cntr" times RNR command, this action decreases
1083 * "npta" by one. Returns 0 for success, 1 otherwise.
1085 int llc_conn_ac_adjust_npta_by_rnr(struct sock
*sk
, struct sk_buff
*skb
)
1087 struct llc_sock
*llc
= llc_sk(sk
);
1089 if (llc
->remote_busy_flag
)
1090 if (!llc
->dec_step
) {
1091 if (!llc
->dec_cntr
) {
1092 llc
->inc_cntr
= llc
->dec_cntr
= 2;
1102 * llc_conn_ac_dec_tx_win_size - decreases tx window size
1103 * @sk: current connection structure.
1104 * @skb: current event.
1106 * After receiving of a REJ command or response, transmit window size is
1107 * decreased by number of PDUs which are outstanding yet. Returns 0 for
1108 * success, 1 otherwise.
1110 int llc_conn_ac_dec_tx_win_size(struct sock
*sk
, struct sk_buff
*skb
)
1112 struct llc_sock
*llc
= llc_sk(sk
);
1113 u8 unacked_pdu
= skb_queue_len(&llc
->pdu_unack_q
);
1115 llc
->k
-= unacked_pdu
;
1122 * llc_conn_ac_inc_tx_win_size - tx window size is inc by 1
1123 * @sk: current connection structure.
1124 * @skb: current event.
1126 * After receiving an RR response with f-bit set to one, transmit window
1127 * size is increased by one. Returns 0 for success, 1 otherwise.
1129 int llc_conn_ac_inc_tx_win_size(struct sock
*sk
, struct sk_buff
*skb
)
1131 struct llc_sock
*llc
= llc_sk(sk
);
1139 int llc_conn_ac_stop_all_timers(struct sock
*sk
, struct sk_buff
*skb
)
1141 struct llc_sock
*llc
= llc_sk(sk
);
1143 del_timer(&llc
->pf_cycle_timer
.timer
);
1144 del_timer(&llc
->ack_timer
.timer
);
1145 del_timer(&llc
->rej_sent_timer
.timer
);
1146 del_timer(&llc
->busy_state_timer
.timer
);
1147 llc
->ack_must_be_send
= 0;
1152 int llc_conn_ac_stop_other_timers(struct sock
*sk
, struct sk_buff
*skb
)
1154 struct llc_sock
*llc
= llc_sk(sk
);
1156 del_timer(&llc
->rej_sent_timer
.timer
);
1157 del_timer(&llc
->pf_cycle_timer
.timer
);
1158 del_timer(&llc
->busy_state_timer
.timer
);
1159 llc
->ack_must_be_send
= 0;
1164 int llc_conn_ac_start_ack_timer(struct sock
*sk
, struct sk_buff
*skb
)
1166 struct llc_sock
*llc
= llc_sk(sk
);
1168 mod_timer(&llc
->ack_timer
.timer
, jiffies
+ llc
->ack_timer
.expire
* HZ
);
1172 int llc_conn_ac_start_rej_timer(struct sock
*sk
, struct sk_buff
*skb
)
1174 struct llc_sock
*llc
= llc_sk(sk
);
1176 mod_timer(&llc
->rej_sent_timer
.timer
,
1177 jiffies
+ llc
->rej_sent_timer
.expire
* HZ
);
1181 int llc_conn_ac_start_ack_tmr_if_not_running(struct sock
*sk
,
1182 struct sk_buff
*skb
)
1184 struct llc_sock
*llc
= llc_sk(sk
);
1186 if (!timer_pending(&llc
->ack_timer
.timer
))
1187 mod_timer(&llc
->ack_timer
.timer
,
1188 jiffies
+ llc
->ack_timer
.expire
* HZ
);
1192 int llc_conn_ac_stop_ack_timer(struct sock
*sk
, struct sk_buff
*skb
)
1194 del_timer(&llc_sk(sk
)->ack_timer
.timer
);
1198 int llc_conn_ac_stop_p_timer(struct sock
*sk
, struct sk_buff
*skb
)
1200 struct llc_sock
*llc
= llc_sk(sk
);
1202 del_timer(&llc
->pf_cycle_timer
.timer
);
1203 llc_conn_set_p_flag(sk
, 0);
1207 int llc_conn_ac_stop_rej_timer(struct sock
*sk
, struct sk_buff
*skb
)
1209 del_timer(&llc_sk(sk
)->rej_sent_timer
.timer
);
1213 int llc_conn_ac_upd_nr_received(struct sock
*sk
, struct sk_buff
*skb
)
1217 struct llc_pdu_sn
*pdu
= llc_pdu_sn_hdr(skb
);
1218 struct llc_sock
*llc
= llc_sk(sk
);
1220 llc
->last_nr
= PDU_SUPV_GET_Nr(pdu
);
1221 acked
= llc_conn_remove_acked_pdus(sk
, llc
->last_nr
, &unacked
);
1222 /* On loopback we don't queue I frames in unack_pdu_q queue. */
1223 if (acked
> 0 || (llc
->dev
->flags
& IFF_LOOPBACK
)) {
1224 llc
->retry_count
= 0;
1225 del_timer(&llc
->ack_timer
.timer
);
1226 if (llc
->failed_data_req
) {
1227 /* already, we did not accept data from upper layer
1228 * (tx_window full or unacceptable state). Now, we
1229 * can send data and must inform to upper layer.
1231 llc
->failed_data_req
= 0;
1232 llc_conn_ac_data_confirm(sk
, skb
);
1235 mod_timer(&llc
->ack_timer
.timer
,
1236 jiffies
+ llc
->ack_timer
.expire
* HZ
);
1237 } else if (llc
->failed_data_req
) {
1240 llc_pdu_decode_pf_bit(skb
, &f_bit
);
1242 llc
->failed_data_req
= 0;
1243 llc_conn_ac_data_confirm(sk
, skb
);
1249 int llc_conn_ac_upd_p_flag(struct sock
*sk
, struct sk_buff
*skb
)
1251 struct llc_pdu_sn
*pdu
= llc_pdu_sn_hdr(skb
);
1253 if (LLC_PDU_IS_RSP(pdu
)) {
1256 llc_pdu_decode_pf_bit(skb
, &f_bit
);
1258 llc_conn_set_p_flag(sk
, 0);
1259 llc_conn_ac_stop_p_timer(sk
, skb
);
1265 int llc_conn_ac_set_data_flag_2(struct sock
*sk
, struct sk_buff
*skb
)
1267 llc_sk(sk
)->data_flag
= 2;
1271 int llc_conn_ac_set_data_flag_0(struct sock
*sk
, struct sk_buff
*skb
)
1273 llc_sk(sk
)->data_flag
= 0;
1277 int llc_conn_ac_set_data_flag_1(struct sock
*sk
, struct sk_buff
*skb
)
1279 llc_sk(sk
)->data_flag
= 1;
1283 int llc_conn_ac_set_data_flag_1_if_data_flag_eq_0(struct sock
*sk
,
1284 struct sk_buff
*skb
)
1286 if (!llc_sk(sk
)->data_flag
)
1287 llc_sk(sk
)->data_flag
= 1;
1291 int llc_conn_ac_set_p_flag_0(struct sock
*sk
, struct sk_buff
*skb
)
1293 llc_conn_set_p_flag(sk
, 0);
1297 static int llc_conn_ac_set_p_flag_1(struct sock
*sk
, struct sk_buff
*skb
)
1299 llc_conn_set_p_flag(sk
, 1);
1303 int llc_conn_ac_set_remote_busy_0(struct sock
*sk
, struct sk_buff
*skb
)
1305 llc_sk(sk
)->remote_busy_flag
= 0;
1309 int llc_conn_ac_set_cause_flag_0(struct sock
*sk
, struct sk_buff
*skb
)
1311 llc_sk(sk
)->cause_flag
= 0;
1315 int llc_conn_ac_set_cause_flag_1(struct sock
*sk
, struct sk_buff
*skb
)
1317 llc_sk(sk
)->cause_flag
= 1;
1321 int llc_conn_ac_set_retry_cnt_0(struct sock
*sk
, struct sk_buff
*skb
)
1323 llc_sk(sk
)->retry_count
= 0;
1327 int llc_conn_ac_inc_retry_cnt_by_1(struct sock
*sk
, struct sk_buff
*skb
)
1329 llc_sk(sk
)->retry_count
++;
1333 int llc_conn_ac_set_vr_0(struct sock
*sk
, struct sk_buff
*skb
)
1339 int llc_conn_ac_inc_vr_by_1(struct sock
*sk
, struct sk_buff
*skb
)
1341 llc_sk(sk
)->vR
= PDU_GET_NEXT_Vr(llc_sk(sk
)->vR
);
1345 int llc_conn_ac_set_vs_0(struct sock
*sk
, struct sk_buff
*skb
)
1351 int llc_conn_ac_set_vs_nr(struct sock
*sk
, struct sk_buff
*skb
)
1353 llc_sk(sk
)->vS
= llc_sk(sk
)->last_nr
;
1357 int llc_conn_ac_inc_vs_by_1(struct sock
*sk
, struct sk_buff
*skb
)
1359 llc_sk(sk
)->vS
= (llc_sk(sk
)->vS
+ 1) % 128;
1363 void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data
)
1365 struct sock
*sk
= (struct sock
*)timeout_data
;
1366 struct sk_buff
*skb
= alloc_skb(0, GFP_ATOMIC
);
1370 struct llc_conn_state_ev
*ev
= llc_conn_ev(skb
);
1373 ev
->type
= LLC_CONN_EV_TYPE_P_TMR
;
1374 llc_process_tmr_ev(sk
, skb
);
1379 void llc_conn_busy_tmr_cb(unsigned long timeout_data
)
1381 struct sock
*sk
= (struct sock
*)timeout_data
;
1382 struct sk_buff
*skb
= alloc_skb(0, GFP_ATOMIC
);
1386 struct llc_conn_state_ev
*ev
= llc_conn_ev(skb
);
1389 ev
->type
= LLC_CONN_EV_TYPE_BUSY_TMR
;
1390 llc_process_tmr_ev(sk
, skb
);
1395 void llc_conn_ack_tmr_cb(unsigned long timeout_data
)
1397 struct sock
* sk
= (struct sock
*)timeout_data
;
1398 struct sk_buff
*skb
= alloc_skb(0, GFP_ATOMIC
);
1402 struct llc_conn_state_ev
*ev
= llc_conn_ev(skb
);
1405 ev
->type
= LLC_CONN_EV_TYPE_ACK_TMR
;
1406 llc_process_tmr_ev(sk
, skb
);
1411 void llc_conn_rej_tmr_cb(unsigned long timeout_data
)
1413 struct sock
*sk
= (struct sock
*)timeout_data
;
1414 struct sk_buff
*skb
= alloc_skb(0, GFP_ATOMIC
);
1418 struct llc_conn_state_ev
*ev
= llc_conn_ev(skb
);
1421 ev
->type
= LLC_CONN_EV_TYPE_REJ_TMR
;
1422 llc_process_tmr_ev(sk
, skb
);
1427 int llc_conn_ac_rst_vs(struct sock
*sk
, struct sk_buff
*skb
)
1429 llc_sk(sk
)->X
= llc_sk(sk
)->vS
;
1430 llc_conn_ac_set_vs_nr(sk
, skb
);
1434 int llc_conn_ac_upd_vs(struct sock
*sk
, struct sk_buff
*skb
)
1436 struct llc_pdu_sn
*pdu
= llc_pdu_sn_hdr(skb
);
1437 u8 nr
= PDU_SUPV_GET_Nr(pdu
);
1439 if (llc_circular_between(llc_sk(sk
)->vS
, nr
, llc_sk(sk
)->X
))
1440 llc_conn_ac_set_vs_nr(sk
, skb
);
1445 * Non-standard actions; these not contained in IEEE specification; for
1449 * llc_conn_disc - removes connection from SAP list and frees it
1450 * @sk: closed connection
1451 * @skb: occurred event
1453 int llc_conn_disc(struct sock
*sk
, struct sk_buff
*skb
)
1455 /* FIXME: this thing seems to want to die */
1460 * llc_conn_reset - resets connection
1461 * @sk : reseting connection.
1462 * @skb: occurred event.
1464 * Stop all timers, empty all queues and reset all flags.
1466 int llc_conn_reset(struct sock
*sk
, struct sk_buff
*skb
)
1473 * llc_circular_between - designates that b is between a and c or not
1475 * @b: element to see if is between a and b
1478 * This function designates that b is between a and c or not (for example,
1479 * 0 is between 127 and 1). Returns 1 if b is between a and c, 0
1482 u8
llc_circular_between(u8 a
, u8 b
, u8 c
)
1490 * llc_process_tmr_ev - timer backend
1491 * @sk: active connection
1492 * @skb: occurred event
1494 * This function is called from timer callback functions. When connection
1495 * is busy (during sending a data frame) timer expiration event must be
1496 * queued. Otherwise this event can be sent to connection state machine.
1497 * Queued events will process by llc_backlog_rcv function after sending
1500 static void llc_process_tmr_ev(struct sock
*sk
, struct sk_buff
*skb
)
1502 if (llc_sk(sk
)->state
== LLC_CONN_OUT_OF_SVC
) {
1503 printk(KERN_WARNING
"%s: timer called on closed connection\n",
1507 if (!sock_owned_by_user(sk
))
1508 llc_conn_state_process(sk
, skb
);
1510 llc_set_backlog_type(skb
, LLC_EVENT
);
1511 sk_add_backlog(sk
, skb
);