aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ax25.h2
-rw-r--r--include/net/ieee80211.h856
-rw-r--r--include/net/ip6_fib.h9
-rw-r--r--include/net/ip6_route.h9
-rw-r--r--include/net/ip_fib.h14
-rw-r--r--include/net/ipv6.h1
-rw-r--r--include/net/route.h2
-rw-r--r--include/net/sctp/command.h8
-rw-r--r--include/net/sctp/constants.h25
-rw-r--r--include/net/sctp/sctp.h17
-rw-r--r--include/net/sctp/sm.h6
-rw-r--r--include/net/sctp/structs.h45
-rw-r--r--include/net/sctp/user.h3
-rw-r--r--include/net/snmp.h14
-rw-r--r--include/net/tcp.h239
-rw-r--r--include/net/x25.h9
-rw-r--r--include/net/xfrm.h4
17 files changed, 1041 insertions, 222 deletions
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 9e6368a54547..828a3a93dda1 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -220,7 +220,7 @@ static __inline__ void ax25_cb_put(ax25_cb *ax25)
220 } 220 }
221} 221}
222 222
223static inline unsigned short ax25_type_trans(struct sk_buff *skb, struct net_device *dev) 223static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev)
224{ 224{
225 skb->dev = dev; 225 skb->dev = dev;
226 skb->pkt_type = PACKET_HOST; 226 skb->pkt_type = PACKET_HOST;
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
new file mode 100644
index 000000000000..db09580ad14b
--- /dev/null
+++ b/include/net/ieee80211.h
@@ -0,0 +1,856 @@
1/*
2 * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11
3 * remains copyright by the original authors
4 *
5 * Portions of the merged code are based on Host AP (software wireless
6 * LAN access point) driver for Intersil Prism2/2.5/3.
7 *
8 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
9 * <jkmaline@cc.hut.fi>
10 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
11 *
12 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
13 * <jketreno@linux.intel.com>
14 * Copyright (c) 2004, Intel Corporation
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation. See README and COPYING for
19 * more details.
20 */
21#ifndef IEEE80211_H
22#define IEEE80211_H
23
24#include <linux/if_ether.h> /* ETH_ALEN */
25#include <linux/kernel.h> /* ARRAY_SIZE */
26
27#if WIRELESS_EXT < 17
28#define IW_QUAL_QUAL_INVALID 0x10
29#define IW_QUAL_LEVEL_INVALID 0x20
30#define IW_QUAL_NOISE_INVALID 0x40
31#define IW_QUAL_QUAL_UPDATED 0x1
32#define IW_QUAL_LEVEL_UPDATED 0x2
33#define IW_QUAL_NOISE_UPDATED 0x4
34#endif
35
36#define IEEE80211_DATA_LEN 2304
37/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
38 6.2.1.1.2.
39
40 The figure in section 7.1.2 suggests a body size of up to 2312
41 bytes is allowed, which is a bit confusing, I suspect this
42 represents the 2304 bytes of real data, plus a possible 8 bytes of
43 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
44
45
46#define IEEE80211_HLEN 30
47#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
48
49struct ieee80211_hdr {
50 u16 frame_ctl;
51 u16 duration_id;
52 u8 addr1[ETH_ALEN];
53 u8 addr2[ETH_ALEN];
54 u8 addr3[ETH_ALEN];
55 u16 seq_ctl;
56 u8 addr4[ETH_ALEN];
57} __attribute__ ((packed));
58
59struct ieee80211_hdr_3addr {
60 u16 frame_ctl;
61 u16 duration_id;
62 u8 addr1[ETH_ALEN];
63 u8 addr2[ETH_ALEN];
64 u8 addr3[ETH_ALEN];
65 u16 seq_ctl;
66} __attribute__ ((packed));
67
68enum eap_type {
69 EAP_PACKET = 0,
70 EAPOL_START,
71 EAPOL_LOGOFF,
72 EAPOL_KEY,
73 EAPOL_ENCAP_ASF_ALERT
74};
75
76static const char *eap_types[] = {
77 [EAP_PACKET] = "EAP-Packet",
78 [EAPOL_START] = "EAPOL-Start",
79 [EAPOL_LOGOFF] = "EAPOL-Logoff",
80 [EAPOL_KEY] = "EAPOL-Key",
81 [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert"
82};
83
84static inline const char *eap_get_type(int type)
85{
86 return (type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type];
87}
88
89struct eapol {
90 u8 snap[6];
91 u16 ethertype;
92 u8 version;
93 u8 type;
94 u16 length;
95} __attribute__ ((packed));
96
97#define IEEE80211_1ADDR_LEN 10
98#define IEEE80211_2ADDR_LEN 16
99#define IEEE80211_3ADDR_LEN 24
100#define IEEE80211_4ADDR_LEN 30
101#define IEEE80211_FCS_LEN 4
102
103#define MIN_FRAG_THRESHOLD 256U
104#define MAX_FRAG_THRESHOLD 2346U
105
106/* Frame control field constants */
107#define IEEE80211_FCTL_VERS 0x0002
108#define IEEE80211_FCTL_FTYPE 0x000c
109#define IEEE80211_FCTL_STYPE 0x00f0
110#define IEEE80211_FCTL_TODS 0x0100
111#define IEEE80211_FCTL_FROMDS 0x0200
112#define IEEE80211_FCTL_MOREFRAGS 0x0400
113#define IEEE80211_FCTL_RETRY 0x0800
114#define IEEE80211_FCTL_PM 0x1000
115#define IEEE80211_FCTL_MOREDATA 0x2000
116#define IEEE80211_FCTL_WEP 0x4000
117#define IEEE80211_FCTL_ORDER 0x8000
118
119#define IEEE80211_FTYPE_MGMT 0x0000
120#define IEEE80211_FTYPE_CTL 0x0004
121#define IEEE80211_FTYPE_DATA 0x0008
122
123/* management */
124#define IEEE80211_STYPE_ASSOC_REQ 0x0000
125#define IEEE80211_STYPE_ASSOC_RESP 0x0010
126#define IEEE80211_STYPE_REASSOC_REQ 0x0020
127#define IEEE80211_STYPE_REASSOC_RESP 0x0030
128#define IEEE80211_STYPE_PROBE_REQ 0x0040
129#define IEEE80211_STYPE_PROBE_RESP 0x0050
130#define IEEE80211_STYPE_BEACON 0x0080
131#define IEEE80211_STYPE_ATIM 0x0090
132#define IEEE80211_STYPE_DISASSOC 0x00A0
133#define IEEE80211_STYPE_AUTH 0x00B0
134#define IEEE80211_STYPE_DEAUTH 0x00C0
135
136/* control */
137#define IEEE80211_STYPE_PSPOLL 0x00A0
138#define IEEE80211_STYPE_RTS 0x00B0
139#define IEEE80211_STYPE_CTS 0x00C0
140#define IEEE80211_STYPE_ACK 0x00D0
141#define IEEE80211_STYPE_CFEND 0x00E0
142#define IEEE80211_STYPE_CFENDACK 0x00F0
143
144/* data */
145#define IEEE80211_STYPE_DATA 0x0000
146#define IEEE80211_STYPE_DATA_CFACK 0x0010
147#define IEEE80211_STYPE_DATA_CFPOLL 0x0020
148#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
149#define IEEE80211_STYPE_NULLFUNC 0x0040
150#define IEEE80211_STYPE_CFACK 0x0050
151#define IEEE80211_STYPE_CFPOLL 0x0060
152#define IEEE80211_STYPE_CFACKPOLL 0x0070
153
154#define IEEE80211_SCTL_FRAG 0x000F
155#define IEEE80211_SCTL_SEQ 0xFFF0
156
157
158/* debug macros */
159
160#ifdef CONFIG_IEEE80211_DEBUG
161extern u32 ieee80211_debug_level;
162#define IEEE80211_DEBUG(level, fmt, args...) \
163do { if (ieee80211_debug_level & (level)) \
164 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \
165 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0)
166#else
167#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
168#endif /* CONFIG_IEEE80211_DEBUG */
169
170/*
171 * To use the debug system;
172 *
173 * If you are defining a new debug classification, simply add it to the #define
174 * list here in the form of:
175 *
176 * #define IEEE80211_DL_xxxx VALUE
177 *
178 * shifting value to the left one bit from the previous entry. xxxx should be
179 * the name of the classification (for example, WEP)
180 *
181 * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your
182 * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want
183 * to send output to that classification.
184 *
185 * To add your debug level to the list of levels seen when you perform
186 *
187 * % cat /proc/net/ipw/debug_level
188 *
189 * you simply need to add your entry to the ipw_debug_levels array.
190 *
191 * If you do not see debug_level in /proc/net/ipw then you do not have
192 * CONFIG_IEEE80211_DEBUG defined in your kernel configuration
193 *
194 */
195
196#define IEEE80211_DL_INFO (1<<0)
197#define IEEE80211_DL_WX (1<<1)
198#define IEEE80211_DL_SCAN (1<<2)
199#define IEEE80211_DL_STATE (1<<3)
200#define IEEE80211_DL_MGMT (1<<4)
201#define IEEE80211_DL_FRAG (1<<5)
202#define IEEE80211_DL_EAP (1<<6)
203#define IEEE80211_DL_DROP (1<<7)
204
205#define IEEE80211_DL_TX (1<<8)
206#define IEEE80211_DL_RX (1<<9)
207
208#define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a)
209#define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a)
210#define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a)
211
212#define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a)
213#define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a)
214#define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a)
215#define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a)
216#define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a)
217#define IEEE80211_DEBUG_EAP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_EAP, f, ## a)
218#define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a)
219#define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a)
220#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)
221#include <linux/netdevice.h>
222#include <linux/wireless.h>
223#include <linux/if_arp.h> /* ARPHRD_ETHER */
224
225#ifndef WIRELESS_SPY
226#define WIRELESS_SPY // enable iwspy support
227#endif
228#include <net/iw_handler.h> // new driver API
229
230#ifndef ETH_P_PAE
231#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
232#endif /* ETH_P_PAE */
233
234#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
235
236#ifndef ETH_P_80211_RAW
237#define ETH_P_80211_RAW (ETH_P_ECONET + 1)
238#endif
239
240/* IEEE 802.11 defines */
241
242#define P80211_OUI_LEN 3
243
244struct ieee80211_snap_hdr {
245
246 u8 dsap; /* always 0xAA */
247 u8 ssap; /* always 0xAA */
248 u8 ctrl; /* always 0x03 */
249 u8 oui[P80211_OUI_LEN]; /* organizational universal id */
250
251} __attribute__ ((packed));
252
253#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
254
255#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
256#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
257
258#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
259#define WLAN_GET_SEQ_SEQ(seq) ((seq) & IEEE80211_SCTL_SEQ)
260
261/* Authentication algorithms */
262#define WLAN_AUTH_OPEN 0
263#define WLAN_AUTH_SHARED_KEY 1
264
265#define WLAN_AUTH_CHALLENGE_LEN 128
266
267#define WLAN_CAPABILITY_BSS (1<<0)
268#define WLAN_CAPABILITY_IBSS (1<<1)
269#define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
270#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
271#define WLAN_CAPABILITY_PRIVACY (1<<4)
272#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
273#define WLAN_CAPABILITY_PBCC (1<<6)
274#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
275
276/* Status codes */
277#define WLAN_STATUS_SUCCESS 0
278#define WLAN_STATUS_UNSPECIFIED_FAILURE 1
279#define WLAN_STATUS_CAPS_UNSUPPORTED 10
280#define WLAN_STATUS_REASSOC_NO_ASSOC 11
281#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
282#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
283#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
284#define WLAN_STATUS_CHALLENGE_FAIL 15
285#define WLAN_STATUS_AUTH_TIMEOUT 16
286#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
287#define WLAN_STATUS_ASSOC_DENIED_RATES 18
288/* 802.11b */
289#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
290#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
291#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
292
293/* Reason codes */
294#define WLAN_REASON_UNSPECIFIED 1
295#define WLAN_REASON_PREV_AUTH_NOT_VALID 2
296#define WLAN_REASON_DEAUTH_LEAVING 3
297#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
298#define WLAN_REASON_DISASSOC_AP_BUSY 5
299#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
300#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
301#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
302#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
303
304
305#define IEEE80211_STATMASK_SIGNAL (1<<0)
306#define IEEE80211_STATMASK_RSSI (1<<1)
307#define IEEE80211_STATMASK_NOISE (1<<2)
308#define IEEE80211_STATMASK_RATE (1<<3)
309#define IEEE80211_STATMASK_WEMASK 0x7
310
311
312#define IEEE80211_CCK_MODULATION (1<<0)
313#define IEEE80211_OFDM_MODULATION (1<<1)
314
315#define IEEE80211_24GHZ_BAND (1<<0)
316#define IEEE80211_52GHZ_BAND (1<<1)
317
318#define IEEE80211_CCK_RATE_1MB 0x02
319#define IEEE80211_CCK_RATE_2MB 0x04
320#define IEEE80211_CCK_RATE_5MB 0x0B
321#define IEEE80211_CCK_RATE_11MB 0x16
322#define IEEE80211_OFDM_RATE_6MB 0x0C
323#define IEEE80211_OFDM_RATE_9MB 0x12
324#define IEEE80211_OFDM_RATE_12MB 0x18
325#define IEEE80211_OFDM_RATE_18MB 0x24
326#define IEEE80211_OFDM_RATE_24MB 0x30
327#define IEEE80211_OFDM_RATE_36MB 0x48
328#define IEEE80211_OFDM_RATE_48MB 0x60
329#define IEEE80211_OFDM_RATE_54MB 0x6C
330#define IEEE80211_BASIC_RATE_MASK 0x80
331
332#define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
333#define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
334#define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
335#define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
336#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
337#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
338#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
339#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
340#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
341#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
342#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
343#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
344
345#define IEEE80211_CCK_RATES_MASK 0x0000000F
346#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
347 IEEE80211_CCK_RATE_2MB_MASK)
348#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
349 IEEE80211_CCK_RATE_5MB_MASK | \
350 IEEE80211_CCK_RATE_11MB_MASK)
351
352#define IEEE80211_OFDM_RATES_MASK 0x00000FF0
353#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
354 IEEE80211_OFDM_RATE_12MB_MASK | \
355 IEEE80211_OFDM_RATE_24MB_MASK)
356#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
357 IEEE80211_OFDM_RATE_9MB_MASK | \
358 IEEE80211_OFDM_RATE_18MB_MASK | \
359 IEEE80211_OFDM_RATE_36MB_MASK | \
360 IEEE80211_OFDM_RATE_48MB_MASK | \
361 IEEE80211_OFDM_RATE_54MB_MASK)
362#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
363 IEEE80211_CCK_DEFAULT_RATES_MASK)
364
365#define IEEE80211_NUM_OFDM_RATES 8
366#define IEEE80211_NUM_CCK_RATES 4
367#define IEEE80211_OFDM_SHIFT_MASK_A 4
368
369
370
371
372/* NOTE: This data is for statistical purposes; not all hardware provides this
373 * information for frames received. Not setting these will not cause
374 * any adverse affects. */
375struct ieee80211_rx_stats {
376 u32 mac_time;
377 s8 rssi;
378 u8 signal;
379 u8 noise;
380 u16 rate; /* in 100 kbps */
381 u8 received_channel;
382 u8 control;
383 u8 mask;
384 u8 freq;
385 u16 len;
386};
387
388/* IEEE 802.11 requires that STA supports concurrent reception of at least
389 * three fragmented frames. This define can be increased to support more
390 * concurrent frames, but it should be noted that each entry can consume about
391 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
392#define IEEE80211_FRAG_CACHE_LEN 4
393
394struct ieee80211_frag_entry {
395 unsigned long first_frag_time;
396 unsigned int seq;
397 unsigned int last_frag;
398 struct sk_buff *skb;
399 u8 src_addr[ETH_ALEN];
400 u8 dst_addr[ETH_ALEN];
401};
402
403struct ieee80211_stats {
404 unsigned int tx_unicast_frames;
405 unsigned int tx_multicast_frames;
406 unsigned int tx_fragments;
407 unsigned int tx_unicast_octets;
408 unsigned int tx_multicast_octets;
409 unsigned int tx_deferred_transmissions;
410 unsigned int tx_single_retry_frames;
411 unsigned int tx_multiple_retry_frames;
412 unsigned int tx_retry_limit_exceeded;
413 unsigned int tx_discards;
414 unsigned int rx_unicast_frames;
415 unsigned int rx_multicast_frames;
416 unsigned int rx_fragments;
417 unsigned int rx_unicast_octets;
418 unsigned int rx_multicast_octets;
419 unsigned int rx_fcs_errors;
420 unsigned int rx_discards_no_buffer;
421 unsigned int tx_discards_wrong_sa;
422 unsigned int rx_discards_undecryptable;
423 unsigned int rx_message_in_msg_fragments;
424 unsigned int rx_message_in_bad_msg_fragments;
425};
426
427struct ieee80211_device;
428
429#if 0 /* for later */
430#include "ieee80211_crypt.h"
431#endif
432
433#define SEC_KEY_1 (1<<0)
434#define SEC_KEY_2 (1<<1)
435#define SEC_KEY_3 (1<<2)
436#define SEC_KEY_4 (1<<3)
437#define SEC_ACTIVE_KEY (1<<4)
438#define SEC_AUTH_MODE (1<<5)
439#define SEC_UNICAST_GROUP (1<<6)
440#define SEC_LEVEL (1<<7)
441#define SEC_ENABLED (1<<8)
442
443#define SEC_LEVEL_0 0 /* None */
444#define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
445#define SEC_LEVEL_2 2 /* Level 1 + TKIP */
446#define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
447#define SEC_LEVEL_3 4 /* Level 2 + CCMP */
448
449#define WEP_KEYS 4
450#define WEP_KEY_LEN 13
451
452struct ieee80211_security {
453 u16 active_key:2,
454 enabled:1,
455 auth_mode:2,
456 auth_algo:4,
457 unicast_uses_group:1;
458 u8 key_sizes[WEP_KEYS];
459 u8 keys[WEP_KEYS][WEP_KEY_LEN];
460 u8 level;
461 u16 flags;
462} __attribute__ ((packed));
463
464
465/*
466
467 802.11 data frame from AP
468
469 ,-------------------------------------------------------------------.
470Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
471 |------|------|---------|---------|---------|------|---------|------|
472Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
473 | | tion | (BSSID) | | | ence | data | |
474 `-------------------------------------------------------------------'
475
476Total: 28-2340 bytes
477
478*/
479
480#define BEACON_PROBE_SSID_ID_POSITION 12
481
482/* Management Frame Information Element Types */
483#define MFIE_TYPE_SSID 0
484#define MFIE_TYPE_RATES 1
485#define MFIE_TYPE_FH_SET 2
486#define MFIE_TYPE_DS_SET 3
487#define MFIE_TYPE_CF_SET 4
488#define MFIE_TYPE_TIM 5
489#define MFIE_TYPE_IBSS_SET 6
490#define MFIE_TYPE_CHALLENGE 16
491#define MFIE_TYPE_RSN 48
492#define MFIE_TYPE_RATES_EX 50
493#define MFIE_TYPE_GENERIC 221
494
495struct ieee80211_info_element_hdr {
496 u8 id;
497 u8 len;
498} __attribute__ ((packed));
499
500struct ieee80211_info_element {
501 u8 id;
502 u8 len;
503 u8 data[0];
504} __attribute__ ((packed));
505
506/*
507 * These are the data types that can make up management packets
508 *
509 u16 auth_algorithm;
510 u16 auth_sequence;
511 u16 beacon_interval;
512 u16 capability;
513 u8 current_ap[ETH_ALEN];
514 u16 listen_interval;
515 struct {
516 u16 association_id:14, reserved:2;
517 } __attribute__ ((packed));
518 u32 time_stamp[2];
519 u16 reason;
520 u16 status;
521*/
522
523struct ieee80211_authentication {
524 struct ieee80211_hdr_3addr header;
525 u16 algorithm;
526 u16 transaction;
527 u16 status;
528 struct ieee80211_info_element info_element;
529} __attribute__ ((packed));
530
531
532struct ieee80211_probe_response {
533 struct ieee80211_hdr_3addr header;
534 u32 time_stamp[2];
535 u16 beacon_interval;
536 u16 capability;
537 struct ieee80211_info_element info_element;
538} __attribute__ ((packed));
539
540struct ieee80211_assoc_request_frame {
541 u16 capability;
542 u16 listen_interval;
543 u8 current_ap[ETH_ALEN];
544 struct ieee80211_info_element info_element;
545} __attribute__ ((packed));
546
547struct ieee80211_assoc_response_frame {
548 struct ieee80211_hdr_3addr header;
549 u16 capability;
550 u16 status;
551 u16 aid;
552 struct ieee80211_info_element info_element; /* supported rates */
553} __attribute__ ((packed));
554
555
556struct ieee80211_txb {
557 u8 nr_frags;
558 u8 encrypted;
559 u16 reserved;
560 u16 frag_size;
561 u16 payload_size;
562 struct sk_buff *fragments[0];
563};
564
565
566/* SWEEP TABLE ENTRIES NUMBER*/
567#define MAX_SWEEP_TAB_ENTRIES 42
568#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
569/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
570 * only use 8, and then use extended rates for the remaining supported
571 * rates. Other APs, however, stick all of their supported rates on the
572 * main rates information element... */
573#define MAX_RATES_LENGTH ((u8)12)
574#define MAX_RATES_EX_LENGTH ((u8)16)
575#define MAX_NETWORK_COUNT 128
576
577#define CRC_LENGTH 4U
578
579#define MAX_WPA_IE_LEN 64
580
581#define NETWORK_EMPTY_ESSID (1<<0)
582#define NETWORK_HAS_OFDM (1<<1)
583#define NETWORK_HAS_CCK (1<<2)
584
585struct ieee80211_network {
586 /* These entries are used to identify a unique network */
587 u8 bssid[ETH_ALEN];
588 u8 channel;
589 /* Ensure null-terminated for any debug msgs */
590 u8 ssid[IW_ESSID_MAX_SIZE + 1];
591 u8 ssid_len;
592
593 /* These are network statistics */
594 struct ieee80211_rx_stats stats;
595 u16 capability;
596 u8 rates[MAX_RATES_LENGTH];
597 u8 rates_len;
598 u8 rates_ex[MAX_RATES_EX_LENGTH];
599 u8 rates_ex_len;
600 unsigned long last_scanned;
601 u8 mode;
602 u8 flags;
603 u32 last_associate;
604 u32 time_stamp[2];
605 u16 beacon_interval;
606 u16 listen_interval;
607 u16 atim_window;
608 u8 wpa_ie[MAX_WPA_IE_LEN];
609 size_t wpa_ie_len;
610 u8 rsn_ie[MAX_WPA_IE_LEN];
611 size_t rsn_ie_len;
612 struct list_head list;
613};
614
615enum ieee80211_state {
616 IEEE80211_UNINITIALIZED = 0,
617 IEEE80211_INITIALIZED,
618 IEEE80211_ASSOCIATING,
619 IEEE80211_ASSOCIATED,
620 IEEE80211_AUTHENTICATING,
621 IEEE80211_AUTHENTICATED,
622 IEEE80211_SHUTDOWN
623};
624
625#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
626#define DEFAULT_FTS 2346
627#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
628#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
629
630
631#define CFG_IEEE80211_RESERVE_FCS (1<<0)
632#define CFG_IEEE80211_COMPUTE_FCS (1<<1)
633
634struct ieee80211_device {
635 struct net_device *dev;
636
637 /* Bookkeeping structures */
638 struct net_device_stats stats;
639 struct ieee80211_stats ieee_stats;
640
641 /* Probe / Beacon management */
642 struct list_head network_free_list;
643 struct list_head network_list;
644 struct ieee80211_network *networks;
645 int scans;
646 int scan_age;
647
648 int iw_mode; /* operating mode (IW_MODE_*) */
649
650 spinlock_t lock;
651
652 int tx_headroom; /* Set to size of any additional room needed at front
653 * of allocated Tx SKBs */
654 u32 config;
655
656 /* WEP and other encryption related settings at the device level */
657 int open_wep; /* Set to 1 to allow unencrypted frames */
658
659 int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
660 * WEP key changes */
661
662 /* If the host performs {en,de}cryption, then set to 1 */
663 int host_encrypt;
664 int host_decrypt;
665 int ieee802_1x; /* is IEEE 802.1X used */
666
667 /* WPA data */
668 int wpa_enabled;
669 int drop_unencrypted;
670 int tkip_countermeasures;
671 int privacy_invoked;
672 size_t wpa_ie_len;
673 u8 *wpa_ie;
674
675 struct list_head crypt_deinit_list;
676 struct ieee80211_crypt_data *crypt[WEP_KEYS];
677 int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
678 struct timer_list crypt_deinit_timer;
679
680 int bcrx_sta_key; /* use individual keys to override default keys even
681 * with RX of broad/multicast frames */
682
683 /* Fragmentation structures */
684 struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN];
685 unsigned int frag_next_idx;
686 u16 fts; /* Fragmentation Threshold */
687
688 /* Association info */
689 u8 bssid[ETH_ALEN];
690
691 enum ieee80211_state state;
692
693 int mode; /* A, B, G */
694 int modulation; /* CCK, OFDM */
695 int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
696 int abg_ture; /* ABG flag */
697
698 /* Callback functions */
699 void (*set_security)(struct net_device *dev,
700 struct ieee80211_security *sec);
701 int (*hard_start_xmit)(struct ieee80211_txb *txb,
702 struct net_device *dev);
703 int (*reset_port)(struct net_device *dev);
704
705 /* This must be the last item so that it points to the data
706 * allocated beyond this structure by alloc_ieee80211 */
707 u8 priv[0];
708};
709
710#define IEEE_A (1<<0)
711#define IEEE_B (1<<1)
712#define IEEE_G (1<<2)
713#define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
714
715extern inline void *ieee80211_priv(struct net_device *dev)
716{
717 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
718}
719
720extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
721{
722 /* Single white space is for Linksys APs */
723 if (essid_len == 1 && essid[0] == ' ')
724 return 1;
725
726 /* Otherwise, if the entire essid is 0, we assume it is hidden */
727 while (essid_len) {
728 essid_len--;
729 if (essid[essid_len] != '\0')
730 return 0;
731 }
732
733 return 1;
734}
735
736extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode)
737{
738 /*
739 * It is possible for both access points and our device to support
740 * combinations of modes, so as long as there is one valid combination
741 * of ap/device supported modes, then return success
742 *
743 */
744 if ((mode & IEEE_A) &&
745 (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
746 (ieee->freq_band & IEEE80211_52GHZ_BAND))
747 return 1;
748
749 if ((mode & IEEE_G) &&
750 (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
751 (ieee->freq_band & IEEE80211_24GHZ_BAND))
752 return 1;
753
754 if ((mode & IEEE_B) &&
755 (ieee->modulation & IEEE80211_CCK_MODULATION) &&
756 (ieee->freq_band & IEEE80211_24GHZ_BAND))
757 return 1;
758
759 return 0;
760}
761
762extern inline int ieee80211_get_hdrlen(u16 fc)
763{
764 int hdrlen = IEEE80211_3ADDR_LEN;
765
766 switch (WLAN_FC_GET_TYPE(fc)) {
767 case IEEE80211_FTYPE_DATA:
768 if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
769 hdrlen = IEEE80211_4ADDR_LEN;
770 break;
771 case IEEE80211_FTYPE_CTL:
772 switch (WLAN_FC_GET_STYPE(fc)) {
773 case IEEE80211_STYPE_CTS:
774 case IEEE80211_STYPE_ACK:
775 hdrlen = IEEE80211_1ADDR_LEN;
776 break;
777 default:
778 hdrlen = IEEE80211_2ADDR_LEN;
779 break;
780 }
781 break;
782 }
783
784 return hdrlen;
785}
786
787
788
789/* ieee80211.c */
790extern void free_ieee80211(struct net_device *dev);
791extern struct net_device *alloc_ieee80211(int sizeof_priv);
792
793extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
794
795/* ieee80211_tx.c */
796
797
798extern int ieee80211_xmit(struct sk_buff *skb,
799 struct net_device *dev);
800extern void ieee80211_txb_free(struct ieee80211_txb *);
801
802
803/* ieee80211_rx.c */
804extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
805 struct ieee80211_rx_stats *rx_stats);
806extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
807 struct ieee80211_hdr *header,
808 struct ieee80211_rx_stats *stats);
809
810/* iee80211_wx.c */
811extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
812 struct iw_request_info *info,
813 union iwreq_data *wrqu, char *key);
814extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
815 struct iw_request_info *info,
816 union iwreq_data *wrqu, char *key);
817extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
818 struct iw_request_info *info,
819 union iwreq_data *wrqu, char *key);
820
821
822extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
823{
824 ieee->scans++;
825}
826
827extern inline int ieee80211_get_scans(struct ieee80211_device *ieee)
828{
829 return ieee->scans;
830}
831
832static inline const char *escape_essid(const char *essid, u8 essid_len) {
833 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
834 const char *s = essid;
835 char *d = escaped;
836
837 if (ieee80211_is_empty_essid(essid, essid_len)) {
838 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
839 return escaped;
840 }
841
842 essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE);
843 while (essid_len--) {
844 if (*s == '\0') {
845 *d++ = '\\';
846 *d++ = '0';
847 s++;
848 } else {
849 *d++ = *s++;
850 }
851 }
852 *d = '\0';
853 return escaped;
854}
855
856#endif /* IEEE80211_H */
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 319904518194..a66e9de16a6c 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -167,14 +167,17 @@ extern int fib6_walk_continue(struct fib6_walker_t *w);
167extern int fib6_add(struct fib6_node *root, 167extern int fib6_add(struct fib6_node *root,
168 struct rt6_info *rt, 168 struct rt6_info *rt,
169 struct nlmsghdr *nlh, 169 struct nlmsghdr *nlh,
170 void *rtattr); 170 void *rtattr,
171 struct netlink_skb_parms *req);
171 172
172extern int fib6_del(struct rt6_info *rt, 173extern int fib6_del(struct rt6_info *rt,
173 struct nlmsghdr *nlh, 174 struct nlmsghdr *nlh,
174 void *rtattr); 175 void *rtattr,
176 struct netlink_skb_parms *req);
175 177
176extern void inet6_rt_notify(int event, struct rt6_info *rt, 178extern void inet6_rt_notify(int event, struct rt6_info *rt,
177 struct nlmsghdr *nlh); 179 struct nlmsghdr *nlh,
180 struct netlink_skb_parms *req);
178 181
179extern void fib6_run_gc(unsigned long dummy); 182extern void fib6_run_gc(unsigned long dummy);
180 183
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index d5d1dd10cdb8..f920706d526b 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -41,13 +41,16 @@ extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg);
41 41
42extern int ip6_route_add(struct in6_rtmsg *rtmsg, 42extern int ip6_route_add(struct in6_rtmsg *rtmsg,
43 struct nlmsghdr *, 43 struct nlmsghdr *,
44 void *rtattr); 44 void *rtattr,
45 struct netlink_skb_parms *req);
45extern int ip6_ins_rt(struct rt6_info *, 46extern int ip6_ins_rt(struct rt6_info *,
46 struct nlmsghdr *, 47 struct nlmsghdr *,
47 void *rtattr); 48 void *rtattr,
49 struct netlink_skb_parms *req);
48extern int ip6_del_rt(struct rt6_info *, 50extern int ip6_del_rt(struct rt6_info *,
49 struct nlmsghdr *, 51 struct nlmsghdr *,
50 void *rtattr); 52 void *rtattr,
53 struct netlink_skb_parms *req);
51 54
52extern int ip6_rt_addr_add(struct in6_addr *addr, 55extern int ip6_rt_addr_add(struct in6_addr *addr,
53 struct net_device *dev, 56 struct net_device *dev,
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index e5a5f6b62f88..a4208a336ac0 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -109,6 +109,20 @@ struct fib_result {
109#endif 109#endif
110}; 110};
111 111
112struct fib_result_nl {
113 u32 fl_addr; /* To be looked up*/
114 u32 fl_fwmark;
115 unsigned char fl_tos;
116 unsigned char fl_scope;
117 unsigned char tb_id_in;
118
119 unsigned char tb_id; /* Results */
120 unsigned char prefixlen;
121 unsigned char nh_sel;
122 unsigned char type;
123 unsigned char scope;
124 int err;
125};
112 126
113#ifdef CONFIG_IP_ROUTE_MULTIPATH 127#ifdef CONFIG_IP_ROUTE_MULTIPATH
114 128
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 771b47e30f86..69324465e8b3 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -183,7 +183,6 @@ struct ipv6_txoptions
183 struct ipv6_opt_hdr *hopopt; 183 struct ipv6_opt_hdr *hopopt;
184 struct ipv6_opt_hdr *dst0opt; 184 struct ipv6_opt_hdr *dst0opt;
185 struct ipv6_rt_hdr *srcrt; /* Routing Header */ 185 struct ipv6_rt_hdr *srcrt; /* Routing Header */
186 struct ipv6_opt_hdr *auth;
187 struct ipv6_opt_hdr *dst1opt; 186 struct ipv6_opt_hdr *dst1opt;
188 187
189 /* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */ 188 /* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */
diff --git a/include/net/route.h b/include/net/route.h
index d34ca8fc6756..c3cd069a9aca 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -107,7 +107,7 @@ struct rt_cache_stat
107 107
108extern struct rt_cache_stat *rt_cache_stat; 108extern struct rt_cache_stat *rt_cache_stat;
109#define RT_CACHE_STAT_INC(field) \ 109#define RT_CACHE_STAT_INC(field) \
110 (per_cpu_ptr(rt_cache_stat, _smp_processor_id())->field++) 110 (per_cpu_ptr(rt_cache_stat, raw_smp_processor_id())->field++)
111 111
112extern struct ip_rt_acct *ip_rt_acct; 112extern struct ip_rt_acct *ip_rt_acct;
113 113
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index ebc5282e6d58..dc107ffad483 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -65,9 +65,11 @@ typedef enum {
65 SCTP_CMD_TIMER_START, /* Start a timer. */ 65 SCTP_CMD_TIMER_START, /* Start a timer. */
66 SCTP_CMD_TIMER_RESTART, /* Restart a timer. */ 66 SCTP_CMD_TIMER_RESTART, /* Restart a timer. */
67 SCTP_CMD_TIMER_STOP, /* Stop a timer. */ 67 SCTP_CMD_TIMER_STOP, /* Stop a timer. */
68 SCTP_CMD_COUNTER_RESET, /* Reset a counter. */ 68 SCTP_CMD_INIT_CHOOSE_TRANSPORT, /* Choose transport for an INIT. */
69 SCTP_CMD_COUNTER_INC, /* Increment a counter. */ 69 SCTP_CMD_INIT_COUNTER_RESET, /* Reset init counter. */
70 SCTP_CMD_INIT_COUNTER_INC, /* Increment init counter. */
70 SCTP_CMD_INIT_RESTART, /* High level, do init timer work. */ 71 SCTP_CMD_INIT_RESTART, /* High level, do init timer work. */
72 SCTP_CMD_COOKIEECHO_RESTART, /* High level, do cookie-echo timer work. */
71 SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */ 73 SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */
72 SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */ 74 SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */
73 SCTP_CMD_STRIKE, /* Mark a strike against a transport. */ 75 SCTP_CMD_STRIKE, /* Mark a strike against a transport. */
@@ -118,7 +120,6 @@ typedef union {
118 int error; 120 int error;
119 sctp_state_t state; 121 sctp_state_t state;
120 sctp_event_timeout_t to; 122 sctp_event_timeout_t to;
121 sctp_counter_t counter;
122 void *ptr; 123 void *ptr;
123 struct sctp_chunk *chunk; 124 struct sctp_chunk *chunk;
124 struct sctp_association *asoc; 125 struct sctp_association *asoc;
@@ -165,7 +166,6 @@ SCTP_ARG_CONSTRUCTOR(U16, __u16, u16)
165SCTP_ARG_CONSTRUCTOR(U8, __u8, u8) 166SCTP_ARG_CONSTRUCTOR(U8, __u8, u8)
166SCTP_ARG_CONSTRUCTOR(ERROR, int, error) 167SCTP_ARG_CONSTRUCTOR(ERROR, int, error)
167SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) 168SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state)
168SCTP_ARG_CONSTRUCTOR(COUNTER, sctp_counter_t, counter)
169SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) 169SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to)
170SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr) 170SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr)
171SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) 171SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk)
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 2b76c0f4babc..5999e5684bbf 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -263,30 +263,11 @@ enum { SCTP_MIN_PMTU = 576 };
263enum { SCTP_MAX_DUP_TSNS = 16 }; 263enum { SCTP_MAX_DUP_TSNS = 16 };
264enum { SCTP_MAX_GABS = 16 }; 264enum { SCTP_MAX_GABS = 16 };
265 265
266typedef enum { 266/* Heartbeat interval - 30 secs */
267 SCTP_COUNTER_INIT_ERROR, 267#define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (30 * HZ)
268} sctp_counter_t;
269
270/* How many counters does an association need? */
271#define SCTP_NUMBER_COUNTERS 5
272
273/* Here we define the default timers. */
274
275/* cookie timer def = ? seconds */
276#define SCTP_DEFAULT_TIMEOUT_T1_COOKIE (3 * HZ)
277
278/* init timer def = 3 seconds */
279#define SCTP_DEFAULT_TIMEOUT_T1_INIT (3 * HZ)
280
281/* shutdown timer def = 300 ms */
282#define SCTP_DEFAULT_TIMEOUT_T2_SHUTDOWN ((300 * HZ) / 1000)
283
284/* 0 seconds + RTO */
285#define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (10 * HZ)
286 268
287/* recv timer def = 200ms (in usec) */ 269/* Delayed sack timer - 200ms */
288#define SCTP_DEFAULT_TIMEOUT_SACK ((200 * HZ) / 1000) 270#define SCTP_DEFAULT_TIMEOUT_SACK ((200 * HZ) / 1000)
289#define SCTP_DEFAULT_TIMEOUT_SACK_MAX ((500 * HZ) / 1000) /* 500 ms */
290 271
291/* RTO.Initial - 3 seconds 272/* RTO.Initial - 3 seconds
292 * RTO.Min - 1 second 273 * RTO.Min - 1 second
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 960abfa48d68..ef2738159ab3 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -223,6 +223,22 @@ DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics);
223extern int sctp_debug_flag; 223extern int sctp_debug_flag;
224#define SCTP_DEBUG_PRINTK(whatever...) \ 224#define SCTP_DEBUG_PRINTK(whatever...) \
225 ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever))) 225 ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever)))
226#define SCTP_DEBUG_PRINTK_IPADDR(lead, trail, leadparm, saddr, otherparms...) \
227 if (sctp_debug_flag) { \
228 if (saddr->sa.sa_family == AF_INET6) { \
229 printk(KERN_DEBUG \
230 lead "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" trail, \
231 leadparm, \
232 NIP6(saddr->v6.sin6_addr), \
233 otherparms); \
234 } else { \
235 printk(KERN_DEBUG \
236 lead "%u.%u.%u.%u" trail, \
237 leadparm, \
238 NIPQUAD(saddr->v4.sin_addr.s_addr), \
239 otherparms); \
240 } \
241 }
226#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } 242#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; }
227#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } 243#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; }
228 244
@@ -236,6 +252,7 @@ extern int sctp_debug_flag;
236#else /* SCTP_DEBUG */ 252#else /* SCTP_DEBUG */
237 253
238#define SCTP_DEBUG_PRINTK(whatever...) 254#define SCTP_DEBUG_PRINTK(whatever...)
255#define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
239#define SCTP_ENABLE_DEBUG 256#define SCTP_ENABLE_DEBUG
240#define SCTP_DISABLE_DEBUG 257#define SCTP_DISABLE_DEBUG
241#define SCTP_ASSERT(expr, str, func) 258#define SCTP_ASSERT(expr, str, func)
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index f4fcee104707..88d9fe5975d5 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -116,7 +116,8 @@ sctp_state_fn_t sctp_sf_eat_data_fast_4_4;
116sctp_state_fn_t sctp_sf_eat_sack_6_2; 116sctp_state_fn_t sctp_sf_eat_sack_6_2;
117sctp_state_fn_t sctp_sf_tabort_8_4_8; 117sctp_state_fn_t sctp_sf_tabort_8_4_8;
118sctp_state_fn_t sctp_sf_operr_notify; 118sctp_state_fn_t sctp_sf_operr_notify;
119sctp_state_fn_t sctp_sf_t1_timer_expire; 119sctp_state_fn_t sctp_sf_t1_init_timer_expire;
120sctp_state_fn_t sctp_sf_t1_cookie_timer_expire;
120sctp_state_fn_t sctp_sf_t2_timer_expire; 121sctp_state_fn_t sctp_sf_t2_timer_expire;
121sctp_state_fn_t sctp_sf_t4_timer_expire; 122sctp_state_fn_t sctp_sf_t4_timer_expire;
122sctp_state_fn_t sctp_sf_t5_timer_expire; 123sctp_state_fn_t sctp_sf_t5_timer_expire;
@@ -130,7 +131,6 @@ sctp_state_fn_t sctp_sf_do_ecne;
130sctp_state_fn_t sctp_sf_ootb; 131sctp_state_fn_t sctp_sf_ootb;
131sctp_state_fn_t sctp_sf_pdiscard; 132sctp_state_fn_t sctp_sf_pdiscard;
132sctp_state_fn_t sctp_sf_violation; 133sctp_state_fn_t sctp_sf_violation;
133sctp_state_fn_t sctp_sf_violation_chunklen;
134sctp_state_fn_t sctp_sf_discard_chunk; 134sctp_state_fn_t sctp_sf_discard_chunk;
135sctp_state_fn_t sctp_sf_do_5_2_1_siminit; 135sctp_state_fn_t sctp_sf_do_5_2_1_siminit;
136sctp_state_fn_t sctp_sf_do_5_2_2_dupinit; 136sctp_state_fn_t sctp_sf_do_5_2_2_dupinit;
@@ -258,8 +258,6 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc,
258void sctp_chunk_assign_tsn(struct sctp_chunk *); 258void sctp_chunk_assign_tsn(struct sctp_chunk *);
259void sctp_chunk_assign_ssn(struct sctp_chunk *); 259void sctp_chunk_assign_ssn(struct sctp_chunk *);
260 260
261void sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands, __u16 error);
262
263/* Prototypes for statetable processing. */ 261/* Prototypes for statetable processing. */
264 262
265int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, 263int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 6c24d9cd3d66..47727c7cc628 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -161,6 +161,9 @@ extern struct sctp_globals {
161 */ 161 */
162 int sndbuf_policy; 162 int sndbuf_policy;
163 163
164 /* Delayed SACK timeout 200ms default*/
165 int sack_timeout;
166
164 /* HB.interval - 30 seconds */ 167 /* HB.interval - 30 seconds */
165 int hb_interval; 168 int hb_interval;
166 169
@@ -217,6 +220,7 @@ extern struct sctp_globals {
217#define sctp_sndbuf_policy (sctp_globals.sndbuf_policy) 220#define sctp_sndbuf_policy (sctp_globals.sndbuf_policy)
218#define sctp_max_retrans_path (sctp_globals.max_retrans_path) 221#define sctp_max_retrans_path (sctp_globals.max_retrans_path)
219#define sctp_max_retrans_init (sctp_globals.max_retrans_init) 222#define sctp_max_retrans_init (sctp_globals.max_retrans_init)
223#define sctp_sack_timeout (sctp_globals.sack_timeout)
220#define sctp_hb_interval (sctp_globals.hb_interval) 224#define sctp_hb_interval (sctp_globals.hb_interval)
221#define sctp_max_instreams (sctp_globals.max_instreams) 225#define sctp_max_instreams (sctp_globals.max_instreams)
222#define sctp_max_outstreams (sctp_globals.max_outstreams) 226#define sctp_max_outstreams (sctp_globals.max_outstreams)
@@ -867,10 +871,13 @@ struct sctp_transport {
867 */ 871 */
868 unsigned long last_time_ecne_reduced; 872 unsigned long last_time_ecne_reduced;
869 873
870 /* active : The current active state of this destination, 874 /* The number of times INIT has been sent on this transport. */
871 * : i.e. DOWN, UP, etc. 875 int init_sent_count;
876
877 /* state : The current state of this destination,
878 * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKOWN.
872 */ 879 */
873 int active; 880 int state;
874 881
875 /* hb_allowed : The current heartbeat state of this destination, 882 /* hb_allowed : The current heartbeat state of this destination,
876 * : i.e. ALLOW-HB, NO-HEARTBEAT, etc. 883 * : i.e. ALLOW-HB, NO-HEARTBEAT, etc.
@@ -1222,9 +1229,6 @@ struct sctp_endpoint {
1222 1229
1223 /* sendbuf acct. policy. */ 1230 /* sendbuf acct. policy. */
1224 __u32 sndbuf_policy; 1231 __u32 sndbuf_policy;
1225
1226 /* Name for debugging output... */
1227 char *debug_name;
1228}; 1232};
1229 1233
1230/* Recover the outter endpoint structure. */ 1234/* Recover the outter endpoint structure. */
@@ -1314,11 +1318,23 @@ struct sctp_association {
1314 * : association. Normally this information is 1318 * : association. Normally this information is
1315 * : hashed or keyed for quick lookup and access 1319 * : hashed or keyed for quick lookup and access
1316 * : of the TCB. 1320 * : of the TCB.
1321 * : The list is also initialized with the list
1322 * : of addresses passed with the sctp_connectx()
1323 * : call.
1317 * 1324 *
1318 * It is a list of SCTP_transport's. 1325 * It is a list of SCTP_transport's.
1319 */ 1326 */
1320 struct list_head transport_addr_list; 1327 struct list_head transport_addr_list;
1321 1328
1329 /* transport_count
1330 *
1331 * Peer : A count of the number of peer addresses
1332 * Transport : in the Peer Transport Address List.
1333 * Address :
1334 * Count :
1335 */
1336 __u16 transport_count;
1337
1322 /* port 1338 /* port
1323 * The transport layer port number. 1339 * The transport layer port number.
1324 */ 1340 */
@@ -1486,6 +1502,9 @@ struct sctp_association {
1486 /* Transport to which SHUTDOWN chunk was last sent. */ 1502 /* Transport to which SHUTDOWN chunk was last sent. */
1487 struct sctp_transport *shutdown_last_sent_to; 1503 struct sctp_transport *shutdown_last_sent_to;
1488 1504
1505 /* Transport to which INIT chunk was last sent. */
1506 struct sctp_transport *init_last_sent_to;
1507
1489 /* Next TSN : The next TSN number to be assigned to a new 1508 /* Next TSN : The next TSN number to be assigned to a new
1490 * : DATA chunk. This is sent in the INIT or INIT 1509 * : DATA chunk. This is sent in the INIT or INIT
1491 * : ACK chunk to the peer and incremented each 1510 * : ACK chunk to the peer and incremented each
@@ -1549,8 +1568,11 @@ struct sctp_association {
1549 /* The message size at which SCTP fragmentation will occur. */ 1568 /* The message size at which SCTP fragmentation will occur. */
1550 __u32 frag_point; 1569 __u32 frag_point;
1551 1570
1552 /* Currently only one counter is used to count INIT errors. */ 1571 /* Counter used to count INIT errors. */
1553 int counters[SCTP_NUMBER_COUNTERS]; 1572 int init_err_counter;
1573
1574 /* Count the number of INIT cycles (for doubling timeout). */
1575 int init_cycle;
1554 1576
1555 /* Default send parameters. */ 1577 /* Default send parameters. */
1556 __u16 default_stream; 1578 __u16 default_stream;
@@ -1708,6 +1730,8 @@ void sctp_association_free(struct sctp_association *);
1708void sctp_association_put(struct sctp_association *); 1730void sctp_association_put(struct sctp_association *);
1709void sctp_association_hold(struct sctp_association *); 1731void sctp_association_hold(struct sctp_association *);
1710 1732
1733struct sctp_transport *sctp_assoc_choose_init_transport(
1734 struct sctp_association *);
1711struct sctp_transport *sctp_assoc_choose_shutdown_transport( 1735struct sctp_transport *sctp_assoc_choose_shutdown_transport(
1712 struct sctp_association *); 1736 struct sctp_association *);
1713void sctp_assoc_update_retran_path(struct sctp_association *); 1737void sctp_assoc_update_retran_path(struct sctp_association *);
@@ -1717,9 +1741,12 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
1717 const union sctp_addr *laddr); 1741 const union sctp_addr *laddr);
1718struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *, 1742struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *,
1719 const union sctp_addr *address, 1743 const union sctp_addr *address,
1720 const int gfp); 1744 const int gfp,
1745 const int peer_state);
1721void sctp_assoc_del_peer(struct sctp_association *asoc, 1746void sctp_assoc_del_peer(struct sctp_association *asoc,
1722 const union sctp_addr *addr); 1747 const union sctp_addr *addr);
1748void sctp_assoc_rm_peer(struct sctp_association *asoc,
1749 struct sctp_transport *peer);
1723void sctp_assoc_control_transport(struct sctp_association *, 1750void sctp_assoc_control_transport(struct sctp_association *,
1724 struct sctp_transport *, 1751 struct sctp_transport *,
1725 sctp_transport_cmd_t, sctp_sn_error_t); 1752 sctp_transport_cmd_t, sctp_sn_error_t);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 2758e8ce4f25..f6328aeddcce 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -111,6 +111,8 @@ enum sctp_optname {
111#define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM 111#define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM
112 SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ 112 SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */
113#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS 113#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS
114 SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
115#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX
114}; 116};
115 117
116/* 118/*
@@ -527,6 +529,7 @@ struct sctp_paddrinfo {
527enum sctp_spinfo_state { 529enum sctp_spinfo_state {
528 SCTP_INACTIVE, 530 SCTP_INACTIVE,
529 SCTP_ACTIVE, 531 SCTP_ACTIVE,
532 SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */
530}; 533};
531 534
532/* 535/*
diff --git a/include/net/snmp.h b/include/net/snmp.h
index a15ab256276e..a36bed8ea210 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -128,18 +128,18 @@ struct linux_mib {
128#define SNMP_STAT_USRPTR(name) (name[1]) 128#define SNMP_STAT_USRPTR(name) (name[1])
129 129
130#define SNMP_INC_STATS_BH(mib, field) \ 130#define SNMP_INC_STATS_BH(mib, field) \
131 (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field]++) 131 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++)
132#define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \ 132#define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \
133 (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field + (offset)]++) 133 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field + (offset)]++)
134#define SNMP_INC_STATS_USER(mib, field) \ 134#define SNMP_INC_STATS_USER(mib, field) \
135 (per_cpu_ptr(mib[1], _smp_processor_id())->mibs[field]++) 135 (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field]++)
136#define SNMP_INC_STATS(mib, field) \ 136#define SNMP_INC_STATS(mib, field) \
137 (per_cpu_ptr(mib[!in_softirq()], _smp_processor_id())->mibs[field]++) 137 (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]++)
138#define SNMP_DEC_STATS(mib, field) \ 138#define SNMP_DEC_STATS(mib, field) \
139 (per_cpu_ptr(mib[!in_softirq()], _smp_processor_id())->mibs[field]--) 139 (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]--)
140#define SNMP_ADD_STATS_BH(mib, field, addend) \ 140#define SNMP_ADD_STATS_BH(mib, field, addend) \
141 (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field] += addend) 141 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend)
142#define SNMP_ADD_STATS_USER(mib, field, addend) \ 142#define SNMP_ADD_STATS_USER(mib, field, addend) \
143 (per_cpu_ptr(mib[1], _smp_processor_id())->mibs[field] += addend) 143 (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field] += addend)
144 144
145#endif 145#endif
diff --git a/include/net/tcp.h b/include/net/tcp.h
index f730935b824a..ec9e20c27179 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -505,25 +505,6 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
505#else 505#else
506# define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG) 506# define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG)
507#endif 507#endif
508
509#define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation
510 * max_cwnd = snd_cwnd * beta
511 */
512#define BICTCP_MAX_INCREMENT 32 /*
513 * Limit on the amount of
514 * increment allowed during
515 * binary search.
516 */
517#define BICTCP_FUNC_OF_MIN_INCR 11 /*
518 * log(B/Smin)/log(B/(B-1))+1,
519 * Smin:min increment
520 * B:log factor
521 */
522#define BICTCP_B 4 /*
523 * In binary search,
524 * go to point (max+min)/N
525 */
526
527/* 508/*
528 * TCP option 509 * TCP option
529 */ 510 */
@@ -596,16 +577,7 @@ extern int sysctl_tcp_adv_win_scale;
596extern int sysctl_tcp_tw_reuse; 577extern int sysctl_tcp_tw_reuse;
597extern int sysctl_tcp_frto; 578extern int sysctl_tcp_frto;
598extern int sysctl_tcp_low_latency; 579extern int sysctl_tcp_low_latency;
599extern int sysctl_tcp_westwood;
600extern int sysctl_tcp_vegas_cong_avoid;
601extern int sysctl_tcp_vegas_alpha;
602extern int sysctl_tcp_vegas_beta;
603extern int sysctl_tcp_vegas_gamma;
604extern int sysctl_tcp_nometrics_save; 580extern int sysctl_tcp_nometrics_save;
605extern int sysctl_tcp_bic;
606extern int sysctl_tcp_bic_fast_convergence;
607extern int sysctl_tcp_bic_low_window;
608extern int sysctl_tcp_bic_beta;
609extern int sysctl_tcp_moderate_rcvbuf; 581extern int sysctl_tcp_moderate_rcvbuf;
610extern int sysctl_tcp_tso_win_divisor; 582extern int sysctl_tcp_tso_win_divisor;
611 583
@@ -1136,6 +1108,82 @@ static inline void tcp_packets_out_dec(struct tcp_sock *tp,
1136 tp->packets_out -= tcp_skb_pcount(skb); 1108 tp->packets_out -= tcp_skb_pcount(skb);
1137} 1109}
1138 1110
1111/* Events passed to congestion control interface */
1112enum tcp_ca_event {
1113 CA_EVENT_TX_START, /* first transmit when no packets in flight */
1114 CA_EVENT_CWND_RESTART, /* congestion window restart */
1115 CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */
1116 CA_EVENT_FRTO, /* fast recovery timeout */
1117 CA_EVENT_LOSS, /* loss timeout */
1118 CA_EVENT_FAST_ACK, /* in sequence ack */
1119 CA_EVENT_SLOW_ACK, /* other ack */
1120};
1121
1122/*
1123 * Interface for adding new TCP congestion control handlers
1124 */
1125#define TCP_CA_NAME_MAX 16
1126struct tcp_congestion_ops {
1127 struct list_head list;
1128
1129 /* initialize private data (optional) */
1130 void (*init)(struct tcp_sock *tp);
1131 /* cleanup private data (optional) */
1132 void (*release)(struct tcp_sock *tp);
1133
1134 /* return slow start threshold (required) */
1135 u32 (*ssthresh)(struct tcp_sock *tp);
1136 /* lower bound for congestion window (optional) */
1137 u32 (*min_cwnd)(struct tcp_sock *tp);
1138 /* do new cwnd calculation (required) */
1139 void (*cong_avoid)(struct tcp_sock *tp, u32 ack,
1140 u32 rtt, u32 in_flight, int good_ack);
1141 /* round trip time sample per acked packet (optional) */
1142 void (*rtt_sample)(struct tcp_sock *tp, u32 usrtt);
1143 /* call before changing ca_state (optional) */
1144 void (*set_state)(struct tcp_sock *tp, u8 new_state);
1145 /* call when cwnd event occurs (optional) */
1146 void (*cwnd_event)(struct tcp_sock *tp, enum tcp_ca_event ev);
1147 /* new value of cwnd after loss (optional) */
1148 u32 (*undo_cwnd)(struct tcp_sock *tp);
1149 /* hook for packet ack accounting (optional) */
1150 void (*pkts_acked)(struct tcp_sock *tp, u32 num_acked);
1151 /* get info for tcp_diag (optional) */
1152 void (*get_info)(struct tcp_sock *tp, u32 ext, struct sk_buff *skb);
1153
1154 char name[TCP_CA_NAME_MAX];
1155 struct module *owner;
1156};
1157
1158extern int tcp_register_congestion_control(struct tcp_congestion_ops *type);
1159extern void tcp_unregister_congestion_control(struct tcp_congestion_ops *type);
1160
1161extern void tcp_init_congestion_control(struct tcp_sock *tp);
1162extern void tcp_cleanup_congestion_control(struct tcp_sock *tp);
1163extern int tcp_set_default_congestion_control(const char *name);
1164extern void tcp_get_default_congestion_control(char *name);
1165extern int tcp_set_congestion_control(struct tcp_sock *tp, const char *name);
1166
1167extern struct tcp_congestion_ops tcp_init_congestion_ops;
1168extern u32 tcp_reno_ssthresh(struct tcp_sock *tp);
1169extern void tcp_reno_cong_avoid(struct tcp_sock *tp, u32 ack,
1170 u32 rtt, u32 in_flight, int flag);
1171extern u32 tcp_reno_min_cwnd(struct tcp_sock *tp);
1172extern struct tcp_congestion_ops tcp_reno;
1173
1174static inline void tcp_set_ca_state(struct tcp_sock *tp, u8 ca_state)
1175{
1176 if (tp->ca_ops->set_state)
1177 tp->ca_ops->set_state(tp, ca_state);
1178 tp->ca_state = ca_state;
1179}
1180
1181static inline void tcp_ca_event(struct tcp_sock *tp, enum tcp_ca_event event)
1182{
1183 if (tp->ca_ops->cwnd_event)
1184 tp->ca_ops->cwnd_event(tp, event);
1185}
1186
1139/* This determines how many packets are "in the network" to the best 1187/* This determines how many packets are "in the network" to the best
1140 * of our knowledge. In many cases it is conservative, but where 1188 * of our knowledge. In many cases it is conservative, but where
1141 * detailed information is available from the receiver (via SACK 1189 * detailed information is available from the receiver (via SACK
@@ -1155,91 +1203,6 @@ static __inline__ unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
1155 return (tp->packets_out - tp->left_out + tp->retrans_out); 1203 return (tp->packets_out - tp->left_out + tp->retrans_out);
1156} 1204}
1157 1205
1158/*
1159 * Which congestion algorithim is in use on the connection.
1160 */
1161#define tcp_is_vegas(__tp) ((__tp)->adv_cong == TCP_VEGAS)
1162#define tcp_is_westwood(__tp) ((__tp)->adv_cong == TCP_WESTWOOD)
1163#define tcp_is_bic(__tp) ((__tp)->adv_cong == TCP_BIC)
1164
1165/* Recalculate snd_ssthresh, we want to set it to:
1166 *
1167 * Reno:
1168 * one half the current congestion window, but no
1169 * less than two segments
1170 *
1171 * BIC:
1172 * behave like Reno until low_window is reached,
1173 * then increase congestion window slowly
1174 */
1175static inline __u32 tcp_recalc_ssthresh(struct tcp_sock *tp)
1176{
1177 if (tcp_is_bic(tp)) {
1178 if (sysctl_tcp_bic_fast_convergence &&
1179 tp->snd_cwnd < tp->bictcp.last_max_cwnd)
1180 tp->bictcp.last_max_cwnd = (tp->snd_cwnd *
1181 (BICTCP_BETA_SCALE
1182 + sysctl_tcp_bic_beta))
1183 / (2 * BICTCP_BETA_SCALE);
1184 else
1185 tp->bictcp.last_max_cwnd = tp->snd_cwnd;
1186
1187 if (tp->snd_cwnd > sysctl_tcp_bic_low_window)
1188 return max((tp->snd_cwnd * sysctl_tcp_bic_beta)
1189 / BICTCP_BETA_SCALE, 2U);
1190 }
1191
1192 return max(tp->snd_cwnd >> 1U, 2U);
1193}
1194
1195/* Stop taking Vegas samples for now. */
1196#define tcp_vegas_disable(__tp) ((__tp)->vegas.doing_vegas_now = 0)
1197
1198static inline void tcp_vegas_enable(struct tcp_sock *tp)
1199{
1200 /* There are several situations when we must "re-start" Vegas:
1201 *
1202 * o when a connection is established
1203 * o after an RTO
1204 * o after fast recovery
1205 * o when we send a packet and there is no outstanding
1206 * unacknowledged data (restarting an idle connection)
1207 *
1208 * In these circumstances we cannot do a Vegas calculation at the
1209 * end of the first RTT, because any calculation we do is using
1210 * stale info -- both the saved cwnd and congestion feedback are
1211 * stale.
1212 *
1213 * Instead we must wait until the completion of an RTT during
1214 * which we actually receive ACKs.
1215 */
1216
1217 /* Begin taking Vegas samples next time we send something. */
1218 tp->vegas.doing_vegas_now = 1;
1219
1220 /* Set the beginning of the next send window. */
1221 tp->vegas.beg_snd_nxt = tp->snd_nxt;
1222
1223 tp->vegas.cntRTT = 0;
1224 tp->vegas.minRTT = 0x7fffffff;
1225}
1226
1227/* Should we be taking Vegas samples right now? */
1228#define tcp_vegas_enabled(__tp) ((__tp)->vegas.doing_vegas_now)
1229
1230extern void tcp_ca_init(struct tcp_sock *tp);
1231
1232static inline void tcp_set_ca_state(struct tcp_sock *tp, u8 ca_state)
1233{
1234 if (tcp_is_vegas(tp)) {
1235 if (ca_state == TCP_CA_Open)
1236 tcp_vegas_enable(tp);
1237 else
1238 tcp_vegas_disable(tp);
1239 }
1240 tp->ca_state = ca_state;
1241}
1242
1243/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 1206/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
1244 * The exception is rate halving phase, when cwnd is decreasing towards 1207 * The exception is rate halving phase, when cwnd is decreasing towards
1245 * ssthresh. 1208 * ssthresh.
@@ -1288,7 +1251,7 @@ static inline void tcp_cwnd_validate(struct sock *sk, struct tcp_sock *tp)
1288static inline void __tcp_enter_cwr(struct tcp_sock *tp) 1251static inline void __tcp_enter_cwr(struct tcp_sock *tp)
1289{ 1252{
1290 tp->undo_marker = 0; 1253 tp->undo_marker = 0;
1291 tp->snd_ssthresh = tcp_recalc_ssthresh(tp); 1254 tp->snd_ssthresh = tp->ca_ops->ssthresh(tp);
1292 tp->snd_cwnd = min(tp->snd_cwnd, 1255 tp->snd_cwnd = min(tp->snd_cwnd,
1293 tcp_packets_in_flight(tp) + 1U); 1256 tcp_packets_in_flight(tp) + 1U);
1294 tp->snd_cwnd_cnt = 0; 1257 tp->snd_cwnd_cnt = 0;
@@ -1876,52 +1839,4 @@ struct tcp_iter_state {
1876extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo); 1839extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo);
1877extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo); 1840extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo);
1878 1841
1879/* TCP Westwood functions and constants */
1880
1881#define TCP_WESTWOOD_INIT_RTT (20*HZ) /* maybe too conservative?! */
1882#define TCP_WESTWOOD_RTT_MIN (HZ/20) /* 50ms */
1883
1884static inline void tcp_westwood_update_rtt(struct tcp_sock *tp, __u32 rtt_seq)
1885{
1886 if (tcp_is_westwood(tp))
1887 tp->westwood.rtt = rtt_seq;
1888}
1889
1890static inline __u32 __tcp_westwood_bw_rttmin(const struct tcp_sock *tp)
1891{
1892 return max((tp->westwood.bw_est) * (tp->westwood.rtt_min) /
1893 (__u32) (tp->mss_cache_std),
1894 2U);
1895}
1896
1897static inline __u32 tcp_westwood_bw_rttmin(const struct tcp_sock *tp)
1898{
1899 return tcp_is_westwood(tp) ? __tcp_westwood_bw_rttmin(tp) : 0;
1900}
1901
1902static inline int tcp_westwood_ssthresh(struct tcp_sock *tp)
1903{
1904 __u32 ssthresh = 0;
1905
1906 if (tcp_is_westwood(tp)) {
1907 ssthresh = __tcp_westwood_bw_rttmin(tp);
1908 if (ssthresh)
1909 tp->snd_ssthresh = ssthresh;
1910 }
1911
1912 return (ssthresh != 0);
1913}
1914
1915static inline int tcp_westwood_cwnd(struct tcp_sock *tp)
1916{
1917 __u32 cwnd = 0;
1918
1919 if (tcp_is_westwood(tp)) {
1920 cwnd = __tcp_westwood_bw_rttmin(tp);
1921 if (cwnd)
1922 tp->snd_cwnd = cwnd;
1923 }
1924
1925 return (cwnd != 0);
1926}
1927#endif /* _TCP_H */ 1842#endif /* _TCP_H */
diff --git a/include/net/x25.h b/include/net/x25.h
index 7a1ba5bbb868..8b39b98876e8 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -79,6 +79,8 @@ enum {
79#define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */ 79#define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */
80#define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */ 80#define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */
81#define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */ 81#define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */
82#define X25_DENY_ACCPT_APPRV 0x01 /* Default value */
83#define X25_ALLOW_ACCPT_APPRV 0x00 /* Control enabled */
82 84
83#define X25_SMODULUS 8 85#define X25_SMODULUS 8
84#define X25_EMODULUS 128 86#define X25_EMODULUS 128
@@ -94,7 +96,7 @@ enum {
94#define X25_FAC_CLASS_C 0x80 96#define X25_FAC_CLASS_C 0x80
95#define X25_FAC_CLASS_D 0xC0 97#define X25_FAC_CLASS_D 0xC0
96 98
97#define X25_FAC_REVERSE 0x01 99#define X25_FAC_REVERSE 0x01 /* also fast select */
98#define X25_FAC_THROUGHPUT 0x02 100#define X25_FAC_THROUGHPUT 0x02
99#define X25_FAC_PACKET_SIZE 0x42 101#define X25_FAC_PACKET_SIZE 0x42
100#define X25_FAC_WINDOW_SIZE 0x43 102#define X25_FAC_WINDOW_SIZE 0x43
@@ -134,8 +136,8 @@ struct x25_sock {
134 struct sock sk; 136 struct sock sk;
135 struct x25_address source_addr, dest_addr; 137 struct x25_address source_addr, dest_addr;
136 struct x25_neigh *neighbour; 138 struct x25_neigh *neighbour;
137 unsigned int lci; 139 unsigned int lci, cudmatchlength;
138 unsigned char state, condition, qbitincl, intflag; 140 unsigned char state, condition, qbitincl, intflag, accptapprv;
139 unsigned short vs, vr, va, vl; 141 unsigned short vs, vr, va, vl;
140 unsigned long t2, t21, t22, t23; 142 unsigned long t2, t21, t22, t23;
141 unsigned short fraglen; 143 unsigned short fraglen;
@@ -242,7 +244,6 @@ extern int x25_validate_nr(struct sock *, unsigned short);
242extern void x25_write_internal(struct sock *, int); 244extern void x25_write_internal(struct sock *, int);
243extern int x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *, int *); 245extern int x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *, int *);
244extern void x25_disconnect(struct sock *, int, unsigned char, unsigned char); 246extern void x25_disconnect(struct sock *, int, unsigned char, unsigned char);
245extern int x25_check_calluserdata(struct x25_calluserdata *,struct x25_calluserdata *);
246 247
247/* x25_timer.c */ 248/* x25_timer.c */
248extern void x25_start_heartbeat(struct sock *); 249extern void x25_start_heartbeat(struct sock *);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 0e65e02b7a1d..029522a4ceda 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -204,6 +204,7 @@ struct xfrm_state_afinfo {
204 rwlock_t lock; 204 rwlock_t lock;
205 struct list_head *state_bydst; 205 struct list_head *state_bydst;
206 struct list_head *state_byspi; 206 struct list_head *state_byspi;
207 int (*init_flags)(struct xfrm_state *x);
207 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, 208 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl,
208 struct xfrm_tmpl *tmpl, 209 struct xfrm_tmpl *tmpl,
209 xfrm_address_t *daddr, xfrm_address_t *saddr); 210 xfrm_address_t *daddr, xfrm_address_t *saddr);
@@ -225,7 +226,7 @@ struct xfrm_type
225 struct module *owner; 226 struct module *owner;
226 __u8 proto; 227 __u8 proto;
227 228
228 int (*init_state)(struct xfrm_state *x, void *args); 229 int (*init_state)(struct xfrm_state *x);
229 void (*destructor)(struct xfrm_state *); 230 void (*destructor)(struct xfrm_state *);
230 int (*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); 231 int (*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb);
231 int (*post_input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); 232 int (*post_input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb);
@@ -839,6 +840,7 @@ extern int xfrm_replay_check(struct xfrm_state *x, u32 seq);
839extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq); 840extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq);
840extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb); 841extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb);
841extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); 842extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
843extern int xfrm_init_state(struct xfrm_state *x);
842extern int xfrm4_rcv(struct sk_buff *skb); 844extern int xfrm4_rcv(struct sk_buff *skb);
843extern int xfrm4_output(struct sk_buff *skb); 845extern int xfrm4_output(struct sk_buff *skb);
844extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); 846extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);