diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-alpha/termios.h | 2 | ||||
-rw-r--r-- | include/asm-arm/termios.h | 2 | ||||
-rw-r--r-- | include/asm-i386/termios.h | 2 | ||||
-rw-r--r-- | include/asm-m68k/termios.h | 2 | ||||
-rw-r--r-- | include/asm-mips/termios.h | 2 | ||||
-rw-r--r-- | include/asm-ppc/termios.h | 2 | ||||
-rw-r--r-- | include/asm-sparc/termios.h | 2 | ||||
-rw-r--r-- | include/asm-sparc64/termios.h | 2 | ||||
-rw-r--r-- | include/linux/ax25.h | 72 | ||||
-rw-r--r-- | include/linux/ax25_userdev.h | 120 | ||||
-rw-r--r-- | include/linux/miscdevice.h | 1 | ||||
-rw-r--r-- | include/linux/netdevice.h | 1 | ||||
-rw-r--r-- | include/linux/netlink.h | 1 | ||||
-rw-r--r-- | include/linux/scc.h | 198 | ||||
-rw-r--r-- | include/linux/sysctl.h | 88 | ||||
-rw-r--r-- | include/net/ax25.h | 381 | ||||
-rw-r--r-- | include/net/ax25_uid.h | 33 | ||||
-rw-r--r-- | include/net/ax25call.h | 2 | ||||
-rw-r--r-- | include/net/ax25dev.h | 164 | ||||
-rw-r--r-- | include/net/netrom.h | 3 | ||||
-rw-r--r-- | include/net/rose.h | 3 |
21 files changed, 672 insertions, 411 deletions
diff --git a/include/asm-alpha/termios.h b/include/asm-alpha/termios.h index 374793646..b1bf59210 100644 --- a/include/asm-alpha/termios.h +++ b/include/asm-alpha/termios.h @@ -72,7 +72,7 @@ struct termio { #define N_MOUSE 2 #define N_PPP 3 #define N_STRIP 4 -#define N_AX25 5 +#define N_KISS 5 #define N_X25 6 /* X.25 async */ #define N_6PACK 7 #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ diff --git a/include/asm-arm/termios.h b/include/asm-arm/termios.h index 3da727e71..95a242b9a 100644 --- a/include/asm-arm/termios.h +++ b/include/asm-arm/termios.h @@ -55,7 +55,7 @@ struct termio { #define N_MOUSE 2 #define N_PPP 3 #define N_STRIP 4 -#define N_AX25 5 +#define N_KISS 5 #define N_X25 6 /* X.25 async */ #define N_6PACK 7 #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ diff --git a/include/asm-i386/termios.h b/include/asm-i386/termios.h index 70c1ecefd..d8c6f6a93 100644 --- a/include/asm-i386/termios.h +++ b/include/asm-i386/termios.h @@ -45,7 +45,7 @@ struct termio { #define N_MOUSE 2 #define N_PPP 3 #define N_STRIP 4 -#define N_AX25 5 +#define N_KISS 5 #define N_X25 6 /* X.25 async */ #define N_6PACK 7 #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ diff --git a/include/asm-m68k/termios.h b/include/asm-m68k/termios.h index 411018fdb..75b0d9432 100644 --- a/include/asm-m68k/termios.h +++ b/include/asm-m68k/termios.h @@ -55,7 +55,7 @@ struct termio { #define N_MOUSE 2 #define N_PPP 3 #define N_STRIP 4 -#define N_AX25 5 +#define N_KISS 5 #define N_X25 6 /* X.25 async */ #define N_6PACK 7 #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ diff --git a/include/asm-mips/termios.h b/include/asm-mips/termios.h index abc5deb3c..a37f05970 100644 --- a/include/asm-mips/termios.h +++ b/include/asm-mips/termios.h @@ -90,7 +90,7 @@ struct termio { #define N_MOUSE 2 #define N_PPP 3 #define N_STRIP 4 -#define N_AX25 5 +#define N_KISS 5 #define N_X25 6 /* X.25 async */ #define N_6PACK 7 #define N_MASC 8 /* Reserved fo Mobitex module <kaz@cafe.net> */ diff --git a/include/asm-ppc/termios.h b/include/asm-ppc/termios.h index 942c6e4b6..c481f19e4 100644 --- a/include/asm-ppc/termios.h +++ b/include/asm-ppc/termios.h @@ -180,7 +180,7 @@ struct termio { #define N_MOUSE 2 #define N_PPP 3 #define N_STRIP 4 -#define N_AX25 5 +#define N_KISS 5 #define N_X25 6 /* X.25 async */ #define N_6PACK 7 #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h index a05f65856..2ff48aaa6 100644 --- a/include/asm-sparc/termios.h +++ b/include/asm-sparc/termios.h @@ -60,7 +60,7 @@ struct winsize { #define N_MOUSE 2 #define N_PPP 3 #define N_STRIP 4 -#define N_AX25 5 +#define N_KISS 5 #define N_X25 6 #define N_6PACK 7 #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ diff --git a/include/asm-sparc64/termios.h b/include/asm-sparc64/termios.h index 082b57ac7..55d542645 100644 --- a/include/asm-sparc64/termios.h +++ b/include/asm-sparc64/termios.h @@ -60,7 +60,7 @@ struct winsize { #define N_MOUSE 2 #define N_PPP 3 #define N_STRIP 4 -#define N_AX25 5 +#define N_KISS 5 #define N_X25 6 #define N_6PACK 7 #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ diff --git a/include/linux/ax25.h b/include/linux/ax25.h index 9191445bb..f316c9960 100644 --- a/include/linux/ax25.h +++ b/include/linux/ax25.h @@ -6,8 +6,10 @@ #ifndef AX25_KERNEL_H #define AX25_KERNEL_H +#define AX25_NEW_DEVIF 1 + #define AX25_MTU 256 -#define AX25_MAX_DIGIS 8 +#define AX25_MAX_DIGIS 8 #define AX25_WINDOW 1 #define AX25_T1 2 @@ -35,6 +37,9 @@ #define SIOCAX25DEVCTL (SIOCPROTOPRIVATE+12) #define SIOCAX25GETINFO (SIOCPROTOPRIVATE+13) +#define AX25_SET_DEV_BITRATE 0 +#define AX25_SET_DEV_MODE 1 + #define AX25_SET_RT_IPMODE 2 #define AX25_NOUID_DEFAULT 0 @@ -58,6 +63,59 @@ struct full_sockaddr_ax25 { ax25_address fsa_digipeater[AX25_MAX_DIGIS]; }; +#define fsax25_family fsa_ax25.sax25_family +#define fsax25_call fsa_ax25.sax25_call +#define fsax25_ndigis fsa_ax25.sax25_ndigis + +typedef struct { + ax25_address addr; + ax25_address digipeater[AX25_MAX_DIGIS];; + unsigned char dcount; +} ax25_path_t; + +typedef struct { + ax25_address dest; + ax25_address src; + ax25_address digipeater[AX25_MAX_DIGIS]; + unsigned char dcount; + char lastrepeat; +} ax25_addr_t; + +struct ax25_rtmsg { + char port_name[32]; + unsigned int mode; + ax25_addr_t addr; +}; + +struct ax25_armsg { + char port_name[32]; + unsigned int ip_addr; + ax25_address ax_addr; +}; + +struct ax25_pathmsg { + char port_name[32]; + unsigned int mode; + ax25_path_t path; +}; + +struct ax25_nlmsg { + +#define AX25_MSG_RTINFO 0 +#define AX25_MSG_ARINFO 1 +#define AX25_MSG_SETRT 2 +#define AX25_MSG_DELRT 3 +#define AX25_MSG_OPTRT 4 + unsigned int msg_type; + + union { + unsigned char raw[128-sizeof(unsigned int)]; + struct ax25_rtmsg rtmsg; + struct ax25_armsg armsg; + struct ax25_pathmsg pathmsg; + } msg; +}; + struct ax25_routes_struct { ax25_address port_addr; ax25_address dest_addr; @@ -73,13 +131,11 @@ struct ax25_route_opt_struct { }; struct ax25_ctl_struct { - ax25_address port_addr; - ax25_address source_addr; - ax25_address dest_addr; - unsigned int cmd; - unsigned long arg; - unsigned char digi_count; - ax25_address digi_addr[AX25_MAX_DIGIS]; + ax25_address port_addr; + ax25_address source_addr; + ax25_address dest_addr; + unsigned int cmd; + unsigned long arg; }; /* this will go away. Please do not export to user land */ diff --git a/include/linux/ax25_userdev.h b/include/linux/ax25_userdev.h new file mode 100644 index 000000000..cc58a3e5e --- /dev/null +++ b/include/linux/ax25_userdev.h @@ -0,0 +1,120 @@ +/* + * AX.25 usermode device driver. + * Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com> + * Copyright 2001, by Joerg Reuter <jreuter@yaina.de> + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __IF_AX25_UDEV_H +#define __IF_AX25_UDEV_H + +#define AX25_UDEV_VER "0.1" +#define AX25_UDEV_DEBUG + +/* Uncomment to enable debugging */ +/* #define AX25_UDEV_DEBUG 1 */ + +#ifdef __KERNEL__ + +#ifdef AX25_UDEV_DEBUG +#define DBG if(ax25_udev->debug)printk +#define DBG1 if(debug==2)printk +#else +#define DBG( a... ) +#define DBG1( a... ) +#endif + +struct ax25_udev_struct { + char name[IFNAMSIZ]; + unsigned long flags; + + struct fasync_struct *fasync; + wait_queue_head_t read_wait; + + struct net_device dev; + struct sk_buff_head txq; + struct net_device_stats stats; + struct ax25_dev ax25_dev; + + struct { + int duplex; + int arbitration; + } capabilities; + + struct { + int dcd:1; + int cts:1; + int rts:1; + int ptt:1; + } status; + +#ifdef AX25_UDEV_DEBUG + int debug; +#endif +}; + +#endif /* __KERNEL__ */ + +/* Number of devices */ +#define AX25_UDEV_MAX_DEV 255 + +/* TX queue size */ +#define AX25_UDEV_TXQ_SIZE 10 + +/* Max frame size */ +#define AX25_UDEV_MAX_FRAME 4096 + +/* AX25_UDEV device flags */ +#define AX25_UDEV_TYPE_MASK 0x000f +#define AX25_UDEV_FASYNC 0x0010 +#define AX25_UDEV_IFF_SET 0x1000 + +/* AX25_UDEV IFF ioctl */ +#define AX25_UDEV_SETIFF _IOW(0x25, 0, void *) +#define AX25_UDEV_SETDEBUG _IOW(0x25, 1, int) + +/* Packet layout: + * + * (int) packet_type + * (int) data + * ... + * + * Exception for AX25_UDEV_DATA: + * (int) 0 + * (char) octet + * ... + * + */ + +typedef enum ax25_user_dev_commands_e { + AX25_UDEV_DATA, + AX25_UDEV_CAPABILITIES, + AX25_UDEV_DCD_STATUS, + AX25_UDEV_CTS_STATUS, + AX25_UDEV_PTT_STATUS, + AX25_UDEV_SET_MAC_VALUE, + AX25_UDEV_REQUEST_RTS +} ax25_user_dev_commands_t; + +typedef enum ax25_user_dev_capabilities_e { + AX25_UDEV_CAP_HALF_DUPLEX, + AX25_UDEV_CAP_FULL_DUPLEX, + AX25_UDEV_CAP_ADVANCED_ARBITRATION, + AX25_UDEV_CAP_OWN_ARBITRATION, + AX25_UDEV_CAP_SIMPLE_ARBITRATION +} ax25_user_dev_capabilities_t; + +typedef int ax25_udev_pt_t; +typedef int ax25_udev_val_t; + +#endif /* __IF_AX25_UDEV_H */ diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index 34c8dcb04..1fd9db550 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -33,6 +33,7 @@ #define SGI_USEMACLONE 151 #define TUN_MINOR 200 +#define AX25_UDEV_MINOR 210 extern int misc_init(void); diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 011caf23d..686ebda28 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -317,6 +317,7 @@ struct net_device void *dn_ptr; /* DECnet specific data */ void *ip6_ptr; /* IPv6 specific data */ void *ec_ptr; /* Econet specific data */ + void *ax25_ptr; /* AX.25 specific data */ struct Qdisc *qdisc; struct Qdisc *qdisc_sleeping; diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 2afb52e98..6eaaa86bf 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -5,6 +5,7 @@ #define NETLINK_SKIP 1 /* Reserved for ENskip */ #define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ #define NETLINK_FIREWALL 3 /* Firewalling hook */ +#define NETLINK_AX25 4 /* AX25 routing daemon hook */ #define NETLINK_ARPD 8 #define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ #define NETLINK_IP6_FW 13 diff --git a/include/linux/scc.h b/include/linux/scc.h index a896704e6..1ec441746 100644 --- a/include/linux/scc.h +++ b/include/linux/scc.h @@ -8,7 +8,7 @@ /* selection of hardware types */ #define PA0HZP 0x00 /* hardware type for PA0HZP SCC card and compatible */ -#define EAGLE 0x01 /* hardware type for EAGLE card */ +#define EAGLE 0x01 /* hardware type for EAGLE card */ #define PC100 0x02 /* hardware type for PC100 card */ #define PRIMUS 0x04 /* hardware type for PRIMUS-PC (DG9BL) card */ #define DRSI 0x08 /* hardware type for DRSI PC*Packet card */ @@ -22,87 +22,45 @@ enum SCC_ioctl_cmds { SIOCSCCINI, SIOCSCCCHANINI, SIOCSCCSMEM, - SIOCSCCGKISS, - SIOCSCCSKISS, + SIOCSCCGMODEM, + SIOCSCCSMODEM, SIOCSCCGSTAT, SIOCSCCCAL }; -/* Device parameter control (from WAMPES) */ - -enum L1_params { - PARAM_DATA, - PARAM_TXDELAY, - PARAM_PERSIST, - PARAM_SLOTTIME, - PARAM_TXTAIL, - PARAM_FULLDUP, - PARAM_SOFTDCD, /* was: PARAM_HW */ - PARAM_MUTE, /* ??? */ - PARAM_DTR, - PARAM_RTS, - PARAM_SPEED, - PARAM_ENDDELAY, /* ??? */ - PARAM_GROUP, - PARAM_IDLE, - PARAM_MIN, - PARAM_MAXKEY, - PARAM_WAIT, - PARAM_MAXDEFER, - PARAM_TX, - PARAM_HWEVENT = 31, - PARAM_RETURN = 255 /* reset kiss mode */ -}; - -/* fulldup parameter */ +/* magic number */ -enum FULLDUP_modes { - KISS_DUPLEX_HALF, /* normal CSMA operation */ - KISS_DUPLEX_FULL, /* fullduplex, key down trx after transmission */ - KISS_DUPLEX_LINK, /* fullduplex, key down trx after 'idletime' sec */ - KISS_DUPLEX_OPTIMA /* fullduplex, let the protocol layer control the hw */ -}; +#define SCC_MAGIC 0x8530 /* ;-) */ /* misc. parameters */ #define TIMER_OFF 65535U /* to switch off timers */ -#define NO_SUCH_PARAM 65534U /* param not implemented */ - -/* HWEVENT parameter */ -enum HWEVENT_opts { - HWEV_DCD_ON, - HWEV_DCD_OFF, - HWEV_ALL_SENT -}; - -/* channel grouping */ +/* Tx/Rx clock sources */ -#define RXGROUP 0100 /* if set, only tx when all channels clear */ -#define TXGROUP 0200 /* if set, don't transmit simultaneously */ +typedef enum { + CLOCK_SOURCE_RTxC, /* use RTxC pin */ + CLOCK_SOURCE_TRxC, /* use TRxC pin */ + CLOCK_SOURCE_BRG, /* use baud rate generator */ + CLOCK_SOURCE_DPLL /* use DPLL */ +} Scc_clock_sources; -/* Tx/Rx clock sources */ +typedef enum { + TRXCP_MODE_IN, /* TRxC pin is input */ + TRXCP_MODE_TXC_OUT, /* TRxC bears Tx clock */ + TRXCP_MODE_BRG_OUT, /* TRxC bears BRG output */ + TRXCP_MODE_DPLL_OUT /* TRxC bears DPLL */ -enum CLOCK_sources { - CLK_DPLL, /* normal halfduplex operation */ - CLK_EXTERNAL, /* external clocking (G3RUH/DF9IC modems) */ - CLK_DIVIDER, /* Rx = DPLL, Tx = divider (fullduplex with */ - /* modems without clock regeneration */ - CLK_BRG /* experimental fullduplex mode with DPLL/BRG for */ - /* MODEMs without clock recovery */ -}; +} Scc_trxc_pin_modes; /* Tx state */ -enum TX_state { +typedef enum { TXS_IDLE, /* Transmitter off, no data pending */ - TXS_BUSY, /* waiting for permission to send / tailtime */ + TXS_TXDELAY, /* waiting for transmitter keyed up */ TXS_ACTIVE, /* Transmitter on, sending data */ - TXS_NEWFRAME, /* reset CRC and send (next) frame */ - TXS_IDLE2, /* Transmitter on, no data pending */ - TXS_WAIT, /* Waiting for Mintime to expire */ - TXS_TIMEOUT /* We had a transmission timeout */ -}; + TXS_TAIL, /* Transmition tail time */ +} Scc_tx_states; typedef unsigned long io_port; /* type definition for an 'io port address' */ @@ -124,50 +82,22 @@ struct scc_stat { unsigned int tx_under; /* Transmitter Underruns */ unsigned int tx_state; /* Transmitter state */ - int tx_queued; /* tx frames enqueued */ - - unsigned int maxqueue; /* allocated tx_buffers */ unsigned int bufsize; /* used buffersize */ }; struct scc_modem { - long speed; /* Line speed, bps */ - char clocksrc; /* 0 = DPLL, 1 = external, 2 = divider */ - char nrz; /* NRZ instead of NRZI */ -}; - -struct scc_kiss_cmd { - int command; /* one of the KISS-Commands defined above */ - unsigned param; /* KISS-Param */ -}; - -struct scc_hw_config { - io_port data_a; /* data port channel A */ - io_port ctrl_a; /* control port channel A */ - io_port data_b; /* data port channel B */ - io_port ctrl_b; /* control port channel B */ - io_port vector_latch; /* INTACK-Latch (#) */ - io_port special; /* special function port */ - - int irq; /* irq */ - long clock; /* clock */ - char option; /* command for function port */ - - char brand; /* hardware type */ - char escc; /* use ext. features of a 8580/85180/85280 */ -}; - -/* (#) only one INTACK latch allowed. */ - - -struct scc_mem_config { - unsigned int dummy; - unsigned int bufsize; -}; - -struct scc_calibrate { - unsigned int time; - unsigned char pattern; + int rx_speed; /* Line speed, bps */ + int tx_speed; + int rx_clock_source; /* see CLOCK_sources above */ + int tx_clock_source; /* dito */ + int trxc_pin_mode; /* see TRXCP_modes above */ + int nrz_mode; /* 0 = NRZ, 1 = NRZI */ + int tx_delay; /* tx delay in msec */ + int tx_tail; /* tx tail time in msec */ + int fullduplex; /* Duplex mode: 0 = "halfduplex", 1 = "fullduplex" */ + int trx_feedback; /* TRX feeds transmit signal back to RxD */ + int tx_inhibit; /* Transmit is not allowed when set */ + int softdcd; /* Use DPLL instead of DCD pin for carrier detect */ }; #ifdef __KERNEL__ @@ -182,71 +112,53 @@ enum {TX_OFF, TX_ON}; /* command for scc_key_trx() */ #define RXINT 0x04 #define SPINT 0x06 -#ifdef CONFIG_SCC_DELAY -#define Inb(port) inb_p(port) -#define Outb(port, val) outb_p(val, port) -#else -#define Inb(port) inb(port) -#define Outb(port, val) outb(val, port) -#endif - -/* SCC channel control structure for KISS */ - -struct scc_kiss { - unsigned char txdelay; /* Transmit Delay 10 ms/cnt */ - unsigned char persist; /* Persistence (0-255) as a % */ - unsigned char slottime; /* Delay to wait on persistence hit */ - unsigned char tailtime; /* Delay after last byte written */ - unsigned char fulldup; /* Full Duplex mode 0=CSMA 1=DUP 2=ALWAYS KEYED */ - unsigned char waittime; /* Waittime before any transmit attempt */ - unsigned int maxkeyup; /* Maximum time to transmit (seconds) */ - unsigned char mintime; /* Minimal offtime after MAXKEYUP timeout (seconds) */ - unsigned int idletime; /* Maximum idle time in ALWAYS KEYED mode (seconds) */ - unsigned int maxdefer; /* Timer for CSMA channel busy limit */ - unsigned char tx_inhibit; /* Transmit is not allowed when set */ - unsigned char group; /* Group ID for AX.25 TX interlocking */ - unsigned char mode; /* 'normal' or 'hwctrl' mode (unused) */ - unsigned char softdcd; /* Use DPLL instead of DCD pin for carrier detect */ -}; - - /* SCC channel structure */ struct scc_channel { - int magic; /* magic word */ - int init; /* channel exists? */ struct net_device *dev; /* link to device control structure */ struct net_device_stats dev_stat;/* device statistics */ + struct ax25_dev ax25dev; + char * proc_dev_name; /* points to dev->name or NULL */ char brand; /* manufacturer of the board */ long clock; /* used clock */ io_port ctrl; /* I/O address of CONTROL register */ io_port data; /* I/O address of DATA register */ - io_port special; /* I/O address of special function port */ + io_port special_port; /* I/O address of special function port */ int irq; /* Number of Interrupt */ - char option; + char special_option; char enhanced; /* Enhanced SCC support */ unsigned char wreg[16]; /* Copy of last written value in WRx */ unsigned char status; /* Copy of R0 at last external interrupt */ unsigned char dcd; /* DCD status */ - struct scc_kiss kiss; /* control structure for KISS params */ - struct scc_stat stat; /* statistical information */ struct scc_modem modem; /* modem information */ + struct scc_stat stat; /* statistical information */ + + struct { + spinlock_t hwaccess; /* hardware access */ + spinlock_t timer; /* timer functions */ + spinlock_t kick_tx; /* start of transmission */ + } spinlocks; + + struct { + ctl_table channel[6]; /* /.../chip_<n>/channel_<k>/ */ + ctl_table modem[13]; /* /.../channel_<k>/modem/ */ + ctl_table stats[1]; /* /.../channel_<k>/stats/ */ + } proc_tables; + - struct sk_buff_head tx_queue; /* next tx buffer */ struct sk_buff *rx_buff; /* pointer to frame currently received */ struct sk_buff *tx_buff; /* pointer to frame currently transmitted */ - - /* Timer */ - struct timer_list tx_t; /* tx timer for this channel */ - struct timer_list tx_wdog; /* tx watchdogs */ + struct sk_buff *tx_new; /* next transmit buffer */ + struct timer_list tx_timer; /* Tx delay & tail timer */ }; +int scc_init(void); #endif /* defined(__KERNEL__) */ #endif /* defined(_SCC_H) */ diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index cbfaafbfe..24ca11425 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -155,7 +155,8 @@ enum NET_TR=14, NET_DECNET=15, NET_ECONET=16, - NET_KHTTPD=17 + NET_KHTTPD=17, + NET_DEV=18 }; /* /proc/sys/kernel/random */ @@ -423,7 +424,16 @@ enum { NET_AX25_N2=11, NET_AX25_PACLEN=12, NET_AX25_PROTOCOL=13, - NET_AX25_DAMA_SLAVE_TIMEOUT=14 + NET_AX25_DAMA_SLAVE_TIMEOUT=14, + NET_AX25_MEDIA_DUPLEX=15, + NET_AX25_MEDIA_TXDELAY=16, + NET_AX25_MEDIA_TXTAIL=17, + NET_AX25_MEDIA_TXBITRATE=18, + NET_AX25_MEDIA_RXBITRATE=19, + NET_AX25_MEDIA_SLOTTIME=20, + NET_AX25_MEDIA_PPERSISTENCE=21, + NET_AX25_MEDIA_AUTO_ADJUST=22, + NET_AX25_DEVICE_NAME=23 }; /* /proc/sys/net/rose */ @@ -510,6 +520,80 @@ enum { NET_DECNET_CONF_DEV_STATE = 7 }; +/* /proc/sys/net/dev/ (hardware configuration for net devices) */ + +enum { + NET_DEV_Z8530DRV=1 +}; + +/* /proc/sys/net/dev/z8530drv/ */ + +enum { + NET_DEV_Z8530DRV_NCHIPS=1, + NET_DEV_Z8530DRV_DELAY=2, + NET_DEV_Z8530DRV_CHIP_BASE=32 +}; + +/* /proc/sys/net/dev/z8530drv/chip<n>/ */ + +enum { + NET_DEV_Z8530DRV_VENDOR=1, + NET_DEV_Z8530DRV_CLOCK=2, + NET_DEV_Z8530DRV_IRQ=3, + NET_DEV_Z8530DRV_ESCC=4, + NET_DEV_Z8530DRV_SPECIAL_PORT=5, + NET_DEV_Z8530DRV_SPECIAL_OPT=6, + NET_DEV_Z8530DRV_CHANNEL_A=32, + NET_DEV_Z8530DRV_CHANNEL_B=33 +}; + +/* /proc/sys/net/dev/z8530drv/chip<n>/port<c>/ */ + +enum { + NET_DEV_Z8530DRV_DATA_PORT=1, + NET_DEV_Z8530DRV_CTRL_PORT=2, + NET_DEV_Z8530DRV_IFNAME=3, + NET_DEV_Z8530DRV_BUFSIZE=4, +/* + NET_DEV_Z8530DRV_SPECIAL_PORT=5, + NET_DEV_Z8530DRV_SPECIAL_OPT=6, +*/ + NET_DEV_Z8530DRV_MODEM=32, + NET_DEV_Z8530DRV_STAT=33 +}; + +/* /proc/sys/net/dev/z8530drv/chip<n>/port<c>/modem/ */ + +enum { + NET_DEV_Z8530DRV_RX_SPEED=1, + NET_DEV_Z8530DRV_TX_SPEED=2, + NET_DEV_Z8530DRV_RX_CLOCK_SOURCE=3, + NET_DEV_Z8530DRV_TX_CLOCK_SOURCE=4, + NET_DEV_Z8530DRV_TRXC_PIN_MODE=5, + NET_DEV_Z8530DRV_FULLDUPLEX=6, + NET_DEV_Z8530DRV_TRX_FEEDBACK=7, + NET_DEV_Z8530DRV_NRZ_MODE=8, + NET_DEV_Z8530DRV_TX_INHIBIT=9, + NET_DEV_Z8530DRV_SOFTDCD=10, + NET_DEV_Z8530DRV_TX_DELAY=11, + NET_DEV_Z8530DRV_TX_TAIL=12 +}; + +/* /proc/sys/net/dev/z8530drv/chip<n>/port<c>/stats/ */ + +enum { + NET_DEV_Z8530DRV_STAT_RX_INTS=1, + NET_DEV_Z8530DRV_STAT_TX_INTS=2, + NET_DEV_Z8530DRV_STAT_EX_INTS=3, + NET_DEV_Z8530DRV_STAT_TX_FRAMES=4, + NET_DEV_Z8530DRV_STAT_RX_FRAMES=5, + NET_DEV_Z8530DRV_STAT_TX_ERRORS=6, + NET_DEV_Z8530DRV_STAT_RX_ERRORS=7, + NET_DEV_Z8530DRV_STAT_TX_UNDERRUNS=8, + NET_DEV_Z8530DRV_STAT_RX_OVERRUNS=9, + NET_DEV_Z8530DRV_STAT_NO_SPACE=10, + NET_DEV_Z8530DRV_STAT_TX_STATE=11 +}; /* CTL_PROC names: */ /* CTL_FS names: */ diff --git a/include/net/ax25.h b/include/net/ax25.h index 0957d1aae..fc0509a3f 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h @@ -6,19 +6,27 @@ #ifndef _AX25_H #define _AX25_H -#include <linux/config.h> #include <linux/ax25.h> -#define AX25_T1CLAMPLO 1 -#define AX25_T1CLAMPHI (30 * HZ) +#define AX25_TICS (HZ/10) /* AX25 timertic is 1/10 sec (100 ms) */ +#define AX25_SLOWHZ 10 /* 10 timertics, 1 second */ + +#define AX25_T1CLAMPLO AX25_SLOWHZ /* 1 sec */ +#define AX25_T1CLAMPHI (30 * AX25_SLOWHZ) /* 30 secs */ #define AX25_BPQ_HEADER_LEN 16 -#define AX25_KISS_HEADER_LEN 1 -#define AX25_HEADER_LEN 17 #define AX25_ADDR_LEN 7 -#define AX25_DIGI_HEADER_LEN (AX25_MAX_DIGIS * AX25_ADDR_LEN) -#define AX25_MAX_HEADER_LEN (AX25_HEADER_LEN + AX25_DIGI_HEADER_LEN) +#define AX25_MIN_HEADER_LEN (AX25_ADDR_LEN*2+1) /* Source, Destination, Control */ +#define AX25_MAX_HEADER_LEN (AX25_MIN_HEADER_LEN+1+AX25_ADDR_LEN*AX25_MAX_DIGIS) /* ... including Digipeaters */ + +/* + * these are obsolete + * + * #define AX25_KISS_HEADER_LEN 1 + * #define AX25_HEADER_LEN 17 + * #define AX25_DIGI_HEADER_LEN (AX25_MAX_DIGIS * AX25_ADDR_LEN) + */ /* AX.25 Protocol IDs */ #define AX25_P_ROSE 0x01 @@ -27,6 +35,8 @@ #define AX25_P_TEXT 0xF0 #define AX25_P_NETROM 0xCF #define AX25_P_SEGMENT 0x08 +#define AX25_P_VJCOMP 0x06 /* Matthias Welwarsky (DG2FEF) */ +#define AX25_P_VJUNCOMP 0x07 /* Matthias Welwarsky (DG2FEF) */ /* AX.25 Segment control values */ #define AX25_SEG_REM 0x7F @@ -38,18 +48,45 @@ #define AX25_SSSID_SPARE 0x60 /* Unused bits in SSID for standard AX.25 */ #define AX25_ESSID_SPARE 0x20 /* Unused bits in SSID for extended AX.25 */ -#define AX25_DAMA_FLAG 0x20 /* Well, it is *NOT* unused! (dl1bke 951121 */ +#define AX25_DAMA_FLAG 0x20 /* Well, it is *NOT* unused! (dl1bke 951121) */ #define AX25_COND_ACK_PENDING 0x01 #define AX25_COND_REJECT 0x02 #define AX25_COND_PEER_RX_BUSY 0x04 #define AX25_COND_OWN_RX_BUSY 0x08 -#define AX25_COND_DAMA_MODE 0x10 +#define AX25_COND_STATE_CHANGE 0x10 +#define AX25_COND_RELEASE 0x20 +#define AX25_COND_SETUP 0x40 +#define AX25_COND_START_T1 0x80 + +#define AX25_SCHED_IDLE 0 +#define AX25_SCHED_READY 1 #ifndef _LINUX_NETDEVICE_H #include <linux/netdevice.h> #endif +/* + * These headers are taken from the KA9Q package by Phil Karn. These specific + * files have been placed under the GPL (not the whole package) by Phil. + * + * + * Copyright 1991 Phil Karn, KA9Q + * + * 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; version 2 dated June, 1991. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139, USA. + */ + /* Upper sub-layer (LAPB) definitions */ /* Control field templates */ @@ -81,270 +118,122 @@ /* Define Link State constants. */ -enum { - AX25_STATE_0, +enum { + AX25_STATE_0 = 0, AX25_STATE_1, AX25_STATE_2, AX25_STATE_3, - AX25_STATE_4 -}; - -#define AX25_MODULUS 8 /* Standard AX.25 modulus */ -#define AX25_EMODULUS 128 /* Extended AX.25 modulus */ - -enum { - AX25_PROTO_STD_SIMPLEX, - AX25_PROTO_STD_DUPLEX, - AX25_PROTO_DAMA_SLAVE, - AX25_PROTO_DAMA_MASTER + AX25_STATE_4, + AX25_LISTEN }; -enum { - AX25_VALUES_IPDEFMODE, /* 0=DG 1=VC */ - AX25_VALUES_AXDEFMODE, /* 0=Normal 1=Extended Seq Nos */ - AX25_VALUES_BACKOFF, /* 0=None 1=Linear 2=Exponential */ - AX25_VALUES_CONMODE, /* Allow connected modes - 0=No 1=no "PID text" 2=all PIDs */ - AX25_VALUES_WINDOW, /* Default window size for standard AX.25 */ - AX25_VALUES_EWINDOW, /* Default window size for extended AX.25 */ - AX25_VALUES_T1, /* Default T1 timeout value */ - AX25_VALUES_T2, /* Default T2 timeout value */ - AX25_VALUES_T3, /* Default T3 timeout value */ - AX25_VALUES_IDLE, /* Connected mode idle timer */ - AX25_VALUES_N2, /* Default N2 value */ - AX25_VALUES_PACLEN, /* AX.25 MTU */ - AX25_VALUES_PROTOCOL, /* Std AX.25, DAMA Slave, DAMA Master */ - AX25_VALUES_DS_TIMEOUT, /* DAMA Slave timeout */ - AX25_MAX_VALUES /* THIS MUST REMAIN THE LAST ENTRY OF THIS LIST */ -}; +typedef enum { + AX25_SEQMASK = 7, + AX25_ESEQMASK = 127 +} ax25_seqmask_t; -#define AX25_DEF_IPDEFMODE 0 /* Datagram */ -#define AX25_DEF_AXDEFMODE 0 /* Normal */ -#define AX25_DEF_BACKOFF 1 /* Linear backoff */ -#define AX25_DEF_CONMODE 2 /* Connected mode allowed */ -#define AX25_DEF_WINDOW 2 /* Window=2 */ -#define AX25_DEF_EWINDOW 32 /* Module-128 Window=32 */ -#define AX25_DEF_T1 (10 * HZ) /* T1=10s */ -#define AX25_DEF_T2 (3 * HZ) /* T2=3s */ -#define AX25_DEF_T3 (300 * HZ) /* T3=300s */ -#define AX25_DEF_N2 10 /* N2=10 */ -#define AX25_DEF_IDLE (0 * 60 * HZ) /* Idle=None */ -#define AX25_DEF_PACLEN 256 /* Paclen=256 */ -#define AX25_DEF_PROTOCOL AX25_PROTO_STD_SIMPLEX /* Standard AX.25 */ -#define AX25_DEF_DS_TIMEOUT (3 * 60 * HZ) /* DAMA timeout 3 minutes */ - -typedef struct ax25_uid_assoc { - struct ax25_uid_assoc *next; - uid_t uid; - ax25_address call; -} ax25_uid_assoc; +#ifndef _AX25_VJ_H +struct axvj_slcomp; +#endif typedef struct { - ax25_address calls[AX25_MAX_DIGIS]; - unsigned char repeated[AX25_MAX_DIGIS]; - unsigned char ndigi; - char lastrepeat; -} ax25_digi; - -typedef struct ax25_route { - struct ax25_route *next; - ax25_address callsign; - struct net_device *dev; - ax25_digi *digipeat; - char ip_mode; -} ax25_route; - -typedef struct { - char slave; /* slave_mode? */ - struct timer_list slave_timer; /* timeout timer */ - unsigned short slave_timeout; /* when? */ -} ax25_dama_info; - -struct ctl_table; - -typedef struct ax25_dev { - struct ax25_dev *next; - struct net_device *dev; - struct net_device *forward; - struct ctl_table *systable; - int values[AX25_MAX_VALUES]; -#if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER) - ax25_dama_info dama; -#endif -} ax25_dev; + unsigned int csum; + struct sk_buff *skb; +} ax25_reseq_t; typedef struct ax25_cb { + struct ax25_cb *prev; /* doubly linked list now */ struct ax25_cb *next; - ax25_address source_addr, dest_addr; - ax25_digi *digipeat; - ax25_dev *ax25_dev; - unsigned char iamdigi; - unsigned char state, modulus, pidincl; - unsigned short vs, vr, va; - unsigned char condition, backoff; + struct ax25_cb *peer; /* for FlexNet style digipeating */ + struct net_device *device; /* backlink to device structure */ + int inserted; /* Socket is on a list */ + struct sock *sk; /* Backlink to socket */ + + /* used by the DDI layer */ + struct { + int state; + struct ax25_cb *prev; + struct ax25_cb *next; + } ready; + + unsigned short tx_cmd, tx_rsp; + + /* layer II values + * + * vs = sequence number assigned to next to be transmitted I frame + * va = sequence number of first I frame our peer has not acked yet + * vr = sequence number of next frame we expect to receive from peer + * vl = last frame we ack'ed yet + */ + ax25_addr_t addr; + unsigned char state, condition; + unsigned short vs, vr, va, vs_max, vl, window; + ax25_seqmask_t seqmask; + unsigned long rtt_timestamp; + short rtt, vs_rtt; unsigned char n2, n2count; - struct timer_list t1timer, t2timer, t3timer, idletimer; - unsigned long t1, t2, t3, idle, rtt; + unsigned short t1, t2, t3, idle; + unsigned short wrt_timer, ack_timer, idletimer, killtimer; unsigned short paclen, fragno, fraglen; + unsigned char iamdigi, pidincl, backoff; struct sk_buff_head write_queue; - struct sk_buff_head reseq_queue; + struct sk_buff_head rcv_queue; /* MW: for flow control handling */ struct sk_buff_head ack_queue; struct sk_buff_head frag_queue; - unsigned char window; - struct timer_list timer; - struct sock *sk; /* Backlink to socket */ + struct axvj_slcomp *slcomp; /* MW: for VJ Compression */ + unsigned char slcomp_enable; /* MW: dito. */ + ax25_reseq_t reseq[AX25_SEQMASK+1]; /* MW: resequencer, not for EMODULUS */ + rwlock_t timer_lock; } ax25_cb; -/* af_ax25.c */ -extern ax25_cb *volatile ax25_list; -extern void ax25_free_cb(ax25_cb *); -extern void ax25_insert_socket(ax25_cb *); -struct sock *ax25_find_listener(ax25_address *, int, struct net_device *, int); -struct sock *ax25_find_socket(ax25_address *, ax25_address *, int); -extern ax25_cb *ax25_find_cb(ax25_address *, ax25_address *, ax25_digi *, struct net_device *); -extern struct sock *ax25_addr_match(ax25_address *); -extern void ax25_send_to_raw(struct sock *, struct sk_buff *, int); -extern void ax25_destroy_socket(ax25_cb *); -extern ax25_cb *ax25_create_cb(void); -extern void ax25_fillin_cb(ax25_cb *, ax25_dev *); -extern int ax25_create(struct socket *, int); -extern struct sock *ax25_make_new(struct sock *, struct ax25_dev *); - -/* ax25_addr.c */ +typedef struct { + ax25_addr_t addr; + unsigned short frametype; + unsigned short nr; + unsigned short ns; + unsigned char pf; + unsigned char cmdrsp; + unsigned char dama; +} ax25_pktinfo; + +#define DAMA_STATE(ax25_cb) (AX25_PTR(ax25_cb->device)->dama_mode) + +/* needed by netrom/rose */ +extern __inline__ unsigned long ax25_display_timer(struct timer_list *timer) +{ + if (!timer_pending(timer)) + return 0; + return timer->expires - jiffies; +} + +#include <net/ax25call.h> + +extern ax25_address* asc2ax(char *); extern ax25_address null_ax25_address; -extern char *ax2asc(ax25_address *); -extern ax25_address *asc2ax(char *); -extern int ax25cmp(ax25_address *, ax25_address *); -extern int ax25digicmp(ax25_digi *, ax25_digi *); -extern unsigned char *ax25_addr_parse(unsigned char *, int, ax25_address *, ax25_address *, ax25_digi *, int *, int *); -extern int ax25_addr_build(unsigned char *, ax25_address *, ax25_address *, ax25_digi *, int, int); -extern int ax25_addr_size(ax25_digi *); -extern void ax25_digi_invert(ax25_digi *, ax25_digi *); - -/* ax25_dev.c */ -extern ax25_dev *ax25_dev_list; -extern ax25_dev *ax25_dev_ax25dev(struct net_device *); -extern ax25_dev *ax25_addr_ax25dev(ax25_address *); -extern void ax25_dev_device_up(struct net_device *); -extern void ax25_dev_device_down(struct net_device *); -extern int ax25_fwd_ioctl(unsigned int, struct ax25_fwd_struct *); -extern struct net_device *ax25_fwd_dev(struct net_device *); -extern void ax25_dev_free(void); - -/* ax25_ds_in.c */ -extern int ax25_ds_frame_in(ax25_cb *, struct sk_buff *, int); - -/* ax25_ds_subr.c */ -extern void ax25_ds_nr_error_recovery(ax25_cb *); -extern void ax25_ds_enquiry_response(ax25_cb *); -extern void ax25_ds_establish_data_link(ax25_cb *); -extern void ax25_dev_dama_on(ax25_dev *); -extern void ax25_dev_dama_off(ax25_dev *); -extern void ax25_dama_on(ax25_cb *); -extern void ax25_dama_off(ax25_cb *); - -/* ax25_ds_timer.c */ -extern void ax25_ds_set_timer(ax25_dev *); -extern void ax25_ds_del_timer(ax25_dev *); -extern void ax25_ds_timer(ax25_cb *); -extern void ax25_ds_t1_timeout(ax25_cb *); -extern void ax25_ds_heartbeat_expiry(ax25_cb *); -extern void ax25_ds_t3timer_expiry(ax25_cb *); -extern void ax25_ds_idletimer_expiry(ax25_cb *); - -/* ax25_iface.c */ -extern int ax25_protocol_register(unsigned int, int (*)(struct sk_buff *, ax25_cb *)); -extern void ax25_protocol_release(unsigned int); -extern int ax25_linkfail_register(void (*)(ax25_cb *, int)); -extern void ax25_linkfail_release(void (*)(ax25_cb *, int)); -extern int ax25_listen_register(ax25_address *, struct net_device *); -extern void ax25_listen_release(ax25_address *, struct net_device *); -extern int (*ax25_protocol_function(unsigned int))(struct sk_buff *, ax25_cb *); -extern int ax25_listen_mine(ax25_address *, struct net_device *); -extern void ax25_link_failed(ax25_cb *, int); -extern int ax25_protocol_is_registered(unsigned int); - -/* ax25_in.c */ -extern int ax25_rx_iframe(ax25_cb *, struct sk_buff *); -extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *); - -/* ax25_ip.c */ -extern int ax25_encapsulate(struct sk_buff *, struct net_device *, unsigned short, void *, void *, unsigned int); -extern int ax25_rebuild_header(struct sk_buff *); +extern char* ax2asc(ax25_address *); +extern int ax25cmp(ax25_address *, ax25_address *); +extern ax25_cb *ax25_send_frame(struct sk_buff*, int, ax25_addr_t*, struct net_device*); +extern ax25_cb *ax25_find_cb(ax25_addr_t*, struct net_device*); /* ax25_out.c */ -extern ax25_cb *ax25_send_frame(struct sk_buff *, int, ax25_address *, ax25_address *, ax25_digi *, struct net_device *); extern void ax25_output(ax25_cb *, int, struct sk_buff *); -extern void ax25_kick(ax25_cb *); -extern void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int); -extern void ax25_queue_xmit(struct sk_buff *); -extern int ax25_check_iframes_acked(ax25_cb *, unsigned short); - -/* ax25_route.c */ -extern void ax25_rt_device_down(struct net_device *); -extern int ax25_rt_ioctl(unsigned int, void *); -extern int ax25_rt_get_info(char *, char **, off_t, int); -extern int ax25_rt_autobind(ax25_cb *, ax25_address *); -extern ax25_route *ax25_rt_find_route(ax25_address *, struct net_device *); -extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); -extern void ax25_rt_free(void); - -/* ax25_std_in.c */ -extern int ax25_std_frame_in(ax25_cb *, struct sk_buff *, int); - -/* ax25_std_subr.c */ -extern void ax25_std_nr_error_recovery(ax25_cb *); -extern void ax25_std_establish_data_link(ax25_cb *); -extern void ax25_std_transmit_enquiry(ax25_cb *); -extern void ax25_std_enquiry_response(ax25_cb *); -extern void ax25_std_timeout_response(ax25_cb *); - -/* ax25_std_timer.c */ -extern void ax25_std_heartbeat_expiry(ax25_cb *); -extern void ax25_std_t1timer_expiry(ax25_cb *); -extern void ax25_std_t2timer_expiry(ax25_cb *); -extern void ax25_std_t3timer_expiry(ax25_cb *); -extern void ax25_std_idletimer_expiry(ax25_cb *); - -/* ax25_subr.c */ -extern void ax25_clear_queues(ax25_cb *); -extern void ax25_frames_acked(ax25_cb *, unsigned short); -extern void ax25_requeue_frames(ax25_cb *); -extern int ax25_validate_nr(ax25_cb *, unsigned short); -extern int ax25_decode(ax25_cb *, struct sk_buff *, int *, int *, int *); -extern void ax25_send_control(ax25_cb *, int, int, int); -extern void ax25_return_dm(struct net_device *, ax25_address *, ax25_address *, ax25_digi *); -extern void ax25_calculate_t1(ax25_cb *); -extern void ax25_calculate_rtt(ax25_cb *); -extern void ax25_disconnect(ax25_cb *, int); /* ax25_timer.c */ -extern void ax25_start_heartbeat(ax25_cb *); -extern void ax25_start_t1timer(ax25_cb *); -extern void ax25_start_t2timer(ax25_cb *); -extern void ax25_start_t3timer(ax25_cb *); -extern void ax25_start_idletimer(ax25_cb *); -extern void ax25_stop_heartbeat(ax25_cb *); -extern void ax25_stop_t1timer(ax25_cb *); -extern void ax25_stop_t2timer(ax25_cb *); -extern void ax25_stop_t3timer(ax25_cb *); -extern void ax25_stop_idletimer(ax25_cb *); -extern int ax25_t1timer_running(ax25_cb *); -extern unsigned long ax25_display_timer(struct timer_list *); - -/* ax25_uid.c */ -extern int ax25_uid_policy; -extern ax25_address *ax25_findbyuid(uid_t); -extern int ax25_uid_ioctl(int, struct sockaddr_ax25 *); -extern int ax25_uid_get_info(char *, char **, off_t, int); -extern void ax25_uid_free(void); +extern void ax25_timer(ax25_cb *); +extern void ax25_link_failed(ax25_cb *, int); +extern int (*ax25_protocol_function(unsigned int))(struct sk_buff *, ax25_cb *); /* sysctl_net_ax25.c */ -#ifdef CONFIG_SYSCTL extern void ax25_register_sysctl(void); extern void ax25_unregister_sysctl(void); -#else -extern inline void ax25_register_sysctl(void) {}; -extern inline void ax25_unregister_sysctl(void) {}; -#endif /* CONFIG_SYSCTL */ + +/* support routines for modules that use AX.25, in ax25_timer.c */ +extern int ax25_protocol_register(unsigned int, int (*)(struct sk_buff *, ax25_cb *)); +extern void ax25_protocol_release(unsigned int); +extern int ax25_linkfail_register(void (*)(ax25_cb *, int)); +extern void ax25_linkfail_release(void (*)(ax25_cb *, int)); +extern int ax25_listen_register(ax25_address *, struct net_device *); +extern void ax25_listen_release(ax25_address *, struct net_device *); +extern int ax25_protocol_is_registered(unsigned int); #endif diff --git a/include/net/ax25_uid.h b/include/net/ax25_uid.h new file mode 100644 index 000000000..ae40ff0fd --- /dev/null +++ b/include/net/ax25_uid.h @@ -0,0 +1,33 @@ +/* + * This code REQUIRES 1.2.1 or higher/ NET3.029 + * + * This module: + * This module 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. + */ + +#ifndef _AX25_UID_H +#define _AX25_UID_H + +typedef struct ax25_uid_assoc { + struct ax25_uid_assoc *next; + uid_t uid; + ax25_address call; + char device[IFNAMSIZ]; +} ax25_uid_assoc; + +typedef enum { + AX25_UID_POLICY_ARBITRARY_CALLSIGN, + AX25_UID_POLICY_GIVEN_CALLSIGN, + AX25_UID_POLICY_ANY_SSID +} t_ax25_uid_policy; + +extern t_ax25_uid_policy ax25_uid_policy; +extern int ax25_cs_get_info(char *, char **, off_t, int); +extern int ax25_uid_ioctl(int, struct sockaddr_ax25*); +extern ax25_address* ax25_find_by_uid(uid_t uid); +extern ax25_address* ax25_find_match_for_uid(uid_t uid, ax25_address *providec, char *device); + +#endif diff --git a/include/net/ax25call.h b/include/net/ax25call.h new file mode 100644 index 000000000..68b8a70c0 --- /dev/null +++ b/include/net/ax25call.h @@ -0,0 +1,2 @@ +/* Separate to keep compilation of protocols.c simpler */ +extern void ax25_proto_init(struct net_proto *pro); diff --git a/include/net/ax25dev.h b/include/net/ax25dev.h new file mode 100644 index 000000000..f2e125e6b --- /dev/null +++ b/include/net/ax25dev.h @@ -0,0 +1,164 @@ +/* + * include/net/ax25dev.h + * + * intra-kernel interface declaration, anything needed by device drivers for + * AX.25 interfaces is defined here. + * + */ + +#ifndef _NET_AX25DEV_H +#define _NET_AX25DEV_H + +#include <linux/netdevice.h> +#include <linux/sysctl.h> +#include <linux/tqueue.h> +#include <linux/timer.h> + +#ifndef AX25_TICS +#define AX25_TICS (HZ/10) +#endif + +#define AX25_MAX_DEVICES 20 /* Max No of AX.25 devices */ +#define AX25_DEV_MAGIC 0x88babe73 + +enum { + AX25_VALUES_IPDEFMODE, /* 0=DG 1=VC */ + AX25_VALUES_AXDEFMODE, /* 0=Normal 1=Extended Seq Nos */ + AX25_VALUES_BACKOFF, /* 0=None 1=Linear 2=Exponential */ + AX25_VALUES_CONMODE, /* Allow connected modes - 0=No 1=no "PID text" 2=all PIDs */ + AX25_VALUES_WINDOW, /* Default window size for standard AX.25 */ + AX25_VALUES_EWINDOW, /* Default window size for extended AX.25 */ + AX25_VALUES_T1, /* Default T1 timeout value */ + AX25_VALUES_T2, /* Default T2 timeout value */ + AX25_VALUES_T3, /* Default T3 timeout value */ + AX25_VALUES_IDLE, /* Connected mode idle timer */ + AX25_VALUES_N2, /* Default N2 value */ + AX25_VALUES_PACLEN, /* AX.25 MTU */ + AX25_VALUES_PROTOCOL, /* What is this? */ + AX25_VALUES_DAMA_SLAVE_TIMEOUT, /* DAMA */ + AX25_VALUES_MEDIA_DUPLEX, /* Duplex type */ + AX25_VALUES_MEDIA_TXDELAY, /* TX-Delay */ + AX25_VALUES_MEDIA_TXTAIL, /* TX-Tail */ + AX25_VALUES_MEDIA_TXBITRATE, /* TX-Bitrate */ + AX25_VALUES_MEDIA_RXBITRATE, /* RX-Bitrate */ + AX25_VALUES_MEDIA_SLOTTIME, /* Slottime */ + AX25_VALUES_MEDIA_PPERSISTENCE, /* P-Persistence */ + AX25_VALUES_MEDIA_AUTO_ADJUST, /* Enable/disable auto adjustment */ + AX25_VALUES_DUMMY_0, /* For future use */ + AX25_VALUES_DUMMY_1, /* For future use */ + AX25_VALUES_DUMMY_2, /* For future use */ + AX25_VALUES_DUMMY_3, /* For future use */ + AX25_VALUES_DUMMY_4, /* For future use */ + AX25_VALUES_DUMMY_5, /* For future use */ + AX25_VALUES_DUMMY_6, /* For future use */ + AX25_VALUES_DUMMY_7, /* For future use */ + AX25_MAX_VALUES /* THIS MUST REMAIN THE LAST ENTRY OF THIS LIST */ +}; + +#define AX25_DEF_IPDEFMODE 1 /* VC */ +#define AX25_DEF_AXDEFMODE 0 /* Normal */ +#define AX25_DEF_BACKOFF 1 /* Linear backoff */ +#define AX25_DEF_CONMODE 2 /* Connected mode allowed */ +#define AX25_DEF_WINDOW 7 /* Window=7 */ +#define AX25_DEF_EWINDOW 32 /* Module-128 Window=32 */ +#define AX25_DEF_T1 (10 * AX25_SLOWHZ) /* T1=10s */ +#define AX25_DEF_T2 (3 * AX25_SLOWHZ) /* T2=3s */ +#define AX25_DEF_T3 (90 * AX25_SLOWHZ) /* T3=90s */ +#define AX25_DEF_N2 10 /* N2=10 */ +#define AX25_DEF_IDLE (120 * AX25_SLOWHZ) /* Idle=120s */ +#define AX25_DEF_PACLEN 256 /* Paclen=256 */ +#define AX25_DEF_PROTOCOL 1 /* 0=CSMA; 1=CSMA/DAMA slave auto; 2=DAMA master */ +#define AX25_DEF_DAMA_SLAVE_TIMEOUT 0 /* ? */ +#define AX25_DEF_MEDIA_DUPLEX 0 /* Half duplex */ +#define AX25_DEF_MEDIA_TXDELAY 60 /* 60 ms */ +#define AX25_DEF_MEDIA_TXTAIL 10 /* 10 ms */ +#define AX25_DEF_MEDIA_TXBITRATE 9600 /* 9600 bps */ +#define AX25_DEF_MEDIA_RXBITRATE 9600 /* 9600 bps */ +#define AX25_DEF_MEDIA_SLOTTIME 10 /* 10 ms */ +#define AX25_DEF_MEDIA_PPERSISTENCE 32 /* 32/256 */ +#define AX25_DEF_MEDIA_AUTO_ADJUST 1 /* Auto adjust on */ + +struct ax25_dev { + unsigned long magic; + struct net_device *netdev; /* backlink to the network device */ + struct net_device *forward; + struct timer_list timer; + struct timer_list tics; + struct tq_struct task_queue; + struct sk_buff_head unproto_queue; + int needs_transmit; + unsigned int dama_mode; + struct { + struct ax25_cb *ready; + struct ax25_cb *all; + } list; + + struct { + unsigned char fast; /* + * set for "infinitely" + * fast channels to skip + * arbitration + */ + + /* downcalls */ + unsigned int (*dcd)(struct net_device *dev); /* required: report dcd state */ + unsigned int (*ptt)(struct net_device *dev); /* required: report ptt state */ + unsigned int (*cts)(struct net_device *dev); /* optional: report "clear to send" */ + void (*rts)(struct net_device *dev); /* optional: forced "key transmitter" */ + void (*parameter_change_notify)( /* configure media parameter */ + struct net_device *dev, + int id, /* parameter type */ + int old, /* old value */ + int new); /* new value */ + } hw; + + struct ctl_table systable[AX25_MAX_VALUES+1]; + int values[AX25_MAX_VALUES]; + + /* handled by DDI layer */ + unsigned int bit_per_jiffie; /* internal use */ + unsigned int jiffies_per_slot; /* internal use */ + unsigned char dcd_memory; /* internal use */ + unsigned char dcd_dropped; /* internal use */ + unsigned char dama_polled; /* internal use */ + unsigned int bytes_sent; + unsigned int max_bytes; + + /* statistics */ + unsigned long tx_iframes; + unsigned long rx_iframes; + unsigned long tx_bytes; + unsigned long rx_bytes; + unsigned long rx_rejects; + + rwlock_t ready_lock; +}; + +#define DAMA_SLAVE (1<<0) +#define DAMA_MASTER (1<<1) + +#define AX25_PTR(dev) ((struct ax25_dev *)dev->ax25_ptr) + +extern void register_ax25device(struct net_device *dev); +extern void unregister_ax25device(struct net_device *dev); + + +/* + * Call this function from device driver code for reading a parameter + */ +extern inline int ax25_dev_get_value(struct net_device *dev, int valueno) +{ + struct ax25_dev *ax25_device = AX25_PTR(dev); + return ax25_device->values[valueno]; +} + +/* + * Call this function from device driver code for writing a parameter + */ +extern inline void ax25_dev_set_value(struct net_device *dev, int valueno, int newvalue) +{ + struct ax25_dev *ax25_device = AX25_PTR(dev); + ax25_device->values[valueno] = newvalue; +} + +#endif /* _NET_AX25DEV_H */ diff --git a/include/net/netrom.h b/include/net/netrom.h index 21c9f8b86..b6ccf33a9 100644 --- a/include/net/netrom.h +++ b/include/net/netrom.h @@ -76,8 +76,7 @@ typedef struct { struct nr_neigh { struct nr_neigh *next; - ax25_address callsign; - ax25_digi *digipeat; + ax25_addr_t addr; ax25_cb *ax25; struct net_device *dev; unsigned char quality; diff --git a/include/net/rose.h b/include/net/rose.h index f1f893e27..167e629b9 100644 --- a/include/net/rose.h +++ b/include/net/rose.h @@ -81,8 +81,7 @@ enum { struct rose_neigh { struct rose_neigh *next; - ax25_address callsign; - ax25_digi *digipeat; + ax25_addr_t addr; ax25_cb *ax25; struct net_device *dev; unsigned short count; |