patch-2.4.4 linux/include/linux/wanpipe.h
Next file: linux/include/linux/wanrouter.h
Previous file: linux/include/linux/videodev.h
Back to the patch index
Back to the overall index
- Lines: 362
- Date:
Thu Apr 12 12:11:39 2001
- Orig file:
v2.4.3/linux/include/linux/wanpipe.h
- Orig date:
Mon Dec 11 13:00:10 2000
diff -u --recursive --new-file v2.4.3/linux/include/linux/wanpipe.h linux/include/linux/wanpipe.h
@@ -5,13 +5,17 @@
* Author: Nenad Corbic <ncorbic@sangoma.com>
* Gideon Hack
*
-* Copyright: (c) 1995-1999 Sangoma Technologies Inc.
+* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
* ============================================================================
+* Nov 3, 2000 Nenad Corbic Added config_id to sdla_t structure.
+* Used to determine the protocol running.
+* Jul 13, 2000 Nenad Corbic Added SyncPPP Support
+* Feb 24, 2000 Nenad Corbic Added support for x25api driver
* Oct 04, 1999 Nenad Corbic New CHDLC and FRAME RELAY code, SMP support
* Jun 02, 1999 Gideon Hack Added 'update_call_count' for Cisco HDLC
* support
@@ -35,10 +39,58 @@
#ifndef _WANPIPE_H
#define _WANPIPE_H
-#include <linux/config.h>
+#include <linux/version.h>
-#ifdef CONFIG_SMP
-#include <asm/spinlock.h> /* Support for SMP Locking */
+#ifndef KERNEL_VERSION
+ #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
+
+ #define LINUX_2_4
+ #define netdevice_t struct net_device
+
+ #define FREE_READ 1
+ #define FREE_WRITE 0
+
+ #define stop_net_queue(a) netif_stop_queue(a)
+ #define start_net_queue(a) netif_start_queue(a)
+ #define is_queue_stopped(a) netif_queue_stopped(a)
+ #define wake_net_dev(a) netif_wake_queue(a)
+ #define is_dev_running(a) netif_running(a)
+ #define wan_dev_kfree_skb(a,b) dev_kfree_skb_any(a)
+
+
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
+
+ #define LINUX_2_1
+ #define netdevice_t struct device
+ #define FREE_READ 1
+ #define FREE_WRITE 0
+
+ #define stop_net_queue(a) (set_bit(0, &##a->tbusy))
+ #define start_net_queue(a) (clear_bit(0,&##a->tbusy))
+ #define is_queue_stopped(a) (##a->tbusy)
+ #define wake_net_dev(a) {clear_bit(0,&##a->tbusy);mark_bh(NET_BH);}
+ #define is_dev_running(a) (test_bit(0,&##a->start))
+ #define wan_dev_kfree_skb(a,b) dev_kfree_skb(a)
+
+#else
+ #define LINUX_2_0
+ #define netdevice_t struct device
+
+ #define test_and_set_bit set_bit
+ #define net_ratelimit() 1
+
+ #define stop_net_queue(a) (set_bit(0, &##a->tbusy))
+ #define start_net_queue(a) (clear_bit(0,&##a->tbusy))
+ #define is_queue_stopped(a) (##a->tbusy)
+ #define wake_net_dev(a) {clear_bit(0,&##a->tbusy);mark_bh(NET_BH);}
+ #define is_dev_running(a) (test_bit(0,(void*)&##a->start))
+ #define wan_dev_kfree_skb(a,b) dev_kfree_skb(a,b)
+ #define spin_lock_init(a)
+ #define spin_lock(a)
+ #define spin_unlock(a)
#endif
#include <linux/wanrouter.h>
@@ -49,7 +101,7 @@
#define PACKED __attribute__((packed))
#endif
-#define WANPIPE_MAGIC 0x414C4453L /* signatire: 'SDLA' reversed */
+#define WANPIPE_MAGIC 0x414C4453L /* signature: 'SDLA' reversed */
/* IOCTL numbers (up to 16) */
#define WANPIPE_DUMP (ROUTER_USER+0) /* dump adapter's memory */
@@ -64,6 +116,51 @@
#define UDPMGMT_REPLY 0x02
#define UDP_OFFSET 12
+#define MAX_CMD_BUFF 10
+#define MAX_X25_LCN 255 /* Maximum number of x25 channels */
+#define MAX_LCN_NUM 4095 /* Maximum lcn number */
+#define MAX_FT1_RETRY 100
+
+#ifdef LINUX_2_4
+ #ifndef AF_WANPIPE
+ #define AF_WANPIPE 25
+ #ifndef PF_WANPIPE
+ #define PF_WANPIPE AF_WANPIPE
+ #endif
+ #endif
+
+#else
+ #ifndef AF_WANPIPE
+ #define AF_WANPIPE 24
+ #ifndef PF_WANPIPE
+ #define PF_WANPIPE AF_WANPIPE
+ #endif
+ #endif
+#endif
+
+
+#define TX_TIMEOUT 5*HZ
+
+/* General Critical Flags */
+#define SEND_CRIT 0x00
+#define PERI_CRIT 0x01
+
+/* Chdlc and PPP polling critical flag */
+#define POLL_CRIT 0x03
+
+/* Frame Relay Tx IRQ send critical flag */
+#define SEND_TXIRQ_CRIT 0x02
+
+/* Frame Relay ARP critical flag */
+#define ARP_CRIT 0x03
+
+/* Bit maps for dynamic interface configuration
+ * DYN_OPT_ON : turns this option on/off
+ * DEV_DOWN : device was shutdown by the driver not
+ * by user
+ */
+#define DYN_OPT_ON 0x00
+#define DEV_DOWN 0x01
/*
* Data structures for IOCTL calls.
@@ -197,6 +294,9 @@
} pipe_mgmt_stat_t;
+typedef struct {
+ struct sk_buff *skb;
+} bh_data_t, cmd_data_t;
#define MAX_LGTH_UDP_MGNT_PKT 2000
@@ -210,11 +310,27 @@
#define WUM_KILL 0x50
#define WUM_EXEC 0x51
+#define WANPIPE 0x00
+#define API 0x01
+#define BRIDGE 0x02
+#define BRIDGE_NODE 0x03
+
#ifdef __KERNEL__
/****** Kernel Interface ****************************************************/
#include <linux/sdladrv.h> /* SDLA support module API definitions */
#include <linux/sdlasfm.h> /* SDLA firmware module definitions */
+#include <linux/tqueue.h>
+#ifdef LINUX_2_4
+ #include <linux/serial.h>
+ #include <linux/serialP.h>
+ #include <linux/serial_reg.h>
+ #include <asm/serial.h>
+#endif
+#include <linux/tty.h>
+#include <linux/tty_driver.h>
+#include <linux/tty_flip.h>
+
#ifndef min
#define min(a,b) (((a)<(b))?(a):(b))
@@ -230,6 +346,7 @@
((ch)>=(unsigned)'a'&&(ch)<=(unsigned)'f')||\
((ch)>=(unsigned)'A'&&(ch)<=(unsigned)'F'))?1:0)
+
/****** Data Structures *****************************************************/
/* Adapter Data Space.
@@ -241,6 +358,7 @@
char devname[WAN_DRVNAME_SZ+1]; /* card name */
sdlahw_t hw; /* hardware configuration */
wan_device_t wandev; /* WAN device data space */
+
unsigned open_cnt; /* number of open interfaces */
unsigned long state_tick; /* link state timestamp */
unsigned intr_mode; /* Type of Interrupt Mode */
@@ -248,30 +366,71 @@
char buff_int_mode_unbusy; /* flag for carrying out dev_tint */
char dlci_int_mode_unbusy; /* flag for carrying out dev_tint */
char configured; /* flag for previous configurations */
+
unsigned short irq_dis_if_send_count; /* Disabling irqs in if_send*/
unsigned short irq_dis_poll_count; /* Disabling irqs in poll routine*/
unsigned short force_enable_irq;
char TracingEnabled; /* flag for enabling trace */
global_stats_t statistics; /* global statistics */
-#ifdef CONFIG_SMP
- spinlock_t lock; /* Support for SMP Locking */
-#endif
void* mbox; /* -> mailbox */
void* rxmb; /* -> receive mailbox */
void* flags; /* -> adapter status flags */
void (*isr)(struct sdla* card); /* interrupt service routine */
void (*poll)(struct sdla* card); /* polling routine */
int (*exec)(struct sdla* card, void* u_cmd, void* u_data);
-
- struct sdla *next; /* Secondary Port Device: Piggibacking */
+ /* Used by the listen() system call */
+ /* Wanpipe Socket Interface */
+ int (*func) (struct sk_buff *, struct sock *);
+ struct sock *sk;
+
+ /* Shutdown function */
+ void (*disable_comm) (struct sdla *card);
+
+ /* Secondary Port Device: Piggibacking */
+ struct sdla *next;
+
+ /* TTY driver variables */
+ unsigned char tty_opt;
+ struct tty_struct *tty;
+ unsigned int tty_minor;
+ unsigned int tty_open;
+ unsigned char *tty_buf;
+ unsigned char *tty_rx;
+ struct tq_struct tty_task_queue;
+
union
{
struct
{ /****** X.25 specific data **********/
- unsigned lo_pvc;
- unsigned hi_pvc;
- unsigned lo_svc;
- unsigned hi_svc;
+ u32 lo_pvc;
+ u32 hi_pvc;
+ u32 lo_svc;
+ u32 hi_svc;
+ netdevice_t *svc_to_dev_map[MAX_X25_LCN];
+ netdevice_t *pvc_to_dev_map[MAX_X25_LCN];
+ netdevice_t *tx_dev;
+ netdevice_t *cmd_dev;
+ u32 no_dev;
+ volatile u8 *hdlc_buf_status;
+ u32 tx_interrupts_pending;
+ u16 timer_int_enabled;
+ netdevice_t *poll_device;
+ atomic_t command_busy;
+
+ u16 udp_pkt_lgth;
+ u32 udp_type;
+ u8 udp_pkt_src;
+ u32 udp_lcn;
+ netdevice_t * udp_dev;
+ s8 udp_pkt_data[MAX_LGTH_UDP_MGNT_PKT];
+
+ u8 LAPB_hdlc; /* Option to turn off X25 and run only LAPB */
+ u8 logging; /* Option to log call messages */
+ u8 oob_on_modem; /* Option to send modem status to the api */
+ u16 num_of_ch; /* Number of channels configured by the user */
+
+ struct tq_struct x25_poll_task;
+ struct timer_list x25_timer;
} x;
struct
{ /****** frame relay specific data ***/
@@ -281,7 +440,7 @@
unsigned rx_top; /* S508 receive buffer end */
unsigned short node_dlci[100];
unsigned short dlci_num;
- struct net_device *dlci_to_dev_map[991 + 1];
+ netdevice_t *dlci_to_dev_map[991 + 1];
unsigned tx_interrupts_pending;
unsigned short timer_int_enabled;
unsigned short udp_pkt_lgth;
@@ -289,11 +448,13 @@
char udp_pkt_src;
unsigned udp_dlci;
char udp_pkt_data[MAX_LGTH_UDP_MGNT_PKT];
- void* trc_el_base; /* first trace element */
- void* trc_el_last; /* last trace element */
- void *curr_trc_el; /* current trace element */
- unsigned short trc_bfr_space; /* trace buffer space */
+ void* trc_el_base; /* first trace element */
+ void* trc_el_last; /* last trace element */
+ void *curr_trc_el; /* current trace element */
+ unsigned short trc_bfr_space; /* trace buffer space */
unsigned char update_comms_stats;
+ netdevice_t *arp_dev;
+ spinlock_t if_send_lock;
} f;
struct /****** PPP-specific data ***********/
{
@@ -307,6 +468,10 @@
unsigned rx_top; /* S508 receive buffer end */
char ip_mode; /* STATIC/HOST/PEER IP Mode */
char authenticator; /* Authenticator for PAP/CHAP */
+ unsigned char comm_enabled; /* Is comm enabled or not */
+ unsigned char peer_route; /* Process Peer Route */
+ unsigned long *txbuf_next; /* Next Tx buffer to use */
+ unsigned long *rxbuf_next; /* Next Rx buffer to use */
} p;
struct /* Cisco HDLC-specific data */
{
@@ -324,6 +489,7 @@
void* rxbuf_last; /* -> last Rx buffer */
unsigned rx_base; /* S508 receive buffer base */
unsigned rx_top; /* S508 receive buffer end */
+ unsigned char receive_only; /* high speed receivers */
unsigned short protocol_options;
unsigned short kpalv_tx; /* Tx kpalv timer */
unsigned short kpalv_rx; /* Rx kpalv timer */
@@ -332,6 +498,19 @@
unsigned state; /* state of the link */
unsigned char api_status;
unsigned char update_call_count;
+ unsigned short api_options; /* for async config */
+ unsigned char async_mode;
+ unsigned short tx_bits_per_char;
+ unsigned short rx_bits_per_char;
+ unsigned short stop_bits;
+ unsigned short parity;
+ unsigned short break_timer;
+ unsigned short inter_char_timer;
+ unsigned short rx_complete_length;
+ unsigned short xon_char;
+ unsigned short xoff_char;
+ unsigned char comm_enabled; /* Is comm enabled or not */
+ unsigned char backup;
} c;
struct
{
@@ -368,6 +547,18 @@
int bsc_init (sdla_t* card, wandev_conf_t* conf); /* BSC streaming */
int hdlc_init(sdla_t* card, wandev_conf_t* conf); /* HDLC support */
int wpft1_init (sdla_t* card, wandev_conf_t* conf); /* FT1 Config support */
+int wsppp_init (sdla_t* card, wandev_conf_t* conf); /* Sync PPP on top of RAW CHDLC */
+
+extern sdla_t * wanpipe_find_card(char *);
+extern sdla_t * wanpipe_find_card_num (int);
+
+extern void wanpipe_queue_tq (struct tq_struct *);
+extern void wanpipe_mark_bh (void);
+extern void wakeup_sk_bh (netdevice_t *);
+extern int change_dev_flags (netdevice_t *, unsigned);
+extern unsigned long get_ip_address (netdevice_t *dev, int option);
+extern void add_gateway(sdla_t *, netdevice_t *);
+
#endif /* __KERNEL__ */
#endif /* _WANPIPE_H */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)