Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 1
/*****************************************************************************
2
* sdla_fr.h     Sangoma frame relay firmware API definitions.
3
*
4
* Author:       Gideon Hack    
5
*               Nenad Corbic <ncorbic@sangoma.com>      
6
*
7
* Copyright:    (c) 1995-2000 Sangoma Technologies Inc.
8
*
9
*               This program is free software; you can redistribute it and/or
10
*               modify it under the terms of the GNU General Public License
11
*               as published by the Free Software Foundation; either version
12
*               2 of the License, or (at your option) any later version.
13
* ============================================================================
14
* Oct 04, 1999  Gideon Hack     Updated API structures
15
* Jun 02, 1999  Gideon Hack     Modifications for S514 support
16
* Oct 12, 1997  Jaspreet Singh  Added FR_READ_DLCI_IB_MAPPING
17
* Jul 21, 1997  Jaspreet Singh  Changed FRRES_TOO_LONG and FRRES_TOO_MANY to
18
*                               0x05 and 0x06 respectively.
19
* Dec 23, 1996  Gene Kozin      v2.0
20
* Apr 29, 1996  Gene Kozin      v1.0 (merged version S502 & S508 definitions).
21
* Sep 26, 1995  Gene Kozin      Initial version.
22
*****************************************************************************/
23
#ifndef _SDLA_FR_H
24
#define _SDLA_FR_H
25
 
26
/*----------------------------------------------------------------------------
27
 * Notes:
28
 * ------
29
 * 1. All structures defined in this file are byte-alined.  
30
 *
31
 *      Compiler        Platform
32
 *      --------        --------
33
 *      GNU C           Linux
34
 */
35
 
36
#ifndef PACKED
37
#    define     PACKED  __attribute__((packed))
38
#endif  /* PACKED */
39
 
40
/* Adapter memory layout */
41
#define FR_MB_VECTOR    0xE000  /* mailbox window vector */
42
#define FR502_RX_VECTOR 0xA000  /* S502 direct receive window vector */
43
#define FR502_MBOX_OFFS 0xF60   /* S502 mailbox offset */
44
#define FR508_MBOX_OFFS 0       /* S508 mailbox offset */
45
#define FR502_FLAG_OFFS 0x1FF0  /* S502 status flags offset */
46
#define FR508_FLAG_OFFS 0x1000  /* S508 status flags offset */
47
#define FR502_RXMB_OFFS 0x900   /* S502 direct receive mailbox offset */
48
#define FR508_TXBC_OFFS 0x1100  /* S508 Tx buffer info offset */
49
#define FR508_RXBC_OFFS 0x1120  /* S508 Rx buffer info offset */
50
 
51
/* Important constants */
52
#define FR502_MAX_DATA  4096    /* maximum data buffer length */
53
#define FR508_MAX_DATA  4080    /* maximum data buffer length */
54
#define MIN_LGTH_FR_DATA_CFG         300     /* min Information frame length
55
(for configuration purposes) */
56
#define FR_MAX_NO_DATA_BYTES_IN_FRAME  15354    /* max Information frame length */
57
 
58
#define HIGHEST_VALID_DLCI      991
59
 
60
/****** Data Structures *****************************************************/
61
 
62
/*----------------------------------------------------------------------------
63
 * Frame relay command block.
64
 */
65
typedef struct fr_cmd
66
{
67
        unsigned char  command  PACKED; /* command code */
68
        unsigned short length   PACKED; /* length of data buffer */
69
        unsigned char  result   PACKED; /* return code */
70
        unsigned short dlci     PACKED; /* DLCI number */
71
        unsigned char  attr     PACKED; /* FECN, BECN, DE and C/R bits */
72
        unsigned short rxlost1  PACKED; /* frames discarded at int. level */
73
        unsigned long  rxlost2  PACKED; /* frames discarded at app. level */
74
        unsigned char  rsrv[2]  PACKED; /* reserved for future use */
75
} fr_cmd_t;
76
 
77
/* 'command' field defines */
78
#define FR_WRITE                0x01
79
#define FR_READ                 0x02
80
#define FR_ISSUE_IS_FRAME       0x03
81
#define FR_SET_CONFIG           0x10
82
#define FR_READ_CONFIG          0x11
83
#define FR_COMM_DISABLE         0x12
84
#define FR_COMM_ENABLE          0x13
85
#define FR_READ_STATUS          0x14
86
#define FR_READ_STATISTICS      0x15
87
#define FR_FLUSH_STATISTICS     0x16
88
#define FR_LIST_ACTIVE_DLCI     0x17
89
#define FR_FLUSH_DATA_BUFFERS   0x18
90
#define FR_READ_ADD_DLC_STATS   0x19
91
#define FR_ADD_DLCI             0x20
92
#define FR_DELETE_DLCI          0x21
93
#define FR_ACTIVATE_DLCI        0x22
94
#define FR_DEACTIVATE_DLCI      0x22
95
#define FR_READ_MODEM_STATUS    0x30
96
#define FR_SET_MODEM_STATUS     0x31
97
#define FR_READ_ERROR_STATS     0x32
98
#define FR_FLUSH_ERROR_STATS    0x33
99
#define FR_READ_DLCI_IB_MAPPING 0x34
100
#define FR_READ_CODE_VERSION    0x40
101
#define FR_SET_INTR_MODE        0x50
102
#define FR_READ_INTR_MODE       0x51
103
#define FR_SET_TRACE_CONFIG     0x60
104
#define FR_FT1_STATUS_CTRL      0x80
105
#define FR_SET_FT1_MODE         0x81
106
 
107
/* Special UDP drivers management commands */
108
#define FPIPE_ENABLE_TRACING            0x41
109
#define FPIPE_DISABLE_TRACING           0x42
110
#define FPIPE_GET_TRACE_INFO            0x43
111
#define FPIPE_FT1_READ_STATUS           0x44
112
#define FPIPE_DRIVER_STAT_IFSEND        0x45
113
#define FPIPE_DRIVER_STAT_INTR          0x46
114
#define FPIPE_DRIVER_STAT_GEN           0x47
115
#define FPIPE_FLUSH_DRIVER_STATS        0x48
116
#define FPIPE_ROUTER_UP_TIME            0x49
117
 
118
/* 'result' field defines */
119
#define FRRES_OK                0x00    /* command executed successfully */
120
#define FRRES_DISABLED          0x01    /* communications not enabled */
121
#define FRRES_INOPERATIVE       0x02    /* channel inoperative */
122
#define FRRES_DLCI_INACTIVE     0x03    /* DLCI is inactive */
123
#define FRRES_DLCI_INVALID      0x04    /* DLCI is not configured */
124
#define FRRES_TOO_LONG          0x05
125
#define FRRES_TOO_MANY          0x06
126
#define FRRES_CIR_OVERFLOW      0x07    /* Tx throughput has exceeded CIR */
127
#define FRRES_BUFFER_OVERFLOW   0x08
128
#define FRRES_MODEM_FAILURE     0x10    /* DCD and/or CTS dropped */
129
#define FRRES_CHANNEL_DOWN      0x11    /* channel became inoperative */
130
#define FRRES_CHANNEL_UP        0x12    /* channel became operative */
131
#define FRRES_DLCI_CHANGE       0x13    /* DLCI status (or number) changed */
132
#define FRRES_DLCI_MISMATCH     0x14
133
#define FRRES_INVALID_CMD       0x1F    /* invalid command */
134
 
135
/* 'attr' field defines */
136
#define FRATTR_
137
 
138
/*----------------------------------------------------------------------------
139
 * Frame relay mailbox.
140
 *      This structure is located at offset FR50?_MBOX_OFFS into FR_MB_VECTOR.
141
 *      For S502 it is also located at offset FR502_RXMB_OFFS into
142
 *      FR502_RX_VECTOR.
143
 */
144
typedef struct fr_mbox
145
{
146
        unsigned char opflag    PACKED; /* 00h: execution flag */
147
        fr_cmd_t cmd            PACKED; /* 01h: command block */
148
        unsigned char data[1]   PACKED; /* 10h: variable length data buffer */
149
} fr_mbox_t;
150
 
151
/*----------------------------------------------------------------------------
152
 * S502 frame relay status flags.
153
 *      This structure is located at offset FR502_FLAG_OFFS into FR_MB_VECTOR.
154
 */
155
typedef struct  fr502_flags
156
{      
157
        unsigned char rsrv1[1]  PACKED; /* 00h: */
158
        unsigned char tx_ready  PACKED; /* 01h: Tx buffer available */
159
        unsigned char rx_ready  PACKED; /* 02h: Rx frame available */
160
        unsigned char event     PACKED; /* 03h: asynchronous event */
161
        unsigned char mstatus   PACKED; /* 04h: modem status */
162
        unsigned char rsrv2[8]  PACKED; /* 05h: */
163
        unsigned char iflag     PACKED; /* 0Dh: interrupt flag */
164
        unsigned char imask     PACKED; /* 0Eh: interrupt mask */
165
} fr502_flags_t;
166
 
167
/*----------------------------------------------------------------------------
168
 * S508 frame relay status flags.
169
 *      This structure is located at offset FR508_FLAG_OFFS into FR_MB_VECTOR.
170
 */
171
typedef struct  fr508_flags
172
{
173
        unsigned char rsrv1[3]  PACKED; /* 00h: reserved */
174
        unsigned char event     PACKED; /* 03h: asynchronous event */
175
        unsigned char mstatus   PACKED; /* 04h: modem status */
176
        unsigned char rsrv2[11] PACKED; /* 05h: reserved */
177
        unsigned char iflag     PACKED; /* 10h: interrupt flag */
178
        unsigned char imask     PACKED; /* 11h: interrupt mask */
179
        unsigned long tse_offs  PACKED; /* 12h: Tx status element */
180
        unsigned short dlci     PACKED; /* 16h: DLCI NUMBER */
181
} fr508_flags_t;
182
 
183
/* 'event' field defines */
184
#define FR_EVENT_STATUS         0x01    /* channel status change */
185
#define FR_EVENT_DLC_STATUS     0x02    /* DLC status change */
186
#define FR_EVENT_BAD_DLCI       0x04    /* FSR included wrong DLCI */
187
#define FR_EVENT_LINK_DOWN      0x40    /* DCD or CTS low */
188
 
189
/* 'mstatus' field defines */
190
#define FR_MDM_DCD              0x08    /* mdm_status: DCD */
191
#define FR_MDM_CTS              0x20    /* mdm_status: CTS */
192
 
193
/* 'iflag' & 'imask' fields defines */
194
#define FR_INTR_RXRDY           0x01    /* Rx ready */
195
#define FR_INTR_TXRDY           0x02    /* Tx ready */
196
#define FR_INTR_MODEM           0x04    /* modem status change (DCD, CTS) */
197
#define FR_INTR_READY           0x08    /* interface command completed */
198
#define FR_INTR_DLC             0x10    /* DLC status change */
199
#define FR_INTR_TIMER           0x20    /* millisecond timer */
200
#define FR_INTR_TX_MULT_DLCIs   0x80    /* Tx interrupt on multiple DLCIs */
201
 
202
 
203
/*----------------------------------------------------------------------------
204
 * Receive Buffer Configuration Info. S508 only!
205
 *      This structure is located at offset FR508_RXBC_OFFS into FR_MB_VECTOR.
206
 */
207
typedef struct  fr_buf_info
208
{
209
        unsigned short rse_num  PACKED; /* 00h: number of status elements */
210
        unsigned long rse_base  PACKED; /* 02h: receive status array base */
211
        unsigned long rse_next  PACKED; /* 06h: next status element */
212
        unsigned long buf_base  PACKED; /* 0Ah: rotational buffer base */
213
        unsigned short reserved PACKED; /* 0Eh:  */
214
        unsigned long buf_top   PACKED; /* 10h: rotational buffer top */
215
} fr_buf_info_t;
216
 
217
/*----------------------------------------------------------------------------
218
 * Buffer Status Element. S508 only!
219
 *      Array of structures of this type is located at offset defined by the
220
 *      'rse_base' field of the frBufInfo_t structure into absolute adapter
221
 *      memory address space.
222
 */
223
typedef struct  fr_rx_buf_ctl
224
{
225
        unsigned char flag      PACKED; /* 00h: ready flag */
226
        unsigned short length   PACKED; /* 01h: frame length */
227
        unsigned short dlci     PACKED; /* 03h: DLCI */
228
        unsigned char attr      PACKED; /* 05h: FECN/BECN/DE/CR */
229
        unsigned short tmstamp  PACKED; /* 06h: time stamp */
230
        unsigned short rsrv[2]  PACKED; /* 08h:  */
231
        unsigned long offset    PACKED; /* 0Ch: buffer absolute address */
232
} fr_rx_buf_ctl_t;
233
 
234
typedef struct  fr_tx_buf_ctl
235
{
236
        unsigned char flag      PACKED; /* 00h: ready flag */
237
        unsigned short rsrv0[2] PACKED; /* 01h: */
238
        unsigned short length   PACKED; /* 05h: frame length */
239
        unsigned short dlci     PACKED; /* 07h: DLCI */
240
        unsigned char attr      PACKED; /* 09h: FECN/BECN/DE/CR */
241
        unsigned short rsrv1    PACKED; /* 0Ah:  */
242
        unsigned long offset    PACKED; /* 0Ch: buffer absolute address */
243
} fr_tx_buf_ctl_t;
244
 
245
/*----------------------------------------------------------------------------
246
 * Global Configuration Block. Passed to FR_SET_CONFIG command when dlci == 0.
247
 */
248
typedef struct  fr_conf
249
{
250
        unsigned short station  PACKED; /* 00h: CPE/Node */
251
        unsigned short options  PACKED; /* 02h: configuration options */
252
        unsigned short kbps     PACKED; /* 04h: baud rate in kbps */
253
        unsigned short port     PACKED; /* 06h: RS-232/V.35 */
254
        unsigned short mtu      PACKED; /* 08h: max. transmit length */
255
        unsigned short t391     PACKED; /* 0Ah:  */
256
        unsigned short t392     PACKED; /* 0Ch:  */
257
        unsigned short n391     PACKED; /* 0Eh:  */
258
        unsigned short n392     PACKED; /* 10h:  */
259
        unsigned short n393     PACKED; /* 12h:  */
260
        unsigned short cir_fwd  PACKED; /* 14h:  */
261
        unsigned short bc_fwd   PACKED; /* 16h:  */
262
        unsigned short be_fwd   PACKED; /* 18h:  */
263
        unsigned short cir_bwd  PACKED; /* 1Ah:  */
264
        unsigned short bc_bwd   PACKED; /* 1Ch:  */
265
        unsigned short be_bwd   PACKED; /* 1Eh:  */
266
        unsigned short dlci[0]  PACKED; /* 20h:  */
267
} fr_conf_t;
268
 
269
/* 'station_type' defines */
270
#define FRCFG_STATION_CPE       0
271
#define FRCFG_STATION_NODE      1
272
 
273
/* 'conf_flags' defines */
274
#define FRCFG_IGNORE_TX_CIR     0x0001
275
#define FRCFG_IGNORE_RX_CIR     0x0002
276
#define FRCFG_DONT_RETRANSMIT   0x0004
277
#define FRCFG_IGNORE_CBS        0x0008
278
#define FRCFG_THROUGHPUT        0x0010  /* enable throughput calculation */
279
#define FRCFG_DIRECT_RX         0x0080  /* enable direct receive buffer */
280
#define FRCFG_AUTO_CONFIG       0x8000  /* enable  auto DLCI configuration */
281
 
282
/* 'baud_rate' defines */
283
#define FRCFG_BAUD_1200         12
284
#define FRCFG_BAUD_2400         24
285
#define FRCFG_BAUD_4800         48
286
#define FRCFG_BAUD_9600         96
287
#define FRCFG_BAUD_19200        19
288
#define FRCFG_BAUD_38400        38
289
#define FRCFG_BAUD_56000        56
290
#define FRCFG_BAUD_64000        64
291
#define FRCFG_BAUD_128000       128
292
 
293
/* 'port_mode' defines */
294
#define FRCFG_MODE_EXT_CLK      0x0000
295
#define FRCFG_MODE_INT_CLK      0x0001
296
#define FRCFG_MODE_V35          0x0000  /* S508 only */
297
#define FRCFG_MODE_RS232        0x0002  /* S508 only */
298
 
299
/* defines for line tracing */
300
 
301
/* the line trace status element presented by the frame relay code */
302
typedef struct {
303
        unsigned char flag      PACKED; /* ready flag */
304
        unsigned short length   PACKED; /* trace length */
305
        unsigned char rsrv0[2]  PACKED; /* reserved */
306
        unsigned char attr      PACKED; /* trace attributes */
307
        unsigned short tmstamp  PACKED; /* time stamp */
308
        unsigned char rsrv1[4]  PACKED; /* reserved */
309
        unsigned long offset    PACKED; /* buffer absolute address */
310
} fr_trc_el_t;
311
 
312
typedef struct {
313
        unsigned char status            PACKED; /* status flag */
314
        unsigned char data_passed       PACKED; /* 0 if no data passed, 1 if */
315
                                                /* data passed */
316
        unsigned short length           PACKED; /* frame length */
317
        unsigned short tmstamp          PACKED; /* time stamp */
318
} fpipemon_trc_hdr_t;
319
 
320
typedef struct {
321
        fpipemon_trc_hdr_t fpipemon_trc_hdr                     PACKED;
322
        unsigned char data[FR_MAX_NO_DATA_BYTES_IN_FRAME]       PACKED;
323
} fpipemon_trc_t;
324
 
325
/* bit settings for the 'status' byte  - note that bits 1, 2 and 3 are used */
326
/* for returning the number of frames being passed to fpipemon */
327
#define TRC_OUTGOING_FRM        0x01
328
#define TRC_ABORT_ERROR         0x10
329
#define TRC_CRC_ERROR           0x20
330
#define TRC_OVERRUN_ERROR       0x40
331
#define MORE_TRC_DATA           0x80
332
 
333
#define MAX_FRMS_TRACED         0x07
334
 
335
#define NO_TRC_ELEMENTS_OFF             0x9000
336
#define BASE_TRC_ELEMENTS_OFF           0x9002
337
#define TRC_ACTIVE                      0x01
338
#define FLUSH_TRC_BUFFERS               0x02
339
#define FLUSH_TRC_STATISTICS            0x04
340
#define TRC_SIGNALLING_FRMS             0x10
341
#define TRC_INFO_FRMS                   0x20
342
#define ACTIVATE_TRC    (TRC_ACTIVE | TRC_SIGNALLING_FRMS | TRC_INFO_FRMS)
343
#define RESET_TRC       (FLUSH_TRC_BUFFERS | FLUSH_TRC_STATISTICS)
344
 
345
/*----------------------------------------------------------------------------
346
 * Channel configuration.
347
 *      This structure is passed to the FR_SET_CONFIG command when dlci != 0.
348
 */
349
typedef struct  fr_dlc_conf
350
{
351
        unsigned short conf_flags       PACKED; /* 00h: configuration bits */
352
        unsigned short cir_fwd          PACKED; /* 02h:  */
353
        unsigned short bc_fwd           PACKED; /* 04h:  */
354
        unsigned short be_fwd           PACKED; /* 06h:  */
355
        unsigned short cir_bwd          PACKED; /* 08h:  */
356
        unsigned short bc_bwd           PACKED; /* 0Ah:  */
357
        unsigned short be_bwd           PACKED; /* 0Ch:  */
358
} fr_dlc_conf_t;
359
 
360
/*----------------------------------------------------------------------------
361
 * S502 interrupt mode control block.
362
 *      This structure is passed to the FR_SET_INTR_FLAGS and returned by the
363
 *      FR_READ_INTR_FLAGS commands.
364
 */
365
typedef struct fr502_intr_ctl
366
{
367
        unsigned char mode      PACKED; /* 00h: interrupt enable flags */
368
        unsigned short tx_len   PACKED; /* 01h: required Tx buffer size */
369
} fr502_intr_ctl_t;
370
 
371
/*----------------------------------------------------------------------------
372
 * S508 interrupt mode control block.
373
 *      This structure is passed to the FR_SET_INTR_FLAGS and returned by the
374
 *      FR_READ_INTR_FLAGS commands.
375
 */
376
typedef struct fr508_intr_ctl
377
{
378
        unsigned char mode      PACKED; /* 00h: interrupt enable flags */
379
        unsigned short tx_len   PACKED; /* 01h: required Tx buffer size */
380
        unsigned char irq       PACKED; /* 03h: IRQ level to activate */
381
        unsigned char flags     PACKED; /* 04h: ?? */
382
        unsigned short timeout  PACKED; /* 05h: ms, for timer interrupt */
383
} fr508_intr_ctl_t;
384
 
385
/*----------------------------------------------------------------------------
386
 * Channel status.
387
 *      This structure is returned by the FR_READ_STATUS command.
388
 */
389
typedef struct  fr_dlc_Status
390
{
391
        unsigned char status            PACKED; /* 00h: link/DLCI status */
392
        struct
393
        {
394
                unsigned short dlci     PACKED; /* 01h: DLCI number */
395
                unsigned char status    PACKED; /* 03h: DLCI status */
396
        } circuit[1]                    PACKED;
397
} fr_dlc_status_t;
398
 
399
/* 'status' defines */
400
#define FR_LINK_INOPER  0x00            /* for global status (DLCI == 0) */
401
#define FR_LINK_OPER    0x01
402
#define FR_DLCI_DELETED 0x01            /* for circuit status (DLCI != 0) */
403
#define FR_DLCI_ACTIVE  0x02
404
#define FR_DLCI_WAITING 0x04
405
#define FR_DLCI_NEW     0x08
406
#define FR_DLCI_REPORT  0x40
407
 
408
/*----------------------------------------------------------------------------
409
 * Global Statistics Block.
410
 *      This structure is returned by the FR_READ_STATISTICS command when
411
 *      dcli == 0.
412
 */
413
typedef struct  fr_link_stat
414
{
415
        unsigned short rx_too_long      PACKED; /* 00h:  */
416
        unsigned short rx_dropped       PACKED; /* 02h:  */
417
        unsigned short rx_dropped2      PACKED; /* 04h:  */
418
        unsigned short rx_bad_dlci      PACKED; /* 06h:  */
419
        unsigned short rx_bad_format    PACKED; /* 08h:  */
420
        unsigned short retransmitted    PACKED; /* 0Ah:  */
421
        unsigned short cpe_tx_FSE       PACKED; /* 0Ch:  */
422
        unsigned short cpe_tx_LIV       PACKED; /* 0Eh:  */
423
        unsigned short cpe_rx_FSR       PACKED; /* 10h:  */
424
        unsigned short cpe_rx_LIV       PACKED; /* 12h:  */
425
        unsigned short node_rx_FSE      PACKED; /* 14h:  */
426
        unsigned short node_rx_LIV      PACKED; /* 16h:  */
427
        unsigned short node_tx_FSR      PACKED; /* 18h:  */
428
        unsigned short node_tx_LIV      PACKED; /* 1Ah:  */
429
        unsigned short rx_ISF_err       PACKED; /* 1Ch:  */
430
        unsigned short rx_unsolicited   PACKED; /* 1Eh:  */
431
        unsigned short rx_SSN_err       PACKED; /* 20h:  */
432
        unsigned short rx_RSN_err       PACKED; /* 22h:  */
433
        unsigned short T391_timeouts    PACKED; /* 24h:  */
434
        unsigned short T392_timeouts    PACKED; /* 26h:  */
435
        unsigned short N392_reached     PACKED; /* 28h:  */
436
        unsigned short cpe_SSN_RSN      PACKED; /* 2Ah:  */
437
        unsigned short current_SSN      PACKED; /* 2Ch:  */
438
        unsigned short current_RSN      PACKED; /* 2Eh:  */
439
        unsigned short curreny_T391     PACKED; /* 30h:  */
440
        unsigned short current_T392     PACKED; /* 32h:  */
441
        unsigned short current_N392     PACKED; /* 34h:  */
442
        unsigned short current_N393     PACKED; /* 36h:  */
443
} fr_link_stat_t;
444
 
445
/*----------------------------------------------------------------------------
446
 * DLCI statistics.
447
 *      This structure is returned by the FR_READ_STATISTICS command when
448
 *      dlci != 0.
449
 */
450
typedef struct  fr_dlci_stat
451
{
452
        unsigned long tx_frames         PACKED; /* 00h:  */
453
        unsigned long tx_bytes          PACKED; /* 04h:  */
454
        unsigned long rx_frames         PACKED; /* 08h:  */
455
        unsigned long rx_bytes          PACKED; /* 0Ch:  */
456
        unsigned long rx_dropped        PACKED; /* 10h:  */
457
        unsigned long rx_inactive       PACKED; /* 14h:  */
458
        unsigned long rx_exceed_CIR     PACKED; /* 18h:  */
459
        unsigned long rx_DE_set         PACKED; /* 1Ch:  */
460
        unsigned long tx_throughput     PACKED; /* 20h:  */
461
        unsigned long tx_calc_timer     PACKED; /* 24h:  */
462
        unsigned long rx_throughput     PACKED; /* 28h:  */
463
        unsigned long rx_calc_timer     PACKED; /* 2Ch:  */
464
} fr_dlci_stat_t;
465
 
466
/*----------------------------------------------------------------------------
467
 * Communications error statistics.
468
 *      This structure is returned by the FR_READ_ERROR_STATS command.
469
 */
470
typedef struct  fr_comm_stat
471
{
472
        unsigned char rx_overruns       PACKED; /* 00h:  */
473
        unsigned char rx_bad_crc        PACKED; /* 01h:  */
474
        unsigned char rx_aborts         PACKED; /* 02h:  */
475
        unsigned char rx_too_long       PACKED; /* 03h:  */
476
        unsigned char tx_aborts         PACKED; /* 04h:  */
477
        unsigned char tx_underruns      PACKED; /* 05h:  */
478
        unsigned char tx_missed_undr    PACKED; /* 06h:  */
479
        unsigned char dcd_dropped       PACKED; /* 07h:  */
480
        unsigned char cts_dropped       PACKED; /* 08h:  */
481
} fr_comm_stat_t;
482
 
483
/*----------------------------------------------------------------------------
484
 * Defines for the FR_ISSUE_IS_FRAME command.
485
 */
486
#define FR_ISF_LVE      2               /* issue Link Verification Enquiry */
487
#define FR_ISF_FSE      3               /* issue Full Status Enquiry */
488
 
489
/*----------------------------------------------------------------------------
490
 * Frame Relay ARP Header -- Used for Dynamic route creation with InvARP
491
 */
492
 
493
typedef struct arphdr_fr
494
        {
495
        unsigned short ar_hrd PACKED;           /* format of hardware addr */
496
        unsigned short ar_pro PACKED;           /* format of protocol addr */
497
        unsigned char  ar_hln PACKED;           /* length of hardware addr */  
498
        unsigned char  ar_pln PACKED;           /* length of protocol addr */
499
        unsigned short ar_op  PACKED;           /* ARP opcode              */
500
        unsigned short ar_sha PACKED;           /* Sender DLCI addr 2 bytes */
501
        unsigned long  ar_sip PACKED;           /* Sender IP   addr 4 bytes */
502
        unsigned short ar_tha PACKED;           /* Target DLCI addr 2 bytes */
503
        unsigned long  ar_tip PACKED;           /* Target IP   addr 4 bytes */
504
        } arphdr_fr_t;
505
 
506
/*----------------------------------------------------------------------------
507
 * Frame Relay RFC 1490 SNAP Header -- Used to check for ARP packets
508
 */
509
typedef struct arphdr_1490
510
        {
511
        unsigned char control PACKED;           /* UI, etc...  */
512
        unsigned char pad     PACKED;           /* Pad */
513
        unsigned char NLPID   PACKED;           /* SNAP */
514
        unsigned char OUI[3]  PACKED;           /* Ethertype, etc... */
515
        unsigned short PID    PACKED;           /* ARP, IP, etc... */
516
        }  arphdr_1490_t;
517
 
518
/* UDP/IP packet (for UDP management) layout */
519
 
520
/* The embedded control block for UDP mgmt
521
   This is essentially a mailbox structure, without the large data field */
522
 
523
typedef struct {
524
        unsigned char  opp_flag PACKED; /* the opp flag */
525
        unsigned char  command  PACKED; /* command code */
526
        unsigned short length   PACKED; /* length of data buffer */
527
        unsigned char  result   PACKED; /* return code */
528
        unsigned short dlci     PACKED; /* DLCI number */
529
        unsigned char  attr     PACKED; /* FECN, BECN, DE and C/R bits */
530
        unsigned short rxlost1  PACKED; /* frames discarded at int. level */
531
        unsigned long  rxlost2  PACKED; /* frames discarded at app. level */
532
        unsigned char  rsrv[2]  PACKED; /* reserved for future use */
533
} cblock_t;
534
 
535
 
536
/* UDP management packet layout (data area of ip packet) */
537
 
538
typedef struct {
539
        unsigned char   control                 PACKED;
540
        unsigned char   NLPID                   PACKED;
541
} fr_encap_hdr_t;
542
 
543
typedef struct {
544
//      fr_encap_hdr_t          fr_encap_hdr    PACKED;
545
        ip_pkt_t                ip_pkt          PACKED;
546
        udp_pkt_t               udp_pkt         PACKED;
547
        wp_mgmt_t               wp_mgmt         PACKED;
548
        cblock_t                cblock          PACKED;
549
        unsigned char           data[4080]      PACKED;
550
} fr_udp_pkt_t;
551
 
552
 
553
/* valid ip_protocol for UDP management */
554
#define UDPMGMT_UDP_PROTOCOL 0x11
555
 
556
#define UDPMGMT_FPIPE_SIGNATURE         "FPIPE8ND"
557
#define UDPMGMT_DRVRSTATS_SIGNATURE     "DRVSTATS"
558
 
559
/* values for request/reply byte */
560
#define UDPMGMT_REQUEST 0x01
561
#define UDPMGMT_REPLY   0x02
562
#define UDP_OFFSET      12
563
 
564
typedef struct {
565
        unsigned long if_send_entry;
566
        unsigned long if_send_skb_null;
567
        unsigned long if_send_broadcast;
568
        unsigned long if_send_multicast;
569
        unsigned long if_send_critical_ISR;
570
        unsigned long if_send_critical_non_ISR;
571
        unsigned long if_send_busy;
572
        unsigned long if_send_busy_timeout;
573
        unsigned long if_send_DRVSTATS_request;
574
        unsigned long if_send_FPIPE_request;
575
        unsigned long if_send_wan_disconnected;
576
        unsigned long if_send_dlci_disconnected;
577
        unsigned long if_send_no_bfrs;
578
        unsigned long if_send_adptr_bfrs_full;
579
        unsigned long if_send_bfrs_passed_to_adptr;
580
        unsigned long if_send_consec_send_fail;
581
} drvstats_if_send_t;
582
 
583
typedef struct {
584
        unsigned long rx_intr_no_socket;
585
        unsigned long rx_intr_dev_not_started;
586
        unsigned long rx_intr_DRVSTATS_request;
587
        unsigned long rx_intr_FPIPE_request;
588
        unsigned long rx_intr_bfr_not_passed_to_stack;
589
        unsigned long rx_intr_bfr_passed_to_stack;
590
 } drvstats_rx_intr_t;
591
 
592
typedef struct {
593
        unsigned long UDP_FPIPE_mgmt_kmalloc_err;
594
        unsigned long UDP_FPIPE_mgmt_direction_err;
595
        unsigned long UDP_FPIPE_mgmt_adptr_type_err;
596
        unsigned long UDP_FPIPE_mgmt_adptr_cmnd_OK;
597
        unsigned long UDP_FPIPE_mgmt_adptr_cmnd_timeout;
598
        unsigned long UDP_FPIPE_mgmt_adptr_send_passed;
599
        unsigned long UDP_FPIPE_mgmt_adptr_send_failed;
600
        unsigned long UDP_FPIPE_mgmt_not_passed_to_stack;
601
        unsigned long UDP_FPIPE_mgmt_passed_to_stack;
602
        unsigned long UDP_FPIPE_mgmt_no_socket;
603
        unsigned long UDP_DRVSTATS_mgmt_kmalloc_err;
604
        unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_OK;
605
        unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_timeout;
606
        unsigned long UDP_DRVSTATS_mgmt_adptr_send_passed;
607
        unsigned long UDP_DRVSTATS_mgmt_adptr_send_failed;
608
        unsigned long UDP_DRVSTATS_mgmt_not_passed_to_stack;
609
        unsigned long UDP_DRVSTATS_mgmt_passed_to_stack;
610
        unsigned long UDP_DRVSTATS_mgmt_no_socket;
611
} drvstats_gen_t;
612
 
613
typedef struct {
614
        unsigned char   attr            PACKED;
615
        unsigned short  time_stamp      PACKED;
616
        unsigned char   reserved[13]    PACKED;
617
} api_rx_hdr_t;
618
 
619
typedef struct {
620
        api_rx_hdr_t    api_rx_hdr      PACKED;
621
        void *          data            PACKED;
622
} api_rx_element_t;
623
 
624
typedef struct {
625
        unsigned char   attr            PACKED;
626
        unsigned char   reserved[15]    PACKED;
627
} api_tx_hdr_t;
628
 
629
typedef struct {
630
        api_tx_hdr_t    api_tx_hdr      PACKED;
631
        void *          data            PACKED;
632
} api_tx_element_t;
633
 
634
#ifdef          _MSC_
635
#  pragma       pack()
636
#endif
637
#endif  /* _SDLA_FR_H */
638