| 1 | /***************************************************************************** |
|---|
| 2 | * wanpipe.h WANPIPE(tm) Multiprotocol WAN Link Driver. |
|---|
| 3 | * User-level API definitions. |
|---|
| 4 | * |
|---|
| 5 | * Author: Nenad Corbic <ncorbic@sangoma.com> |
|---|
| 6 | * Gideon Hack |
|---|
| 7 | * |
|---|
| 8 | * Copyright: (c) 1995-2000 Sangoma Technologies Inc. |
|---|
| 9 | * |
|---|
| 10 | * This program is free software; you can redistribute it and/or |
|---|
| 11 | * modify it under the terms of the GNU General Public License |
|---|
| 12 | * as published by the Free Software Foundation; either version |
|---|
| 13 | * 2 of the License, or (at your option) any later version. |
|---|
| 14 | * ============================================================================ |
|---|
| 15 | * Nov 3, 2000 Nenad Corbic Added config_id to sdla_t structure. |
|---|
| 16 | * Used to determine the protocol running. |
|---|
| 17 | * Jul 13, 2000 Nenad Corbic Added SyncPPP Support |
|---|
| 18 | * Feb 24, 2000 Nenad Corbic Added support for x25api driver |
|---|
| 19 | * Oct 04, 1999 Nenad Corbic New CHDLC and FRAME RELAY code, SMP support |
|---|
| 20 | * Jun 02, 1999 Gideon Hack Added 'update_call_count' for Cisco HDLC |
|---|
| 21 | * support |
|---|
| 22 | * Jun 26, 1998 David Fong Added 'ip_mode' in sdla_t.u.p for dynamic IP |
|---|
| 23 | * routing mode configuration |
|---|
| 24 | * Jun 12, 1998 David Fong Added Cisco HDLC union member in sdla_t |
|---|
| 25 | * Dec 08, 1997 Jaspreet Singh Added 'authenticator' in union of 'sdla_t' |
|---|
| 26 | * Nov 26, 1997 Jaspreet Singh Added 'load_sharing' structure. Also added |
|---|
| 27 | * 'devs_struct','dev_to_devtint_next' to 'sdla_t' |
|---|
| 28 | * Nov 24, 1997 Jaspreet Singh Added 'irq_dis_if_send_count', |
|---|
| 29 | * 'irq_dis_poll_count' to 'sdla_t'. |
|---|
| 30 | * Nov 06, 1997 Jaspreet Singh Added a define called 'INTR_TEST_MODE' |
|---|
| 31 | * Oct 20, 1997 Jaspreet Singh Added 'buff_intr_mode_unbusy' and |
|---|
| 32 | * 'dlci_intr_mode_unbusy' to 'sdla_t' |
|---|
| 33 | * Oct 18, 1997 Jaspreet Singh Added structure to maintain global driver |
|---|
| 34 | * statistics. |
|---|
| 35 | * Jan 15, 1997 Gene Kozin Version 3.1.0 |
|---|
| 36 | * o added UDP management stuff |
|---|
| 37 | * Jan 02, 1997 Gene Kozin Version 3.0.0 |
|---|
| 38 | *****************************************************************************/ |
|---|
| 39 | #ifndef _WANPIPE_H |
|---|
| 40 | #define _WANPIPE_H |
|---|
| 41 | |
|---|
| 42 | #include <linux/wanrouter.h> |
|---|
| 43 | |
|---|
| 44 | /* Defines */ |
|---|
| 45 | |
|---|
| 46 | #ifndef PACKED |
|---|
| 47 | #define PACKED __attribute__((packed)) |
|---|
| 48 | #endif |
|---|
| 49 | |
|---|
| 50 | #define WANPIPE_MAGIC 0x414C4453L /* signature: 'SDLA' reversed */ |
|---|
| 51 | |
|---|
| 52 | /* IOCTL numbers (up to 16) */ |
|---|
| 53 | #define WANPIPE_DUMP (ROUTER_USER+0) /* dump adapter's memory */ |
|---|
| 54 | #define WANPIPE_EXEC (ROUTER_USER+1) /* execute firmware command */ |
|---|
| 55 | |
|---|
| 56 | #define TRACE_ALL 0x00 |
|---|
| 57 | #define TRACE_PROT 0x01 |
|---|
| 58 | #define TRACE_DATA 0x02 |
|---|
| 59 | |
|---|
| 60 | /* values for request/reply byte */ |
|---|
| 61 | #define UDPMGMT_REQUEST 0x01 |
|---|
| 62 | #define UDPMGMT_REPLY 0x02 |
|---|
| 63 | #define UDP_OFFSET 12 |
|---|
| 64 | |
|---|
| 65 | #define MAX_CMD_BUFF 10 |
|---|
| 66 | #define MAX_X25_LCN 255 /* Maximum number of x25 channels */ |
|---|
| 67 | #define MAX_LCN_NUM 4095 /* Maximum lcn number */ |
|---|
| 68 | #define MAX_FT1_RETRY 100 |
|---|
| 69 | |
|---|
| 70 | #ifndef AF_WANPIPE |
|---|
| 71 | #define AF_WANPIPE 25 |
|---|
| 72 | #ifndef PF_WANPIPE |
|---|
| 73 | #define PF_WANPIPE AF_WANPIPE |
|---|
| 74 | #endif |
|---|
| 75 | #endif |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | #define TX_TIMEOUT 5*HZ |
|---|
| 79 | |
|---|
| 80 | /* General Critical Flags */ |
|---|
| 81 | #define SEND_CRIT 0x00 |
|---|
| 82 | #define PERI_CRIT 0x01 |
|---|
| 83 | |
|---|
| 84 | /* Chdlc and PPP polling critical flag */ |
|---|
| 85 | #define POLL_CRIT 0x03 |
|---|
| 86 | |
|---|
| 87 | /* Frame Relay Tx IRQ send critical flag */ |
|---|
| 88 | #define SEND_TXIRQ_CRIT 0x02 |
|---|
| 89 | |
|---|
| 90 | /* Frame Relay ARP critical flag */ |
|---|
| 91 | #define ARP_CRIT 0x03 |
|---|
| 92 | |
|---|
| 93 | /* Bit maps for dynamic interface configuration |
|---|
| 94 | * DYN_OPT_ON : turns this option on/off |
|---|
| 95 | * DEV_DOWN : device was shutdown by the driver not |
|---|
| 96 | * by user |
|---|
| 97 | */ |
|---|
| 98 | #define DYN_OPT_ON 0x00 |
|---|
| 99 | #define DEV_DOWN 0x01 |
|---|
| 100 | |
|---|
| 101 | /* |
|---|
| 102 | * Data structures for IOCTL calls. |
|---|
| 103 | */ |
|---|
| 104 | |
|---|
| 105 | typedef struct sdla_dump /* WANPIPE_DUMP */ |
|---|
| 106 | { |
|---|
| 107 | unsigned long magic; /* for verification */ |
|---|
| 108 | unsigned long offset; /* absolute adapter memory address */ |
|---|
| 109 | unsigned long length; /* block length */ |
|---|
| 110 | void* ptr; /* -> buffer */ |
|---|
| 111 | } sdla_dump_t; |
|---|
| 112 | |
|---|
| 113 | typedef struct sdla_exec /* WANPIPE_EXEC */ |
|---|
| 114 | { |
|---|
| 115 | unsigned long magic; /* for verification */ |
|---|
| 116 | void* cmd; /* -> command structure */ |
|---|
| 117 | void* data; /* -> data buffer */ |
|---|
| 118 | } sdla_exec_t; |
|---|
| 119 | |
|---|
| 120 | /* UDP management stuff */ |
|---|
| 121 | |
|---|
| 122 | typedef struct wum_header |
|---|
| 123 | { |
|---|
| 124 | unsigned char signature[8]; /* 00h: signature */ |
|---|
| 125 | unsigned char type; /* 08h: request/reply */ |
|---|
| 126 | unsigned char command; /* 09h: commnand */ |
|---|
| 127 | unsigned char reserved[6]; /* 0Ah: reserved */ |
|---|
| 128 | } wum_header_t; |
|---|
| 129 | |
|---|
| 130 | /************************************************************************* |
|---|
| 131 | Data Structure for global statistics |
|---|
| 132 | *************************************************************************/ |
|---|
| 133 | |
|---|
| 134 | typedef struct global_stats |
|---|
| 135 | { |
|---|
| 136 | unsigned long isr_entry; |
|---|
| 137 | unsigned long isr_already_critical; |
|---|
| 138 | unsigned long isr_rx; |
|---|
| 139 | unsigned long isr_tx; |
|---|
| 140 | unsigned long isr_intr_test; |
|---|
| 141 | unsigned long isr_spurious; |
|---|
| 142 | unsigned long isr_enable_tx_int; |
|---|
| 143 | unsigned long rx_intr_corrupt_rx_bfr; |
|---|
| 144 | unsigned long rx_intr_on_orphaned_DLCI; |
|---|
| 145 | unsigned long rx_intr_dev_not_started; |
|---|
| 146 | unsigned long tx_intr_dev_not_started; |
|---|
| 147 | unsigned long poll_entry; |
|---|
| 148 | unsigned long poll_already_critical; |
|---|
| 149 | unsigned long poll_processed; |
|---|
| 150 | unsigned long poll_tbusy_bad_status; |
|---|
| 151 | unsigned long poll_host_disable_irq; |
|---|
| 152 | unsigned long poll_host_enable_irq; |
|---|
| 153 | |
|---|
| 154 | } global_stats_t; |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | typedef struct{ |
|---|
| 158 | unsigned short udp_src_port PACKED; |
|---|
| 159 | unsigned short udp_dst_port PACKED; |
|---|
| 160 | unsigned short udp_length PACKED; |
|---|
| 161 | unsigned short udp_checksum PACKED; |
|---|
| 162 | } udp_pkt_t; |
|---|
| 163 | |
|---|
| 164 | |
|---|
| 165 | typedef struct { |
|---|
| 166 | unsigned char ver_inet_hdr_length PACKED; |
|---|
| 167 | unsigned char service_type PACKED; |
|---|
| 168 | unsigned short total_length PACKED; |
|---|
| 169 | unsigned short identifier PACKED; |
|---|
| 170 | unsigned short flags_frag_offset PACKED; |
|---|
| 171 | unsigned char ttl PACKED; |
|---|
| 172 | unsigned char protocol PACKED; |
|---|
| 173 | unsigned short hdr_checksum PACKED; |
|---|
| 174 | unsigned long ip_src_address PACKED; |
|---|
| 175 | unsigned long ip_dst_address PACKED; |
|---|
| 176 | } ip_pkt_t; |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | typedef struct { |
|---|
| 180 | unsigned char signature[8] PACKED; |
|---|
| 181 | unsigned char request_reply PACKED; |
|---|
| 182 | unsigned char id PACKED; |
|---|
| 183 | unsigned char reserved[6] PACKED; |
|---|
| 184 | } wp_mgmt_t; |
|---|
| 185 | |
|---|
| 186 | /************************************************************************* |
|---|
| 187 | Data Structure for if_send statistics |
|---|
| 188 | *************************************************************************/ |
|---|
| 189 | typedef struct if_send_stat{ |
|---|
| 190 | unsigned long if_send_entry; |
|---|
| 191 | unsigned long if_send_skb_null; |
|---|
| 192 | unsigned long if_send_broadcast; |
|---|
| 193 | unsigned long if_send_multicast; |
|---|
| 194 | unsigned long if_send_critical_ISR; |
|---|
| 195 | unsigned long if_send_critical_non_ISR; |
|---|
| 196 | unsigned long if_send_tbusy; |
|---|
| 197 | unsigned long if_send_tbusy_timeout; |
|---|
| 198 | unsigned long if_send_PIPE_request; |
|---|
| 199 | unsigned long if_send_wan_disconnected; |
|---|
| 200 | unsigned long if_send_dlci_disconnected; |
|---|
| 201 | unsigned long if_send_no_bfrs; |
|---|
| 202 | unsigned long if_send_adptr_bfrs_full; |
|---|
| 203 | unsigned long if_send_bfr_passed_to_adptr; |
|---|
| 204 | unsigned long if_send_protocol_error; |
|---|
| 205 | unsigned long if_send_bfr_not_passed_to_adptr; |
|---|
| 206 | unsigned long if_send_tx_int_enabled; |
|---|
| 207 | unsigned long if_send_consec_send_fail; |
|---|
| 208 | } if_send_stat_t; |
|---|
| 209 | |
|---|
| 210 | typedef struct rx_intr_stat{ |
|---|
| 211 | unsigned long rx_intr_no_socket; |
|---|
| 212 | unsigned long rx_intr_dev_not_started; |
|---|
| 213 | unsigned long rx_intr_PIPE_request; |
|---|
| 214 | unsigned long rx_intr_bfr_not_passed_to_stack; |
|---|
| 215 | unsigned long rx_intr_bfr_passed_to_stack; |
|---|
| 216 | } rx_intr_stat_t; |
|---|
| 217 | |
|---|
| 218 | typedef struct pipe_mgmt_stat{ |
|---|
| 219 | unsigned long UDP_PIPE_mgmt_kmalloc_err; |
|---|
| 220 | unsigned long UDP_PIPE_mgmt_direction_err; |
|---|
| 221 | unsigned long UDP_PIPE_mgmt_adptr_type_err; |
|---|
| 222 | unsigned long UDP_PIPE_mgmt_adptr_cmnd_OK; |
|---|
| 223 | unsigned long UDP_PIPE_mgmt_adptr_cmnd_timeout; |
|---|
| 224 | unsigned long UDP_PIPE_mgmt_adptr_send_passed; |
|---|
| 225 | unsigned long UDP_PIPE_mgmt_adptr_send_failed; |
|---|
| 226 | unsigned long UDP_PIPE_mgmt_not_passed_to_stack; |
|---|
| 227 | unsigned long UDP_PIPE_mgmt_passed_to_stack; |
|---|
| 228 | unsigned long UDP_PIPE_mgmt_no_socket; |
|---|
| 229 | unsigned long UDP_PIPE_mgmt_passed_to_adptr; |
|---|
| 230 | } pipe_mgmt_stat_t; |
|---|
| 231 | |
|---|
| 232 | |
|---|
| 233 | typedef struct { |
|---|
| 234 | struct sk_buff *skb; |
|---|
| 235 | } bh_data_t, cmd_data_t; |
|---|
| 236 | |
|---|
| 237 | #define MAX_LGTH_UDP_MGNT_PKT 2000 |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | /* This is used for interrupt testing */ |
|---|
| 241 | #define INTR_TEST_MODE 0x02 |
|---|
| 242 | |
|---|
| 243 | #define WUM_SIGNATURE_L 0x50495046 |
|---|
| 244 | #define WUM_SIGNATURE_H 0x444E3845 |
|---|
| 245 | |
|---|
| 246 | #define WUM_KILL 0x50 |
|---|
| 247 | #define WUM_EXEC 0x51 |
|---|
| 248 | |
|---|
| 249 | #define WANPIPE 0x00 |
|---|
| 250 | #define API 0x01 |
|---|
| 251 | #define BRIDGE 0x02 |
|---|
| 252 | #define BRIDGE_NODE 0x03 |
|---|
| 253 | |
|---|
| 254 | #endif /* _WANPIPE_H */ |
|---|
| 255 | |
|---|