amd64_edac: cleanup DRAM cfg low debug output
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / net / netrom.h
blob15696b1fd30fbe85c248ad95fba4a4e7db4f4454
1 /*
2 * Declarations of NET/ROM type objects.
4 * Jonathan Naylor G4KLX 9/4/95
5 */
7 #ifndef _NETROM_H
8 #define _NETROM_H
10 #include <linux/netrom.h>
11 #include <linux/list.h>
12 #include <net/sock.h>
14 #define NR_NETWORK_LEN 15
15 #define NR_TRANSPORT_LEN 5
17 #define NR_PROTO_IP 0x0C
19 #define NR_PROTOEXT 0x00
20 #define NR_CONNREQ 0x01
21 #define NR_CONNACK 0x02
22 #define NR_DISCREQ 0x03
23 #define NR_DISCACK 0x04
24 #define NR_INFO 0x05
25 #define NR_INFOACK 0x06
26 #define NR_RESET 0x07
28 #define NR_CHOKE_FLAG 0x80
29 #define NR_NAK_FLAG 0x40
30 #define NR_MORE_FLAG 0x20
32 /* Define Link State constants. */
33 enum {
34 NR_STATE_0,
35 NR_STATE_1,
36 NR_STATE_2,
37 NR_STATE_3
40 #define NR_COND_ACK_PENDING 0x01
41 #define NR_COND_REJECT 0x02
42 #define NR_COND_PEER_RX_BUSY 0x04
43 #define NR_COND_OWN_RX_BUSY 0x08
45 #define NR_DEFAULT_T1 120000 /* Outstanding frames - 120 seconds */
46 #define NR_DEFAULT_T2 5000 /* Response delay - 5 seconds */
47 #define NR_DEFAULT_N2 3 /* Number of Retries - 3 */
48 #define NR_DEFAULT_T4 180000 /* Busy Delay - 180 seconds */
49 #define NR_DEFAULT_IDLE 0 /* No Activity Timeout - none */
50 #define NR_DEFAULT_WINDOW 4 /* Default Window Size - 4 */
51 #define NR_DEFAULT_OBS 6 /* Default Obsolescence Count - 6 */
52 #define NR_DEFAULT_QUAL 10 /* Default Neighbour Quality - 10 */
53 #define NR_DEFAULT_TTL 16 /* Default Time To Live - 16 */
54 #define NR_DEFAULT_ROUTING 1 /* Is routing enabled ? */
55 #define NR_DEFAULT_FAILS 2 /* Link fails until route fails */
56 #define NR_DEFAULT_RESET 0 /* Sent / accept reset cmds? */
58 #define NR_MODULUS 256
59 #define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */
60 #define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */
62 struct nr_sock {
63 struct sock sock;
64 ax25_address user_addr, source_addr, dest_addr;
65 struct net_device *device;
66 unsigned char my_index, my_id;
67 unsigned char your_index, your_id;
68 unsigned char state, condition, bpqext, window;
69 unsigned short vs, vr, va, vl;
70 unsigned char n2, n2count;
71 unsigned long t1, t2, t4, idle;
72 unsigned short fraglen;
73 struct timer_list t1timer;
74 struct timer_list t2timer;
75 struct timer_list t4timer;
76 struct timer_list idletimer;
77 struct sk_buff_head ack_queue;
78 struct sk_buff_head reseq_queue;
79 struct sk_buff_head frag_queue;
82 #define nr_sk(sk) ((struct nr_sock *)(sk))
84 struct nr_neigh {
85 struct hlist_node neigh_node;
86 ax25_address callsign;
87 ax25_digi *digipeat;
88 ax25_cb *ax25;
89 struct net_device *dev;
90 unsigned char quality;
91 unsigned char locked;
92 unsigned short count;
93 unsigned int number;
94 unsigned char failed;
95 atomic_t refcount;
98 struct nr_route {
99 unsigned char quality;
100 unsigned char obs_count;
101 struct nr_neigh *neighbour;
104 struct nr_node {
105 struct hlist_node node_node;
106 ax25_address callsign;
107 char mnemonic[7];
108 unsigned char which;
109 unsigned char count;
110 struct nr_route routes[3];
111 atomic_t refcount;
112 spinlock_t node_lock;
115 /*********************************************************************
116 * nr_node & nr_neigh lists, refcounting and locking
117 *********************************************************************/
119 #define nr_node_hold(__nr_node) \
120 atomic_inc(&((__nr_node)->refcount))
122 static __inline__ void nr_node_put(struct nr_node *nr_node)
124 if (atomic_dec_and_test(&nr_node->refcount)) {
125 kfree(nr_node);
129 #define nr_neigh_hold(__nr_neigh) \
130 atomic_inc(&((__nr_neigh)->refcount))
132 static __inline__ void nr_neigh_put(struct nr_neigh *nr_neigh)
134 if (atomic_dec_and_test(&nr_neigh->refcount)) {
135 kfree(nr_neigh->digipeat);
136 kfree(nr_neigh);
140 /* nr_node_lock and nr_node_unlock also hold/put the node's refcounter.
142 static __inline__ void nr_node_lock(struct nr_node *nr_node)
144 nr_node_hold(nr_node);
145 spin_lock_bh(&nr_node->node_lock);
148 static __inline__ void nr_node_unlock(struct nr_node *nr_node)
150 spin_unlock_bh(&nr_node->node_lock);
151 nr_node_put(nr_node);
154 #define nr_neigh_for_each(__nr_neigh, node, list) \
155 hlist_for_each_entry(__nr_neigh, node, list, neigh_node)
157 #define nr_neigh_for_each_safe(__nr_neigh, node, node2, list) \
158 hlist_for_each_entry_safe(__nr_neigh, node, node2, list, neigh_node)
160 #define nr_node_for_each(__nr_node, node, list) \
161 hlist_for_each_entry(__nr_node, node, list, node_node)
163 #define nr_node_for_each_safe(__nr_node, node, node2, list) \
164 hlist_for_each_entry_safe(__nr_node, node, node2, list, node_node)
167 /*********************************************************************/
169 /* af_netrom.c */
170 extern int sysctl_netrom_default_path_quality;
171 extern int sysctl_netrom_obsolescence_count_initialiser;
172 extern int sysctl_netrom_network_ttl_initialiser;
173 extern int sysctl_netrom_transport_timeout;
174 extern int sysctl_netrom_transport_maximum_tries;
175 extern int sysctl_netrom_transport_acknowledge_delay;
176 extern int sysctl_netrom_transport_busy_delay;
177 extern int sysctl_netrom_transport_requested_window_size;
178 extern int sysctl_netrom_transport_no_activity_timeout;
179 extern int sysctl_netrom_routing_control;
180 extern int sysctl_netrom_link_fails_count;
181 extern int sysctl_netrom_reset_circuit;
183 extern int nr_rx_frame(struct sk_buff *, struct net_device *);
184 extern void nr_destroy_socket(struct sock *);
186 /* nr_dev.c */
187 extern int nr_rx_ip(struct sk_buff *, struct net_device *);
188 extern void nr_setup(struct net_device *);
190 /* nr_in.c */
191 extern int nr_process_rx_frame(struct sock *, struct sk_buff *);
193 /* nr_loopback.c */
194 extern void nr_loopback_init(void);
195 extern void nr_loopback_clear(void);
196 extern int nr_loopback_queue(struct sk_buff *);
198 /* nr_out.c */
199 extern void nr_output(struct sock *, struct sk_buff *);
200 extern void nr_send_nak_frame(struct sock *);
201 extern void nr_kick(struct sock *);
202 extern void nr_transmit_buffer(struct sock *, struct sk_buff *);
203 extern void nr_establish_data_link(struct sock *);
204 extern void nr_enquiry_response(struct sock *);
205 extern void nr_check_iframes_acked(struct sock *, unsigned short);
207 /* nr_route.c */
208 extern void nr_rt_device_down(struct net_device *);
209 extern struct net_device *nr_dev_first(void);
210 extern struct net_device *nr_dev_get(ax25_address *);
211 extern int nr_rt_ioctl(unsigned int, void __user *);
212 extern void nr_link_failed(ax25_cb *, int);
213 extern int nr_route_frame(struct sk_buff *, ax25_cb *);
214 extern const struct file_operations nr_nodes_fops;
215 extern const struct file_operations nr_neigh_fops;
216 extern void nr_rt_free(void);
218 /* nr_subr.c */
219 extern void nr_clear_queues(struct sock *);
220 extern void nr_frames_acked(struct sock *, unsigned short);
221 extern void nr_requeue_frames(struct sock *);
222 extern int nr_validate_nr(struct sock *, unsigned short);
223 extern int nr_in_rx_window(struct sock *, unsigned short);
224 extern void nr_write_internal(struct sock *, int);
226 extern void __nr_transmit_reply(struct sk_buff *skb, int mine,
227 unsigned char cmdflags);
230 * This routine is called when a Connect Acknowledge with the Choke Flag
231 * set is needed to refuse a connection.
233 #define nr_transmit_refusal(skb, mine) \
234 do { \
235 __nr_transmit_reply((skb), (mine), NR_CONNACK | NR_CHOKE_FLAG); \
236 } while (0)
239 * This routine is called when we don't have a circuit matching an incoming
240 * NET/ROM packet. This is an G8PZT Xrouter extension.
242 #define nr_transmit_reset(skb, mine) \
243 do { \
244 __nr_transmit_reply((skb), (mine), NR_RESET); \
245 } while (0)
247 extern void nr_disconnect(struct sock *, int);
249 /* nr_timer.c */
250 extern void nr_init_timers(struct sock *sk);
251 extern void nr_start_heartbeat(struct sock *);
252 extern void nr_start_t1timer(struct sock *);
253 extern void nr_start_t2timer(struct sock *);
254 extern void nr_start_t4timer(struct sock *);
255 extern void nr_start_idletimer(struct sock *);
256 extern void nr_stop_heartbeat(struct sock *);
257 extern void nr_stop_t1timer(struct sock *);
258 extern void nr_stop_t2timer(struct sock *);
259 extern void nr_stop_t4timer(struct sock *);
260 extern void nr_stop_idletimer(struct sock *);
261 extern int nr_t1timer_running(struct sock *);
263 /* sysctl_net_netrom.c */
264 extern void nr_register_sysctl(void);
265 extern void nr_unregister_sysctl(void);
267 #endif