OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [isdn/] [hisax/] [isdnl2.c] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1626 jcastillo
/* $Id: isdnl2.c,v 1.1 2005-12-20 10:17:01 jcastillo Exp $
2
 
3
 * Author       Karsten Keil (keil@temic-ech.spacenet.de)
4
 *              based on the teles driver from Jan den Ouden
5
 *
6
 *              This file is (c) under GNU PUBLIC LICENSE
7
 *              For changes and modifications please read
8
 *              ../../../Documentation/isdn/HiSax.cert
9
 *
10
 * Thanks to    Jan den Ouden
11
 *              Fritz Elfert
12
 *
13
 * $Log: not supported by cvs2svn $
14
 * Revision 1.1.1.1  2001/09/10 07:44:18  simons
15
 * Initial import
16
 *
17
 * Revision 1.1.1.1  2001/07/02 17:58:32  simons
18
 * Initial revision
19
 *
20
 * Revision 1.10.2.11  1998/11/03 00:06:57  keil
21
 * certification related changes
22
 * fixed logging for smaller stack use
23
 *
24
 * Revision 1.10.2.10  1998/09/27 13:06:30  keil
25
 * Apply most changes from 2.1.X (HiSax 3.1)
26
 *
27
 * Revision 1.10.2.9  1998/06/19 15:17:56  keil
28
 * fix LAPB tx_cnt for none I-frames
29
 *
30
 * Revision 1.10.2.8  1998/06/18 23:12:05  keil
31
 * LAPB bugfix
32
 *
33
 * Revision 1.10.2.7  1998/05/27 18:05:51  keil
34
 * HiSax 3.0
35
 *
36
 * Revision 1.10.2.6  1998/05/26 10:36:57  keil
37
 * fixes from certification
38
 *
39
 * Revision 1.10.2.5  1998/03/07 23:15:31  tsbogend
40
 * made HiSax working on Linux/Alpha
41
 *
42
 * Revision 1.10.2.4  1998/01/27 22:44:38  keil
43
 * fixed window size calculation
44
 *
45
 * Revision 1.10.2.3  1997/11/15 18:54:03  keil
46
 * cosmetics
47
 *
48
 * Revision 1.10.2.2  1997/10/17 22:13:59  keil
49
 * update to last hisax version
50
 *
51
 * Revision 2.2  1997/07/31 11:49:05  keil
52
 * Eroor handling for no TEI assign
53
 *
54
 * Revision 2.1  1997/07/27 21:34:38  keil
55
 * cosmetics
56
 *
57
 * Revision 2.0  1997/06/26 11:07:29  keil
58
 * New q.921 and X.75 Layer2
59
 *
60
 *
61
 *  Old log removed KKe
62
 *
63
 */
64
#define __NO_VERSION__
65
#include "hisax.h"
66
#include "isdnl2.h"
67
 
68
const char *l2_revision = "$Revision: 1.1 $";
69
 
70
static void l2m_debug(struct FsmInst *fi, char *fmt, ...);
71
 
72
static
73
struct Fsm l2fsm =
74
{NULL, 0, 0, NULL, NULL};
75
 
76
enum {
77
        ST_L2_1,
78
        ST_L2_2,
79
        ST_L2_3,
80
        ST_L2_4,
81
        ST_L2_5,
82
        ST_L2_6,
83
        ST_L2_7,
84
        ST_L2_8,
85
};
86
 
87
#define L2_STATE_COUNT (ST_L2_8+1)
88
 
89
static char *strL2State[] =
90
{
91
        "ST_L2_1",
92
        "ST_L2_2",
93
        "ST_L2_3",
94
        "ST_L2_4",
95
        "ST_L2_5",
96
        "ST_L2_6",
97
        "ST_L2_7",
98
        "ST_L2_8",
99
};
100
 
101
enum {
102
        EV_L2_UI,
103
        EV_L2_SABMX,
104
        EV_L2_DISC,
105
        EV_L2_DM,
106
        EV_L2_UA,
107
        EV_L2_FRMR,
108
        EV_L2_SUPER,
109
        EV_L2_I,
110
        EV_L2_DL_DATA,
111
        EV_L2_ACK_PULL,
112
        EV_L2_DL_UNIT_DATA,
113
        EV_L2_DL_ESTABLISH,
114
        EV_L2_DL_RELEASE,
115
        EV_L2_MDL_ASSIGN,
116
        EV_L2_MDL_REMOVE,
117
        EV_L2_MDL_ERROR,
118
        EV_L1_DEACTIVATE,
119
        EV_L2_T200,
120
        EV_L2_T203,
121
};
122
 
123
#define L2_EVENT_COUNT (EV_L2_T203+1)
124
 
125
static char *strL2Event[] =
126
{
127
        "EV_L2_UI",
128
        "EV_L2_SABMX",
129
        "EV_L2_DISC",
130
        "EV_L2_DM",
131
        "EV_L2_UA",
132
        "EV_L2_FRMR",
133
        "EV_L2_SUPER",
134
        "EV_L2_I",
135
        "EV_L2_DL_DATA",
136
        "EV_L2_ACK_PULL",
137
        "EV_L2_DL_UNIT_DATA",
138
        "EV_L2_DL_ESTABLISH",
139
        "EV_L2_DL_RELEASE",
140
        "EV_L2_MDL_ASSIGN",
141
        "EV_L2_MDL_REMOVE",
142
        "EV_L2_MDL_ERROR",
143
        "EV_L1_DEACTIVATE",
144
        "EV_L2_T200",
145
        "EV_L2_T203",
146
};
147
 
148
static int l2addrsize(struct Layer2 *l2);
149
 
150
static void
151
InitWin(struct Layer2 *l2)
152
{
153
        int i;
154
 
155
        for (i = 0; i < MAX_WINDOW; i++)
156
                l2->windowar[i] = NULL;
157
}
158
 
159
static void
160
ReleaseWin(struct Layer2 *l2)
161
{
162
        int i, cnt = 0;
163
 
164
        for (i = 0; i < MAX_WINDOW; i++) {
165
                if (l2->windowar[i]) {
166
                        cnt++;
167
                        dev_kfree_skb(l2->windowar[i], FREE_WRITE);
168
                        l2->windowar[i] = NULL;
169
                }
170
        }
171
        if (cnt)
172
                printk(KERN_WARNING "isdl2 freed %d skbuffs in release\n", cnt);
173
}
174
 
175
inline int
176
cansend(struct PStack *st)
177
{
178
        int p1;
179
 
180
        p1 = st->l2.vs - st->l2.va;
181
        if (p1 < 0)
182
                p1 += (test_bit(FLG_MOD128, &st->l2.flag) ? 128 : 8);
183
        return ((p1 < st->l2.window) && !test_bit(FLG_PEER_BUSY, &st->l2.flag));
184
}
185
 
186
inline void
187
clear_exception(struct Layer2 *l2)
188
{
189
        test_and_clear_bit(FLG_ACK_PEND, &l2->flag);
190
        test_and_clear_bit(FLG_REJEXC, &l2->flag);
191
        test_and_clear_bit(FLG_OWN_BUSY, &l2->flag);
192
        test_and_clear_bit(FLG_PEER_BUSY, &l2->flag);
193
}
194
 
195
inline int
196
l2headersize(struct Layer2 *l2, int ui)
197
{
198
        return (((test_bit(FLG_MOD128, &l2->flag) && (!ui)) ? 2 : 1) +
199
                (test_bit(FLG_LAPD, &l2->flag) ? 2 : 1));
200
}
201
 
202
inline int
203
l2addrsize(struct Layer2 *l2)
204
{
205
        return (test_bit(FLG_LAPD, &l2->flag) ? 2 : 1);
206
}
207
 
208
static int
209
sethdraddr(struct Layer2 *l2, u_char * header, int rsp)
210
{
211
        u_char *ptr = header;
212
        int crbit = rsp;
213
 
214
        if (test_bit(FLG_LAPD, &l2->flag)) {
215
                *ptr++ = (l2->sap << 2) | (rsp ? 2 : 0);
216
                *ptr++ = (l2->tei << 1) | 1;
217
                return (2);
218
        } else {
219
                if (test_bit(FLG_ORIG, &l2->flag))
220
                        crbit = !crbit;
221
                if (crbit)
222
                        *ptr++ = 1;
223
                else
224
                        *ptr++ = 3;
225
                return (1);
226
        }
227
}
228
 
229
inline static void
230
enqueue_super(struct PStack *st,
231
              struct sk_buff *skb)
232
{
233
        if (test_bit(FLG_LAPB, &st->l2.flag))
234
                st->l1.bcs->tx_cnt += skb->len;
235
        st->l2.l2l1(st, PH_DATA | REQUEST, skb);
236
}
237
 
238
#define enqueue_ui(a, b) enqueue_super(a, b)
239
 
240
inline int
241
IsUI(u_char * data, int ext)
242
{
243
        return ((data[0] & 0xef) == UI);
244
}
245
 
246
inline int
247
IsUA(u_char * data, int ext)
248
{
249
        return ((data[0] & 0xef) == UA);
250
}
251
 
252
inline int
253
IsDM(u_char * data, int ext)
254
{
255
        return ((data[0] & 0xef) == DM);
256
}
257
 
258
inline int
259
IsDISC(u_char * data, int ext)
260
{
261
        return ((data[0] & 0xef) == DISC);
262
}
263
 
264
inline int
265
IsRR(u_char * data, int ext)
266
{
267
        if (ext)
268
                return (data[0] == RR);
269
        else
270
                return ((data[0] & 0xf) == 1);
271
}
272
 
273
inline int
274
IsSFrame(u_char * data, int ext)
275
{
276
        register u_char d = *data;
277
 
278
        if (!ext)
279
                d &= 0xf;
280
        return(((d & 0xf3) == 1) && ((d & 0x0c) != 0x0c));
281
}
282
 
283
inline int
284
IsSABMX(u_char * data, int ext)
285
{
286
        u_char d = data[0] & ~0x10;
287
 
288
        return (ext ? d == SABME : d == SABM);
289
}
290
 
291
inline int
292
IsREJ(u_char * data, int ext)
293
{
294
        return (ext ? data[0] == REJ : (data[0] & 0xf) == REJ);
295
}
296
 
297
inline int
298
IsFRMR(u_char * data, int ext)
299
{
300
        return ((data[0] & 0xef) == FRMR);
301
}
302
 
303
inline int
304
IsRNR(u_char * data, int ext)
305
{
306
        return (ext ? data[0] == RNR : (data[0] & 0xf) == RNR);
307
}
308
 
309
static int
310
legalnr(struct PStack *st, int nr)
311
{
312
        struct Layer2 *l2 = &st->l2;
313
        int lnr, lvs;
314
 
315
        lvs = (l2->vs >= l2->va) ? l2->vs :
316
            (l2->vs + (test_bit(FLG_MOD128, &l2->flag) ? 128 : 8));
317
        lnr = (nr >= l2->va) ? nr : (test_bit(FLG_MOD128, &l2->flag) ? 128 : 8);
318
        return (lnr <= lvs);
319
}
320
 
321
static void
322
setva(struct PStack *st, int nr)
323
{
324
        struct Layer2 *l2 = &st->l2;
325
        int len;
326
 
327
        while (l2->va != nr) {
328
                l2->va = (l2->va + 1) % (test_bit(FLG_MOD128, &l2->flag) ? 128 : 8);
329
                len = l2->windowar[l2->sow]->len;
330
                if (PACKET_NOACK == l2->windowar[l2->sow]->pkt_type)
331
                        len = -1;
332
                dev_kfree_skb(l2->windowar[l2->sow], FREE_WRITE);
333
                l2->windowar[l2->sow] = NULL;
334
                l2->sow = (l2->sow + 1) % l2->window;
335
                if (st->lli.l2writewakeup && (len >=0))
336
                        st->lli.l2writewakeup(st, len);
337
        }
338
}
339
 
340
static void
341
send_uframe(struct PStack *st, u_char cmd, u_char cr)
342
{
343
        struct sk_buff *skb;
344
        u_char tmp[MAX_HEADER_LEN];
345
        int i;
346
 
347
        i = sethdraddr(&st->l2, tmp, cr);
348
        tmp[i++] = cmd;
349
        if (!(skb = alloc_skb(i, GFP_ATOMIC))) {
350
                printk(KERN_WARNING "isdl2 can't alloc sbbuff for send_uframe\n");
351
                return;
352
        }
353
        SET_SKB_FREE(skb);
354
        memcpy(skb_put(skb, i), tmp, i);
355
        enqueue_super(st, skb);
356
}
357
 
358
inline u_char
359
get_PollFlag(struct PStack * st, struct sk_buff * skb)
360
{
361
        return (skb->data[l2addrsize(&(st->l2))] & 0x10);
362
}
363
 
364
inline void
365
FreeSkb(struct sk_buff *skb)
366
{
367
        dev_kfree_skb(skb, FREE_READ);
368
}
369
 
370
 
371
inline u_char
372
get_PollFlagFree(struct PStack *st, struct sk_buff *skb)
373
{
374
        u_char PF;
375
 
376
        PF = get_PollFlag(st, skb);
377
        FreeSkb(skb);
378
        return (PF);
379
}
380
 
381
static void
382
establishlink(struct FsmInst *fi)
383
{
384
        struct PStack *st = fi->userdata;
385
        u_char cmd;
386
 
387
        clear_exception(&st->l2);
388
        st->l2.rc = 0;
389
        cmd = (test_bit(FLG_MOD128, &st->l2.flag) ? SABME : SABM) | 0x10;
390
        send_uframe(st, cmd, CMD);
391
        FsmDelTimer(&st->l2.t203, 1);
392
        FsmRestartTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 1);
393
        test_and_set_bit(FLG_T200_RUN, &st->l2.flag);
394
        FsmChangeState(fi, ST_L2_5);
395
}
396
 
397
static void
398
l2_mdl_error(struct FsmInst *fi, int event, void *arg)
399
{
400
        struct sk_buff *skb = arg;
401
        struct PStack *st = fi->userdata;
402
 
403
        switch (event) {
404
                case EV_L2_UA:
405
                        if (get_PollFlagFree(st, skb))
406
                                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'C');
407
                        else
408
                                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'D');
409
                        break;
410
                case EV_L2_DM:
411
                        if (get_PollFlagFree(st, skb))
412
                                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'B');
413
                        else {
414
                                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'E');
415
                                establishlink(fi);
416
                                test_and_clear_bit(FLG_L3_INIT, &st->l2.flag);
417
                        }
418
                        break;
419
        }
420
}
421
 
422
static void
423
l2_dl_establish(struct FsmInst *fi, int event, void *arg)
424
{
425
        struct PStack *st = fi->userdata;
426
        int state = fi->state;
427
 
428
 
429
        if (test_bit(FLG_FIXED_TEI, &st->l2.flag)) {
430
                FsmChangeState(fi, ST_L2_4);
431
                establishlink(fi);
432
                test_and_set_bit(FLG_L3_INIT, &st->l2.flag);
433
        } else {
434
                FsmChangeState(fi, ST_L2_3);
435
                if (state == ST_L2_1)
436
                        st->l2.l2tei(st, MDL_ASSIGN | INDICATION, NULL);
437
        }
438
}
439
 
440
static void
441
l2_send_ui(struct PStack *st)
442
{
443
        struct sk_buff *skb;
444
        u_char header[MAX_HEADER_LEN];
445
        int i;
446
 
447
        i = sethdraddr(&(st->l2), header, CMD);
448
        header[i++] = UI;
449
        while ((skb = skb_dequeue(&st->l2.ui_queue))) {
450
                memcpy(skb_push(skb, i), header, i);
451
                enqueue_ui(st, skb);
452
        }
453
}
454
 
455
static void
456
l2_put_ui(struct FsmInst *fi, int event, void *arg)
457
{
458
        struct PStack *st = fi->userdata;
459
        struct sk_buff *skb = arg;
460
 
461
        skb_queue_tail(&st->l2.ui_queue, skb);
462
        if (fi->state == ST_L2_1) {
463
                FsmChangeState(fi, ST_L2_2);
464
                st->l2.l2tei(st, MDL_ASSIGN | INDICATION, NULL);
465
        }
466
        if (fi->state > ST_L2_3)
467
                l2_send_ui(st);
468
}
469
 
470
static void
471
l2_got_ui(struct FsmInst *fi, int event, void *arg)
472
{
473
        struct PStack *st = fi->userdata;
474
        struct sk_buff *skb = arg;
475
 
476
        skb_pull(skb, l2headersize(&st->l2, 1));
477
        if (skb->len > st->l2.maxlen) {
478
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'O');
479
                FreeSkb(skb);
480
        } else
481
                st->l2.l2l3(st, DL_UNIT_DATA | INDICATION, skb);
482
}
483
 
484
static void
485
l2_establish(struct FsmInst *fi, int event, void *arg)
486
{
487
        struct PStack *st = fi->userdata;
488
 
489
        if (fi->state != ST_L2_4)
490
                discard_queue(&st->l2.i_queue);
491
        if (fi->state != ST_L2_5)
492
                establishlink(fi);
493
        test_and_set_bit(FLG_L3_INIT, &st->l2.flag);
494
}
495
 
496
static void
497
l2_dl_release(struct FsmInst *fi, int event, void *arg)
498
{
499
        struct PStack *st = fi->userdata;
500
 
501
        if (fi->state == ST_L2_4) {
502
                st->l2.l2l3(st, DL_RELEASE  | CONFIRM, NULL);
503
                return;
504
        } else if (fi->state == ST_L2_5) {
505
                test_and_set_bit(FLG_PEND_REL, &st->l2.flag);
506
                return;
507
        }
508
        discard_queue(&st->l2.i_queue);
509
        FsmChangeState(fi, ST_L2_6);
510
        st->l2.rc = 0;
511
        send_uframe(st, DISC | 0x10, CMD);
512
        FsmDelTimer(&st->l2.t203, 1);
513
        FsmRestartTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 2);
514
        test_and_set_bit(FLG_T200_RUN, &st->l2.flag);
515
}
516
 
517
static void
518
l2_got_SABMX(struct FsmInst *fi, int event, void *arg)
519
{
520
        struct PStack *st = fi->userdata;
521
        struct sk_buff *skb = arg;
522
        int est = 1, state, rsp;
523
        u_char PollFlag;
524
 
525
        state = fi->state;
526
        rsp = *skb->data & 0x2;
527
        if (test_bit(FLG_ORIG, &st->l2.flag))
528
                rsp = !rsp;
529
        if (rsp) {
530
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'L');
531
                FreeSkb(skb);
532
                if ((state == ST_L2_7) || (state == ST_L2_8))
533
                        establishlink(fi);
534
                return;
535
        }
536
        if (skb->len != (l2addrsize(&st->l2) + 1)) {
537
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'N');
538
                FreeSkb(skb);
539
                if ((state == ST_L2_7) || (state == ST_L2_8))
540
                        establishlink(fi);
541
                return;
542
        }
543
        PollFlag = get_PollFlagFree(st, skb);
544
        if (ST_L2_6 == state) {
545
                send_uframe(st, DM | PollFlag, RSP);
546
                return;
547
        } else
548
                send_uframe(st, UA | PollFlag, RSP);
549
        if (ST_L2_5 == state)
550
                return;
551
        if (ST_L2_4 != state) {
552
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'F');
553
                if (st->l2.vs != st->l2.va) {
554
                        discard_queue(&st->l2.i_queue);
555
                        est = 1;
556
                } else
557
                        est = 0;
558
        }
559
        clear_exception(&st->l2);
560
        st->l2.vs = 0;
561
        st->l2.va = 0;
562
        st->l2.vr = 0;
563
        st->l2.sow = 0;
564
        FsmChangeState(fi, ST_L2_7);
565
        if (test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
566
                FsmDelTimer(&st->l2.t200, 2);
567
        FsmRestartTimer(&st->l2.t203, st->l2.T203, EV_L2_T203, NULL, 3);
568
 
569
        if (est)
570
                st->l2.l2l3(st, DL_ESTABLISH | INDICATION, NULL);
571
 
572
        if (ST_L2_8 == state)
573
                if (skb_queue_len(&st->l2.i_queue) && cansend(st))
574
                        st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
575
}
576
 
577
static void
578
l2_got_disconn(struct FsmInst *fi, int event, void *arg)
579
{
580
        struct PStack *st = fi->userdata;
581
        struct sk_buff *skb = arg;
582
        u_char PollFlag, cmd = UA;
583
        int state, rel = 1, cst = 1, rsp;
584
 
585
        state = fi->state;
586
        rsp = *skb->data & 0x2;
587
        if (test_bit(FLG_ORIG, &st->l2.flag))
588
                rsp = !rsp;
589
 
590
        if (rsp) {
591
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'L');
592
                FreeSkb(skb);
593
                if ((state == ST_L2_7) || (state == ST_L2_8))
594
                        establishlink(fi);
595
                return;
596
        }
597
        if (skb->len != (l2addrsize(&st->l2) + 1)) {
598
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'N');
599
                FreeSkb(skb);
600
                if ((state == ST_L2_7) || (state == ST_L2_8))
601
                        establishlink(fi);
602
                return;
603
        }
604
        PollFlag = get_PollFlagFree(st, skb);
605
        if ((state == ST_L2_4) || (state == ST_L2_5)) {
606
                rel = 0;
607
                cst = 0;
608
                cmd = DM;
609
        } else if (state == ST_L2_6) {
610
                rel = 0;
611
                cst = 0;
612
        }
613
        if (cst) {
614
                FsmChangeState(fi, ST_L2_4);
615
                FsmDelTimer(&st->l2.t203, 3);
616
                if (test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
617
                        FsmDelTimer(&st->l2.t200, 2);
618
        }
619
        send_uframe(st, cmd | PollFlag, RSP);
620
        if (rel) {
621
                if (test_bit(FLG_LAPB, &st->l2.flag))
622
                        st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL);
623
                st->l2.l2l3(st, DL_RELEASE | INDICATION, NULL);
624
        }
625
}
626
 
627
 
628
static void
629
l2_got_ua(struct FsmInst *fi, int event, void *arg)
630
{
631
        struct PStack *st = fi->userdata;
632
        struct sk_buff *skb = arg;
633
        int pr=-1;
634
        u_char PollFlag;
635
        int state,rsp;
636
 
637
        state = fi->state;
638
        rsp = *skb->data & 0x2;
639
        if (test_bit(FLG_ORIG, &st->l2.flag))
640
                rsp = !rsp;
641
 
642
        if (!rsp) {
643
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'L');
644
                FreeSkb(skb);
645
                if ((state == ST_L2_7) || (state == ST_L2_8))
646
                        establishlink(fi);
647
                return;
648
        }
649
        if (skb->len != (l2addrsize(&st->l2) + 1)) {
650
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'N');
651
                FreeSkb(skb);
652
                if ((fi->state == ST_L2_7) || (fi->state == ST_L2_8))
653
                        establishlink(fi);
654
                return;
655
        }
656
        PollFlag = get_PollFlag(st, skb);
657
        if (!PollFlag) {
658
                l2_mdl_error(fi, event, arg);
659
                return;
660
        }
661
        FreeSkb(skb);
662
 
663
        if (test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
664
                FsmDelTimer(&st->l2.t200, 2);
665
        if (fi->state == ST_L2_5) {
666
                if (test_and_clear_bit(FLG_PEND_REL, &st->l2.flag)) {
667
                        discard_queue(&st->l2.i_queue);
668
                        st->l2.rc = 0;
669
                        send_uframe(st, DISC | 0x10, CMD);
670
                        FsmChangeState(fi, ST_L2_6);
671
                        FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 4);
672
                        test_and_set_bit(FLG_T200_RUN, &st->l2.flag);
673
                } else {
674
                        if (test_and_clear_bit(FLG_L3_INIT, &st->l2.flag)) {
675
                                pr = DL_ESTABLISH | CONFIRM;
676
                        } else if (st->l2.vs != st->l2.va) {
677
                                discard_queue(&st->l2.i_queue);
678
                                pr = DL_ESTABLISH | INDICATION;
679
                        }
680
                        st->l2.vs = 0;
681
                        st->l2.va = 0;
682
                        st->l2.vr = 0;
683
                        st->l2.sow = 0;
684
                        FsmChangeState(fi, ST_L2_7);
685
                        if (pr > -1)
686
                                st->l2.l2l3(st, pr, NULL);
687
                }
688
        } else {                /* ST_L2_6 */
689
                if (test_bit(FLG_LAPB, &st->l2.flag))
690
                        st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL);
691
                st->l2.l2l3(st, DL_RELEASE | CONFIRM, NULL);
692
                FsmChangeState(fi, ST_L2_4);
693
        }
694
}
695
 
696
static void
697
l2_got_dm(struct FsmInst *fi, int event, void *arg)
698
{
699
        struct PStack *st = fi->userdata;
700
        struct sk_buff *skb = arg;
701
        u_char PollFlag;
702
        int state,rsp;
703
 
704
        state = fi->state;
705
        rsp = *skb->data & 0x2;
706
        if (test_bit(FLG_ORIG, &st->l2.flag))
707
                rsp = !rsp;
708
 
709
        if (!rsp) {
710
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'L');
711
                FreeSkb(skb);
712
                if ((state == ST_L2_7) || (state == ST_L2_8))
713
                        establishlink(fi);
714
                return;
715
        }
716
        if (skb->len != (l2addrsize(&st->l2) + 1)) {
717
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'N');
718
                FreeSkb(skb);
719
                if ((fi->state == ST_L2_7) || (fi->state == ST_L2_8))
720
                        establishlink(fi);
721
                return;
722
        }
723
        PollFlag = get_PollFlagFree(st, skb);
724
        if (!PollFlag) {
725
                if (fi->state == ST_L2_4) {
726
                        establishlink(fi);
727
                        test_and_clear_bit(FLG_L3_INIT, &st->l2.flag);
728
                        FsmChangeState(fi, ST_L2_5);
729
                } else if ((fi->state == ST_L2_7) || (fi->state == ST_L2_8)) {
730
                        st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'E');
731
                        establishlink(fi);
732
                }
733
        } else {
734
                switch (fi->state) {
735
                        case ST_L2_8:
736
                                 establishlink(fi);
737
                        case ST_L2_7:
738
                                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'B');
739
                                break;
740
                        case ST_L2_4:
741
                                break;
742
                        case ST_L2_5:
743
                                if (test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
744
                                        FsmDelTimer(&st->l2.t200, 2);
745
                                discard_queue(&st->l2.i_queue);
746
                                if (test_bit(FLG_LAPB, &st->l2.flag))
747
                                        st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL);
748
                                st->l2.l2l3(st, DL_RELEASE | INDICATION, NULL);
749
                                FsmChangeState(fi, ST_L2_4);
750
                                break;
751
                        case ST_L2_6:
752
                                if (test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
753
                                        FsmDelTimer(&st->l2.t200, 2);
754
                                if (test_bit(FLG_LAPB, &st->l2.flag))
755
                                        st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL);
756
                                st->l2.l2l3(st, DL_RELEASE | CONFIRM, NULL);
757
                                FsmChangeState(fi, ST_L2_4);
758
                                break;
759
                }
760
        }
761
}
762
 
763
inline void
764
enquiry_cr(struct PStack *st, u_char typ, u_char cr, u_char pf)
765
{
766
        struct sk_buff *skb;
767
        struct Layer2 *l2;
768
        u_char tmp[MAX_HEADER_LEN];
769
        int i;
770
 
771
        l2 = &st->l2;
772
        i = sethdraddr(l2, tmp, cr);
773
        if (test_bit(FLG_MOD128, &l2->flag)) {
774
                tmp[i++] = typ;
775
                tmp[i++] = (l2->vr << 1) | (pf ? 1 : 0);
776
        } else
777
                tmp[i++] = (l2->vr << 5) | typ | (pf ? 0x10 : 0);
778
        if (!(skb = alloc_skb(i, GFP_ATOMIC))) {
779
                printk(KERN_WARNING "isdl2 can't alloc sbbuff for enquiry_cr\n");
780
                return;
781
        }
782
        SET_SKB_FREE(skb);
783
        memcpy(skb_put(skb, i), tmp, i);
784
        enqueue_super(st, skb);
785
}
786
 
787
inline void
788
enquiry_response(struct PStack *st)
789
{
790
        if (test_bit(FLG_OWN_BUSY, &st->l2.flag))
791
                enquiry_cr(st, RNR, RSP, 1);
792
        else
793
                enquiry_cr(st, RR, RSP, 1);
794
        test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag);
795
}
796
 
797
inline void
798
transmit_enquiry(struct PStack *st)
799
{
800
        if (test_bit(FLG_OWN_BUSY, &st->l2.flag))
801
                enquiry_cr(st, RNR, CMD, 1);
802
        else
803
                enquiry_cr(st, RR, CMD, 1);
804
        test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag);
805
        FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 12);
806
        test_and_set_bit(FLG_T200_RUN, &st->l2.flag);
807
}
808
 
809
 
810
static void
811
nrerrorrecovery(struct FsmInst *fi)
812
{
813
        struct PStack *st = fi->userdata;
814
 
815
        st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'J');
816
        establishlink(fi);
817
}
818
 
819
static void
820
invoke_retransmission(struct PStack *st, int nr)
821
{
822
        struct Layer2 *l2 = &st->l2;
823
        int p1;
824
        long flags;
825
 
826
        if (l2->vs != nr) {
827
                save_flags(flags);
828
                cli();
829
                while (l2->vs != nr) {
830
                        l2->vs = l2->vs - 1;
831
                        if (l2->vs < 0)
832
                                l2->vs += (test_bit(FLG_MOD128, &l2->flag) ? 128 : 8);
833
                        p1 = l2->vs - l2->va;
834
                        if (p1 < 0)
835
                                p1 += (test_bit(FLG_MOD128, &l2->flag) ? 128 : 8);
836
                        p1 = (p1 + l2->sow) % l2->window;
837
                        if (test_bit(FLG_LAPB, &l2->flag))
838
                                st->l1.bcs->tx_cnt += l2->windowar[p1]->len + l2headersize(l2, 0);
839
                        skb_queue_head(&l2->i_queue, l2->windowar[p1]);
840
                        l2->windowar[p1] = NULL;
841
                }
842
                restore_flags(flags);
843
                st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
844
        }
845
}
846
 
847
static void
848
l2_got_st7_super(struct FsmInst *fi, int event, void *arg)
849
{
850
        struct PStack *st = fi->userdata;
851
        struct sk_buff *skb = arg;
852
        int PollFlag, nr, rsp, typ = RR;
853
        struct Layer2 *l2 = &st->l2;
854
 
855
        rsp = *skb->data & 0x2;
856
        if (test_bit(FLG_ORIG, &l2->flag))
857
                rsp = !rsp;
858
 
859
        skb_pull(skb, l2addrsize(l2));
860
        if (IsRNR(skb->data, test_bit(FLG_MOD128, &l2->flag))) {
861
                test_and_set_bit(FLG_PEER_BUSY, &l2->flag);
862
                typ = RNR;
863
        } else
864
                test_and_clear_bit(FLG_PEER_BUSY, &l2->flag);
865
        if (IsREJ(skb->data, test_bit(FLG_MOD128, &l2->flag)))
866
                typ = REJ;
867
        if (test_bit(FLG_MOD128, &l2->flag)) {
868
                if (skb->len == 2) {
869
                        PollFlag = (skb->data[1] & 0x1) == 0x1;
870
                        nr = skb->data[1] >> 1;
871
                } else {
872
                        if (skb->len >2) {
873
                                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'N');
874
                                establishlink(fi);
875
                        }
876
                        FreeSkb(skb);
877
                        return;
878
                }
879
        } else {
880
                if (skb->len == 1) {
881
                        PollFlag = (skb->data[0] & 0x10);
882
                        nr = (skb->data[0] >> 5) & 0x7;
883
                } else {
884
                        st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'N');
885
                        FreeSkb(skb);
886
                        establishlink(fi);
887
                        return;
888
                }
889
        }
890
        FreeSkb(skb);
891
 
892
        if ((!rsp) && PollFlag)
893
                enquiry_response(st);
894
        if (rsp && PollFlag)
895
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'A');
896
        if (legalnr(st, nr)) {
897
                if (typ == REJ) {
898
                        setva(st, nr);
899
                        invoke_retransmission(st, nr);
900
                        if (test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
901
                                FsmDelTimer(&st->l2.t200, 9);
902
                        if (FsmAddTimer(&st->l2.t203, st->l2.T203,
903
                                        EV_L2_T203, NULL, 6))
904
                                l2m_debug(&st->l2.l2m, "Restart T203 ST7 REJ");
905
                } else if ((nr == l2->vs) && (typ == RR)) {
906
                        setva(st, nr);
907
                        if (test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
908
                                FsmDelTimer(&st->l2.t200, 9);
909
                        FsmRestartTimer(&st->l2.t203, st->l2.T203,
910
                                        EV_L2_T203, NULL, 7);
911
                } else if ((l2->va != nr) || (typ == RNR)) {
912
                        setva(st, nr);
913
                        FsmDelTimer(&st->l2.t203, 9);
914
                        FsmRestartTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 6);
915
                        test_and_set_bit(FLG_T200_RUN, &st->l2.flag);
916
                }
917
                if (skb_queue_len(&st->l2.i_queue) && (typ == RR))
918
                        st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
919
        } else
920
                nrerrorrecovery(fi);
921
 
922
        if ((fi->userint & LC_FLUSH_WAIT) && rsp && !(skb_queue_len(&st->l2.i_queue))) {
923
                fi->userint &= ~LC_FLUSH_WAIT;
924
                st->l2.l2l3(st, DL_FLUSH | INDICATION, NULL);
925
        }
926
}
927
 
928
static void
929
l2_feed_iqueue(struct FsmInst *fi, int event, void *arg)
930
{
931
        struct PStack *st = fi->userdata;
932
        struct sk_buff *skb = arg;
933
 
934
        if (test_bit(FLG_LAPB, &st->l2.flag))
935
                st->l1.bcs->tx_cnt += skb->len + l2headersize(&st->l2, 0);
936
        if (!((fi->state == ST_L2_5) && test_bit(FLG_L3_INIT, &st->l2.flag)))
937
                skb_queue_tail(&st->l2.i_queue, skb);
938
        if (fi->state == ST_L2_7)
939
                st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
940
}
941
 
942
static void
943
l2_got_iframe(struct FsmInst *fi, int event, void *arg)
944
{
945
        struct PStack *st = fi->userdata;
946
        struct sk_buff *skb = arg;
947
        struct Layer2 *l2 = &(st->l2);
948
        int PollFlag, ns, nr, i, rsp;
949
 
950
        rsp = *skb->data & 0x2;
951
        if (test_bit(FLG_ORIG, &l2->flag))
952
                rsp = !rsp;
953
 
954
        if (rsp) {
955
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'L');
956
                FreeSkb(skb);
957
                establishlink(fi);
958
                return;
959
        }
960
        i = l2addrsize(l2);
961
        if (test_bit(FLG_MOD128, &l2->flag)) {
962
                if (skb->len <= (i + 1)) {
963
                        FreeSkb(skb);
964
                        return;
965
                } else if ((skb->len - i - 1) > l2->maxlen) {
966
                        st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'O');
967
                        FreeSkb(skb);
968
                        establishlink(fi);
969
                        return;
970
                }
971
                PollFlag = ((skb->data[i + 1] & 0x1) == 0x1);
972
                ns = skb->data[i] >> 1;
973
                nr = (skb->data[i + 1] >> 1) & 0x7f;
974
        } else {
975
                if (skb->len <= i) {
976
                        st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'N');
977
                        FreeSkb(skb);
978
                        establishlink(fi);
979
                        return;
980
                } else if ((skb->len - i) > l2->maxlen) {
981
                        st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'O');
982
                        FreeSkb(skb);
983
                        establishlink(fi);
984
                        return;
985
                }
986
                PollFlag = (skb->data[i] & 0x10);
987
                ns = (skb->data[i] >> 1) & 0x7;
988
                nr = (skb->data[i] >> 5) & 0x7;
989
        }
990
        if (test_bit(FLG_OWN_BUSY, &l2->flag)) {
991
                FreeSkb(skb);
992
                enquiry_response(st);
993
        } else if (l2->vr == ns) {
994
                l2->vr = (l2->vr + 1) % (test_bit(FLG_MOD128, &l2->flag) ? 128 : 8);
995
                test_and_clear_bit(FLG_REJEXC, &l2->flag);
996
                if (PollFlag)
997
                        enquiry_response(st);
998
                else
999
                        test_and_set_bit(FLG_ACK_PEND, &l2->flag);
1000
                skb_pull(skb, l2headersize(l2, 0));
1001
                st->l2.l2l3(st, DL_DATA | INDICATION, skb);
1002
        } else {
1003
                /* n(s)!=v(r) */
1004
                FreeSkb(skb);
1005
                if (test_and_set_bit(FLG_REJEXC, &l2->flag)) {
1006
                        if (PollFlag)
1007
                                enquiry_response(st);
1008
                } else {
1009
                        enquiry_cr(st, REJ, RSP, PollFlag);
1010
                        test_and_clear_bit(FLG_ACK_PEND, &l2->flag);
1011
                }
1012
        }
1013
 
1014
        if (legalnr(st, nr)) {
1015
                setva(st, nr);
1016
                if (!test_bit(FLG_PEER_BUSY, &st->l2.flag) && (fi->state == ST_L2_7)) {
1017
                        if (nr == st->l2.vs) {
1018
                                if (test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
1019
                                        FsmDelTimer(&st->l2.t200, 10);
1020
                                FsmRestartTimer(&st->l2.t203, st->l2.T203,
1021
                                                EV_L2_T203, NULL, 7);
1022
                        } else if (nr != st->l2.va) {
1023
                                FsmRestartTimer(&st->l2.t200, st->l2.T200, EV_L2_T200,
1024
                                                NULL, 8);
1025
                                test_and_set_bit(FLG_T200_RUN, &st->l2.flag);
1026
                        }
1027
                }
1028
        } else {
1029
                nrerrorrecovery(fi);
1030
                return;
1031
        }
1032
 
1033
        if (skb_queue_len(&st->l2.i_queue) && (fi->state == ST_L2_7))
1034
                st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
1035
        if (test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag))
1036
                enquiry_cr(st, RR, RSP, 0);
1037
}
1038
 
1039
static void
1040
l2_got_tei(struct FsmInst *fi, int event, void *arg)
1041
{
1042
        struct PStack *st = fi->userdata;
1043
 
1044
        st->l2.tei = (long) arg;
1045
 
1046
        if (fi->state == ST_L2_3) {
1047
                establishlink(fi);
1048
                test_and_set_bit(FLG_L3_INIT, &st->l2.flag);
1049
        } else
1050
                FsmChangeState(fi, ST_L2_4);
1051
        if (skb_queue_len(&st->l2.ui_queue))
1052
                l2_send_ui(st);
1053
}
1054
 
1055
static void
1056
l2_st5_tout_200(struct FsmInst *fi, int event, void *arg)
1057
{
1058
        struct PStack *st = fi->userdata;
1059
 
1060
        if (test_bit(FLG_LAPD, &st->l2.flag) &&
1061
                test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) {
1062
                FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 9);
1063
        } else if (st->l2.rc == st->l2.N200) {
1064
                FsmChangeState(fi, ST_L2_4);
1065
                test_and_clear_bit(FLG_T200_RUN, &st->l2.flag);
1066
                discard_queue(&st->l2.i_queue);
1067
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'G');
1068
                if (test_bit(FLG_LAPB, &st->l2.flag))
1069
                        st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL);
1070
                st->l2.l2l3(st, DL_RELEASE | INDICATION, NULL);
1071
        } else {
1072
                st->l2.rc++;
1073
                FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 9);
1074
                send_uframe(st, (test_bit(FLG_MOD128, &st->l2.flag) ? SABME : SABM)
1075
                            | 0x10, CMD);
1076
        }
1077
}
1078
 
1079
static void
1080
l2_st6_tout_200(struct FsmInst *fi, int event, void *arg)
1081
{
1082
        struct PStack *st = fi->userdata;
1083
 
1084
        if (test_bit(FLG_LAPD, &st->l2.flag) &&
1085
                test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) {
1086
                FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 9);
1087
        } else if (st->l2.rc == st->l2.N200) {
1088
                FsmChangeState(fi, ST_L2_4);
1089
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'H');
1090
                if (test_bit(FLG_LAPB, &st->l2.flag))
1091
                        st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL);
1092
                st->l2.l2l3(st, DL_RELEASE | INDICATION, NULL);
1093
        } else {
1094
                st->l2.rc++;
1095
                FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200,
1096
                            NULL, 9);
1097
                send_uframe(st, DISC | 0x10, CMD);
1098
        }
1099
}
1100
 
1101
static void
1102
l2_st78_tout_200(struct FsmInst *fi, int event, void *arg)
1103
{
1104
        struct PStack *st = fi->userdata;
1105
 
1106
        if (test_bit(FLG_LAPD, &st->l2.flag) &&
1107
                test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) {
1108
                FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 9);
1109
                return;
1110
        }
1111
        test_and_clear_bit(FLG_T200_RUN, &st->l2.flag);
1112
        if (fi->state == ST_L2_7) {
1113
                st->l2.rc = 0;
1114
                FsmChangeState(fi, ST_L2_8);
1115
        }
1116
        if (st->l2.rc == st->l2.N200) {
1117
                establishlink(fi);
1118
        } else {
1119
                transmit_enquiry(st);
1120
                st->l2.rc++;
1121
        }
1122
}
1123
 
1124
static void
1125
l2_st7_tout_203(struct FsmInst *fi, int event, void *arg)
1126
{
1127
        struct PStack *st = fi->userdata;
1128
 
1129
        if (test_bit(FLG_LAPD, &st->l2.flag) &&
1130
                test_bit(FLG_DCHAN_BUSY, &st->l2.flag)) {
1131
                FsmAddTimer(&st->l2.t203, st->l2.T203, EV_L2_T203, NULL, 9);
1132
                return;
1133
        }
1134
        FsmChangeState(fi, ST_L2_8);
1135
        transmit_enquiry(st);
1136
        st->l2.rc = 0;
1137
}
1138
 
1139
static void
1140
l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
1141
{
1142
        struct PStack *st = fi->userdata;
1143
        struct sk_buff *skb, *oskb;
1144
        struct Layer2 *l2 = &st->l2;
1145
        u_char header[MAX_HEADER_LEN];
1146
        int p1, i;
1147
 
1148
        if (!cansend(st))
1149
                return;
1150
 
1151
        skb = skb_dequeue(&l2->i_queue);
1152
        if (!skb)
1153
                return;
1154
 
1155
        p1 = l2->vs - l2->va;
1156
        if (p1 < 0)
1157
                p1 += test_bit(FLG_MOD128, &l2->flag) ? 128 : 8;
1158
        p1 = (p1 + l2->sow) % l2->window;
1159
        if (l2->windowar[p1]) {
1160
                printk(KERN_WARNING "isdnl2 try overwrite ack queue entry %d\n",
1161
                       p1);
1162
                dev_kfree_skb(l2->windowar[p1], FREE_WRITE);
1163
        }
1164
        l2->windowar[p1] = skb_clone(skb, GFP_ATOMIC);
1165
 
1166
        i = sethdraddr(&st->l2, header, CMD);
1167
 
1168
        if (test_bit(FLG_MOD128, &l2->flag)) {
1169
                header[i++] = l2->vs << 1;
1170
                header[i++] = l2->vr << 1;
1171
                l2->vs = (l2->vs + 1) % 128;
1172
        } else {
1173
                header[i++] = (l2->vr << 5) | (l2->vs << 1);
1174
                l2->vs = (l2->vs + 1) % 8;
1175
        }
1176
        p1 = skb->data - skb->head;
1177
        if (p1 >= i)
1178
                memcpy(skb_push(skb, i), header, i);
1179
        else {
1180
                printk(KERN_WARNING
1181
                "isdl2 pull_iqueue skb header(%d/%d) too short\n", i, p1);
1182
                oskb = skb;
1183
                skb = alloc_skb(oskb->len + i, GFP_ATOMIC);
1184
                SET_SKB_FREE(skb);
1185
                memcpy(skb_put(skb, i), header, i);
1186
                memcpy(skb_put(skb, oskb->len), oskb->data, oskb->len);
1187
                FreeSkb(oskb);
1188
        }
1189
        st->l2.l2l1(st, PH_PULL | INDICATION, skb);
1190
        test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag);
1191
        if (!test_and_set_bit(FLG_T200_RUN, &st->l2.flag)) {
1192
                FsmDelTimer(&st->l2.t203, 13);
1193
                FsmAddTimer(&st->l2.t200, st->l2.T200, EV_L2_T200, NULL, 11);
1194
        }
1195
        if (skb_queue_len(&l2->i_queue) && cansend(st))
1196
                st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
1197
}
1198
 
1199
static void
1200
l2_got_st8_super(struct FsmInst *fi, int event, void *arg)
1201
{
1202
        struct PStack *st = fi->userdata;
1203
        struct sk_buff *skb = arg;
1204
        int PollFlag, nr, rsp, rnr = 0;
1205
        struct Layer2 *l2 = &st->l2;
1206
 
1207
        rsp = *skb->data & 0x2;
1208
        if (test_bit(FLG_ORIG, &l2->flag))
1209
                rsp = !rsp;
1210
        skb_pull(skb, l2addrsize(l2));
1211
 
1212
        if (IsRNR(skb->data, test_bit(FLG_MOD128, &l2->flag))) {
1213
                test_and_set_bit(FLG_PEER_BUSY, &l2->flag);
1214
                rnr = 1;
1215
        } else
1216
                test_and_clear_bit(FLG_PEER_BUSY, &l2->flag);
1217
        if (test_bit(FLG_MOD128, &l2->flag)) {
1218
                if (skb->len == 2) {
1219
                        PollFlag = (skb->data[1] & 0x1) == 0x1;
1220
                        nr = skb->data[1] >> 1;
1221
                } else {
1222
                        st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'N');
1223
                        FreeSkb(skb);
1224
                        establishlink(fi);
1225
                        return;
1226
                }
1227
        } else {
1228
                if (skb->len == 1) {
1229
                        PollFlag = (skb->data[0] & 0x10);
1230
                        nr = (skb->data[0] >> 5) & 0x7;
1231
                } else {
1232
                        st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'N');
1233
                        FreeSkb(skb);
1234
                        establishlink(fi);
1235
                        return;
1236
                }
1237
        }
1238
        FreeSkb(skb);
1239
 
1240
        if (rsp && PollFlag) {
1241
                if (legalnr(st, nr)) {
1242
                        setva(st, nr);
1243
                        if (test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
1244
                                FsmDelTimer(&st->l2.t200, 7);
1245
                        FsmDelTimer(&l2->t203, 8);
1246
                        if (rnr) {
1247
                                FsmRestartTimer(&l2->t200, l2->T200,
1248
                                                EV_L2_T200, NULL, 14);
1249
                                test_and_set_bit(FLG_T200_RUN, &st->l2.flag);
1250
                        } else
1251
                                FsmAddTimer(&l2->t203, l2->T203,
1252
                                            EV_L2_T203, NULL, 5);
1253
                        invoke_retransmission(st, nr);
1254
                        FsmChangeState(fi, ST_L2_7);
1255
                        if (skb_queue_len(&l2->i_queue) && cansend(st))
1256
                                st->l2.l2l1(st, PH_PULL | REQUEST, NULL);
1257
                        else if (fi->userint & LC_FLUSH_WAIT) {
1258
                                fi->userint &= ~LC_FLUSH_WAIT;
1259
                                st->l2.l2l3(st, DL_FLUSH | INDICATION, NULL);
1260
                        }
1261
                }
1262
        } else {
1263
                if (!rsp && PollFlag)
1264
                        enquiry_response(st);
1265
                if (legalnr(st, nr)) {
1266
                        setva(st, nr);
1267
                }
1268
        }
1269
}
1270
 
1271
static void
1272
l2_got_FRMR(struct FsmInst *fi, int event, void *arg)
1273
{
1274
        struct PStack *st = fi->userdata;
1275
        struct sk_buff *skb = arg;
1276
 
1277
        skb_pull(skb, l2addrsize(&st->l2) + 1);
1278
        if (test_bit(FLG_MOD128, &st->l2.flag)) {
1279
                if (skb->len < 5)
1280
                        st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'N');
1281
                else
1282
                        l2m_debug(&st->l2.l2m, "FRMR information %2x %2x %2x %2x %2x",
1283
                                skb->data[0], skb->data[1], skb->data[2],
1284
                                skb->data[3], skb->data[4]);
1285
        } else {
1286
                if (skb->len < 3)
1287
                        st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'N');
1288
                else
1289
                        l2m_debug(&st->l2.l2m, "FRMR information %2x %2x %2x",
1290
                                skb->data[0], skb->data[1], skb->data[2]);
1291
        }
1292
        if (!(skb->data[0] & 1) || ((skb->data[0] & 3) == 1) ||           /* I or S */
1293
            (IsUA(skb->data, 0) && (fi->state == ST_L2_7))) {
1294
                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'K');
1295
                establishlink(fi);
1296
                test_and_clear_bit(FLG_L3_INIT, &st->l2.flag);
1297
        }
1298
        FreeSkb(skb);
1299
}
1300
 
1301
static void
1302
l2_tei_remove(struct FsmInst *fi, int event, void *arg)
1303
{
1304
        struct PStack *st = fi->userdata;
1305
 
1306
        discard_queue(&st->l2.i_queue);
1307
        discard_queue(&st->l2.ui_queue);
1308
        st->l2.tei = -1;
1309
        if (test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
1310
                FsmDelTimer(&st->l2.t200, 18);
1311
        FsmDelTimer(&st->l2.t203, 19);
1312
        if (fi->state != ST_L2_4)
1313
                st->l2.l2l3(st, DL_RELEASE | INDICATION, NULL);
1314
        FsmChangeState(fi, ST_L2_1);
1315
}
1316
 
1317
static void
1318
l2_persistant_da(struct FsmInst *fi, int event, void *arg)
1319
{
1320
        struct PStack *st = fi->userdata;
1321
        int rel = DL_RELEASE | INDICATION;
1322
 
1323
 
1324
        discard_queue(&st->l2.i_queue);
1325
        discard_queue(&st->l2.ui_queue);
1326
        if (test_and_clear_bit(FLG_T200_RUN, &st->l2.flag))
1327
                FsmDelTimer(&st->l2.t200, 18);
1328
        FsmDelTimer(&st->l2.t203, 19);
1329
        clear_exception(&st->l2);
1330
        switch (fi->state) {
1331
                case ST_L2_1:
1332
                        if (!test_and_clear_bit(FLG_ESTAB_PEND, &st->l2.flag))
1333
                                break;
1334
                case ST_L2_3:
1335
                        st->l2.l2l3(st, DL_RELEASE | INDICATION, NULL);
1336
                case ST_L2_2:
1337
                        FsmChangeState(fi, ST_L2_1);
1338
                        break;
1339
                case ST_L2_6:
1340
                        rel = DL_RELEASE | CONFIRM;
1341
                case ST_L2_5:
1342
                        if (test_and_clear_bit(FLG_PEND_REL, &st->l2.flag))
1343
                                rel = DL_RELEASE | CONFIRM;
1344
                case ST_L2_7:
1345
                case ST_L2_8:
1346
                        st->l2.l2l3(st, rel, NULL);
1347
                        FsmChangeState(fi, ST_L2_4);
1348
                        break;
1349
                case ST_L2_4:
1350
                        if (test_and_clear_bit(FLG_ESTAB_PEND, &st->l2.flag))
1351
                                st->l2.l2l3(st, DL_RELEASE | INDICATION, NULL);
1352
                        break;
1353
        }
1354
        test_and_clear_bit(FLG_PEND_REL, &st->l2.flag);
1355
        test_and_clear_bit(FLG_L1_ACTIV, &st->l2.flag);
1356
}
1357
 
1358
static struct FsmNode L2FnList[] HISAX_INITDATA =
1359
{
1360
        {ST_L2_1, EV_L2_DL_ESTABLISH, l2_dl_establish},
1361
        {ST_L2_2, EV_L2_DL_ESTABLISH, l2_dl_establish},
1362
        {ST_L2_4, EV_L2_DL_ESTABLISH, l2_establish},
1363
        {ST_L2_5, EV_L2_DL_ESTABLISH, l2_establish},
1364
        {ST_L2_7, EV_L2_DL_ESTABLISH, l2_establish},
1365
        {ST_L2_8, EV_L2_DL_ESTABLISH, l2_establish},
1366
        {ST_L2_4, EV_L2_DL_RELEASE, l2_dl_release},
1367
        {ST_L2_5, EV_L2_DL_RELEASE, l2_dl_release},
1368
        {ST_L2_7, EV_L2_DL_RELEASE, l2_dl_release},
1369
        {ST_L2_8, EV_L2_DL_RELEASE, l2_dl_release},
1370
        {ST_L2_5, EV_L2_DL_DATA, l2_feed_iqueue},
1371
        {ST_L2_7, EV_L2_DL_DATA, l2_feed_iqueue},
1372
        {ST_L2_8, EV_L2_DL_DATA, l2_feed_iqueue},
1373
        {ST_L2_1, EV_L2_DL_UNIT_DATA, l2_put_ui},
1374
        {ST_L2_2, EV_L2_DL_UNIT_DATA, l2_put_ui},
1375
        {ST_L2_3, EV_L2_DL_UNIT_DATA, l2_put_ui},
1376
        {ST_L2_4, EV_L2_DL_UNIT_DATA, l2_put_ui},
1377
        {ST_L2_5, EV_L2_DL_UNIT_DATA, l2_put_ui},
1378
        {ST_L2_6, EV_L2_DL_UNIT_DATA, l2_put_ui},
1379
        {ST_L2_7, EV_L2_DL_UNIT_DATA, l2_put_ui},
1380
        {ST_L2_8, EV_L2_DL_UNIT_DATA, l2_put_ui},
1381
        {ST_L2_1, EV_L2_MDL_ASSIGN, l2_got_tei},
1382
        {ST_L2_2, EV_L2_MDL_ASSIGN, l2_got_tei},
1383
        {ST_L2_3, EV_L2_MDL_ASSIGN, l2_got_tei},
1384
        {ST_L2_2, EV_L2_MDL_ERROR, l2_tei_remove},
1385
        {ST_L2_3, EV_L2_MDL_ERROR, l2_tei_remove},
1386
        {ST_L2_4, EV_L2_MDL_REMOVE, l2_tei_remove},
1387
        {ST_L2_5, EV_L2_MDL_REMOVE, l2_tei_remove},
1388
        {ST_L2_6, EV_L2_MDL_REMOVE, l2_tei_remove},
1389
        {ST_L2_7, EV_L2_MDL_REMOVE, l2_tei_remove},
1390
        {ST_L2_8, EV_L2_MDL_REMOVE, l2_tei_remove},
1391
        {ST_L2_4, EV_L2_SABMX, l2_got_SABMX},
1392
        {ST_L2_5, EV_L2_SABMX, l2_got_SABMX},
1393
        {ST_L2_6, EV_L2_SABMX, l2_got_SABMX},
1394
        {ST_L2_7, EV_L2_SABMX, l2_got_SABMX},
1395
        {ST_L2_8, EV_L2_SABMX, l2_got_SABMX},
1396
        {ST_L2_4, EV_L2_DISC, l2_got_disconn},
1397
        {ST_L2_5, EV_L2_DISC, l2_got_disconn},
1398
        {ST_L2_6, EV_L2_DISC, l2_got_disconn},
1399
        {ST_L2_7, EV_L2_DISC, l2_got_disconn},
1400
        {ST_L2_8, EV_L2_DISC, l2_got_disconn},
1401
        {ST_L2_4, EV_L2_UA, l2_mdl_error},
1402
        {ST_L2_5, EV_L2_UA, l2_got_ua},
1403
        {ST_L2_6, EV_L2_UA, l2_got_ua},
1404
        {ST_L2_7, EV_L2_UA, l2_mdl_error},
1405
        {ST_L2_8, EV_L2_UA, l2_mdl_error},
1406
        {ST_L2_4, EV_L2_DM, l2_got_dm},
1407
        {ST_L2_5, EV_L2_DM, l2_got_dm},
1408
        {ST_L2_6, EV_L2_DM, l2_got_dm},
1409
        {ST_L2_7, EV_L2_DM, l2_got_dm},
1410
        {ST_L2_8, EV_L2_DM, l2_got_dm},
1411
        {ST_L2_1, EV_L2_UI, l2_got_ui},
1412
        {ST_L2_2, EV_L2_UI, l2_got_ui},
1413
        {ST_L2_3, EV_L2_UI, l2_got_ui},
1414
        {ST_L2_4, EV_L2_UI, l2_got_ui},
1415
        {ST_L2_5, EV_L2_UI, l2_got_ui},
1416
        {ST_L2_6, EV_L2_UI, l2_got_ui},
1417
        {ST_L2_7, EV_L2_UI, l2_got_ui},
1418
        {ST_L2_8, EV_L2_UI, l2_got_ui},
1419
        {ST_L2_7, EV_L2_FRMR, l2_got_FRMR},
1420
        {ST_L2_8, EV_L2_FRMR, l2_got_FRMR},
1421
        {ST_L2_7, EV_L2_SUPER, l2_got_st7_super},
1422
        {ST_L2_8, EV_L2_SUPER, l2_got_st8_super},
1423
        {ST_L2_7, EV_L2_I, l2_got_iframe},
1424
        {ST_L2_8, EV_L2_I, l2_got_iframe},
1425
        {ST_L2_5, EV_L2_T200, l2_st5_tout_200},
1426
        {ST_L2_6, EV_L2_T200, l2_st6_tout_200},
1427
        {ST_L2_7, EV_L2_T200, l2_st78_tout_200},
1428
        {ST_L2_8, EV_L2_T200, l2_st78_tout_200},
1429
        {ST_L2_7, EV_L2_T203, l2_st7_tout_203},
1430
        {ST_L2_7, EV_L2_ACK_PULL, l2_pull_iqueue},
1431
        {ST_L2_1, EV_L1_DEACTIVATE, l2_persistant_da},
1432
        {ST_L2_2, EV_L1_DEACTIVATE, l2_persistant_da},
1433
        {ST_L2_3, EV_L1_DEACTIVATE, l2_persistant_da},
1434
        {ST_L2_4, EV_L1_DEACTIVATE, l2_persistant_da},
1435
        {ST_L2_5, EV_L1_DEACTIVATE, l2_persistant_da},
1436
        {ST_L2_6, EV_L1_DEACTIVATE, l2_persistant_da},
1437
        {ST_L2_7, EV_L1_DEACTIVATE, l2_persistant_da},
1438
        {ST_L2_8, EV_L1_DEACTIVATE, l2_persistant_da},
1439
};
1440
 
1441
#define L2_FN_COUNT (sizeof(L2FnList)/sizeof(struct FsmNode))
1442
 
1443
static void
1444
isdnl2_l1l2(struct PStack *st, int pr, void *arg)
1445
{
1446
        struct sk_buff *skb = arg;
1447
        u_char *datap;
1448
        int ret = 1, len;
1449
 
1450
        switch (pr) {
1451
                case (PH_DATA | INDICATION):
1452
                        datap = skb->data;
1453
                        len = l2addrsize(&st->l2);
1454
                        if (skb->len > len)
1455
                                datap += len;
1456
                        else {
1457
                                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'N');
1458
                                FreeSkb(skb);
1459
                                return;
1460
                        }
1461
                        if (!(*datap & 1))      /* I-Frame */
1462
                                ret = FsmEvent(&st->l2.l2m, EV_L2_I, skb);
1463
                        else if (IsSFrame(datap, test_bit(FLG_MOD128, &st->l2.flag)))
1464
                                ret = FsmEvent(&st->l2.l2m, EV_L2_SUPER, skb);
1465
                        else if (IsUI(datap, test_bit(FLG_MOD128, &st->l2.flag)))
1466
                                ret = FsmEvent(&st->l2.l2m, EV_L2_UI, skb);
1467
                        else if (IsSABMX(datap, test_bit(FLG_MOD128, &st->l2.flag)))
1468
                                ret = FsmEvent(&st->l2.l2m, EV_L2_SABMX, skb);
1469
                        else if (IsUA(datap, test_bit(FLG_MOD128, &st->l2.flag)))
1470
                                ret = FsmEvent(&st->l2.l2m, EV_L2_UA, skb);
1471
                        else if (IsDISC(datap, test_bit(FLG_MOD128, &st->l2.flag)))
1472
                                ret = FsmEvent(&st->l2.l2m, EV_L2_DISC, skb);
1473
                        else if (IsDM(datap, test_bit(FLG_MOD128, &st->l2.flag)))
1474
                                ret = FsmEvent(&st->l2.l2m, EV_L2_DM, skb);
1475
                        else if (IsFRMR(datap, test_bit(FLG_MOD128, &st->l2.flag)))
1476
                                ret = FsmEvent(&st->l2.l2m, EV_L2_FRMR, skb);
1477
                        else {
1478
                                ret = 1;
1479
                                if ((st->l2.l2m.state == ST_L2_7) ||
1480
                                        (st->l2.l2m.state == ST_L2_8))
1481
                                        establishlink(&st->l2.l2m);
1482
                                st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'L');
1483
                        }
1484
                        if (ret) {
1485
                                FreeSkb(skb);
1486
                        }
1487
                        break;
1488
                case (PH_PULL | CONFIRM):
1489
                        FsmEvent(&st->l2.l2m, EV_L2_ACK_PULL, arg);
1490
                        break;
1491
                case (PH_PAUSE | INDICATION):
1492
                        test_and_set_bit(FLG_DCHAN_BUSY, &st->l2.flag);
1493
                        break;
1494
                case (PH_PAUSE | CONFIRM):
1495
                        test_and_clear_bit(FLG_DCHAN_BUSY, &st->l2.flag);
1496
                        break;
1497
                case (PH_ACTIVATE | CONFIRM):
1498
                case (PH_ACTIVATE | INDICATION):
1499
                        test_and_set_bit(FLG_L1_ACTIV, &st->l2.flag);
1500
                        if (test_and_clear_bit(FLG_ESTAB_PEND, &st->l2.flag))
1501
                                FsmEvent(&st->l2.l2m, EV_L2_DL_ESTABLISH, arg);
1502
                        break;
1503
                case (PH_DEACTIVATE | INDICATION):
1504
                case (PH_DEACTIVATE | CONFIRM):
1505
                        test_and_clear_bit(FLG_L1_ACTIV, &st->l2.flag);
1506
                        FsmEvent(&st->l2.l2m, EV_L1_DEACTIVATE, arg);
1507
                        break;
1508
                default:
1509
                        l2m_debug(&st->l2.l2m, "l2 unknown pr %04x", pr);
1510
                        break;
1511
        }
1512
}
1513
 
1514
static void
1515
isdnl2_l3l2(struct PStack *st, int pr, void *arg)
1516
{
1517
        switch (pr) {
1518
                case (DL_DATA | REQUEST):
1519
                        if (FsmEvent(&st->l2.l2m, EV_L2_DL_DATA, arg)) {
1520
                                dev_kfree_skb((struct sk_buff *) arg, FREE_READ);
1521
                        }
1522
                        break;
1523
                case (DL_UNIT_DATA | REQUEST):
1524
                        if (FsmEvent(&st->l2.l2m, EV_L2_DL_UNIT_DATA, arg)) {
1525
                                dev_kfree_skb((struct sk_buff *) arg, FREE_READ);
1526
                        }
1527
                        break;
1528
                case (DL_ESTABLISH | REQUEST):
1529
                        if (test_bit(FLG_L1_ACTIV, &st->l2.flag)) {
1530
                                if (test_bit(FLG_LAPD, &st->l2.flag) ||
1531
                                        test_bit(FLG_ORIG, &st->l2.flag)) {
1532
                                        FsmEvent(&st->l2.l2m, EV_L2_DL_ESTABLISH, arg);
1533
                                }
1534
                        } else {
1535
                                if (test_bit(FLG_LAPD, &st->l2.flag) ||
1536
                                        test_bit(FLG_ORIG, &st->l2.flag)) {
1537
                                        test_and_set_bit(FLG_ESTAB_PEND, &st->l2.flag);
1538
                                }
1539
                                st->l2.l2l1(st, PH_ACTIVATE, NULL);
1540
                        }
1541
                        break;
1542
                case (DL_RELEASE | REQUEST):
1543
                        if (test_bit(FLG_LAPB, &st->l2.flag)) {
1544
                                st->l2.l2l1(st, PH_DEACTIVATE, NULL);
1545
                        }
1546
                        FsmEvent(&st->l2.l2m, EV_L2_DL_RELEASE, arg);
1547
                        break;
1548
                case (DL_FLUSH | REQUEST):
1549
                        (&st->l2.l2m)->userint |= LC_FLUSH_WAIT;
1550
                        break;
1551
                case (MDL_ASSIGN | REQUEST):
1552
                        FsmEvent(&st->l2.l2m, EV_L2_MDL_ASSIGN, arg);
1553
                        break;
1554
                case (MDL_REMOVE | REQUEST):
1555
                        FsmEvent(&st->l2.l2m, EV_L2_MDL_REMOVE, arg);
1556
                        break;
1557
                case (MDL_ERROR | RESPONSE):
1558
                        FsmEvent(&st->l2.l2m, EV_L2_MDL_ERROR, arg);
1559
                        break;
1560
        }
1561
}
1562
 
1563
void
1564
releasestack_isdnl2(struct PStack *st)
1565
{
1566
        FsmDelTimer(&st->l2.t200, 15);
1567
        FsmDelTimer(&st->l2.t203, 16);
1568
        discard_queue(&st->l2.i_queue);
1569
        discard_queue(&st->l2.ui_queue);
1570
        ReleaseWin(&st->l2);
1571
}
1572
 
1573
static void
1574
l2m_debug(struct FsmInst *fi, char *fmt, ...)
1575
{
1576
        va_list args;
1577
        struct PStack *st = fi->userdata;
1578
 
1579
        va_start(args, fmt);
1580
        VHiSax_putstatus(st->l1.hardware, st->l2.debug_id, fmt, args);
1581
        va_end(args);
1582
}
1583
 
1584
void
1585
setstack_isdnl2(struct PStack *st, char *debug_id)
1586
{
1587
        st->l1.l1l2 = isdnl2_l1l2;
1588
        st->l3.l3l2 = isdnl2_l3l2;
1589
 
1590
        skb_queue_head_init(&st->l2.i_queue);
1591
        skb_queue_head_init(&st->l2.ui_queue);
1592
        InitWin(&st->l2);
1593
        st->l2.debug = 0;
1594
 
1595
        st->l2.l2m.fsm = &l2fsm;
1596
        if (test_bit(FLG_LAPB, &st->l2.flag))
1597
                st->l2.l2m.state = ST_L2_4;
1598
        else
1599
        st->l2.l2m.state = ST_L2_1;
1600
        st->l2.l2m.debug = 0;
1601
        st->l2.l2m.userdata = st;
1602
        st->l2.l2m.userint = 0;
1603
        st->l2.l2m.printdebug = l2m_debug;
1604
        strcpy(st->l2.debug_id, debug_id);
1605
 
1606
        FsmInitTimer(&st->l2.l2m, &st->l2.t200);
1607
        FsmInitTimer(&st->l2.l2m, &st->l2.t203);
1608
}
1609
 
1610
static void
1611
transl2_l3l2(struct PStack *st, int pr, void *arg)
1612
{
1613
        switch (pr) {
1614
                case (DL_DATA | REQUEST):
1615
                case (DL_UNIT_DATA | REQUEST):
1616
                        st->l2.l2l1(st, PH_DATA | REQUEST, arg);
1617
                        break;
1618
                case (DL_ESTABLISH | REQUEST):
1619
                        st->l2.l2l1(st, PH_ACTIVATE | REQUEST, NULL);
1620
                        break;
1621
                case (DL_RELEASE | REQUEST):
1622
                        st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL);
1623
                        break;
1624
        }
1625
}
1626
 
1627
void
1628
setstack_transl2(struct PStack *st)
1629
{
1630
        st->l3.l3l2 = transl2_l3l2;
1631
}
1632
 
1633
void
1634
releasestack_transl2(struct PStack *st)
1635
{
1636
}
1637
 
1638
HISAX_INITFUNC(void
1639
Isdnl2New(void))
1640
{
1641
        l2fsm.state_count = L2_STATE_COUNT;
1642
        l2fsm.event_count = L2_EVENT_COUNT;
1643
        l2fsm.strEvent = strL2Event;
1644
        l2fsm.strState = strL2State;
1645
        FsmNew(&l2fsm, L2FnList, L2_FN_COUNT);
1646
}
1647
 
1648
void
1649
Isdnl2Free(void)
1650
{
1651
        FsmFree(&l2fsm);
1652
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.