6 #include <asm/byteorder.h>
8 #define dn_ntohs(x) le16_to_cpu(x)
9 #define dn_htons(x) cpu_to_le16(x)
11 struct dn_scp
/* Session Control Port */
14 #define DN_O 1 /* Open */
15 #define DN_CR 2 /* Connect Receive */
16 #define DN_DR 3 /* Disconnect Reject */
17 #define DN_DRC 4 /* Discon. Rej. Complete*/
18 #define DN_CC 5 /* Connect Confirm */
19 #define DN_CI 6 /* Connect Initiate */
20 #define DN_NR 7 /* No resources */
21 #define DN_NC 8 /* No communication */
22 #define DN_CD 9 /* Connect Delivery */
23 #define DN_RJ 10 /* Rejected */
24 #define DN_RUN 11 /* Running */
25 #define DN_DI 12 /* Disconnect Initiate */
26 #define DN_DIC 13 /* Disconnect Complete */
27 #define DN_DN 14 /* Disconnect Notificat */
28 #define DN_CL 15 /* Closed */
29 #define DN_CN 16 /* Closed Notification */
61 unsigned long seg_total
; /* Running total of current segment */
63 struct optdata_dn conndata_in
;
64 struct optdata_dn conndata_out
;
65 struct optdata_dn discdata_in
;
66 struct optdata_dn discdata_out
;
67 struct accessdata_dn accessdata
;
69 struct sockaddr_dn addr
; /* Local address */
70 struct sockaddr_dn peer
; /* Remote address */
73 * In this case the RTT estimation is not specified in the
74 * docs, nor is any back off algorithm. Here we follow well
75 * known tcp algorithms with a few small variations.
77 * snd_window: Max number of packets we send before we wait for
78 * an ack to come back. This will become part of a
79 * more complicated scheme when we support flow
82 * nsp_srtt: Round-Trip-Time (x8) in jiffies. This is a rolling
84 * nsp_rttvar: Round-Trip-Time-Varience (x4) in jiffies. This is the
85 * varience of the smoothed average (but calculated in
86 * a simpler way than for normal statistical varience
89 * nsp_rxtshift: Backoff counter. Value is zero normally, each time
90 * a packet is lost is increases by one until an ack
91 * is received. Its used to index an array of backoff
94 #define NSP_MIN_WINDOW 1
95 #define NSP_MAX_WINDOW (0x07fe)
96 unsigned long max_window
;
97 unsigned long snd_window
;
98 #define NSP_INITIAL_SRTT (HZ)
99 unsigned long nsp_srtt
;
100 #define NSP_INITIAL_RTTVAR (HZ*3)
101 unsigned long nsp_rttvar
;
102 #define NSP_MAXRXTSHIFT 12
103 unsigned long nsp_rxtshift
;
106 * Output queues, one for data, one for otherdata/linkservice
108 struct sk_buff_head data_xmit_queue
;
109 struct sk_buff_head other_xmit_queue
;
112 * Input queue for other data
114 struct sk_buff_head other_receive_queue
;
118 * Stuff to do with the slow timer
120 unsigned long stamp
; /* time of last transmit */
121 unsigned long persist
;
122 int (*persist_fxn
)(struct sock
*sk
);
123 unsigned long keepalive
;
124 void (*keepalive_fxn
)(struct sock
*sk
);
127 * This stuff is for the fast timer for delayed acks
129 struct timer_list delack_timer
;
131 void (*delack_fxn
)(struct sock
*sk
);
135 static inline struct dn_scp
*DN_SK(struct sock
*sk
)
137 return (struct dn_scp
*)(sk
+ 1);
141 * src,dst : Source and Destination DECnet addresses
142 * hops : Number of hops through the network
143 * dst_port, src_port : NSP port numbers
144 * services, info : Useful data extracted from conninit messages
145 * rt_flags : Routing flags byte
146 * nsp_flags : NSP layer flags byte
147 * segsize : Size of segment
148 * segnum : Number, for data, otherdata and linkservice
149 * xmit_count : Number of times we've transmitted this skb
150 * stamp : Time stamp of most recent transmission, used in RTT calculations
151 * iif: Input interface number
153 * As a general policy, this structure keeps all addresses in network
154 * byte order, and all else in host byte order. Thus dst, src, dst_port
155 * and src_port are in network order. All else is in host order.
158 #define DN_SKB_CB(skb) ((struct dn_skb_cb *)(skb)->cb)
176 static inline __le16
dn_eth2dn(unsigned char *ethaddr
)
178 return dn_htons(ethaddr
[4] | (ethaddr
[5] << 8));
181 static inline __le16
dn_saddr2dn(struct sockaddr_dn
*saddr
)
183 return *(__le16
*)saddr
->sdn_nodeaddr
;
186 static inline void dn_dn2eth(unsigned char *ethaddr
, __le16 addr
)
188 __u16 a
= dn_ntohs(addr
);
193 ethaddr
[4] = (__u8
)(a
& 0xff);
194 ethaddr
[5] = (__u8
)(a
>> 8);
197 static inline void dn_sk_ports_copy(struct flowi
*fl
, struct dn_scp
*scp
)
199 fl
->uli_u
.dnports
.sport
= scp
->addrloc
;
200 fl
->uli_u
.dnports
.dport
= scp
->addrrem
;
203 extern unsigned dn_mss_from_pmtu(struct net_device
*dev
, int mtu
);
205 #define DN_MENUVER_ACC 0x01
206 #define DN_MENUVER_USR 0x02
207 #define DN_MENUVER_PRX 0x04
208 #define DN_MENUVER_UIC 0x08
210 extern struct sock
*dn_sklist_find_listener(struct sockaddr_dn
*addr
);
211 extern struct sock
*dn_find_by_skb(struct sk_buff
*skb
);
212 #define DN_ASCBUF_LEN 9
213 extern char *dn_addr2asc(__u16
, char *);
214 extern int dn_destroy_timer(struct sock
*sk
);
216 extern int dn_sockaddr2username(struct sockaddr_dn
*addr
, unsigned char *buf
, unsigned char type
);
217 extern int dn_username2sockaddr(unsigned char *data
, int len
, struct sockaddr_dn
*addr
, unsigned char *type
);
219 extern void dn_start_slow_timer(struct sock
*sk
);
220 extern void dn_stop_slow_timer(struct sock
*sk
);
222 extern __le16 decnet_address
;
223 extern int decnet_debug_level
;
224 extern int decnet_time_wait
;
225 extern int decnet_dn_count
;
226 extern int decnet_di_count
;
227 extern int decnet_dr_count
;
228 extern int decnet_no_fc_max_cwnd
;
230 extern int sysctl_decnet_mem
[3];
231 extern int sysctl_decnet_wmem
[3];
232 extern int sysctl_decnet_rmem
[3];
234 #endif /* _NET_DN_H */