2 * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 /*---------------------------------------------------------------------------
28 * i4b_l2fsm.c - layer 2 FSM
29 * -------------------------
30 * last edit-date: [Sat Mar 9 16:14:07 2002]
32 *---------------------------------------------------------------------------*/
34 #include <sys/cdefs.h>
35 __FBSDID("$FreeBSD$");
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/socket.h>
42 #include <i4b/include/i4b_debug.h>
43 #include <i4b/include/i4b_ioctl.h>
45 #include <i4b/include/i4b_global.h>
46 #include <i4b/include/i4b_l2l3.h>
47 #include <i4b/include/i4b_mbuf.h>
49 #include <i4b/layer2/i4b_l2.h>
50 #include <i4b/layer2/i4b_l2fsm.h>
52 l2_softc_t l2_softc[MAXL1UNITS];
55 static char *l2state_text[N_STATES] = {
70 static char *l2event_text[N_EVENTS] = {
95 static void F_TU01(l2_softc_t *);
96 static void F_TU03(l2_softc_t *);
98 static void F_TA03(l2_softc_t *);
99 static void F_TA04(l2_softc_t *);
100 static void F_TA05(l2_softc_t *);
102 static void F_TE03(l2_softc_t *);
103 static void F_TE04(l2_softc_t *);
104 static void F_TE05(l2_softc_t *);
106 static void F_T01(l2_softc_t *);
107 static void F_T05(l2_softc_t *);
108 static void F_T06(l2_softc_t *);
109 static void F_T07(l2_softc_t *);
110 static void F_T08(l2_softc_t *);
111 static void F_T09(l2_softc_t *);
112 static void F_T10(l2_softc_t *);
113 static void F_T13(l2_softc_t *);
115 static void F_AE01(l2_softc_t *);
116 static void F_AE05(l2_softc_t *);
117 static void F_AE06(l2_softc_t *);
118 static void F_AE07(l2_softc_t *);
119 static void F_AE08(l2_softc_t *);
120 static void F_AE09(l2_softc_t *);
121 static void F_AE10(l2_softc_t *);
122 static void F_AE11(l2_softc_t *);
123 static void F_AE12(l2_softc_t *);
125 static void F_AR05(l2_softc_t *);
126 static void F_AR06(l2_softc_t *);
127 static void F_AR07(l2_softc_t *);
128 static void F_AR08(l2_softc_t *);
129 static void F_AR09(l2_softc_t *);
130 static void F_AR10(l2_softc_t *);
131 static void F_AR11(l2_softc_t *);
133 static void F_MF01(l2_softc_t *);
134 static void F_MF05(l2_softc_t *);
135 static void F_MF06(l2_softc_t *);
136 static void F_MF07(l2_softc_t *);
137 static void F_MF08(l2_softc_t *);
138 static void F_MF09(l2_softc_t *);
139 static void F_MF10(l2_softc_t *);
140 static void F_MF11(l2_softc_t *);
141 static void F_MF12(l2_softc_t *);
142 static void F_MF13(l2_softc_t *);
143 static void F_MF14(l2_softc_t *);
144 static void F_MF15(l2_softc_t *);
145 static void F_MF16(l2_softc_t *);
146 static void F_MF17(l2_softc_t *);
147 static void F_MF18(l2_softc_t *);
148 static void F_MF19(l2_softc_t *);
149 static void F_MF20(l2_softc_t *);
151 static void F_TR01(l2_softc_t *);
152 static void F_TR05(l2_softc_t *);
153 static void F_TR06(l2_softc_t *);
154 static void F_TR07(l2_softc_t *);
155 static void F_TR08(l2_softc_t *);
156 static void F_TR09(l2_softc_t *);
157 static void F_TR10(l2_softc_t *);
158 static void F_TR11(l2_softc_t *);
159 static void F_TR12(l2_softc_t *);
160 static void F_TR13(l2_softc_t *);
161 static void F_TR15(l2_softc_t *);
162 static void F_TR16(l2_softc_t *);
163 static void F_TR17(l2_softc_t *);
164 static void F_TR18(l2_softc_t *);
165 static void F_TR19(l2_softc_t *);
166 static void F_TR20(l2_softc_t *);
167 static void F_ILL(l2_softc_t *);
168 static void F_NCNA(l2_softc_t *);
170 /*---------------------------------------------------------------------------*
171 * FSM illegal state default action
172 *---------------------------------------------------------------------------*/
174 F_ILL(l2_softc_t *l2sc)
176 NDBGL2(L2_F_ERR, "FSM function F_ILL executing");
179 /*---------------------------------------------------------------------------*
180 * FSM No change, No action
181 *---------------------------------------------------------------------------*/
183 F_NCNA(l2_softc_t *l2sc)
185 NDBGL2(L2_F_MSG, "FSM function F_NCNA executing");
188 /*---------------------------------------------------------------------------*
189 * layer 2 state transition table
190 *---------------------------------------------------------------------------*/
192 void (*func)(l2_softc_t *); /* function to execute */
193 int newstate; /* next state */
194 } l2state_tab[N_EVENTS][N_STATES] = {
196 /* STATE: ST_TEI_UNAS, ST_ASG_AW_TEI, ST_EST_AW_TEI, ST_TEI_ASGD, ST_AW_EST, ST_AW_REL, ST_MULTIFR, ST_TIMREC, ST_SUBSET, ILLEGAL STATE */
197 /* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
198 /*EV_DLESTRQ*/{ {F_TU01, ST_EST_AW_TEI}, {F_NCNA, ST_EST_AW_TEI}, {F_ILL, ST_ILL}, {F_T01, ST_AW_EST}, {F_AE01, ST_AW_EST}, {F_ILL, ST_ILL}, {F_MF01, ST_AW_EST}, {F_TR01, ST_AW_EST}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
199 /*EV_DLUDTRQ*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
200 /*EV_MDASGRQ*/{ {F_TU03, ST_TEI_ASGD}, {F_TA03, ST_TEI_ASGD}, {F_TE03, ST_AW_EST}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
201 /*EV_MDERRRS*/{ {F_ILL, ST_ILL}, {F_TA04, ST_TEI_UNAS}, {F_TE04, ST_TEI_UNAS}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
202 /*EV_PSDEACT*/{ {F_ILL, ST_ILL}, {F_TA05, ST_TEI_UNAS}, {F_TE05, ST_TEI_UNAS}, {F_T05, ST_TEI_ASGD}, {F_AE05, ST_TEI_ASGD}, {F_AR05, ST_TEI_ASGD}, {F_MF05, ST_TEI_ASGD}, {F_TR05, ST_TEI_ASGD}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
203 /*EV_MDREMRQ*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T06, ST_TEI_UNAS}, {F_AE06, ST_TEI_UNAS}, {F_AR06, ST_TEI_UNAS}, {F_MF06, ST_TEI_UNAS}, {F_TR06, ST_TEI_UNAS}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
204 /*EV_RXSABME*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T07, ST_SUBSET}, {F_AE07, ST_AW_EST}, {F_AR07, ST_AW_REL}, {F_MF07, ST_MULTIFR}, {F_TR07, ST_MULTIFR}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
205 /*EV_RXDISC */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T08, ST_TEI_ASGD}, {F_AE08, ST_AW_EST}, {F_AR08, ST_AW_REL}, {F_MF08, ST_TEI_ASGD}, {F_TR08, ST_TEI_ASGD}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
206 /*EV_RXUA */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T09, ST_TEI_ASGD}, {F_AE09, ST_SUBSET}, {F_AR09, ST_SUBSET}, {F_MF09, ST_MULTIFR}, {F_TR09, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
207 /*EV_RXDM */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T10, ST_SUBSET}, {F_AE10, ST_SUBSET}, {F_AR10, ST_SUBSET}, {F_MF10, ST_SUBSET}, {F_TR10, ST_AW_EST}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
208 /*EV_T200EXP*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_AE11, ST_SUBSET}, {F_AR11, ST_SUBSET}, {F_MF11, ST_TIMREC}, {F_TR11, ST_SUBSET}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
209 /*EV_DLDATRQ*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_AE12, ST_AW_EST}, {F_ILL, ST_ILL}, {F_MF12, ST_MULTIFR}, {F_TR12, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
210 /*EV_DLRELRQ*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_T13, ST_TEI_ASGD}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF13, ST_AW_REL}, {F_TR13, ST_AW_REL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
211 /*EV_T203EXP*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF14, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
212 /*EV_OWNBUSY*/{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF15, ST_MULTIFR}, {F_TR15, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
213 /*EV_OWNRDY */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF16, ST_MULTIFR}, {F_TR16, ST_TIMREC}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
214 /*EV_RXRR */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF17, ST_SUBSET}, {F_TR17, ST_SUBSET}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
215 /*EV_RXREJ */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF18, ST_SUBSET}, {F_TR18, ST_SUBSET}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
216 /*EV_RXRNR */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF19, ST_SUBSET}, {F_TR19, ST_SUBSET}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
217 /*EV_RXFRMR */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_MF20, ST_AW_EST}, {F_TR20, ST_AW_EST}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} },
218 /*EV_ILL */{ {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL}, {F_ILL, ST_ILL} }
221 /*---------------------------------------------------------------------------*
222 * event handler, executes function and sets new state
223 *---------------------------------------------------------------------------*/
224 void i4b_next_l2state(l2_softc_t *l2sc, int event)
226 int currstate, newstate;
227 int (*savpostfsmfunc)(int) = NULL;
229 /* check event number */
230 if(event >= N_EVENTS)
231 panic("i4b_l2fsm.c: event >= N_EVENTS\n");
233 /* get current state and check it */
234 if((currstate = l2sc->Q921_state) >= N_STATES) /* failsafe */
235 panic("i4b_l2fsm.c: currstate >= N_STATES\n");
237 /* get new state and check it */
238 if((newstate = l2state_tab[event][currstate].newstate) >= N_STATES)
239 panic("i4b_l2fsm.c: newstate >= N_STATES\n");
242 if(newstate != ST_SUBSET)
243 { /* state function does NOT set new state */
244 NDBGL2(L2_F_MSG, "FSM event [%s]: [%s/%d => %s/%d]",
246 l2state_text[currstate], currstate,
247 l2state_text[newstate], newstate);
250 /* execute state transition function */
251 (*l2state_tab[event][currstate].func)(l2sc);
253 if(newstate == ST_SUBSET)
254 { /* state function DOES set new state */
255 NDBGL2(L2_F_MSG, "FSM S-event [%s]: [%s => %s]", l2event_text[event],
256 l2state_text[currstate],
257 l2state_text[l2sc->Q921_state]);
260 /* check for illegal new state */
262 if(newstate == ST_ILL)
264 newstate = currstate;
265 NDBGL2(L2_F_ERR, "FSM illegal state, state = %s, event = %s!",
266 l2state_text[currstate],
267 l2event_text[event]);
270 /* check if state machine function has to set new state */
272 if(newstate != ST_SUBSET)
273 l2sc->Q921_state = newstate; /* no, we set new state */
275 if(l2sc->postfsmfunc != NULL)
277 NDBGL2(L2_F_MSG, "FSM executing postfsmfunc!");
278 /* try to avoid an endless loop */
279 savpostfsmfunc = l2sc->postfsmfunc;
280 l2sc->postfsmfunc = NULL;
281 (*savpostfsmfunc)(l2sc->postfsmarg);
286 /*---------------------------------------------------------------------------*
287 * return pointer to current state description
288 *---------------------------------------------------------------------------*/
289 char *i4b_print_l2state(l2_softc_t *l2sc)
291 return((char *) l2state_text[l2sc->Q921_state]);
295 /*---------------------------------------------------------------------------*
296 * FSM state ST_TEI_UNAS event dl establish request
297 *---------------------------------------------------------------------------*/
299 F_TU01(l2_softc_t *l2sc)
301 NDBGL2(L2_F_MSG, "FSM function F_TU01 executing");
302 i4b_mdl_assign_ind(l2sc);
305 /*---------------------------------------------------------------------------*
306 * FSM state ST_TEI_UNAS event mdl assign request
307 *---------------------------------------------------------------------------*/
309 F_TU03(l2_softc_t *l2sc)
311 NDBGL2(L2_F_MSG, "FSM function F_TU03 executing");
314 /*---------------------------------------------------------------------------*
315 * FSM state ST_ASG_AW_TEI event mdl assign request
316 *---------------------------------------------------------------------------*/
318 F_TA03(l2_softc_t *l2sc)
320 NDBGL2(L2_F_MSG, "FSM function F_TA03 executing");
323 /*---------------------------------------------------------------------------*
324 * FSM state ST_ASG_AW_TEI event mdl error response
325 *---------------------------------------------------------------------------*/
327 F_TA04(l2_softc_t *l2sc)
329 NDBGL2(L2_F_MSG, "FSM function F_TA04 executing");
332 /*---------------------------------------------------------------------------*
333 * FSM state ST_ASG_AW_TEI event persistent deactivation
334 *---------------------------------------------------------------------------*/
336 F_TA05(l2_softc_t *l2sc)
338 NDBGL2(L2_F_MSG, "FSM function F_TA05 executing");
341 /*---------------------------------------------------------------------------*
342 * FSM state ST_EST_AW_TEI event mdl assign request
343 *---------------------------------------------------------------------------*/
345 F_TE03(l2_softc_t *l2sc)
347 NDBGL2(L2_F_MSG, "FSM function F_TE03 executing");
348 i4b_establish_data_link(l2sc);
349 l2sc->l3initiated = 1;
352 /*---------------------------------------------------------------------------*
353 * FSM state ST_EST_AW_TEI event mdl error response
354 *---------------------------------------------------------------------------*/
356 F_TE04(l2_softc_t *l2sc)
358 NDBGL2(L2_F_MSG, "FSM function F_TE04 executing");
359 l2sc->postfsmarg = l2sc->unit;
360 l2sc->postfsmfunc = DL_Rel_Ind_A;
363 /*---------------------------------------------------------------------------*
364 * FSM state ST_EST_AW_TEI event persistent deactivation
365 *---------------------------------------------------------------------------*/
367 F_TE05(l2_softc_t *l2sc)
369 NDBGL2(L2_F_MSG, "FSM function F_TE05 executing");
370 l2sc->postfsmarg = l2sc->unit;
371 l2sc->postfsmfunc = DL_Rel_Ind_A;
374 /*---------------------------------------------------------------------------*
375 * FSM state ST_TEI_ASGD event dl establish request
376 *---------------------------------------------------------------------------*/
378 F_T01(l2_softc_t *l2sc)
380 NDBGL2(L2_F_MSG, "FSM function F_T01 executing");
381 i4b_establish_data_link(l2sc);
382 l2sc->l3initiated = 1;
385 /*---------------------------------------------------------------------------*
386 * FSM state ST_TEI_ASGD event persistent deactivation
387 *---------------------------------------------------------------------------*/
389 F_T05(l2_softc_t *l2sc)
391 NDBGL2(L2_F_MSG, "FSM function F_T05 executing");
394 /*---------------------------------------------------------------------------*
395 * FSM state ST_TEI_ASGD event mdl remove request
396 *---------------------------------------------------------------------------*/
398 F_T06(l2_softc_t *l2sc)
400 NDBGL2(L2_F_MSG, "FSM function F_T06 executing");
401 /*XXX*/ i4b_mdl_assign_ind(l2sc);
404 /*---------------------------------------------------------------------------*
405 * FSM state ST_TEI_ASGD event rx'd SABME
406 *---------------------------------------------------------------------------*/
408 F_T07(l2_softc_t *l2sc)
410 NDBGL2(L2_F_MSG, "FSM function F_T07 executing");
414 if(NOT able to establish)
416 i4b_tx_dm(l2sc, l2sc->rxd_PF);
417 l2sc->Q921_state = ST_TEI_ASGD;
422 i4b_clear_exception_conditions(l2sc);
424 MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_ACTIVE);
426 i4b_tx_ua(l2sc, l2sc->rxd_PF);
432 l2sc->postfsmarg = l2sc->unit;
433 l2sc->postfsmfunc = DL_Est_Ind_A;
435 i4b_T203_start(l2sc);
437 l2sc->Q921_state = ST_MULTIFR;
440 /*---------------------------------------------------------------------------*
441 * FSM state ST_TEI_ASGD event rx'd DISC
442 *---------------------------------------------------------------------------*/
444 F_T08(l2_softc_t *l2sc)
446 NDBGL2(L2_F_MSG, "FSM function F_T08 executing");
447 MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_IDLE);
448 i4b_tx_ua(l2sc, l2sc->rxd_PF);
451 /*---------------------------------------------------------------------------*
452 * FSM state ST_TEI_ASGD event rx'd UA
453 *---------------------------------------------------------------------------*/
455 F_T09(l2_softc_t *l2sc)
457 NDBGL2(L2_F_MSG, "FSM function F_T09 executing");
458 i4b_mdl_error_ind(l2sc, "F_T09", MDL_ERR_C);
459 i4b_mdl_error_ind(l2sc, "F_T09", MDL_ERR_D);
462 /*---------------------------------------------------------------------------*
463 * FSM state ST_TEI_ASGD event rx'd DM
464 *---------------------------------------------------------------------------*/
466 F_T10(l2_softc_t *l2sc)
468 NDBGL2(L2_F_MSG, "FSM function F_T10 executing");
472 l2sc->Q921_state = ST_TEI_ASGD;
477 if(NOT able_to_etablish)
479 l2sc->Q921_state = ST_TEI_ASGD;
483 i4b_establish_data_link(l2sc);
485 l2sc->l3initiated = 1;
487 l2sc->Q921_state = ST_AW_EST;
491 /*---------------------------------------------------------------------------*
492 * FSM state ST_TEI_ASGD event dl release request
493 *---------------------------------------------------------------------------*/
495 F_T13(l2_softc_t *l2sc)
497 NDBGL2(L2_F_MSG, "FSM function F_T13 executing");
498 l2sc->postfsmarg = l2sc->unit;
499 l2sc->postfsmfunc = DL_Rel_Cnf_A;
502 /*---------------------------------------------------------------------------*
503 * FSM state ST_AW_EST event dl establish request
504 *---------------------------------------------------------------------------*/
506 F_AE01(l2_softc_t *l2sc)
508 NDBGL2(L2_F_MSG, "FSM function F_AE01 executing");
510 i4b_Dcleanifq(&l2sc->i_queue);
512 l2sc->l3initiated = 1;
515 /*---------------------------------------------------------------------------*
516 * FSM state ST_AW_EST event persistent deactivation
517 *---------------------------------------------------------------------------*/
519 F_AE05(l2_softc_t *l2sc)
521 NDBGL2(L2_F_MSG, "FSM function F_AE05 executing");
523 i4b_Dcleanifq(&l2sc->i_queue);
525 l2sc->postfsmarg = l2sc->unit;
526 l2sc->postfsmfunc = DL_Rel_Ind_A;
531 /*---------------------------------------------------------------------------*
532 * FSM state ST_AW_EST event mdl remove request
533 *---------------------------------------------------------------------------*/
535 F_AE06(l2_softc_t *l2sc)
537 NDBGL2(L2_F_MSG, "FSM function F_AE06 executing");
539 i4b_Dcleanifq(&l2sc->i_queue);
541 l2sc->postfsmarg = l2sc->unit;
542 l2sc->postfsmfunc = DL_Rel_Ind_A;
546 /*XXX*/ i4b_mdl_assign_ind(l2sc);
549 /*---------------------------------------------------------------------------*
550 * FSM state ST_AW_EST event rx'd SABME
551 *---------------------------------------------------------------------------*/
553 F_AE07(l2_softc_t *l2sc)
555 NDBGL2(L2_F_MSG, "FSM function F_AE07 executing");
556 MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_ACTIVE);
557 i4b_tx_ua(l2sc, l2sc->rxd_PF);
560 /*---------------------------------------------------------------------------*
561 * FSM state ST_AW_EST event rx'd DISC
562 *---------------------------------------------------------------------------*/
564 F_AE08(l2_softc_t *l2sc)
566 NDBGL2(L2_F_MSG, "FSM function F_AE08 executing");
567 i4b_tx_dm(l2sc, l2sc->rxd_PF);
570 /*---------------------------------------------------------------------------*
571 * FSM state ST_AW_EST event rx'd UA
572 *---------------------------------------------------------------------------*/
574 F_AE09(l2_softc_t *l2sc)
576 NDBGL2(L2_F_MSG, "FSM function F_AE09 executing");
578 if(l2sc->rxd_PF == 0)
580 i4b_mdl_error_ind(l2sc, "F_AE09", MDL_ERR_D);
581 l2sc->Q921_state = ST_AW_EST;
585 if(l2sc->l3initiated)
587 l2sc->l3initiated = 0;
589 l2sc->postfsmarg = l2sc->unit;
590 l2sc->postfsmfunc = DL_Est_Cnf_A;
594 if(l2sc->vs != l2sc->va)
596 i4b_Dcleanifq(&l2sc->i_queue);
597 l2sc->postfsmarg = l2sc->unit;
598 l2sc->postfsmfunc = DL_Est_Ind_A;
602 MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_ACTIVE);
605 i4b_T203_start(l2sc);
610 l2sc->Q921_state = ST_MULTIFR;
614 /*---------------------------------------------------------------------------*
615 * FSM state ST_AW_EST event rx'd DM
616 *---------------------------------------------------------------------------*/
618 F_AE10(l2_softc_t *l2sc)
620 NDBGL2(L2_F_MSG, "FSM function F_AE10 executing");
622 if(l2sc->rxd_PF == 0)
624 l2sc->Q921_state = ST_AW_EST;
628 i4b_Dcleanifq(&l2sc->i_queue);
630 l2sc->postfsmarg = l2sc->unit;
631 l2sc->postfsmfunc = DL_Rel_Ind_A;
635 l2sc->Q921_state = ST_TEI_ASGD;
639 /*---------------------------------------------------------------------------*
640 * FSM state ST_AW_EST event T200 expiry
641 *---------------------------------------------------------------------------*/
643 F_AE11(l2_softc_t *l2sc)
645 NDBGL2(L2_F_MSG, "FSM function F_AE11 executing");
649 i4b_Dcleanifq(&l2sc->i_queue);
651 i4b_mdl_error_ind(l2sc, "F_AE11", MDL_ERR_G);
653 l2sc->postfsmarg = l2sc->unit;
654 l2sc->postfsmfunc = DL_Rel_Ind_A;
656 l2sc->Q921_state = ST_TEI_ASGD;
662 i4b_tx_sabme(l2sc, P1);
664 i4b_T200_start(l2sc);
666 l2sc->Q921_state = ST_AW_EST;
670 /*---------------------------------------------------------------------------*
671 * FSM state ST_AW_EST event dl data request
672 *---------------------------------------------------------------------------*/
674 F_AE12(l2_softc_t *l2sc)
676 NDBGL2(L2_F_MSG, "FSM function F_AE12 executing");
678 if(l2sc->l3initiated == 0)
680 i4b_i_frame_queued_up(l2sc);
684 /*---------------------------------------------------------------------------*
685 * FSM state ST_AW_REL event persistent deactivation
686 *---------------------------------------------------------------------------*/
688 F_AR05(l2_softc_t *l2sc)
690 NDBGL2(L2_F_MSG, "FSM function F_AR05 executing");
692 l2sc->postfsmarg = l2sc->unit;
693 l2sc->postfsmfunc = DL_Rel_Cnf_A;
698 /*---------------------------------------------------------------------------*
699 * FSM state ST_AW_REL event mdl remove request
700 *---------------------------------------------------------------------------*/
702 F_AR06(l2_softc_t *l2sc)
704 NDBGL2(L2_F_MSG, "FSM function F_AR06 executing");
706 l2sc->postfsmarg = l2sc->unit;
707 l2sc->postfsmfunc = DL_Rel_Cnf_A;
711 /*XXX*/ i4b_mdl_assign_ind(l2sc);
714 /*---------------------------------------------------------------------------*
715 * FSM state ST_AW_REL event rx'd SABME
716 *---------------------------------------------------------------------------*/
718 F_AR07(l2_softc_t *l2sc)
720 NDBGL2(L2_F_MSG, "FSM function F_AR07 executing");
721 i4b_tx_dm(l2sc, l2sc->rxd_PF);
724 /*---------------------------------------------------------------------------*
725 * FSM state ST_AW_REL event rx'd DISC
726 *---------------------------------------------------------------------------*/
728 F_AR08(l2_softc_t *l2sc)
730 NDBGL2(L2_F_MSG, "FSM function F_AR08 executing");
731 MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_IDLE);
732 i4b_tx_ua(l2sc, l2sc->rxd_PF);
735 /*---------------------------------------------------------------------------*
736 * FSM state ST_AW_REL event rx'd UA
737 *---------------------------------------------------------------------------*/
739 F_AR09(l2_softc_t *l2sc)
741 NDBGL2(L2_F_MSG, "FSM function F_AR09 executing");
745 l2sc->postfsmarg = l2sc->unit;
746 l2sc->postfsmfunc = DL_Rel_Cnf_A;
750 l2sc->Q921_state = ST_TEI_ASGD;
754 i4b_mdl_error_ind(l2sc, "F_AR09", MDL_ERR_D);
756 l2sc->Q921_state = ST_AW_REL;
760 /*---------------------------------------------------------------------------*
761 * FSM state ST_AW_REL event rx'd DM
762 *---------------------------------------------------------------------------*/
764 F_AR10(l2_softc_t *l2sc)
766 NDBGL2(L2_F_MSG, "FSM function F_AR10 executing");
770 l2sc->postfsmarg = l2sc->unit;
771 l2sc->postfsmfunc = DL_Rel_Cnf_A;
775 l2sc->Q921_state = ST_TEI_ASGD;
779 l2sc->Q921_state = ST_AW_REL;
783 /*---------------------------------------------------------------------------*
784 * FSM state ST_AW_REL event T200 expiry
785 *---------------------------------------------------------------------------*/
787 F_AR11(l2_softc_t *l2sc)
789 NDBGL2(L2_F_MSG, "FSM function F_AR11 executing");
793 i4b_mdl_error_ind(l2sc, "F_AR11", MDL_ERR_H);
795 l2sc->postfsmarg = l2sc->unit;
796 l2sc->postfsmfunc = DL_Rel_Cnf_A;
798 l2sc->Q921_state = ST_TEI_ASGD;
804 i4b_tx_disc(l2sc, P1);
806 i4b_T200_start(l2sc);
808 l2sc->Q921_state = ST_AW_REL;
812 /*---------------------------------------------------------------------------*
813 * FSM state ST_MULTIFR event dl establish request
814 *---------------------------------------------------------------------------*/
816 F_MF01(l2_softc_t *l2sc)
818 NDBGL2(L2_F_MSG, "FSM function F_MF01 executing");
820 i4b_Dcleanifq(&l2sc->i_queue);
822 i4b_establish_data_link(l2sc);
824 l2sc->l3initiated = 1;
827 /*---------------------------------------------------------------------------*
828 * FSM state ST_MULTIFR event persistent deactivation
829 *---------------------------------------------------------------------------*/
831 F_MF05(l2_softc_t *l2sc)
833 NDBGL2(L2_F_MSG, "FSM function F_MF05 executing");
835 i4b_Dcleanifq(&l2sc->i_queue);
837 l2sc->postfsmarg = l2sc->unit;
838 l2sc->postfsmfunc = DL_Rel_Ind_A;
844 /*---------------------------------------------------------------------------*
845 * FSM state ST_MULTIFR event mdl remove request
846 *---------------------------------------------------------------------------*/
848 F_MF06(l2_softc_t *l2sc)
850 NDBGL2(L2_F_MSG, "FSM function F_MF06 executing");
852 i4b_Dcleanifq(&l2sc->i_queue);
854 l2sc->postfsmarg = l2sc->unit;
855 l2sc->postfsmfunc = DL_Rel_Ind_A;
860 /*XXX*/ i4b_mdl_assign_ind(l2sc);
863 /*---------------------------------------------------------------------------*
864 * FSM state ST_MULTIFR event rx'd SABME
865 *---------------------------------------------------------------------------*/
867 F_MF07(l2_softc_t *l2sc)
869 NDBGL2(L2_F_MSG, "FSM function F_MF07 executing");
871 i4b_clear_exception_conditions(l2sc);
873 MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_ACTIVE);
875 i4b_tx_ua(l2sc, l2sc->rxd_PF);
877 i4b_mdl_error_ind(l2sc, "F_MF07", MDL_ERR_F);
879 if(l2sc->vs != l2sc->va)
881 i4b_Dcleanifq(&l2sc->i_queue);
883 l2sc->postfsmarg = l2sc->unit;
884 l2sc->postfsmfunc = DL_Est_Ind_A;
888 i4b_T203_start(l2sc);
895 /*---------------------------------------------------------------------------*
896 * FSM state ST_MULTIFR event rx'd DISC
897 *---------------------------------------------------------------------------*/
899 F_MF08(l2_softc_t *l2sc)
901 NDBGL2(L2_F_MSG, "FSM function F_MF08 executing");
903 i4b_Dcleanifq(&l2sc->i_queue);
904 MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_IDLE);
905 i4b_tx_ua(l2sc, l2sc->rxd_PF);
907 l2sc->postfsmarg = l2sc->unit;
908 l2sc->postfsmfunc = DL_Rel_Ind_A;
914 /*---------------------------------------------------------------------------*
915 * FSM state ST_MULTIFR event rx'd UA
916 *---------------------------------------------------------------------------*/
918 F_MF09(l2_softc_t *l2sc)
920 NDBGL2(L2_F_MSG, "FSM function F_MF09 executing");
922 i4b_mdl_error_ind(l2sc, "F_MF09", MDL_ERR_C);
924 i4b_mdl_error_ind(l2sc, "F_MF09", MDL_ERR_D);
927 /*---------------------------------------------------------------------------*
928 * FSM state ST_MULTIFR event rx'd DM
929 *---------------------------------------------------------------------------*/
931 F_MF10(l2_softc_t *l2sc)
933 NDBGL2(L2_F_MSG, "FSM function F_MF10 executing");
937 i4b_mdl_error_ind(l2sc, "F_MF10", MDL_ERR_B);
939 l2sc->Q921_state = ST_MULTIFR;
943 i4b_mdl_error_ind(l2sc, "F_MF10", MDL_ERR_E);
945 i4b_establish_data_link(l2sc);
947 l2sc->l3initiated = 0;
949 l2sc->Q921_state = ST_AW_EST;
953 /*---------------------------------------------------------------------------*
954 * FSM state ST_MULTIFR event T200 expiry
955 *---------------------------------------------------------------------------*/
957 F_MF11(l2_softc_t *l2sc)
959 NDBGL2(L2_F_MSG, "FSM function F_MF11 executing");
963 i4b_transmit_enquire(l2sc);
968 /*---------------------------------------------------------------------------*
969 * FSM state ST_MULTIFR event dl data request
970 *---------------------------------------------------------------------------*/
972 F_MF12(l2_softc_t *l2sc)
974 NDBGL2(L2_F_MSG, "FSM function F_MF12 executing");
976 i4b_i_frame_queued_up(l2sc);
979 /*---------------------------------------------------------------------------*
980 * FSM state ST_MULTIFR event dl release request
981 *---------------------------------------------------------------------------*/
983 F_MF13(l2_softc_t *l2sc)
985 NDBGL2(L2_F_MSG, "FSM function F_MF13 executing");
987 i4b_Dcleanifq(&l2sc->i_queue);
991 i4b_tx_disc(l2sc, P1);
994 i4b_T200_restart(l2sc);
997 /*---------------------------------------------------------------------------*
998 * FSM state ST_MULTIFR event T203 expiry
999 *---------------------------------------------------------------------------*/
1001 F_MF14(l2_softc_t *l2sc)
1003 NDBGL2(L2_F_MSG, "FSM function F_MF14 executing");
1005 i4b_transmit_enquire(l2sc);
1010 /*---------------------------------------------------------------------------*
1011 * FSM state ST_MULTIFR event set own rx busy
1012 *---------------------------------------------------------------------------*/
1014 F_MF15(l2_softc_t *l2sc)
1016 NDBGL2(L2_F_MSG, "FSM function F_MF15 executing");
1018 if(l2sc->own_busy == 0)
1022 i4b_tx_rnr_response(l2sc, F0); /* wrong in Q.921 03/93 p 64 */
1028 /*---------------------------------------------------------------------------*
1029 * FSM state ST_MULTIFR event clear own rx busy
1030 *---------------------------------------------------------------------------*/
1032 F_MF16(l2_softc_t *l2sc)
1034 NDBGL2(L2_F_MSG, "FSM function F_MF16 executing");
1036 if(l2sc->own_busy != 0)
1040 i4b_tx_rr_response(l2sc, F0); /* wrong in Q.921 03/93 p 64 */
1046 /*---------------------------------------------------------------------------*
1047 * FSM state ST_MULTIFR event rx'd RR
1048 *---------------------------------------------------------------------------*/
1050 F_MF17(l2_softc_t *l2sc)
1052 NDBGL2(L2_F_MSG, "FSM function F_MF17 executing");
1054 l2sc->peer_busy = 0;
1056 if(l2sc->rxd_CR == CR_CMD_FROM_NT)
1058 if(l2sc->rxd_PF == 1)
1060 i4b_enquiry_response(l2sc);
1065 if(l2sc->rxd_PF == 1)
1067 i4b_mdl_error_ind(l2sc, "F_MF17", MDL_ERR_A);
1071 if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs))
1073 if(l2sc->rxd_NR == l2sc->vs)
1075 l2sc->va = l2sc->rxd_NR;
1076 i4b_T200_stop(l2sc);
1077 i4b_T203_restart(l2sc);
1079 else if(l2sc->rxd_NR != l2sc->va)
1081 l2sc->va = l2sc->rxd_NR;
1082 i4b_T200_restart(l2sc);
1084 l2sc->Q921_state = ST_MULTIFR;
1088 i4b_nr_error_recovery(l2sc);
1089 l2sc->Q921_state = ST_AW_EST;
1093 /*---------------------------------------------------------------------------*
1094 * FSM state ST_MULTIFR event rx'd REJ
1095 *---------------------------------------------------------------------------*/
1097 F_MF18(l2_softc_t *l2sc)
1099 NDBGL2(L2_F_MSG, "FSM function F_MF18 executing");
1101 l2sc->peer_busy = 0;
1103 if(l2sc->rxd_CR == CR_CMD_FROM_NT)
1105 if(l2sc->rxd_PF == 1)
1107 i4b_enquiry_response(l2sc);
1112 if(l2sc->rxd_PF == 1)
1114 i4b_mdl_error_ind(l2sc, "F_MF18", MDL_ERR_A);
1118 if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs))
1120 l2sc->va = l2sc->rxd_NR;
1121 i4b_T200_stop(l2sc);
1122 i4b_T203_start(l2sc);
1123 i4b_invoke_retransmission(l2sc, l2sc->rxd_NR);
1124 l2sc->Q921_state = ST_MULTIFR;
1128 i4b_nr_error_recovery(l2sc);
1129 l2sc->Q921_state = ST_AW_EST;
1133 /*---------------------------------------------------------------------------*
1134 * FSM state ST_MULTIFR event rx'd RNR
1135 *---------------------------------------------------------------------------*/
1137 F_MF19(l2_softc_t *l2sc)
1139 NDBGL2(L2_F_MSG, "FSM function F_MF19 executing");
1141 l2sc->peer_busy = 1;
1143 if(l2sc->rxd_CR == CR_CMD_FROM_NT)
1145 if(l2sc->rxd_PF == 1)
1147 i4b_enquiry_response(l2sc);
1152 if(l2sc->rxd_PF == 1)
1154 i4b_mdl_error_ind(l2sc, "F_MF19", MDL_ERR_A);
1158 if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs))
1160 l2sc->va = l2sc->rxd_NR;
1161 i4b_T203_stop(l2sc);
1162 i4b_T200_restart(l2sc);
1163 l2sc->Q921_state = ST_MULTIFR;
1167 i4b_nr_error_recovery(l2sc);
1168 l2sc->Q921_state = ST_AW_EST;
1172 /*---------------------------------------------------------------------------*
1173 * FSM state ST_MULTIFR event rx'd FRMR
1174 *---------------------------------------------------------------------------*/
1176 F_MF20(l2_softc_t *l2sc)
1178 NDBGL2(L2_F_MSG, "FSM function F_MF20 executing");
1180 i4b_mdl_error_ind(l2sc, "F_MF20", MDL_ERR_K);
1182 i4b_establish_data_link(l2sc);
1184 l2sc->l3initiated = 0;
1187 /*---------------------------------------------------------------------------*
1188 * FSM state ST_TIMREC event dl establish request
1189 *---------------------------------------------------------------------------*/
1191 F_TR01(l2_softc_t *l2sc)
1193 NDBGL2(L2_F_MSG, "FSM function F_TR01 executing");
1195 i4b_Dcleanifq(&l2sc->i_queue);
1197 i4b_establish_data_link(l2sc);
1199 l2sc->l3initiated = 1;
1202 /*---------------------------------------------------------------------------*
1203 * FSM state ST_TIMREC event persistent deactivation
1204 *---------------------------------------------------------------------------*/
1206 F_TR05(l2_softc_t *l2sc)
1208 NDBGL2(L2_F_MSG, "FSM function F_TR05 executing");
1210 i4b_Dcleanifq(&l2sc->i_queue);
1212 l2sc->postfsmarg = l2sc->unit;
1213 l2sc->postfsmfunc = DL_Rel_Ind_A;
1215 i4b_T200_stop(l2sc);
1218 /*---------------------------------------------------------------------------*
1219 * FSM state ST_TIMREC event mdl remove request
1220 *---------------------------------------------------------------------------*/
1222 F_TR06(l2_softc_t *l2sc)
1224 NDBGL2(L2_F_MSG, "FSM function F_TR06 executing");
1226 i4b_Dcleanifq(&l2sc->i_queue);
1228 l2sc->postfsmarg = l2sc->unit;
1229 l2sc->postfsmfunc = DL_Rel_Ind_A;
1231 i4b_T200_stop(l2sc);
1233 /*XXX*/ i4b_mdl_assign_ind(l2sc);
1236 /*---------------------------------------------------------------------------*
1237 * FSM state ST_TIMREC event rx'd SABME
1238 *---------------------------------------------------------------------------*/
1240 F_TR07(l2_softc_t *l2sc)
1242 NDBGL2(L2_F_MSG, "FSM function F_TR07 executing");
1244 i4b_clear_exception_conditions(l2sc);
1246 MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_ACTIVE);
1248 i4b_tx_ua(l2sc, l2sc->rxd_PF);
1250 i4b_mdl_error_ind(l2sc, "F_TR07", MDL_ERR_F);
1252 if(l2sc->vs != l2sc->va)
1254 i4b_Dcleanifq(&l2sc->i_queue);
1256 l2sc->postfsmarg = l2sc->unit;
1257 l2sc->postfsmfunc = DL_Est_Ind_A;
1260 i4b_T200_stop(l2sc);
1261 i4b_T203_start(l2sc);
1268 /*---------------------------------------------------------------------------*
1269 * FSM state ST_TIMREC event rx'd DISC
1270 *---------------------------------------------------------------------------*/
1272 F_TR08(l2_softc_t *l2sc)
1274 NDBGL2(L2_F_MSG, "FSM function F_TR08 executing");
1276 i4b_Dcleanifq(&l2sc->i_queue);
1277 MDL_Status_Ind(l2sc->unit, STI_L2STAT, LAYER_IDLE);
1278 i4b_tx_ua(l2sc, l2sc->rxd_PF);
1280 l2sc->postfsmarg = l2sc->unit;
1281 l2sc->postfsmfunc = DL_Rel_Ind_A;
1283 i4b_T200_stop(l2sc);
1286 /*---------------------------------------------------------------------------*
1287 * FSM state ST_TIMREC event rx'd UA
1288 *---------------------------------------------------------------------------*/
1290 F_TR09(l2_softc_t *l2sc)
1292 NDBGL2(L2_F_MSG, "FSM function F_TR09 executing");
1294 i4b_mdl_error_ind(l2sc, "F_TR09", MDL_ERR_C);
1296 i4b_mdl_error_ind(l2sc, "F_TR09", MDL_ERR_D);
1299 /*---------------------------------------------------------------------------*
1300 * FSM state ST_TIMREC event rx'd DM
1301 *---------------------------------------------------------------------------*/
1303 F_TR10(l2_softc_t *l2sc)
1305 NDBGL2(L2_F_MSG, "FSM function F_TR10 executing");
1309 i4b_mdl_error_ind(l2sc, "F_TR10", MDL_ERR_B);
1313 i4b_mdl_error_ind(l2sc, "F_TR10", MDL_ERR_E);
1316 i4b_establish_data_link(l2sc);
1318 l2sc->l3initiated = 0;
1321 /*---------------------------------------------------------------------------*
1322 * FSM state ST_TIMREC event T200 expiry
1323 *---------------------------------------------------------------------------*/
1325 F_TR11(l2_softc_t *l2sc)
1327 NDBGL2(L2_F_MSG, "FSM function F_TR11 executing");
1329 if(l2sc->RC >= N200)
1331 i4b_mdl_error_ind(l2sc, "F_TR11", MDL_ERR_I);
1333 i4b_establish_data_link(l2sc);
1335 l2sc->l3initiated = 0;
1337 l2sc->Q921_state = ST_AW_EST;
1341 i4b_transmit_enquire(l2sc);
1345 l2sc->Q921_state = ST_TIMREC;
1349 /*---------------------------------------------------------------------------*
1350 * FSM state ST_TIMREC event dl data request
1351 *---------------------------------------------------------------------------*/
1353 F_TR12(l2_softc_t *l2sc)
1355 NDBGL2(L2_F_MSG, "FSM function F_TR12 executing");
1357 i4b_i_frame_queued_up(l2sc);
1360 /*---------------------------------------------------------------------------*
1361 * FSM state ST_TIMREC event dl release request
1362 *---------------------------------------------------------------------------*/
1364 F_TR13(l2_softc_t *l2sc)
1366 NDBGL2(L2_F_MSG, "FSM function F_TR13 executing");
1368 i4b_Dcleanifq(&l2sc->i_queue);
1372 i4b_tx_disc(l2sc, P1);
1374 i4b_T200_restart(l2sc);
1377 /*---------------------------------------------------------------------------*
1378 * FSM state ST_TIMREC event set own rx busy
1379 *---------------------------------------------------------------------------*/
1381 F_TR15(l2_softc_t *l2sc)
1383 NDBGL2(L2_F_MSG, "FSM function F_TR15 executing");
1385 if(l2sc->own_busy == 0)
1389 i4b_tx_rnr_response(l2sc, F0);
1395 /*---------------------------------------------------------------------------*
1396 * FSM state ST_TIMREC event clear own rx busy
1397 *---------------------------------------------------------------------------*/
1399 F_TR16(l2_softc_t *l2sc)
1401 NDBGL2(L2_F_MSG, "FSM function F_TR16 executing");
1403 if(l2sc->own_busy != 0)
1407 i4b_tx_rr_response(l2sc, F0); /* this is wrong */
1408 /* in Q.921 03/93 p 74 ! */
1413 /*---------------------------------------------------------------------------*
1414 * FSM state ST_TIMREC event rx'd RR
1415 *---------------------------------------------------------------------------*/
1417 F_TR17(l2_softc_t *l2sc)
1419 NDBGL2(L2_F_MSG, "FSM function F_TR17 executing");
1421 l2sc->peer_busy = 0;
1423 if(l2sc->rxd_CR == CR_CMD_FROM_NT)
1425 if(l2sc->rxd_PF == 1)
1427 i4b_enquiry_response(l2sc);
1432 if(l2sc->rxd_PF == 1)
1434 if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs))
1436 l2sc->va = l2sc->rxd_NR;
1437 i4b_T200_stop(l2sc);
1438 i4b_T203_start(l2sc);
1439 i4b_invoke_retransmission(l2sc, l2sc->rxd_NR);
1440 l2sc->Q921_state = ST_MULTIFR;
1445 i4b_nr_error_recovery(l2sc);
1446 l2sc->Q921_state = ST_AW_EST;
1452 if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs))
1454 l2sc->va = l2sc->rxd_NR;
1455 l2sc->Q921_state = ST_TIMREC;
1459 i4b_nr_error_recovery(l2sc);
1460 l2sc->Q921_state = ST_AW_EST;
1464 /*---------------------------------------------------------------------------*
1465 * FSM state ST_TIMREC event
1466 *---------------------------------------------------------------------------*/
1468 F_TR18(l2_softc_t *l2sc)
1470 NDBGL2(L2_F_MSG, "FSM function F_TR18 executing");
1472 l2sc->peer_busy = 0;
1474 if(l2sc->rxd_CR == CR_CMD_FROM_NT)
1476 if(l2sc->rxd_PF == 1)
1478 i4b_enquiry_response(l2sc);
1483 if(l2sc->rxd_PF == 1)
1485 if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs))
1487 l2sc->va = l2sc->rxd_NR;
1488 i4b_T200_stop(l2sc);
1489 i4b_T203_start(l2sc);
1490 i4b_invoke_retransmission(l2sc, l2sc->rxd_NR);
1491 l2sc->Q921_state = ST_MULTIFR;
1496 i4b_nr_error_recovery(l2sc);
1497 l2sc->Q921_state = ST_AW_EST;
1503 if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs))
1505 l2sc->va = l2sc->rxd_NR;
1506 l2sc->Q921_state = ST_TIMREC;
1510 i4b_nr_error_recovery(l2sc);
1511 l2sc->Q921_state = ST_AW_EST;
1515 /*---------------------------------------------------------------------------*
1516 * FSM state ST_TIMREC event rx'd RNR
1517 *---------------------------------------------------------------------------*/
1519 F_TR19(l2_softc_t *l2sc)
1521 NDBGL2(L2_F_MSG, "FSM function F_TR19 executing");
1523 l2sc->peer_busy = 0;
1525 if(l2sc->rxd_CR == CR_CMD_FROM_NT)
1527 if(l2sc->rxd_PF == 1)
1529 i4b_enquiry_response(l2sc);
1534 if(l2sc->rxd_PF == 1)
1536 if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs))
1538 l2sc->va = l2sc->rxd_NR;
1539 i4b_T200_restart(l2sc);
1540 i4b_invoke_retransmission(l2sc, l2sc->rxd_NR);
1541 l2sc->Q921_state = ST_MULTIFR;
1546 i4b_nr_error_recovery(l2sc);
1547 l2sc->Q921_state = ST_AW_EST;
1553 if(i4b_l2_nr_ok(l2sc->rxd_NR, l2sc->va, l2sc->vs))
1555 l2sc->va = l2sc->rxd_NR;
1556 l2sc->Q921_state = ST_TIMREC;
1560 i4b_nr_error_recovery(l2sc);
1561 l2sc->Q921_state = ST_AW_EST;
1565 /*---------------------------------------------------------------------------*
1566 * FSM state ST_TIMREC event rx'd FRMR
1567 *---------------------------------------------------------------------------*/
1569 F_TR20(l2_softc_t *l2sc)
1571 NDBGL2(L2_F_MSG, "FSM function F_TR20 executing");
1573 i4b_mdl_error_ind(l2sc, "F_TR20", MDL_ERR_K);
1575 i4b_establish_data_link(l2sc);
1577 l2sc->l3initiated = 0;