4ae75053c9d2a9e572f0fb760caabac9ce4b3e28
3 * Author Karsten Keil <kkeil@novell.com>
5 * Copyright 2008 by Karsten Keil <kkeil@novell.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #include <linux/mISDNif.h>
19 #include <linux/slab.h>
27 struct Fsm l2fsm
= {NULL
, 0, 0, NULL
, NULL
};
29 static char *strL2State
[] =
53 EV_L2_DL_ESTABLISH_REQ
,
66 #define L2_EVENT_COUNT (EV_L2_FRAME_ERROR+1)
68 static char *strL2Event
[] =
81 "EV_L2_DL_ESTABLISH_REQ",
82 "EV_L2_DL_RELEASE_REQ",
90 "EV_L2_CLEAR_OWN_BUSY",
95 l2m_debug(struct FsmInst
*fi
, char *fmt
, ...)
97 struct layer2
*l2
= fi
->userdata
;
101 if (!(*debug
& DEBUG_L2_FSM
))
109 printk(KERN_DEBUG
"l2 (sapi %d tei %d): %pV\n",
110 l2
->sapi
, l2
->tei
, &vaf
);
116 l2headersize(struct layer2
*l2
, int ui
)
118 return ((test_bit(FLG_MOD128
, &l2
->flag
) && (!ui
)) ? 2 : 1) +
119 (test_bit(FLG_LAPD
, &l2
->flag
) ? 2 : 1);
123 l2addrsize(struct layer2
*l2
)
125 return test_bit(FLG_LAPD
, &l2
->flag
) ? 2 : 1;
129 l2_newid(struct layer2
*l2
)
143 l2up(struct layer2
*l2
, u_int prim
, struct sk_buff
*skb
)
149 mISDN_HEAD_PRIM(skb
) = prim
;
150 mISDN_HEAD_ID(skb
) = (l2
->ch
.nr
<< 16) | l2
->ch
.addr
;
151 err
= l2
->up
->send(l2
->up
, skb
);
153 printk(KERN_WARNING
"%s: err=%d\n", __func__
, err
);
159 l2up_create(struct layer2
*l2
, u_int prim
, int len
, void *arg
)
162 struct mISDNhead
*hh
;
167 skb
= mI_alloc_skb(len
, GFP_ATOMIC
);
170 hh
= mISDN_HEAD_P(skb
);
172 hh
->id
= (l2
->ch
.nr
<< 16) | l2
->ch
.addr
;
174 memcpy(skb_put(skb
, len
), arg
, len
);
175 err
= l2
->up
->send(l2
->up
, skb
);
177 printk(KERN_WARNING
"%s: err=%d\n", __func__
, err
);
183 l2down_skb(struct layer2
*l2
, struct sk_buff
*skb
) {
186 ret
= l2
->ch
.recv(l2
->ch
.peer
, skb
);
187 if (ret
&& (*debug
& DEBUG_L2_RECV
))
188 printk(KERN_DEBUG
"l2down_skb: ret(%d)\n", ret
);
193 l2down_raw(struct layer2
*l2
, struct sk_buff
*skb
)
195 struct mISDNhead
*hh
= mISDN_HEAD_P(skb
);
197 if (hh
->prim
== PH_DATA_REQ
) {
198 if (test_and_set_bit(FLG_L1_NOTREADY
, &l2
->flag
)) {
199 skb_queue_tail(&l2
->down_queue
, skb
);
202 l2
->down_id
= mISDN_HEAD_ID(skb
);
204 return l2down_skb(l2
, skb
);
208 l2down(struct layer2
*l2
, u_int prim
, u_int id
, struct sk_buff
*skb
)
210 struct mISDNhead
*hh
= mISDN_HEAD_P(skb
);
214 return l2down_raw(l2
, skb
);
218 l2down_create(struct layer2
*l2
, u_int prim
, u_int id
, int len
, void *arg
)
222 struct mISDNhead
*hh
;
224 skb
= mI_alloc_skb(len
, GFP_ATOMIC
);
227 hh
= mISDN_HEAD_P(skb
);
231 memcpy(skb_put(skb
, len
), arg
, len
);
232 err
= l2down_raw(l2
, skb
);
239 ph_data_confirm(struct layer2
*l2
, struct mISDNhead
*hh
, struct sk_buff
*skb
) {
240 struct sk_buff
*nskb
= skb
;
243 if (test_bit(FLG_L1_NOTREADY
, &l2
->flag
)) {
244 if (hh
->id
== l2
->down_id
) {
245 nskb
= skb_dequeue(&l2
->down_queue
);
247 l2
->down_id
= mISDN_HEAD_ID(nskb
);
248 if (l2down_skb(l2
, nskb
)) {
250 l2
->down_id
= MISDN_ID_NONE
;
253 l2
->down_id
= MISDN_ID_NONE
;
258 if (l2
->down_id
== MISDN_ID_NONE
) {
259 test_and_clear_bit(FLG_L1_NOTREADY
, &l2
->flag
);
260 mISDN_FsmEvent(&l2
->l2m
, EV_L2_ACK_PULL
, NULL
);
264 if (!test_and_set_bit(FLG_L1_NOTREADY
, &l2
->flag
)) {
265 nskb
= skb_dequeue(&l2
->down_queue
);
267 l2
->down_id
= mISDN_HEAD_ID(nskb
);
268 if (l2down_skb(l2
, nskb
)) {
270 l2
->down_id
= MISDN_ID_NONE
;
271 test_and_clear_bit(FLG_L1_NOTREADY
, &l2
->flag
);
274 test_and_clear_bit(FLG_L1_NOTREADY
, &l2
->flag
);
280 l2mgr(struct layer2
*l2
, u_int prim
, void *arg
) {
284 "l2mgr: addr:%x prim %x %c\n", l2
->id
, prim
, (char)c
);
285 if (test_bit(FLG_LAPD
, &l2
->flag
) &&
286 !test_bit(FLG_FIXED_TEI
, &l2
->flag
)) {
292 l2_tei(l2
, prim
, (u_long
)arg
);
300 set_peer_busy(struct layer2
*l2
) {
301 test_and_set_bit(FLG_PEER_BUSY
, &l2
->flag
);
302 if (skb_queue_len(&l2
->i_queue
) || skb_queue_len(&l2
->ui_queue
))
303 test_and_set_bit(FLG_L2BLOCK
, &l2
->flag
);
307 clear_peer_busy(struct layer2
*l2
) {
308 if (test_and_clear_bit(FLG_PEER_BUSY
, &l2
->flag
))
309 test_and_clear_bit(FLG_L2BLOCK
, &l2
->flag
);
313 InitWin(struct layer2
*l2
)
317 for (i
= 0; i
< MAX_WINDOW
; i
++)
318 l2
->windowar
[i
] = NULL
;
322 freewin(struct layer2
*l2
)
326 for (i
= 0; i
< MAX_WINDOW
; i
++) {
327 if (l2
->windowar
[i
]) {
329 dev_kfree_skb(l2
->windowar
[i
]);
330 l2
->windowar
[i
] = NULL
;
337 ReleaseWin(struct layer2
*l2
)
339 int cnt
= freewin(l2
);
343 "isdnl2 freed %d skbuffs in release\n", cnt
);
347 cansend(struct layer2
*l2
)
351 if (test_bit(FLG_MOD128
, &l2
->flag
))
352 p1
= (l2
->vs
- l2
->va
) % 128;
354 p1
= (l2
->vs
- l2
->va
) % 8;
355 return (p1
< l2
->window
) && !test_bit(FLG_PEER_BUSY
, &l2
->flag
);
359 clear_exception(struct layer2
*l2
)
361 test_and_clear_bit(FLG_ACK_PEND
, &l2
->flag
);
362 test_and_clear_bit(FLG_REJEXC
, &l2
->flag
);
363 test_and_clear_bit(FLG_OWN_BUSY
, &l2
->flag
);
368 sethdraddr(struct layer2
*l2
, u_char
*header
, int rsp
)
370 u_char
*ptr
= header
;
373 if (test_bit(FLG_LAPD
, &l2
->flag
)) {
374 if (test_bit(FLG_LAPD_NET
, &l2
->flag
))
376 *ptr
++ = (l2
->sapi
<< 2) | (crbit
? 2 : 0);
377 *ptr
++ = (l2
->tei
<< 1) | 1;
380 if (test_bit(FLG_ORIG
, &l2
->flag
))
391 enqueue_super(struct layer2
*l2
, struct sk_buff
*skb
)
393 if (l2down(l2
, PH_DATA_REQ
, l2_newid(l2
), skb
))
398 enqueue_ui(struct layer2
*l2
, struct sk_buff
*skb
)
401 l2_tei(l2
, MDL_STATUS_UI_IND
, 0);
402 if (l2down(l2
, PH_DATA_REQ
, l2_newid(l2
), skb
))
409 return (data
[0] & 0xef) == UI
;
415 return (data
[0] & 0xef) == UA
;
421 return (data
[0] & 0xef) == DM
;
427 return (data
[0] & 0xef) == DISC
;
431 IsRR(u_char
*data
, struct layer2
*l2
)
433 if (test_bit(FLG_MOD128
, &l2
->flag
))
434 return data
[0] == RR
;
436 return (data
[0] & 0xf) == 1;
440 IsSFrame(u_char
*data
, struct layer2
*l2
)
442 register u_char d
= *data
;
444 if (!test_bit(FLG_MOD128
, &l2
->flag
))
446 return ((d
& 0xf3) == 1) && ((d
& 0x0c) != 0x0c);
450 IsSABME(u_char
*data
, struct layer2
*l2
)
452 u_char d
= data
[0] & ~0x10;
454 return test_bit(FLG_MOD128
, &l2
->flag
) ? d
== SABME
: d
== SABM
;
458 IsREJ(u_char
*data
, struct layer2
*l2
)
460 return test_bit(FLG_MOD128
, &l2
->flag
) ?
461 data
[0] == REJ
: (data
[0] & 0xf) == REJ
;
467 return (data
[0] & 0xef) == FRMR
;
471 IsRNR(u_char
*data
, struct layer2
*l2
)
473 return test_bit(FLG_MOD128
, &l2
->flag
) ?
474 data
[0] == RNR
: (data
[0] & 0xf) == RNR
;
478 iframe_error(struct layer2
*l2
, struct sk_buff
*skb
)
481 int rsp
= *skb
->data
& 0x2;
483 i
= l2addrsize(l2
) + (test_bit(FLG_MOD128
, &l2
->flag
) ? 2 : 1);
484 if (test_bit(FLG_ORIG
, &l2
->flag
))
490 if ((skb
->len
- i
) > l2
->maxlen
)
496 super_error(struct layer2
*l2
, struct sk_buff
*skb
)
498 if (skb
->len
!= l2addrsize(l2
) +
499 (test_bit(FLG_MOD128
, &l2
->flag
) ? 2 : 1))
505 unnum_error(struct layer2
*l2
, struct sk_buff
*skb
, int wantrsp
)
507 int rsp
= (*skb
->data
& 0x2) >> 1;
508 if (test_bit(FLG_ORIG
, &l2
->flag
))
512 if (skb
->len
!= l2addrsize(l2
) + 1)
518 UI_error(struct layer2
*l2
, struct sk_buff
*skb
)
520 int rsp
= *skb
->data
& 0x2;
521 if (test_bit(FLG_ORIG
, &l2
->flag
))
525 if (skb
->len
> l2
->maxlen
+ l2addrsize(l2
) + 1)
531 FRMR_error(struct layer2
*l2
, struct sk_buff
*skb
)
533 u_int headers
= l2addrsize(l2
) + 1;
534 u_char
*datap
= skb
->data
+ headers
;
535 int rsp
= *skb
->data
& 0x2;
537 if (test_bit(FLG_ORIG
, &l2
->flag
))
541 if (test_bit(FLG_MOD128
, &l2
->flag
)) {
542 if (skb
->len
< headers
+ 5)
544 else if (*debug
& DEBUG_L2
)
546 "FRMR information %2x %2x %2x %2x %2x",
547 datap
[0], datap
[1], datap
[2], datap
[3], datap
[4]);
549 if (skb
->len
< headers
+ 3)
551 else if (*debug
& DEBUG_L2
)
553 "FRMR information %2x %2x %2x",
554 datap
[0], datap
[1], datap
[2]);
560 legalnr(struct layer2
*l2
, unsigned int nr
)
562 if (test_bit(FLG_MOD128
, &l2
->flag
))
563 return ((nr
- l2
->va
) % 128) <= ((l2
->vs
- l2
->va
) % 128);
565 return ((nr
- l2
->va
) % 8) <= ((l2
->vs
- l2
->va
) % 8);
569 setva(struct layer2
*l2
, unsigned int nr
)
573 while (l2
->va
!= nr
) {
575 if (test_bit(FLG_MOD128
, &l2
->flag
))
579 if (l2
->windowar
[l2
->sow
]) {
580 skb_trim(l2
->windowar
[l2
->sow
], 0);
581 skb_queue_tail(&l2
->tmp_queue
, l2
->windowar
[l2
->sow
]);
582 l2
->windowar
[l2
->sow
] = NULL
;
584 l2
->sow
= (l2
->sow
+ 1) % l2
->window
;
586 skb
= skb_dequeue(&l2
->tmp_queue
);
589 skb
= skb_dequeue(&l2
->tmp_queue
);
594 send_uframe(struct layer2
*l2
, struct sk_buff
*skb
, u_char cmd
, u_char cr
)
596 u_char tmp
[MAX_L2HEADER_LEN
];
599 i
= sethdraddr(l2
, tmp
, cr
);
604 skb
= mI_alloc_skb(i
, GFP_ATOMIC
);
606 printk(KERN_WARNING
"%s: can't alloc skbuff\n",
611 memcpy(skb_put(skb
, i
), tmp
, i
);
612 enqueue_super(l2
, skb
);
617 get_PollFlag(struct layer2
*l2
, struct sk_buff
*skb
)
619 return skb
->data
[l2addrsize(l2
)] & 0x10;
623 get_PollFlagFree(struct layer2
*l2
, struct sk_buff
*skb
)
627 PF
= get_PollFlag(l2
, skb
);
633 start_t200(struct layer2
*l2
, int i
)
635 mISDN_FsmAddTimer(&l2
->t200
, l2
->T200
, EV_L2_T200
, NULL
, i
);
636 test_and_set_bit(FLG_T200_RUN
, &l2
->flag
);
640 restart_t200(struct layer2
*l2
, int i
)
642 mISDN_FsmRestartTimer(&l2
->t200
, l2
->T200
, EV_L2_T200
, NULL
, i
);
643 test_and_set_bit(FLG_T200_RUN
, &l2
->flag
);
647 stop_t200(struct layer2
*l2
, int i
)
649 if (test_and_clear_bit(FLG_T200_RUN
, &l2
->flag
))
650 mISDN_FsmDelTimer(&l2
->t200
, i
);
654 st5_dl_release_l2l3(struct layer2
*l2
)
658 if (test_and_clear_bit(FLG_PEND_REL
, &l2
->flag
))
662 l2up_create(l2
, pr
, 0, NULL
);
666 lapb_dl_release_l2l3(struct layer2
*l2
, int f
)
668 if (test_bit(FLG_LAPB
, &l2
->flag
))
669 l2down_create(l2
, PH_DEACTIVATE_REQ
, l2_newid(l2
), 0, NULL
);
670 l2up_create(l2
, f
, 0, NULL
);
674 establishlink(struct FsmInst
*fi
)
676 struct layer2
*l2
= fi
->userdata
;
681 cmd
= (test_bit(FLG_MOD128
, &l2
->flag
) ? SABME
: SABM
) | 0x10;
682 send_uframe(l2
, NULL
, cmd
, CMD
);
683 mISDN_FsmDelTimer(&l2
->t203
, 1);
685 test_and_clear_bit(FLG_PEND_REL
, &l2
->flag
);
687 mISDN_FsmChangeState(fi
, ST_L2_5
);
691 l2_mdl_error_ua(struct FsmInst
*fi
, int event
, void *arg
)
693 struct sk_buff
*skb
= arg
;
694 struct layer2
*l2
= fi
->userdata
;
696 if (get_PollFlagFree(l2
, skb
))
697 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'C');
699 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'D');
704 l2_mdl_error_dm(struct FsmInst
*fi
, int event
, void *arg
)
706 struct sk_buff
*skb
= arg
;
707 struct layer2
*l2
= fi
->userdata
;
709 if (get_PollFlagFree(l2
, skb
))
710 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'B');
712 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'E');
714 test_and_clear_bit(FLG_L3_INIT
, &l2
->flag
);
719 l2_st8_mdl_error_dm(struct FsmInst
*fi
, int event
, void *arg
)
721 struct sk_buff
*skb
= arg
;
722 struct layer2
*l2
= fi
->userdata
;
724 if (get_PollFlagFree(l2
, skb
))
725 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'B');
727 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'E');
729 test_and_clear_bit(FLG_L3_INIT
, &l2
->flag
);
733 l2_go_st3(struct FsmInst
*fi
, int event
, void *arg
)
735 dev_kfree_skb((struct sk_buff
*)arg
);
736 mISDN_FsmChangeState(fi
, ST_L2_3
);
740 l2_mdl_assign(struct FsmInst
*fi
, int event
, void *arg
)
742 struct layer2
*l2
= fi
->userdata
;
744 mISDN_FsmChangeState(fi
, ST_L2_3
);
745 dev_kfree_skb((struct sk_buff
*)arg
);
746 l2_tei(l2
, MDL_ASSIGN_IND
, 0);
750 l2_queue_ui_assign(struct FsmInst
*fi
, int event
, void *arg
)
752 struct layer2
*l2
= fi
->userdata
;
753 struct sk_buff
*skb
= arg
;
755 skb_queue_tail(&l2
->ui_queue
, skb
);
756 mISDN_FsmChangeState(fi
, ST_L2_2
);
757 l2_tei(l2
, MDL_ASSIGN_IND
, 0);
761 l2_queue_ui(struct FsmInst
*fi
, int event
, void *arg
)
763 struct layer2
*l2
= fi
->userdata
;
764 struct sk_buff
*skb
= arg
;
766 skb_queue_tail(&l2
->ui_queue
, skb
);
770 tx_ui(struct layer2
*l2
)
773 u_char header
[MAX_L2HEADER_LEN
];
776 i
= sethdraddr(l2
, header
, CMD
);
777 if (test_bit(FLG_LAPD_NET
, &l2
->flag
))
778 header
[1] = 0xff; /* tei 127 */
780 while ((skb
= skb_dequeue(&l2
->ui_queue
))) {
781 memcpy(skb_push(skb
, i
), header
, i
);
787 l2_send_ui(struct FsmInst
*fi
, int event
, void *arg
)
789 struct layer2
*l2
= fi
->userdata
;
790 struct sk_buff
*skb
= arg
;
792 skb_queue_tail(&l2
->ui_queue
, skb
);
797 l2_got_ui(struct FsmInst
*fi
, int event
, void *arg
)
799 struct layer2
*l2
= fi
->userdata
;
800 struct sk_buff
*skb
= arg
;
802 skb_pull(skb
, l2headersize(l2
, 1));
804 * in states 1-3 for broadcast
808 l2_tei(l2
, MDL_STATUS_UI_IND
, 0);
809 l2up(l2
, DL_UNITDATA_IND
, skb
);
813 l2_establish(struct FsmInst
*fi
, int event
, void *arg
)
815 struct sk_buff
*skb
= arg
;
816 struct layer2
*l2
= fi
->userdata
;
819 test_and_set_bit(FLG_L3_INIT
, &l2
->flag
);
824 l2_discard_i_setl3(struct FsmInst
*fi
, int event
, void *arg
)
826 struct sk_buff
*skb
= arg
;
827 struct layer2
*l2
= fi
->userdata
;
829 skb_queue_purge(&l2
->i_queue
);
830 test_and_set_bit(FLG_L3_INIT
, &l2
->flag
);
831 test_and_clear_bit(FLG_PEND_REL
, &l2
->flag
);
836 l2_l3_reestablish(struct FsmInst
*fi
, int event
, void *arg
)
838 struct sk_buff
*skb
= arg
;
839 struct layer2
*l2
= fi
->userdata
;
841 skb_queue_purge(&l2
->i_queue
);
843 test_and_set_bit(FLG_L3_INIT
, &l2
->flag
);
848 l2_release(struct FsmInst
*fi
, int event
, void *arg
)
850 struct layer2
*l2
= fi
->userdata
;
851 struct sk_buff
*skb
= arg
;
854 l2up(l2
, DL_RELEASE_CNF
, skb
);
858 l2_pend_rel(struct FsmInst
*fi
, int event
, void *arg
)
860 struct sk_buff
*skb
= arg
;
861 struct layer2
*l2
= fi
->userdata
;
863 test_and_set_bit(FLG_PEND_REL
, &l2
->flag
);
868 l2_disconnect(struct FsmInst
*fi
, int event
, void *arg
)
870 struct layer2
*l2
= fi
->userdata
;
871 struct sk_buff
*skb
= arg
;
873 skb_queue_purge(&l2
->i_queue
);
875 mISDN_FsmChangeState(fi
, ST_L2_6
);
877 send_uframe(l2
, NULL
, DISC
| 0x10, CMD
);
878 mISDN_FsmDelTimer(&l2
->t203
, 1);
885 l2_start_multi(struct FsmInst
*fi
, int event
, void *arg
)
887 struct layer2
*l2
= fi
->userdata
;
888 struct sk_buff
*skb
= arg
;
895 send_uframe(l2
, NULL
, UA
| get_PollFlag(l2
, skb
), RSP
);
896 mISDN_FsmChangeState(fi
, ST_L2_7
);
897 mISDN_FsmAddTimer(&l2
->t203
, l2
->T203
, EV_L2_T203
, NULL
, 3);
899 l2up(l2
, DL_ESTABLISH_IND
, skb
);
901 l2_tei(l2
, MDL_STATUS_UP_IND
, 0);
905 l2_send_UA(struct FsmInst
*fi
, int event
, void *arg
)
907 struct layer2
*l2
= fi
->userdata
;
908 struct sk_buff
*skb
= arg
;
910 send_uframe(l2
, skb
, UA
| get_PollFlag(l2
, skb
), RSP
);
914 l2_send_DM(struct FsmInst
*fi
, int event
, void *arg
)
916 struct layer2
*l2
= fi
->userdata
;
917 struct sk_buff
*skb
= arg
;
919 send_uframe(l2
, skb
, DM
| get_PollFlag(l2
, skb
), RSP
);
923 l2_restart_multi(struct FsmInst
*fi
, int event
, void *arg
)
925 struct layer2
*l2
= fi
->userdata
;
926 struct sk_buff
*skb
= arg
;
929 send_uframe(l2
, skb
, UA
| get_PollFlag(l2
, skb
), RSP
);
931 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'F');
933 if (l2
->vs
!= l2
->va
) {
934 skb_queue_purge(&l2
->i_queue
);
943 mISDN_FsmChangeState(fi
, ST_L2_7
);
945 mISDN_FsmRestartTimer(&l2
->t203
, l2
->T203
, EV_L2_T203
, NULL
, 3);
948 l2up_create(l2
, DL_ESTABLISH_IND
, 0, NULL
);
949 /* mISDN_queue_data(&l2->inst, l2->inst.id | MSG_BROADCAST,
950 * MGR_SHORTSTATUS | INDICATION, SSTATUS_L2_ESTABLISHED,
953 if (skb_queue_len(&l2
->i_queue
) && cansend(l2
))
954 mISDN_FsmEvent(fi
, EV_L2_ACK_PULL
, NULL
);
958 l2_stop_multi(struct FsmInst
*fi
, int event
, void *arg
)
960 struct layer2
*l2
= fi
->userdata
;
961 struct sk_buff
*skb
= arg
;
963 mISDN_FsmChangeState(fi
, ST_L2_4
);
964 mISDN_FsmDelTimer(&l2
->t203
, 3);
967 send_uframe(l2
, skb
, UA
| get_PollFlag(l2
, skb
), RSP
);
968 skb_queue_purge(&l2
->i_queue
);
970 lapb_dl_release_l2l3(l2
, DL_RELEASE_IND
);
972 l2_tei(l2
, MDL_STATUS_DOWN_IND
, 0);
976 l2_connected(struct FsmInst
*fi
, int event
, void *arg
)
978 struct layer2
*l2
= fi
->userdata
;
979 struct sk_buff
*skb
= arg
;
982 if (!get_PollFlag(l2
, skb
)) {
983 l2_mdl_error_ua(fi
, event
, arg
);
987 if (test_and_clear_bit(FLG_PEND_REL
, &l2
->flag
))
988 l2_disconnect(fi
, event
, NULL
);
989 if (test_and_clear_bit(FLG_L3_INIT
, &l2
->flag
)) {
990 pr
= DL_ESTABLISH_CNF
;
991 } else if (l2
->vs
!= l2
->va
) {
992 skb_queue_purge(&l2
->i_queue
);
993 pr
= DL_ESTABLISH_IND
;
1000 mISDN_FsmChangeState(fi
, ST_L2_7
);
1001 mISDN_FsmAddTimer(&l2
->t203
, l2
->T203
, EV_L2_T203
, NULL
, 4);
1003 l2up_create(l2
, pr
, 0, NULL
);
1005 if (skb_queue_len(&l2
->i_queue
) && cansend(l2
))
1006 mISDN_FsmEvent(fi
, EV_L2_ACK_PULL
, NULL
);
1009 l2_tei(l2
, MDL_STATUS_UP_IND
, 0);
1013 l2_released(struct FsmInst
*fi
, int event
, void *arg
)
1015 struct layer2
*l2
= fi
->userdata
;
1016 struct sk_buff
*skb
= arg
;
1018 if (!get_PollFlag(l2
, skb
)) {
1019 l2_mdl_error_ua(fi
, event
, arg
);
1024 lapb_dl_release_l2l3(l2
, DL_RELEASE_CNF
);
1025 mISDN_FsmChangeState(fi
, ST_L2_4
);
1027 l2_tei(l2
, MDL_STATUS_DOWN_IND
, 0);
1031 l2_reestablish(struct FsmInst
*fi
, int event
, void *arg
)
1033 struct layer2
*l2
= fi
->userdata
;
1034 struct sk_buff
*skb
= arg
;
1036 if (!get_PollFlagFree(l2
, skb
)) {
1038 test_and_set_bit(FLG_L3_INIT
, &l2
->flag
);
1043 l2_st5_dm_release(struct FsmInst
*fi
, int event
, void *arg
)
1045 struct layer2
*l2
= fi
->userdata
;
1046 struct sk_buff
*skb
= arg
;
1048 if (get_PollFlagFree(l2
, skb
)) {
1050 if (!test_bit(FLG_L3_INIT
, &l2
->flag
))
1051 skb_queue_purge(&l2
->i_queue
);
1052 if (test_bit(FLG_LAPB
, &l2
->flag
))
1053 l2down_create(l2
, PH_DEACTIVATE_REQ
,
1054 l2_newid(l2
), 0, NULL
);
1055 st5_dl_release_l2l3(l2
);
1056 mISDN_FsmChangeState(fi
, ST_L2_4
);
1058 l2_tei(l2
, MDL_STATUS_DOWN_IND
, 0);
1063 l2_st6_dm_release(struct FsmInst
*fi
, int event
, void *arg
)
1065 struct layer2
*l2
= fi
->userdata
;
1066 struct sk_buff
*skb
= arg
;
1068 if (get_PollFlagFree(l2
, skb
)) {
1070 lapb_dl_release_l2l3(l2
, DL_RELEASE_CNF
);
1071 mISDN_FsmChangeState(fi
, ST_L2_4
);
1073 l2_tei(l2
, MDL_STATUS_DOWN_IND
, 0);
1078 enquiry_cr(struct layer2
*l2
, u_char typ
, u_char cr
, u_char pf
)
1080 struct sk_buff
*skb
;
1081 u_char tmp
[MAX_L2HEADER_LEN
];
1084 i
= sethdraddr(l2
, tmp
, cr
);
1085 if (test_bit(FLG_MOD128
, &l2
->flag
)) {
1087 tmp
[i
++] = (l2
->vr
<< 1) | (pf
? 1 : 0);
1089 tmp
[i
++] = (l2
->vr
<< 5) | typ
| (pf
? 0x10 : 0);
1090 skb
= mI_alloc_skb(i
, GFP_ATOMIC
);
1093 "isdnl2 can't alloc sbbuff for enquiry_cr\n");
1096 memcpy(skb_put(skb
, i
), tmp
, i
);
1097 enqueue_super(l2
, skb
);
1101 enquiry_response(struct layer2
*l2
)
1103 if (test_bit(FLG_OWN_BUSY
, &l2
->flag
))
1104 enquiry_cr(l2
, RNR
, RSP
, 1);
1106 enquiry_cr(l2
, RR
, RSP
, 1);
1107 test_and_clear_bit(FLG_ACK_PEND
, &l2
->flag
);
1111 transmit_enquiry(struct layer2
*l2
)
1113 if (test_bit(FLG_OWN_BUSY
, &l2
->flag
))
1114 enquiry_cr(l2
, RNR
, CMD
, 1);
1116 enquiry_cr(l2
, RR
, CMD
, 1);
1117 test_and_clear_bit(FLG_ACK_PEND
, &l2
->flag
);
1123 nrerrorrecovery(struct FsmInst
*fi
)
1125 struct layer2
*l2
= fi
->userdata
;
1127 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'J');
1129 test_and_clear_bit(FLG_L3_INIT
, &l2
->flag
);
1133 invoke_retransmission(struct layer2
*l2
, unsigned int nr
)
1138 while (l2
->vs
!= nr
) {
1140 if (test_bit(FLG_MOD128
, &l2
->flag
)) {
1142 p1
= (l2
->vs
- l2
->va
) % 128;
1145 p1
= (l2
->vs
- l2
->va
) % 8;
1147 p1
= (p1
+ l2
->sow
) % l2
->window
;
1148 if (l2
->windowar
[p1
])
1149 skb_queue_head(&l2
->i_queue
, l2
->windowar
[p1
]);
1152 "%s: windowar[%d] is NULL\n",
1154 l2
->windowar
[p1
] = NULL
;
1156 mISDN_FsmEvent(&l2
->l2m
, EV_L2_ACK_PULL
, NULL
);
1161 l2_st7_got_super(struct FsmInst
*fi
, int event
, void *arg
)
1163 struct layer2
*l2
= fi
->userdata
;
1164 struct sk_buff
*skb
= arg
;
1165 int PollFlag
, rsp
, typ
= RR
;
1168 rsp
= *skb
->data
& 0x2;
1169 if (test_bit(FLG_ORIG
, &l2
->flag
))
1172 skb_pull(skb
, l2addrsize(l2
));
1173 if (IsRNR(skb
->data
, l2
)) {
1177 clear_peer_busy(l2
);
1178 if (IsREJ(skb
->data
, l2
))
1181 if (test_bit(FLG_MOD128
, &l2
->flag
)) {
1182 PollFlag
= (skb
->data
[1] & 0x1) == 0x1;
1183 nr
= skb
->data
[1] >> 1;
1185 PollFlag
= (skb
->data
[0] & 0x10);
1186 nr
= (skb
->data
[0] >> 5) & 0x7;
1192 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'A');
1194 enquiry_response(l2
);
1196 if (legalnr(l2
, nr
)) {
1199 invoke_retransmission(l2
, nr
);
1201 if (mISDN_FsmAddTimer(&l2
->t203
, l2
->T203
,
1202 EV_L2_T203
, NULL
, 6))
1203 l2m_debug(&l2
->l2m
, "Restart T203 ST7 REJ");
1204 } else if ((nr
== l2
->vs
) && (typ
== RR
)) {
1207 mISDN_FsmRestartTimer(&l2
->t203
, l2
->T203
,
1208 EV_L2_T203
, NULL
, 7);
1209 } else if ((l2
->va
!= nr
) || (typ
== RNR
)) {
1212 mISDN_FsmDelTimer(&l2
->t203
, 9);
1213 restart_t200(l2
, 12);
1215 if (skb_queue_len(&l2
->i_queue
) && (typ
== RR
))
1216 mISDN_FsmEvent(fi
, EV_L2_ACK_PULL
, NULL
);
1218 nrerrorrecovery(fi
);
1222 l2_feed_i_if_reest(struct FsmInst
*fi
, int event
, void *arg
)
1224 struct layer2
*l2
= fi
->userdata
;
1225 struct sk_buff
*skb
= arg
;
1227 if (!test_bit(FLG_L3_INIT
, &l2
->flag
))
1228 skb_queue_tail(&l2
->i_queue
, skb
);
1234 l2_feed_i_pull(struct FsmInst
*fi
, int event
, void *arg
)
1236 struct layer2
*l2
= fi
->userdata
;
1237 struct sk_buff
*skb
= arg
;
1239 skb_queue_tail(&l2
->i_queue
, skb
);
1240 mISDN_FsmEvent(fi
, EV_L2_ACK_PULL
, NULL
);
1244 l2_feed_iqueue(struct FsmInst
*fi
, int event
, void *arg
)
1246 struct layer2
*l2
= fi
->userdata
;
1247 struct sk_buff
*skb
= arg
;
1249 skb_queue_tail(&l2
->i_queue
, skb
);
1253 l2_got_iframe(struct FsmInst
*fi
, int event
, void *arg
)
1255 struct layer2
*l2
= fi
->userdata
;
1256 struct sk_buff
*skb
= arg
;
1261 if (test_bit(FLG_MOD128
, &l2
->flag
)) {
1262 PollFlag
= ((skb
->data
[i
+ 1] & 0x1) == 0x1);
1263 ns
= skb
->data
[i
] >> 1;
1264 nr
= (skb
->data
[i
+ 1] >> 1) & 0x7f;
1266 PollFlag
= (skb
->data
[i
] & 0x10);
1267 ns
= (skb
->data
[i
] >> 1) & 0x7;
1268 nr
= (skb
->data
[i
] >> 5) & 0x7;
1270 if (test_bit(FLG_OWN_BUSY
, &l2
->flag
)) {
1273 enquiry_response(l2
);
1277 if (test_bit(FLG_MOD128
, &l2
->flag
))
1281 test_and_clear_bit(FLG_REJEXC
, &l2
->flag
);
1283 enquiry_response(l2
);
1285 test_and_set_bit(FLG_ACK_PEND
, &l2
->flag
);
1286 skb_pull(skb
, l2headersize(l2
, 0));
1287 l2up(l2
, DL_DATA_IND
, skb
);
1291 if (test_and_set_bit(FLG_REJEXC
, &l2
->flag
)) {
1293 enquiry_response(l2
);
1295 enquiry_cr(l2
, REJ
, RSP
, PollFlag
);
1296 test_and_clear_bit(FLG_ACK_PEND
, &l2
->flag
);
1300 if (legalnr(l2
, nr
)) {
1301 if (!test_bit(FLG_PEER_BUSY
, &l2
->flag
) &&
1302 (fi
->state
== ST_L2_7
)) {
1305 mISDN_FsmRestartTimer(&l2
->t203
, l2
->T203
,
1306 EV_L2_T203
, NULL
, 7);
1307 } else if (nr
!= l2
->va
)
1308 restart_t200(l2
, 14);
1312 nrerrorrecovery(fi
);
1315 if (skb_queue_len(&l2
->i_queue
) && (fi
->state
== ST_L2_7
))
1316 mISDN_FsmEvent(fi
, EV_L2_ACK_PULL
, NULL
);
1317 if (test_and_clear_bit(FLG_ACK_PEND
, &l2
->flag
))
1318 enquiry_cr(l2
, RR
, RSP
, 0);
1322 l2_got_tei(struct FsmInst
*fi
, int event
, void *arg
)
1324 struct layer2
*l2
= fi
->userdata
;
1327 l2
->tei
= (signed char)(long)arg
;
1328 set_channel_address(&l2
->ch
, l2
->sapi
, l2
->tei
);
1329 info
= DL_INFO_L2_CONNECT
;
1330 l2up_create(l2
, DL_INFORMATION_IND
, sizeof(info
), &info
);
1331 if (fi
->state
== ST_L2_3
) {
1333 test_and_set_bit(FLG_L3_INIT
, &l2
->flag
);
1335 mISDN_FsmChangeState(fi
, ST_L2_4
);
1336 if (skb_queue_len(&l2
->ui_queue
))
1341 l2_st5_tout_200(struct FsmInst
*fi
, int event
, void *arg
)
1343 struct layer2
*l2
= fi
->userdata
;
1345 if (test_bit(FLG_LAPD
, &l2
->flag
) &&
1346 test_bit(FLG_DCHAN_BUSY
, &l2
->flag
)) {
1347 mISDN_FsmAddTimer(&l2
->t200
, l2
->T200
, EV_L2_T200
, NULL
, 9);
1348 } else if (l2
->rc
== l2
->N200
) {
1349 mISDN_FsmChangeState(fi
, ST_L2_4
);
1350 test_and_clear_bit(FLG_T200_RUN
, &l2
->flag
);
1351 skb_queue_purge(&l2
->i_queue
);
1352 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'G');
1353 if (test_bit(FLG_LAPB
, &l2
->flag
))
1354 l2down_create(l2
, PH_DEACTIVATE_REQ
,
1355 l2_newid(l2
), 0, NULL
);
1356 st5_dl_release_l2l3(l2
);
1358 l2_tei(l2
, MDL_STATUS_DOWN_IND
, 0);
1361 mISDN_FsmAddTimer(&l2
->t200
, l2
->T200
, EV_L2_T200
, NULL
, 9);
1362 send_uframe(l2
, NULL
, (test_bit(FLG_MOD128
, &l2
->flag
) ?
1363 SABME
: SABM
) | 0x10, CMD
);
1368 l2_st6_tout_200(struct FsmInst
*fi
, int event
, void *arg
)
1370 struct layer2
*l2
= fi
->userdata
;
1372 if (test_bit(FLG_LAPD
, &l2
->flag
) &&
1373 test_bit(FLG_DCHAN_BUSY
, &l2
->flag
)) {
1374 mISDN_FsmAddTimer(&l2
->t200
, l2
->T200
, EV_L2_T200
, NULL
, 9);
1375 } else if (l2
->rc
== l2
->N200
) {
1376 mISDN_FsmChangeState(fi
, ST_L2_4
);
1377 test_and_clear_bit(FLG_T200_RUN
, &l2
->flag
);
1378 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'H');
1379 lapb_dl_release_l2l3(l2
, DL_RELEASE_CNF
);
1381 l2_tei(l2
, MDL_STATUS_DOWN_IND
, 0);
1384 mISDN_FsmAddTimer(&l2
->t200
, l2
->T200
, EV_L2_T200
,
1386 send_uframe(l2
, NULL
, DISC
| 0x10, CMD
);
1391 l2_st7_tout_200(struct FsmInst
*fi
, int event
, void *arg
)
1393 struct layer2
*l2
= fi
->userdata
;
1395 if (test_bit(FLG_LAPD
, &l2
->flag
) &&
1396 test_bit(FLG_DCHAN_BUSY
, &l2
->flag
)) {
1397 mISDN_FsmAddTimer(&l2
->t200
, l2
->T200
, EV_L2_T200
, NULL
, 9);
1400 test_and_clear_bit(FLG_T200_RUN
, &l2
->flag
);
1402 mISDN_FsmChangeState(fi
, ST_L2_8
);
1403 transmit_enquiry(l2
);
1408 l2_st8_tout_200(struct FsmInst
*fi
, int event
, void *arg
)
1410 struct layer2
*l2
= fi
->userdata
;
1412 if (test_bit(FLG_LAPD
, &l2
->flag
) &&
1413 test_bit(FLG_DCHAN_BUSY
, &l2
->flag
)) {
1414 mISDN_FsmAddTimer(&l2
->t200
, l2
->T200
, EV_L2_T200
, NULL
, 9);
1417 test_and_clear_bit(FLG_T200_RUN
, &l2
->flag
);
1418 if (l2
->rc
== l2
->N200
) {
1419 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'I');
1421 test_and_clear_bit(FLG_L3_INIT
, &l2
->flag
);
1423 transmit_enquiry(l2
);
1429 l2_st7_tout_203(struct FsmInst
*fi
, int event
, void *arg
)
1431 struct layer2
*l2
= fi
->userdata
;
1433 if (test_bit(FLG_LAPD
, &l2
->flag
) &&
1434 test_bit(FLG_DCHAN_BUSY
, &l2
->flag
)) {
1435 mISDN_FsmAddTimer(&l2
->t203
, l2
->T203
, EV_L2_T203
, NULL
, 9);
1438 mISDN_FsmChangeState(fi
, ST_L2_8
);
1439 transmit_enquiry(l2
);
1444 l2_pull_iqueue(struct FsmInst
*fi
, int event
, void *arg
)
1446 struct layer2
*l2
= fi
->userdata
;
1447 struct sk_buff
*skb
, *nskb
, *oskb
;
1448 u_char header
[MAX_L2HEADER_LEN
];
1454 skb
= skb_dequeue(&l2
->i_queue
);
1458 if (test_bit(FLG_MOD128
, &l2
->flag
))
1459 p1
= (l2
->vs
- l2
->va
) % 128;
1461 p1
= (l2
->vs
- l2
->va
) % 8;
1462 p1
= (p1
+ l2
->sow
) % l2
->window
;
1463 if (l2
->windowar
[p1
]) {
1464 printk(KERN_WARNING
"isdnl2 try overwrite ack queue entry %d\n",
1466 dev_kfree_skb(l2
->windowar
[p1
]);
1468 l2
->windowar
[p1
] = skb
;
1469 i
= sethdraddr(l2
, header
, CMD
);
1470 if (test_bit(FLG_MOD128
, &l2
->flag
)) {
1471 header
[i
++] = l2
->vs
<< 1;
1472 header
[i
++] = l2
->vr
<< 1;
1473 l2
->vs
= (l2
->vs
+ 1) % 128;
1475 header
[i
++] = (l2
->vr
<< 5) | (l2
->vs
<< 1);
1476 l2
->vs
= (l2
->vs
+ 1) % 8;
1479 nskb
= skb_clone(skb
, GFP_ATOMIC
);
1480 p1
= skb_headroom(nskb
);
1482 memcpy(skb_push(nskb
, i
), header
, i
);
1485 "isdnl2 pull_iqueue skb header(%d/%d) too short\n", i
, p1
);
1487 nskb
= mI_alloc_skb(oskb
->len
+ i
, GFP_ATOMIC
);
1489 dev_kfree_skb(oskb
);
1490 printk(KERN_WARNING
"%s: no skb mem\n", __func__
);
1493 memcpy(skb_put(nskb
, i
), header
, i
);
1494 memcpy(skb_put(nskb
, oskb
->len
), oskb
->data
, oskb
->len
);
1495 dev_kfree_skb(oskb
);
1497 l2down(l2
, PH_DATA_REQ
, l2_newid(l2
), nskb
);
1498 test_and_clear_bit(FLG_ACK_PEND
, &l2
->flag
);
1499 if (!test_and_set_bit(FLG_T200_RUN
, &l2
->flag
)) {
1500 mISDN_FsmDelTimer(&l2
->t203
, 13);
1501 mISDN_FsmAddTimer(&l2
->t200
, l2
->T200
, EV_L2_T200
, NULL
, 11);
1506 l2_st8_got_super(struct FsmInst
*fi
, int event
, void *arg
)
1508 struct layer2
*l2
= fi
->userdata
;
1509 struct sk_buff
*skb
= arg
;
1510 int PollFlag
, rsp
, rnr
= 0;
1513 rsp
= *skb
->data
& 0x2;
1514 if (test_bit(FLG_ORIG
, &l2
->flag
))
1517 skb_pull(skb
, l2addrsize(l2
));
1519 if (IsRNR(skb
->data
, l2
)) {
1523 clear_peer_busy(l2
);
1525 if (test_bit(FLG_MOD128
, &l2
->flag
)) {
1526 PollFlag
= (skb
->data
[1] & 0x1) == 0x1;
1527 nr
= skb
->data
[1] >> 1;
1529 PollFlag
= (skb
->data
[0] & 0x10);
1530 nr
= (skb
->data
[0] >> 5) & 0x7;
1533 if (rsp
&& PollFlag
) {
1534 if (legalnr(l2
, nr
)) {
1536 restart_t200(l2
, 15);
1539 mISDN_FsmAddTimer(&l2
->t203
, l2
->T203
,
1540 EV_L2_T203
, NULL
, 5);
1543 invoke_retransmission(l2
, nr
);
1544 mISDN_FsmChangeState(fi
, ST_L2_7
);
1545 if (skb_queue_len(&l2
->i_queue
) && cansend(l2
))
1546 mISDN_FsmEvent(fi
, EV_L2_ACK_PULL
, NULL
);
1548 nrerrorrecovery(fi
);
1550 if (!rsp
&& PollFlag
)
1551 enquiry_response(l2
);
1552 if (legalnr(l2
, nr
))
1555 nrerrorrecovery(fi
);
1560 l2_got_FRMR(struct FsmInst
*fi
, int event
, void *arg
)
1562 struct layer2
*l2
= fi
->userdata
;
1563 struct sk_buff
*skb
= arg
;
1565 skb_pull(skb
, l2addrsize(l2
) + 1);
1567 if (!(skb
->data
[0] & 1) || ((skb
->data
[0] & 3) == 1) || /* I or S */
1568 (IsUA(skb
->data
) && (fi
->state
== ST_L2_7
))) {
1569 l2mgr(l2
, MDL_ERROR_IND
, (void *) 'K');
1571 test_and_clear_bit(FLG_L3_INIT
, &l2
->flag
);
1577 l2_st24_tei_remove(struct FsmInst
*fi
, int event
, void *arg
)
1579 struct layer2
*l2
= fi
->userdata
;
1581 skb_queue_purge(&l2
->ui_queue
);
1582 l2
->tei
= GROUP_TEI
;
1583 mISDN_FsmChangeState(fi
, ST_L2_1
);
1587 l2_st3_tei_remove(struct FsmInst
*fi
, int event
, void *arg
)
1589 struct layer2
*l2
= fi
->userdata
;
1591 skb_queue_purge(&l2
->ui_queue
);
1592 l2
->tei
= GROUP_TEI
;
1593 l2up_create(l2
, DL_RELEASE_IND
, 0, NULL
);
1594 mISDN_FsmChangeState(fi
, ST_L2_1
);
1598 l2_st5_tei_remove(struct FsmInst
*fi
, int event
, void *arg
)
1600 struct layer2
*l2
= fi
->userdata
;
1602 skb_queue_purge(&l2
->i_queue
);
1603 skb_queue_purge(&l2
->ui_queue
);
1605 l2
->tei
= GROUP_TEI
;
1607 st5_dl_release_l2l3(l2
);
1608 mISDN_FsmChangeState(fi
, ST_L2_1
);
1612 l2_st6_tei_remove(struct FsmInst
*fi
, int event
, void *arg
)
1614 struct layer2
*l2
= fi
->userdata
;
1616 skb_queue_purge(&l2
->ui_queue
);
1617 l2
->tei
= GROUP_TEI
;
1619 l2up_create(l2
, DL_RELEASE_IND
, 0, NULL
);
1620 mISDN_FsmChangeState(fi
, ST_L2_1
);
1624 l2_tei_remove(struct FsmInst
*fi
, int event
, void *arg
)
1626 struct layer2
*l2
= fi
->userdata
;
1628 skb_queue_purge(&l2
->i_queue
);
1629 skb_queue_purge(&l2
->ui_queue
);
1631 l2
->tei
= GROUP_TEI
;
1633 mISDN_FsmDelTimer(&l2
->t203
, 19);
1634 l2up_create(l2
, DL_RELEASE_IND
, 0, NULL
);
1635 /* mISDN_queue_data(&l2->inst, l2->inst.id | MSG_BROADCAST,
1636 * MGR_SHORTSTATUS_IND, SSTATUS_L2_RELEASED,
1639 mISDN_FsmChangeState(fi
, ST_L2_1
);
1643 l2_st14_persistant_da(struct FsmInst
*fi
, int event
, void *arg
)
1645 struct layer2
*l2
= fi
->userdata
;
1646 struct sk_buff
*skb
= arg
;
1648 skb_queue_purge(&l2
->i_queue
);
1649 skb_queue_purge(&l2
->ui_queue
);
1650 if (test_and_clear_bit(FLG_ESTAB_PEND
, &l2
->flag
))
1651 l2up(l2
, DL_RELEASE_IND
, skb
);
1657 l2_st5_persistant_da(struct FsmInst
*fi
, int event
, void *arg
)
1659 struct layer2
*l2
= fi
->userdata
;
1660 struct sk_buff
*skb
= arg
;
1662 skb_queue_purge(&l2
->i_queue
);
1663 skb_queue_purge(&l2
->ui_queue
);
1666 st5_dl_release_l2l3(l2
);
1667 mISDN_FsmChangeState(fi
, ST_L2_4
);
1669 l2_tei(l2
, MDL_STATUS_DOWN_IND
, 0);
1674 l2_st6_persistant_da(struct FsmInst
*fi
, int event
, void *arg
)
1676 struct layer2
*l2
= fi
->userdata
;
1677 struct sk_buff
*skb
= arg
;
1679 skb_queue_purge(&l2
->ui_queue
);
1681 l2up(l2
, DL_RELEASE_CNF
, skb
);
1682 mISDN_FsmChangeState(fi
, ST_L2_4
);
1684 l2_tei(l2
, MDL_STATUS_DOWN_IND
, 0);
1688 l2_persistant_da(struct FsmInst
*fi
, int event
, void *arg
)
1690 struct layer2
*l2
= fi
->userdata
;
1691 struct sk_buff
*skb
= arg
;
1693 skb_queue_purge(&l2
->i_queue
);
1694 skb_queue_purge(&l2
->ui_queue
);
1697 mISDN_FsmDelTimer(&l2
->t203
, 19);
1698 l2up(l2
, DL_RELEASE_IND
, skb
);
1699 mISDN_FsmChangeState(fi
, ST_L2_4
);
1701 l2_tei(l2
, MDL_STATUS_DOWN_IND
, 0);
1705 l2_set_own_busy(struct FsmInst
*fi
, int event
, void *arg
)
1707 struct layer2
*l2
= fi
->userdata
;
1708 struct sk_buff
*skb
= arg
;
1710 if (!test_and_set_bit(FLG_OWN_BUSY
, &l2
->flag
)) {
1711 enquiry_cr(l2
, RNR
, RSP
, 0);
1712 test_and_clear_bit(FLG_ACK_PEND
, &l2
->flag
);
1719 l2_clear_own_busy(struct FsmInst
*fi
, int event
, void *arg
)
1721 struct layer2
*l2
= fi
->userdata
;
1722 struct sk_buff
*skb
= arg
;
1724 if (!test_and_clear_bit(FLG_OWN_BUSY
, &l2
->flag
)) {
1725 enquiry_cr(l2
, RR
, RSP
, 0);
1726 test_and_clear_bit(FLG_ACK_PEND
, &l2
->flag
);
1733 l2_frame_error(struct FsmInst
*fi
, int event
, void *arg
)
1735 struct layer2
*l2
= fi
->userdata
;
1737 l2mgr(l2
, MDL_ERROR_IND
, arg
);
1741 l2_frame_error_reest(struct FsmInst
*fi
, int event
, void *arg
)
1743 struct layer2
*l2
= fi
->userdata
;
1745 l2mgr(l2
, MDL_ERROR_IND
, arg
);
1747 test_and_clear_bit(FLG_L3_INIT
, &l2
->flag
);
1750 static struct FsmNode L2FnList
[] =
1752 {ST_L2_1
, EV_L2_DL_ESTABLISH_REQ
, l2_mdl_assign
},
1753 {ST_L2_2
, EV_L2_DL_ESTABLISH_REQ
, l2_go_st3
},
1754 {ST_L2_4
, EV_L2_DL_ESTABLISH_REQ
, l2_establish
},
1755 {ST_L2_5
, EV_L2_DL_ESTABLISH_REQ
, l2_discard_i_setl3
},
1756 {ST_L2_7
, EV_L2_DL_ESTABLISH_REQ
, l2_l3_reestablish
},
1757 {ST_L2_8
, EV_L2_DL_ESTABLISH_REQ
, l2_l3_reestablish
},
1758 {ST_L2_4
, EV_L2_DL_RELEASE_REQ
, l2_release
},
1759 {ST_L2_5
, EV_L2_DL_RELEASE_REQ
, l2_pend_rel
},
1760 {ST_L2_7
, EV_L2_DL_RELEASE_REQ
, l2_disconnect
},
1761 {ST_L2_8
, EV_L2_DL_RELEASE_REQ
, l2_disconnect
},
1762 {ST_L2_5
, EV_L2_DL_DATA
, l2_feed_i_if_reest
},
1763 {ST_L2_7
, EV_L2_DL_DATA
, l2_feed_i_pull
},
1764 {ST_L2_8
, EV_L2_DL_DATA
, l2_feed_iqueue
},
1765 {ST_L2_1
, EV_L2_DL_UNITDATA
, l2_queue_ui_assign
},
1766 {ST_L2_2
, EV_L2_DL_UNITDATA
, l2_queue_ui
},
1767 {ST_L2_3
, EV_L2_DL_UNITDATA
, l2_queue_ui
},
1768 {ST_L2_4
, EV_L2_DL_UNITDATA
, l2_send_ui
},
1769 {ST_L2_5
, EV_L2_DL_UNITDATA
, l2_send_ui
},
1770 {ST_L2_6
, EV_L2_DL_UNITDATA
, l2_send_ui
},
1771 {ST_L2_7
, EV_L2_DL_UNITDATA
, l2_send_ui
},
1772 {ST_L2_8
, EV_L2_DL_UNITDATA
, l2_send_ui
},
1773 {ST_L2_1
, EV_L2_MDL_ASSIGN
, l2_got_tei
},
1774 {ST_L2_2
, EV_L2_MDL_ASSIGN
, l2_got_tei
},
1775 {ST_L2_3
, EV_L2_MDL_ASSIGN
, l2_got_tei
},
1776 {ST_L2_2
, EV_L2_MDL_ERROR
, l2_st24_tei_remove
},
1777 {ST_L2_3
, EV_L2_MDL_ERROR
, l2_st3_tei_remove
},
1778 {ST_L2_4
, EV_L2_MDL_REMOVE
, l2_st24_tei_remove
},
1779 {ST_L2_5
, EV_L2_MDL_REMOVE
, l2_st5_tei_remove
},
1780 {ST_L2_6
, EV_L2_MDL_REMOVE
, l2_st6_tei_remove
},
1781 {ST_L2_7
, EV_L2_MDL_REMOVE
, l2_tei_remove
},
1782 {ST_L2_8
, EV_L2_MDL_REMOVE
, l2_tei_remove
},
1783 {ST_L2_4
, EV_L2_SABME
, l2_start_multi
},
1784 {ST_L2_5
, EV_L2_SABME
, l2_send_UA
},
1785 {ST_L2_6
, EV_L2_SABME
, l2_send_DM
},
1786 {ST_L2_7
, EV_L2_SABME
, l2_restart_multi
},
1787 {ST_L2_8
, EV_L2_SABME
, l2_restart_multi
},
1788 {ST_L2_4
, EV_L2_DISC
, l2_send_DM
},
1789 {ST_L2_5
, EV_L2_DISC
, l2_send_DM
},
1790 {ST_L2_6
, EV_L2_DISC
, l2_send_UA
},
1791 {ST_L2_7
, EV_L2_DISC
, l2_stop_multi
},
1792 {ST_L2_8
, EV_L2_DISC
, l2_stop_multi
},
1793 {ST_L2_4
, EV_L2_UA
, l2_mdl_error_ua
},
1794 {ST_L2_5
, EV_L2_UA
, l2_connected
},
1795 {ST_L2_6
, EV_L2_UA
, l2_released
},
1796 {ST_L2_7
, EV_L2_UA
, l2_mdl_error_ua
},
1797 {ST_L2_8
, EV_L2_UA
, l2_mdl_error_ua
},
1798 {ST_L2_4
, EV_L2_DM
, l2_reestablish
},
1799 {ST_L2_5
, EV_L2_DM
, l2_st5_dm_release
},
1800 {ST_L2_6
, EV_L2_DM
, l2_st6_dm_release
},
1801 {ST_L2_7
, EV_L2_DM
, l2_mdl_error_dm
},
1802 {ST_L2_8
, EV_L2_DM
, l2_st8_mdl_error_dm
},
1803 {ST_L2_1
, EV_L2_UI
, l2_got_ui
},
1804 {ST_L2_2
, EV_L2_UI
, l2_got_ui
},
1805 {ST_L2_3
, EV_L2_UI
, l2_got_ui
},
1806 {ST_L2_4
, EV_L2_UI
, l2_got_ui
},
1807 {ST_L2_5
, EV_L2_UI
, l2_got_ui
},
1808 {ST_L2_6
, EV_L2_UI
, l2_got_ui
},
1809 {ST_L2_7
, EV_L2_UI
, l2_got_ui
},
1810 {ST_L2_8
, EV_L2_UI
, l2_got_ui
},
1811 {ST_L2_7
, EV_L2_FRMR
, l2_got_FRMR
},
1812 {ST_L2_8
, EV_L2_FRMR
, l2_got_FRMR
},
1813 {ST_L2_7
, EV_L2_SUPER
, l2_st7_got_super
},
1814 {ST_L2_8
, EV_L2_SUPER
, l2_st8_got_super
},
1815 {ST_L2_7
, EV_L2_I
, l2_got_iframe
},
1816 {ST_L2_8
, EV_L2_I
, l2_got_iframe
},
1817 {ST_L2_5
, EV_L2_T200
, l2_st5_tout_200
},
1818 {ST_L2_6
, EV_L2_T200
, l2_st6_tout_200
},
1819 {ST_L2_7
, EV_L2_T200
, l2_st7_tout_200
},
1820 {ST_L2_8
, EV_L2_T200
, l2_st8_tout_200
},
1821 {ST_L2_7
, EV_L2_T203
, l2_st7_tout_203
},
1822 {ST_L2_7
, EV_L2_ACK_PULL
, l2_pull_iqueue
},
1823 {ST_L2_7
, EV_L2_SET_OWN_BUSY
, l2_set_own_busy
},
1824 {ST_L2_8
, EV_L2_SET_OWN_BUSY
, l2_set_own_busy
},
1825 {ST_L2_7
, EV_L2_CLEAR_OWN_BUSY
, l2_clear_own_busy
},
1826 {ST_L2_8
, EV_L2_CLEAR_OWN_BUSY
, l2_clear_own_busy
},
1827 {ST_L2_4
, EV_L2_FRAME_ERROR
, l2_frame_error
},
1828 {ST_L2_5
, EV_L2_FRAME_ERROR
, l2_frame_error
},
1829 {ST_L2_6
, EV_L2_FRAME_ERROR
, l2_frame_error
},
1830 {ST_L2_7
, EV_L2_FRAME_ERROR
, l2_frame_error_reest
},
1831 {ST_L2_8
, EV_L2_FRAME_ERROR
, l2_frame_error_reest
},
1832 {ST_L2_1
, EV_L1_DEACTIVATE
, l2_st14_persistant_da
},
1833 {ST_L2_2
, EV_L1_DEACTIVATE
, l2_st24_tei_remove
},
1834 {ST_L2_3
, EV_L1_DEACTIVATE
, l2_st3_tei_remove
},
1835 {ST_L2_4
, EV_L1_DEACTIVATE
, l2_st14_persistant_da
},
1836 {ST_L2_5
, EV_L1_DEACTIVATE
, l2_st5_persistant_da
},
1837 {ST_L2_6
, EV_L1_DEACTIVATE
, l2_st6_persistant_da
},
1838 {ST_L2_7
, EV_L1_DEACTIVATE
, l2_persistant_da
},
1839 {ST_L2_8
, EV_L1_DEACTIVATE
, l2_persistant_da
},
1843 ph_data_indication(struct layer2
*l2
, struct mISDNhead
*hh
, struct sk_buff
*skb
)
1845 u_char
*datap
= skb
->data
;
1852 if (skb
->len
<= l
) {
1853 mISDN_FsmEvent(&l2
->l2m
, EV_L2_FRAME_ERROR
, (void *) 'N');
1856 if (test_bit(FLG_LAPD
, &l2
->flag
)) { /* Maybe not needed */
1859 if ((psapi
& 1) || !(ptei
& 1)) {
1861 "l2 D-channel frame wrong EA0/EA1\n");
1866 if (psapi
!= l2
->sapi
) {
1867 /* not our bussiness */
1868 if (*debug
& DEBUG_L2
)
1869 printk(KERN_DEBUG
"%s: sapi %d/%d mismatch\n",
1870 __func__
, psapi
, l2
->sapi
);
1874 if ((ptei
!= l2
->tei
) && (ptei
!= GROUP_TEI
)) {
1875 /* not our bussiness */
1876 if (*debug
& DEBUG_L2
)
1877 printk(KERN_DEBUG
"%s: tei %d/%d mismatch\n",
1878 __func__
, ptei
, l2
->tei
);
1884 if (!(*datap
& 1)) { /* I-Frame */
1885 c
= iframe_error(l2
, skb
);
1887 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_I
, skb
);
1888 } else if (IsSFrame(datap
, l2
)) { /* S-Frame */
1889 c
= super_error(l2
, skb
);
1891 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_SUPER
, skb
);
1892 } else if (IsUI(datap
)) {
1893 c
= UI_error(l2
, skb
);
1895 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_UI
, skb
);
1896 } else if (IsSABME(datap
, l2
)) {
1897 c
= unnum_error(l2
, skb
, CMD
);
1899 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_SABME
, skb
);
1900 } else if (IsUA(datap
)) {
1901 c
= unnum_error(l2
, skb
, RSP
);
1903 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_UA
, skb
);
1904 } else if (IsDISC(datap
)) {
1905 c
= unnum_error(l2
, skb
, CMD
);
1907 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_DISC
, skb
);
1908 } else if (IsDM(datap
)) {
1909 c
= unnum_error(l2
, skb
, RSP
);
1911 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_DM
, skb
);
1912 } else if (IsFRMR(datap
)) {
1913 c
= FRMR_error(l2
, skb
);
1915 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_FRMR
, skb
);
1919 printk(KERN_WARNING
"l2 D-channel frame error %c\n", c
);
1920 mISDN_FsmEvent(&l2
->l2m
, EV_L2_FRAME_ERROR
, (void *)(long)c
);
1926 l2_send(struct mISDNchannel
*ch
, struct sk_buff
*skb
)
1928 struct layer2
*l2
= container_of(ch
, struct layer2
, ch
);
1929 struct mISDNhead
*hh
= mISDN_HEAD_P(skb
);
1932 if (*debug
& DEBUG_L2_RECV
)
1933 printk(KERN_DEBUG
"%s: prim(%x) id(%x) sapi(%d) tei(%d)\n",
1934 __func__
, hh
->prim
, hh
->id
, l2
->sapi
, l2
->tei
);
1937 ret
= ph_data_indication(l2
, hh
, skb
);
1940 ret
= ph_data_confirm(l2
, hh
, skb
);
1942 case PH_ACTIVATE_IND
:
1943 test_and_set_bit(FLG_L1_ACTIV
, &l2
->flag
);
1944 l2up_create(l2
, MPH_ACTIVATE_IND
, 0, NULL
);
1945 if (test_and_clear_bit(FLG_ESTAB_PEND
, &l2
->flag
))
1946 ret
= mISDN_FsmEvent(&l2
->l2m
,
1947 EV_L2_DL_ESTABLISH_REQ
, skb
);
1949 case PH_DEACTIVATE_IND
:
1950 test_and_clear_bit(FLG_L1_ACTIV
, &l2
->flag
);
1951 l2up_create(l2
, MPH_DEACTIVATE_IND
, 0, NULL
);
1952 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L1_DEACTIVATE
, skb
);
1954 case MPH_INFORMATION_IND
:
1957 ret
= l2
->up
->send(l2
->up
, skb
);
1960 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_DL_DATA
, skb
);
1962 case DL_UNITDATA_REQ
:
1963 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_DL_UNITDATA
, skb
);
1965 case DL_ESTABLISH_REQ
:
1966 if (test_bit(FLG_LAPB
, &l2
->flag
))
1967 test_and_set_bit(FLG_ORIG
, &l2
->flag
);
1968 if (test_bit(FLG_L1_ACTIV
, &l2
->flag
)) {
1969 if (test_bit(FLG_LAPD
, &l2
->flag
) ||
1970 test_bit(FLG_ORIG
, &l2
->flag
))
1971 ret
= mISDN_FsmEvent(&l2
->l2m
,
1972 EV_L2_DL_ESTABLISH_REQ
, skb
);
1974 if (test_bit(FLG_LAPD
, &l2
->flag
) ||
1975 test_bit(FLG_ORIG
, &l2
->flag
)) {
1976 test_and_set_bit(FLG_ESTAB_PEND
,
1979 ret
= l2down(l2
, PH_ACTIVATE_REQ
, l2_newid(l2
),
1983 case DL_RELEASE_REQ
:
1984 if (test_bit(FLG_LAPB
, &l2
->flag
))
1985 l2down_create(l2
, PH_DEACTIVATE_REQ
,
1986 l2_newid(l2
), 0, NULL
);
1987 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_DL_RELEASE_REQ
,
1991 if (*debug
& DEBUG_L2
)
1992 l2m_debug(&l2
->l2m
, "l2 unknown pr %04x",
2003 tei_l2(struct layer2
*l2
, u_int cmd
, u_long arg
)
2007 if (*debug
& DEBUG_L2_TEI
)
2008 printk(KERN_DEBUG
"%s: cmd(%x)\n", __func__
, cmd
);
2010 case (MDL_ASSIGN_REQ
):
2011 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_MDL_ASSIGN
, (void *)arg
);
2013 case (MDL_REMOVE_REQ
):
2014 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_MDL_REMOVE
, NULL
);
2016 case (MDL_ERROR_IND
):
2017 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_MDL_ERROR
, NULL
);
2019 case (MDL_ERROR_RSP
):
2020 /* ETS 300-125 5.3.2.1 Test: TC13010 */
2021 printk(KERN_NOTICE
"MDL_ERROR|REQ (tei_l2)\n");
2022 ret
= mISDN_FsmEvent(&l2
->l2m
, EV_L2_MDL_ERROR
, NULL
);
2029 release_l2(struct layer2
*l2
)
2031 mISDN_FsmDelTimer(&l2
->t200
, 21);
2032 mISDN_FsmDelTimer(&l2
->t203
, 16);
2033 skb_queue_purge(&l2
->i_queue
);
2034 skb_queue_purge(&l2
->ui_queue
);
2035 skb_queue_purge(&l2
->down_queue
);
2037 if (test_bit(FLG_LAPD
, &l2
->flag
)) {
2040 l2
->ch
.st
->dev
->D
.ctrl(&l2
->ch
.st
->dev
->D
,
2041 CLOSE_CHANNEL
, NULL
);
2047 l2_ctrl(struct mISDNchannel
*ch
, u_int cmd
, void *arg
)
2049 struct layer2
*l2
= container_of(ch
, struct layer2
, ch
);
2052 if (*debug
& DEBUG_L2_CTRL
)
2053 printk(KERN_DEBUG
"%s:(%x)\n", __func__
, cmd
);
2057 if (test_bit(FLG_LAPD
, &l2
->flag
)) {
2058 set_channel_address(&l2
->ch
, l2
->sapi
, l2
->tei
);
2059 info
= DL_INFO_L2_CONNECT
;
2060 l2up_create(l2
, DL_INFORMATION_IND
,
2061 sizeof(info
), &info
);
2066 l2
->ch
.peer
->ctrl(l2
->ch
.peer
, CLOSE_CHANNEL
, NULL
);
2074 create_l2(struct mISDNchannel
*ch
, u_int protocol
, u_long options
, int tei
,
2078 struct channel_req rq
;
2080 l2
= kzalloc(sizeof(struct layer2
), GFP_KERNEL
);
2082 printk(KERN_ERR
"kzalloc layer2 failed\n");
2086 l2
->down_id
= MISDN_ID_NONE
;
2089 l2
->ch
.send
= l2_send
;
2090 l2
->ch
.ctrl
= l2_ctrl
;
2092 case ISDN_P_LAPD_NT
:
2093 test_and_set_bit(FLG_LAPD
, &l2
->flag
);
2094 test_and_set_bit(FLG_LAPD_NET
, &l2
->flag
);
2095 test_and_set_bit(FLG_MOD128
, &l2
->flag
);
2097 l2
->maxlen
= MAX_DFRAME_LEN
;
2098 if (test_bit(OPTION_L2_PMX
, &options
))
2102 if (test_bit(OPTION_L2_PTP
, &options
))
2103 test_and_set_bit(FLG_PTP
, &l2
->flag
);
2104 if (test_bit(OPTION_L2_FIXEDTEI
, &options
))
2105 test_and_set_bit(FLG_FIXED_TEI
, &l2
->flag
);
2110 if (test_bit(OPTION_L2_PMX
, &options
))
2111 rq
.protocol
= ISDN_P_NT_E1
;
2113 rq
.protocol
= ISDN_P_NT_S0
;
2115 l2
->ch
.st
->dev
->D
.ctrl(&l2
->ch
.st
->dev
->D
, OPEN_CHANNEL
, &rq
);
2117 case ISDN_P_LAPD_TE
:
2118 test_and_set_bit(FLG_LAPD
, &l2
->flag
);
2119 test_and_set_bit(FLG_MOD128
, &l2
->flag
);
2120 test_and_set_bit(FLG_ORIG
, &l2
->flag
);
2122 l2
->maxlen
= MAX_DFRAME_LEN
;
2123 if (test_bit(OPTION_L2_PMX
, &options
))
2127 if (test_bit(OPTION_L2_PTP
, &options
))
2128 test_and_set_bit(FLG_PTP
, &l2
->flag
);
2129 if (test_bit(OPTION_L2_FIXEDTEI
, &options
))
2130 test_and_set_bit(FLG_FIXED_TEI
, &l2
->flag
);
2135 if (test_bit(OPTION_L2_PMX
, &options
))
2136 rq
.protocol
= ISDN_P_TE_E1
;
2138 rq
.protocol
= ISDN_P_TE_S0
;
2140 l2
->ch
.st
->dev
->D
.ctrl(&l2
->ch
.st
->dev
->D
, OPEN_CHANNEL
, &rq
);
2142 case ISDN_P_B_X75SLP
:
2143 test_and_set_bit(FLG_LAPB
, &l2
->flag
);
2145 l2
->maxlen
= MAX_DATA_SIZE
;
2153 printk(KERN_ERR
"layer2 create failed prt %x\n",
2158 skb_queue_head_init(&l2
->i_queue
);
2159 skb_queue_head_init(&l2
->ui_queue
);
2160 skb_queue_head_init(&l2
->down_queue
);
2161 skb_queue_head_init(&l2
->tmp_queue
);
2163 l2
->l2m
.fsm
= &l2fsm
;
2164 if (test_bit(FLG_LAPB
, &l2
->flag
) ||
2165 test_bit(FLG_PTP
, &l2
->flag
) ||
2166 test_bit(FLG_LAPD_NET
, &l2
->flag
))
2167 l2
->l2m
.state
= ST_L2_4
;
2169 l2
->l2m
.state
= ST_L2_1
;
2170 l2
->l2m
.debug
= *debug
;
2171 l2
->l2m
.userdata
= l2
;
2172 l2
->l2m
.userint
= 0;
2173 l2
->l2m
.printdebug
= l2m_debug
;
2175 mISDN_FsmInitTimer(&l2
->l2m
, &l2
->t200
);
2176 mISDN_FsmInitTimer(&l2
->l2m
, &l2
->t203
);
2181 x75create(struct channel_req
*crq
)
2185 if (crq
->protocol
!= ISDN_P_B_X75SLP
)
2186 return -EPROTONOSUPPORT
;
2187 l2
= create_l2(crq
->ch
, crq
->protocol
, 0, 0, 0);
2191 crq
->protocol
= ISDN_P_B_HDLC
;
2195 static struct Bprotocol X75SLP
= {
2196 .Bprotocols
= (1 << (ISDN_P_B_X75SLP
& ISDN_P_B_MASK
)),
2202 Isdnl2_Init(u_int
*deb
)
2205 mISDN_register_Bprotocol(&X75SLP
);
2206 l2fsm
.state_count
= L2_STATE_COUNT
;
2207 l2fsm
.event_count
= L2_EVENT_COUNT
;
2208 l2fsm
.strEvent
= strL2Event
;
2209 l2fsm
.strState
= strL2State
;
2210 mISDN_FsmNew(&l2fsm
, L2FnList
, ARRAY_SIZE(L2FnList
));
2216 Isdnl2_cleanup(void)
2218 mISDN_unregister_Bprotocol(&X75SLP
);
2220 mISDN_FsmFree(&l2fsm
);
This page took 0.078362 seconds and 5 git commands to generate.