summaryrefslogtreecommitdiffstats
path: root/include/net/ax25dev.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/ax25dev.h')
-rw-r--r--include/net/ax25dev.h164
1 files changed, 164 insertions, 0 deletions
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 */