sdla_fr.h 24 KB

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