From e5f75e8ece5d1a8d3c17bd0156082caf153d3779 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 5 Feb 2000 12:21:17 +0000 Subject: Import of Linux 2.2.14 subset (ipv4 stack and related) --- pfinet/linux-src/arch/s390/lib/checksum.c | 56 ++ pfinet/linux-src/include/asm-s390/checksum.h | 188 +++++++ pfinet/linux-src/include/linux/apm_bios.h | 2 +- pfinet/linux-src/include/linux/blk.h | 22 + pfinet/linux-src/include/linux/dcache.h | 8 +- pfinet/linux-src/include/linux/elf.h | 4 + pfinet/linux-src/include/linux/errqueue.h | 2 + pfinet/linux-src/include/linux/fb.h | 2 + pfinet/linux-src/include/linux/fs.h | 7 +- pfinet/linux-src/include/linux/genhd.h | 2 +- pfinet/linux-src/include/linux/hfs_fs.h | 14 +- pfinet/linux-src/include/linux/i2c.h | 1 + pfinet/linux-src/include/linux/if.h | 25 - pfinet/linux-src/include/linux/inetdevice.h | 2 + pfinet/linux-src/include/linux/ip.h | 3 +- pfinet/linux-src/include/linux/isdn.h | 45 +- pfinet/linux-src/include/linux/isdnif.h | 5 +- pfinet/linux-src/include/linux/ixjuser.h | 629 +++++++++++++++++++++ pfinet/linux-src/include/linux/joystick.h | 123 ++-- pfinet/linux-src/include/linux/lp.h | 2 +- pfinet/linux-src/include/linux/major.h | 4 + pfinet/linux-src/include/linux/mm.h | 3 +- pfinet/linux-src/include/linux/msg.h | 1 + pfinet/linux-src/include/linux/netdevice.h | 5 + pfinet/linux-src/include/linux/openpic.h | 7 +- pfinet/linux-src/include/linux/pagemap.h | 16 +- pfinet/linux-src/include/linux/parport.h | 3 + pfinet/linux-src/include/linux/parport_pc.h | 49 +- pfinet/linux-src/include/linux/pci.h | 51 +- pfinet/linux-src/include/linux/phonedev.h | 26 + pfinet/linux-src/include/linux/proc_fs.h | 3 +- pfinet/linux-src/include/linux/rtnetlink.h | 2 + pfinet/linux-src/include/linux/sched.h | 8 +- pfinet/linux-src/include/linux/sdla_chdlc.h | 808 +++++++++++++++++++++++++++ pfinet/linux-src/include/linux/sdla_fr.h | 260 ++++++++- pfinet/linux-src/include/linux/sdla_ppp.h | 231 ++++---- pfinet/linux-src/include/linux/sdladrv.h | 20 +- pfinet/linux-src/include/linux/sdlapci.h | 68 +++ pfinet/linux-src/include/linux/sdlasfm.h | 16 +- pfinet/linux-src/include/linux/socket.h | 2 +- pfinet/linux-src/include/linux/swap.h | 6 +- pfinet/linux-src/include/linux/sysctl.h | 6 +- pfinet/linux-src/include/linux/telephony.h | 200 +++++++ pfinet/linux-src/include/linux/tty.h | 2 + pfinet/linux-src/include/linux/wanpipe.h | 196 ++++++- pfinet/linux-src/include/linux/wanrouter.h | 173 ++++-- pfinet/linux-src/include/linux/wireless.h | 147 +++-- pfinet/linux-src/include/net/br.h | 36 +- pfinet/linux-src/include/net/tcp.h | 25 +- pfinet/linux-src/net/core/dev.c | 65 ++- pfinet/linux-src/net/ethernet/eth.c | 2 +- pfinet/linux-src/net/ipv4/arp.c | 33 +- pfinet/linux-src/net/ipv4/devinet.c | 11 +- pfinet/linux-src/net/ipv4/icmp.c | 2 +- pfinet/linux-src/net/ipv4/ip_forward.c | 15 +- pfinet/linux-src/net/ipv4/ip_fw.c | 13 +- pfinet/linux-src/net/ipv4/ip_input.c | 8 + pfinet/linux-src/net/ipv4/ip_masq.c | 25 +- pfinet/linux-src/net/ipv4/ip_masq_user.c | 4 +- pfinet/linux-src/net/ipv4/route.c | 2 +- pfinet/linux-src/net/ipv4/syncookies.c | 8 +- pfinet/linux-src/net/ipv4/tcp.c | 43 +- pfinet/linux-src/net/ipv4/tcp_input.c | 4 +- pfinet/linux-src/net/ipv4/tcp_ipv4.c | 39 +- pfinet/linux-src/net/ipv4/tcp_timer.c | 10 +- 65 files changed, 3304 insertions(+), 496 deletions(-) create mode 100644 pfinet/linux-src/arch/s390/lib/checksum.c create mode 100644 pfinet/linux-src/include/asm-s390/checksum.h create mode 100644 pfinet/linux-src/include/linux/ixjuser.h create mode 100644 pfinet/linux-src/include/linux/phonedev.h create mode 100644 pfinet/linux-src/include/linux/sdla_chdlc.h create mode 100644 pfinet/linux-src/include/linux/sdlapci.h create mode 100644 pfinet/linux-src/include/linux/telephony.h diff --git a/pfinet/linux-src/arch/s390/lib/checksum.c b/pfinet/linux-src/arch/s390/lib/checksum.c new file mode 100644 index 00000000..9411e1c5 --- /dev/null +++ b/pfinet/linux-src/arch/s390/lib/checksum.c @@ -0,0 +1,56 @@ +/* + * arch/s390/lib/checksum.c + * S390 fast network checksum routines + * + * S390 version + * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation + * Author(s): Ulrich Hild (first version), + * Martin Schwidefsky (schwidefsky@de.ibm.com), + * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), + * + * This file contains network checksum routines + */ + +#include +#include +#include +#include +#include + +/* + * computes a partial checksum, e.g. for TCP/UDP fragments + */ +unsigned int +csum_partial (const unsigned char *buff, int len, unsigned int sum) +{ + /* + * Experiments with ethernet and slip connections show that buff + * is aligned on either a 2-byte or 4-byte boundary. + */ + __asm__ __volatile__ ( + " lr 2,%1\n" /* address in gpr 2 */ + " lr 3,%2\n" /* length in gpr 3 */ + "0: cksm %0,2\n" /* do checksum on longs */ + " jo 0b\n" + : "+&d" (sum) + : "d" (buff), "d" (len) + : "cc", "2", "3" ); + return sum; +} + +/* + * Fold a partial checksum without adding pseudo headers + */ +unsigned short csum_fold(unsigned int sum) +{ + __asm__ __volatile__ ( + " sr 3,3\n" /* %0 = H*65536 + L */ + " lr 2,%0\n" /* %0 = H L, R2/R3 = H L / 0 0 */ + " srdl 2,16\n" /* %0 = H L, R2/R3 = 0 H / L 0 */ + " alr 2,3\n" /* %0 = H L, R2/R3 = L H / L 0 */ + " alr %0,2\n" /* %0 = H+L+C L+H */ + " srl %0,16\n" /* %0 = H+L+C */ + : "+d" (sum) : : "cc", "2", "3"); + return ((unsigned short) ~sum); +} + diff --git a/pfinet/linux-src/include/asm-s390/checksum.h b/pfinet/linux-src/include/asm-s390/checksum.h new file mode 100644 index 00000000..487ccc99 --- /dev/null +++ b/pfinet/linux-src/include/asm-s390/checksum.h @@ -0,0 +1,188 @@ +#ifndef _S390_CHECKSUM_H +#define _S390_CHECKSUM_H + +/* + * include/asm-s390/checksum.h + * S390 fast network checksum routines + * see also arch/S390/lib/checksum.c + * + * S390 version + * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation + * Author(s): Ulrich Hild (first version) + * Martin Schwidefsky (heavily optimized CKSM version) + * D.J. Barrow (third attempt) + */ + +#include + +/* + * computes the checksum of a memory block at buff, length len, + * and adds in "sum" (32-bit) + * + * returns a 32-bit number suitable for feeding into itself + * or csum_tcpudp_magic + * + * this function must be called with even lengths, except + * for the last fragment, which may be odd + * + * it's best to have buff aligned on a 32-bit boundary + */ +unsigned int +csum_partial(const unsigned char * buff, int len, unsigned int sum); + +/* + * csum_partial as an inline function + */ +extern inline unsigned int +csum_partial_inline(const unsigned char * buff, int len, unsigned int sum) +{ + __asm__ __volatile__ ( + " lr 2,%1\n" /* address in gpr 2 */ + " lr 3,%2\n" /* length in gpr 3 */ + "0: cksm %0,2\n" /* do checksum on longs */ + " jo 0b\n" + : "+&d" (sum) + : "d" (buff), "d" (len) + : "cc", "2", "3" ); + return sum; +} + +/* + * the same as csum_partial, but copies from src while it + * checksums + * + * here even more important to align src and dst on a 32-bit (or even + * better 64-bit) boundary + */ + +extern inline unsigned int +csum_partial_copy(const char *src, char *dst, int len,unsigned int sum) +{ + memcpy(dst,src,len); + return csum_partial_inline(dst, len, sum); +} + +/* + * the same as csum_partial_copy, but copies from user space. + * + * here even more important to align src and dst on a 32-bit (or even + * better 64-bit) boundary + */ + +extern inline unsigned int +csum_partial_copy_from_user(const char *src, char *dst, + int len, unsigned int sum, int *errp) +{ + if (copy_from_user(dst, src, len)) { + *errp = -EFAULT; + memset(dst, 0, len); + return sum; + } + return csum_partial(dst, len, sum); +} + +extern inline unsigned int +csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum) +{ + memcpy(dst,src,len); + return csum_partial_inline(dst, len, sum); +} + +/* + * Fold a partial checksum without adding pseudo headers + */ +#if 1 +unsigned short csum_fold(unsigned int sum); +#else +extern inline unsigned short +csum_fold(unsigned int sum) +{ + __asm__ __volatile__ ( + " sr 3,3\n" /* %0 = H*65536 + L */ + " lr 2,%0\n" /* %0 = H L, R2/R3 = H L / 0 0 */ + " srdl 2,16\n" /* %0 = H L, R2/R3 = 0 H / L 0 */ + " alr 2,3\n" /* %0 = H L, R2/R3 = L H / L 0 */ + " alr %0,2\n" /* %0 = H+L+C L+H */ + " srl %0,16\n" /* %0 = H+L+C */ + : "+&d" (sum) : : "cc", "2", "3"); + return ((unsigned short) ~sum); +} +#endif + +/* + * This is a version of ip_compute_csum() optimized for IP headers, + * which always checksum on 4 octet boundaries. + * + */ +extern inline unsigned short +ip_fast_csum(unsigned char *iph, unsigned int ihl) +{ + unsigned long sum; + + __asm__ __volatile__ ( + " sr %0,%0\n" /* set sum to zero */ + " lr 2,%1\n" /* address in gpr 2 */ + " lr 3,%2\n" /* length in gpr 3 */ + "0: cksm %0,2\n" /* do checksum on longs */ + " jo 0b\n" + : "=&d" (sum) + : "d" (iph), "d" (ihl*4) + : "cc", "2", "3" ); + return csum_fold(sum); +} + +/* + * computes the checksum of the TCP/UDP pseudo-header + * returns a 32-bit checksum + */ +extern inline unsigned int +csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, + unsigned short len, unsigned short proto, + unsigned int sum) +{ + __asm__ __volatile__ ( + " sll %3,16\n" + " or %3,%4\n" /* newproto=proto<<16 in hiword, len in lowword */ + " alr %1,%2\n" /* saddr+=daddr */ + " brc 12,0f\n" + " ahi %1,1\n" /* add carry */ + "0: alr %1,%3\n" /* add saddr+=newproto */ + " brc 12,1f\n" + " ahi %1,1\n" /* add carry again */ + "1: alr %0,%1\n" /* sum+=saddr */ + " brc 12,2f\n" + " ahi %0,1\n" /* add carry again */ + "2:" + : "+&d" (sum) + : "d" (saddr), "d" (daddr), "d" (proto), "d" (len) + : "cc" ); + return sum; +} + +/* + * computes the checksum of the TCP/UDP pseudo-header + * returns a 16-bit checksum, already complemented + */ + +extern inline unsigned short int +csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, + unsigned short len, unsigned short proto, + unsigned int sum) +{ + return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); +} + +/* + * this routine is used for miscellaneous IP-like checksums, mainly + * in icmp.c + */ + +extern inline unsigned short +ip_compute_csum(unsigned char * buff, int len) +{ + return csum_fold(csum_partial(buff, len, 0)); +} + +#endif /* _S390_CHECKSUM_H */ + + diff --git a/pfinet/linux-src/include/linux/apm_bios.h b/pfinet/linux-src/include/linux/apm_bios.h index 7dc036b2..caf0b4b7 100644 --- a/pfinet/linux-src/include/linux/apm_bios.h +++ b/pfinet/linux-src/include/linux/apm_bios.h @@ -3,7 +3,7 @@ /* * Include file for the interface to an APM BIOS - * Copyright 1994-1998 Stephen Rothwell (Stephen.Rothwell@canb.auug.org.au) + * Copyright 1994-1999 Stephen Rothwell (sfr@linuxcare.com) * * 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 diff --git a/pfinet/linux-src/include/linux/blk.h b/pfinet/linux-src/include/linux/blk.h index 53db6024..44e05c7f 100644 --- a/pfinet/linux-src/include/linux/blk.h +++ b/pfinet/linux-src/include/linux/blk.h @@ -64,6 +64,11 @@ extern int ez_init(void); extern int bpcd_init(void); extern int ps2esdi_init(void); +#ifdef CONFIG_ARCH_S390 +extern int mdisk_init(void); +extern int dasd_init(void); +#endif /* CONFIG_ARCH_S390 */ + extern void set_device_ro(kdev_t dev,int flag); void add_blkdev_randomness(int major); @@ -369,6 +374,23 @@ static void floppy_off(unsigned int nr); #define DEVICE_ON(device) #define DEVICE_OFF(device) + +#elif (MAJOR_NR == MDISK_MAJOR) + +#define DEVICE_NAME "mdisk" +#define DEVICE_REQUEST mdisk_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == DASD_MAJOR) + +#define DEVICE_NAME "dasd" +#define DEVICE_REQUEST do_dasd_request +#define DEVICE_NR(device) (MINOR(device) >> PARTN_BITS) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + #elif (MAJOR_NR == COMPAQ_SMART2_MAJOR) #define DEVICE_NAME "ida" diff --git a/pfinet/linux-src/include/linux/dcache.h b/pfinet/linux-src/include/linux/dcache.h index 84e1376b..9c1f8b5f 100644 --- a/pfinet/linux-src/include/linux/dcache.h +++ b/pfinet/linux-src/include/linux/dcache.h @@ -133,15 +133,14 @@ extern void d_delete(struct dentry *); /* allocate/de-allocate */ extern struct dentry * d_alloc(struct dentry * parent, const struct qstr *name); -extern void prune_dcache(int); +extern int prune_dcache(int, int); extern void shrink_dcache_sb(struct super_block *); extern void shrink_dcache_parent(struct dentry *); extern int d_invalidate(struct dentry *); -#define shrink_dcache() prune_dcache(0) +#define shrink_dcache() prune_dcache(0, -1) /* dcache memory management */ -extern int select_dcache(int, int); extern void shrink_dcache_memory(int, unsigned int); extern void check_dcache_memory(void); extern void free_inode_memory(int); /* defined in fs/inode.c */ @@ -152,6 +151,9 @@ extern struct dentry * d_alloc_root(struct inode * root_inode, struct dentry * o /* test whether root is busy without destroying dcache */ extern int is_root_busy(struct dentry *); +/* test whether we have any submounts in a subdir tree */ +extern int have_submounts(struct dentry *); + /* * This adds the entry to the hash queues. */ diff --git a/pfinet/linux-src/include/linux/elf.h b/pfinet/linux-src/include/linux/elf.h index 8e88496a..f1b9c912 100644 --- a/pfinet/linux-src/include/linux/elf.h +++ b/pfinet/linux-src/include/linux/elf.h @@ -74,6 +74,10 @@ typedef __u64 Elf64_Word; */ #define EM_ALPHA 0x9026 +/* + * This is an interim value for S390 architecture + */ +#define EM_S390 0xA390 /* This is the info that is needed to parse the dynamic section of the file */ #define DT_NULL 0 diff --git a/pfinet/linux-src/include/linux/errqueue.h b/pfinet/linux-src/include/linux/errqueue.h index 4a16756d..48d79561 100644 --- a/pfinet/linux-src/include/linux/errqueue.h +++ b/pfinet/linux-src/include/linux/errqueue.h @@ -1,7 +1,9 @@ #ifndef _LINUX_ERRQUEUE_H #define _LINUX_ERRQUEUE_H 1 +#ifdef __KERNEL__ #include +#endif struct sock_extended_err { diff --git a/pfinet/linux-src/include/linux/fb.h b/pfinet/linux-src/include/linux/fb.h index f084ca03..4170e030 100644 --- a/pfinet/linux-src/include/linux/fb.h +++ b/pfinet/linux-src/include/linux/fb.h @@ -26,6 +26,7 @@ /* #define FBIOSWITCH_MONIBIT 0x460E */ #define FBIOGET_CON2FBMAP 0x460F #define FBIOPUT_CON2FBMAP 0x4610 +#define FBIOBLANK 0x4611 /* arg: 0 or vesa level + 1 */ #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ @@ -72,6 +73,7 @@ #define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */ #define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */ #define FB_ACCEL_SUN_TCX 25 /* Sun tcx */ +#define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */ struct fb_fix_screeninfo { char id[16]; /* identification string eg "TT Builtin" */ diff --git a/pfinet/linux-src/include/linux/fs.h b/pfinet/linux-src/include/linux/fs.h index 93a39537..548b9d74 100644 --- a/pfinet/linux-src/include/linux/fs.h +++ b/pfinet/linux-src/include/linux/fs.h @@ -753,7 +753,7 @@ extern void set_writetime(struct buffer_head * buf, int flag); extern int try_to_free_buffers(struct page *); extern int nr_buffers; -extern int buffermem; +extern long buffermem; extern int nr_buffer_heads; #define BUF_CLEAN 0 @@ -783,7 +783,9 @@ extern inline void mark_buffer_dirty(struct buffer_head * bh, int flag) extern int check_disk_change(kdev_t dev); extern int invalidate_inodes(struct super_block * sb); extern void invalidate_inode_pages(struct inode *); -extern void invalidate_buffers(kdev_t dev); +#define invalidate_buffers(dev) __invalidate_buffers((dev), 0) +#define destroy_buffers(dev) __invalidate_buffers((dev), 1) +extern void __invalidate_buffers(kdev_t dev, int); extern int floppy_is_wp(int minor); extern void sync_inodes(kdev_t dev); extern void write_inode_now(struct inode *inode); @@ -837,6 +839,7 @@ extern void iput(struct inode *); extern struct inode * igrab(struct inode *inode); extern ino_t iunique(struct super_block *, ino_t); extern struct inode * iget(struct super_block *, unsigned long); +extern struct inode * iget_in_use (struct super_block *, unsigned long); extern void clear_inode(struct inode *); extern struct inode * get_empty_inode(void); diff --git a/pfinet/linux-src/include/linux/genhd.h b/pfinet/linux-src/include/linux/genhd.h index 45a6dc35..1b625319 100644 --- a/pfinet/linux-src/include/linux/genhd.h +++ b/pfinet/linux-src/include/linux/genhd.h @@ -42,7 +42,7 @@ #endif #define DM6_PARTITION 0x54 /* has DDO: use xlated geom & offset */ -#define EZD_PARTITION 0x55 /* EZ-DRIVE: same as DM6 (we think) */ +#define EZD_PARTITION 0x55 /* EZ-DRIVE: remap sector 1 to 0 */ #define DM6_AUX1PARTITION 0x51 /* no DDO: use xlated geom */ #define DM6_AUX3PARTITION 0x53 /* no DDO: use xlated geom */ diff --git a/pfinet/linux-src/include/linux/hfs_fs.h b/pfinet/linux-src/include/linux/hfs_fs.h index 36cf43f5..851bcb0d 100644 --- a/pfinet/linux-src/include/linux/hfs_fs.h +++ b/pfinet/linux-src/include/linux/hfs_fs.h @@ -140,6 +140,19 @@ struct hfs_hdr_layout { *order[HFS_HDR_MAX]; /* 'descr' ordered by offset */ }; +/* header layout for netatalk's v1 appledouble file format */ +struct hfs_nat_hdr { + hfs_lword_t magic; + hfs_lword_t version; + hfs_byte_t homefs[16]; + hfs_word_t entries; + hfs_byte_t descrs[12*5]; + hfs_byte_t real_name[255]; /* id=3 */ + hfs_byte_t comment[200]; /* id=4 XXX: not yet implemented */ + hfs_byte_t old_info[16]; /* id=7 */ + hfs_u8 finderinfo[32]; /* id=9 */ +}; + /* * Default header layout for Netatalk and AppleDouble */ @@ -162,7 +175,6 @@ struct hfs_dbl_hdr { hfs_u8 prodosi[8]; /* id=11 */ }; - /* finder metadata for CAP */ struct hfs_cap_info { hfs_byte_t fi_fndr[32]; /* Finder's info */ diff --git a/pfinet/linux-src/include/linux/i2c.h b/pfinet/linux-src/include/linux/i2c.h index 6082de3d..8b355d9e 100644 --- a/pfinet/linux-src/include/linux/i2c.h +++ b/pfinet/linux-src/include/linux/i2c.h @@ -40,6 +40,7 @@ struct i2c_device; /* 2 is used in 2.3.x */ #define I2C_BUSID_BUZ 3 /* I2C bus on a BUZ */ #define I2C_BUSID_ZORAN 4 /* I2C bus on a Zoran */ +#define I2C_BUSID_SGIVWFB 5 /* Moved to be unique */ /* * struct for a driver for a i2c chip (tuner, soundprocessor, diff --git a/pfinet/linux-src/include/linux/if.h b/pfinet/linux-src/include/linux/if.h index cd5f3139..c95f372c 100644 --- a/pfinet/linux-src/include/linux/if.h +++ b/pfinet/linux-src/include/linux/if.h @@ -45,31 +45,6 @@ #define IFF_AUTOMEDIA 0x4000 /* auto media select active */ #define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/ -#ifdef __KERNEL__ -/* - * The ifaddr structure contains information about one address - * of an interface. They are maintained by the different address - * families, are allocated and attached when an address is set, - * and are linked together so all addresses for an interface can - * be located. - */ - -struct ifaddr -{ - struct sockaddr ifa_addr; /* address of interface */ - union { - struct sockaddr ifu_broadaddr; - struct sockaddr ifu_dstaddr; - } ifa_ifu; - struct iface *ifa_ifp; /* back-pointer to interface */ - struct ifaddr *ifa_next; /* next address for interface */ -}; - -#define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */ -#define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of link */ - -#endif /* __KERNEL__ */ - /* * Device mapping structure. I'd just gone off and designed a * beautiful scheme using only loadable modules with arguments diff --git a/pfinet/linux-src/include/linux/inetdevice.h b/pfinet/linux-src/include/linux/inetdevice.h index 25c44959..323a305c 100644 --- a/pfinet/linux-src/include/linux/inetdevice.h +++ b/pfinet/linux-src/include/linux/inetdevice.h @@ -16,6 +16,7 @@ struct ipv4_devconf int log_martians; int forwarding; int mc_forwarding; + int hidden; void *sysctl; }; @@ -40,6 +41,7 @@ struct in_device #define IN_DEV_LOG_MARTIANS(in_dev) (ipv4_devconf.log_martians || (in_dev)->cnf.log_martians) #define IN_DEV_PROXY_ARP(in_dev) (ipv4_devconf.proxy_arp || (in_dev)->cnf.proxy_arp) +#define IN_DEV_HIDDEN(in_dev) ((in_dev)->cnf.hidden && ipv4_devconf.hidden) #define IN_DEV_SHARED_MEDIA(in_dev) (ipv4_devconf.shared_media || (in_dev)->cnf.shared_media) #define IN_DEV_TX_REDIRECTS(in_dev) (ipv4_devconf.send_redirects || (in_dev)->cnf.send_redirects) #define IN_DEV_SEC_REDIRECTS(in_dev) (ipv4_devconf.secure_redirects || (in_dev)->cnf.secure_redirects) diff --git a/pfinet/linux-src/include/linux/ip.h b/pfinet/linux-src/include/linux/ip.h index 6675cee9..7b642728 100644 --- a/pfinet/linux-src/include/linux/ip.h +++ b/pfinet/linux-src/include/linux/ip.h @@ -88,6 +88,8 @@ #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ #define IPOPT_TS_PRESPEC 3 /* specified modules only */ +#ifdef __KERNEL__ + struct ip_options { __u32 faddr; /* Saved first hop address */ unsigned char optlen; @@ -108,7 +110,6 @@ struct ip_options { unsigned char __data[0]; }; -#ifdef __KERNEL__ #define optlength(opt) (sizeof(struct ip_options) + opt->optlen) #endif diff --git a/pfinet/linux-src/include/linux/isdn.h b/pfinet/linux-src/include/linux/isdn.h index acb653d6..a0a0b0fa 100644 --- a/pfinet/linux-src/include/linux/isdn.h +++ b/pfinet/linux-src/include/linux/isdn.h @@ -1,4 +1,4 @@ -/* $Id: isdn.h,v 1.76 1999/09/14 10:16:21 keil Exp $ +/* $Id: isdn.h,v 1.81 1999/10/27 21:21:18 detabc Exp $ * * Main header for the Linux ISDN subsystem (linklevel). * @@ -21,6 +21,31 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdn.h,v $ + * Revision 1.81 1999/10/27 21:21:18 detabc + * Added support for building logically-bind-group's per interface. + * usefull for outgoing call's with more then one isdn-card. + * + * Switchable support to dont reset the hangup-timeout for + * receive frames. Most part's of the timru-rules for receiving frames + * are now obsolete. If the input- or forwarding-firewall deny + * the frame, the line will be not hold open. + * + * Revision 1.80 1999/10/26 21:09:29 armin + * New bufferlen for phonenumber only with kernel 2.3.x + * + * Revision 1.79 1999/10/16 17:52:38 keil + * Changing the MSN length need new data versions + * + * Revision 1.78 1999/10/08 18:59:33 armin + * Bugfix of too small MSN buffer and checking phone number + * in isdn_tty_getdial() + * + * Revision 1.77 1999/09/23 22:22:42 detabc + * added tcp-keepalive-detect with local response (ipv4 only) + * added host-only-interface support + * (source ipaddr == interface ipaddr) (ipv4 only) + * ok with kernel 2.3.18 and 2.2.12 + * * Revision 1.76 1999/09/14 10:16:21 keil * change ABC include * @@ -301,9 +326,13 @@ #undef CONFIG_ISDN_WITH_ABC_CALLB #undef CONFIG_ISDN_WITH_ABC_UDP_CHECK #undef CONFIG_ISDN_WITH_ABC_UDP_CHECK_HANGUP +#undef CONFIG_ISDN_WITH_ABC_UDP_CHECK_DIAL #undef CONFIG_ISDN_WITH_ABC_OUTGOING_EAZ -#undef CONFIG_ISDN_WITH_ABC_CALL_CHECK_SYNCRO #undef CONFIG_ISDN_WITH_ABC_LCR_SUPPORT +#undef CONFIG_ISDN_WITH_ABC_IPV4_TCP_KEEPALIVE +#undef CONFIG_ISDN_WITH_ABC_IPV4_DYNADDR +#undef CONFIG_ISDN_WITH_ABC_RCV_NO_HUPTIMER +#undef CONFIG_ISDN_WITH_ABC_ICALL_BIND /* New ioctl-codes */ @@ -363,10 +392,15 @@ #define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */ #define ISDN_MODEM_ANZREG 24 /* Number of Modem-Registers */ -#define ISDN_MSNLEN 20 #define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */ #define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */ +#define ISDN_MSNLEN 20 +#define NET_DV 0x05 /* Data version for isdn_net_ioctl_cfg */ +#define TTY_DV 0x05 /* Data version for iprofd etc. */ + +#define INF_DV 0x01 /* Data version for /dev/isdninfo */ + typedef struct { char drvid[25]; unsigned long arg; @@ -384,10 +418,6 @@ typedef struct { int outgoing; } isdn_net_ioctl_phone; -#define NET_DV 0x05 /* Data version for isdn_net_ioctl_cfg */ -#define TTY_DV 0x05 /* Data version for iprofd etc. */ -#define INF_DV 0x01 /* Data version for /dev/isdninfo */ - typedef struct { char name[10]; /* Name of interface */ char master[10]; /* Name of Master for Bundling */ @@ -898,6 +928,7 @@ typedef struct isdn_devt { extern isdn_dev *dev; + /* Utility-Macros */ #define MIN(a,b) ((ab)?a:b) diff --git a/pfinet/linux-src/include/linux/isdnif.h b/pfinet/linux-src/include/linux/isdnif.h index 6d639860..07e3b826 100644 --- a/pfinet/linux-src/include/linux/isdnif.h +++ b/pfinet/linux-src/include/linux/isdnif.h @@ -1,4 +1,4 @@ -/* $Id: isdnif.h,v 1.31 1999/09/06 07:29:36 fritz Exp $ +/* $Id: isdnif.h,v 1.32 1999/10/11 22:03:00 keil Exp $ * * Linux ISDN subsystem * @@ -22,6 +22,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdnif.h,v $ + * Revision 1.32 1999/10/11 22:03:00 keil + * COMPAT_NEED_UACCESS (no include in isdn_compat.h) + * * Revision 1.31 1999/09/06 07:29:36 fritz * Changed my mail-address. * diff --git a/pfinet/linux-src/include/linux/ixjuser.h b/pfinet/linux-src/include/linux/ixjuser.h new file mode 100644 index 00000000..a7019533 --- /dev/null +++ b/pfinet/linux-src/include/linux/ixjuser.h @@ -0,0 +1,629 @@ +/* + * ixjuser.h + * + * User-space include file for the Internet PhoneJACK and + * Internet LineJACK Telephony Cards. + * + * (c) Copyright 1999 Quicknet 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. + * + * Author: Ed Okerson, + * + * Contributors: Greg Herlein, + * David W. Erhart, + * John Sellers, + * Mike Preston, + * + * More information about the hardware related to this driver can be found + * at our website: http://www.quicknet.net + * + * Fixes: + */ + +static char ixjuser_h_rcsid[] = "$Id: ixjuser.h,v 3.4 1999/12/16 22:18:36 root Exp root $"; + +#include + +/*************************************************************************** + + If you use the IXJCTL_TESTRAM command, the card must be power + cycled to reset the SRAM values before futher use. + +***************************************************************************/ +#define IXJCTL_DSP_RESET _IO ('q', 0xC0) + +#define IXJCTL_RING PHONE_RING +#define IXJCTL_HOOKSTATE PHONE_HOOKSTATE +#define IXJCTL_MAXRINGS PHONE_MAXRINGS +#define IXJCTL_RING_CADENCE PHONE_RING_CADENCE +#define IXJCTL_RING_START PHONE_RING_START +#define IXJCTL_RING_STOP PHONE_RING_STOP + +#define IXJCTL_CARDTYPE _IOR ('q', 0xC1, int) +#define IXJCTL_SERIAL _IOR ('q', 0xC2, int) +#define IXJCTL_DSP_TYPE _IOR ('q', 0xC3, int) +#define IXJCTL_DSP_VERSION _IOR ('q', 0xC4, int) +#define IXJCTL_DSP_IDLE _IO ('q', 0xC5) +#define IXJCTL_TESTRAM _IO ('q', 0xC6) + +/****************************************************************************** +* +* This group of IOCTLs deal with the record settings of the DSP +* +* The IXJCTL_REC_DEPTH command sets the internal buffer depth of the DSP. +* Setting a lower depth reduces latency, but increases the demand of the +* application to service the driver without frame loss. The DSP has 480 +* bytes of physical buffer memory for the record channel so the true +* maximum limit is determined by how many frames will fit in the buffer. +* +* 1 uncompressed (480 byte) 16-bit linear frame. +* 2 uncompressed (240 byte) 8-bit A-law/mu-law frames. +* 15 TrueSpeech 8.5 frames. +* 20 TrueSpeech 6.3,5.3,4.8 or 4.1 frames. +* +* The default in the driver is currently set to 2 frames. +* +* The IXJCTL_REC_VOLUME and IXJCTL_PLAY_VOLUME commands both use a Q8 +* number as a parameter, 0x100 scales the signal by 1.0, 0x200 scales the +* signal by 2.0, 0x80 scales the signal by 0.5. No protection is given +* against over-scaling, if the multiplication factor times the input +* signal exceeds 16 bits, overflow distortion will occur. The default +* setting is 0x100 (1.0). +* +* The IXJCTL_REC_LEVEL returns the average signal level (not r.m.s.) on +* the most recently recorded frame as a 16 bit value. +******************************************************************************/ + +#define IXJCTL_REC_CODEC PHONE_REC_CODEC +#define IXJCTL_REC_START PHONE_REC_START +#define IXJCTL_REC_STOP PHONE_REC_STOP +#define IXJCTL_REC_DEPTH PHONE_REC_DEPTH +#define IXJCTL_FRAME PHONE_FRAME +#define IXJCTL_REC_VOLUME PHONE_REC_VOLUME +#define IXJCTL_REC_LEVEL PHONE_REC_LEVEL + +typedef enum { + f300_640 = 4, f300_500, f1100, f350, f400, f480, f440, f620, f20_50, + f133_200, f300, f300_420, f330, f300_425, f330_440, f340, f350_400, + f350_440, f350_450, f360, f380_420, f392, f400_425, f400_440, f400_450, + f420, f425, f425_450, f425_475, f435, f440_450, f440_480, f445, f450, + f452, f475, f480_620, f494, f500, f520, f523, f525, f540_660, f587, + f590, f600, f660, f700, f740, f750, f750_1450, f770, f800, f816, f850, + f857_1645, f900, f900_1300, f935_1215, f941_1477, f942, f950, f950_1400, + f975, f1000, f1020, f1050, f1100_1750, f1140, f1200, f1209, f1330, f1336, + lf1366, f1380, f1400, f1477, f1600, f1633_1638, f1800, f1860 +} IXJ_FILTER_FREQ; + +typedef struct { + unsigned int filter; + IXJ_FILTER_FREQ freq; + char enable; +} IXJ_FILTER; + +#define IXJCTL_SET_FILTER _IOW ('q', 0xC7, IXJ_FILTER *) +#define IXJCTL_GET_FILTER_HIST _IOW ('q', 0xC8, int) +/****************************************************************************** +* +* This IOCTL allows you to reassign values in the tone index table. The +* tone table has 32 entries (0 - 31), but the driver only allows entries +* 13 - 27 to be modified, entry 0 is reserved for silence and 1 - 12 are +* the standard DTMF digits and 28 - 31 are the DTMF tones for A, B, C & D. +* The positions used internally for Call Progress Tones are as follows: +* Dial Tone - 25 +* Ring Back - 26 +* Busy Signal - 27 +* +* The freq values are calculated as: +* freq = cos(2 * PI * frequency / 8000) +* +* The most commonly needed values are already calculated and listed in the +* enum IXJ_TONE_FREQ. Each tone index can have two frequencies with +* different gains, if you are only using a single frequency set the unused +* one to 0. +* +* The gain values range from 0 to 15 indicating +6dB to -24dB in 2dB +* increments. +* +******************************************************************************/ + +typedef enum { + hz20 = 0x7ffa, + hz50 = 0x7fe5, + hz133 = 0x7f4c, + hz200 = 0x7e6b, + hz261 = 0x7d50, /* .63 C1 */ + hz277 = 0x7cfa, /* .18 CS1 */ + hz293 = 0x7c9f, /* .66 D1 */ + hz300 = 0x7c75, + hz311 = 0x7c32, /* .13 DS1 */ + hz329 = 0x7bbf, /* .63 E1 */ + hz330 = 0x7bb8, + hz340 = 0x7b75, + hz349 = 0x7b37, /* .23 F1 */ + hz350 = 0x7b30, + hz360 = 0x7ae9, + hz369 = 0x7aa8, /* .99 FS1 */ + hz380 = 0x7a56, + hz392 = 0x79fa, /* .00 G1 */ + hz400 = 0x79bb, + hz415 = 0x7941, /* .30 GS1 */ + hz420 = 0x7918, + hz425 = 0x78ee, + hz435 = 0x7899, + hz440 = 0x786d, /* .00 A1 */ + hz445 = 0x7842, + hz450 = 0x7815, + hz452 = 0x7803, + hz466 = 0x7784, /* .16 AS1 */ + hz475 = 0x7731, + hz480 = 0x7701, + hz493 = 0x7685, /* .88 B1 */ + hz494 = 0x767b, + hz500 = 0x7640, + hz520 = 0x7578, + hz523 = 0x7559, /* .25 C2 */ + hz525 = 0x7544, + hz540 = 0x74a7, + hz554 = 0x7411, /* .37 CS2 */ + hz587 = 0x72a1, /* .33 D2 */ + hz590 = 0x727f, + hz600 = 0x720b, + hz620 = 0x711e, + hz622 = 0x7106, /* .25 DS2 */ + hz659 = 0x6f3b, /* .26 E2 */ + hz660 = 0x6f2e, + hz698 = 0x6d3d, /* .46 F2 */ + hz700 = 0x6d22, + hz739 = 0x6b09, /* .99 FS2 */ + hz740 = 0x6afa, + hz750 = 0x6a6c, + hz770 = 0x694b, + hz783 = 0x688b, /* .99 G2 */ + hz800 = 0x678d, + hz816 = 0x6698, + hz830 = 0x65bf, /* .61 GS2 */ + hz850 = 0x6484, + hz857 = 0x6414, + hz880 = 0x629f, /* .00 A2 */ + hz900 = 0x6154, + hz932 = 0x5f35, /* .33 AS2 */ + hz935 = 0x5f01, + hz941 = 0x5e9a, + hz942 = 0x5e88, + hz950 = 0x5dfd, + hz975 = 0x5c44, + hz1000 = 0x5a81, + hz1020 = 0x5912, + hz1050 = 0x56e2, + hz1100 = 0x5320, + hz1140 = 0x5007, + hz1200 = 0x4b3b, + hz1209 = 0x4a80, + hz1215 = 0x4a02, + hz1250 = 0x471c, + hz1300 = 0x42e0, + hz1330 = 0x4049, + hz1336 = 0x3fc4, + hz1366 = 0x3d22, + hz1380 = 0x3be4, + hz1400 = 0x3a1b, + hz1450 = 0x3596, + hz1477 = 0x331c, + hz1500 = 0x30fb, + hz1600 = 0x278d, + hz1633 = 0x2462, + hz1638 = 0x23e7, + hz1645 = 0x233a, + hz1750 = 0x18f8, + hz1800 = 0x1405, + hz1860 = 0xe0b, + hz2100 = 0xf5f6, + hz2450 = 0xd3b3 +} IXJ_FREQ; + +typedef enum { + C1 = hz261, + CS1 = hz277, + D1 = hz293, + DS1 = hz311, + E1 = hz329, + F1 = hz349, + FS1 = hz369, + G1 = hz392, + GS1 = hz415, + A1 = hz440, + AS1 = hz466, + B1 = hz493, + C2 = hz523, + CS2 = hz554, + D2 = hz587, + DS2 = hz622, + E2 = hz659, + F2 = hz698, + FS2 = hz739, + G2 = hz783, + GS2 = hz830, + A2 = hz880, + AS2 = hz932, +} IXJ_NOTE; + +typedef struct { + int tone_index; + int freq0; + int gain0; + int freq1; + int gain1; +} IXJ_TONE; + +#define IXJCTL_INIT_TONE _IOW ('q', 0xC9, IXJ_TONE *) + +/****************************************************************************** +* +* The IXJCTL_TONE_CADENCE ioctl defines tone sequences used for various +* Call Progress Tones (CPT). This is accomplished by setting up an array of +* IXJ_CADENCE_ELEMENT structures that sequentially define the states of +* the tone sequence. The tone_on_time and tone_off time are in +* 250 microsecond intervals. A pointer to this array is passed to the +* driver as the ce element of an IXJ_CADENCE structure. The elements_used +* must be set to the number of IXJ_CADENCE_ELEMENTS in the array. The +* termination variable defines what to do at the end of a cadence, the +* options are to play the cadence once and stop, to repeat the last +* element of the cadence indefinatly, or to repeat the entire cadence +* indefinatly. The ce variable is a pointer to the array of IXJ_TONE +* structures. If the freq0 variable is non-zero, the tone table contents +* for the tone_index are updated to the frequencies and gains defined. It +* should be noted that DTMF tones cannot be reassigned, so if DTMF tone +* table indexs are used in a cadence the frequency and gain variables will +* be ignored. +* +* If the array elements contain frequency parameters the driver will +* initialize the needed tone table elements and begin playing the tone, +* there is no preset limit on the number of elements in the cadence. If +* there is more than one frequency used in the cadence, sequential elements +* of different frequencies MUST use different tone table indexes. Only one +* cadence can be played at a time. It is possible to build complex +* cadences with multiple frequencies using 2 tone table indexes by +* alternating between them. +* +******************************************************************************/ + +typedef struct { + int index; + int tone_on_time; + int tone_off_time; + int freq0; + int gain0; + int freq1; + int gain1; +} IXJ_CADENCE_ELEMENT; + +typedef enum { + PLAY_ONCE, + REPEAT_LAST_ELEMENT, + REPEAT_ALL +} IXJ_CADENCE_TERM; + +typedef struct { + int elements_used; + IXJ_CADENCE_TERM termination; + IXJ_CADENCE_ELEMENT *ce; +} IXJ_CADENCE; + +#define IXJCTL_TONE_CADENCE _IOW ('q', 0xCA, IXJ_CADENCE *) +/****************************************************************************** +* +* This group of IOCTLs deal with the playback settings of the DSP +* +******************************************************************************/ + +#define IXJCTL_PLAY_CODEC PHONE_PLAY_CODEC +#define IXJCTL_PLAY_START PHONE_PLAY_START +#define IXJCTL_PLAY_STOP PHONE_PLAY_STOP +#define IXJCTL_PLAY_DEPTH PHONE_PLAY_DEPTH +#define IXJCTL_PLAY_VOLUME PHONE_PLAY_VOLUME +#define IXJCTL_PLAY_LEVEL PHONE_PLAY_LEVEL + +/****************************************************************************** +* +* This group of IOCTLs deal with the Acoustic Echo Cancellation settings +* of the DSP +* +* Issueing the IXJCTL_AEC_START command with a value of AEC_OFF has the +* same effect as IXJCTL_AEC_STOP. This is to simplify slider bar +* controls. IXJCTL_AEC_GET_LEVEL returns the current setting of the AEC. +******************************************************************************/ +#define IXJCTL_AEC_START _IOW ('q', 0xCB, int) +#define IXJCTL_AEC_STOP _IO ('q', 0xCC) +#define IXJCTL_AEC_GET_LEVEL _IO ('q', 0xCD) + +#define AEC_OFF 0 +#define AEC_LOW 1 +#define AEC_MED 2 +#define AEC_HIGH 3 +/****************************************************************************** +* +* Call Progress Tones, DTMF, etc. +* IXJCTL_DTMF_OOB determines if dtmf signaling is sent as Out-Of-Band +* only. If you pass a 1, dtmf is suppressed from the audio stream. +* Tone on and off times are in 250 microsecond intervals so +* ioctl(ixj1, IXJCTL_SET_TONE_ON_TIME, 360); +* will set the tone on time of board ixj1 to 360 * 250us = 90ms +* the default values of tone on and off times is 840 or 210ms +******************************************************************************/ + +#define IXJCTL_DTMF_READY PHONE_DTMF_READY +#define IXJCTL_GET_DTMF PHONE_GET_DTMF +#define IXJCTL_GET_DTMF_ASCII PHONE_GET_DTMF_ASCII +#define IXJCTL_DTMF_OOB PHONE_DTMF_OOB +#define IXJCTL_EXCEPTION PHONE_EXCEPTION +#define IXJCTL_PLAY_TONE PHONE_PLAY_TONE +#define IXJCTL_SET_TONE_ON_TIME PHONE_SET_TONE_ON_TIME +#define IXJCTL_SET_TONE_OFF_TIME PHONE_SET_TONE_OFF_TIME +#define IXJCTL_GET_TONE_ON_TIME PHONE_GET_TONE_ON_TIME +#define IXJCTL_GET_TONE_OFF_TIME PHONE_GET_TONE_OFF_TIME +#define IXJCTL_GET_TONE_STATE PHONE_GET_TONE_STATE +#define IXJCTL_BUSY PHONE_BUSY +#define IXJCTL_RINGBACK PHONE_RINGBACK +#define IXJCTL_DIALTONE PHONE_DIALTONE +#define IXJCTL_CPT_STOP PHONE_CPT_STOP + +/****************************************************************************** +* LineJack specific IOCTLs +* +* The lsb 4 bits of the LED argument represent the state of each of the 4 +* LED's on the LineJack +******************************************************************************/ + +#define IXJCTL_SET_LED _IOW ('q', 0xCE, int) +#define IXJCTL_MIXER _IOW ('q', 0xCF, int) + +/****************************************************************************** +* +* The master volume controls use attenuation with 32 levels from 0 to -62dB +* with steps of 2dB each, the defines should be OR'ed together then sent +* as the parameter to the mixer command to change the mixer settings. +* +******************************************************************************/ +#define MIXER_MASTER_L 0x0100 +#define MIXER_MASTER_R 0x0200 +#define ATT00DB 0x00 +#define ATT02DB 0x01 +#define ATT04DB 0x02 +#define ATT06DB 0x03 +#define ATT08DB 0x04 +#define ATT10DB 0x05 +#define ATT12DB 0x06 +#define ATT14DB 0x07 +#define ATT16DB 0x08 +#define ATT18DB 0x09 +#define ATT20DB 0x0A +#define ATT22DB 0x0B +#define ATT24DB 0x0C +#define ATT26DB 0x0D +#define ATT28DB 0x0E +#define ATT30DB 0x0F +#define ATT32DB 0x10 +#define ATT34DB 0x11 +#define ATT36DB 0x12 +#define ATT38DB 0x13 +#define ATT40DB 0x14 +#define ATT42DB 0x15 +#define ATT44DB 0x16 +#define ATT46DB 0x17 +#define ATT48DB 0x18 +#define ATT50DB 0x19 +#define ATT52DB 0x1A +#define ATT54DB 0x1B +#define ATT56DB 0x1C +#define ATT58DB 0x1D +#define ATT60DB 0x1E +#define ATT62DB 0x1F +#define MASTER_MUTE 0x80 + +/****************************************************************************** +* +* The input volume controls use gain with 32 levels from +12dB to -50dB +* with steps of 2dB each, the defines should be OR'ed together then sent +* as the parameter to the mixer command to change the mixer settings. +* +******************************************************************************/ +#define MIXER_PORT_CD_L 0x0600 +#define MIXER_PORT_CD_R 0x0700 +#define MIXER_PORT_LINE_IN_L 0x0800 +#define MIXER_PORT_LINE_IN_R 0x0900 +#define MIXER_PORT_POTS_REC 0x0C00 +#define MIXER_PORT_MIC 0x0E00 + +#define GAIN12DB 0x00 +#define GAIN10DB 0x01 +#define GAIN08DB 0x02 +#define GAIN06DB 0x03 +#define GAIN04DB 0x04 +#define GAIN02DB 0x05 +#define GAIN00DB 0x06 +#define GAIN_02DB 0x07 +#define GAIN_04DB 0x08 +#define GAIN_06DB 0x09 +#define GAIN_08DB 0x0A +#define GAIN_10DB 0x0B +#define GAIN_12DB 0x0C +#define GAIN_14DB 0x0D +#define GAIN_16DB 0x0E +#define GAIN_18DB 0x0F +#define GAIN_20DB 0x10 +#define GAIN_22DB 0x11 +#define GAIN_24DB 0x12 +#define GAIN_26DB 0x13 +#define GAIN_28DB 0x14 +#define GAIN_30DB 0x15 +#define GAIN_32DB 0x16 +#define GAIN_34DB 0x17 +#define GAIN_36DB 0x18 +#define GAIN_38DB 0x19 +#define GAIN_40DB 0x1A +#define GAIN_42DB 0x1B +#define GAIN_44DB 0x1C +#define GAIN_46DB 0x1D +#define GAIN_48DB 0x1E +#define GAIN_50DB 0x1F +#define INPUT_MUTE 0x80 + +/****************************************************************************** +* +* The POTS volume control use attenuation with 8 levels from 0dB to -28dB +* with steps of 4dB each, the defines should be OR'ed together then sent +* as the parameter to the mixer command to change the mixer settings. +* +******************************************************************************/ +#define MIXER_PORT_POTS_PLAY 0x0F00 + +#define POTS_ATT_00DB 0x00 +#define POTS_ATT_04DB 0x01 +#define POTS_ATT_08DB 0x02 +#define POTS_ATT_12DB 0x03 +#define POTS_ATT_16DB 0x04 +#define POTS_ATT_20DB 0x05 +#define POTS_ATT_24DB 0x06 +#define POTS_ATT_28DB 0x07 +#define POTS_MUTE 0x80 + +/****************************************************************************** +* +* The DAA controls the interface to the PSTN port. The driver loads the +* US coefficients by default, so if you live in a different country you +* need to load the set for your countries phone system. +* +******************************************************************************/ +#define IXJCTL_DAA_COEFF_SET _IOW ('q', 0xD0, int) + +#define DAA_US 1 //PITA 8kHz +#define DAA_UK 2 //ISAR34 8kHz +#define DAA_FRANCE 3 // +#define DAA_GERMANY 4 +#define DAA_AUSTRALIA 5 +#define DAA_JAPAN 6 + +/****************************************************************************** +* +* Use IXJCTL_PORT to set or query the port the card is set to. If the +* argument is set to PORT_QUERY, the return value of the ioctl will +* indicate which port is currently in use, otherwise it will change the +* port. +* +******************************************************************************/ +#define IXJCTL_PORT _IOW ('q', 0xD1, int) + +#define PORT_QUERY 0 +#define PORT_POTS 1 +#define PORT_PSTN 2 +#define PORT_SPEAKER 3 +#define PORT_HANDSET 4 + +#define IXJCTL_PSTN_SET_STATE PHONE_PSTN_SET_STATE +#define IXJCTL_PSTN_GET_STATE PHONE_PSTN_GET_STATE + +#define PSTN_ON_HOOK 0 +#define PSTN_RINGING 1 +#define PSTN_OFF_HOOK 2 +#define PSTN_PULSE_DIAL 3 + +/****************************************************************************** +* +* The DAA Analog GAIN sets 2 parameters at one time, the receive gain (AGRR), +* and the transmit gain (AGX). OR together the components and pass them +* as the parameter to IXJCTL_DAA_AGAIN. The default setting is both at 0dB. +* +******************************************************************************/ +#define IXJCTL_DAA_AGAIN _IOW ('q', 0xD2, int) + +#define AGRR00DB 0x00 // Analog gain in receive direction 0dB +#define AGRR3_5DB 0x10 // Analog gain in receive direction 3.5dB +#define AGRR06DB 0x30 // Analog gain in receive direction 6dB + +#define AGX00DB 0x00 // Analog gain in transmit direction 0dB +#define AGX_6DB 0x04 // Analog gain in transmit direction -6dB +#define AGX3_5DB 0x08 // Analog gain in transmit direction 3.5dB +#define AGX_2_5B 0x0C // Analog gain in transmit direction -2.5dB + +#define IXJCTL_PSTN_LINETEST _IO ('q', 0xD3) + +typedef struct { + char month[3]; + char day[3]; + char hour[3]; + char min[3]; + int numlen; + char number[11]; + int namelen; + char name[80]; +} IXJ_CID; + +#define IXJCTL_CID _IOR ('q', 0xD4, IXJ_CID *) +/****************************************************************************** +* +* The wink duration is tunable with this ioctl. The default wink duration +* is 320ms. You do not need to use this ioctl if you do not require a +* different wink duration. +* +******************************************************************************/ +#define IXJCTL_WINK_DURATION PHONE_WINK_DURATION + +/****************************************************************************** +* +* This ioctl will connect the POTS port to the PSTN port on the LineJACK +* In order for this to work properly the port selection should be set to +* the PSTN port with IXJCTL_PORT prior to calling this ioctl. This will +* enable conference calls between PSTN callers and network callers. +* Passing a 1 to this ioctl enables the POTS<->PSTN connection while +* passing a 0 turns it back off. +* +******************************************************************************/ +#define IXJCTL_POTS_PSTN _IOW ('q', 0xD5, int) + +/****************************************************************************** +* +* IOCTLs added by request. +* +* IXJCTL_HZ sets the value your Linux kernel uses for HZ as defined in +* /usr/include/asm/param.h, this determines the fundamental +* frequency of the clock ticks on your Linux system. The kernel +* must be rebuilt if you change this value, also all modules you +* use (except this one) must be recompiled. The default value +* is 100, and you only need to use this IOCTL if you use some +* other value. +* +* +* IXJCTL_RATE sets the number of times per second that the driver polls +* the DSP. This value cannot be larger than HZ. By +* increasing both of these values, you may be able to reduce +* latency because the max hang time that can exist between the +* driver and the DSP will be reduced. +* +******************************************************************************/ + +#define IXJCTL_HZ _IOW ('q', 0xE0, int) +#define IXJCTL_RATE _IOW ('q', 0xE1, int) +#define IXJCTL_FRAMES_READ _IOR ('q', 0xE2, unsigned long) +#define IXJCTL_FRAMES_WRITTEN _IOR ('q', 0xE3, unsigned long) +#define IXJCTL_READ_WAIT _IOR ('q', 0xE4, unsigned long) +#define IXJCTL_WRITE_WAIT _IOR ('q', 0xE5, unsigned long) +#define IXJCTL_DRYBUFFER_READ _IOR ('q', 0xE6, unsigned long) +#define IXJCTL_DRYBUFFER_CLEAR _IO ('q', 0xE7) + +/****************************************************************************** +* +* The intercom IOCTL's short the output from one card to the input of the +* other and vice versa (actually done in the DSP read function). It is only +* necessary to execute the IOCTL on one card, but it is necessary to have +* both devices open to be able to detect hook switch changes. The record +* codec and rate of each card must match the playback codec and rate of +* the other card for this to work properly. +* +******************************************************************************/ + +#define IXJCTL_INTERCOM_START _IOW ('q', 0xFD, int) +#define IXJCTL_INTERCOM_STOP _IOW ('q', 0xFE, int) diff --git a/pfinet/linux-src/include/linux/joystick.h b/pfinet/linux-src/include/linux/joystick.h index c1794ca2..b5b39d0f 100644 --- a/pfinet/linux-src/include/linux/joystick.h +++ b/pfinet/linux-src/include/linux/joystick.h @@ -4,7 +4,9 @@ /* * /usr/include/linux/joystick.h Version 1.2 * - * Copyright (C) 1996-1998 Vojtech Pavlik + * Copyright (C) 1996-1999 Vojtech Pavlik + * + * Sponsored by SuSE */ /* @@ -23,7 +25,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: + * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ @@ -34,7 +36,7 @@ * Version */ -#define JS_VERSION 0x01020d +#define JS_VERSION 0x01020f /* * Types and constants for reading from /dev/js @@ -128,75 +130,62 @@ struct JS_DATA_SAVE_TYPE { #include -#ifndef KERNEL_VERSION -#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -#endif - -#ifndef LINUX_VERSION_CODE -#error "You need to use at least 2.0 Linux kernel." +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) +#error "You need to use at least v2.2 Linux kernel." #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,0,0) -#error "You need to use at least 2.0 Linux kernel." -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) -#define JS_HAS_RDTSC (current_cpu_data.x86_capability & 0x10) -#include -#else -#ifdef MODULE -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,35) -#define JS_HAS_RDTSC (x86_capability & 0x10) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) +#include +typedef struct wait_queue *wait_queue_head_t; +#define __setup(a,b) +#define BASE_ADDRESS(x,i) ((x)->base_address[i]) +#define DECLARE_WAITQUEUE(x,y) struct wait_queue x = { y, NULL } +#define init_waitqueue_head(x) do { *(x) = NULL; } while (0) +#define __set_current_state(x) current->state = x +#define SETUP_PARAM char *str, int *ints +#define SETUP_PARSE(x) do {} while (0) #else -#define JS_HAS_RDTSC 0 -#endif -#else -#define JS_HAS_RDTSC (x86_capability & 0x10) -#endif -#define __initdata -#define __init -#define __cli cli -#define __save_flags(flags) save_flags(flags) -#define __restore_flags(flags) restore_flags(flags) -#define spin_lock_irqsave(x, flags) do { save_flags(flags); cli(); } while (0) -#define spin_unlock_irqrestore(x, flags) restore_flags(flags) -#define spin_lock_init(x) do { } while (0) -typedef struct { int something; } spinlock_t; -#define SPIN_LOCK_UNLOCKED { 0 } -#define MODULE_AUTHOR(x) -#define MODULE_PARM(x,y) -#define MODULE_SUPPORTED_DEVICE(x) -#define signal_pending(x) (((x)->signal) & ~((x)->blocked)) +#include +#define BASE_ADDRESS(x,i) ((x)->resource[i].start) +#define SETUP_PARAM char *str +#define SETUP_PARSE(x) int ints[x]; get_options(str, x, ints) #endif +#define PCI_VENDOR_ID_AUREAL 0x12eb + /* * Parport stuff */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) -#define USE_PARPORT -#endif - -#ifdef USE_PARPORT #include + +#define JS_PAR_STATUS_INVERT (0x80) +#define JS_PAR_CTRL_INVERT (0x04) #define JS_PAR_DATA_IN(y) parport_read_data(y->port) #define JS_PAR_DATA_OUT(x,y) parport_write_data(y->port, x) #define JS_PAR_STATUS(y) parport_read_status(y->port) + +#ifndef PARPORT_NEED_GENERIC_OPS #define JS_PAR_CTRL_IN(y) parport_read_control(y->port) +#else +#define JS_PAR_CTRL_IN(y) inb(y->port->base+2) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) #define JS_PAR_CTRL_OUT(x,y) parport_write_control(y->port, x) #define JS_PAR_ECTRL_OUT(x,y) parport_write_econtrol(y->port, x) #else -#define JS_PAR_DATA_IN(y) inb(y) -#define JS_PAR_DATA_OUT(x,y) outb(x,y) -#define JS_PAR_STATUS(y) inb(y+1) -#define JS_PAR_CTRL_IN(y) inb(y+2) -#define JS_PAR_CTRL_OUT(x,y) outb(x,y+2) -#define JS_PAR_ECTRL_OUT(x,y) outb(x,y+0x402) +#define JS_PAR_CTRL_OUT(x,y) \ + do { \ + if ((x) & 0x20) parport_data_reverse(y->port); \ + else parport_data_forward(y->port); \ + parport_write_control(y->port, (x) & ~0x20); \ + } while (0) +#define JS_PAR_ECTRL_OUT(x,y) /*parport sets PS/2 mode on ECR chips */ +#define PARPORT_MODE_PCPS2 PARPORT_MODE_TRISTATE +#define PARPORT_MODE_PCECPPS2 PARPORT_MODE_TRISTATE #endif -#define JS_PAR_STATUS_INVERT (0x80) -#define JS_PAR_CTRL_INVERT (0x04) - /* * Internal types */ @@ -204,8 +193,6 @@ typedef struct { int something; } spinlock_t; struct js_dev; typedef int (*js_read_func)(void *info, int **axes, int **buttons); -typedef unsigned int (*js_time_func)(void); -typedef int (*js_delta_func)(unsigned int x, unsigned int y); typedef int (*js_ops_func)(struct js_dev *dev); struct js_data { @@ -217,7 +204,7 @@ struct js_dev { struct js_dev *next; struct js_list *list; struct js_port *port; - struct wait_queue *wait; + wait_queue_head_t wait; struct js_data cur; struct js_data new; struct js_corr *corr; @@ -249,20 +236,14 @@ struct js_port { struct js_corr **corr; void *info; int ndevs; + int fail; + int total; }; /* * Sub-module interface */ -extern unsigned int js_time_speed; -extern js_time_func js_get_time; -extern js_delta_func js_delta; - -extern unsigned int js_time_speed_a; -extern js_time_func js_get_time_a; -extern js_delta_func js_delta_a; - extern struct js_port *js_register_port(struct js_port *port, void *info, int devs, int infos, js_read_func read); extern struct js_port *js_unregister_port(struct js_port *port); @@ -280,19 +261,19 @@ extern int js_am_init(void); extern int js_an_init(void); extern int js_as_init(void); extern int js_console_init(void); +extern int js_cr_init(void); extern int js_db9_init(void); extern int js_gr_init(void); extern int js_l4_init(void); extern int js_lt_init(void); +extern int js_mag_init(void); +extern int js_pci_init(void); extern int js_sw_init(void); +extern int js_sball_init(void); +extern int js_orb_init(void); extern int js_tm_init(void); - -extern void js_am_setup(char *str, int *ints); -extern void js_an_setup(char *str, int *ints); -extern void js_as_setup(char *str, int *ints); -extern void js_console_setup(char *str, int *ints); -extern void js_db9_setup(char *str, int *ints); -extern void js_l4_setup(char *str, int *ints); +extern int js_tg_init(void); +extern int js_war_init(void); #endif /* __KERNEL__ */ diff --git a/pfinet/linux-src/include/linux/lp.h b/pfinet/linux-src/include/linux/lp.h index 44474dcf..139ad843 100644 --- a/pfinet/linux-src/include/linux/lp.h +++ b/pfinet/linux-src/include/linux/lp.h @@ -19,7 +19,7 @@ #define LP_NOPA 0x0010 #define LP_ERR 0x0020 #define LP_ABORT 0x0040 -#define LP_CAREFUL 0x0080 /* obsoleted -arca */ +#define LP_CAREFUL 0x0080 #define LP_ABORTOPEN 0x0100 #define LP_TRUST_IRQ 0x0200 diff --git a/pfinet/linux-src/include/linux/major.h b/pfinet/linux-src/include/linux/major.h index 571c9be0..2db0a0af 100644 --- a/pfinet/linux-src/include/linux/major.h +++ b/pfinet/linux-src/include/linux/major.h @@ -105,8 +105,12 @@ #define SPECIALIX_NORMAL_MAJOR 75 #define SPECIALIX_CALLOUT_MAJOR 76 +#define DASD_MAJOR 94 /* Official assignations from Peter */ + #define LVM_CHAR_MAJOR 109 /* Logical Volume Manager */ +#define MDISK_MAJOR 95 /* Official assignations from Peter */ + #define AURORA_MAJOR 79 #define UNIX98_PTY_MASTER_MAJOR 128 diff --git a/pfinet/linux-src/include/linux/mm.h b/pfinet/linux-src/include/linux/mm.h index 0dc98d55..232c53dc 100644 --- a/pfinet/linux-src/include/linux/mm.h +++ b/pfinet/linux-src/include/linux/mm.h @@ -292,7 +292,7 @@ extern int zeromap_page_range(unsigned long from, unsigned long size, pgprot_t p extern void vmtruncate(struct inode * inode, unsigned long offset); extern int handle_mm_fault(struct task_struct *tsk,struct vm_area_struct *vma, unsigned long address, int write_access); -extern void make_pages_present(unsigned long addr, unsigned long end); +extern int make_pages_present(unsigned long addr, unsigned long end); extern int pgt_cache_water[2]; extern int check_pgt_cache(void); @@ -300,7 +300,6 @@ extern int check_pgt_cache(void); extern unsigned long paging_init(unsigned long start_mem, unsigned long end_mem); extern void mem_init(unsigned long start_mem, unsigned long end_mem); extern void show_mem(void); -extern void oom(struct task_struct * tsk); extern void si_meminfo(struct sysinfo * val); /* mmap.c */ diff --git a/pfinet/linux-src/include/linux/msg.h b/pfinet/linux-src/include/linux/msg.h index 2be62719..0312b5de 100644 --- a/pfinet/linux-src/include/linux/msg.h +++ b/pfinet/linux-src/include/linux/msg.h @@ -49,6 +49,7 @@ struct msginfo { #define MSGMNI 128 /* <= 1K */ /* max # of msg queue identifiers */ #define MSGMAX 4056 /* <= 4056 */ /* max size of message (bytes) */ #define MSGMNB 16384 /* ? */ /* default max size of a message queue */ +#define MSGQNUM 1024 /* <=65535 */ /* Max messages in flight / queue */ /* unused */ #define MSGPOOL (MSGMNI*MSGMNB/1024) /* size in kilobytes of message pool */ diff --git a/pfinet/linux-src/include/linux/netdevice.h b/pfinet/linux-src/include/linux/netdevice.h index 6d43f98d..86f84a90 100644 --- a/pfinet/linux-src/include/linux/netdevice.h +++ b/pfinet/linux-src/include/linux/netdevice.h @@ -24,7 +24,9 @@ #ifndef _LINUX_NETDEVICE_H #define _LINUX_NETDEVICE_H +#ifdef __KERNEL__ #include +#endif #include #include #include @@ -266,6 +268,9 @@ struct device struct Qdisc *qdisc_list; unsigned long tx_queue_len; /* Max frames per queue allowed */ + /* Bridge stuff */ + int bridge_port_id; + /* Pointers to interface service routines. */ int (*open)(struct device *dev); int (*stop)(struct device *dev); diff --git a/pfinet/linux-src/include/linux/openpic.h b/pfinet/linux-src/include/linux/openpic.h index 9cf18c5d..68102042 100644 --- a/pfinet/linux-src/include/linux/openpic.h +++ b/pfinet/linux-src/include/linux/openpic.h @@ -50,10 +50,9 @@ * Vector numbers */ -#define OPENPIC_VEC_SOURCE 0x10 /* and up */ -#define OPENPIC_VEC_TIMER 0x40 /* and up */ -#define OPENPIC_VEC_IPI 0x50 /* and up */ -#define OPENPIC_VEC_SPURIOUS 99 +#define OPENPIC_VEC_TIMER 64 /* and up */ +#define OPENPIC_VEC_IPI 70 /* and up */ +#define OPENPIC_VEC_SPURIOUS 127 /* diff --git a/pfinet/linux-src/include/linux/pagemap.h b/pfinet/linux-src/include/linux/pagemap.h index 1f5a62dd..9bf5efd8 100644 --- a/pfinet/linux-src/include/linux/pagemap.h +++ b/pfinet/linux-src/include/linux/pagemap.h @@ -38,11 +38,15 @@ static inline unsigned long page_address(struct page * page) */ #define page_cache_entry(x) (mem_map + MAP_NR(x)) -#define PAGE_HASH_BITS 12 -#define PAGE_HASH_SIZE (1 << PAGE_HASH_BITS) +#define PAGE_HASH_BITS page_hash_bits +#define PAGE_HASH_MASK page_hash_mask extern unsigned long page_cache_size; /* # of pages currently in the hash table */ -extern struct page * page_hash_table[PAGE_HASH_SIZE]; +extern unsigned int page_hash_bits; +extern unsigned int page_hash_mask; +extern struct page **page_hash_table; + +extern void page_cache_init(unsigned long); /* * We use a power-of-two hash table to avoid a modulus, @@ -53,12 +57,10 @@ extern struct page * page_hash_table[PAGE_HASH_SIZE]; static inline unsigned long _page_hashfn(struct inode * inode, unsigned long offset) { #define i (((unsigned long) inode)/(sizeof(struct inode) & ~ (sizeof(struct inode) - 1))) -#define o (offset >> PAGE_SHIFT) -#define s(x) ((x)+((x)>>PAGE_HASH_BITS)) - return s(i+o) & (PAGE_HASH_SIZE-1); +#define o ((offset >> PAGE_SHIFT) + (offset & ~PAGE_MASK)) + return ((i+o) & PAGE_HASH_MASK); #undef i #undef o -#undef s } #define page_hash(inode,offset) (page_hash_table+_page_hashfn(inode,offset)) diff --git a/pfinet/linux-src/include/linux/parport.h b/pfinet/linux-src/include/linux/parport.h index 3adbc5ab..856fc016 100644 --- a/pfinet/linux-src/include/linux/parport.h +++ b/pfinet/linux-src/include/linux/parport.h @@ -209,6 +209,9 @@ struct parport { spinlock_t pardevice_lock; spinlock_t waitlist_lock; rwlock_t cad_lock; + + /* PCI parallel I/O card support. */ + unsigned long base_hi; /* base address (hi - ECR) */ }; /* parport_register_port registers a new parallel port at the given address (if diff --git a/pfinet/linux-src/include/linux/parport_pc.h b/pfinet/linux-src/include/linux/parport_pc.h index a74c7a12..f7ef3406 100644 --- a/pfinet/linux-src/include/linux/parport_pc.h +++ b/pfinet/linux-src/include/linux/parport_pc.h @@ -5,14 +5,15 @@ /* --- register definitions ------------------------------- */ -#define ECONTROL 0x402 -#define CONFIGB 0x401 -#define CONFIGA 0x400 -#define EPPDATA 0x4 -#define EPPADDR 0x3 -#define CONTROL 0x2 -#define STATUS 0x1 -#define DATA 0 +#define ECONTROL(p) ((p)->base_hi + 0x2) +#define CONFIGB(p) ((p)->base_hi + 0x1) +#define CONFIGA(p) ((p)->base_hi + 0x0) +#define FIFO(p) ((p)->base_hi + 0x0) +#define EPPDATA(p) ((p)->base + 0x4) +#define EPPADDR(p) ((p)->base + 0x3) +#define CONTROL(p) ((p)->base + 0x2) +#define STATUS(p) ((p)->base + 0x1) +#define DATA(p) ((p)->base + 0x0) /* Private data for PC low-level driver. */ struct parport_pc_private { @@ -26,27 +27,27 @@ extern volatile unsigned char parport_pc_ctr; extern __inline__ void parport_pc_write_epp(struct parport *p, unsigned char d) { - outb(d, p->base+EPPDATA); + outb(d, EPPDATA(p)); } extern __inline__ unsigned char parport_pc_read_epp(struct parport *p) { - return inb(p->base+EPPDATA); + return inb(EPPDATA(p)); } extern __inline__ void parport_pc_write_epp_addr(struct parport *p, unsigned char d) { - outb(d, p->base+EPPADDR); + outb(d, EPPADDR(p)); } extern __inline__ unsigned char parport_pc_read_epp_addr(struct parport *p) { - return inb(p->base+EPPADDR); + return inb(EPPADDR(p)); } extern __inline__ int parport_pc_check_epp_timeout(struct parport *p) { - if (!(inb(p->base+STATUS) & 1)) + if (!(inb(STATUS(p)) & 1)) return 0; parport_pc_epp_clear_timeout(p); return 1; @@ -54,24 +55,24 @@ extern __inline__ int parport_pc_check_epp_timeout(struct parport *p) extern __inline__ unsigned char parport_pc_read_configb(struct parport *p) { - return inb(p->base+CONFIGB); + return inb(CONFIGB(p)); } extern __inline__ void parport_pc_write_data(struct parport *p, unsigned char d) { - outb(d, p->base+DATA); + outb(d, DATA(p)); } extern __inline__ unsigned char parport_pc_read_data(struct parport *p) { - return inb(p->base+DATA); + return inb(DATA(p)); } extern __inline__ void parport_pc_write_control(struct parport *p, unsigned char d) { struct parport_pc_private *priv = p->private_data; priv->ctr = d;/* update soft copy */ - outb(d, p->base+CONTROL); + outb(d, CONTROL(p)); } extern __inline__ unsigned char parport_pc_read_control(struct parport *p) @@ -85,34 +86,34 @@ extern __inline__ unsigned char parport_pc_frob_control(struct parport *p, unsig struct parport_pc_private *priv = p->private_data; unsigned char ctr = priv->ctr; ctr = (ctr & ~mask) ^ val; - outb (ctr, p->base+CONTROL); + outb (ctr, CONTROL(p)); return priv->ctr = ctr; /* update soft copy */ } extern __inline__ void parport_pc_write_status(struct parport *p, unsigned char d) { - outb(d, p->base+STATUS); + outb(d, STATUS(p)); } extern __inline__ unsigned char parport_pc_read_status(struct parport *p) { - return inb(p->base+STATUS); + return inb(STATUS(p)); } extern __inline__ void parport_pc_write_econtrol(struct parport *p, unsigned char d) { - outb(d, p->base+ECONTROL); + outb(d, ECONTROL(p)); } extern __inline__ unsigned char parport_pc_read_econtrol(struct parport *p) { - return inb(p->base+ECONTROL); + return inb(ECONTROL(p)); } extern __inline__ unsigned char parport_pc_frob_econtrol(struct parport *p, unsigned char mask, unsigned char val) { - unsigned char old = inb(p->base+ECONTROL); - outb(((old & ~mask) ^ val), p->base+ECONTROL); + unsigned char old = inb(ECONTROL(p)); + outb(((old & ~mask) ^ val), ECONTROL(p)); return old; } diff --git a/pfinet/linux-src/include/linux/pci.h b/pfinet/linux-src/include/linux/pci.h index 8f5eda0c..6ad71fa4 100644 --- a/pfinet/linux-src/include/linux/pci.h +++ b/pfinet/linux-src/include/linux/pci.h @@ -831,10 +831,10 @@ #define PCI_DEVICE_ID_ALLIANCE_AT24 0x6424 #define PCI_DEVICE_ID_ALLIANCE_AT3D 0x643d -#define PCI_VENDOR_ID_SK 0x1148 -#define PCI_DEVICE_ID_SK_FP 0x4000 -#define PCI_DEVICE_ID_SK_TR 0x4200 -#define PCI_DEVICE_ID_SK_GE 0x4300 +#define PCI_VENDOR_ID_SYSKONNECT 0x1148 +#define PCI_DEVICE_ID_SYSKONNECT_FP 0x4000 +#define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200 +#define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300 #define PCI_VENDOR_ID_VMIC 0x114a #define PCI_DEVICE_ID_VMIC_VME 0x7587 @@ -993,9 +993,35 @@ #define PCI_VENDOR_ID_CBOARDS 0x1307 #define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001 +#define PCI_VENDOR_ID_SIIG 0x131f +#define PCI_DEVICE_ID_SIIG_1S1P_10x_550 0x1010 +#define PCI_DEVICE_ID_SIIG_1S1P_10x_650 0x1011 +#define PCI_DEVICE_ID_SIIG_1S1P_10x_850 0x1012 +#define PCI_DEVICE_ID_SIIG_1P_10x 0x1020 +#define PCI_DEVICE_ID_SIIG_2P_10x 0x1021 +#define PCI_DEVICE_ID_SIIG_2S1P_10x_550 0x1034 +#define PCI_DEVICE_ID_SIIG_2S1P_10x_650 0x1035 +#define PCI_DEVICE_ID_SIIG_2S1P_10x_850 0x1036 +#define PCI_DEVICE_ID_SIIG_1P_20x 0x2020 +#define PCI_DEVICE_ID_SIIG_2P_20x 0x2021 +#define PCI_DEVICE_ID_SIIG_2P1S_20x_550 0x2040 +#define PCI_DEVICE_ID_SIIG_2P1S_20x_650 0x2041 +#define PCI_DEVICE_ID_SIIG_2P1S_20x_850 0x2042 +#define PCI_DEVICE_ID_SIIG_1S1P_20x_550 0x2010 +#define PCI_DEVICE_ID_SIIG_1S1P_20x_650 0x2011 +#define PCI_DEVICE_ID_SIIG_1S1P_20x_850 0x2012 +#define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060 +#define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061 +#define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062 + #define PCI_VENDOR_ID_NETGEAR 0x1385 #define PCI_DEVICE_ID_NETGEAR_GA620 0x620a +#define PCI_VENDOR_ID_LAVA 0x1407 +#define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000 +#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */ +#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */ + #define PCI_VENDOR_ID_SYMPHONY 0x1c1c #define PCI_DEVICE_ID_SYMPHONY_101 0x0001 @@ -1008,6 +1034,9 @@ #define PCI_DEVICE_ID_3DLABS_DELTA 0x0003 #define PCI_DEVICE_ID_3DLABS_PERMEDIA 0x0004 #define PCI_DEVICE_ID_3DLABS_MX 0x0006 +#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007 +#define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008 +#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009 #define PCI_VENDOR_ID_AVANCE 0x4005 #define PCI_DEVICE_ID_AVANCE_ALG2064 0x2064 @@ -1067,6 +1096,7 @@ #define PCI_DEVICE_ID_INTEL_82441 0x1237 #define PCI_DEVICE_ID_INTEL_82380FB 0x124b #define PCI_DEVICE_ID_INTEL_82439 0x1250 +#define PCI_DEVICE_ID_INTEL_MEGARAID 0x1960 #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 #define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 #define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 @@ -1076,17 +1106,19 @@ #define PCI_DEVICE_ID_INTEL_82371AB 0x7111 #define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112 #define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 -#define PCI_VENDOR_ID_COMPUTONE 0x8e0e -#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 - #define PCI_DEVICE_ID_INTEL_82443LX_0 0x7180 #define PCI_DEVICE_ID_INTEL_82443LX_1 0x7181 #define PCI_DEVICE_ID_INTEL_82443BX_0 0x7190 #define PCI_DEVICE_ID_INTEL_82443BX_1 0x7191 #define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192 #define PCI_DEVICE_ID_INTEL_P6 0x84c4 -#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 +#define PCI_DEVICE_ID_INTEL_82450GX 0x84c4 +#define PCI_DEVICE_ID_INTEL_82453GX 0x84c5 #define PCI_DEVICE_ID_INTEL_82451NX 0x84ca +#define PCI_DEVICE_ID_INTEL_82454NX 0x84cb + +#define PCI_VENDOR_ID_COMPUTONE 0x8e0e +#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 #define PCI_VENDOR_ID_KTI 0x8e2e #define PCI_DEVICE_ID_KTI_ET32P2 0x3000 @@ -1318,6 +1350,9 @@ extern inline struct pci_dev *pci_find_class(unsigned int class, struct pci_dev extern inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn) { return NULL; } +extern inline void pci_set_master(struct pci_dev *dev) +{ return; } + #endif /* !CONFIG_PCI */ #endif /* __KERNEL__ */ diff --git a/pfinet/linux-src/include/linux/phonedev.h b/pfinet/linux-src/include/linux/phonedev.h new file mode 100644 index 00000000..d54049ee --- /dev/null +++ b/pfinet/linux-src/include/linux/phonedev.h @@ -0,0 +1,26 @@ +#ifndef __LINUX_PHONEDEV_H +#define __LINUX_PHONEDEV_H + +#include +#include + +#ifdef __KERNEL__ + +#include + +struct phone_device { + struct phone_device *next; + struct file_operations *f_op; + int (*open) (struct phone_device *, struct file *); + int board; /* Device private index */ + int minor; +}; + +extern int phonedev_init(void); +#define PHONE_MAJOR 100 +extern int phone_register_device(struct phone_device *, int unit); +#define PHONE_UNIT_ANY -1 +extern void phone_unregister_device(struct phone_device *); + +#endif +#endif diff --git a/pfinet/linux-src/include/linux/proc_fs.h b/pfinet/linux-src/include/linux/proc_fs.h index e1b0a893..77d7d741 100644 --- a/pfinet/linux-src/include/linux/proc_fs.h +++ b/pfinet/linux-src/include/linux/proc_fs.h @@ -466,6 +466,7 @@ extern inline void remove_proc_entry(const char *name, struct proc_dir_entry *pa extern inline void proc_tty_register_driver(struct tty_driver *driver) {}; extern inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; +extern struct proc_dir_entry proc_root; -#endif +#endif /* CONFIG_PROC_FS */ #endif /* _LINUX_PROC_FS_H */ diff --git a/pfinet/linux-src/include/linux/rtnetlink.h b/pfinet/linux-src/include/linux/rtnetlink.h index b339f652..39802a5f 100644 --- a/pfinet/linux-src/include/linux/rtnetlink.h +++ b/pfinet/linux-src/include/linux/rtnetlink.h @@ -1,7 +1,9 @@ #ifndef __LINUX_RTNETLINK_H #define __LINUX_RTNETLINK_H +#ifdef __KERNEL__ #include +#endif #include #define RTNL_DEBUG 1 diff --git a/pfinet/linux-src/include/linux/sched.h b/pfinet/linux-src/include/linux/sched.h index 4a5ffd58..d983c17e 100644 --- a/pfinet/linux-src/include/linux/sched.h +++ b/pfinet/linux-src/include/linux/sched.h @@ -3,7 +3,7 @@ #include /* for HZ */ -extern unsigned long event; +extern unsigned long global_event; #include #include @@ -657,12 +657,12 @@ static inline int expand_files(struct files_struct *files, int nr) if (nr >= files->max_fdset) { expand = 1; - if ((err = expand_fdset(files, nr))) + if ((err = expand_fdset(files, nr + 1))) goto out; } if (nr >= files->max_fds) { expand = 1; - if ((err = expand_fd_array(files, nr))) + if ((err = expand_fd_array(files, nr + 1))) goto out; } err = expand; @@ -737,6 +737,7 @@ do { \ add_wait_queue(&wq, &__wait); \ for (;;) { \ current->state = TASK_UNINTERRUPTIBLE; \ + mb(); \ if (condition) \ break; \ schedule(); \ @@ -760,6 +761,7 @@ do { \ add_wait_queue(&wq, &__wait); \ for (;;) { \ current->state = TASK_INTERRUPTIBLE; \ + mb(); \ if (condition) \ break; \ if (!signal_pending(current)) { \ diff --git a/pfinet/linux-src/include/linux/sdla_chdlc.h b/pfinet/linux-src/include/linux/sdla_chdlc.h new file mode 100644 index 00000000..c82fe14b --- /dev/null +++ b/pfinet/linux-src/include/linux/sdla_chdlc.h @@ -0,0 +1,808 @@ +/************************************************************************* + sdla_chdlc.h Sangoma Cisco HDLC firmware API definitions + + Author: Gideon Hack + Nenad Corbic + + Copyright: (c) 1995-1999 Sangoma Technologies Inc. + + This program is free software; you can redistribute it and/or + modify it under the term 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. + +=========================================================================== + Oct 04, 1999 Nenad Corbic Updated API support + Jun 02, 1999 Gideon Hack Changes for S514 usage. + Oct 28, 1998 Jaspreet Singh Made changes for Dual Port CHDLC. + Jun 11, 1998 David Fong Initial version. +=========================================================================== + + Organization + - Compatibility notes + - Constants defining the shared memory control block (mailbox) + - Interface commands + - Return code from interface commands + - Constants for the commands (structures for casting data) + - UDP Management constants and structures + +*************************************************************************/ + +#ifndef _SDLA_CHDLC_H +# define _SDLC_CHDLC_H + +/*------------------------------------------------------------------------ + Notes: + + All structres defined in this file are byte-aligned. + + Compiler Platform + ------------------------ + GNU C Linux + +------------------------------------------------------------------------*/ + +#ifndef PACKED +#define PACKED __attribute__((packed)) +#endif /* PACKED */ + + +/* ---------------------------------------------------------------------------- + * Constants defining the shared memory control block (mailbox) + * --------------------------------------------------------------------------*/ + +#define PRI_BASE_ADDR_MB_STRUCT 0xE000 /* the base address of the mailbox structure on the adapter */ +#define SEC_BASE_ADDR_MB_STRUCT 0xE800 /* the base address of the mailbox structure on the adapter */ +#define SIZEOF_MB_DATA_BFR 2032 /* the size of the actual mailbox data area */ +#define NUMBER_MB_RESERVED_BYTES 0x0B /* the number of reserved bytes in the mailbox header area */ + + +#define MIN_LGTH_CHDLC_DATA_CFG 300 /* min length of the CHDLC data field (for configuration purposes) */ +#define PRI_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* PRIMARY - max length of the CHDLC data field */ + +typedef struct { + unsigned char opp_flag PACKED; /* the opp flag */ + unsigned char command PACKED; /* the user command */ + unsigned short buffer_length PACKED; /* the data length */ + unsigned char return_code PACKED; /* the return code */ + unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; /* reserved for later */ + unsigned char data[SIZEOF_MB_DATA_BFR] PACKED; /* the data area */ +} CHDLC_MAILBOX_STRUCT; + +typedef struct { + pid_t pid_num PACKED; + CHDLC_MAILBOX_STRUCT cmdarea PACKED; + +} CMDBLOCK_STRUCT; + + + + +/* ---------------------------------------------------------------------------- + * Interface commands + * --------------------------------------------------------------------------*/ + +/* global interface commands */ +#define READ_GLOBAL_EXCEPTION_CONDITION 0x01 +#define SET_GLOBAL_CONFIGURATION 0x02 +#define READ_GLOBAL_CONFIGURATION 0x03 +#define READ_GLOBAL_STATISTICS 0x04 +#define FLUSH_GLOBAL_STATISTICS 0x05 +#define SET_MODEM_STATUS 0x06 /* set status of DTR or RTS */ +#define READ_MODEM_STATUS 0x07 /* read status of CTS and DCD */ +#define READ_COMMS_ERROR_STATS 0x08 +#define FLUSH_COMMS_ERROR_STATS 0x09 +#define SET_TRACE_CONFIGURATION 0x0A /* set the line trace config */ +#define READ_TRACE_CONFIGURATION 0x0B /* read the line trace config */ +#define READ_TRACE_STATISTICS 0x0C /* read the trace statistics */ +#define FLUSH_TRACE_STATISTICS 0x0D /* flush the trace statistics */ +#define FT1_MONITOR_STATUS_CTRL 0x1C /* set the status of the S508/FT1 monitoring */ +#define SET_FT1_CONFIGURATION 0x18 /* set the FT1 configuration */ +#define READ_FT1_CONFIGURATION 0x19 /* read the FT1 configuration */ +#define TRANSMIT_ASYNC_DATA_TO_FT1 0x1A /* output asynchronous data to the FT1 */ +#define RECEIVE_ASYNC_DATA_FROM_FT1 0x1B /* receive asynchronous data from the FT1 */ +#define FT1_MONITOR_STATUS_CTRL 0x1C /* set the status of the FT1 monitoring */ + +#define READ_FT1_OPERATIONAL_STATS 0x1D /* read the S508/FT1 operational statistics */ +#define SET_FT1_MODE 0x1E /* set the operational mode of the S508/FT1 module */ + +/* CHDLC-level interface commands */ +#define READ_CHDLC_CODE_VERSION 0x20 +#define READ_CHDLC_EXCEPTION_CONDITION 0x21 /* read exception condition from the adapter */ +#define SET_CHDLC_CONFIGURATION 0x22 +#define READ_CHDLC_CONFIGURATION 0x23 +#define ENABLE_CHDLC_COMMUNICATIONS 0x24 +#define DISABLE_CHDLC_COMMUNICATIONS 0x25 +#define READ_CHDLC_LINK_STATUS 0x26 +#define READ_CHDLC_OPERATIONAL_STATS 0x27 +#define FLUSH_CHDLC_OPERATIONAL_STATS 0x28 +#define SET_CHDLC_INTERRUPT_TRIGGERS 0x30 /* set application interrupt triggers */ +#define READ_CHDLC_INTERRUPT_TRIGGERS 0x31 /* read application interrupt trigger configuration */ + +/* Special UDP drivers management commands */ +#define CPIPE_ENABLE_TRACING 0x50 +#define CPIPE_DISABLE_TRACING 0x51 +#define CPIPE_GET_TRACE_INFO 0x52 +#define CPIPE_GET_IBA_DATA 0x53 +#define CPIPE_FT1_READ_STATUS 0x54 +#define CPIPE_DRIVER_STAT_IFSEND 0x55 +#define CPIPE_DRIVER_STAT_INTR 0x56 +#define CPIPE_DRIVER_STAT_GEN 0x57 +#define CPIPE_FLUSH_DRIVER_STATS 0x58 +#define CPIPE_ROUTER_UP_TIME 0x59 + +/* Driver specific commands for API */ +#define CHDLC_READ_TRACE_DATA 0xE4 /* read trace data */ +#define TRACE_ALL 0x00 +#define TRACE_PROT 0x01 +#define TRACE_DATA 0x02 + +/* ---------------------------------------------------------------------------- + * Return codes from interface commands + * --------------------------------------------------------------------------*/ + +#define COMMAND_OK 0x00 + +/* return codes from global interface commands */ +#define NO_GLOBAL_EXCEP_COND_TO_REPORT 0x01 /* there is no CHDLC exception condition to report */ +#define LGTH_GLOBAL_CFG_DATA_INVALID 0x01 /* the length of the passed global configuration data is invalid */ +#define LGTH_TRACE_CFG_DATA_INVALID 0x01 /* the length of the passed trace configuration data is invalid */ +#define IRQ_TIMEOUT_VALUE_INVALID 0x02 /* an invalid application IRQ timeout value was selected */ +#define TRACE_CONFIG_INVALID 0x02 /* the passed line trace configuration is invalid */ +#define ADAPTER_OPERATING_FREQ_INVALID 0x03 /* an invalid adapter operating frequency was selected */ +#define TRC_DEAC_TMR_INVALID 0x03 /* the trace deactivation timer is invalid */ +#define S508_FT1_ADPTR_NOT_PRESENT 0x0C /* the S508/FT1 adapter is not present */ +#define INVALID_FT1_STATUS_SELECTION 0x0D /* the S508/FT1 status selection is invalid */ +#define FT1_OP_STATS_NOT_ENABLED 0x0D /* the FT1 operational statistics have not been enabled */ +#define FT1_OP_STATS_NOT_AVAILABLE 0x0E /* the FT1 operational statistics are not currently available */ +#define S508_FT1_MODE_SELECTION_BUSY 0x0E /* the S508/FT1 adapter is busy selecting the operational mode */ + +/* return codes from command READ_GLOBAL_EXCEPTION_CONDITION */ +#define EXCEP_MODEM_STATUS_CHANGE 0x10 /* a modem status change occurred */ +#define EXCEP_TRC_DISABLED 0x11 /* the trace has been disabled */ +#define EXCEP_IRQ_TIMEOUT 0x12 /* IRQ timeout */ + +/* return codes from CHDLC-level interface commands */ +#define NO_CHDLC_EXCEP_COND_TO_REPORT 0x21 /* there is no CHDLC exception condition to report */ +#define CHDLC_COMMS_DISABLED 0x21 /* communications are not currently enabled */ +#define CHDLC_COMMS_ENABLED 0x21 /* communications are currently enabled */ +#define DISABLE_CHDLC_COMMS_BEFORE_CFG 0x21 /* CHDLC communications must be disabled before setting the configuration */ +#define ENABLE_CHDLC_COMMS_BEFORE_CONN 0x21 /* communications must be enabled before using the CHDLC_CONNECT conmmand */ +#define CHDLC_CFG_BEFORE_COMMS_ENABLED 0x22 /* perform a SET_CHDLC_CONFIGURATION before enabling comms */ +#define LGTH_CHDLC_CFG_DATA_INVALID 0x22 /* the length of the passed CHDLC configuration data is invalid */ +#define LGTH_INT_TRIGGERS_DATA_INVALID 0x22 /* the length of the passed interrupt trigger data is invalid */ +#define INVALID_IRQ_SELECTED 0x23 /* in invalid IRQ was selected in the SET_CHDLC_INTERRUPT_TRIGGERS */ +#define INVALID_CHDLC_CFG_DATA 0x23 /* the passed CHDLC configuration data is invalid */ +#define IRQ_TMR_VALUE_INVALID 0x24 /* an invalid application IRQ timer value was selected */ +#define LARGER_PERCENT_TX_BFR_REQUIRED 0x24 /* a larger Tx buffer percentage is required */ +#define LARGER_PERCENT_RX_BFR_REQUIRED 0x25 /* a larger Rx buffer percentage is required */ +#define S514_BOTH_PORTS_SAME_CLK_MODE 0x26 /* S514 - both ports must have same clock mode */ +#define INVALID_CMND_HDLC_STREAM_MODE 0x4E /* the CHDLC interface command is invalid for HDLC streaming mode */ +#define INVALID_CHDLC_COMMAND 0x4F /* the defined CHDLC interface command is invalid */ + +/* return codes from command READ_CHDLC_EXCEPTION_CONDITION */ +#define EXCEP_LINK_ACTIVE 0x30 /* the CHDLC link has become active */ +#define EXCEP_LINK_INACTIVE_MODEM 0x31 /* the CHDLC link has become inactive (modem status) */ +#define EXCEP_LINK_INACTIVE_KPALV 0x32 /* the CHDLC link has become inactive (keepalive status) */ +#define EXCEP_IP_ADDRESS_DISCOVERED 0x33 /* the IP address has been discovered */ +#define EXCEP_LOOPBACK_CONDITION 0x34 /* a loopback condition has occurred */ + + +/* return code from command CHDLC_SEND_WAIT and CHDLC_SEND_NO_WAIT */ +#define LINK_DISCONNECTED 0x21 +#define NO_TX_BFRS_AVAIL 0x24 + + +/* ---------------------------------------------------------------------------- + * Constants for the SET_GLOBAL_CONFIGURATION/READ_GLOBAL_CONFIGURATION commands + * --------------------------------------------------------------------------*/ + +/* the global configuration structure */ +typedef struct { + unsigned short adapter_config_options PACKED; /* adapter config options */ + unsigned short app_IRQ_timeout PACKED; /* application IRQ timeout */ + unsigned long adapter_operating_frequency PACKED; /* adapter operating frequency */ +} GLOBAL_CONFIGURATION_STRUCT; + +/* settings for the 'app_IRQ_timeout' */ +#define MAX_APP_IRQ_TIMEOUT_VALUE 5000 /* the maximum permitted IRQ timeout */ + + + +/* ---------------------------------------------------------------------------- + * Constants for the READ_GLOBAL_STATISTICS command + * --------------------------------------------------------------------------*/ + +/* the global statistics structure */ +typedef struct { + unsigned short app_IRQ_timeout_count PACKED; +} GLOBAL_STATS_STRUCT; + + + +/* ---------------------------------------------------------------------------- + * Constants for the READ_COMMS_ERROR_STATS command + * --------------------------------------------------------------------------*/ + +/* the communications error statistics structure */ +typedef struct { + unsigned short Rx_overrun_err_count PACKED; + unsigned short CRC_err_count PACKED; /* receiver CRC error count */ + unsigned short Rx_abort_count PACKED; /* abort frames recvd count */ + unsigned short Rx_dis_pri_bfrs_full_count PACKED;/* receiver disabled */ + unsigned short comms_err_stat_reserved_1 PACKED;/* reserved for later */ + unsigned short sec_Tx_abort_msd_Tx_int_count PACKED; /* secondary - abort frames transmitted count (missed Tx interrupt) */ + unsigned short missed_Tx_und_int_count PACKED; /* missed tx underrun interrupt count */ + unsigned short sec_Tx_abort_count PACKED; /*secondary-abort frames tx count */ + unsigned short DCD_state_change_count PACKED; /* DCD state change */ + unsigned short CTS_state_change_count PACKED; /* CTS state change */ +} COMMS_ERROR_STATS_STRUCT; + + + +/* ---------------------------------------------------------------------------- + * Constants used for line tracing + * --------------------------------------------------------------------------*/ + +/* the trace configuration structure (SET_TRACE_CONFIGURATION/READ_TRACE_CONFIGURATION commands) */ +typedef struct { + unsigned char trace_config PACKED; /* trace configuration */ + unsigned short trace_deactivation_timer PACKED; /* trace deactivation timer */ + unsigned long ptr_trace_stat_el_cfg_struct PACKED; /* a pointer to the line trace element configuration structure */ +} LINE_TRACE_CONFIG_STRUCT; + +/* 'trace_config' bit settings */ +#define TRACE_INACTIVE 0x00 /* trace is inactive */ +#define TRACE_ACTIVE 0x01 /* trace is active */ +#define TRACE_DELAY_MODE 0x04 /* operate the trace in delay mode */ +#define TRACE_DATA_FRAMES 0x08 /* trace Data frames */ +#define TRACE_SLARP_FRAMES 0x10 /* trace SLARP frames */ +#define TRACE_CDP_FRAMES 0x20 /* trace CDP frames */ + +/* the line trace status element configuration structure */ +typedef struct { + unsigned short number_trace_status_elements PACKED; /* number of line trace elements */ + unsigned long base_addr_trace_status_elements PACKED; /* base address of the trace element list */ + unsigned long next_trace_element_to_use PACKED; /* pointer to the next trace element to be used */ + unsigned long base_addr_trace_buffer PACKED; /* base address of the trace data buffer */ + unsigned long end_addr_trace_buffer PACKED; /* end address of the trace data buffer */ +} TRACE_STATUS_EL_CFG_STRUCT; + +/* the line trace status element structure */ +typedef struct { + unsigned char opp_flag PACKED; /* opp flag */ + unsigned short trace_length PACKED; /* trace length */ + unsigned char trace_type PACKED; /* trace type */ + unsigned short trace_time_stamp PACKED; /* time stamp */ + unsigned short trace_reserved_1 PACKED; /* reserved for later use */ + unsigned long trace_reserved_2 PACKED; /* reserved for later use */ + unsigned long ptr_data_bfr PACKED; /* ptr to the trace data buffer */ +} TRACE_STATUS_ELEMENT_STRUCT; + +/* "trace_type" bit settings */ +#define TRACE_INCOMING 0x00 +#define TRACE_OUTGOINGING 0x01 +#define TRACE_INCOMING_ABORTED 0x10 +#define TRACE_INCOMING_CRC_ERROR 0x20 +#define TRACE_INCOMING_OVERRUN_ERROR 0x40 + + + +/* the line trace statistics structure */ +typedef struct { + unsigned long frames_traced_count PACKED; /* number of frames traced */ + unsigned long trc_frms_not_recorded_count PACKED; /* number of trace frames discarded */ +} LINE_TRACE_STATS_STRUCT; + + +/* ---------------------------------------------------------------------------- + * Constants for the FT1_MONITOR_STATUS_CTRL command + * --------------------------------------------------------------------------*/ + +#define DISABLE_FT1_STATUS_STATISTICS 0x00 /* disable the FT1 status and statistics monitoring */ +#define ENABLE_READ_FT1_STATUS 0x01 /* read the FT1 operational status */ +#define ENABLE_READ_FT1_OP_STATS 0x02 /* read the FT1 operational statistics */ +#define FLUSH_FT1_OP_STATS 0x04 /* flush the FT1 operational statistics */ + + + + +/* ---------------------------------------------------------------------------- + * Constants for the SET_CHDLC_CONFIGURATION command + * --------------------------------------------------------------------------*/ + +/* the CHDLC configuration structure */ +typedef struct { + unsigned long baud_rate PACKED; /* the baud rate */ + unsigned short line_config_options PACKED; /* line configuration options */ + unsigned short modem_config_options PACKED; /* modem configration options */ + unsigned short modem_status_timer PACKED; /* timer for monitoring modem status changes */ + unsigned short CHDLC_API_options PACKED; /* CHDLC API options */ + unsigned short CHDLC_protocol_options PACKED; /* CHDLC protocol options */ + unsigned short percent_data_buffer_for_Tx PACKED; /* percentage data buffering used for Tx */ + unsigned short CHDLC_statistics_options PACKED; /* CHDLC operational statistics options */ + unsigned short max_CHDLC_data_field_length PACKED; /* the maximum length of the CHDLC Data field */ + unsigned short transmit_keepalive_timer PACKED; /* the transmit keepalive timer */ + unsigned short receive_keepalive_timer PACKED; /* the receive keepalive timer */ + unsigned short keepalive_error_tolerance PACKED; /* the receive keepalive error tolerance */ + unsigned short SLARP_request_timer PACKED; /* the SLARP request timer */ + unsigned long IP_address PACKED; /* the IP address */ + unsigned long IP_netmask PACKED; /* the IP netmask */ + unsigned long ptr_shared_mem_info_struct PACKED; /* a pointer to the shared memory area information structure */ + unsigned long ptr_CHDLC_Tx_stat_el_cfg_struct PACKED; /* a pointer to the transmit status element configuration structure */ + unsigned long ptr_CHDLC_Rx_stat_el_cfg_struct PACKED; /* a pointer to the receive status element configuration structure */ +} CHDLC_CONFIGURATION_STRUCT; + +/* settings for the 'line_config_options' */ +#define INTERFACE_LEVEL_V35 0x0000 /* V.35 interface level */ +#define INTERFACE_LEVEL_RS232 0x0001 /* RS-232 interface level */ + +/* settings for the 'modem_config_options' */ + +#define DONT_RAISE_DTR_RTS_ON_EN_COMMS 0x0001 +/* don't automatically raise DTR and RTS when performing an + ENABLE_CHDLC_COMMUNICATIONS command */ + +#define DONT_REPORT_CHG_IN_MODEM_STAT 0x0002 +/* don't report changes in modem status to the application */ + + +/* bit settings for the 'CHDLC_protocol_options' byte */ + +#define IGNORE_DCD_FOR_LINK_STAT 0x0001 +/* ignore DCD in determining the CHDLC link status */ + +#define IGNORE_CTS_FOR_LINK_STAT 0x0002 +/* ignore CTS in determining the CHDLC link status */ + +#define IGNORE_KPALV_FOR_LINK_STAT 0x0004 +/* ignore keepalive frames in determining the CHDLC link status */ + +#define HDLC_STREAMING_MODE 0x8000 + +/* settings for the 'CHDLC_statistics_options' */ + +#define CHDLC_TX_DATA_BYTE_COUNT_STAT 0x0001 +/* record the number of Data bytes transmitted */ + +#define CHDLC_RX_DATA_BYTE_COUNT_STAT 0x0002 +/* record the number of Data bytes received */ + +#define CHDLC_TX_THROUGHPUT_STAT 0x0004 +/* compute the Data frame transmit throughput */ + +#define CHDLC_RX_THROUGHPUT_STAT 0x0008 +/* compute the Data frame receive throughput */ + + +/* permitted minimum and maximum values for setting the CHDLC configuration */ +#define PRI_MAX_BAUD_RATE_S508 2666666 /* PRIMARY - maximum baud rate (S508) */ +#define SEC_MAX_BAUD_RATE_S508 258064 /* SECONDARY - maximum baud rate (S508) */ +#define PRI_MAX_BAUD_RATE_S514 2750000 /* PRIMARY - maximum baud rate (S508) */ +#define SEC_MAX_BAUD_RATE_S514 515625 /* SECONDARY - maximum baud rate (S508) */ + +#define MIN_MODEM_TIMER 0 /* minimum modem status timer */ +#define MAX_MODEM_TIMER 5000 /* maximum modem status timer */ + +#define SEC_MAX_NO_DATA_BYTES_IN_FRAME 2048 /* SECONDARY - max length of the CHDLC data field */ + +#define MIN_Tx_KPALV_TIMER 0 /* minimum transmit keepalive timer */ +#define MAX_Tx_KPALV_TIMER 60000 /* maximum transmit keepalive timer */ +#define DEFAULT_Tx_KPALV_TIMER 10000 /* default transmit keepalive timer */ + +#define MIN_Rx_KPALV_TIMER 10 /* minimum receive keepalive timer */ +#define MAX_Rx_KPALV_TIMER 60000 /* maximum receive keepalive timer */ +#define DEFAULT_Rx_KPALV_TIMER 10000 /* default receive keepalive timer */ + +#define MIN_KPALV_ERR_TOL 1 /* min kpalv error tolerance count */ +#define MAX_KPALV_ERR_TOL 20 /* max kpalv error tolerance count */ +#define DEFAULT_KPALV_ERR_TOL 3 /* default value */ + +#define MIN_SLARP_REQ_TIMER 0 /* min transmit SLARP Request timer */ +#define MAX_SLARP_REQ_TIMER 60000 /* max transmit SLARP Request timer */ +#define DEFAULT_SLARP_REQ_TIMER 0 /* default value -- no SLARP */ + + + +/* ---------------------------------------------------------------------------- + * Constants for the READ_CHDLC_LINK_STATUS command + * --------------------------------------------------------------------------*/ + +/* the CHDLC status structure */ +typedef struct { + unsigned char CHDLC_link_status PACKED; /* CHDLC link status */ + unsigned char no_Data_frms_for_app PACKED; /* number of Data frames available for the application */ + unsigned char receiver_status PACKED; /* enabled/disabled */ + unsigned char SLARP_state PACKED; /* internal SLARP state */ +} CHDLC_LINK_STATUS_STRUCT; + +/* settings for the 'CHDLC_link_status' variable */ +#define CHDLC_LINK_INACTIVE 0x00 /* the CHDLC link is inactive */ +#define CHDLC_LINK_ACTIVE 0x01 /* the CHDLC link is active */ + + + +/* ---------------------------------------------------------------------------- + * Constants for the READ_CHDLC_OPERATIONAL_STATS command + * --------------------------------------------------------------------------*/ + +/* the CHDLC operational statistics structure */ +typedef struct { + + /* Data frame transmission statistics */ + unsigned long Data_frames_Tx_count PACKED; /* # of frames transmitted */ + unsigned long Data_bytes_Tx_count PACKED; /* # of bytes transmitted */ + unsigned long Data_Tx_throughput PACKED; /* transmit throughput */ + unsigned long no_ms_for_Data_Tx_thruput_comp PACKED; /* millisecond time used for the Tx throughput computation */ + unsigned long Tx_Data_discard_lgth_err_count PACKED; /* number of Data frames discarded (length error) */ + unsigned long reserved_Data_frm_Tx_stat1 PACKED; /* reserved for later */ + unsigned long reserved_Data_frm_Tx_stat2 PACKED; /* reserved for later */ + unsigned long reserved_Data_frm_Tx_stat3 PACKED; /* reserved for later */ + + /* Data frame reception statistics */ + unsigned long Data_frames_Rx_count PACKED; /* number of frames received */ + unsigned long Data_bytes_Rx_count PACKED; /* number of bytes received */ + unsigned long Data_Rx_throughput PACKED; /* receive throughput */ + unsigned long no_ms_for_Data_Rx_thruput_comp PACKED; /* millisecond time used for the Rx throughput computation */ + unsigned long Rx_Data_discard_short_count PACKED; /* received Data frames discarded (too short) */ + unsigned long Rx_Data_discard_long_count PACKED; /* received Data frames discarded (too long) */ + unsigned long Rx_Data_discard_inactive_count PACKED; /* received Data frames discarded (link inactive) */ + unsigned long reserved_Data_frm_Rx_stat1 PACKED; /* reserved for later */ + + /* SLARP frame transmission/reception statistics */ + unsigned long CHDLC_SLARP_REQ_Tx_count PACKED; /* number of SLARP Request frames transmitted */ + unsigned long CHDLC_SLARP_REQ_Rx_count PACKED; /* number of SLARP Request frames received */ + unsigned long CHDLC_SLARP_REPLY_Tx_count PACKED; /* number of SLARP Reply frames transmitted */ + unsigned long CHDLC_SLARP_REPLY_Rx_count PACKED; /* number of SLARP Reply frames received */ + unsigned long CHDLC_SLARP_KPALV_Tx_count PACKED; /* number of SLARP keepalive frames transmitted */ + unsigned long CHDLC_SLARP_KPALV_Rx_count PACKED; /* number of SLARP keepalive frames received */ + unsigned long reserved_SLARP_stat1 PACKED; /* reserved for later */ + unsigned long reserved_SLARP_stat2 PACKED; /* reserved for later */ + + /* CDP frame transmission/reception statistics */ + unsigned long CHDLC_CDP_Tx_count PACKED; /* number of CDP frames transmitted */ + unsigned long CHDLC_CDP_Rx_count PACKED; /* number of CDP frames received */ + unsigned long reserved_CDP_stat1 PACKED; /* reserved for later */ + unsigned long reserved_CDP_stat2 PACKED; /* reserved for later */ + unsigned long reserved_CDP_stat3 PACKED; /* reserved for later */ + unsigned long reserved_CDP_stat4 PACKED; /* reserved for later */ + unsigned long reserved_CDP_stat5 PACKED; /* reserved for later */ + unsigned long reserved_CDP_stat6 PACKED; /* reserved for later */ + + /* Incomming frames with a format error statistics */ + unsigned short Rx_frm_incomp_CHDLC_hdr_count PACKED; /* frames received of with incomplete Cisco HDLC header */ + unsigned short Rx_frms_too_long_count PACKED; /* frames received of excessive length count */ + unsigned short Rx_invalid_CHDLC_addr_count PACKED; /* frames received with an invalid CHDLC address count */ + unsigned short Rx_invalid_CHDLC_ctrl_count PACKED; /* frames received with an invalid CHDLC control field count */ + unsigned short Rx_invalid_CHDLC_type_count PACKED; /* frames received of an invalid CHDLC frame type count */ + unsigned short Rx_SLARP_invalid_code_count PACKED; /* SLARP frame received with an invalid packet code */ + unsigned short Rx_SLARP_Reply_bad_IP_addr PACKED; /* SLARP Reply received - bad IP address */ + unsigned short Rx_SLARP_Reply_bad_netmask PACKED; /* SLARP Reply received - bad netmask */ + unsigned long reserved_frm_format_err1 PACKED; /* reserved for later */ + unsigned long reserved_frm_format_err2 PACKED; /* reserved for later */ + unsigned long reserved_frm_format_err3 PACKED; /* reserved for later */ + unsigned long reserved_frm_format_err4 PACKED; /* reserved for later */ + + /* CHDLC timeout/retry statistics */ + unsigned short SLARP_Rx_keepalive_TO_count PACKED; /* timeout count for incomming SLARP frames */ + unsigned short SLARP_Request_TO_count PACKED; /* timeout count for SLARP Request frames */ + unsigned long To_retry_reserved_stat1 PACKED; /* reserved for later */ + unsigned long To_retry_reserved_stat2 PACKED; /* reserved for later */ + unsigned long To_retry_reserved_stat3 PACKED; /* reserved for later */ + + /* CHDLC link active/inactive and loopback statistics */ + unsigned short link_active_count PACKED; /* number of times that the link went active */ + unsigned short link_inactive_modem_count PACKED; /* number of times that the link went inactive (modem failure) */ + unsigned short link_inactive_keepalive_count PACKED; /* number of times that the link went inactive (keepalive failure) */ + unsigned short link_looped_count PACKED; /* link looped count */ + unsigned long link_status_reserved_stat1 PACKED; /* reserved for later use */ + unsigned long link_status_reserved_stat2 PACKED; /* reserved for later use */ + + /* miscellaneous statistics */ + unsigned long reserved_misc_stat1 PACKED; /* reserved for later */ + unsigned long reserved_misc_stat2 PACKED; /* reserved for later */ + unsigned long reserved_misc_stat3 PACKED; /* reserved for later */ + unsigned long reserved_misc_stat4 PACKED; /* reserved for later */ + +} CHDLC_OPERATIONAL_STATS_STRUCT; + + + +/* ---------------------------------------------------------------------------- + * Constants for using application interrupts + * --------------------------------------------------------------------------*/ + +/* the structure used for the SET_CHDLC_INTERRUPT_TRIGGERS/READ_CHDLC_INTERRUPT_TRIGGERS command */ +typedef struct { + unsigned char CHDLC_interrupt_triggers PACKED; /* CHDLC interrupt trigger configuration */ + unsigned char IRQ PACKED; /* IRQ to be used */ + unsigned short interrupt_timer PACKED; /* interrupt timer */ + unsigned short misc_interrupt_bits PACKED; /* miscellaneous bits */ +} CHDLC_INT_TRIGGERS_STRUCT; + +/* 'CHDLC_interrupt_triggers' bit settings */ +#define APP_INT_ON_RX_FRAME 0x01 /* interrupt on Data frame reception */ +#define APP_INT_ON_TX_FRAME 0x02 /* interrupt when an Data frame may be transmitted */ +#define APP_INT_ON_COMMAND_COMPLETE 0x04 /* interrupt when an interface command is complete */ +#define APP_INT_ON_TIMER 0x08 /* interrupt on a defined millisecond timeout */ +#define APP_INT_ON_GLOBAL_EXCEP_COND 0x10 /* interrupt on a global exception condition */ +#define APP_INT_ON_CHDLC_EXCEP_COND 0x20 /* interrupt on an CHDLC exception condition */ +#define APP_INT_ON_TRACE_DATA_AVAIL 0x80 /* interrupt when trace data is available */ + +/* interrupt types indicated at 'interrupt_type' byte of the INTERRUPT_INFORMATION_STRUCT */ +#define NO_APP_INTS_PEND 0x00 /* no interrups are pending */ +#define RX_APP_INT_PEND 0x01 /* a receive interrupt is pending */ +#define TX_APP_INT_PEND 0x02 /* a transmit interrupt is pending */ +#define COMMAND_COMPLETE_APP_INT_PEND 0x04 /* a 'command complete' interrupt is pending */ +#define TIMER_APP_INT_PEND 0x08 /* a timer interrupt is pending */ +#define GLOBAL_EXCEP_COND_APP_INT_PEND 0x10 /* a global exception condition interrupt is pending */ +#define CHDLC_EXCEP_COND_APP_INT_PEND 0x20 /* an CHDLC exception condition interrupt is pending */ +#define TRACE_DATA_AVAIL_APP_INT_PEND 0x80 /* a trace data available interrupt is pending */ + + +/* modem status changes */ +#define DCD_HIGH 0x08 +#define CTS_HIGH 0x20 + + +/* ---------------------------------------------------------------------------- + * Constants for Data frame transmission + * --------------------------------------------------------------------------*/ + +/* the Data frame transmit status element configuration structure */ +typedef struct { + unsigned short number_Tx_status_elements PACKED; /* number of transmit status elements */ + unsigned long base_addr_Tx_status_elements PACKED; /* base address of the transmit element list */ + unsigned long next_Tx_status_element_to_use PACKED; /* pointer to the next transmit element to be used */ +} CHDLC_TX_STATUS_EL_CFG_STRUCT; + +/* the Data frame transmit status element structure */ +typedef struct { + unsigned char opp_flag PACKED; /* opp flag */ + unsigned short frame_length PACKED; /* length of the frame to be transmitted */ + unsigned char reserved_1 PACKED; /* reserved for internal use */ + unsigned long reserved_2 PACKED; /* reserved for internal use */ + unsigned long reserved_3 PACKED; /* reserved for internal use */ + unsigned long ptr_data_bfr PACKED; /* pointer to the data area */ +} CHDLC_DATA_TX_STATUS_EL_STRUCT; + + + +/* ---------------------------------------------------------------------------- + * Constants for Data frame reception + * --------------------------------------------------------------------------*/ + +/* the Data frame receive status element configuration structure */ +typedef struct { + unsigned short number_Rx_status_elements PACKED; /* number of receive status elements */ + unsigned long base_addr_Rx_status_elements PACKED; /* base address of the receive element list */ + unsigned long next_Rx_status_element_to_use PACKED; /* pointer to the next receive element to be used */ + unsigned long base_addr_Rx_buffer PACKED; /* base address of the receive data buffer */ + unsigned long end_addr_Rx_buffer PACKED; /* end address of the receive data buffer */ +} CHDLC_RX_STATUS_EL_CFG_STRUCT; + +/* the Data frame receive status element structure */ +typedef struct { + unsigned char opp_flag PACKED; /* opp flag */ + unsigned short frame_length PACKED; /* length of the received frame */ + unsigned char error_flag PACKED; /* frame errors (HDLC_STREAMING_MODE)*/ + unsigned short time_stamp PACKED; /* receive time stamp (HDLC_STREAMING_MODE) */ + unsigned long reserved_1 PACKED; /* reserved for internal use */ + unsigned short reserved_2 PACKED; /* reserved for internal use */ + unsigned long ptr_data_bfr PACKED; /* pointer to the data area */ +} CHDLC_DATA_RX_STATUS_EL_STRUCT; + + + +/* ---------------------------------------------------------------------------- + * Constants defining the shared memory information area + * --------------------------------------------------------------------------*/ + +/* the global information structure */ +typedef struct { + unsigned char global_status PACKED; /* global status */ + unsigned char modem_status PACKED; /* current modem status */ + unsigned char global_excep_conditions PACKED; /* global exception conditions */ + unsigned char glob_info_reserved[5] PACKED; /* reserved */ + unsigned char codename[4] PACKED; /* Firmware name */ + unsigned char codeversion[4] PACKED; /* Firmware version */ +} GLOBAL_INFORMATION_STRUCT; + +/* the CHDLC information structure */ +typedef struct { + unsigned char CHDLC_status PACKED; /* CHDLC status */ + unsigned char CHDLC_excep_conditions PACKED; /* CHDLC exception conditions */ + unsigned char CHDLC_info_reserved[14] PACKED; /* reserved */ +} CHDLC_INFORMATION_STRUCT; + +/* the interrupt information structure */ +typedef struct { + unsigned char interrupt_type PACKED; /* type of interrupt triggered */ + unsigned char interrupt_permission PACKED; /* interrupt permission mask */ + unsigned char int_info_reserved[14] PACKED; /* reserved */ +} INTERRUPT_INFORMATION_STRUCT; + +/* the S508/FT1 information structure */ +typedef struct { + unsigned char parallel_port_A_input PACKED; /* input - parallel port A */ + unsigned char parallel_port_B_input PACKED; /* input - parallel port B */ + unsigned char FT1_info_reserved[14] PACKED; /* reserved */ +} FT1_INFORMATION_STRUCT; + +/* the shared memory area information structure */ +typedef struct { + GLOBAL_INFORMATION_STRUCT global_info_struct PACKED; /* the global information structure */ + CHDLC_INFORMATION_STRUCT CHDLC_info_struct PACKED; /* the CHDLC information structure */ + INTERRUPT_INFORMATION_STRUCT interrupt_info_struct PACKED; /* the interrupt information structure */ + FT1_INFORMATION_STRUCT FT1_info_struct PACKED; /* the S508/FT1 information structure */ +} SHARED_MEMORY_INFO_STRUCT; + +/* ---------------------------------------------------------------------------- + * UDP Management constants and structures + * --------------------------------------------------------------------------*/ + +/* The embedded control block for UDP mgmt + This is essentially a mailbox structure, without the large data field */ + +typedef struct { + unsigned char opp_flag PACKED; /* the opp flag */ + unsigned char command PACKED; /* the user command */ + unsigned short buffer_length PACKED; /* the data length */ + unsigned char return_code PACKED; /* the return code */ + unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; /* reserved for later */ +} cblock_t; + + +/* UDP management packet layout (data area of ip packet) */ +/* +typedef struct { + unsigned char signature[8] PACKED; + unsigned char request_reply PACKED; + unsigned char id PACKED; + unsigned char reserved[6] PACKED; + cblock_t cblock PACKED; + unsigned char num_frames PACKED; + unsigned char ismoredata PACKED; + unsigned char data[SIZEOF_MB_DATA_BFR] PACKED; +} udp_management_packet_t; + +*/ + +typedef struct { + unsigned char num_frames PACKED; + unsigned char ismoredata PACKED; +} trace_info_t; + +typedef struct { + ip_pkt_t ip_pkt PACKED; + udp_pkt_t udp_pkt PACKED; + wp_mgmt_t wp_mgmt PACKED; + cblock_t cblock PACKED; + trace_info_t trace_info PACKED; + unsigned char data[SIZEOF_MB_DATA_BFR] PACKED; +} chdlc_udp_pkt_t; + +typedef struct ft1_exec_cmd{ + unsigned char command PACKED; /* the user command */ + unsigned short buffer_length PACKED; /* the data length */ + unsigned char return_code PACKED; /* the return code */ + unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; +} ft1_exec_cmd_t; + +typedef struct { + unsigned char opp_flag PACKED; + ft1_exec_cmd_t cmd PACKED; + unsigned char data[SIZEOF_MB_DATA_BFR] PACKED; +} ft1_exec_t; + +#define UDPMGMT_SIGNATURE "CTPIPEAB" + + +/* UDP/IP packet (for UDP management) layout */ +/* +typedef struct { + unsigned char reserved[2] PACKED; + unsigned short ip_length PACKED; + unsigned char reserved2[4] PACKED; + unsigned char ip_ttl PACKED; + unsigned char ip_protocol PACKED; + unsigned short ip_checksum PACKED; + unsigned long ip_src_address PACKED; + unsigned long ip_dst_address PACKED; + unsigned short udp_src_port PACKED; + unsigned short udp_dst_port PACKED; + unsigned short udp_length PACKED; + unsigned short udp_checksum PACKED; + udp_management_packet_t um_packet PACKED; +} ip_packet_t; +*/ + +/* valid ip_protocol for UDP management */ +#define UDPMGMT_UDP_PROTOCOL 0x11 + + +typedef struct { + unsigned char status PACKED; + unsigned char data_avail PACKED; + unsigned short real_length PACKED; + unsigned short time_stamp PACKED; + unsigned char data[1] PACKED; +} trace_pkt_t; + +typedef struct { + unsigned char error_flag PACKED; + unsigned short time_stamp PACKED; + unsigned char reserved[13] PACKED; +} api_rx_hdr_t; + +typedef struct { + api_rx_hdr_t api_rx_hdr PACKED; + void * data PACKED; +} api_rx_element_t; + +typedef struct { + unsigned char attr PACKED; + unsigned char reserved[15] PACKED; +} api_tx_hdr_t; + +typedef struct { + api_tx_hdr_t api_tx_hdr PACKED; + void * data PACKED; +} api_tx_element_t; + +/* ---------------------------------------------------------------------------- + * Constants for the SET_FT1_CONFIGURATION/READ_FT1_CONFIGURATION command + * --------------------------------------------------------------------------*/ + +/* the FT1 configuration structure */ +typedef struct { + unsigned short framing_mode; + unsigned short encoding_mode; + unsigned short line_build_out; + unsigned short channel_base; + unsigned short baud_rate_kbps; /* the baud rate (in kbps) */ + unsigned short clock_mode; +} ft1_config_t; + +/* settings for the 'framing_mode' */ +#define ESF_FRAMING 0x00 /* ESF framing */ +#define D4_FRAMING 0x01 /* D4 framing */ + +/* settings for the 'encoding_mode' */ +#define B8ZS_ENCODING 0x00 /* B8ZS encoding */ +#define AMI_ENCODING 0x01 /* AMI encoding */ + +/* settings for the 'line_build_out' */ +#define LN_BLD_CSU_0dB_DSX1_0_to_133 0x00 /* set build out to CSU (0db) or DSX-1 (0-133ft) */ +#define LN_BLD_DSX1_133_to_266 0x01 /* set build out DSX-1 (133-266ft) */ +#define LN_BLD_DSX1_266_to_399 0x02 /* set build out DSX-1 (266-399ft) */ +#define LN_BLD_DSX1_399_to_533 0x03 /* set build out DSX-1 (399-533ft) */ +#define LN_BLD_DSX1_533_to_655 0x04 /* set build out DSX-1 (533-655ft) */ +#define LN_BLD_CSU_NEG_7dB 0x05 /* set build out to CSU (-7.5db) */ +#define LN_BLD_CSU_NEG_15dB 0x06 /* set build out to CSU (-15db) */ +#define LN_BLD_CSU_NEG_22dB 0x07 /* set build out to CSU (-22.5db) */ + +/* settings for the 'channel_base' */ +#define MIN_CHANNEL_BASE_VALUE 1 /* the minimum permitted channel base value */ +#define MAX_CHANNEL_BASE_VALUE 24 /* the maximum permitted channel base value */ + +/* settings for the 'baud_rate_kbps' */ +#define MIN_BAUD_RATE_KBPS 0 /* the minimum permitted baud rate (kbps) */ +#define MAX_BAUD_RATE_KBPS 1536 /* the maximum permitted baud rate (kbps) */ +#define BAUD_RATE_FT1_AUTO_CONFIG 0xFFFF /* the baud rate used to trigger an automatic FT1 configuration */ + +/* settings for the 'clock_mode' */ +#define CLOCK_MODE_NORMAL 0x00 /* clock mode set to normal (slave) */ +#define CLOCK_MODE_MASTER 0x01 /* clock mode set to master */ + + +#define BAUD_RATE_FT1_AUTO_CONFIG 0xFFFF +#define AUTO_FT1_CONFIG_NOT_COMPLETE 0x08 +#define AUTO_FT1_CFG_FAIL_OP_MODE 0x0C +#define AUTO_FT1_CFG_FAIL_INVALID_LINE 0x0D + + +#ifdef _MSC_ +# pragma pack() +#endif +#endif /* _SDLA_CHDLC_H */ diff --git a/pfinet/linux-src/include/linux/sdla_fr.h b/pfinet/linux-src/include/linux/sdla_fr.h index 533f2acb..f5aef96a 100644 --- a/pfinet/linux-src/include/linux/sdla_fr.h +++ b/pfinet/linux-src/include/linux/sdla_fr.h @@ -1,16 +1,18 @@ /***************************************************************************** * sdla_fr.h Sangoma frame relay firmware API definitions. * -* Author: Jaspreet Singh -* Gene Kozin <74604.152@compuserve.com> +* Author: Gideon Hack +* Nenad Corbic * -* Copyright: (c) 1995-1996 Sangoma Technologies Inc. +* Copyright: (c) 1995-1999 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. * ============================================================================ +* Oct 04, 1999 Gideon Hack Updated API structures +* Jun 02, 1999 Gideon Hack Modifications for S514 support * Oct 12, 1997 Jaspreet Singh Added FR_READ_DLCI_IB_MAPPING * Jul 21, 1997 Jaspreet Singh Changed FRRES_TOO_LONG and FRRES_TOO_MANY to * 0x05 and 0x06 respectively. @@ -24,26 +26,16 @@ /*---------------------------------------------------------------------------- * Notes: * ------ - * 1. All structures defined in this file are byte-alined. To ensure - * portability of this code between different platforms and compilers, one - * of the following defines must be defined before including this file: + * 1. All structures defined in this file are byte-alined. * - * Compiler Platform Define Use option - * -------- -------- ------ ---------- - * GNU C Linux _GNUC_ - - * Microsoft C DOS/Windows _MSC_ - + * Compiler Platform + * -------- -------- + * GNU C Linux */ -#ifdef _GNUC_ -# ifndef PACKED +#ifndef PACKED # define PACKED __attribute__((packed)) -# endif /* PACKED */ -#else -# define PACKED -#endif -#ifdef _MSC_ -# pragma pack(1) -#endif +#endif /* PACKED */ /* Adapter memory layout */ #define FR_MB_VECTOR 0xE000 /* mailbox window vector */ @@ -59,6 +51,11 @@ /* Important constants */ #define FR502_MAX_DATA 4096 /* maximum data buffer length */ #define FR508_MAX_DATA 4080 /* maximum data buffer length */ +#define MIN_LGTH_FR_DATA_CFG 300 /* min Information frame length +(for configuration purposes) */ +#define FR_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* max Information frame length */ + +#define HIGHEST_VALID_DLCI 991 /****** Data Structures *****************************************************/ @@ -90,6 +87,7 @@ typedef struct fr_cmd #define FR_FLUSH_STATISTICS 0x16 #define FR_LIST_ACTIVE_DLCI 0x17 #define FR_FLUSH_DATA_BUFFERS 0x18 +#define FR_READ_ADD_DLC_STATS 0x19 #define FR_ADD_DLCI 0x20 #define FR_DELETE_DLCI 0x21 #define FR_ACTIVATE_DLCI 0x22 @@ -102,6 +100,20 @@ typedef struct fr_cmd #define FR_READ_CODE_VERSION 0x40 #define FR_SET_INTR_MODE 0x50 #define FR_READ_INTR_MODE 0x51 +#define FR_SET_TRACE_CONFIG 0x60 +#define FR_FT1_STATUS_CTRL 0x80 +#define FR_SET_FT1_MODE 0x81 + +/* Special UDP drivers management commands */ +#define FPIPE_ENABLE_TRACING 0x41 +#define FPIPE_DISABLE_TRACING 0x42 +#define FPIPE_GET_TRACE_INFO 0x43 +#define FPIPE_FT1_READ_STATUS 0x44 +#define FPIPE_DRIVER_STAT_IFSEND 0x45 +#define FPIPE_DRIVER_STAT_INTR 0x46 +#define FPIPE_DRIVER_STAT_GEN 0x47 +#define FPIPE_FLUSH_DRIVER_STATS 0x48 +#define FPIPE_ROUTER_UP_TIME 0x49 /* 'result' field defines */ #define FRRES_OK 0x00 /* command executed successfully */ @@ -169,7 +181,7 @@ typedef struct fr508_flags } fr508_flags_t; /* 'event' field defines */ -#define FR_EVENT_STATUS 0x01 /* channel status change ??? */ +#define FR_EVENT_STATUS 0x01 /* channel status change */ #define FR_EVENT_DLC_STATUS 0x02 /* DLC status change */ #define FR_EVENT_BAD_DLCI 0x04 /* FSR included wrong DLCI */ #define FR_EVENT_LINK_DOWN 0x40 /* DCD or CTS low */ @@ -185,6 +197,8 @@ typedef struct fr508_flags #define FR_INTR_READY 0x08 /* interface command completed */ #define FR_INTR_DLC 0x10 /* DLC status change */ #define FR_INTR_TIMER 0x20 /* millisecond timer */ +#define FR_INTR_TX_MULT_DLCIs 0x80 /* Tx interrupt on multiple DLCIs */ + /*---------------------------------------------------------------------------- * Receive Buffer Configuration Info. S508 only! @@ -206,7 +220,7 @@ typedef struct fr_buf_info * 'rse_base' field of the frBufInfo_t structure into absolute adapter * memory address space. */ -typedef struct fr_buf_ctl +typedef struct fr_rx_buf_ctl { unsigned char flag PACKED; /* 00h: ready flag */ unsigned short length PACKED; /* 01h: frame length */ @@ -215,7 +229,18 @@ typedef struct fr_buf_ctl unsigned short tmstamp PACKED; /* 06h: time stamp */ unsigned short rsrv[2] PACKED; /* 08h: */ unsigned long offset PACKED; /* 0Ch: buffer absolute address */ -} fr_buf_ctl_t; +} fr_rx_buf_ctl_t; + +typedef struct fr_tx_buf_ctl +{ + unsigned char flag PACKED; /* 00h: ready flag */ + unsigned short rsrv0[2] PACKED; /* 01h: */ + unsigned short length PACKED; /* 05h: frame length */ + unsigned short dlci PACKED; /* 07h: DLCI */ + unsigned char attr PACKED; /* 09h: FECN/BECN/DE/CR */ + unsigned short rsrv1 PACKED; /* 0Ah: */ + unsigned long offset PACKED; /* 0Ch: buffer absolute address */ +} fr_tx_buf_ctl_t; /*---------------------------------------------------------------------------- * Global Configuration Block. Passed to FR_SET_CONFIG command when dlci == 0. @@ -271,6 +296,52 @@ typedef struct fr_conf #define FRCFG_MODE_V35 0x0000 /* S508 only */ #define FRCFG_MODE_RS232 0x0002 /* S508 only */ +/* defines for line tracing */ + +/* the line trace status element presented by the frame relay code */ +typedef struct { + unsigned char flag PACKED; /* ready flag */ + unsigned short length PACKED; /* trace length */ + unsigned char rsrv0[2] PACKED; /* reserved */ + unsigned char attr PACKED; /* trace attributes */ + unsigned short tmstamp PACKED; /* time stamp */ + unsigned char rsrv1[4] PACKED; /* reserved */ + unsigned long offset PACKED; /* buffer absolute address */ +} fr_trc_el_t; + +typedef struct { + unsigned char status PACKED; /* status flag */ + unsigned char data_passed PACKED; /* 0 if no data passed, 1 if */ + /* data passed */ + unsigned short length PACKED; /* frame length */ + unsigned short tmstamp PACKED; /* time stamp */ +} fpipemon_trc_hdr_t; + +typedef struct { + fpipemon_trc_hdr_t fpipemon_trc_hdr PACKED; + unsigned char data[FR_MAX_NO_DATA_BYTES_IN_FRAME] PACKED; +} fpipemon_trc_t; + +/* bit settings for the 'status' byte - note that bits 1, 2 and 3 are used */ +/* for returning the number of frames being passed to fpipemon */ +#define TRC_OUTGOING_FRM 0x01 +#define TRC_ABORT_ERROR 0x10 +#define TRC_CRC_ERROR 0x20 +#define TRC_OVERRUN_ERROR 0x40 +#define MORE_TRC_DATA 0x80 + +#define MAX_FRMS_TRACED 0x07 + +#define NO_TRC_ELEMENTS_OFF 0x9000 +#define BASE_TRC_ELEMENTS_OFF 0x9002 +#define TRC_ACTIVE 0x01 +#define FLUSH_TRC_BUFFERS 0x02 +#define FLUSH_TRC_STATISTICS 0x04 +#define TRC_SIGNALLING_FRMS 0x10 +#define TRC_INFO_FRMS 0x20 +#define ACTIVATE_TRC (TRC_ACTIVE | TRC_SIGNALLING_FRMS | TRC_INFO_FRMS) +#define RESET_TRC (FLUSH_TRC_BUFFERS | FLUSH_TRC_STATISTICS) + /*---------------------------------------------------------------------------- * Channel configuration. * This structure is passed to the FR_SET_CONFIG command when dlci != 0. @@ -415,6 +486,151 @@ typedef struct fr_comm_stat #define FR_ISF_LVE 2 /* issue Link Verification Enquiry */ #define FR_ISF_FSE 3 /* issue Full Status Enquiry */ +/*---------------------------------------------------------------------------- + * Frame Relay ARP Header -- Used for Dynamic route creation with InvARP + */ + +typedef struct arphdr_fr + { + unsigned short ar_hrd PACKED; /* format of hardware addr */ + unsigned short ar_pro PACKED; /* format of protocol addr */ + unsigned char ar_hln PACKED; /* length of hardware addr */ + unsigned char ar_pln PACKED; /* length of protocol addr */ + unsigned short ar_op PACKED; /* ARP opcode */ + unsigned short ar_sha PACKED; /* Sender DLCI addr 2 bytes */ + unsigned long ar_sip PACKED; /* Sender IP addr 4 bytes */ + unsigned short ar_tha PACKED; /* Target DLCI addr 2 bytes */ + unsigned long ar_tip PACKED; /* Target IP addr 4 bytes */ + } arphdr_fr_t; + +/*---------------------------------------------------------------------------- + * Frame Relay RFC 1490 SNAP Header -- Used to check for ARP packets + */ +typedef struct arphdr_1490 + { + unsigned char control PACKED; /* UI, etc... */ + unsigned char pad PACKED; /* Pad */ + unsigned char NLPID PACKED; /* SNAP */ + unsigned char OUI[3] PACKED; /* Ethertype, etc... */ + unsigned short PID PACKED; /* ARP, IP, etc... */ + } arphdr_1490_t; + +/* UDP/IP packet (for UDP management) layout */ + +/* The embedded control block for UDP mgmt + This is essentially a mailbox structure, without the large data field */ + +typedef struct { + unsigned char opp_flag PACKED; /* the opp flag */ + unsigned char command PACKED; /* command code */ + unsigned short length PACKED; /* length of data buffer */ + unsigned char result PACKED; /* return code */ + unsigned short dlci PACKED; /* DLCI number */ + unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */ + unsigned short rxlost1 PACKED; /* frames discarded at int. level */ + unsigned long rxlost2 PACKED; /* frames discarded at app. level */ + unsigned char rsrv[2] PACKED; /* reserved for future use */ +} cblock_t; + + +/* UDP management packet layout (data area of ip packet) */ + +typedef struct { + unsigned char control PACKED; + unsigned char NLPID PACKED; +} fr_encap_hdr_t; + +typedef struct { + fr_encap_hdr_t fr_encap_hdr PACKED; + ip_pkt_t ip_pkt PACKED; + udp_pkt_t udp_pkt PACKED; + wp_mgmt_t wp_mgmt PACKED; + cblock_t cblock PACKED; + unsigned char data[4080] PACKED; +} fr_udp_pkt_t; + + +/* valid ip_protocol for UDP management */ +#define UDPMGMT_UDP_PROTOCOL 0x11 + +#define UDPMGMT_FPIPE_SIGNATURE "FPIPE8ND" +#define UDPMGMT_DRVRSTATS_SIGNATURE "DRVSTATS" + +/* values for request/reply byte */ +#define UDPMGMT_REQUEST 0x01 +#define UDPMGMT_REPLY 0x02 +#define UDP_OFFSET 12 + +typedef struct { + unsigned long if_send_entry; + unsigned long if_send_skb_null; + unsigned long if_send_broadcast; + unsigned long if_send_multicast; + unsigned long if_send_critical_ISR; + unsigned long if_send_critical_non_ISR; + unsigned long if_send_busy; + unsigned long if_send_busy_timeout; + unsigned long if_send_DRVSTATS_request; + unsigned long if_send_FPIPE_request; + unsigned long if_send_wan_disconnected; + unsigned long if_send_dlci_disconnected; + unsigned long if_send_no_bfrs; + unsigned long if_send_adptr_bfrs_full; + unsigned long if_send_bfrs_passed_to_adptr; + unsigned long if_send_consec_send_fail; +} drvstats_if_send_t; + +typedef struct { + unsigned long rx_intr_no_socket; + unsigned long rx_intr_dev_not_started; + unsigned long rx_intr_DRVSTATS_request; + unsigned long rx_intr_FPIPE_request; + unsigned long rx_intr_bfr_not_passed_to_stack; + unsigned long rx_intr_bfr_passed_to_stack; + } drvstats_rx_intr_t; + +typedef struct { + unsigned long UDP_FPIPE_mgmt_kmalloc_err; + unsigned long UDP_FPIPE_mgmt_direction_err; + unsigned long UDP_FPIPE_mgmt_adptr_type_err; + unsigned long UDP_FPIPE_mgmt_adptr_cmnd_OK; + unsigned long UDP_FPIPE_mgmt_adptr_cmnd_timeout; + unsigned long UDP_FPIPE_mgmt_adptr_send_passed; + unsigned long UDP_FPIPE_mgmt_adptr_send_failed; + unsigned long UDP_FPIPE_mgmt_not_passed_to_stack; + unsigned long UDP_FPIPE_mgmt_passed_to_stack; + unsigned long UDP_FPIPE_mgmt_no_socket; + unsigned long UDP_DRVSTATS_mgmt_kmalloc_err; + unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_OK; + unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_timeout; + unsigned long UDP_DRVSTATS_mgmt_adptr_send_passed; + unsigned long UDP_DRVSTATS_mgmt_adptr_send_failed; + unsigned long UDP_DRVSTATS_mgmt_not_passed_to_stack; + unsigned long UDP_DRVSTATS_mgmt_passed_to_stack; + unsigned long UDP_DRVSTATS_mgmt_no_socket; +} drvstats_gen_t; + +typedef struct { + unsigned char attr PACKED; + unsigned short time_stamp PACKED; + unsigned char reserved[13] PACKED; +} api_rx_hdr_t; + +typedef struct { + api_rx_hdr_t api_rx_hdr PACKED; + void * data PACKED; +} api_rx_element_t; + +typedef struct { + unsigned char attr PACKED; + unsigned char reserved[15] PACKED; +} api_tx_hdr_t; + +typedef struct { + api_tx_hdr_t api_tx_hdr PACKED; + void * data PACKED; +} api_tx_element_t; + #ifdef _MSC_ # pragma pack() #endif diff --git a/pfinet/linux-src/include/linux/sdla_ppp.h b/pfinet/linux-src/include/linux/sdla_ppp.h index 26798683..95d5c0fe 100644 --- a/pfinet/linux-src/include/linux/sdla_ppp.h +++ b/pfinet/linux-src/include/linux/sdla_ppp.h @@ -19,38 +19,25 @@ /*---------------------------------------------------------------------------- * Notes: * ------ - * 1. All structures defined in this file are byte-alined. To ensure - * portability of this code between different platforms and compilers, one - * of the following defines must be defined before including this file: + * 1. All structures defined in this file are byte-alined. * - * Compiler Platform Define Use option - * -------- -------- ------ ---------- - * GNU C Linux _GNUC_ - - * Microsoft C DOS/Windows _MSC_ - + * Compiler Platform + * -------- -------- + * GNU C Linux */ -#ifdef _GNUC_ -# ifndef PACKED +#ifndef PACKED # define PACKED __attribute__((packed)) -# endif /* PACKED */ -#else -# define PACKED -#endif -#ifdef _MSC_ -# pragma pack(1) -#endif +#endif /* PACKED */ /* Adapter memory layout and important constants */ - -#define PPP502_MB_VECT 0xA000 /* mailbox window vector */ -#define PPP502_MB_OFFS 0x1C00 /* mailbox offset */ -#define PPP502_FLG_OFFS 0 /* status flags offset */ -#define PPP502_BUF_OFFS 0x0010 /* buffer info block offset */ - #define PPP508_MB_VECT 0xE000 /* mailbox window vector */ -#define PPP508_MB_OFFS 0 /* mailbox offset */ +#define PPP508_MB_OFFS 0 /* mailbox offset */ #define PPP508_FLG_OFFS 0x1000 /* status flags offset */ #define PPP508_BUF_OFFS 0x1100 /* buffer info block offset */ +#define PPP514_MB_OFFS 0xE000 /* mailbox offset */ +#define PPP514_FLG_OFFS 0xF000 /* status flags offset */ +#define PPP514_BUF_OFFS 0xF100 /* buffer info block offset */ #define PPP_MAX_DATA 1008 /* command block data buffer length */ @@ -59,14 +46,46 @@ /*---------------------------------------------------------------------------- * PPP Command Block. */ -typedef struct ppp_cmd -{ +typedef struct ppp_cmd{ unsigned char command PACKED; /* command code */ unsigned short length PACKED; /* length of data buffer */ unsigned char result PACKED; /* return code */ unsigned char rsrv[11] PACKED; /* reserved for future use */ } ppp_cmd_t; +typedef struct cblock{ + unsigned char opp_flag PACKED; + unsigned char command PACKED; /* command code */ + unsigned short length PACKED; /* length of data buffer */ + unsigned char result PACKED; /* return code */ + unsigned char rsrv[11] PACKED; /* reserved for future use */ +} cblock_t; + +typedef struct ppp_udp_pkt{ + ip_pkt_t ip_pkt PACKED; + udp_pkt_t udp_pkt PACKED; + wp_mgmt_t wp_mgmt PACKED; + cblock_t cblock PACKED; + unsigned char data[MAX_LGTH_UDP_MGNT_PKT] PACKED; +} ppp_udp_pkt_t; + +typedef struct { + unsigned char status PACKED; + unsigned char data_avail PACKED; + unsigned short real_length PACKED; + unsigned short time_stamp PACKED; + unsigned char data[1] PACKED; +} trace_pkt_t; + + +typedef struct { + unsigned char opp_flag PACKED; + unsigned char trace_type PACKED; + unsigned short trace_length PACKED; + unsigned short trace_data_ptr PACKED; + unsigned short trace_time_stamp PACKED; +} trace_element_t; + /* 'command' field defines */ #define PPP_READ_CODE_VERSION 0x10 /* configuration commands */ #define PPP_SET_CONFIG 0x05 @@ -145,26 +164,46 @@ typedef struct ppp_flags #define PPP_INTR_DISC 0x10 /* data link disconnected */ #define PPP_INTR_OPEN 0x20 /* data link open */ #define PPP_INTR_DROP_DTR 0x40 /* DTR drop timeout expired */ +#define PPP_INTR_TIMER 0x80 /* timer interrupt */ + /* 'mstatus' defines */ #define PPP_MDM_DCD 0x08 /* mdm_status: DCD */ #define PPP_MDM_CTS 0x20 /* mdm_status: CTS */ -/*---------------------------------------------------------------------------- - * PPP Buffer Info. - * This structure is located at offset PPP502_BUF_OFFS into - * PPP502_MB_VECT. - */ -typedef struct ppp502_buf_info -{ - unsigned short txb_num PACKED; /* 00: number of transmit buffers */ - unsigned short txb_offs PACKED; /* 02: offset of the buffer ctl. */ - unsigned char rsrv1[4] PACKED; - unsigned short rxb_num PACKED; /* 08: number of receive buffers */ - unsigned short rxb_offs PACKED; /* 0A: offset of the buffer ctl. */ - unsigned char rsrv2[2] PACKED; - unsigned short rxb_next PACKED; /* 0E: index of the next buffer */ -} ppp502_buf_info_t; +/* 'disc_cause' defines */ +#define PPP_LOCAL_TERMINATION 0x0001 /* Local Request by PPP termination phase */ +#define PPP_DCD_CTS_DROP 0x0002 /* DCD and/or CTS dropped. Link down */ +#define PPP_REMOTE_TERMINATION 0x0800 /* Remote Request by PPP termination phase */ + +/* 'misc_config_bits' defines */ +#define DONT_RE_TX_ABORTED_I_FRAMES 0x01 +#define TX_FRM_BYTE_COUNT_STATS 0x02 +#define RX_FRM_BYTE_COUNT_STATS 0x04 +#define TIME_STAMP_IN_RX_FRAMES 0x08 +#define NON_STD_ADPTR_FREQ 0x10 +#define INTERFACE_LEVEL_RS232 0x20 +#define AUTO_LINK_RECOVERY 0x100 +#define DONT_TERMINATE_LNK_MAX_CONFIG 0x200 + +/* 'authentication options' defines */ +#define NO_AUTHENTICATION 0x00 +#define INBOUND_AUTH 0x80 +#define PAP_AUTH 0x01 +#define CHAP_AUTH 0x02 + +/* 'ip options' defines */ +#define L_AND_R_IP_NO_ASSIG 0x00 +#define L_IP_LOCAL_ASSIG 0x01 +#define L_IP_REMOTE_ASSIG 0x02 +#define R_IP_LOCAL_ASSIG 0x04 +#define R_IP_REMOTE_ASSIG 0x08 +#define ENABLE_IP 0x80 + +/* 'ipx options' defines */ +#define ROUTING_PROT_DEFAULT 0x20 +#define ENABLE_IPX 0x80 +#define DISABLE_IPX 0x00 /*---------------------------------------------------------------------------- * PPP Buffer Info. @@ -202,37 +241,6 @@ typedef struct ppp_buf_ctl } buf PACKED; } ppp_buf_ctl_t; -/*---------------------------------------------------------------------------- - * S502 Adapter Configuration Block (passed to the PPP_SET_CONFIG command). - */ -typedef struct ppp502_conf -{ - unsigned char line_speed PACKED; /* 00: 0 - external clk. */ - unsigned short txbuf_num PACKED; /* 01: number of Tx buffers */ - unsigned short conf_flags PACKED; /* 03: configuration bits */ - unsigned short mtu_local PACKED; /* 05: local MTU */ - unsigned short mtu_remote PACKED; /* 07: remote MTU */ - unsigned short restart_tmr PACKED; /* 09: restart timer */ - unsigned short auth_rsrt_tmr PACKED; /* 0B: authentication timer */ - unsigned short auth_wait_tmr PACKED; /* 0D: authentication timer */ - unsigned short mdm_fail_tmr PACKED; /* 0F: modem failure timer */ - unsigned short dtr_drop_tmr PACKED; /* 11: DTR drop timer */ - unsigned short connect_tmout PACKED; /* 13: connection timeout */ - unsigned short conf_retry PACKED; /* 15: max. retry */ - unsigned short term_retry PACKED; /* 17: max. retry */ - unsigned short fail_retry PACKED; /* 19: max. retry */ - unsigned short auth_retry PACKED; /* 1B: max. retry */ - unsigned char auth_options PACKED; /* 1D: authentication opt. */ - unsigned char ip_options PACKED; /* 1E: IP options */ - unsigned char ip_local[4] PACKED; /* 1F: local IP address */ - unsigned char ip_remote[4] PACKED; /* 23: remote IP address */ - unsigned char ipx_options PACKED; /* 27: IPX options */ - unsigned char ipx_netno[4] PACKED; /* 28: IPX net number */ - unsigned char ipx_local[6] PACKED; /* 2C: local IPX node number*/ - unsigned char ipx_remote[6] PACKED; /* 32: remote IPX node num.*/ - unsigned char ipx_router[48] PACKED; /* 38: IPX router name*/ -} ppp502_conf_t; - /*---------------------------------------------------------------------------- * S508 Adapter Configuration Block (passed to the PPP_SET_CONFIG command). */ @@ -255,8 +263,8 @@ typedef struct ppp508_conf unsigned short auth_retry PACKED; /* 1E: max. retry */ unsigned char auth_options PACKED; /* 20: authentication opt. */ unsigned char ip_options PACKED; /* 21: IP options */ - unsigned char ip_local[4] PACKED; /* 22: local IP address */ - unsigned char ip_remote[4] PACKED; /* 26: remote IP address */ + unsigned long ip_local PACKED; /* 22: local IP address */ + unsigned long ip_remote PACKED; /* 26: remote IP address */ unsigned char ipx_options PACKED; /* 2A: IPX options */ unsigned char ipx_netno[4] PACKED; /* 2B: IPX net number */ unsigned char ipx_local[6] PACKED; /* 2F: local IPX node number*/ @@ -265,6 +273,25 @@ typedef struct ppp508_conf unsigned long alt_cpu_clock PACKED; /* 6B: */ } ppp508_conf_t; +/*---------------------------------------------------------------------------- + * S508 Adapter Read Connection Information Block + * Returned by the PPP_GET_CONNECTION_INFO command + */ +typedef struct ppp508_connect_info +{ + unsigned short mru PACKED; /* 00-01 Remote Max Rec' Unit */ + unsigned char ip_options PACKED; /* 02: Negotiated ip options */ + unsigned long ip_local PACKED; /* 03-06: local IP address */ + unsigned long ip_remote PACKED; /* 07-0A: remote IP address */ + unsigned char ipx_options PACKED; /* 0B: Negotiated ipx options */ + unsigned char ipx_netno[4] PACKED; /* 0C-0F: IPX net number */ + unsigned char ipx_local[6] PACKED; /* 10-1F: local IPX node # */ + unsigned char ipx_remote[6] PACKED; /* 16-1B: remote IPX node # */ + unsigned char ipx_router[48] PACKED; /* 1C-4B: IPX router name */ + unsigned char auth_status PACKED; /* 4C: Authentication Status */ + unsigned char inbd_auth_peerID[1] PACKED; /* 4D: variable length inbound authenticated peer ID */ +} ppp508_connect_info_t; + /* 'line_speed' field */ #define PPP_BITRATE_1200 0x01 #define PPP_BITRATE_2400 0x02 @@ -302,16 +329,6 @@ typedef struct ppp508_conf #define PPP_IPX_CONF_COMPLETE 0x40 #define PPP_IPX_ENABLE 0x80 -/*---------------------------------------------------------------------------- - * S502 Adapter Configuration Block (returned by the PPP_READ_CONFIG command). - */ -typedef struct ppp502_get_conf -{ - ppp502_conf_t conf PACKED; /* 00: requested config. */ - unsigned short txb_num PACKED; /* 68: number of Tx buffers */ - unsigned short rxb_num PACKED; /* 6A: number of Rx buffers */ -} ppp502_get_conf_t; - /*---------------------------------------------------------------------------- * S508 Adapter Configuration Block (returned by the PPP_READ_CONFIG command). */ @@ -323,20 +340,6 @@ typedef struct ppp508_get_conf unsigned short rxb_num PACKED; /* 71: number of Rx buffers */ } ppp508_get_conf_t; -/*---------------------------------------------------------------------------- - * S502 Operational Statistics (returned by the PPP_READ_STATISTIC command). - */ -typedef struct ppp502_Stats -{ - unsigned short rx_lost_intr PACKED; /* 00: */ - unsigned short rx_lost_buff PACKED; /* 02: */ - unsigned short tx_abort PACKED; /* 04: */ - unsigned long tx_frames PACKED; /* 06: */ - unsigned long tx_bytes PACKED; /* 0A: */ - unsigned long rx_frames PACKED; /* 0E: */ - unsigned long rx_bytes PACKED; /* 12: */ -} ppp502_Stats_t; - /*---------------------------------------------------------------------------- * S508 Operational Statistics (returned by the PPP_READ_STATISTIC command). */ @@ -530,6 +533,40 @@ typedef struct ppp_conn_info unsigned char peer_id[0] PACKED; /* 4D: */ } ppp_conn_info_t; +/* Data structure for SET_TRIGGER_INTR command + */ + +typedef struct ppp_intr_info{ + unsigned char i_enable PACKED; /* 0 Interrupt enable bits */ + unsigned char irq PACKED; /* 1 Irq number */ + unsigned short timer_len PACKED; /* 2 Timer delay */ +} ppp_intr_info_t; + + +#define FT1_MONITOR_STATUS_CTRL 0x80 +#define SET_FT1_MODE 0x81 + + + +/* Special UDP drivers management commands */ +#define PPIPE_ENABLE_TRACING 0x20 +#define PPIPE_DISABLE_TRACING 0x21 +#define PPIPE_GET_TRACE_INFO 0x22 +#define PPIPE_GET_IBA_DATA 0x23 +#define PPIPE_KILL_BOARD 0x24 +#define PPIPE_FT1_READ_STATUS 0x25 +#define PPIPE_DRIVER_STAT_IFSEND 0x26 +#define PPIPE_DRIVER_STAT_INTR 0x27 +#define PPIPE_DRIVER_STAT_GEN 0x28 +#define PPIPE_FLUSH_DRIVER_STATS 0x29 +#define PPIPE_ROUTER_UP_TIME 0x30 + +#define DISABLE_TRACING 0x00 +#define TRACE_SIGNALLING_FRAMES 0x01 +#define TRACE_DATA_FRAMES 0x02 + + + #ifdef _MSC_ # pragma pack() #endif diff --git a/pfinet/linux-src/include/linux/sdladrv.h b/pfinet/linux-src/include/linux/sdladrv.h index 23ae8a1e..724fd6c7 100644 --- a/pfinet/linux-src/include/linux/sdladrv.h +++ b/pfinet/linux-src/include/linux/sdladrv.h @@ -1,15 +1,16 @@ /***************************************************************************** * sdladrv.h SDLA Support Module. Kernel API Definitions. * -* Author: Gene Kozin +* Author: Gideon Hack * -* Copyright: (c) 1995-1996 Sangoma Technologies Inc. +* Copyright: (c) 1995-1999 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. * ============================================================================ +* Jun 02, 1999 Gideon Hack Added support for the S514 PCI adapter. * Dec 11, 1996 Gene Kozin Complete overhaul. * Oct 17, 1996 Gene Kozin Minor bug fixes. * Jun 12, 1996 Gene Kozin Added support for S503 card. @@ -18,6 +19,11 @@ #ifndef _SDLADRV_H #define _SDLADRV_H +#include +#if LINUX_VERSION_CODE >= 0x020100 +#define LINUX_2_1 +#endif + #define SDLA_MAXIORANGE 4 /* maximum I/O port range */ #define SDLA_WINDOWSIZE 0x2000 /* default dual-port memory window size */ @@ -33,6 +39,14 @@ typedef struct sdlahw unsigned fwid; /* firmware ID */ unsigned port; /* adapter I/O port base */ int irq; /* interrupt request level */ + char S514_cpu_no[1]; /* PCI CPU Number */ + unsigned char S514_slot_no; /* PCI Slot Number */ +#ifdef LINUX_2_1 + struct pci_dev *pci_dev; /* PCI device */ +#else + unsigned char pci_bus; /* PCI bus number */ + unsigned char pci_dev_func; /* PCI device/function number */ +#endif void * dpmbase; /* dual-port memory base */ unsigned dpmsize; /* dual-port memory size */ unsigned pclk; /* CPU clock rate, kHz */ @@ -50,6 +64,8 @@ extern int sdla_down (sdlahw_t* hw); extern int sdla_inten (sdlahw_t* hw); extern int sdla_intde (sdlahw_t* hw); extern int sdla_intack (sdlahw_t* hw); +extern void S514_intack (sdlahw_t* hw, u32 int_status); +extern void read_S514_int_stat (sdlahw_t* hw, u32* int_status); extern int sdla_intr (sdlahw_t* hw); extern int sdla_mapmem (sdlahw_t* hw, unsigned long addr); extern int sdla_peek (sdlahw_t* hw, unsigned long addr, void* buf, diff --git a/pfinet/linux-src/include/linux/sdlapci.h b/pfinet/linux-src/include/linux/sdlapci.h new file mode 100644 index 00000000..857fd062 --- /dev/null +++ b/pfinet/linux-src/include/linux/sdlapci.h @@ -0,0 +1,68 @@ +/***************************************************************************** +* sdlapci.h WANPIPE(tm) Multiprotocol WAN Link Driver. +* Definitions for the SDLA PCI adapter. +* +* Author: Gideon Hack +* +* Copyright: (c) 1999 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. +* ============================================================================ +* Jun 02, 1999 Gideon Hack Initial version. +*****************************************************************************/ +#ifndef _SDLAPCI_H +#define _SDLAPCI_H + +/****** Defines *************************************************************/ + +/* Definitions for identifying and finding S514 PCI adapters */ +#define V3_VENDOR_ID 0x11B0 /* V3 vendor ID number */ +#define V3_DEVICE_ID 0x0002 /* V3 device ID number */ +#define SANGOMA_SUBSYS_VENDOR 0x4753 /* ID for Sangoma */ +#define PCI_DEV_SLOT_MASK 0x1F /* mask for slot numbering */ +#define PCI_IRQ_NOT_ALLOCATED 0xFF /* interrupt line for no IRQ */ + +/* Local PCI register offsets */ +#define PCI_VENDOR_ID_WORD 0x00 /* vendor ID */ +#define PCI_IO_BASE_DWORD 0x10 /* IO base */ +#define PCI_MEM_BASE0_DWORD 0x14 /* memory base - apperture 0 */ +#define PCI_MEM_BASE1_DWORD 0x18 /* memory base - apperture 1 */ +#define PCI_SUBSYS_VENDOR_WORD 0x2C /* subsystem vendor ID */ +#define PCI_INT_LINE_BYTE 0x3C /* interrupt line */ +#define PCI_INT_PIN_BYTE 0x3D /* interrupt pin */ +#define PCI_MAP0_DWORD 0x40 /* PCI to local bus address 0 */ +#define PCI_MAP1_DWORD 0x44 /* PCI to local bus address 1 */ +#define PCI_INT_STATUS 0x48 /* interrupt status */ +#define PCI_INT_CONFIG 0x4C /* interrupt configuration */ + +/* Local PCI register usage */ +#define PCI_MEMORY_ENABLE 0x00000003 /* enable PCI memory */ +#define PCI_CPU_A_MEM_DISABLE 0x00000002 /* disable CPU A memory */ +#define PCI_CPU_B_MEM_DISABLE 0x00100002 /* disable CPU B memory */ +#define PCI_ENABLE_IRQ_CPU_A 0x005A0004 /* enable IRQ for CPU A */ +#define PCI_ENABLE_IRQ_CPU_B 0x005A0008 /* enable IRQ for CPU B */ +#define PCI_DISABLE_IRQ_CPU_A 0x00000004 /* disable IRQ for CPU A */ +#define PCI_DISABLE_IRQ_CPU_B 0x00000008 /* disable IRQ for CPU B */ + +/* Setting for the Interrupt Status register */ +#define IRQ_CPU_A 0x04 /* IRQ for CPU A */ +#define IRQ_CPU_B 0x08 /* IRQ for CPU B */ + +/* The maximum size of the S514 memory */ +#define MAX_SIZEOF_S514_MEMORY (256 * 1024) + +/* S514 control register offsets within the memory address space */ +#define S514_CTRL_REG_BYTE 0x80000 + +/* S514 adapter control bytes */ +#define S514_CPU_HALT 0x00 +#define S514_CPU_START 0x01 + +/* The maximum number of S514 adapters supported */ +#define MAX_S514_CARDS 8 + +#endif /* _SDLAPCI_H */ + diff --git a/pfinet/linux-src/include/linux/sdlasfm.h b/pfinet/linux-src/include/linux/sdlasfm.h index 65e7f30a..94aaa8ad 100644 --- a/pfinet/linux-src/include/linux/sdlasfm.h +++ b/pfinet/linux-src/include/linux/sdlasfm.h @@ -2,15 +2,16 @@ * sdlasfm.h WANPIPE(tm) Multiprotocol WAN Link Driver. * Definitions for the SDLA Firmware Module (SFM). * -* Author: Gene Kozin <74604.152@compuserve.com> +* Author: Gideon Hack * -* Copyright: (c) 1995-1996 Sangoma Technologies Inc. +* Copyright: (c) 1995-1999 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. * ============================================================================ +* Jun 02, 1999 Gideon Hack Added support for the S514 adapter. * Dec 11, 1996 Gene Kozin Cosmetic changes * Apr 16, 1996 Gene Kozin Changed adapter & firmware IDs. Version 2 * Dec 15, 1995 Gene Kozin Structures chaned @@ -36,6 +37,12 @@ #define SDLA_S508 5080 #define SDLA_S507 5070 #define SDLA_S509 5090 +#define SDLA_S514 5140 + +/* S514 PCI adapter CPU numbers */ +#define S514_CPU_A 'A' +#define S514_CPU_B 'B' + /* Firmware identification numbers: * 0 .. 999 Test & Diagnostics @@ -46,6 +53,7 @@ * 5000 .. 5999 X.25 * 6000 .. 6999 Frame Relay * 7000 .. 7999 PPP + * 8000 .. 8999 Cisco HDLC */ #define SFID_CALIB502 200 #define SFID_STRM502 1200 @@ -53,12 +61,16 @@ #define SFID_BSC502 2200 #define SFID_SDLC502 3200 #define SFID_HDLC502 4200 +#define SFID_HDLC508 4800 #define SFID_X25_502 5200 #define SFID_X25_508 5800 #define SFID_FR502 6200 #define SFID_FR508 6800 #define SFID_PPP502 7200 #define SFID_PPP508 7800 +#define SFID_PPP514 7140 +#define SFID_CHDLC508 8800 +#define SFID_CHDLC514 8140 /****** Data Types **********************************************************/ diff --git a/pfinet/linux-src/include/linux/socket.h b/pfinet/linux-src/include/linux/socket.h index d681aa5b..837a3e46 100644 --- a/pfinet/linux-src/include/linux/socket.h +++ b/pfinet/linux-src/include/linux/socket.h @@ -106,7 +106,7 @@ __KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size, __ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) + CMSG_ALIGN(__cmsg->cmsg_len)); if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size) - return NULL; + return (struct cmsghdr*)0; return __ptr; } diff --git a/pfinet/linux-src/include/linux/swap.h b/pfinet/linux-src/include/linux/swap.h index 66ba5d62..0e3d2763 100644 --- a/pfinet/linux-src/include/linux/swap.h +++ b/pfinet/linux-src/include/linux/swap.h @@ -68,7 +68,7 @@ extern int nr_free_pages; extern atomic_t nr_async_pages; extern struct inode swapper_inode; extern unsigned long page_cache_size; -extern int buffermem; +extern long buffermem; /* Incomplete types for prototype declarations: */ struct task_struct; @@ -91,8 +91,8 @@ extern void rw_swap_page_nolock(int, unsigned long, char *, int); extern void swap_after_unlock_page (unsigned long entry); /* linux/mm/page_alloc.c */ -extern void swap_in(struct task_struct *, struct vm_area_struct *, - pte_t *, unsigned long, int); +extern int swap_in(struct task_struct *, struct vm_area_struct *, + pte_t *, unsigned long, int); /* linux/mm/swap_state.c */ diff --git a/pfinet/linux-src/include/linux/sysctl.h b/pfinet/linux-src/include/linux/sysctl.h index 753df742..00bebabe 100644 --- a/pfinet/linux-src/include/linux/sysctl.h +++ b/pfinet/linux-src/include/linux/sysctl.h @@ -104,7 +104,8 @@ enum KERN_MSGMNB=36, /* int: Maximum message queue size */ KERN_MSGPOOL=37, /* int: Maximum system message pool size */ KERN_SYSRQ=38, /* int: Sysreq enable */ - KERN_SHMALL=41 /* int: maximum size of shared memory */ + KERN_SHMALL=41, /* int: maximum size of shared memory */ + KERN_SPARC_STOP_A=44, /* int: Sparc Stop-A enable */ }; @@ -267,7 +268,8 @@ enum NET_IPV4_CONF_RP_FILTER=8, NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9, NET_IPV4_CONF_BOOTP_RELAY=10, - NET_IPV4_CONF_LOG_MARTIANS=11 + NET_IPV4_CONF_LOG_MARTIANS=11, + NET_IPV4_CONF_HIDDEN=12 }; /* /proc/sys/net/ipv6 */ diff --git a/pfinet/linux-src/include/linux/telephony.h b/pfinet/linux-src/include/linux/telephony.h new file mode 100644 index 00000000..082b885f --- /dev/null +++ b/pfinet/linux-src/include/linux/telephony.h @@ -0,0 +1,200 @@ +/* + * telephony.h + * + * Basic Linux Telephony Interface + * + * (c) Copyright 1999 Quicknet 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. + * + * Authors: Ed Okerson, + * Greg Herlein, + * + * Contributors: Alan Cox, + * David Erhart, + * + * Version: 0.1.0 - December 19, 1999 + * + * Fixes: + */ + +#ifndef TELEPHONY_H +#define TELEPHONY_H + +/* vendor identification numbers */ +#define PHONE_VENDOR_IXJ 1 +#define PHONE_VENDOR_QUICKNET PHONE_IXJ +#define PHONE_VENDOR_VOICETRONIX 2 +#define PHONE_VENDOR_ACULAB 3 +#define PHONE_VENDOR_DIGI 4 +#define PHONE_VENDOR_FRANKLIN 5 + +/****************************************************************************** + * Vendor Summary Information Area + * + * Quicknet Technologies, Inc. - makes low density analog telephony cards + * with audio compression, POTS and PSTN interfaces (www.quicknet.net) + * + * (other vendors following this API shuld add a short description of + * the telephony products they support under Linux) + * + *****************************************************************************/ + + +/****************************************************************************** +* +* The capabilities ioctls can inform you of the capabilities of each phone +* device installed in your system. The PHONECTL_CAPABILITIES ioctl +* returns an integer value indicating the number of capabilities the +* device has. The PHONECTL_CAPABILITIES_LIST will fill an array of +* capability structs with all of it's capabilities. The +* PHONECTL_CAPABILITIES_CHECK takes a single capability struct and returns +* a TRUE if the device has that capability, otherwise it returns false. +* +******************************************************************************/ +typedef enum { + vendor = 0, + device, + port, + codec, + dsp +} phone_cap; + +struct phone_capability { + char desc[80]; + phone_cap captype; + int cap; + int handle; +}; + +typedef enum { + pots = 0, + pstn, + handset, + speaker +} phone_ports; + +#define PHONE_CAPABILITIES _IO ('q', 0x80) +#define PHONE_CAPABILITIES_LIST _IOR ('q', 0x81, struct phone_capability *) +#define PHONE_CAPABILITIES_CHECK _IOW ('q', 0x82, struct phone_capability *) + +#define PHONE_RING _IO ('q', 0x83) +#define PHONE_HOOKSTATE _IO ('q', 0x84) +#define PHONE_MAXRINGS _IOW ('q', 0x85, char) +#define PHONE_RING_CADENCE _IOW ('q', 0x86, short) +#define PHONE_RING_START _IO ('q', 0x87) +#define PHONE_RING_STOP _IO ('q', 0x88) + +#define USA_RING_CADENCE 0xC0C0 + +#define PHONE_REC_CODEC _IOW ('q', 0x89, int) +#define PHONE_REC_START _IO ('q', 0x8A) +#define PHONE_REC_STOP _IO ('q', 0x8B) +#define PHONE_REC_DEPTH _IOW ('q', 0x8C, int) +#define PHONE_FRAME _IOW ('q', 0x8D, int) +#define PHONE_REC_VOLUME _IOW ('q', 0x8E, int) +#define PHONE_REC_LEVEL _IO ('q', 0x8F) + +#define PHONE_PLAY_CODEC _IOW ('q', 0x90, int) +#define PHONE_PLAY_START _IO ('q', 0x91) +#define PHONE_PLAY_STOP _IO ('q', 0x92) +#define PHONE_PLAY_DEPTH _IOW ('q', 0x93, int) +#define PHONE_PLAY_VOLUME _IOW ('q', 0x94, int) +#define PHONE_PLAY_LEVEL _IO ('q', 0x95) +#define PHONE_DTMF_READY _IOR ('q', 0x96, int) +#define PHONE_GET_DTMF _IOR ('q', 0x97, int) +#define PHONE_GET_DTMF_ASCII _IOR ('q', 0x98, int) +#define PHONE_DTMF_OOB _IOW ('q', 0x99, int) +#define PHONE_EXCEPTION _IOR ('q', 0x9A, int) +#define PHONE_PLAY_TONE _IOW ('q', 0x9B, char) +#define PHONE_SET_TONE_ON_TIME _IOW ('q', 0x9C, int) +#define PHONE_SET_TONE_OFF_TIME _IOW ('q', 0x9D, int) +#define PHONE_GET_TONE_ON_TIME _IO ('q', 0x9E) +#define PHONE_GET_TONE_OFF_TIME _IO ('q', 0x9F) +#define PHONE_GET_TONE_STATE _IO ('q', 0xA0) +#define PHONE_BUSY _IO ('q', 0xA1) +#define PHONE_RINGBACK _IO ('q', 0xA2) +#define PHONE_DIALTONE _IO ('q', 0xA3) +#define PHONE_CPT_STOP _IO ('q', 0xA4) + +#define PHONE_PSTN_SET_STATE _IOW ('q', 0xA4, int) +#define PHONE_PSTN_GET_STATE _IO ('q', 0xA5) + +#define PSTN_ON_HOOK 0 +#define PSTN_RINGING 1 +#define PSTN_OFF_HOOK 2 +#define PSTN_PULSE_DIAL 3 + +/****************************************************************************** +* +* The wink duration is tunable with this ioctl. The default wink duration +* is 320ms. You do not need to use this ioctl if you do not require a +* different wink duration. +* +******************************************************************************/ +#define PHONE_WINK_DURATION _IOW ('q', 0xA6, int) + + +/****************************************************************************** +* +* Codec Definitions +* +******************************************************************************/ +typedef enum { + G723_63 = 1, + G723_53 = 2, + TS85 = 3, + TS48 = 4, + TS41 = 5, + G728 = 6, + G729 = 7, + ULAW = 8, + ALAW = 9, + LINEAR16 = 10, + LINEAR8 = 11, + WSS = 12 +} phone_codec; + +/****************************************************************************** +* +* The exception structure allows us to multiplex multiple events onto the +* select() exception set. If any of these flags are set select() will +* return with a positive indication on the exception set. The dtmf_ready +* bit indicates if there is data waiting in the DTMF buffer. The +* hookstate bit is set if there is a change in hookstate status, it does not +* indicate the current state of the hookswitch. The pstn_ring bit +* indicates that the DAA on a LineJACK card has detected ring voltage on +* the PSTN port. The caller_id bit indicates that caller_id data has been +* recieved and is available. The pstn_wink bit indicates that the DAA on +* the LineJACK has recieved a wink from the telco switch. The f0, f1, f2 +* and f3 bits indicate that the filter has been triggered by detecting the +* frequency programmed into that filter. +* +* The remaining bits should be set to zero. They will become defined over time +* for other interface cards and their needs. +* +******************************************************************************/ +struct phone_except +{ + unsigned int dtmf_ready:1; + unsigned int hookstate:1; + unsigned int pstn_ring:1; + unsigned int caller_id:1; + unsigned int pstn_wink:1; + unsigned int f0:1; + unsigned int f1:1; + unsigned int f2:1; + unsigned int f3:1; + unsigned int reserved:23; +}; + +union telephony_exception { + struct phone_except bits; + unsigned int bytes; +}; + + +#endif /* TELEPHONY_H */ diff --git a/pfinet/linux-src/include/linux/tty.h b/pfinet/linux-src/include/linux/tty.h index d215a270..3112c349 100644 --- a/pfinet/linux-src/include/linux/tty.h +++ b/pfinet/linux-src/include/linux/tty.h @@ -348,6 +348,8 @@ extern int rs_init(void); extern int lp_init(void); extern int pty_init(void); extern int tty_init(void); +extern int mxser_init(void); +extern int moxa_init(void); extern int ip2_init(void); extern int pcxe_init(void); extern int pc_init(void); diff --git a/pfinet/linux-src/include/linux/wanpipe.h b/pfinet/linux-src/include/linux/wanpipe.h index aa3cb84a..f0dbd6f5 100644 --- a/pfinet/linux-src/include/linux/wanpipe.h +++ b/pfinet/linux-src/include/linux/wanpipe.h @@ -2,16 +2,23 @@ * wanpipe.h WANPIPE(tm) Multiprotocol WAN Link Driver. * User-level API definitions. * -* Author: Gene Kozin -* Jaspreet Singh +* Author: Nenad Corbic +* Gideon Hack * -* Copyright: (c) 1995-1997 Sangoma Technologies Inc. +* Copyright: (c) 1995-1999 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. * ============================================================================ +* 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 +* Jun 26, 1998 David Fong Added 'ip_mode' in sdla_t.u.p for dynamic IP +* routing mode configuration +* Jun 12, 1998 David Fong Added Cisco HDLC union member in sdla_t +* Dec 08, 1997 Jaspreet Singh Added 'authenticator' in union of 'sdla_t' * Nov 26, 1997 Jaspreet Singh Added 'load_sharing' structure. Also added * 'devs_struct','dev_to_devtint_next' to 'sdla_t' * Nov 24, 1997 Jaspreet Singh Added 'irq_dis_if_send_count', @@ -28,6 +35,10 @@ #ifndef _WANPIPE_H #define _WANPIPE_H +#ifdef __SMP__ +#include /* Support for SMP Locking */ +#endif + #include /* Defines */ @@ -42,6 +53,16 @@ #define WANPIPE_DUMP (ROUTER_USER+0) /* dump adapter's memory */ #define WANPIPE_EXEC (ROUTER_USER+1) /* execute firmware command */ +#define TRACE_ALL 0x00 +#define TRACE_PROT 0x01 +#define TRACE_DATA 0x02 + +/* values for request/reply byte */ +#define UDPMGMT_REQUEST 0x01 +#define UDPMGMT_REPLY 0x02 +#define UDP_OFFSET 12 + + /* * Data structures for IOCTL calls. */ @@ -97,16 +118,86 @@ typedef struct global_stats } global_stats_t; -/* This structure is used for maitaining a circular linked list of all - * interfaces(devices) per card. It is used in the Interrupt Service routine - * for a transmit interrupt where the start of the loop to dev_tint all - * interfaces changes. - */ -typedef struct load_sharing -{ - struct device* dev_ptr; - struct load_sharing* next; -} load_sharing_t; + +typedef struct{ + unsigned short udp_src_port PACKED; + unsigned short udp_dst_port PACKED; + unsigned short udp_length PACKED; + unsigned short udp_checksum PACKED; +} udp_pkt_t; + + +typedef struct { + unsigned char ver_inet_hdr_length PACKED; + unsigned char service_type PACKED; + unsigned short total_length PACKED; + unsigned short identifier PACKED; + unsigned short flags_frag_offset PACKED; + unsigned char ttl PACKED; + unsigned char protocol PACKED; + unsigned short hdr_checksum PACKED; + unsigned long ip_src_address PACKED; + unsigned long ip_dst_address PACKED; +} ip_pkt_t; + + +typedef struct { + unsigned char signature[8] PACKED; + unsigned char request_reply PACKED; + unsigned char id PACKED; + unsigned char reserved[6] PACKED; +} wp_mgmt_t; + +/************************************************************************* + Data Structure for if_send statistics +*************************************************************************/ +typedef struct if_send_stat{ + unsigned long if_send_entry; + unsigned long if_send_skb_null; + unsigned long if_send_broadcast; + unsigned long if_send_multicast; + unsigned long if_send_critical_ISR; + unsigned long if_send_critical_non_ISR; + unsigned long if_send_tbusy; + unsigned long if_send_tbusy_timeout; + unsigned long if_send_PIPE_request; + unsigned long if_send_wan_disconnected; + unsigned long if_send_dlci_disconnected; + unsigned long if_send_no_bfrs; + unsigned long if_send_adptr_bfrs_full; + unsigned long if_send_bfr_passed_to_adptr; + unsigned long if_send_protocol_error; + unsigned long if_send_bfr_not_passed_to_adptr; + unsigned long if_send_tx_int_enabled; + unsigned long if_send_consec_send_fail; +} if_send_stat_t; + +typedef struct rx_intr_stat{ + unsigned long rx_intr_no_socket; + unsigned long rx_intr_dev_not_started; + unsigned long rx_intr_PIPE_request; + unsigned long rx_intr_bfr_not_passed_to_stack; + unsigned long rx_intr_bfr_passed_to_stack; +} rx_intr_stat_t; + +typedef struct pipe_mgmt_stat{ + unsigned long UDP_PIPE_mgmt_kmalloc_err; + unsigned long UDP_PIPE_mgmt_direction_err; + unsigned long UDP_PIPE_mgmt_adptr_type_err; + unsigned long UDP_PIPE_mgmt_adptr_cmnd_OK; + unsigned long UDP_PIPE_mgmt_adptr_cmnd_timeout; + unsigned long UDP_PIPE_mgmt_adptr_send_passed; + unsigned long UDP_PIPE_mgmt_adptr_send_failed; + unsigned long UDP_PIPE_mgmt_not_passed_to_stack; + unsigned long UDP_PIPE_mgmt_passed_to_stack; + unsigned long UDP_PIPE_mgmt_no_socket; + unsigned long UDP_PIPE_mgmt_passed_to_adptr; +} pipe_mgmt_stat_t; + + + +#define MAX_LGTH_UDP_MGNT_PKT 2000 + /* This is used for interrupt testing */ #define INTR_TEST_MODE 0x02 @@ -154,23 +245,23 @@ typedef struct sdla char in_isr; /* interrupt-in-service flag */ 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 */ - - /* The following is used as a pointer to the structure in our - circular linked list which changes the start of the loop for - dev_tint of all interfaces */ - - load_sharing_t* dev_to_devtint_next; - load_sharing_t* devs_struct; - +#ifdef __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 */ union { struct @@ -188,6 +279,19 @@ typedef struct sdla unsigned rx_top; /* S508 receive buffer end */ unsigned short node_dlci[100]; unsigned short dlci_num; + struct device *dlci_to_dev_map[991 + 1]; + unsigned tx_interrupts_pending; + unsigned short timer_int_enabled; + unsigned short udp_pkt_lgth; + int udp_type; + 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 */ + unsigned char update_comms_stats; } f; struct /****** PPP-specific data ***********/ { @@ -199,7 +303,53 @@ typedef struct sdla void* rxbuf_last; /* -> last Rx buffer */ unsigned rx_base; /* S508 receive buffer base */ unsigned rx_top; /* S508 receive buffer end */ + char ip_mode; /* STATIC/HOST/PEER IP Mode */ + char authenticator; /* Authenticator for PAP/CHAP */ } p; + struct /* Cisco HDLC-specific data */ + { + char if_name[WAN_IFNAME_SZ+1]; /* interface name */ + unsigned char comm_port;/* Communication Port O or 1 */ + unsigned char usedby; /* Used by WANPIPE or API */ + void* rxmb; /* Receive mail box */ + void* flags; /* flags */ + void* tx_status; /* Tx status element */ + void* rx_status; /* Rx status element */ + void* txbuf; /* -> current Tx buffer */ + void* txbuf_base; /* -> first Tx buffer */ + void* txbuf_last; /* -> last Tx buffer */ + void* rxbuf_base; /* -> first Rx buffer */ + void* rxbuf_last; /* -> last Rx buffer */ + unsigned rx_base; /* S508 receive buffer base */ + unsigned rx_top; /* S508 receive buffer end */ + unsigned short protocol_options; + unsigned short kpalv_tx; /* Tx kpalv timer */ + unsigned short kpalv_rx; /* Rx kpalv timer */ + unsigned short kpalv_err; /* Error tolerance */ + unsigned short slarp_timer; /* SLARP req timer */ + unsigned state; /* state of the link */ + unsigned char api_status; + unsigned char update_call_count; + } c; + struct + { + void* tx_status; /* Tx status element */ + void* rx_status; /* Rx status element */ + void* trace_status; /* Trace status element */ + void* txbuf; /* -> current Tx buffer */ + void* txbuf_base; /* -> first Tx buffer */ + void* txbuf_last; /* -> last Tx buffer */ + void* rxbuf_base; /* -> first Rx buffer */ + void* rxbuf_last; /* -> last Rx buffer */ + void* tracebuf; /* -> current Trace buffer */ + void* tracebuf_base; /* -> current Trace buffer */ + void* tracebuf_last; /* -> current Trace buffer */ + unsigned rx_base; /* receive buffer base */ + unsigned rx_end; /* receive buffer end */ + unsigned trace_base; /* trace buffer base */ + unsigned trace_end; /* trace buffer end */ + + } h; } u; } sdla_t; @@ -212,6 +362,10 @@ void wanpipe_set_state (sdla_t* card, int state); /* wpmain.c */ int wpx_init (sdla_t* card, wandev_conf_t* conf); /* wpx.c */ int wpf_init (sdla_t* card, wandev_conf_t* conf); /* wpf.c */ int wpp_init (sdla_t* card, wandev_conf_t* conf); /* wpp.c */ +int wpc_init (sdla_t* card, wandev_conf_t* conf); /* Cisco HDLC */ +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 */ #endif /* __KERNEL__ */ #endif /* _WANPIPE_H */ diff --git a/pfinet/linux-src/include/linux/wanrouter.h b/pfinet/linux-src/include/linux/wanrouter.h index fd63868f..530783f7 100644 --- a/pfinet/linux-src/include/linux/wanrouter.h +++ b/pfinet/linux-src/include/linux/wanrouter.h @@ -1,23 +1,32 @@ /***************************************************************************** -* router.h Definitions for the WAN Multiprotocol Router Module. +* wanrouter.h Definitions for the WAN Multiprotocol Router Module. * This module provides API and common services for WAN Link * Drivers and is completely hardware-independent. * -* Author: Gene Kozin -* Jaspreet Singh +* Author: Nenad Corbic +* Gideon Hack * -* Copyright: (c) 1995-1997 Sangoma Technologies Inc. +* Copyright: (c) 1995-1999 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. * ============================================================================ +* Oct 04, 1999 Nenad Corbic Updated for 2.1.0 release +* Jun 02, 1999 Gideon Hack Added support for the S514 adapter. +* Jul 20, 1998 David Fong Added Inverse ARP options to 'wanif_conf_t' +* Jun 12, 1998 David Fong Added Cisco HDLC support. +* Dec 16, 1997 Jaspreet Singh Moved 'enable_IPX' and 'network_number' to +* 'wanif_conf_t' +* Dec 05, 1997 Jaspreet Singh Added 'pap', 'chap' to 'wanif_conf_t' +* Added 'authenticator' to 'wan_ppp_conf_t' * Nov 06, 1997 Jaspreet Singh Changed Router Driver version to 1.1 from 1.0 * Oct 20, 1997 Jaspreet Singh Added 'cir','bc','be' and 'mc' to 'wanif_conf_t' * Added 'enable_IPX' and 'network_number' to * 'wan_device_t'. Also added defines for -* UDP PACKET TYPE, Interrupt test, critical values* for RACE conditions. +* UDP PACKET TYPE, Interrupt test, critical values +* for RACE conditions. * Oct 05, 1997 Jaspreet Singh Added 'dlci_num' and 'dlci[100]' to * 'wan_fr_conf_t' to configure a list of dlci(s) * for a NODE @@ -28,6 +37,12 @@ * Jan 16, 1997 Gene Kozin router_devlist made public * Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h). *****************************************************************************/ +#include + +#if LINUX_VERSION_CODE >= 0x020100 +#define LINUX_2_1 +#endif + #ifndef _ROUTER_H #define _ROUTER_H @@ -50,6 +65,10 @@ enum router_ioctls ROUTER_USER_MAX = (ROUTER_IOCTL<<8)+31 }; +/* identifiers for displaying proc file data for dual port adapters */ +#define PROC_DATA_PORT_0 0x8000 /* the data is for port 0 */ +#define PROC_DATA_PORT_1 0x8001 /* the data is for port 1 */ + /* NLPID for packet encapsulation (ISO/IEC TR 9577) */ #define NLPID_IP 0xCC /* Internet Protocol Datagram */ #define NLPID_SNAP 0x80 /* IEEE Subnetwork Access Protocol */ @@ -62,12 +81,14 @@ enum router_ioctls #define WAN_IFNAME_SZ 15 /* max length of the interface name */ #define WAN_DRVNAME_SZ 15 /* max length of the link driver name */ #define WAN_ADDRESS_SZ 31 /* max length of the WAN media address */ +#define USED_BY_FIELD 8 /* max length of the used by field */ /* Defines for UDP PACKET TYPE */ #define UDP_PTPIPE_TYPE 0x01 #define UDP_FPIPE_TYPE 0x02 -#define UDP_DRVSTATS_TYPE 0x03 -#define UDP_INVALID_TYPE 0x04 +#define UDP_CPIPE_TYPE 0x03 +#define UDP_DRVSTATS_TYPE 0x04 +#define UDP_INVALID_TYPE 0x05 /* Command return code */ #define CMD_OK 0 /* normal firmware return code */ @@ -145,8 +166,26 @@ typedef struct wan_ppp_conf unsigned auth_retry; /* max. retry */ unsigned auth_options; /* authentication opt. */ unsigned ip_options; /* IP options */ + char authenticator; /* AUTHENTICATOR or not */ + char ip_mode; /* Static/Host/Peer */ } wan_ppp_conf_t; +/*---------------------------------------------------------------------------- + * CHDLC-specific link-level configuration. + */ +typedef struct wan_chdlc_conf +{ + unsigned char ignore_dcd; /* Protocol options: */ + unsigned char ignore_cts; /* Ignore these to determine */ + unsigned char ignore_keepalive; /* link status (Yes or No) */ + unsigned char hdlc_streaming; /* hdlc_streaming mode (Y/N) */ + unsigned keepalive_tx_tmr; /* transmit keepalive timer */ + unsigned keepalive_rx_tmr; /* receive keepalive timer */ + unsigned keepalive_err_margin; /* keepalive_error_tolerance */ + unsigned slarp_timer; /* SLARP request timer */ +} wan_chdlc_conf_t; + + /*---------------------------------------------------------------------------- * WAN device configuration. Passed to ROUTER_SETUP IOCTL. */ @@ -160,18 +199,21 @@ typedef struct wandev_conf unsigned msize; /* dual-port memory size */ int irq; /* interrupt request level */ int dma; /* DMA request level */ + char S514_CPU_no[1]; /* S514 PCI adapter CPU number ('A' or 'B') */ + unsigned PCI_slot_no; /* S514 PCI adapter slot number */ + char comm_port; /* Communication Port (PRI=0, SEC=1) */ unsigned bps; /* data transfer rate */ unsigned mtu; /* maximum transmit unit size */ unsigned udp_port; /* UDP port for management */ unsigned char ttl; /* Time To Live for UDP security */ + unsigned char ft1; /* FT1 Configurator Option */ char interface; /* RS-232/V.35, etc. */ char clocking; /* external/internal */ char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */ char station; /* DTE/DCE, primary/secondary, etc. */ char connection; /* permanent/switched/on-demand */ + char read_mode; /* read mode: Polling or interrupt */ unsigned hw_opt[4]; /* other hardware options */ - unsigned char enable_IPX; /* Enable or Disable IPX */ - unsigned long network_number; /* Network Number for IPX */ unsigned reserved[4]; /****** arbitrary data ***************/ unsigned data_size; /* data buffer size */ @@ -181,6 +223,7 @@ typedef struct wandev_conf wan_x25_conf_t x25; /* X.25 configuration */ wan_ppp_conf_t ppp; /* PPP configuration */ wan_fr_conf_t fr; /* frame relay configuration */ + wan_chdlc_conf_t chdlc; /* Cisco HDLC configuration */ } u; } wandev_conf_t; @@ -188,6 +231,9 @@ typedef struct wandev_conf #define WANCONFIG_X25 101 /* X.25 link */ #define WANCONFIG_FR 102 /* frame relay link */ #define WANCONFIG_PPP 103 /* synchronous PPP link */ +#define WANCONFIG_CHDLC 104 /* Cisco HDLC Link */ +#define WANCONFIG_BSC 105 /* BiSync Streaming */ +#define WANCONFIG_HDLC 106 /* HDLC Support */ /* * Configuration options defines. @@ -230,9 +276,29 @@ typedef struct wandev_conf #define WANOPT_ONDEMAND 2 /* activate DTR only before sending */ /* frame relay in-channel signalling */ -#define WANOPT_FR_ANSI 0 /* ANSI T1.617 Annex D */ -#define WANOPT_FR_Q933 1 /* ITU Q.933A */ -#define WANOPT_FR_LMI 2 /* LMI */ +#define WANOPT_FR_ANSI 1 /* ANSI T1.617 Annex D */ +#define WANOPT_FR_Q933 2 /* ITU Q.933A */ +#define WANOPT_FR_LMI 3 /* LMI */ + +/* PPP IP Mode Options */ +#define WANOPT_PPP_STATIC 0 +#define WANOPT_PPP_HOST 1 +#define WANOPT_PPP_PEER 2 + +/* CHDLC Protocol Options */ +/* DF Commmented out for now. + +#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT +#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT +#define WANOPT_CHDLC_NO_KEEPALIVE IGNORE_KPALV_FOR_LINK_STAT +*/ + +/* Port options */ +#define WANOPT_PRI 0 +#define WANOPT_SEC 1 +/* read mode */ +#define WANOPT_INTR 0 +#define WANOPT_POLL 1 /*---------------------------------------------------------------------------- * WAN Link Status Info (for ROUTER_STAT IOCTL). @@ -274,7 +340,8 @@ enum wan_states WAN_DISCONNECTED, /* link/channel is disconnected */ WAN_CONNECTING, /* connection is in progress */ WAN_CONNECTED, /* link/channel is operational */ - WAN_LIMIT /* for verification only */ + WAN_LIMIT, /* for verification only */ + WAN_DUALPORT /* for Dual Port cards */ }; /* 'modem_status' masks */ @@ -292,13 +359,35 @@ typedef struct wanif_conf unsigned config_id; /* configuration identifier */ char name[WAN_IFNAME_SZ+1]; /* interface name, ASCIIZ */ char addr[WAN_ADDRESS_SZ+1]; /* media address, ASCIIZ */ + char usedby[USED_BY_FIELD]; /* used by API or WANPIPE */ unsigned idle_timeout; /* sec, before disconnecting */ unsigned hold_timeout; /* sec, before re-connecting */ unsigned cir; /* Committed Information Rate fwd,bwd*/ unsigned bc; /* Committed Burst Size fwd, bwd */ unsigned be; /* Excess Burst Size fwd, bwd */ + unsigned char enable_IPX; /* Enable or Disable IPX */ + unsigned char inarp; /* Send Inverse ARP requests Y/N */ + unsigned inarp_interval; /* sec, between InARP requests */ + unsigned long network_number; /* Network Number for IPX */ char mc; /* Multicast on or off */ - int reserved[8]; /* reserved for future extensions */ + char pap; /* PAP enabled or disabled */ + char chap; /* CHAP enabled or disabled */ + unsigned char userid[511]; /* List of User Id */ + unsigned char passwd[511]; /* List of passwords */ + unsigned char sysname[31]; /* Name of the system */ + unsigned char ignore_dcd; /* Protocol options: */ + unsigned char ignore_cts; /* Ignore these to determine */ + unsigned char ignore_keepalive; /* link status (Yes or No) */ + unsigned char hdlc_streaming; /* Hdlc streaming mode (Y/N) */ + unsigned keepalive_tx_tmr; /* transmit keepalive timer */ + unsigned keepalive_rx_tmr; /* receive keepalive timer */ + unsigned keepalive_err_margin; /* keepalive_error_tolerance */ + unsigned slarp_timer; /* SLARP request timer */ + unsigned char ttl; /* Time To Live for UDP security */ + char interface; /* RS-232/V.35, etc. */ + char clocking; /* external/internal */ + unsigned bps; /* data transfer rate */ + unsigned mtu; /* maximum transmit unit size */ } wanif_conf_t; #ifdef __KERNEL__ @@ -308,7 +397,6 @@ typedef struct wanif_conf #include /* proc filesystem pragmatics */ #include /* in_aton(), in_ntoa() prototypes */ #include /* support for network drivers */ - /*---------------------------------------------------------------------------- * WAN device data space. */ @@ -317,9 +405,12 @@ typedef struct wan_device unsigned magic; /* magic number */ char* name; /* -> WAN device name (ASCIIZ) */ void* private; /* -> driver private data */ + unsigned config_id; /* Configuration ID */ /****** hardware configuration ******/ unsigned ioport; /* adapter I/O port base #1 */ - void * maddr; /* dual-port memory address */ + char S514_cpu_no[1]; /* PCI CPU Number */ + unsigned char S514_slot_no; /* PCI Slot Number */ + unsigned long maddr; /* dual-port memory address */ unsigned msize; /* dual-port memory size */ int irq; /* interrupt request level */ int dma; /* DMA request level */ @@ -333,24 +424,31 @@ typedef struct wan_device char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */ char station; /* DTE/DCE, primary/secondary, etc. */ char connection; /* permanent/switched/on-demand */ + char signalling; /* Signalling RS232 or V35 */ + char read_mode; /* read mode: Polling or interrupt */ + char new_if_cnt; /* Number of interfaces per wanpipe */ + char del_if_cnt; /* Number of times del_if() gets called */ + unsigned char piggyback; /* Piggibacking a port */ unsigned hw_opt[4]; /* other hardware options */ - unsigned char enable_IPX; /* Enable or Disable IPX */ - unsigned long network_number; /* Network Number for IPX */ /****** status and statistics *******/ char state; /* device state */ - unsigned modem_status; /* modem status */ + char api_status; /* device api status */ +#ifdef LINUX_2_1 + struct net_device_stats stats; /* interface statistics */ +#else struct enet_statistics stats; /* interface statistics */ +#endif unsigned reserved[16]; /* reserved for future use */ unsigned critical; /* critical section flag */ /****** device management methods ***/ - int (*setup) (struct wan_device* wandev, wandev_conf_t* conf); - int (*shutdown) (struct wan_device* wandev); - int (*update) (struct wan_device* wandev); - int (*ioctl) (struct wan_device* wandev, unsigned cmd, + int (*setup) (struct wan_device *wandev, wandev_conf_t *conf); + int (*shutdown) (struct wan_device *wandev); + int (*update) (struct wan_device *wandev); + int (*ioctl) (struct wan_device *wandev, unsigned cmd, unsigned long arg); - int (*new_if) (struct wan_device* wandev, struct device* dev, - wanif_conf_t* conf); - int (*del_if) (struct wan_device* wandev, struct device* dev); + int (*new_if) (struct wan_device *wandev, struct device *dev, + wanif_conf_t *conf); + int (*del_if) (struct wan_device *wandev, struct device *dev); /****** maintained by the router ****/ struct wan_device* next; /* -> next device */ struct device* dev; /* list of network interfaces */ @@ -359,23 +457,20 @@ typedef struct wan_device } wan_device_t; /* Public functions available for device drivers */ -extern int register_wan_device(wan_device_t* wandev); -extern int unregister_wan_device(char* name); -unsigned short wanrouter_type_trans(struct sk_buff* skb, struct device* dev); -int wanrouter_encapsulate(struct sk_buff* skb, struct device* dev); +extern int register_wan_device(wan_device_t *wandev); +extern int unregister_wan_device(char *name); +unsigned short wanrouter_type_trans(struct sk_buff *skb, struct device *dev); +int wanrouter_encapsulate(struct sk_buff *skb, struct device *dev); /* Proc interface functions. These must not be called by the drivers! */ -extern int wanrouter_proc_init (void); -extern void wanrouter_proc_cleanup (void); -extern int wanrouter_proc_add (wan_device_t* wandev); -extern int wanrouter_proc_delete (wan_device_t* wandev); -extern int wanrouter_ioctl( - struct inode* inode, struct file* file, - unsigned int cmd, unsigned long arg) -; +extern int wanrouter_proc_init(void); +extern void wanrouter_proc_cleanup(void); +extern int wanrouter_proc_add(wan_device_t *wandev); +extern int wanrouter_proc_delete(wan_device_t *wandev); +extern int wanrouter_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); /* Public Data */ -extern wan_device_t* router_devlist; /* list of registered devices */ +extern wan_device_t *router_devlist; /* list of registered devices */ #endif /* __KERNEL__ */ #endif /* _ROUTER_H */ diff --git a/pfinet/linux-src/include/linux/wireless.h b/pfinet/linux-src/include/linux/wireless.h index acc0619e..868f812a 100644 --- a/pfinet/linux-src/include/linux/wireless.h +++ b/pfinet/linux-src/include/linux/wireless.h @@ -1,7 +1,7 @@ /* * This file define a set of standard wireless extensions * - * Version : 8 28.7.99 + * Version : 9 16.10.99 * * Authors : Jean Tourrilhes - HPL - */ @@ -63,7 +63,7 @@ * (there is some stuff that will be added in the future...) * I just plan to increment with each new version. */ -#define WIRELESS_EXT 8 +#define WIRELESS_EXT 9 /* * Changes : @@ -96,6 +96,14 @@ * - Changed my e-mail address * - More 802.11 support (nickname, rate, rts, frag) * - List index in frequencies + * + * V8 to V9 + * -------- + * - Support for 'mode of operation' (ad-hoc, managed...) + * - Support for unicast and multicast power saving + * - Change encoding to support larger tokens (>64 bits) + * - Updated iw_params (disable, flags) and use it for NWID + * - Extracted iw_point from iwreq for clarity */ /* -------------------------- IOCTL LIST -------------------------- */ @@ -103,12 +111,12 @@ /* Basic operations */ #define SIOCSIWNAME 0x8B00 /* Unused ??? */ #define SIOCGIWNAME 0x8B01 /* get name */ -#define SIOCSIWNWID 0x8B02 /* set network id */ +#define SIOCSIWNWID 0x8B02 /* set network id (the cell) */ #define SIOCGIWNWID 0x8B03 /* get network id */ #define SIOCSIWFREQ 0x8B04 /* set channel/frequency */ #define SIOCGIWFREQ 0x8B05 /* get channel/frequency */ -#define SIOCSIWENCODE 0x8B06 /* set encoding info */ -#define SIOCGIWENCODE 0x8B07 /* get encoding info */ +#define SIOCSIWMODE 0x8B06 /* set operation mode */ +#define SIOCGIWMODE 0x8B07 /* get operation mode */ #define SIOCSIWSENS 0x8B08 /* set sensitivity */ #define SIOCGIWSENS 0x8B09 /* get sensitivity */ @@ -146,11 +154,18 @@ #define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */ #define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */ +/* Encoding stuff (scrambling, hardware security, WEP...) */ +#define SIOCSIWENCODE 0x8B2A /* set encoding token & mode */ +#define SIOCGIWENCODE 0x8B2B /* get encoding token & mode */ +/* Power saving stuff (power management, unicast and multicast) */ +#define SIOCSIWPOWER 0x8B2C /* set Power Management settings */ +#define SIOCGIWPOWER 0x8B2D /* get Power Management settings */ + /* ------------------------- IOCTL STUFF ------------------------- */ /* The first and the last (range) */ #define SIOCIWFIRST 0x8B00 -#define SIOCIWLAST 0x8B25 +#define SIOCIWLAST 0x8B30 /* Even : get (world access), odd : set (root access) */ #define IW_IS_SET(cmd) (!((cmd) & 0x1)) @@ -200,9 +215,66 @@ /* Maximum size of the ESSID and NICKN strings */ #define IW_ESSID_MAX_SIZE 32 +/* Modes of operation */ +#define IW_MODE_AUTO 0 /* Let the driver decides */ +#define IW_MODE_ADHOC 1 /* Single cell network */ +#define IW_MODE_INFRA 2 /* Multi cell network, roaming, ... */ +#define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */ +#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ +#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ + +/* Maximum number of size of encoding token available + * they are listed in the range structure */ +#define IW_MAX_ENCODING_SIZES 8 + +/* Maximum size of the encoding token in bytes */ +#define IW_ENCODING_TOKEN_MAX 32 /* 256 bits (for now) */ + +/* Flags for encoding (along with the token) */ +#define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */ +#define IW_ENCODE_FLAGS 0xF000 /* Flags defined below */ +#define IW_ENCODE_DISABLED 0x8000 /* Encoding disabled */ +#define IW_ENCODE_ENABLED 0x0000 /* Encoding enabled */ +#define IW_ENCODE_RESTRICTED 0x4000 /* Refuse non-encoded packets */ +#define IW_ENCODE_OPEN 0x2000 /* Accept non-encoded packets */ + +/* Power management flags available (along with the value, if any) */ +#define IW_POWER_ON 0x0000 /* No details... */ +#define IW_POWER_TYPE 0xF000 /* Type of parameter */ +#define IW_POWER_PERIOD 0x1000 /* Value is a period/duration of */ +#define IW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */ +#define IW_POWER_MODE 0x0F00 /* Power Management mode */ +#define IW_POWER_UNICAST_R 0x0100 /* Receive only unicast messages */ +#define IW_POWER_MULTICAST_R 0x0200 /* Receive only multicast messages */ +#define IW_POWER_ALL_R 0x0300 /* Receive all messages though PM */ +#define IW_POWER_FORCE_S 0x0400 /* Force PM procedure for sending unicast */ +#define IW_POWER_REPEATER 0x0800 /* Repeat broadcast messages in PM period */ + /****************************** TYPES ******************************/ /* --------------------------- SUBTYPES --------------------------- */ +/* + * Generic format for most parameters that fit in an int + */ +struct iw_param +{ + __s32 value; /* The value of the parameter itself */ + __u8 fixed; /* Hardware should not use auto select */ + __u8 disabled; /* Disable the feature */ + __u16 flags; /* Various specifc flags (if any) */ +}; + +/* + * For all data larger than 16 octets, we need to use a + * pointer to memory alocated in user space. + */ +struct iw_point +{ + caddr_t pointer; /* Pointer to the data (in user space) */ + __u16 length; /* number of fields or size in bytes */ + __u16 flags; /* Optional params */ +}; + /* * A frequency * For numbers lower than 10^9, we encode the number in 'm' and @@ -223,7 +295,7 @@ struct iw_freq */ struct iw_quality { - __u8 qual; /* link quality (SNR or better...) */ + __u8 qual; /* link quality (%retries, SNR or better...) */ __u8 level; /* signal level */ __u8 noise; /* noise level */ __u8 updated; /* Flags to know if updated */ @@ -240,33 +312,13 @@ struct iw_discarded __u32 misc; /* Others cases */ }; -/* - * Encoding information (setting and so on) - * Encoding might be hardware encryption, scrambing or others - */ -struct iw_encoding -{ - __u8 method; /* Algorithm number / key used */ - __u64 code; /* Data/key used for algorithm */ -}; - -/* - * Generic format for parameters - */ -struct iw_param -{ - __s32 value; /* The value of the parameter itself */ - __u8 fixed; /* Hardware should not use auto select */ -}; - - /* ------------------------ WIRELESS STATS ------------------------ */ /* * Wireless statistics (used for /proc/net/wireless) */ struct iw_statistics { - __u8 status; /* Status + __u16 status; /* Status * - device dependent for now */ struct iw_quality qual; /* Quality of the link @@ -295,37 +347,28 @@ struct iwreq union { /* Config - generic */ - char name[IFNAMSIZ]; + char name[IFNAMSIZ]; /* Name : used to verify the presence of wireless extensions. * Name of the protocol/provider... */ - struct /* network id (or domain) : used to to */ - { /* create logical channels on the air */ - __u32 nwid; /* value */ - __u8 on; /* active/unactive nwid */ - } nwid; - + struct iw_point essid; /* Extended network name */ + struct iw_param nwid; /* network id (or domain - the cell) */ struct iw_freq freq; /* frequency or channel : * 0-1000 = channel * > 1000 = frequency in Hz */ - struct iw_encoding encoding; /* Encoding stuff */ - - __u32 sensitivity; /* Obsolete, but compatible */ struct iw_param sens; /* signal level threshold */ struct iw_param bitrate; /* default bit rate */ struct iw_param rts; /* RTS threshold threshold */ struct iw_param frag; /* Fragmentation threshold */ + __u32 mode; /* Operation mode */ + + struct iw_point encoding; /* Encoding stuff : tokens */ + struct iw_param power; /* PM duration/timeout */ struct sockaddr ap_addr; /* Access point address */ - struct /* For all data bigger than 16 octets */ - { - caddr_t pointer; /* Pointer to the data - * (in user space) */ - __u16 length; /* fields or byte size */ - __u16 flags; /* Optional params */ - } data; + struct iw_point data; /* Other large parameters */ } u; }; @@ -366,9 +409,6 @@ struct iw_range /* Quality of link & SNR stuff */ struct iw_quality max_qual; /* Quality of the link */ - /* Encoder stuff */ - struct iw_encoding max_encoding; /* Encoding max range */ - /* Rates */ __u8 num_bitrates; /* Number of entries in the list */ __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */ @@ -380,6 +420,17 @@ struct iw_range /* Frag threshold */ __s32 min_frag; /* Minimal frag threshold */ __s32 max_frag; /* Maximal frag threshold */ + + /* Power Management duration & timeout */ + __s32 min_pmd; /* Minimal PM duration */ + __s32 max_pmd; /* Maximal PM duration */ + __s32 min_pmt; /* Minimal PM timeout */ + __s32 max_pmt; /* Maximal PM timeout */ + + /* Encoder stuff */ + __u16 encoding_size[IW_MAX_ENCODING_SIZES]; /* Different token sizes */ + __u8 num_encoding_sizes; /* Number of entry in the list */ + __u8 max_encoding_tokens; /* Max number of tokens */ }; /* diff --git a/pfinet/linux-src/include/net/br.h b/pfinet/linux-src/include/net/br.h index 4d79fc62..cbf4b4c3 100644 --- a/pfinet/linux-src/include/net/br.h +++ b/pfinet/linux-src/include/net/br.h @@ -19,7 +19,16 @@ #define Forwarding 3 /* (4 4 4) */ #define Blocking 4 /* (4.4.1) */ -#define No_of_ports 8 + +/* MAG Yich! Easiest way of giving a configurable number of ports + * If you want more than 32, change BR_MAX_PORTS and recompile brcfg! + */ +#define BR_MAX_PORTS (32) +#if CONFIG_BRIDGE_NUM_PORTS > BR_MAX_PORTS +#undef CONFIG_BRIDGE_NUM_PORTS +#define CONFIG_BRIDGE_NUM_PORTS BR_MAX_PORTS +#endif +#define No_of_ports CONFIG_BRIDGE_NUM_PORTS /* arbitrary choice, to allow the code below to compile */ #define All_ports (No_of_ports + 1) @@ -147,6 +156,7 @@ typedef struct { unsigned int top_change; /* (4.5.3.12) */ unsigned short topology_change_time; /* (4.5.3.13) */ unsigned short hold_time; /* (4.5.3.14) */ + unsigned int instance; } Bridge_data; /** Port Parameters (4.5.5) **/ @@ -160,7 +170,10 @@ typedef struct { unsigned short designated_port; /* (4.5.5.7) */ unsigned int top_change_ack; /* (4.5.5.8) */ unsigned int config_pending; /* (4.5.5.9) */ - struct device *dev; + bridge_id_t ifmac; + unsigned int admin_state; + char ifname[IFNAMSIZ]; /* Make life easier for brcfg */ + struct device *dev; struct fdb *fdb; /* head of per port fdb chain */ } Port_data; @@ -245,13 +258,14 @@ typedef struct { struct br_stat { unsigned int flags; Bridge_data bridge_data; - Port_data port_data[No_of_ports]; unsigned int policy; unsigned int exempt_protocols; unsigned short protocols[BR_MAX_PROTOCOLS]; unsigned short prot_id[BR_MAX_PROT_STATS]; /* Protocol encountered */ unsigned int prot_counter[BR_MAX_PROT_STATS]; /* How many packets ? */ br_stats_counter packet_cnts; + unsigned int num_ports; + Port_data port_data[BR_MAX_PORTS + 1]; }; /* defined flags for br_stat.flags */ @@ -274,7 +288,7 @@ struct br_cf { #define BRCMD_SET_BRIDGE_PRIORITY 5 /* arg1 = priority */ #define BRCMD_SET_PORT_PRIORITY 6 /* arg1 = port, arg2 = priority */ #define BRCMD_SET_PATH_COST 7 /* arg1 = port, arg2 = cost */ -#define BRCMD_DISPLAY_FDB 8 /* arg1 = port */ +#define BRCMD_DISPLAY_FDB 8 #define BRCMD_ENABLE_DEBUG 9 #define BRCMD_DISABLE_DEBUG 10 #define BRCMD_SET_POLICY 11 /* arg1 = default policy (1==bridge all) */ @@ -283,14 +297,19 @@ struct br_cf { #define BRCMD_DISABLE_PROT_STATS 14 #define BRCMD_ZERO_PROT_STATS 15 #define BRCMD_TOGGLE_STP 16 +#define BRCMD_IF_ENABLE 17 /* arg1 = if_index */ +#define BRCMD_IF_DISABLE 18 /* arg1 = if_index */ +#define BRCMD_SET_IF_PRIORITY 19 /* arg1 = if_index, arg2 = priority */ +#define BRCMD_SET_IF_PATH_COST 20 /* arg1 = if_index, arg2 = cost */ /* prototypes of exported bridging functions... */ +#ifdef __KERNEL__ void br_init(void); int br_receive_frame(struct sk_buff *skb); /* 3.5 */ int br_tx_frame(struct sk_buff *skb); +int brg_init(void); int br_ioctl(unsigned int cmd, void *arg); -int br_protocol_ok(unsigned short protocol); void requeue_fdb(struct fdb *node, int new_port); struct fdb *br_avl_find_addr(unsigned char addr[6]); @@ -298,8 +317,15 @@ struct fdb *br_avl_insert (struct fdb * new_node); void sprintf_avl (char **pbuffer, struct fdb * tree, off_t *pos,int* len, off_t offset, int length); int br_tree_get_info(char *buffer, char **start, off_t offset, int length, int dummy); void br_avl_delete_by_port(int port); +int br_call_bridge(struct sk_buff *skb, unsigned short type); +void br_spacedevice_register(void); + /* externs */ extern struct br_stat br_stats; extern Port_data port_info[]; +#endif + + + diff --git a/pfinet/linux-src/include/net/tcp.h b/pfinet/linux-src/include/net/tcp.h index 8b050c63..0e7e4bb6 100644 --- a/pfinet/linux-src/include/net/tcp.h +++ b/pfinet/linux-src/include/net/tcp.h @@ -24,22 +24,18 @@ #include /* This is for all connections with a full identity, no wildcards. - * New scheme, half the table is for TIME_WAIT, the other half is - * for the rest. I'll experiment with dynamic table growth later. + * Half of the table is for TIME_WAIT, the other half is for the + * rest. + * + * This needs to be shared by v4 and v6 because the lookup and hashing + * code needs to work with different AF's yet the port space is + * shared. */ -#define TCP_HTABLE_SIZE 512 +extern unsigned int tcp_ehash_size; +extern struct sock **tcp_ehash; /* This is for listening sockets, thus all sockets which possess wildcards. */ #define TCP_LHTABLE_SIZE 32 /* Yes, really, this is all you need. */ - -/* This is for all sockets, to keep track of the local port allocations. */ -#define TCP_BHTABLE_SIZE 512 - -/* tcp_ipv4.c: These need to be shared by v4 and v6 because the lookup - * and hashing code needs to work with different AF's yet - * the port space is shared. - */ -extern struct sock *tcp_established_hash[TCP_HTABLE_SIZE]; extern struct sock *tcp_listening_hash[TCP_LHTABLE_SIZE]; /* There are a few simple rules, which allow for local port reuse by @@ -81,7 +77,8 @@ struct tcp_bind_bucket { struct tcp_bind_bucket **pprev; }; -extern struct tcp_bind_bucket *tcp_bound_hash[TCP_BHTABLE_SIZE]; +extern unsigned int tcp_bhash_size; +extern struct tcp_bind_bucket **tcp_bhash; extern kmem_cache_t *tcp_bucket_cachep; extern struct tcp_bind_bucket *tcp_bucket_create(unsigned short snum); extern void tcp_bucket_unlock(struct sock *sk); @@ -109,7 +106,7 @@ static __inline__ void tcp_reg_zap(struct sock *sk) /* These are AF independent. */ static __inline__ int tcp_bhashfn(__u16 lport) { - return (lport & (TCP_BHTABLE_SIZE - 1)); + return (lport & (tcp_bhash_size - 1)); } /* This is a TIME_WAIT bucket. It works around the memory consumption diff --git a/pfinet/linux-src/net/core/dev.c b/pfinet/linux-src/net/core/dev.c index 75fae54a..0baa1371 100644 --- a/pfinet/linux-src/net/core/dev.c +++ b/pfinet/linux-src/net/core/dev.c @@ -57,6 +57,8 @@ * A network device unload needs to purge * the backlog queue. * Paul Rusty Russel : SIOCSIFNAME + * Andrea Arcangeli : dev_clear_backlog() needs the + * skb_queue_lock held. */ #include @@ -711,7 +713,8 @@ static void netdev_wakeup(void) static void dev_clear_backlog(struct device *dev) { - struct sk_buff *prev, *curr; + struct sk_buff *curr; + unsigned long flags; /* * @@ -719,27 +722,24 @@ static void dev_clear_backlog(struct device *dev) * * We are competing here both with netif_rx() and net_bh(). * We don't want either of those to mess with skb ptrs - * while we work on them, thus cli()/sti(). - * - * It looks better to use net_bh trick, at least - * to be sure, that we keep interrupt latency really low. --ANK (980727) + * while we work on them, thus we must grab the + * skb_queue_lock. */ if (backlog.qlen) { - start_bh_atomic(); - curr = backlog.next; - while ( curr != (struct sk_buff *)(&backlog) ) { - unsigned long flags; - curr=curr->next; - if ( curr->prev->dev == dev ) { - prev = curr->prev; - spin_lock_irqsave(&skb_queue_lock, flags); - __skb_unlink(prev, &backlog); + repeat: + spin_lock_irqsave(&skb_queue_lock, flags); + for (curr = backlog.next; + curr != (struct sk_buff *)(&backlog); + curr = curr->next) + if (curr->dev == dev) + { + __skb_unlink(curr, &backlog); spin_unlock_irqrestore(&skb_queue_lock, flags); - kfree_skb(prev); + kfree_skb(curr); + goto repeat; } - } - end_bh_atomic(); + spin_unlock_irqrestore(&skb_queue_lock, flags); #ifdef CONFIG_NET_HW_FLOWCONTROL if (netdev_dropping) netdev_wakeup(); @@ -796,7 +796,11 @@ void netif_rx(struct sk_buff *skb) #ifdef CONFIG_BRIDGE static inline void handle_bridge(struct sk_buff *skb, unsigned short type) { - if (br_stats.flags & BR_UP && br_protocol_ok(ntohs(type))) + /* + * The br_stats.flags is checked here to save the expense of a + * function call. + */ + if ((br_stats.flags & BR_UP) && br_call_bridge(skb, type)) { /* * We pass the bridge a complete frame. This means @@ -820,7 +824,6 @@ static inline void handle_bridge(struct sk_buff *skb, unsigned short type) } #endif - /* * When we are called the queue is ready to grab, the interrupts are * on and hardware can interrupt and queue to the receive queue as we @@ -1275,8 +1278,9 @@ static int sprintf_wireless_stats(char *buffer, struct device *dev) int size; if(stats != (struct iw_statistics *) NULL) + { size = sprintf(buffer, - "%6s: %02x %3d%c %3d%c %3d%c %5d %5d %5d\n", + "%6s: %04x %3d%c %3d%c %3d%c %6d %6d %6d\n", dev->name, stats->status, stats->qual.qual, @@ -1288,6 +1292,8 @@ static int sprintf_wireless_stats(char *buffer, struct device *dev) stats->discard.nwid, stats->discard.code, stats->discard.misc); + stats->qual.updated = 0; + } else size = 0; @@ -1309,8 +1315,9 @@ int dev_get_wireless_info(char * buffer, char **start, off_t offset, struct device * dev; size = sprintf(buffer, - "Inter-|sta| Quality | Discarded packets\n" - " face |tus|link level noise| nwid crypt misc\n"); + "Inter-| sta-| Quality | Discarded packets\n" + " face | tus | link level noise | nwid crypt misc\n" + ); pos+=size; len+=size; @@ -1846,6 +1853,7 @@ extern int lance_init(void); extern int bpq_init(void); extern int scc_init(void); extern void sdla_setup(void); +extern void sdla_c_setup(void); extern void dlci_setup(void); extern int dmascc_init(void); extern int sm_init(void); @@ -1855,6 +1863,7 @@ extern int baycom_ser_hdx_init(void); extern int baycom_par_init(void); extern int lapbeth_init(void); +extern int comx_init(void); extern void arcnet_init(void); extern void ip_auto_config(void); #ifdef CONFIG_8xx @@ -1922,7 +1931,7 @@ __initfunc(int net_dev_init(void)) dlci_setup(); #endif #if defined(CONFIG_SDLA) - sdla_setup(); + sdla_c_setup(); #endif #if defined(CONFIG_BAYCOM_PAR) baycom_par_init(); @@ -1947,6 +1956,9 @@ __initfunc(int net_dev_init(void)) #endif #if defined(CONFIG_8xx) cpm_enet_init(); +#endif +#if defined(CONFIG_COMX) + comx_init(); #endif /* * SLHC if present needs attaching so other people see it @@ -2018,6 +2030,13 @@ __initfunc(int net_dev_init(void)) dev_mcast_init(); +#ifdef CONFIG_BRIDGE + /* + * Register any statically linked ethernet devices with the bridge + */ + br_spacedevice_register(); +#endif + #ifdef CONFIG_IP_PNP ip_auto_config(); #endif diff --git a/pfinet/linux-src/net/ethernet/eth.c b/pfinet/linux-src/net/ethernet/eth.c index bce35d48..945f4a06 100644 --- a/pfinet/linux-src/net/ethernet/eth.c +++ b/pfinet/linux-src/net/ethernet/eth.c @@ -201,7 +201,7 @@ unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev) * seems to set IFF_PROMISC. */ - else if(dev->flags&(IFF_PROMISC/*|IFF_ALLMULTI*/)) + else if(1 /*dev->flags&IFF_PROMISC*/) { if(memcmp(eth->h_dest,dev->dev_addr, ETH_ALEN)) skb->pkt_type=PACKET_OTHERHOST; diff --git a/pfinet/linux-src/net/ipv4/arp.c b/pfinet/linux-src/net/ipv4/arp.c index 1e5cf1b1..d81c1bee 100644 --- a/pfinet/linux-src/net/ipv4/arp.c +++ b/pfinet/linux-src/net/ipv4/arp.c @@ -1,6 +1,6 @@ /* linux/net/inet/arp.c * - * Version: $Id: arp.c,v 1.77.2.1 1999/06/28 10:39:23 davem Exp $ + * Version: $Id: arp.c,v 1.77.2.4 1999/09/23 19:03:36 davem Exp $ * * Copyright (C) 1994 by Florian La Roche * @@ -65,6 +65,8 @@ * clean up the APFDDI & gen. FDDI bits. * Alexey Kuznetsov: new arp state machine; * now it is in net/core/neighbour.c. + * Julian Anastasov: "hidden" flag: hide the + * interface and don't reply for it */ /* RFC1122 Status: @@ -308,10 +310,15 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) u32 saddr; u8 *dst_ha = NULL; struct device *dev = neigh->dev; + struct device *dev2; + struct in_device *in_dev2; u32 target = *(u32*)neigh->primary_key; int probes = neigh->probes; - if (skb && inet_addr_type(skb->nh.iph->saddr) == RTN_LOCAL) + if (skb && + (dev2 = ip_dev_find(skb->nh.iph->saddr)) != NULL && + (in_dev2 = dev2->ip_ptr) != NULL && + !IN_DEV_HIDDEN(in_dev2)) saddr = skb->nh.iph->saddr; else saddr = inet_select_addr(dev, target, RT_SCOPE_LINK); @@ -653,8 +660,14 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) /* Special case: IPv4 duplicate address detection packet (RFC2131) */ if (sip == 0) { + struct device *dev2; + struct in_device *in_dev2; + if (arp->ar_op == __constant_htons(ARPOP_REQUEST) && - inet_addr_type(tip) == RTN_LOCAL) + (dev2 = ip_dev_find(tip)) != NULL && + (dev2 == dev || + ((in_dev2 = dev2->ip_ptr) != NULL && + !IN_DEV_HIDDEN(in_dev2)))) arp_send(ARPOP_REPLY,ETH_P_ARP,tip,dev,tip,sha,dev->dev_addr,dev->dev_addr); goto out; } @@ -668,6 +681,20 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) if (addr_type == RTN_LOCAL) { n = neigh_event_ns(&arp_tbl, sha, &sip, dev); if (n) { + if (ipv4_devconf.hidden && + skb->pkt_type != PACKET_HOST) { + struct device *dev2; + struct in_device *in_dev2; + + if ((dev2 = ip_dev_find(tip)) != NULL && + dev2 != dev && + (in_dev2 = dev2->ip_ptr) != NULL && + IN_DEV_HIDDEN(in_dev2)) { + neigh_release(n); + goto out; + } + } + arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); neigh_release(n); } diff --git a/pfinet/linux-src/net/ipv4/devinet.c b/pfinet/linux-src/net/ipv4/devinet.c index a50ee3bd..41b42a52 100644 --- a/pfinet/linux-src/net/ipv4/devinet.c +++ b/pfinet/linux-src/net/ipv4/devinet.c @@ -658,7 +658,7 @@ u32 inet_select_addr(struct device *dev, u32 dst, int scope) addr = ifa->ifa_local; } endfor_ifa(in_dev); - if (addr || scope >= RT_SCOPE_LINK) + if (addr) return addr; /* Not loopback addresses on loopback should be preferred @@ -670,7 +670,9 @@ u32 inet_select_addr(struct device *dev, u32 dst, int scope) continue; for_primary_ifa(in_dev) { - if (ifa->ifa_scope <= scope) + if (!IN_DEV_HIDDEN(in_dev) && + ifa->ifa_scope <= scope && + ifa->ifa_scope != RT_SCOPE_LINK) return ifa->ifa_local; } endfor_ifa(in_dev); } @@ -923,7 +925,7 @@ int devinet_sysctl_forward(ctl_table *ctl, int write, struct file * filp, static struct devinet_sysctl_table { struct ctl_table_header *sysctl_header; - ctl_table devinet_vars[12]; + ctl_table devinet_vars[13]; ctl_table devinet_dev[2]; ctl_table devinet_conf_dir[2]; ctl_table devinet_proto_dir[2]; @@ -963,6 +965,9 @@ static struct devinet_sysctl_table {NET_IPV4_CONF_LOG_MARTIANS, "log_martians", &ipv4_devconf.log_martians, sizeof(int), 0644, NULL, &proc_dointvec}, + {NET_IPV4_CONF_HIDDEN, "hidden", + &ipv4_devconf.hidden, sizeof(int), 0644, NULL, + &proc_dointvec}, {0}}, {{NET_PROTO_CONF_ALL, "all", NULL, 0, 0555, devinet_sysctl.devinet_vars},{0}}, diff --git a/pfinet/linux-src/net/ipv4/icmp.c b/pfinet/linux-src/net/ipv4/icmp.c index 78c54be8..6c1edfd7 100644 --- a/pfinet/linux-src/net/ipv4/icmp.c +++ b/pfinet/linux-src/net/ipv4/icmp.c @@ -3,7 +3,7 @@ * * Alan Cox, * - * Version: $Id: icmp.c,v 1.52.2.3 1999/09/22 16:33:02 davem Exp $ + * Version: $Id: icmp.c,v 1.52.2.4 1999/11/16 02:28:40 davem Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/pfinet/linux-src/net/ipv4/ip_forward.c b/pfinet/linux-src/net/ipv4/ip_forward.c index 08ebbc2f..fd8c0435 100644 --- a/pfinet/linux-src/net/ipv4/ip_forward.c +++ b/pfinet/linux-src/net/ipv4/ip_forward.c @@ -5,11 +5,12 @@ * * The IP forwarding functionality. * - * Version: $Id: ip_forward.c,v 1.43 1999/03/21 05:22:37 davem Exp $ + * Version: $Id: ip_forward.c,v 1.43.2.1 1999/11/16 06:33:43 davem Exp $ * * Authors: see ip.c * * Fixes: + * Joseph Gooch : Removed maddr selection for ip_masq, now done in ip_masq.c * Many : Split from ip.c , see ip_input.c for * history. * Dave Gregorich : NULL ip_rt_put fix for multicast @@ -168,7 +169,6 @@ int ip_forward(struct sk_buff *skb) * and skip the firewall checks */ if (iph->protocol == IPPROTO_ICMP) { - __u32 maddr; #ifdef CONFIG_IP_MASQUERADE_ICMP struct icmphdr *icmph = (struct icmphdr *)((char*)iph + (iph->ihl << 2)); if ((icmph->type==ICMP_DEST_UNREACH)|| @@ -176,8 +176,7 @@ int ip_forward(struct sk_buff *skb) (icmph->type==ICMP_TIME_EXCEEDED)) { #endif - maddr = inet_select_addr(dev2, rt->rt_gateway, RT_SCOPE_UNIVERSE); - fw_res = ip_fw_masq_icmp(&skb, maddr); + fw_res = ip_fw_masquerade(&skb, 0); if (fw_res < 0) { kfree_skb(skb); return -1; @@ -187,7 +186,7 @@ int ip_forward(struct sk_buff *skb) /* ICMP matched - skip firewall */ goto skip_call_fw_firewall; #ifdef CONFIG_IP_MASQUERADE_ICMP - } + } #endif } if (rt->rt_flags&RTCF_MASQ) @@ -219,15 +218,11 @@ skip_call_fw_firewall: */ if (!(IPCB(skb)->flags&IPSKB_MASQUERADED) && (fw_res==FW_MASQUERADE || rt->rt_flags&RTCF_MASQ)) { - u32 maddr; + u32 maddr = 0; #ifdef CONFIG_IP_ROUTE_NAT maddr = (rt->rt_flags&RTCF_MASQ) ? rt->rt_src_map : 0; - - if (maddr == 0) #endif - maddr = inet_select_addr(dev2, rt->rt_gateway, RT_SCOPE_UNIVERSE); - if (ip_fw_masquerade(&skb, maddr) < 0) { kfree_skb(skb); return -1; diff --git a/pfinet/linux-src/net/ipv4/ip_fw.c b/pfinet/linux-src/net/ipv4/ip_fw.c index 6319b89e..400f46c0 100644 --- a/pfinet/linux-src/net/ipv4/ip_fw.c +++ b/pfinet/linux-src/net/ipv4/ip_fw.c @@ -40,11 +40,12 @@ * 23-Jul-1999: Fixed small fragment security exposure opened on 15-May-1998. * John McDonald * Thomas Lopatic + * 21-Oct-1999: Applied count fix by Emanuele Caratti --RR */ /* * - * The origina Linux port was done Alan Cox, with changes/fixes from + * The original Linux port was done Alan Cox, with changes/fixes from * Pauline Middlelink, Jos Vos, Thomas Quinot, Wouter Gadeyne, Juan * Jose Ciarlante, Bernd Eckenfels, Keith Owens and others. * @@ -86,6 +87,7 @@ #include #include #include +#include #include #include #include @@ -228,6 +230,7 @@ struct ip_reent { struct ip_chain *prevchain; /* Pointer to referencing chain */ struct ip_fwkernel *prevrule; /* Pointer to referencing rule */ + unsigned int count; struct ip_counters counters; }; @@ -488,7 +491,10 @@ static int find_special(ip_chainlabel label, int *answer) static int enabled = 0; if(!enabled) + { + enabled=1; sysctl_ip_always_defrag++; + } *answer = FW_REDIRECT; return 1; #endif @@ -729,8 +735,8 @@ ip_fw_check(struct iphdr *ip, else FWC_HAVE_LOCK(fwc_rlocks); f = chain->chain; + count = 0; do { - count = 0; for (; f; f = f->next) { count++; if (ip_rule_match(f,rif,ip, @@ -768,10 +774,12 @@ ip_fw_check(struct iphdr *ip, else { f->branch->reent[slot].prevchain = chain; + f->branch->reent[slot].count = count; f->branch->reent[slot].prevrule = f->next; chain = f->branch; f = chain->chain; + count = 0; } } else if (f->simplebranch == FW_SKIP) @@ -790,6 +798,7 @@ ip_fw_check(struct iphdr *ip, if (chain->reent[slot].prevchain) { struct ip_chain *tmp = chain; f = chain->reent[slot].prevrule; + count = chain->reent[slot].count; chain = chain->reent[slot].prevchain; tmp->reent[slot].prevchain = NULL; } diff --git a/pfinet/linux-src/net/ipv4/ip_input.c b/pfinet/linux-src/net/ipv4/ip_input.c index b1725fa3..545f093c 100644 --- a/pfinet/linux-src/net/ipv4/ip_input.c +++ b/pfinet/linux-src/net/ipv4/ip_input.c @@ -97,6 +97,7 @@ * Alan Cox : Multicast routing hooks * Jos Vos : Do accounting *before* call_in_firewall * Willy Konynenberg : Transparent proxying support + * Stephan Uphoff : Check IP header length field * * * @@ -421,6 +422,10 @@ int ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) if (skb->len < sizeof(struct iphdr)) goto inhdr_error; + + if (skb->len < (iph->ihl << 2)) + goto inhdr_error; + if (iph->ihl < 5 || iph->version != 4 || ip_fast_csum((u8 *)iph, iph->ihl) != 0) goto inhdr_error; @@ -429,6 +434,9 @@ int ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) if (skb->len < len) goto inhdr_error; + if (len < (iph->ihl << 2)) + goto inhdr_error; + /* * Our transport medium may have padded the buffer out. Now we know it * is IP we can trim to the true length of the frame. diff --git a/pfinet/linux-src/net/ipv4/ip_masq.c b/pfinet/linux-src/net/ipv4/ip_masq.c index 6d0588c0..8f00409f 100644 --- a/pfinet/linux-src/net/ipv4/ip_masq.c +++ b/pfinet/linux-src/net/ipv4/ip_masq.c @@ -10,6 +10,9 @@ * See ip_fw.c for original log * * Fixes: + * Joseph Gooch : Modified ip_fw_masquerade() to do a ip_route_output() + * (help by Dan Drown) : to choose the proper local address. + * (and Alexey) : * Juan Jose Ciarlante : Modularized application masquerading (see ip_masq_app.c) * Juan Jose Ciarlante : New struct ip_masq_seq that holds output/input delta seq. * Juan Jose Ciarlante : Added hashed lookup by proto,maddr,mport and proto,saddr,sport @@ -787,6 +790,8 @@ void ip_masq_put(struct ip_masq *ms) } } +extern int sysctl_ip_always_defrag; + static void masq_expire(unsigned long data) { struct ip_masq *ms = (struct ip_masq *)data; @@ -839,6 +844,7 @@ static void masq_expire(unsigned long data) */ if (atomic_read(&ms->refcnt) == 1) { kfree_s(ms,sizeof(*ms)); + sysctl_ip_always_defrag--; MOD_DEC_USE_COUNT; goto masq_expire_out; } @@ -880,8 +886,6 @@ static __u16 get_next_mport(void) * Be careful, it can be called from u-space */ -extern int sysctl_ip_always_defrag; - struct ip_masq * ip_masq_new(int proto, __u32 maddr, __u16 mport, __u32 saddr, __u16 sport, __u32 daddr, __u16 dport, unsigned mflags) { struct ip_masq *ms, *mst; @@ -1141,6 +1145,23 @@ int ip_fw_masquerade(struct sk_buff **skb_p, __u32 maddr) return -1; } + /* Lets determine our maddr now, shall we? */ + if (maddr == 0) { + struct rtable *rt; + struct rtable *skb_rt = (struct rtable*)skb->dst; + struct device *skb_dev = skb_rt->u.dst.dev; + + if (ip_route_output(&rt, iph->daddr, 0, RT_TOS(iph->tos)|RTO_CONN, skb_dev?skb_dev->ifindex:0)) { + /* Fallback on old method */ + /* This really shouldn't happen... */ + maddr = inet_select_addr(skb_dev, skb_rt->rt_gateway, RT_SCOPE_UNIVERSE); + } else { + /* Route lookup succeeded */ + maddr = rt->rt_src; + ip_rt_put(rt); + } + } + switch (iph->protocol) { case IPPROTO_ICMP: return(ip_fw_masq_icmp(skb_p, maddr)); diff --git a/pfinet/linux-src/net/ipv4/ip_masq_user.c b/pfinet/linux-src/net/ipv4/ip_masq_user.c index f369f03d..848cbfe8 100644 --- a/pfinet/linux-src/net/ipv4/ip_masq_user.c +++ b/pfinet/linux-src/net/ipv4/ip_masq_user.c @@ -2,7 +2,7 @@ * IP_MASQ_USER user space control module * * - * $Id: ip_masq_user.c,v 1.1.2.2 1999/08/13 18:26:33 davem Exp $ + * $Id: ip_masq_user.c,v 1.1.2.3 1999/11/16 06:33:51 davem Exp $ */ #include @@ -100,7 +100,7 @@ static int ip_masq_user_maddr(struct ip_masq_user *ums) return ret; } dev = rt->u.dst.dev; - ums->maddr = ip_masq_select_addr(dev, rt->rt_gateway, RT_SCOPE_UNIVERSE); + ums->maddr = rt->rt_src; /* Per Alexey */ IP_MASQ_DEBUG(1-debug, "did setup maddr=%lX\n", ntohl(ums->maddr)); ip_rt_put(rt); diff --git a/pfinet/linux-src/net/ipv4/route.c b/pfinet/linux-src/net/ipv4/route.c index b308995b..2b114b3e 100644 --- a/pfinet/linux-src/net/ipv4/route.c +++ b/pfinet/linux-src/net/ipv4/route.c @@ -5,7 +5,7 @@ * * ROUTE - implementation of the IP router. * - * Version: $Id: route.c,v 1.67.2.3 1999/08/08 08:43:12 davem Exp $ + * Version: $Id: route.c,v 1.67.2.4 1999/11/16 02:28:43 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, diff --git a/pfinet/linux-src/net/ipv4/syncookies.c b/pfinet/linux-src/net/ipv4/syncookies.c index fb4e8f80..62884aae 100644 --- a/pfinet/linux-src/net/ipv4/syncookies.c +++ b/pfinet/linux-src/net/ipv4/syncookies.c @@ -9,7 +9,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * $Id: syncookies.c,v 1.7.2.1 1999/08/08 08:43:13 davem Exp $ + * $Id: syncookies.c,v 1.7.2.3 1999/12/07 03:11:07 davem Exp $ * * Missing: IPv6 support. */ @@ -184,8 +184,10 @@ cookie_v4_check(struct sock *sk, struct sk_buff *skb, struct ip_options *opt) req->af.v4_req.loc_addr, sk->ip_tos | RTO_CONN, 0)) { - tcp_openreq_free(req); - return NULL; + if (req->af.v4_req.opt) + kfree(req->af.v4_req.opt); + tcp_openreq_free(req); + return NULL; } /* Try to redo what tcp_v4_send_synack did. */ diff --git a/pfinet/linux-src/net/ipv4/tcp.c b/pfinet/linux-src/net/ipv4/tcp.c index 65763215..68b7e5e7 100644 --- a/pfinet/linux-src/net/ipv4/tcp.c +++ b/pfinet/linux-src/net/ipv4/tcp.c @@ -5,7 +5,7 @@ * * Implementation of the Transmission Control Protocol(TCP). * - * Version: $Id: tcp.c,v 1.140.2.4 1999/08/09 03:13:12 davem Exp $ + * Version: $Id: tcp.c,v 1.140.2.5 1999/09/23 19:21:16 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -1798,6 +1798,8 @@ extern void __skb_cb_too_small_for_tcp(int, int); void __init tcp_init(void) { struct sk_buff *skb = NULL; + unsigned long goal; + int order; if(sizeof(struct tcp_skb_cb) > sizeof(skb->cb)) __skb_cb_too_small_for_tcp(sizeof(struct tcp_skb_cb), @@ -1823,4 +1825,43 @@ void __init tcp_init(void) NULL, NULL); if(!tcp_timewait_cachep) panic("tcp_init: Cannot alloc tcp_tw_bucket cache."); + + /* Size and allocate TCP hash tables. */ + goal = num_physpages >> (20 - PAGE_SHIFT); + for (order = 0; (1UL << order) < goal; order++) + ; + do { + tcp_ehash_size = (1UL << order) * PAGE_SIZE / + sizeof(struct sock *); + tcp_ehash = (struct sock **) + __get_free_pages(GFP_ATOMIC, order); + } while (tcp_ehash == NULL && --order >= 0); + + if (!tcp_ehash) + panic("Failed to allocate TCP established hash table\n"); + memset(tcp_ehash, 0, tcp_ehash_size * sizeof(struct sock *)); + + goal = (((1UL << order) * PAGE_SIZE) / sizeof(struct tcp_bind_bucket *)); + if (goal > (64 * 1024)) { + /* Don't size the bind-hash larger than the port + * space, that is just silly. + */ + goal = (((64 * 1024) * sizeof(struct tcp_bind_bucket *)) / PAGE_SIZE); + for (order = 0; (1UL << order) < goal; order++) + ; + } + + do { + tcp_bhash_size = (1UL << order) * PAGE_SIZE / + sizeof(struct tcp_bind_bucket *); + tcp_bhash = (struct tcp_bind_bucket **) + __get_free_pages(GFP_ATOMIC, order); + } while (tcp_bhash == NULL && --order >= 0); + + if (!tcp_bhash) + panic("Failed to allocate TCP bind hash table\n"); + memset(tcp_bhash, 0, tcp_bhash_size * sizeof(struct tcp_bind_bucket *)); + + printk("TCP: Hash tables configured (ehash %d bhash %d)\n", + tcp_ehash_size, tcp_bhash_size); } diff --git a/pfinet/linux-src/net/ipv4/tcp_input.c b/pfinet/linux-src/net/ipv4/tcp_input.c index a753b128..7f5cc4e7 100644 --- a/pfinet/linux-src/net/ipv4/tcp_input.c +++ b/pfinet/linux-src/net/ipv4/tcp_input.c @@ -5,7 +5,7 @@ * * Implementation of the Transmission Control Protocol(TCP). * - * Version: $Id: tcp_input.c,v 1.164.2.7 1999/08/13 16:14:27 davem Exp $ + * Version: $Id: tcp_input.c,v 1.164.2.8 1999/09/23 19:21:23 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -1043,7 +1043,7 @@ static __inline__ void tcp_tw_hashdance(struct sock *sk, struct tcp_tw_bucket *t sk->prot->inuse--; /* Step 4: Hash TW into TIMEWAIT half of established hash table. */ - head = &tcp_established_hash[sk->hashent + (TCP_HTABLE_SIZE/2)]; + head = &tcp_ehash[sk->hashent + (tcp_ehash_size/2)]; sktw = (struct sock *)tw; if((sktw->next = *head) != NULL) (*head)->pprev = &sktw->next; diff --git a/pfinet/linux-src/net/ipv4/tcp_ipv4.c b/pfinet/linux-src/net/ipv4/tcp_ipv4.c index 904f8b5d..1864f096 100644 --- a/pfinet/linux-src/net/ipv4/tcp_ipv4.c +++ b/pfinet/linux-src/net/ipv4/tcp_ipv4.c @@ -5,7 +5,7 @@ * * Implementation of the Transmission Control Protocol(TCP). * - * Version: $Id: tcp_ipv4.c,v 1.175.2.10 1999/08/13 16:14:35 davem Exp $ + * Version: $Id: tcp_ipv4.c,v 1.175.2.13 1999/11/16 06:33:53 davem Exp $ * * IPv4 specific functions * @@ -90,12 +90,14 @@ void tcp_v4_send_check(struct sock *sk, struct tcphdr *th, int len, * First half of the table is for sockets not in TIME_WAIT, second half * is for TIME_WAIT sockets only. */ -struct sock *tcp_established_hash[TCP_HTABLE_SIZE]; +unsigned int tcp_ehash_size; +struct sock **tcp_ehash; /* Ok, let's try this, I give up, we do need a local binding * TCP hash as well as the others for fast bind/connect. */ -struct tcp_bind_bucket *tcp_bound_hash[TCP_BHTABLE_SIZE]; +unsigned int tcp_bhash_size; +struct tcp_bind_bucket **tcp_bhash; /* All sockets in TCP_LISTEN state will be in here. This is the only table * where wildcard'd TCP sockets can exist. Hash function here is just local @@ -117,7 +119,7 @@ int tcp_port_rover = (1024 - 1); static __inline__ int tcp_hashfn(__u32 laddr, __u16 lport, __u32 faddr, __u16 fport) { - return ((laddr ^ lport) ^ (faddr ^ fport)) & ((TCP_HTABLE_SIZE/2) - 1); + return ((laddr ^ lport) ^ (faddr ^ fport)) & ((tcp_ehash_size/2) - 1); } static __inline__ int tcp_sk_hashfn(struct sock *sk) @@ -140,7 +142,7 @@ struct tcp_bind_bucket *tcp_bucket_create(unsigned short snum) tb = kmem_cache_alloc(tcp_bucket_cachep, SLAB_ATOMIC); if(tb != NULL) { struct tcp_bind_bucket **head = - &tcp_bound_hash[tcp_bhashfn(snum)]; + &tcp_bhash[tcp_bhashfn(snum)]; tb->port = snum; tb->fastreuse = 0; tb->owners = NULL; @@ -162,7 +164,7 @@ static __inline__ int __tcp_bucket_check(unsigned short snum) { struct tcp_bind_bucket *tb; - tb = tcp_bound_hash[tcp_bhashfn(snum)]; + tb = tcp_bhash[tcp_bhashfn(snum)]; for( ; (tb && (tb->port != snum)); tb = tb->next) ; if (tb == NULL) { @@ -180,8 +182,8 @@ static __inline__ void __tcp_inherit_port(struct sock *sk, struct sock *child) #ifdef CONFIG_IP_TRANSPARENT_PROXY if (child->num != sk->num) { - unsigned short snum = ntohs(child->num); - for(tb = tcp_bound_hash[tcp_bhashfn(snum)]; + unsigned short snum = child->num; + for(tb = tcp_bhash[tcp_bhashfn(snum)]; tb && tb->port != snum; tb = tb->next) ; @@ -220,7 +222,7 @@ static int tcp_v4_get_port(struct sock *sk, unsigned short snum) do { rover++; if ((rover < low) || (rover > high)) rover = low; - tb = tcp_bound_hash[tcp_bhashfn(rover)]; + tb = tcp_bhash[tcp_bhashfn(rover)]; for ( ; tb; tb = tb->next) if (tb->port == rover) goto next; @@ -237,7 +239,7 @@ static int tcp_v4_get_port(struct sock *sk, unsigned short snum) snum = rover; tb = NULL; } else { - for (tb = tcp_bound_hash[tcp_bhashfn(snum)]; + for (tb = tcp_bhash[tcp_bhashfn(snum)]; tb != NULL; tb = tb->next) if (tb->port == snum) @@ -328,7 +330,7 @@ static __inline__ void __tcp_v4_hash(struct sock *sk) if(sk->state == TCP_LISTEN) skp = &tcp_listening_hash[tcp_sk_listen_hashfn(sk)]; else - skp = &tcp_established_hash[(sk->hashent = tcp_sk_hashfn(sk))]; + skp = &tcp_ehash[(sk->hashent = tcp_sk_hashfn(sk))]; if((sk->next = *skp) != NULL) (*skp)->pprev = &sk->next; @@ -421,7 +423,7 @@ static inline struct sock *__tcp_v4_lookup(struct tcphdr *th, * have wildcards anyways. */ hash = tcp_hashfn(daddr, hnum, saddr, sport); - for(sk = tcp_established_hash[hash]; sk; sk = sk->next) { + for(sk = tcp_ehash[hash]; sk; sk = sk->next) { if(TCP_IPV4_MATCH(sk, acookie, saddr, daddr, ports, dif)) { if (sk->state == TCP_ESTABLISHED) TCP_RHASH(sport) = sk; @@ -429,7 +431,7 @@ static inline struct sock *__tcp_v4_lookup(struct tcphdr *th, } } /* Must check for a TIME_WAIT'er before going to listener hash. */ - for(sk = tcp_established_hash[hash+(TCP_HTABLE_SIZE/2)]; sk; sk = sk->next) + for(sk = tcp_ehash[hash+(tcp_ehash_size/2)]; sk; sk = sk->next) if(TCP_IPV4_MATCH(sk, acookie, saddr, daddr, ports, dif)) goto hit; sk = tcp_v4_lookup_listener(daddr, hnum, dif); @@ -469,7 +471,7 @@ static struct sock *tcp_v4_proxy_lookup(unsigned short num, unsigned long raddr, /* This code must run only from NET_BH. */ { - struct tcp_bind_bucket *tb = tcp_bound_hash[tcp_bhashfn(hnum)]; + struct tcp_bind_bucket *tb = tcp_bhash[tcp_bhashfn(hnum)]; for( ; (tb && tb->port != hnum); tb = tb->next) ; if(tb == NULL) @@ -510,7 +512,7 @@ pass2: } next: if(firstpass--) { - struct tcp_bind_bucket *tb = tcp_bound_hash[tcp_bhashfn(hpnum)]; + struct tcp_bind_bucket *tb = tcp_bhash[tcp_bhashfn(hpnum)]; for( ; (tb && tb->port != hpnum); tb = tb->next) ; if(tb) { @@ -547,7 +549,7 @@ static int tcp_v4_unique_address(struct sock *sk) /* Freeze the hash while we snoop around. */ SOCKHASH_LOCK(); - tb = tcp_bound_hash[tcp_bhashfn(snum)]; + tb = tcp_bhash[tcp_bhashfn(snum)]; for(; tb; tb = tb->next) { if(tb->port == snum && tb->owners != NULL) { /* Almost certainly the re-use port case, search the real hashes @@ -1615,7 +1617,8 @@ static inline struct sock *tcp_v4_hnd_req(struct sock *sk,struct sk_buff *skb) sk = tcp_check_req(sk, skb, req); } #ifdef CONFIG_SYN_COOKIES - else if (flg == __constant_htonl(0x00120000)) { + else if ((flg & __constant_htonl(0x00120000))==__constant_htonl(0x00100000)) + { sk = cookie_v4_check(sk, skb, &(IPCB(skb)->opt)); } #endif @@ -1793,7 +1796,7 @@ do_time_wait: static void __tcp_v4_rehash(struct sock *sk) { - struct sock **skp = &tcp_established_hash[(sk->hashent = tcp_sk_hashfn(sk))]; + struct sock **skp = &tcp_ehash[(sk->hashent = tcp_sk_hashfn(sk))]; SOCKHASH_LOCK(); if(sk->pprev) { diff --git a/pfinet/linux-src/net/ipv4/tcp_timer.c b/pfinet/linux-src/net/ipv4/tcp_timer.c index 21029f8e..7529a441 100644 --- a/pfinet/linux-src/net/ipv4/tcp_timer.c +++ b/pfinet/linux-src/net/ipv4/tcp_timer.c @@ -5,7 +5,7 @@ * * Implementation of the Transmission Control Protocol(TCP). * - * Version: $Id: tcp_timer.c,v 1.62.2.3 1999/06/20 20:14:30 davem Exp $ + * Version: $Id: tcp_timer.c,v 1.62.2.4 1999/09/23 19:21:39 davem Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -363,8 +363,8 @@ static void tcp_keepalive(unsigned long data) int count = 0; int i; - for(i = chain_start; i < (chain_start + ((TCP_HTABLE_SIZE/2) >> 2)); i++) { - struct sock *sk = tcp_established_hash[i]; + for(i = chain_start; i < (chain_start + ((tcp_ehash_size/2) >> 2)); i++) { + struct sock *sk = tcp_ehash[i]; while(sk) { if(!atomic_read(&sk->sock_readers) && sk->keepopen) { count += tcp_keepopen_proc(sk); @@ -375,8 +375,8 @@ static void tcp_keepalive(unsigned long data) } } out: - chain_start = ((chain_start + ((TCP_HTABLE_SIZE/2)>>2)) & - ((TCP_HTABLE_SIZE/2) - 1)); + chain_start = ((chain_start + ((tcp_ehash_size/2)>>2)) & + ((tcp_ehash_size/2) - 1)); } /* -- cgit v1.2.3