7 #include <asm/byteorder.h>
9 typedef unsigned short dn_address
;
11 #define dn_ntohs(x) le16_to_cpu((unsigned short)(x))
12 #define dn_htons(x) cpu_to_le16((unsigned short)(x))
14 struct dn_scp
/* Session Control Port */
17 #define DN_O 1 /* Open */
18 #define DN_CR 2 /* Connect Receive */
19 #define DN_DR 3 /* Disconnect Reject */
20 #define DN_DRC 4 /* Discon. Rej. Complete*/
21 #define DN_CC 5 /* Connect Confirm */
22 #define DN_CI 6 /* Connect Initiate */
23 #define DN_NR 7 /* No resources */
24 #define DN_NC 8 /* No communication */
25 #define DN_CD 9 /* Connect Delivery */
26 #define DN_RJ 10 /* Rejected */
27 #define DN_RUN 11 /* Running */
28 #define DN_DI 12 /* Disconnect Initiate */
29 #define DN_DIC 13 /* Disconnect Complete */
30 #define DN_DN 14 /* Disconnect Notificat */
31 #define DN_CL 15 /* Closed */
32 #define DN_CN 16 /* Closed Notification */
34 unsigned short addrloc
;
35 unsigned short addrrem
;
36 unsigned short numdat
;
37 unsigned short numoth
;
38 unsigned short numoth_rcv
;
39 unsigned short numdat_rcv
;
40 unsigned short ackxmt_dat
;
41 unsigned short ackxmt_oth
;
42 unsigned short ackrcv_dat
;
43 unsigned short ackrcv_oth
;
44 unsigned char flowrem_sw
;
45 unsigned char flowloc_sw
;
49 unsigned short flowrem_dat
;
50 unsigned short flowrem_oth
;
51 unsigned short flowloc_dat
;
52 unsigned short flowloc_oth
;
53 unsigned char services_rem
;
54 unsigned char services_loc
;
55 unsigned char info_rem
;
56 unsigned char info_loc
;
58 unsigned short segsize_rem
;
59 unsigned short segsize_loc
;
61 unsigned char nonagle
;
62 unsigned char multi_ireq
;
63 unsigned char accept_mode
;
64 unsigned long seg_total
; /* Running total of current segment */
66 struct optdata_dn conndata_in
;
67 struct optdata_dn conndata_out
;
68 struct optdata_dn discdata_in
;
69 struct optdata_dn discdata_out
;
70 struct accessdata_dn accessdata
;
72 struct sockaddr_dn addr
; /* Local address */
73 struct sockaddr_dn peer
; /* Remote address */
76 * In this case the RTT estimation is not specified in the
77 * docs, nor is any back off algorithm. Here we follow well
78 * known tcp algorithms with a few small variations.
80 * snd_window: Max number of packets we send before we wait for
81 * an ack to come back. This will become part of a
82 * more complicated scheme when we support flow
85 * nsp_srtt: Round-Trip-Time (x8) in jiffies. This is a rolling
87 * nsp_rttvar: Round-Trip-Time-Varience (x4) in jiffies. This is the
88 * varience of the smoothed average (but calculated in
89 * a simpler way than for normal statistical varience
92 * nsp_rxtshift: Backoff counter. Value is zero normally, each time
93 * a packet is lost is increases by one until an ack
94 * is received. Its used to index an array of backoff
97 #define NSP_MIN_WINDOW 1
98 #define NSP_MAX_WINDOW (0x07fe)
99 unsigned long max_window
;
100 unsigned long snd_window
;
101 #define NSP_INITIAL_SRTT (HZ)
102 unsigned long nsp_srtt
;
103 #define NSP_INITIAL_RTTVAR (HZ*3)
104 unsigned long nsp_rttvar
;
105 #define NSP_MAXRXTSHIFT 12
106 unsigned long nsp_rxtshift
;
109 * Output queues, one for data, one for otherdata/linkservice
111 struct sk_buff_head data_xmit_queue
;
112 struct sk_buff_head other_xmit_queue
;
115 * Input queue for other data
117 struct sk_buff_head other_receive_queue
;
121 * Stuff to do with the slow timer
123 unsigned long stamp
; /* time of last transmit */
124 unsigned long persist
;
125 int (*persist_fxn
)(struct sock
*sk
);
126 unsigned long keepalive
;
127 void (*keepalive_fxn
)(struct sock
*sk
);
130 * This stuff is for the fast timer for delayed acks
132 struct timer_list delack_timer
;
134 void (*delack_fxn
)(struct sock
*sk
);
138 static inline struct dn_scp
*DN_SK(struct sock
*sk
)
140 return (struct dn_scp
*)(sk
+ 1);
144 * src,dst : Source and Destination DECnet addresses
145 * hops : Number of hops through the network
146 * dst_port, src_port : NSP port numbers
147 * services, info : Useful data extracted from conninit messages
148 * rt_flags : Routing flags byte
149 * nsp_flags : NSP layer flags byte
150 * segsize : Size of segment
151 * segnum : Number, for data, otherdata and linkservice
152 * xmit_count : Number of times we've transmitted this skb
153 * stamp : Time stamp of most recent transmission, used in RTT calculations
154 * iif: Input interface number
156 * As a general policy, this structure keeps all addresses in network
157 * byte order, and all else in host byte order. Thus dst, src, dst_port
158 * and src_port are in network order. All else is in host order.
161 #define DN_SKB_CB(skb) ((struct dn_skb_cb *)(skb)->cb)
166 unsigned short dst_port
;
167 unsigned short src_port
;
168 unsigned char services
;
170 unsigned char rt_flags
;
171 unsigned char nsp_flags
;
172 unsigned short segsize
;
173 unsigned short segnum
;
174 unsigned short xmit_count
;
179 static inline dn_address
dn_eth2dn(unsigned char *ethaddr
)
181 return ethaddr
[4] | (ethaddr
[5] << 8);
184 static inline dn_address
dn_saddr2dn(struct sockaddr_dn
*saddr
)
186 return *(dn_address
*)saddr
->sdn_nodeaddr
;
189 static inline void dn_dn2eth(unsigned char *ethaddr
, dn_address addr
)
195 ethaddr
[4] = (unsigned char)(addr
& 0xff);
196 ethaddr
[5] = (unsigned char)(addr
>> 8);
199 static inline void dn_sk_ports_copy(struct flowi
*fl
, struct dn_scp
*scp
)
201 fl
->uli_u
.dnports
.sport
= scp
->addrloc
;
202 fl
->uli_u
.dnports
.dport
= scp
->addrrem
;
203 fl
->uli_u
.dnports
.objnum
= scp
->addr
.sdn_objnum
;
204 if (fl
->uli_u
.dnports
.objnum
== 0) {
205 fl
->uli_u
.dnports
.objnamel
= scp
->addr
.sdn_objnamel
;
206 memcpy(fl
->uli_u
.dnports
.objname
, scp
->addr
.sdn_objname
, 16);
210 extern unsigned dn_mss_from_pmtu(struct net_device
*dev
, int mtu
);
212 #define DN_MENUVER_ACC 0x01
213 #define DN_MENUVER_USR 0x02
214 #define DN_MENUVER_PRX 0x04
215 #define DN_MENUVER_UIC 0x08
217 extern struct sock
*dn_sklist_find_listener(struct sockaddr_dn
*addr
);
218 extern struct sock
*dn_find_by_skb(struct sk_buff
*skb
);
219 #define DN_ASCBUF_LEN 9
220 extern char *dn_addr2asc(dn_address
, char *);
221 extern int dn_destroy_timer(struct sock
*sk
);
223 extern int dn_sockaddr2username(struct sockaddr_dn
*addr
, unsigned char *buf
, unsigned char type
);
224 extern int dn_username2sockaddr(unsigned char *data
, int len
, struct sockaddr_dn
*addr
, unsigned char *type
);
226 extern void dn_start_slow_timer(struct sock
*sk
);
227 extern void dn_stop_slow_timer(struct sock
*sk
);
229 extern dn_address decnet_address
;
230 extern int decnet_debug_level
;
231 extern int decnet_time_wait
;
232 extern int decnet_dn_count
;
233 extern int decnet_di_count
;
234 extern int decnet_dr_count
;
235 extern int decnet_no_fc_max_cwnd
;
237 #endif /* _NET_DN_H */