aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/9p/client.h18
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/bluetooth/hci.h6
-rw-r--r--include/net/bluetooth/hci_core.h5
-rw-r--r--include/net/cfg80211.h287
-rw-r--r--include/net/dst.h2
-rw-r--r--include/net/icmp.h2
-rw-r--r--include/net/ieee80211_radiotap.h4
-rw-r--r--include/net/if_inet6.h2
-rw-r--r--include/net/inet_sock.h4
-rw-r--r--include/net/ip.h9
-rw-r--r--include/net/ip6_fib.h4
-rw-r--r--include/net/ip_vs.h38
-rw-r--r--include/net/ipcomp.h2
-rw-r--r--include/net/ipv6.h8
-rw-r--r--include/net/llc.h39
-rw-r--r--include/net/llc_conn.h2
-rw-r--r--include/net/mac80211.h386
-rw-r--r--include/net/neighbour.h3
-rw-r--r--include/net/net_namespace.h2
-rw-r--r--include/net/netfilter/nf_conntrack.h12
-rw-r--r--include/net/netfilter/nf_conntrack_core.h3
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h58
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h16
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h2
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h8
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h4
-rw-r--r--include/net/netfilter/nf_conntrack_zones.h25
-rw-r--r--include/net/netfilter/nf_nat_helper.h32
-rw-r--r--include/net/netlink.h2
-rw-r--r--include/net/netns/conntrack.h5
-rw-r--r--include/net/netns/core.h2
-rw-r--r--include/net/netns/ipv4.h3
-rw-r--r--include/net/netns/ipv6.h2
-rw-r--r--include/net/netns/packet.h4
-rw-r--r--include/net/phonet/pep.h3
-rw-r--r--include/net/pkt_sched.h1
-rw-r--r--include/net/regulatory.h1
-rw-r--r--include/net/request_sock.h2
-rw-r--r--include/net/route.h2
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/net/sch_generic.h19
-rw-r--r--include/net/snmp.h14
-rw-r--r--include/net/sock.h17
-rw-r--r--include/net/tcp.h36
-rw-r--r--include/net/xfrm.h82
46 files changed, 901 insertions, 283 deletions
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index fb00b329f0d3..52e1fff709e4 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -29,6 +29,19 @@
29/* Number of requests per row */ 29/* Number of requests per row */
30#define P9_ROW_MAXTAG 255 30#define P9_ROW_MAXTAG 255
31 31
32/** enum p9_proto_versions - 9P protocol versions
33 * @p9_proto_legacy: 9P Legacy mode, pre-9P2000.u
34 * @p9_proto_2000u: 9P2000.u extension
35 * @p9_proto_2010L: 9P2010.L extension
36 */
37
38enum p9_proto_versions{
39 p9_proto_legacy = 0,
40 p9_proto_2000u = 1,
41 p9_proto_2010L = 2,
42};
43
44
32/** 45/**
33 * enum p9_trans_status - different states of underlying transports 46 * enum p9_trans_status - different states of underlying transports
34 * @Connected: transport is connected and healthy 47 * @Connected: transport is connected and healthy
@@ -111,6 +124,7 @@ struct p9_req_t {
111 * @lock: protect @fidlist 124 * @lock: protect @fidlist
112 * @msize: maximum data size negotiated by protocol 125 * @msize: maximum data size negotiated by protocol
113 * @dotu: extension flags negotiated by protocol 126 * @dotu: extension flags negotiated by protocol
127 * @proto_version: 9P protocol version to use
114 * @trans_mod: module API instantiated with this client 128 * @trans_mod: module API instantiated with this client
115 * @trans: tranport instance state and API 129 * @trans: tranport instance state and API
116 * @conn: connection state information used by trans_fd 130 * @conn: connection state information used by trans_fd
@@ -137,7 +151,7 @@ struct p9_req_t {
137struct p9_client { 151struct p9_client {
138 spinlock_t lock; /* protect client structure */ 152 spinlock_t lock; /* protect client structure */
139 int msize; 153 int msize;
140 unsigned char dotu; 154 unsigned char proto_version;
141 struct p9_trans_module *trans_mod; 155 struct p9_trans_module *trans_mod;
142 enum p9_trans_status status; 156 enum p9_trans_status status;
143 void *trans; 157 void *trans;
@@ -209,5 +223,7 @@ int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int);
209int p9stat_read(char *, int, struct p9_wstat *, int); 223int p9stat_read(char *, int, struct p9_wstat *, int);
210void p9stat_free(struct p9_wstat *); 224void p9stat_free(struct p9_wstat *);
211 225
226int p9_is_proto_dotu(struct p9_client *clnt);
227int p9_is_proto_dotl(struct p9_client *clnt);
212 228
213#endif /* NET_9P_CLIENT_H */ 229#endif /* NET_9P_CLIENT_H */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 0f7c37825fc1..45375b41a2a0 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -177,7 +177,9 @@ extern int unregister_inet6addr_notifier(struct notifier_block *nb);
177static inline struct inet6_dev * 177static inline struct inet6_dev *
178__in6_dev_get(struct net_device *dev) 178__in6_dev_get(struct net_device *dev)
179{ 179{
180 return rcu_dereference(dev->ip6_ptr); 180 return rcu_dereference_check(dev->ip6_ptr,
181 rcu_read_lock_held() ||
182 lockdep_rtnl_is_held());
181} 183}
182 184
183static inline struct inet6_dev * 185static inline struct inet6_dev *
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index ed3aea1605e8..fc0c502d9fd1 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -43,7 +43,7 @@
43#define HCI_NOTIFY_CONN_DEL 2 43#define HCI_NOTIFY_CONN_DEL 2
44#define HCI_NOTIFY_VOICE_SETTING 3 44#define HCI_NOTIFY_VOICE_SETTING 3
45 45
46/* HCI device types */ 46/* HCI bus types */
47#define HCI_VIRTUAL 0 47#define HCI_VIRTUAL 0
48#define HCI_USB 1 48#define HCI_USB 1
49#define HCI_PCCARD 2 49#define HCI_PCCARD 2
@@ -52,6 +52,10 @@
52#define HCI_PCI 5 52#define HCI_PCI 5
53#define HCI_SDIO 6 53#define HCI_SDIO 6
54 54
55/* HCI controller types */
56#define HCI_BREDR 0x00
57#define HCI_80211 0x01
58
55/* HCI device quirks */ 59/* HCI device quirks */
56enum { 60enum {
57 HCI_QUIRK_NO_RESET, 61 HCI_QUIRK_NO_RESET,
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7b86094a894b..ce3c99e5fa25 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -70,7 +70,8 @@ struct hci_dev {
70 char name[8]; 70 char name[8];
71 unsigned long flags; 71 unsigned long flags;
72 __u16 id; 72 __u16 id;
73 __u8 type; 73 __u8 bus;
74 __u8 dev_type;
74 bdaddr_t bdaddr; 75 bdaddr_t bdaddr;
75 __u8 dev_name[248]; 76 __u8 dev_name[248];
76 __u8 dev_class[3]; 77 __u8 dev_class[3];
@@ -134,6 +135,8 @@ struct hci_dev {
134 135
135 atomic_t promisc; 136 atomic_t promisc;
136 137
138 struct dentry *debugfs;
139
137 struct device *parent; 140 struct device *parent;
138 struct device dev; 141 struct device dev;
139 142
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0884b9a0f778..3d134a1fb96b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3,7 +3,7 @@
3/* 3/*
4 * 802.11 device and configuration interface 4 * 802.11 device and configuration interface
5 * 5 *
6 * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -39,8 +39,8 @@
39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
40 */ 40 */
41enum ieee80211_band { 41enum ieee80211_band {
42 IEEE80211_BAND_2GHZ, 42 IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
43 IEEE80211_BAND_5GHZ, 43 IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
44 44
45 /* keep last */ 45 /* keep last */
46 IEEE80211_NUM_BANDS 46 IEEE80211_NUM_BANDS
@@ -626,8 +626,14 @@ enum cfg80211_signal_type {
626 * @beacon_interval: the beacon interval as from the frame 626 * @beacon_interval: the beacon interval as from the frame
627 * @capability: the capability field in host byte order 627 * @capability: the capability field in host byte order
628 * @information_elements: the information elements (Note that there 628 * @information_elements: the information elements (Note that there
629 * is no guarantee that these are well-formed!) 629 * is no guarantee that these are well-formed!); this is a pointer to
630 * either the beacon_ies or proberesp_ies depending on whether Probe
631 * Response frame has been received
630 * @len_information_elements: total length of the information elements 632 * @len_information_elements: total length of the information elements
633 * @beacon_ies: the information elements from the last Beacon frame
634 * @len_beacon_ies: total length of the beacon_ies
635 * @proberesp_ies: the information elements from the last Probe Response frame
636 * @len_proberesp_ies: total length of the proberesp_ies
631 * @signal: signal strength value (type depends on the wiphy's signal_type) 637 * @signal: signal strength value (type depends on the wiphy's signal_type)
632 * @free_priv: function pointer to free private data 638 * @free_priv: function pointer to free private data
633 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 639 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
@@ -641,6 +647,10 @@ struct cfg80211_bss {
641 u16 capability; 647 u16 capability;
642 u8 *information_elements; 648 u8 *information_elements;
643 size_t len_information_elements; 649 size_t len_information_elements;
650 u8 *beacon_ies;
651 size_t len_beacon_ies;
652 u8 *proberesp_ies;
653 size_t len_proberesp_ies;
644 654
645 s32 signal; 655 s32 signal;
646 656
@@ -837,6 +847,7 @@ enum wiphy_params_flags {
837 WIPHY_PARAM_RETRY_LONG = 1 << 1, 847 WIPHY_PARAM_RETRY_LONG = 1 << 1,
838 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 848 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
839 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 849 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
850 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
840}; 851};
841 852
842/** 853/**
@@ -856,20 +867,11 @@ enum tx_power_setting {
856 * cfg80211_bitrate_mask - masks for bitrate control 867 * cfg80211_bitrate_mask - masks for bitrate control
857 */ 868 */
858struct cfg80211_bitrate_mask { 869struct cfg80211_bitrate_mask {
859/*
860 * As discussed in Berlin, this struct really
861 * should look like this:
862
863 struct { 870 struct {
864 u32 legacy; 871 u32 legacy;
865 u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; 872 /* TODO: add support for masking MCS rates; e.g.: */
873 /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */
866 } control[IEEE80211_NUM_BANDS]; 874 } control[IEEE80211_NUM_BANDS];
867
868 * Since we can always fix in-kernel users, let's keep
869 * it simpler for now:
870 */
871 u32 fixed; /* fixed bitrate, 0 == not fixed */
872 u32 maxrate; /* in kbps, 0 == no limit */
873}; 875};
874/** 876/**
875 * struct cfg80211_pmksa - PMK Security Association 877 * struct cfg80211_pmksa - PMK Security Association
@@ -988,6 +990,16 @@ struct cfg80211_pmksa {
988 * 990 *
989 * @dump_survey: get site survey information. 991 * @dump_survey: get site survey information.
990 * 992 *
993 * @remain_on_channel: Request the driver to remain awake on the specified
994 * channel for the specified duration to complete an off-channel
995 * operation (e.g., public action frame exchange). When the driver is
996 * ready on the requested channel, it must indicate this with an event
997 * notification by calling cfg80211_ready_on_channel().
998 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
999 * This allows the operation to be terminated prior to timeout based on
1000 * the duration value.
1001 * @action: Transmit an action frame
1002 *
991 * @testmode_cmd: run a test mode command 1003 * @testmode_cmd: run a test mode command
992 * 1004 *
993 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac 1005 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
@@ -1123,7 +1135,21 @@ struct cfg80211_ops {
1123 struct cfg80211_pmksa *pmksa); 1135 struct cfg80211_pmksa *pmksa);
1124 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 1136 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
1125 1137
1126 /* some temporary stuff to finish wext */ 1138 int (*remain_on_channel)(struct wiphy *wiphy,
1139 struct net_device *dev,
1140 struct ieee80211_channel *chan,
1141 enum nl80211_channel_type channel_type,
1142 unsigned int duration,
1143 u64 *cookie);
1144 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
1145 struct net_device *dev,
1146 u64 cookie);
1147
1148 int (*action)(struct wiphy *wiphy, struct net_device *dev,
1149 struct ieee80211_channel *chan,
1150 enum nl80211_channel_type channel_type,
1151 const u8 *buf, size_t len, u64 *cookie);
1152
1127 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1153 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1128 bool enabled, int timeout); 1154 bool enabled, int timeout);
1129}; 1155};
@@ -1174,6 +1200,10 @@ enum wiphy_flags {
1174 WIPHY_FLAG_4ADDR_STATION = BIT(6), 1200 WIPHY_FLAG_4ADDR_STATION = BIT(6),
1175}; 1201};
1176 1202
1203struct mac_address {
1204 u8 addr[ETH_ALEN];
1205};
1206
1177/** 1207/**
1178 * struct wiphy - wireless hardware description 1208 * struct wiphy - wireless hardware description
1179 * @idx: the wiphy index assigned to this item 1209 * @idx: the wiphy index assigned to this item
@@ -1192,12 +1222,28 @@ enum wiphy_flags {
1192 * -1 = fragmentation disabled, only odd values >= 256 used 1222 * -1 = fragmentation disabled, only odd values >= 256 used
1193 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1223 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
1194 * @net: the network namespace this wiphy currently lives in 1224 * @net: the network namespace this wiphy currently lives in
1225 * @perm_addr: permanent MAC address of this device
1226 * @addr_mask: If the device supports multiple MAC addresses by masking,
1227 * set this to a mask with variable bits set to 1, e.g. if the last
1228 * four bits are variable then set it to 00:...:00:0f. The actual
1229 * variable bits shall be determined by the interfaces added, with
1230 * interfaces not matching the mask being rejected to be brought up.
1231 * @n_addresses: number of addresses in @addresses.
1232 * @addresses: If the device has more than one address, set this pointer
1233 * to a list of addresses (6 bytes each). The first one will be used
1234 * by default for perm_addr. In this case, the mask should be set to
1235 * all-zeroes. In this case it is assumed that the device can handle
1236 * the same number of arbitrary MAC addresses.
1195 */ 1237 */
1196struct wiphy { 1238struct wiphy {
1197 /* assign these fields before you register the wiphy */ 1239 /* assign these fields before you register the wiphy */
1198 1240
1199 /* permanent MAC address */ 1241 /* permanent MAC address(es) */
1200 u8 perm_addr[ETH_ALEN]; 1242 u8 perm_addr[ETH_ALEN];
1243 u8 addr_mask[ETH_ALEN];
1244
1245 u16 n_addresses;
1246 struct mac_address *addresses;
1201 1247
1202 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 1248 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
1203 u16 interface_modes; 1249 u16 interface_modes;
@@ -1217,6 +1263,7 @@ struct wiphy {
1217 u8 retry_long; 1263 u8 retry_long;
1218 u32 frag_threshold; 1264 u32 frag_threshold;
1219 u32 rts_threshold; 1265 u32 rts_threshold;
1266 u8 coverage_class;
1220 1267
1221 char fw_version[ETHTOOL_BUSINFO_LEN]; 1268 char fw_version[ETHTOOL_BUSINFO_LEN];
1222 u32 hw_version; 1269 u32 hw_version;
@@ -1403,6 +1450,8 @@ struct cfg80211_cached_keys;
1403 * set by driver (if supported) on add_interface BEFORE registering the 1450 * set by driver (if supported) on add_interface BEFORE registering the
1404 * netdev and may otherwise be used by driver read-only, will be update 1451 * netdev and may otherwise be used by driver read-only, will be update
1405 * by cfg80211 on change_interface 1452 * by cfg80211 on change_interface
1453 * @action_registrations: list of registrations for action frames
1454 * @action_registrations_lock: lock for the list
1406 */ 1455 */
1407struct wireless_dev { 1456struct wireless_dev {
1408 struct wiphy *wiphy; 1457 struct wiphy *wiphy;
@@ -1412,6 +1461,9 @@ struct wireless_dev {
1412 struct list_head list; 1461 struct list_head list;
1413 struct net_device *netdev; 1462 struct net_device *netdev;
1414 1463
1464 struct list_head action_registrations;
1465 spinlock_t action_registrations_lock;
1466
1415 struct mutex mtx; 1467 struct mutex mtx;
1416 1468
1417 struct work_struct cleanup_work; 1469 struct work_struct cleanup_work;
@@ -1436,6 +1488,9 @@ struct wireless_dev {
1436 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; 1488 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
1437 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 1489 struct cfg80211_internal_bss *current_bss; /* associated / joined */
1438 1490
1491 bool ps;
1492 int ps_timeout;
1493
1439#ifdef CONFIG_CFG80211_WEXT 1494#ifdef CONFIG_CFG80211_WEXT
1440 /* wext data */ 1495 /* wext data */
1441 struct { 1496 struct {
@@ -1447,8 +1502,7 @@ struct wireless_dev {
1447 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 1502 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
1448 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1503 u8 ssid[IEEE80211_MAX_SSID_LEN];
1449 s8 default_key, default_mgmt_key; 1504 s8 default_key, default_mgmt_key;
1450 bool ps, prev_bssid_valid; 1505 bool prev_bssid_valid;
1451 int ps_timeout;
1452 } wext; 1506 } wext;
1453#endif 1507#endif
1454}; 1508};
@@ -1519,37 +1573,82 @@ ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
1519 * Documentation in Documentation/networking/radiotap-headers.txt 1573 * Documentation in Documentation/networking/radiotap-headers.txt
1520 */ 1574 */
1521 1575
1576struct radiotap_align_size {
1577 uint8_t align:4, size:4;
1578};
1579
1580struct ieee80211_radiotap_namespace {
1581 const struct radiotap_align_size *align_size;
1582 int n_bits;
1583 uint32_t oui;
1584 uint8_t subns;
1585};
1586
1587struct ieee80211_radiotap_vendor_namespaces {
1588 const struct ieee80211_radiotap_namespace *ns;
1589 int n_ns;
1590};
1591
1522/** 1592/**
1523 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 1593 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
1524 * @rtheader: pointer to the radiotap header we are walking through 1594 * @this_arg_index: index of current arg, valid after each successful call
1525 * @max_length: length of radiotap header in cpu byte ordering 1595 * to ieee80211_radiotap_iterator_next()
1526 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 1596 * @this_arg: pointer to current radiotap arg; it is valid after each
1527 * @this_arg: pointer to current radiotap arg 1597 * call to ieee80211_radiotap_iterator_next() but also after
1528 * @arg_index: internal next argument index 1598 * ieee80211_radiotap_iterator_init() where it will point to
1529 * @arg: internal next argument pointer 1599 * the beginning of the actual data portion
1530 * @next_bitmap: internal pointer to next present u32 1600 * @this_arg_size: length of the current arg, for convenience
1531 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 1601 * @current_namespace: pointer to the current namespace definition
1602 * (or internally %NULL if the current namespace is unknown)
1603 * @is_radiotap_ns: indicates whether the current namespace is the default
1604 * radiotap namespace or not
1605 *
1606 * @overrides: override standard radiotap fields
1607 * @n_overrides: number of overrides
1608 *
1609 * @_rtheader: pointer to the radiotap header we are walking through
1610 * @_max_length: length of radiotap header in cpu byte ordering
1611 * @_arg_index: next argument index
1612 * @_arg: next argument pointer
1613 * @_next_bitmap: internal pointer to next present u32
1614 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
1615 * @_vns: vendor namespace definitions
1616 * @_next_ns_data: beginning of the next namespace's data
1617 * @_reset_on_ext: internal; reset the arg index to 0 when going to the
1618 * next bitmap word
1619 *
1620 * Describes the radiotap parser state. Fields prefixed with an underscore
1621 * must not be used by users of the parser, only by the parser internally.
1532 */ 1622 */
1533 1623
1534struct ieee80211_radiotap_iterator { 1624struct ieee80211_radiotap_iterator {
1535 struct ieee80211_radiotap_header *rtheader; 1625 struct ieee80211_radiotap_header *_rtheader;
1536 int max_length; 1626 const struct ieee80211_radiotap_vendor_namespaces *_vns;
1627 const struct ieee80211_radiotap_namespace *current_namespace;
1628
1629 unsigned char *_arg, *_next_ns_data;
1630 uint32_t *_next_bitmap;
1631
1632 unsigned char *this_arg;
1537 int this_arg_index; 1633 int this_arg_index;
1538 u8 *this_arg; 1634 int this_arg_size;
1635
1636 int is_radiotap_ns;
1539 1637
1540 int arg_index; 1638 int _max_length;
1541 u8 *arg; 1639 int _arg_index;
1542 __le32 *next_bitmap; 1640 uint32_t _bitmap_shifter;
1543 u32 bitmap_shifter; 1641 int _reset_on_ext;
1544}; 1642};
1545 1643
1546extern int ieee80211_radiotap_iterator_init( 1644extern int ieee80211_radiotap_iterator_init(
1547 struct ieee80211_radiotap_iterator *iterator, 1645 struct ieee80211_radiotap_iterator *iterator,
1548 struct ieee80211_radiotap_header *radiotap_header, 1646 struct ieee80211_radiotap_header *radiotap_header,
1549 int max_length); 1647 int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns);
1550 1648
1551extern int ieee80211_radiotap_iterator_next( 1649extern int ieee80211_radiotap_iterator_next(
1552 struct ieee80211_radiotap_iterator *iterator); 1650 struct ieee80211_radiotap_iterator *iterator);
1651
1553 1652
1554extern const unsigned char rfc1042_header[6]; 1653extern const unsigned char rfc1042_header[6];
1555extern const unsigned char bridge_tunnel_header[6]; 1654extern const unsigned char bridge_tunnel_header[6];
@@ -1578,7 +1677,7 @@ unsigned int ieee80211_hdrlen(__le16 fc);
1578 * @addr: the device MAC address 1677 * @addr: the device MAC address
1579 * @iftype: the virtual interface type 1678 * @iftype: the virtual interface type
1580 */ 1679 */
1581int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr, 1680int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
1582 enum nl80211_iftype iftype); 1681 enum nl80211_iftype iftype);
1583 1682
1584/** 1683/**
@@ -1589,15 +1688,49 @@ int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr,
1589 * @bssid: the network bssid (used only for iftype STATION and ADHOC) 1688 * @bssid: the network bssid (used only for iftype STATION and ADHOC)
1590 * @qos: build 802.11 QoS data frame 1689 * @qos: build 802.11 QoS data frame
1591 */ 1690 */
1592int ieee80211_data_from_8023(struct sk_buff *skb, u8 *addr, 1691int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
1593 enum nl80211_iftype iftype, u8 *bssid, bool qos); 1692 enum nl80211_iftype iftype, u8 *bssid, bool qos);
1594 1693
1595/** 1694/**
1695 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
1696 *
1697 * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
1698 * 802.3 frames. The @list will be empty if the decode fails. The
1699 * @skb is consumed after the function returns.
1700 *
1701 * @skb: The input IEEE 802.11n A-MSDU frame.
1702 * @list: The output list of 802.3 frames. It must be allocated and
1703 * initialized by by the caller.
1704 * @addr: The device MAC address.
1705 * @iftype: The device interface type.
1706 * @extra_headroom: The hardware extra headroom for SKBs in the @list.
1707 */
1708void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
1709 const u8 *addr, enum nl80211_iftype iftype,
1710 const unsigned int extra_headroom);
1711
1712/**
1596 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 1713 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
1597 * @skb: the data frame 1714 * @skb: the data frame
1598 */ 1715 */
1599unsigned int cfg80211_classify8021d(struct sk_buff *skb); 1716unsigned int cfg80211_classify8021d(struct sk_buff *skb);
1600 1717
1718/**
1719 * cfg80211_find_ie - find information element in data
1720 *
1721 * @eid: element ID
1722 * @ies: data consisting of IEs
1723 * @len: length of data
1724 *
1725 * This function will return %NULL if the element ID could
1726 * not be found or if the element is invalid (claims to be
1727 * longer than the given data), or a pointer to the first byte
1728 * of the requested element, that is the byte containing the
1729 * element ID. There are no checks on the element length
1730 * other than having to fit into the given data.
1731 */
1732const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
1733
1601/* 1734/*
1602 * Regulatory helper functions for wiphys 1735 * Regulatory helper functions for wiphys
1603 */ 1736 */
@@ -2129,5 +2262,79 @@ void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
2129void cfg80211_disconnected(struct net_device *dev, u16 reason, 2262void cfg80211_disconnected(struct net_device *dev, u16 reason,
2130 u8 *ie, size_t ie_len, gfp_t gfp); 2263 u8 *ie, size_t ie_len, gfp_t gfp);
2131 2264
2265/**
2266 * cfg80211_ready_on_channel - notification of remain_on_channel start
2267 * @dev: network device
2268 * @cookie: the request cookie
2269 * @chan: The current channel (from remain_on_channel request)
2270 * @channel_type: Channel type
2271 * @duration: Duration in milliseconds that the driver intents to remain on the
2272 * channel
2273 * @gfp: allocation flags
2274 */
2275void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie,
2276 struct ieee80211_channel *chan,
2277 enum nl80211_channel_type channel_type,
2278 unsigned int duration, gfp_t gfp);
2279
2280/**
2281 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
2282 * @dev: network device
2283 * @cookie: the request cookie
2284 * @chan: The current channel (from remain_on_channel request)
2285 * @channel_type: Channel type
2286 * @gfp: allocation flags
2287 */
2288void cfg80211_remain_on_channel_expired(struct net_device *dev,
2289 u64 cookie,
2290 struct ieee80211_channel *chan,
2291 enum nl80211_channel_type channel_type,
2292 gfp_t gfp);
2293
2294
2295/**
2296 * cfg80211_new_sta - notify userspace about station
2297 *
2298 * @dev: the netdev
2299 * @mac_addr: the station's address
2300 * @sinfo: the station information
2301 * @gfp: allocation flags
2302 */
2303void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
2304 struct station_info *sinfo, gfp_t gfp);
2305
2306/**
2307 * cfg80211_rx_action - notification of received, unprocessed Action frame
2308 * @dev: network device
2309 * @freq: Frequency on which the frame was received in MHz
2310 * @buf: Action frame (header + body)
2311 * @len: length of the frame data
2312 * @gfp: context flags
2313 * Returns %true if a user space application is responsible for rejecting the
2314 * unrecognized Action frame; %false if no such application is registered
2315 * (i.e., the driver is responsible for rejecting the unrecognized Action
2316 * frame)
2317 *
2318 * This function is called whenever an Action frame is received for a station
2319 * mode interface, but is not processed in kernel.
2320 */
2321bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf,
2322 size_t len, gfp_t gfp);
2323
2324/**
2325 * cfg80211_action_tx_status - notification of TX status for Action frame
2326 * @dev: network device
2327 * @cookie: Cookie returned by cfg80211_ops::action()
2328 * @buf: Action frame (header + body)
2329 * @len: length of the frame data
2330 * @ack: Whether frame was acknowledged
2331 * @gfp: context flags
2332 *
2333 * This function is called whenever an Action frame was requested to be
2334 * transmitted with cfg80211_ops::action() to report the TX status of the
2335 * transmission attempt.
2336 */
2337void cfg80211_action_tx_status(struct net_device *dev, u64 cookie,
2338 const u8 *buf, size_t len, bool ack, gfp_t gfp);
2132 2339
2133#endif /* __NET_CFG80211_H */ 2340#endif /* __NET_CFG80211_H */
diff --git a/include/net/dst.h b/include/net/dst.h
index 39c4a5963e12..ce078cda6b74 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -83,8 +83,6 @@ struct dst_entry {
83 * (L1_CACHE_SIZE would be too much) 83 * (L1_CACHE_SIZE would be too much)
84 */ 84 */
85#ifdef CONFIG_64BIT 85#ifdef CONFIG_64BIT
86 long __pad_to_align_refcnt[2];
87#else
88 long __pad_to_align_refcnt[1]; 86 long __pad_to_align_refcnt[1];
89#endif 87#endif
90 /* 88 /*
diff --git a/include/net/icmp.h b/include/net/icmp.h
index dfa72d4e8907..15b3dfe9fce8 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -28,7 +28,7 @@ struct icmp_err {
28 unsigned fatal:1; 28 unsigned fatal:1;
29}; 29};
30 30
31extern struct icmp_err icmp_err_convert[]; 31extern const struct icmp_err icmp_err_convert[];
32#define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) 32#define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field)
33#define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field) 33#define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field)
34#define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmpmsg_statistics, field+256) 34#define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmpmsg_statistics, field+256)
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 9d3d86aaccbb..af49f8ab7f81 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -198,6 +198,10 @@ enum ieee80211_radiotap_type {
198 IEEE80211_RADIOTAP_TX_FLAGS = 15, 198 IEEE80211_RADIOTAP_TX_FLAGS = 15,
199 IEEE80211_RADIOTAP_RTS_RETRIES = 16, 199 IEEE80211_RADIOTAP_RTS_RETRIES = 16,
200 IEEE80211_RADIOTAP_DATA_RETRIES = 17, 200 IEEE80211_RADIOTAP_DATA_RETRIES = 17,
201
202 /* valid in every it_present bitmap, even vendor namespaces */
203 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
204 IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30,
201 IEEE80211_RADIOTAP_EXT = 31 205 IEEE80211_RADIOTAP_EXT = 31
202}; 206};
203 207
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index e9d69d198495..545d8b059bef 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -157,7 +157,7 @@ struct inet6_dev {
157 157
158 struct ifmcaddr6 *mc_list; 158 struct ifmcaddr6 *mc_list;
159 struct ifmcaddr6 *mc_tomb; 159 struct ifmcaddr6 *mc_tomb;
160 rwlock_t mc_lock; 160 spinlock_t mc_lock;
161 unsigned char mc_qrv; 161 unsigned char mc_qrv;
162 unsigned char mc_gq_running; 162 unsigned char mc_gq_running;
163 unsigned char mc_ifc_count; 163 unsigned char mc_ifc_count;
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index bd4c53f75ac0..83fd34437cf1 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -122,10 +122,12 @@ struct inet_sock {
122 __be32 inet_saddr; 122 __be32 inet_saddr;
123 __s16 uc_ttl; 123 __s16 uc_ttl;
124 __u16 cmsg_flags; 124 __u16 cmsg_flags;
125 struct ip_options *opt;
126 __be16 inet_sport; 125 __be16 inet_sport;
127 __u16 inet_id; 126 __u16 inet_id;
127
128 struct ip_options *opt;
128 __u8 tos; 129 __u8 tos;
130 __u8 min_ttl;
129 __u8 mc_ttl; 131 __u8 mc_ttl;
130 __u8 pmtudisc; 132 __u8 pmtudisc;
131 __u8 recverr:1, 133 __u8 recverr:1,
diff --git a/include/net/ip.h b/include/net/ip.h
index fb63371c07a8..503994a38ed1 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -174,9 +174,9 @@ extern struct ipv4_config ipv4_config;
174#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) 174#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
175#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 175#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
176 176
177extern unsigned long snmp_fold_field(void *mib[], int offt); 177extern unsigned long snmp_fold_field(void __percpu *mib[], int offt);
178extern int snmp_mib_init(void *ptr[2], size_t mibsize); 178extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize);
179extern void snmp_mib_free(void *ptr[2]); 179extern void snmp_mib_free(void __percpu *ptr[2]);
180 180
181extern struct local_ports { 181extern struct local_ports {
182 seqlock_t lock; 182 seqlock_t lock;
@@ -352,8 +352,11 @@ enum ip_defrag_users {
352 IP_DEFRAG_LOCAL_DELIVER, 352 IP_DEFRAG_LOCAL_DELIVER,
353 IP_DEFRAG_CALL_RA_CHAIN, 353 IP_DEFRAG_CALL_RA_CHAIN,
354 IP_DEFRAG_CONNTRACK_IN, 354 IP_DEFRAG_CONNTRACK_IN,
355 __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHORT_MAX,
355 IP_DEFRAG_CONNTRACK_OUT, 356 IP_DEFRAG_CONNTRACK_OUT,
357 __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHORT_MAX,
356 IP_DEFRAG_CONNTRACK_BRIDGE_IN, 358 IP_DEFRAG_CONNTRACK_BRIDGE_IN,
359 __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX,
357 IP_DEFRAG_VS_IN, 360 IP_DEFRAG_VS_IN,
358 IP_DEFRAG_VS_OUT, 361 IP_DEFRAG_VS_OUT,
359 IP_DEFRAG_VS_FWD 362 IP_DEFRAG_VS_FWD
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 257808188add..86f46c49e318 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -124,11 +124,13 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
124} 124}
125 125
126struct fib6_walker_t { 126struct fib6_walker_t {
127 struct fib6_walker_t *prev, *next; 127 struct list_head lh;
128 struct fib6_node *root, *node; 128 struct fib6_node *root, *node;
129 struct rt6_info *leaf; 129 struct rt6_info *leaf;
130 unsigned char state; 130 unsigned char state;
131 unsigned char prune; 131 unsigned char prune;
132 unsigned int skip;
133 unsigned int count;
132 int (*func)(struct fib6_walker_t *); 134 int (*func)(struct fib6_walker_t *);
133 void *args; 135 void *args;
134}; 136};
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 8dc3296b7bea..fe82b1e10a29 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -26,6 +26,11 @@
26#include <linux/ipv6.h> /* for struct ipv6hdr */ 26#include <linux/ipv6.h> /* for struct ipv6hdr */
27#include <net/ipv6.h> /* for ipv6_addr_copy */ 27#include <net/ipv6.h> /* for ipv6_addr_copy */
28 28
29
30/* Connections' size value needed by ip_vs_ctl.c */
31extern int ip_vs_conn_tab_size;
32
33
29struct ip_vs_iphdr { 34struct ip_vs_iphdr {
30 int len; 35 int len;
31 __u8 protocol; 36 __u8 protocol;
@@ -220,6 +225,26 @@ enum {
220}; 225};
221 226
222/* 227/*
228 * SCTP State Values
229 */
230enum ip_vs_sctp_states {
231 IP_VS_SCTP_S_NONE,
232 IP_VS_SCTP_S_INIT_CLI,
233 IP_VS_SCTP_S_INIT_SER,
234 IP_VS_SCTP_S_INIT_ACK_CLI,
235 IP_VS_SCTP_S_INIT_ACK_SER,
236 IP_VS_SCTP_S_ECHO_CLI,
237 IP_VS_SCTP_S_ECHO_SER,
238 IP_VS_SCTP_S_ESTABLISHED,
239 IP_VS_SCTP_S_SHUT_CLI,
240 IP_VS_SCTP_S_SHUT_SER,
241 IP_VS_SCTP_S_SHUT_ACK_CLI,
242 IP_VS_SCTP_S_SHUT_ACK_SER,
243 IP_VS_SCTP_S_CLOSED,
244 IP_VS_SCTP_S_LAST
245};
246
247/*
223 * Delta sequence info structure 248 * Delta sequence info structure
224 * Each ip_vs_conn has 2 (output AND input seq. changes). 249 * Each ip_vs_conn has 2 (output AND input seq. changes).
225 * Only used in the VS/NAT. 250 * Only used in the VS/NAT.
@@ -592,17 +617,6 @@ extern void ip_vs_init_hash_table(struct list_head *table, int rows);
592 * (from ip_vs_conn.c) 617 * (from ip_vs_conn.c)
593 */ 618 */
594 619
595/*
596 * IPVS connection entry hash table
597 */
598#ifndef CONFIG_IP_VS_TAB_BITS
599#define CONFIG_IP_VS_TAB_BITS 12
600#endif
601
602#define IP_VS_CONN_TAB_BITS CONFIG_IP_VS_TAB_BITS
603#define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS)
604#define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1)
605
606enum { 620enum {
607 IP_VS_DIR_INPUT = 0, 621 IP_VS_DIR_INPUT = 0,
608 IP_VS_DIR_OUTPUT, 622 IP_VS_DIR_OUTPUT,
@@ -747,7 +761,7 @@ extern struct ip_vs_protocol ip_vs_protocol_udp;
747extern struct ip_vs_protocol ip_vs_protocol_icmp; 761extern struct ip_vs_protocol ip_vs_protocol_icmp;
748extern struct ip_vs_protocol ip_vs_protocol_esp; 762extern struct ip_vs_protocol ip_vs_protocol_esp;
749extern struct ip_vs_protocol ip_vs_protocol_ah; 763extern struct ip_vs_protocol ip_vs_protocol_ah;
750 764extern struct ip_vs_protocol ip_vs_protocol_sctp;
751 765
752/* 766/*
753 * Registering/unregistering scheduler functions 767 * Registering/unregistering scheduler functions
diff --git a/include/net/ipcomp.h b/include/net/ipcomp.h
index 2a1092abaa07..cc4f30cd7315 100644
--- a/include/net/ipcomp.h
+++ b/include/net/ipcomp.h
@@ -9,7 +9,7 @@ struct crypto_comp;
9 9
10struct ipcomp_data { 10struct ipcomp_data {
11 u16 threshold; 11 u16 threshold;
12 struct crypto_comp **tfms; 12 struct crypto_comp * __percpu *tfms;
13}; 13};
14 14
15struct ip_comp_hdr; 15struct ip_comp_hdr;
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index ccab5946c830..e72fb10ce573 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -73,7 +73,6 @@
73#define IPV6_ADDR_SCOPE_MASK 0x00f0U 73#define IPV6_ADDR_SCOPE_MASK 0x00f0U
74 74
75#define IPV6_ADDR_MAPPED 0x1000U 75#define IPV6_ADDR_MAPPED 0x1000U
76#define IPV6_ADDR_RESERVED 0x2000U /* reserved address space */
77 76
78/* 77/*
79 * Addr scopes 78 * Addr scopes
@@ -246,7 +245,9 @@ extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb);
246int ip6_frag_nqueues(struct net *net); 245int ip6_frag_nqueues(struct net *net);
247int ip6_frag_mem(struct net *net); 246int ip6_frag_mem(struct net *net);
248 247
249#define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ 248#define IPV6_FRAG_HIGH_THRESH (256 * 1024) /* 262144 */
249#define IPV6_FRAG_LOW_THRESH (192 * 1024) /* 196608 */
250#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */
250 251
251extern int __ipv6_addr_type(const struct in6_addr *addr); 252extern int __ipv6_addr_type(const struct in6_addr *addr);
252static inline int ipv6_addr_type(const struct in6_addr *addr) 253static inline int ipv6_addr_type(const struct in6_addr *addr)
@@ -353,8 +354,11 @@ struct inet_frag_queue;
353enum ip6_defrag_users { 354enum ip6_defrag_users {
354 IP6_DEFRAG_LOCAL_DELIVER, 355 IP6_DEFRAG_LOCAL_DELIVER,
355 IP6_DEFRAG_CONNTRACK_IN, 356 IP6_DEFRAG_CONNTRACK_IN,
357 __IP6_DEFRAG_CONNTRACK_IN = IP6_DEFRAG_CONNTRACK_IN + USHORT_MAX,
356 IP6_DEFRAG_CONNTRACK_OUT, 358 IP6_DEFRAG_CONNTRACK_OUT,
359 __IP6_DEFRAG_CONNTRACK_OUT = IP6_DEFRAG_CONNTRACK_OUT + USHORT_MAX,
357 IP6_DEFRAG_CONNTRACK_BRIDGE_IN, 360 IP6_DEFRAG_CONNTRACK_BRIDGE_IN,
361 __IP6_DEFRAG_CONNTRACK_BRIDGE_IN = IP6_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX,
358}; 362};
359 363
360struct ip6_create_arg { 364struct ip6_create_arg {
diff --git a/include/net/llc.h b/include/net/llc.h
index 7940da1606e7..5503b74ab170 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -16,6 +16,9 @@
16#include <linux/if_ether.h> 16#include <linux/if_ether.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/rculist_nulls.h>
20#include <linux/hash.h>
21#include <linux/jhash.h>
19 22
20#include <asm/atomic.h> 23#include <asm/atomic.h>
21 24
@@ -31,6 +34,12 @@ struct llc_addr {
31#define LLC_SAP_STATE_INACTIVE 1 34#define LLC_SAP_STATE_INACTIVE 1
32#define LLC_SAP_STATE_ACTIVE 2 35#define LLC_SAP_STATE_ACTIVE 2
33 36
37#define LLC_SK_DEV_HASH_BITS 6
38#define LLC_SK_DEV_HASH_ENTRIES (1<<LLC_SK_DEV_HASH_BITS)
39
40#define LLC_SK_LADDR_HASH_BITS 6
41#define LLC_SK_LADDR_HASH_ENTRIES (1<<LLC_SK_LADDR_HASH_BITS)
42
34/** 43/**
35 * struct llc_sap - Defines the SAP component 44 * struct llc_sap - Defines the SAP component
36 * 45 *
@@ -53,18 +62,38 @@ struct llc_sap {
53 struct net_device *orig_dev); 62 struct net_device *orig_dev);
54 struct llc_addr laddr; 63 struct llc_addr laddr;
55 struct list_head node; 64 struct list_head node;
56 struct { 65 spinlock_t sk_lock;
57 rwlock_t lock; 66 int sk_count;
58 struct hlist_head list; 67 struct hlist_nulls_head sk_laddr_hash[LLC_SK_LADDR_HASH_ENTRIES];
59 } sk_list; 68 struct hlist_head sk_dev_hash[LLC_SK_DEV_HASH_ENTRIES];
60}; 69};
61 70
71static inline
72struct hlist_head *llc_sk_dev_hash(struct llc_sap *sap, int ifindex)
73{
74 return &sap->sk_dev_hash[ifindex % LLC_SK_DEV_HASH_ENTRIES];
75}
76
77static inline
78u32 llc_sk_laddr_hashfn(struct llc_sap *sap, const struct llc_addr *laddr)
79{
80 return hash_32(jhash(laddr->mac, sizeof(laddr->mac), 0),
81 LLC_SK_LADDR_HASH_BITS);
82}
83
84static inline
85struct hlist_nulls_head *llc_sk_laddr_hash(struct llc_sap *sap,
86 const struct llc_addr *laddr)
87{
88 return &sap->sk_laddr_hash[llc_sk_laddr_hashfn(sap, laddr)];
89}
90
62#define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ 91#define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */
63#define LLC_DEST_SAP 1 /* Type 1 goes here */ 92#define LLC_DEST_SAP 1 /* Type 1 goes here */
64#define LLC_DEST_CONN 2 /* Type 2 goes here */ 93#define LLC_DEST_CONN 2 /* Type 2 goes here */
65 94
66extern struct list_head llc_sap_list; 95extern struct list_head llc_sap_list;
67extern rwlock_t llc_sap_list_lock; 96extern spinlock_t llc_sap_list_lock;
68 97
69extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, 98extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
70 struct packet_type *pt, struct net_device *orig_dev); 99 struct packet_type *pt, struct net_device *orig_dev);
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h
index e2374e34989f..2f97d8ddce92 100644
--- a/include/net/llc_conn.h
+++ b/include/net/llc_conn.h
@@ -76,6 +76,8 @@ struct llc_sock {
76 u32 rx_pdu_hdr; /* used for saving header of last pdu 76 u32 rx_pdu_hdr; /* used for saving header of last pdu
77 received and caused sending FRMR. 77 received and caused sending FRMR.
78 Used for resending FRMR */ 78 Used for resending FRMR */
79 u32 cmsg_flags;
80 struct hlist_node dev_hash_node;
79}; 81};
80 82
81static inline struct llc_sock *llc_sk(const struct sock *sk) 83static inline struct llc_sock *llc_sk(const struct sock *sk)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 0bf369752274..80eb7cc42ce9 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright 2002-2005, Devicescape Software, Inc. 4 * Copyright 2002-2005, Devicescape Software, Inc.
5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
6 * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -107,25 +107,14 @@ enum ieee80211_max_queues {
107 * 2^n-1 in the range 1..32767] 107 * 2^n-1 in the range 1..32767]
108 * @cw_max: maximum contention window [like @cw_min] 108 * @cw_max: maximum contention window [like @cw_min]
109 * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled 109 * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
110 * @uapsd: is U-APSD mode enabled for the queue
110 */ 111 */
111struct ieee80211_tx_queue_params { 112struct ieee80211_tx_queue_params {
112 u16 txop; 113 u16 txop;
113 u16 cw_min; 114 u16 cw_min;
114 u16 cw_max; 115 u16 cw_max;
115 u8 aifs; 116 u8 aifs;
116}; 117 bool uapsd;
117
118/**
119 * struct ieee80211_tx_queue_stats - transmit queue statistics
120 *
121 * @len: number of packets in queue
122 * @limit: queue length limit
123 * @count: number of frames sent
124 */
125struct ieee80211_tx_queue_stats {
126 unsigned int len;
127 unsigned int limit;
128 unsigned int count;
129}; 118};
130 119
131struct ieee80211_low_level_stats { 120struct ieee80211_low_level_stats {
@@ -184,7 +173,8 @@ enum ieee80211_bss_change {
184 * @use_short_slot: use short slot time (only relevant for ERP); 173 * @use_short_slot: use short slot time (only relevant for ERP);
185 * if the hardware cannot handle this it must set the 174 * if the hardware cannot handle this it must set the
186 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag 175 * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
187 * @dtim_period: num of beacons before the next DTIM, for PSM 176 * @dtim_period: num of beacons before the next DTIM, for beaconing,
177 * not valid in station mode (cf. hw conf ps_dtim_period)
188 * @timestamp: beacon timestamp 178 * @timestamp: beacon timestamp
189 * @beacon_int: beacon interval 179 * @beacon_int: beacon interval
190 * @assoc_capability: capabilities taken from assoc resp 180 * @assoc_capability: capabilities taken from assoc resp
@@ -255,9 +245,6 @@ struct ieee80211_bss_conf {
255 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be 245 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
256 * set by rate control algorithms to indicate probe rate, will 246 * set by rate control algorithms to indicate probe rate, will
257 * be cleared for fragmented frames (except on the last fragment) 247 * be cleared for fragmented frames (except on the last fragment)
258 * @IEEE80211_TX_INTFL_RCALGO: mac80211 internal flag, do not test or
259 * set this flag in the driver; indicates that the rate control
260 * algorithm was used and should be notified of TX status
261 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, 248 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211,
262 * used to indicate that a pending frame requires TX processing before 249 * used to indicate that a pending frame requires TX processing before
263 * it can be sent out. 250 * it can be sent out.
@@ -272,6 +259,14 @@ struct ieee80211_bss_conf {
272 * transmit function after the current frame, this can be used 259 * transmit function after the current frame, this can be used
273 * by drivers to kick the DMA queue only if unset or when the 260 * by drivers to kick the DMA queue only if unset or when the
274 * queue gets full. 261 * queue gets full.
262 * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted
263 * after TX status because the destination was asleep, it must not
264 * be modified again (no seqno assignment, crypto, etc.)
265 * @IEEE80211_TX_INTFL_HAS_RADIOTAP: This frame was injected and still
266 * has a radiotap header at skb->data.
267 * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211
268 * MLME command (internal to mac80211 to figure out whether to send TX
269 * status to user space)
275 */ 270 */
276enum mac80211_tx_control_flags { 271enum mac80211_tx_control_flags {
277 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 272 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -287,12 +282,14 @@ enum mac80211_tx_control_flags {
287 IEEE80211_TX_STAT_AMPDU = BIT(10), 282 IEEE80211_TX_STAT_AMPDU = BIT(10),
288 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), 283 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
289 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), 284 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
290 IEEE80211_TX_INTFL_RCALGO = BIT(13),
291 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 285 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
292 IEEE80211_TX_INTFL_RETRIED = BIT(15), 286 IEEE80211_TX_INTFL_RETRIED = BIT(15),
293 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), 287 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
294 IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17), 288 IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17),
295 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), 289 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
290 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
291 IEEE80211_TX_INTFL_HAS_RADIOTAP = BIT(20),
292 IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21),
296}; 293};
297 294
298/** 295/**
@@ -571,7 +568,13 @@ struct ieee80211_rx_status {
571 * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this 568 * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this
572 * to determine for example whether to calculate timestamps for packets 569 * to determine for example whether to calculate timestamps for packets
573 * or not, do not use instead of filter flags! 570 * or not, do not use instead of filter flags!
574 * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only) 571 * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only).
572 * This is the power save mode defined by IEEE 802.11-2007 section 11.2,
573 * meaning that the hardware still wakes up for beacons, is able to
574 * transmit frames and receive the possible acknowledgment frames.
575 * Not to be confused with hardware specific wakeup/sleep states,
576 * driver is responsible for that. See the section "Powersave support"
577 * for more.
575 * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set 578 * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set
576 * the driver should be prepared to handle configuration requests but 579 * the driver should be prepared to handle configuration requests but
577 * may turn the device off as much as possible. Typically, this flag will 580 * may turn the device off as much as possible. Typically, this flag will
@@ -595,8 +598,10 @@ enum ieee80211_conf_flags {
595 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed 598 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
596 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 599 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
597 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed 600 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
601 * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed
598 */ 602 */
599enum ieee80211_conf_changed { 603enum ieee80211_conf_changed {
604 IEEE80211_CONF_CHANGE_SMPS = BIT(1),
600 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 605 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
601 IEEE80211_CONF_CHANGE_MONITOR = BIT(3), 606 IEEE80211_CONF_CHANGE_MONITOR = BIT(3),
602 IEEE80211_CONF_CHANGE_PS = BIT(4), 607 IEEE80211_CONF_CHANGE_PS = BIT(4),
@@ -607,6 +612,25 @@ enum ieee80211_conf_changed {
607}; 612};
608 613
609/** 614/**
615 * enum ieee80211_smps_mode - spatial multiplexing power save mode
616 *
617 * @IEEE80211_SMPS_AUTOMATIC: automatic
618 * @IEEE80211_SMPS_OFF: off
619 * @IEEE80211_SMPS_STATIC: static
620 * @IEEE80211_SMPS_DYNAMIC: dynamic
621 * @IEEE80211_SMPS_NUM_MODES: internal, don't use
622 */
623enum ieee80211_smps_mode {
624 IEEE80211_SMPS_AUTOMATIC,
625 IEEE80211_SMPS_OFF,
626 IEEE80211_SMPS_STATIC,
627 IEEE80211_SMPS_DYNAMIC,
628
629 /* keep last */
630 IEEE80211_SMPS_NUM_MODES,
631};
632
633/**
610 * struct ieee80211_conf - configuration of the device 634 * struct ieee80211_conf - configuration of the device
611 * 635 *
612 * This struct indicates how the driver shall configure the hardware. 636 * This struct indicates how the driver shall configure the hardware.
@@ -619,6 +643,9 @@ enum ieee80211_conf_changed {
619 * value will be only achievable between DTIM frames, the hardware 643 * value will be only achievable between DTIM frames, the hardware
620 * needs to check for the multicast traffic bit in DTIM beacons. 644 * needs to check for the multicast traffic bit in DTIM beacons.
621 * This variable is valid only when the CONF_PS flag is set. 645 * This variable is valid only when the CONF_PS flag is set.
646 * @ps_dtim_period: The DTIM period of the AP we're connected to, for use
647 * in power saving. Power saving will not be enabled until a beacon
648 * has been received and the DTIM period is known.
622 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the 649 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
623 * powersave documentation below. This variable is valid only when 650 * powersave documentation below. This variable is valid only when
624 * the CONF_PS flag is set. 651 * the CONF_PS flag is set.
@@ -634,6 +661,10 @@ enum ieee80211_conf_changed {
634 * @short_frame_max_tx_count: Maximum number of transmissions for a "short" 661 * @short_frame_max_tx_count: Maximum number of transmissions for a "short"
635 * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the 662 * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the
636 * number of transmissions not the number of retries 663 * number of transmissions not the number of retries
664 *
665 * @smps_mode: spatial multiplexing powersave mode; note that
666 * %IEEE80211_SMPS_STATIC is used when the device is not
667 * configured for an HT channel
637 */ 668 */
638struct ieee80211_conf { 669struct ieee80211_conf {
639 u32 flags; 670 u32 flags;
@@ -641,11 +672,13 @@ struct ieee80211_conf {
641 int max_sleep_period; 672 int max_sleep_period;
642 673
643 u16 listen_interval; 674 u16 listen_interval;
675 u8 ps_dtim_period;
644 676
645 u8 long_frame_max_tx_count, short_frame_max_tx_count; 677 u8 long_frame_max_tx_count, short_frame_max_tx_count;
646 678
647 struct ieee80211_channel *channel; 679 struct ieee80211_channel *channel;
648 enum nl80211_channel_type channel_type; 680 enum nl80211_channel_type channel_type;
681 enum ieee80211_smps_mode smps_mode;
649}; 682};
650 683
651/** 684/**
@@ -657,12 +690,14 @@ struct ieee80211_conf {
657 * @type: type of this virtual interface 690 * @type: type of this virtual interface
658 * @bss_conf: BSS configuration for this interface, either our own 691 * @bss_conf: BSS configuration for this interface, either our own
659 * or the BSS we're associated to 692 * or the BSS we're associated to
693 * @addr: address of this interface
660 * @drv_priv: data area for driver use, will always be aligned to 694 * @drv_priv: data area for driver use, will always be aligned to
661 * sizeof(void *). 695 * sizeof(void *).
662 */ 696 */
663struct ieee80211_vif { 697struct ieee80211_vif {
664 enum nl80211_iftype type; 698 enum nl80211_iftype type;
665 struct ieee80211_bss_conf bss_conf; 699 struct ieee80211_bss_conf bss_conf;
700 u8 addr[ETH_ALEN];
666 /* must be last */ 701 /* must be last */
667 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 702 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
668}; 703};
@@ -676,33 +711,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
676} 711}
677 712
678/** 713/**
679 * struct ieee80211_if_init_conf - initial configuration of an interface
680 *
681 * @vif: pointer to a driver-use per-interface structure. The pointer
682 * itself is also used for various functions including
683 * ieee80211_beacon_get() and ieee80211_get_buffered_bc().
684 * @type: one of &enum nl80211_iftype constants. Determines the type of
685 * added/removed interface.
686 * @mac_addr: pointer to MAC address of the interface. This pointer is valid
687 * until the interface is removed (i.e. it cannot be used after
688 * remove_interface() callback was called for this interface).
689 *
690 * This structure is used in add_interface() and remove_interface()
691 * callbacks of &struct ieee80211_hw.
692 *
693 * When you allow multiple interfaces to be added to your PHY, take care
694 * that the hardware can actually handle multiple MAC addresses. However,
695 * also take care that when there's no interface left with mac_addr != %NULL
696 * you remove the MAC address from the device to avoid acknowledging packets
697 * in pure monitor mode.
698 */
699struct ieee80211_if_init_conf {
700 enum nl80211_iftype type;
701 struct ieee80211_vif *vif;
702 void *mac_addr;
703};
704
705/**
706 * enum ieee80211_key_alg - key algorithm 714 * enum ieee80211_key_alg - key algorithm
707 * @ALG_WEP: WEP40 or WEP104 715 * @ALG_WEP: WEP40 or WEP104
708 * @ALG_TKIP: TKIP 716 * @ALG_TKIP: TKIP
@@ -797,7 +805,7 @@ enum set_key_cmd {
797 * mac80211, any ieee80211_sta pointer you get access to must 805 * mac80211, any ieee80211_sta pointer you get access to must
798 * either be protected by rcu_read_lock() explicitly or implicitly, 806 * either be protected by rcu_read_lock() explicitly or implicitly,
799 * or you must take good care to not use such a pointer after a 807 * or you must take good care to not use such a pointer after a
800 * call to your sta_notify callback that removed it. 808 * call to your sta_remove callback that removed it.
801 * 809 *
802 * @addr: MAC address 810 * @addr: MAC address
803 * @aid: AID we assigned to the station if we're an AP 811 * @aid: AID we assigned to the station if we're an AP
@@ -823,8 +831,8 @@ struct ieee80211_sta {
823 * indicates addition and removal of a station to station table, 831 * indicates addition and removal of a station to station table,
824 * or if a associated station made a power state transition. 832 * or if a associated station made a power state transition.
825 * 833 *
826 * @STA_NOTIFY_ADD: a station was added to the station table 834 * @STA_NOTIFY_ADD: (DEPRECATED) a station was added to the station table
827 * @STA_NOTIFY_REMOVE: a station being removed from the station table 835 * @STA_NOTIFY_REMOVE: (DEPRECATED) a station being removed from the station table
828 * @STA_NOTIFY_SLEEP: a station is now sleeping 836 * @STA_NOTIFY_SLEEP: a station is now sleeping
829 * @STA_NOTIFY_AWAKE: a sleeping station woke up 837 * @STA_NOTIFY_AWAKE: a sleeping station woke up
830 */ 838 */
@@ -926,6 +934,26 @@ enum ieee80211_tkip_key_type {
926 * @IEEE80211_HW_BEACON_FILTER: 934 * @IEEE80211_HW_BEACON_FILTER:
927 * Hardware supports dropping of irrelevant beacon frames to 935 * Hardware supports dropping of irrelevant beacon frames to
928 * avoid waking up cpu. 936 * avoid waking up cpu.
937 *
938 * @IEEE80211_HW_SUPPORTS_STATIC_SMPS:
939 * Hardware supports static spatial multiplexing powersave,
940 * ie. can turn off all but one chain even on HT connections
941 * that should be using more chains.
942 *
943 * @IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS:
944 * Hardware supports dynamic spatial multiplexing powersave,
945 * ie. can turn off all but one chain and then wake the rest
946 * up as required after, for example, rts/cts handshake.
947 *
948 * @IEEE80211_HW_SUPPORTS_UAPSD:
949 * Hardware supports Unscheduled Automatic Power Save Delivery
950 * (U-APSD) in managed mode. The mode is configured with
951 * conf_tx() operation.
952 *
953 * @IEEE80211_HW_REPORTS_TX_ACK_STATUS:
954 * Hardware can provide ack status reports of Tx frames to
955 * the stack.
956 *
929 */ 957 */
930enum ieee80211_hw_flags { 958enum ieee80211_hw_flags {
931 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 959 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -943,6 +971,10 @@ enum ieee80211_hw_flags {
943 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, 971 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
944 IEEE80211_HW_MFP_CAPABLE = 1<<13, 972 IEEE80211_HW_MFP_CAPABLE = 1<<13,
945 IEEE80211_HW_BEACON_FILTER = 1<<14, 973 IEEE80211_HW_BEACON_FILTER = 1<<14,
974 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15,
975 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
976 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
977 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
946}; 978};
947 979
948/** 980/**
@@ -1121,18 +1153,24 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1121 * 1153 *
1122 * mac80211 has support for various powersave implementations. 1154 * mac80211 has support for various powersave implementations.
1123 * 1155 *
1124 * First, it can support hardware that handles all powersaving by 1156 * First, it can support hardware that handles all powersaving by itself,
1125 * itself, such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS 1157 * such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS hardware
1126 * hardware flag. In that case, it will be told about the desired 1158 * flag. In that case, it will be told about the desired powersave mode
1127 * powersave mode depending on the association status, and the driver 1159 * with the %IEEE80211_CONF_PS flag depending on the association status.
1128 * must take care of sending nullfunc frames when necessary, i.e. when 1160 * The hardware must take care of sending nullfunc frames when necessary,
1129 * entering and leaving powersave mode. The driver is required to look at 1161 * i.e. when entering and leaving powersave mode. The hardware is required
1130 * the AID in beacons and signal to the AP that it woke up when it finds 1162 * to look at the AID in beacons and signal to the AP that it woke up when
1131 * traffic directed to it. This mode supports dynamic PS by simply 1163 * it finds traffic directed to it.
1132 * enabling/disabling PS. 1164 *
1133 * 1165 * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in
1134 * Additionally, such hardware may set the %IEEE80211_HW_SUPPORTS_DYNAMIC_PS 1166 * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused
1135 * flag to indicate that it can support dynamic PS mode itself (see below). 1167 * with hardware wakeup and sleep states. Driver is responsible for waking
1168 * up the hardware before issueing commands to the hardware and putting it
1169 * back to sleep at approriate times.
1170 *
1171 * When PS is enabled, hardware needs to wakeup for beacons and receive the
1172 * buffered multicast/broadcast frames after the beacon. Also it must be
1173 * possible to send frames and receive the acknowledment frame.
1136 * 1174 *
1137 * Other hardware designs cannot send nullfunc frames by themselves and also 1175 * Other hardware designs cannot send nullfunc frames by themselves and also
1138 * need software support for parsing the TIM bitmap. This is also supported 1176 * need software support for parsing the TIM bitmap. This is also supported
@@ -1140,14 +1178,35 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1140 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still 1178 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
1141 * required to pass up beacons. The hardware is still required to handle 1179 * required to pass up beacons. The hardware is still required to handle
1142 * waking up for multicast traffic; if it cannot the driver must handle that 1180 * waking up for multicast traffic; if it cannot the driver must handle that
1143 * as best as it can, mac80211 is too slow. 1181 * as best as it can, mac80211 is too slow to do that.
1144 * 1182 *
1145 * Dynamic powersave mode is an extension to normal powersave mode in which 1183 * Dynamic powersave is an extension to normal powersave in which the
1146 * the hardware stays awake for a user-specified period of time after sending 1184 * hardware stays awake for a user-specified period of time after sending a
1147 * a frame so that reply frames need not be buffered and therefore delayed 1185 * frame so that reply frames need not be buffered and therefore delayed to
1148 * to the next wakeup. This can either be supported by hardware, in which case 1186 * the next wakeup. It's compromise of getting good enough latency when
1149 * the driver needs to look at the @dynamic_ps_timeout hardware configuration 1187 * there's data traffic and still saving significantly power in idle
1150 * value, or by the stack if all nullfunc handling is in the stack. 1188 * periods.
1189 *
1190 * Dynamic powersave is supported by simply mac80211 enabling and disabling
1191 * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS
1192 * flag and mac80211 will handle everything automatically. Additionally,
1193 * hardware having support for the dynamic PS feature may set the
1194 * %IEEE80211_HW_SUPPORTS_DYNAMIC_PS flag to indicate that it can support
1195 * dynamic PS mode itself. The driver needs to look at the
1196 * @dynamic_ps_timeout hardware configuration value and use it that value
1197 * whenever %IEEE80211_CONF_PS is set. In this case mac80211 will disable
1198 * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS
1199 * enabled whenever user has enabled powersave.
1200 *
1201 * Driver informs U-APSD client support by enabling
1202 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the
1203 * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS
1204 * Nullfunc frames and stay awake until the service period has ended. To
1205 * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames
1206 * from that AC are transmitted with powersave enabled.
1207 *
1208 * Note: U-APSD client mode is not yet supported with
1209 * %IEEE80211_HW_PS_NULLFUNC_STACK.
1151 */ 1210 */
1152 1211
1153/** 1212/**
@@ -1211,6 +1270,31 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1211 */ 1270 */
1212 1271
1213/** 1272/**
1273 * DOC: Spatial multiplexing power save
1274 *
1275 * SMPS (Spatial multiplexing power save) is a mechanism to conserve
1276 * power in an 802.11n implementation. For details on the mechanism
1277 * and rationale, please refer to 802.11 (as amended by 802.11n-2009)
1278 * "11.2.3 SM power save".
1279 *
1280 * The mac80211 implementation is capable of sending action frames
1281 * to update the AP about the station's SMPS mode, and will instruct
1282 * the driver to enter the specific mode. It will also announce the
1283 * requested SMPS mode during the association handshake. Hardware
1284 * support for this feature is required, and can be indicated by
1285 * hardware flags.
1286 *
1287 * The default mode will be "automatic", which nl80211/cfg80211
1288 * defines to be dynamic SMPS in (regular) powersave, and SMPS
1289 * turned off otherwise.
1290 *
1291 * To support this feature, the driver must set the appropriate
1292 * hardware support flags, and handle the SMPS flag to the config()
1293 * operation. It will then with this mechanism be instructed to
1294 * enter the requested SMPS mode while associated to an HT AP.
1295 */
1296
1297/**
1214 * DOC: Frame filtering 1298 * DOC: Frame filtering
1215 * 1299 *
1216 * mac80211 requires to see many management frames for proper 1300 * mac80211 requires to see many management frames for proper
@@ -1347,7 +1431,7 @@ enum ieee80211_ampdu_mlme_action {
1347 * When the device is started it should not have a MAC address 1431 * When the device is started it should not have a MAC address
1348 * to avoid acknowledging frames before a non-monitor device 1432 * to avoid acknowledging frames before a non-monitor device
1349 * is added. 1433 * is added.
1350 * Must be implemented. 1434 * Must be implemented and can sleep.
1351 * 1435 *
1352 * @stop: Called after last netdevice attached to the hardware 1436 * @stop: Called after last netdevice attached to the hardware
1353 * is disabled. This should turn off the hardware (at least 1437 * is disabled. This should turn off the hardware (at least
@@ -1355,7 +1439,7 @@ enum ieee80211_ampdu_mlme_action {
1355 * May be called right after add_interface if that rejects 1439 * May be called right after add_interface if that rejects
1356 * an interface. If you added any work onto the mac80211 workqueue 1440 * an interface. If you added any work onto the mac80211 workqueue
1357 * you should ensure to cancel it on this callback. 1441 * you should ensure to cancel it on this callback.
1358 * Must be implemented. 1442 * Must be implemented and can sleep.
1359 * 1443 *
1360 * @add_interface: Called when a netdevice attached to the hardware is 1444 * @add_interface: Called when a netdevice attached to the hardware is
1361 * enabled. Because it is not called for monitor mode devices, @start 1445 * enabled. Because it is not called for monitor mode devices, @start
@@ -1365,7 +1449,7 @@ enum ieee80211_ampdu_mlme_action {
1365 * interface is given in the conf parameter. 1449 * interface is given in the conf parameter.
1366 * The callback may refuse to add an interface by returning a 1450 * The callback may refuse to add an interface by returning a
1367 * negative error code (which will be seen in userspace.) 1451 * negative error code (which will be seen in userspace.)
1368 * Must be implemented. 1452 * Must be implemented and can sleep.
1369 * 1453 *
1370 * @remove_interface: Notifies a driver that an interface is going down. 1454 * @remove_interface: Notifies a driver that an interface is going down.
1371 * The @stop callback is called after this if it is the last interface 1455 * The @stop callback is called after this if it is the last interface
@@ -1374,19 +1458,20 @@ enum ieee80211_ampdu_mlme_action {
1374 * must be cleared so the device no longer acknowledges packets, 1458 * must be cleared so the device no longer acknowledges packets,
1375 * the mac_addr member of the conf structure is, however, set to the 1459 * the mac_addr member of the conf structure is, however, set to the
1376 * MAC address of the device going away. 1460 * MAC address of the device going away.
1377 * Hence, this callback must be implemented. 1461 * Hence, this callback must be implemented. It can sleep.
1378 * 1462 *
1379 * @config: Handler for configuration requests. IEEE 802.11 code calls this 1463 * @config: Handler for configuration requests. IEEE 802.11 code calls this
1380 * function to change hardware configuration, e.g., channel. 1464 * function to change hardware configuration, e.g., channel.
1381 * This function should never fail but returns a negative error code 1465 * This function should never fail but returns a negative error code
1382 * if it does. 1466 * if it does. The callback can sleep.
1383 * 1467 *
1384 * @bss_info_changed: Handler for configuration requests related to BSS 1468 * @bss_info_changed: Handler for configuration requests related to BSS
1385 * parameters that may vary during BSS's lifespan, and may affect low 1469 * parameters that may vary during BSS's lifespan, and may affect low
1386 * level driver (e.g. assoc/disassoc status, erp parameters). 1470 * level driver (e.g. assoc/disassoc status, erp parameters).
1387 * This function should not be used if no BSS has been set, unless 1471 * This function should not be used if no BSS has been set, unless
1388 * for association indication. The @changed parameter indicates which 1472 * for association indication. The @changed parameter indicates which
1389 * of the bss parameters has changed when a call is made. 1473 * of the bss parameters has changed when a call is made. The callback
1474 * can sleep.
1390 * 1475 *
1391 * @prepare_multicast: Prepare for multicast filter configuration. 1476 * @prepare_multicast: Prepare for multicast filter configuration.
1392 * This callback is optional, and its return value is passed 1477 * This callback is optional, and its return value is passed
@@ -1394,20 +1479,22 @@ enum ieee80211_ampdu_mlme_action {
1394 * 1479 *
1395 * @configure_filter: Configure the device's RX filter. 1480 * @configure_filter: Configure the device's RX filter.
1396 * See the section "Frame filtering" for more information. 1481 * See the section "Frame filtering" for more information.
1397 * This callback must be implemented. 1482 * This callback must be implemented and can sleep.
1398 * 1483 *
1399 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit 1484 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
1400 * must be set or cleared for a given STA. Must be atomic. 1485 * must be set or cleared for a given STA. Must be atomic.
1401 * 1486 *
1402 * @set_key: See the section "Hardware crypto acceleration" 1487 * @set_key: See the section "Hardware crypto acceleration"
1403 * This callback can sleep, and is only called between add_interface 1488 * This callback is only called between add_interface and
1404 * and remove_interface calls, i.e. while the given virtual interface 1489 * remove_interface calls, i.e. while the given virtual interface
1405 * is enabled. 1490 * is enabled.
1406 * Returns a negative error code if the key can't be added. 1491 * Returns a negative error code if the key can't be added.
1492 * The callback can sleep.
1407 * 1493 *
1408 * @update_tkip_key: See the section "Hardware crypto acceleration" 1494 * @update_tkip_key: See the section "Hardware crypto acceleration"
1409 * This callback will be called in the context of Rx. Called for drivers 1495 * This callback will be called in the context of Rx. Called for drivers
1410 * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. 1496 * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
1497 * The callback must be atomic.
1411 * 1498 *
1412 * @hw_scan: Ask the hardware to service the scan request, no need to start 1499 * @hw_scan: Ask the hardware to service the scan request, no need to start
1413 * the scan state machine in stack. The scan must honour the channel 1500 * the scan state machine in stack. The scan must honour the channel
@@ -1421,53 +1508,64 @@ enum ieee80211_ampdu_mlme_action {
1421 * When the scan finishes, ieee80211_scan_completed() must be called; 1508 * When the scan finishes, ieee80211_scan_completed() must be called;
1422 * note that it also must be called when the scan cannot finish due to 1509 * note that it also must be called when the scan cannot finish due to
1423 * any error unless this callback returned a negative error code. 1510 * any error unless this callback returned a negative error code.
1511 * The callback can sleep.
1424 * 1512 *
1425 * @sw_scan_start: Notifier function that is called just before a software scan 1513 * @sw_scan_start: Notifier function that is called just before a software scan
1426 * is started. Can be NULL, if the driver doesn't need this notification. 1514 * is started. Can be NULL, if the driver doesn't need this notification.
1515 * The callback can sleep.
1427 * 1516 *
1428 * @sw_scan_complete: Notifier function that is called just after a software scan 1517 * @sw_scan_complete: Notifier function that is called just after a
1429 * finished. Can be NULL, if the driver doesn't need this notification. 1518 * software scan finished. Can be NULL, if the driver doesn't need
1519 * this notification.
1520 * The callback can sleep.
1430 * 1521 *
1431 * @get_stats: Return low-level statistics. 1522 * @get_stats: Return low-level statistics.
1432 * Returns zero if statistics are available. 1523 * Returns zero if statistics are available.
1524 * The callback can sleep.
1433 * 1525 *
1434 * @get_tkip_seq: If your device implements TKIP encryption in hardware this 1526 * @get_tkip_seq: If your device implements TKIP encryption in hardware this
1435 * callback should be provided to read the TKIP transmit IVs (both IV32 1527 * callback should be provided to read the TKIP transmit IVs (both IV32
1436 * and IV16) for the given key from hardware. 1528 * and IV16) for the given key from hardware.
1529 * The callback must be atomic.
1437 * 1530 *
1438 * @set_rts_threshold: Configuration of RTS threshold (if device needs it) 1531 * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
1532 * The callback can sleep.
1533 *
1534 * @sta_add: Notifies low level driver about addition of an associated station,
1535 * AP, IBSS/WDS/mesh peer etc. This callback can sleep.
1536 *
1537 * @sta_remove: Notifies low level driver about removal of an associated
1538 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep.
1439 * 1539 *
1440 * @sta_notify: Notifies low level driver about addition, removal or power 1540 * @sta_notify: Notifies low level driver about power state transition of an
1441 * state transition of an associated station, AP, IBSS/WDS/mesh peer etc. 1541 * associated station, AP, IBSS/WDS/mesh peer etc. Must be atomic.
1442 * Must be atomic.
1443 * 1542 *
1444 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1543 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1445 * bursting) for a hardware TX queue. 1544 * bursting) for a hardware TX queue.
1446 * Returns a negative error code on failure. 1545 * Returns a negative error code on failure.
1447 * 1546 * The callback can sleep.
1448 * @get_tx_stats: Get statistics of the current TX queue status. This is used
1449 * to get number of currently queued packets (queue length), maximum queue
1450 * size (limit), and total number of packets sent using each TX queue
1451 * (count). The 'stats' pointer points to an array that has hw->queues
1452 * items.
1453 * 1547 *
1454 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, 1548 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
1455 * this is only used for IBSS mode BSSID merging and debugging. Is not a 1549 * this is only used for IBSS mode BSSID merging and debugging. Is not a
1456 * required function. 1550 * required function.
1551 * The callback can sleep.
1457 * 1552 *
1458 * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware. 1553 * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
1459 * Currently, this is only used for IBSS mode debugging. Is not a 1554 * Currently, this is only used for IBSS mode debugging. Is not a
1460 * required function. 1555 * required function.
1556 * The callback can sleep.
1461 * 1557 *
1462 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize 1558 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
1463 * with other STAs in the IBSS. This is only used in IBSS mode. This 1559 * with other STAs in the IBSS. This is only used in IBSS mode. This
1464 * function is optional if the firmware/hardware takes full care of 1560 * function is optional if the firmware/hardware takes full care of
1465 * TSF synchronization. 1561 * TSF synchronization.
1562 * The callback can sleep.
1466 * 1563 *
1467 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. 1564 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
1468 * This is needed only for IBSS mode and the result of this function is 1565 * This is needed only for IBSS mode and the result of this function is
1469 * used to determine whether to reply to Probe Requests. 1566 * used to determine whether to reply to Probe Requests.
1470 * Returns non-zero if this device sent the last beacon. 1567 * Returns non-zero if this device sent the last beacon.
1568 * The callback can sleep.
1471 * 1569 *
1472 * @ampdu_action: Perform a certain A-MPDU action 1570 * @ampdu_action: Perform a certain A-MPDU action
1473 * The RA/TID combination determines the destination and TID we want 1571 * The RA/TID combination determines the destination and TID we want
@@ -1476,21 +1574,32 @@ enum ieee80211_ampdu_mlme_action {
1476 * is the first frame we expect to perform the action on. Notice 1574 * is the first frame we expect to perform the action on. Notice
1477 * that TX/RX_STOP can pass NULL for this parameter. 1575 * that TX/RX_STOP can pass NULL for this parameter.
1478 * Returns a negative error code on failure. 1576 * Returns a negative error code on failure.
1577 * The callback must be atomic.
1479 * 1578 *
1480 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also 1579 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also
1481 * need to set wiphy->rfkill_poll to %true before registration, 1580 * need to set wiphy->rfkill_poll to %true before registration,
1482 * and need to call wiphy_rfkill_set_hw_state() in the callback. 1581 * and need to call wiphy_rfkill_set_hw_state() in the callback.
1582 * The callback can sleep.
1583 *
1584 * @set_coverage_class: Set slot time for given coverage class as specified
1585 * in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout
1586 * accordingly. This callback is not required and may sleep.
1483 * 1587 *
1484 * @testmode_cmd: Implement a cfg80211 test mode command. 1588 * @testmode_cmd: Implement a cfg80211 test mode command.
1589 * The callback can sleep.
1590 *
1591 * @flush: Flush all pending frames from the hardware queue, making sure
1592 * that the hardware queues are empty. If the parameter @drop is set
1593 * to %true, pending frames may be dropped. The callback can sleep.
1485 */ 1594 */
1486struct ieee80211_ops { 1595struct ieee80211_ops {
1487 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1596 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
1488 int (*start)(struct ieee80211_hw *hw); 1597 int (*start)(struct ieee80211_hw *hw);
1489 void (*stop)(struct ieee80211_hw *hw); 1598 void (*stop)(struct ieee80211_hw *hw);
1490 int (*add_interface)(struct ieee80211_hw *hw, 1599 int (*add_interface)(struct ieee80211_hw *hw,
1491 struct ieee80211_if_init_conf *conf); 1600 struct ieee80211_vif *vif);
1492 void (*remove_interface)(struct ieee80211_hw *hw, 1601 void (*remove_interface)(struct ieee80211_hw *hw,
1493 struct ieee80211_if_init_conf *conf); 1602 struct ieee80211_vif *vif);
1494 int (*config)(struct ieee80211_hw *hw, u32 changed); 1603 int (*config)(struct ieee80211_hw *hw, u32 changed);
1495 void (*bss_info_changed)(struct ieee80211_hw *hw, 1604 void (*bss_info_changed)(struct ieee80211_hw *hw,
1496 struct ieee80211_vif *vif, 1605 struct ieee80211_vif *vif,
@@ -1508,8 +1617,10 @@ struct ieee80211_ops {
1508 struct ieee80211_vif *vif, struct ieee80211_sta *sta, 1617 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
1509 struct ieee80211_key_conf *key); 1618 struct ieee80211_key_conf *key);
1510 void (*update_tkip_key)(struct ieee80211_hw *hw, 1619 void (*update_tkip_key)(struct ieee80211_hw *hw,
1511 struct ieee80211_key_conf *conf, const u8 *address, 1620 struct ieee80211_vif *vif,
1512 u32 iv32, u16 *phase1key); 1621 struct ieee80211_key_conf *conf,
1622 struct ieee80211_sta *sta,
1623 u32 iv32, u16 *phase1key);
1513 int (*hw_scan)(struct ieee80211_hw *hw, 1624 int (*hw_scan)(struct ieee80211_hw *hw,
1514 struct cfg80211_scan_request *req); 1625 struct cfg80211_scan_request *req);
1515 void (*sw_scan_start)(struct ieee80211_hw *hw); 1626 void (*sw_scan_start)(struct ieee80211_hw *hw);
@@ -1519,12 +1630,14 @@ struct ieee80211_ops {
1519 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 1630 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
1520 u32 *iv32, u16 *iv16); 1631 u32 *iv32, u16 *iv16);
1521 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); 1632 int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
1633 int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1634 struct ieee80211_sta *sta);
1635 int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1636 struct ieee80211_sta *sta);
1522 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1637 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1523 enum sta_notify_cmd, struct ieee80211_sta *sta); 1638 enum sta_notify_cmd, struct ieee80211_sta *sta);
1524 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, 1639 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
1525 const struct ieee80211_tx_queue_params *params); 1640 const struct ieee80211_tx_queue_params *params);
1526 int (*get_tx_stats)(struct ieee80211_hw *hw,
1527 struct ieee80211_tx_queue_stats *stats);
1528 u64 (*get_tsf)(struct ieee80211_hw *hw); 1641 u64 (*get_tsf)(struct ieee80211_hw *hw);
1529 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf); 1642 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf);
1530 void (*reset_tsf)(struct ieee80211_hw *hw); 1643 void (*reset_tsf)(struct ieee80211_hw *hw);
@@ -1535,9 +1648,11 @@ struct ieee80211_ops {
1535 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1648 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1536 1649
1537 void (*rfkill_poll)(struct ieee80211_hw *hw); 1650 void (*rfkill_poll)(struct ieee80211_hw *hw);
1651 void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class);
1538#ifdef CONFIG_NL80211_TESTMODE 1652#ifdef CONFIG_NL80211_TESTMODE
1539 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); 1653 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
1540#endif 1654#endif
1655 void (*flush)(struct ieee80211_hw *hw, bool drop);
1541}; 1656};
1542 1657
1543/** 1658/**
@@ -1777,7 +1892,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1777/** 1892/**
1778 * ieee80211_beacon_get_tim - beacon generation function 1893 * ieee80211_beacon_get_tim - beacon generation function
1779 * @hw: pointer obtained from ieee80211_alloc_hw(). 1894 * @hw: pointer obtained from ieee80211_alloc_hw().
1780 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1895 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1781 * @tim_offset: pointer to variable that will receive the TIM IE offset. 1896 * @tim_offset: pointer to variable that will receive the TIM IE offset.
1782 * Set to 0 if invalid (in non-AP modes). 1897 * Set to 0 if invalid (in non-AP modes).
1783 * @tim_length: pointer to variable that will receive the TIM IE length, 1898 * @tim_length: pointer to variable that will receive the TIM IE length,
@@ -1805,7 +1920,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
1805/** 1920/**
1806 * ieee80211_beacon_get - beacon generation function 1921 * ieee80211_beacon_get - beacon generation function
1807 * @hw: pointer obtained from ieee80211_alloc_hw(). 1922 * @hw: pointer obtained from ieee80211_alloc_hw().
1808 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1923 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1809 * 1924 *
1810 * See ieee80211_beacon_get_tim(). 1925 * See ieee80211_beacon_get_tim().
1811 */ 1926 */
@@ -1816,9 +1931,56 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1816} 1931}
1817 1932
1818/** 1933/**
1934 * ieee80211_pspoll_get - retrieve a PS Poll template
1935 * @hw: pointer obtained from ieee80211_alloc_hw().
1936 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1937 *
1938 * Creates a PS Poll a template which can, for example, uploaded to
1939 * hardware. The template must be updated after association so that correct
1940 * AID, BSSID and MAC address is used.
1941 *
1942 * Note: Caller (or hardware) is responsible for setting the
1943 * &IEEE80211_FCTL_PM bit.
1944 */
1945struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
1946 struct ieee80211_vif *vif);
1947
1948/**
1949 * ieee80211_nullfunc_get - retrieve a nullfunc template
1950 * @hw: pointer obtained from ieee80211_alloc_hw().
1951 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1952 *
1953 * Creates a Nullfunc template which can, for example, uploaded to
1954 * hardware. The template must be updated after association so that correct
1955 * BSSID and address is used.
1956 *
1957 * Note: Caller (or hardware) is responsible for setting the
1958 * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields.
1959 */
1960struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
1961 struct ieee80211_vif *vif);
1962
1963/**
1964 * ieee80211_probereq_get - retrieve a Probe Request template
1965 * @hw: pointer obtained from ieee80211_alloc_hw().
1966 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1967 * @ssid: SSID buffer
1968 * @ssid_len: length of SSID
1969 * @ie: buffer containing all IEs except SSID for the template
1970 * @ie_len: length of the IE buffer
1971 *
1972 * Creates a Probe Request template which can, for example, be uploaded to
1973 * hardware.
1974 */
1975struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
1976 struct ieee80211_vif *vif,
1977 const u8 *ssid, size_t ssid_len,
1978 const u8 *ie, size_t ie_len);
1979
1980/**
1819 * ieee80211_rts_get - RTS frame generation function 1981 * ieee80211_rts_get - RTS frame generation function
1820 * @hw: pointer obtained from ieee80211_alloc_hw(). 1982 * @hw: pointer obtained from ieee80211_alloc_hw().
1821 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1983 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1822 * @frame: pointer to the frame that is going to be protected by the RTS. 1984 * @frame: pointer to the frame that is going to be protected by the RTS.
1823 * @frame_len: the frame length (in octets). 1985 * @frame_len: the frame length (in octets).
1824 * @frame_txctl: &struct ieee80211_tx_info of the frame. 1986 * @frame_txctl: &struct ieee80211_tx_info of the frame.
@@ -1837,7 +1999,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1837/** 1999/**
1838 * ieee80211_rts_duration - Get the duration field for an RTS frame 2000 * ieee80211_rts_duration - Get the duration field for an RTS frame
1839 * @hw: pointer obtained from ieee80211_alloc_hw(). 2001 * @hw: pointer obtained from ieee80211_alloc_hw().
1840 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2002 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1841 * @frame_len: the length of the frame that is going to be protected by the RTS. 2003 * @frame_len: the length of the frame that is going to be protected by the RTS.
1842 * @frame_txctl: &struct ieee80211_tx_info of the frame. 2004 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1843 * 2005 *
@@ -1852,7 +2014,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
1852/** 2014/**
1853 * ieee80211_ctstoself_get - CTS-to-self frame generation function 2015 * ieee80211_ctstoself_get - CTS-to-self frame generation function
1854 * @hw: pointer obtained from ieee80211_alloc_hw(). 2016 * @hw: pointer obtained from ieee80211_alloc_hw().
1855 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2017 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1856 * @frame: pointer to the frame that is going to be protected by the CTS-to-self. 2018 * @frame: pointer to the frame that is going to be protected by the CTS-to-self.
1857 * @frame_len: the frame length (in octets). 2019 * @frame_len: the frame length (in octets).
1858 * @frame_txctl: &struct ieee80211_tx_info of the frame. 2020 * @frame_txctl: &struct ieee80211_tx_info of the frame.
@@ -1872,7 +2034,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
1872/** 2034/**
1873 * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame 2035 * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame
1874 * @hw: pointer obtained from ieee80211_alloc_hw(). 2036 * @hw: pointer obtained from ieee80211_alloc_hw().
1875 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2037 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1876 * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. 2038 * @frame_len: the length of the frame that is going to be protected by the CTS-to-self.
1877 * @frame_txctl: &struct ieee80211_tx_info of the frame. 2039 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1878 * 2040 *
@@ -1888,7 +2050,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
1888/** 2050/**
1889 * ieee80211_generic_frame_duration - Calculate the duration field for a frame 2051 * ieee80211_generic_frame_duration - Calculate the duration field for a frame
1890 * @hw: pointer obtained from ieee80211_alloc_hw(). 2052 * @hw: pointer obtained from ieee80211_alloc_hw().
1891 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2053 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1892 * @frame_len: the length of the frame. 2054 * @frame_len: the length of the frame.
1893 * @rate: the rate at which the frame is going to be transmitted. 2055 * @rate: the rate at which the frame is going to be transmitted.
1894 * 2056 *
@@ -1903,7 +2065,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
1903/** 2065/**
1904 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames 2066 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames
1905 * @hw: pointer as obtained from ieee80211_alloc_hw(). 2067 * @hw: pointer as obtained from ieee80211_alloc_hw().
1906 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2068 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
1907 * 2069 *
1908 * Function for accessing buffered broadcast and multicast frames. If 2070 * Function for accessing buffered broadcast and multicast frames. If
1909 * hardware/firmware does not implement buffering of broadcast/multicast 2071 * hardware/firmware does not implement buffering of broadcast/multicast
@@ -2071,7 +2233,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid);
2071 2233
2072/** 2234/**
2073 * ieee80211_start_tx_ba_cb - low level driver ready to aggregate. 2235 * ieee80211_start_tx_ba_cb - low level driver ready to aggregate.
2074 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf 2236 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2075 * @ra: receiver address of the BA session recipient. 2237 * @ra: receiver address of the BA session recipient.
2076 * @tid: the TID to BA on. 2238 * @tid: the TID to BA on.
2077 * 2239 *
@@ -2082,7 +2244,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
2082 2244
2083/** 2245/**
2084 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. 2246 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate.
2085 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf 2247 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2086 * @ra: receiver address of the BA session recipient. 2248 * @ra: receiver address of the BA session recipient.
2087 * @tid: the TID to BA on. 2249 * @tid: the TID to BA on.
2088 * 2250 *
@@ -2110,7 +2272,7 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid,
2110 2272
2111/** 2273/**
2112 * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate. 2274 * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate.
2113 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf 2275 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2114 * @ra: receiver address of the BA session recipient. 2276 * @ra: receiver address of the BA session recipient.
2115 * @tid: the desired TID to BA on. 2277 * @tid: the desired TID to BA on.
2116 * 2278 *
@@ -2121,7 +2283,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
2121 2283
2122/** 2284/**
2123 * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. 2285 * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate.
2124 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf 2286 * @vif: &struct ieee80211_vif pointer from the add_interface callback
2125 * @ra: receiver address of the BA session recipient. 2287 * @ra: receiver address of the BA session recipient.
2126 * @tid: the desired TID to BA on. 2288 * @tid: the desired TID to BA on.
2127 * 2289 *
@@ -2200,7 +2362,7 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
2200/** 2362/**
2201 * ieee80211_beacon_loss - inform hardware does not receive beacons 2363 * ieee80211_beacon_loss - inform hardware does not receive beacons
2202 * 2364 *
2203 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 2365 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2204 * 2366 *
2205 * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and 2367 * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and
2206 * IEEE80211_CONF_PS is set, the driver needs to inform whenever the 2368 * IEEE80211_CONF_PS is set, the driver needs to inform whenever the
@@ -2234,8 +2396,12 @@ enum rate_control_changed {
2234 * @short_preamble: whether mac80211 will request short-preamble transmission 2396 * @short_preamble: whether mac80211 will request short-preamble transmission
2235 * if the selected rate supports it 2397 * if the selected rate supports it
2236 * @max_rate_idx: user-requested maximum rate (not MCS for now) 2398 * @max_rate_idx: user-requested maximum rate (not MCS for now)
2399 * (deprecated; this will be removed once drivers get updated to use
2400 * rate_idx_mask)
2401 * @rate_idx_mask: user-requested rate mask (not MCS for now)
2237 * @skb: the skb that will be transmitted, the control information in it needs 2402 * @skb: the skb that will be transmitted, the control information in it needs
2238 * to be filled in 2403 * to be filled in
2404 * @ap: whether this frame is sent out in AP mode
2239 */ 2405 */
2240struct ieee80211_tx_rate_control { 2406struct ieee80211_tx_rate_control {
2241 struct ieee80211_hw *hw; 2407 struct ieee80211_hw *hw;
@@ -2245,6 +2411,8 @@ struct ieee80211_tx_rate_control {
2245 struct ieee80211_tx_rate reported_rate; 2411 struct ieee80211_tx_rate reported_rate;
2246 bool rts, short_preamble; 2412 bool rts, short_preamble;
2247 u8 max_rate_idx; 2413 u8 max_rate_idx;
2414 u32 rate_idx_mask;
2415 bool ap;
2248}; 2416};
2249 2417
2250struct rate_control_ops { 2418struct rate_control_ops {
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index b0173202cad9..da1d58be31b7 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -164,7 +164,7 @@ struct neigh_table {
164 rwlock_t lock; 164 rwlock_t lock;
165 unsigned long last_rand; 165 unsigned long last_rand;
166 struct kmem_cache *kmem_cachep; 166 struct kmem_cache *kmem_cachep;
167 struct neigh_statistics *stats; 167 struct neigh_statistics __percpu *stats;
168 struct neighbour **hash_buckets; 168 struct neighbour **hash_buckets;
169 unsigned int hash_mask; 169 unsigned int hash_mask;
170 __u32 hash_rnd; 170 __u32 hash_rnd;
@@ -251,7 +251,6 @@ extern void neigh_seq_stop(struct seq_file *, void *);
251 251
252extern int neigh_sysctl_register(struct net_device *dev, 252extern int neigh_sysctl_register(struct net_device *dev,
253 struct neigh_parms *p, 253 struct neigh_parms *p,
254 int p_id, int pdev_id,
255 char *p_name, 254 char *p_name,
256 proc_handler *proc_handler); 255 proc_handler *proc_handler);
257extern void neigh_sysctl_unregister(struct neigh_parms *p); 256extern void neigh_sysctl_unregister(struct neigh_parms *p);
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index f307e133d14c..82b7be4db89a 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -81,6 +81,8 @@ struct net {
81#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 81#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
82 struct netns_ct ct; 82 struct netns_ct ct;
83#endif 83#endif
84 struct sock *nfnl;
85 struct sock *nfnl_stash;
84#endif 86#endif
85#ifdef CONFIG_XFRM 87#ifdef CONFIG_XFRM
86 struct netns_xfrm xfrm; 88 struct netns_xfrm xfrm;
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index a0904adfb8f7..bde095f7e845 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -70,7 +70,7 @@ union nf_conntrack_help {
70struct nf_conntrack_helper; 70struct nf_conntrack_helper;
71 71
72/* Must be kept in sync with the classes defined by helpers */ 72/* Must be kept in sync with the classes defined by helpers */
73#define NF_CT_MAX_EXPECT_CLASSES 3 73#define NF_CT_MAX_EXPECT_CLASSES 4
74 74
75/* nf_conn feature for connections that have a helper */ 75/* nf_conn feature for connections that have a helper */
76struct nf_conn_help { 76struct nf_conn_help {
@@ -198,7 +198,8 @@ extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int null
198extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size); 198extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size);
199 199
200extern struct nf_conntrack_tuple_hash * 200extern struct nf_conntrack_tuple_hash *
201__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); 201__nf_conntrack_find(struct net *net, u16 zone,
202 const struct nf_conntrack_tuple *tuple);
202 203
203extern void nf_conntrack_hash_insert(struct nf_conn *ct); 204extern void nf_conntrack_hash_insert(struct nf_conn *ct);
204extern void nf_ct_delete_from_lists(struct nf_conn *ct); 205extern void nf_ct_delete_from_lists(struct nf_conn *ct);
@@ -267,11 +268,16 @@ extern void
267nf_ct_iterate_cleanup(struct net *net, int (*iter)(struct nf_conn *i, void *data), void *data); 268nf_ct_iterate_cleanup(struct net *net, int (*iter)(struct nf_conn *i, void *data), void *data);
268extern void nf_conntrack_free(struct nf_conn *ct); 269extern void nf_conntrack_free(struct nf_conn *ct);
269extern struct nf_conn * 270extern struct nf_conn *
270nf_conntrack_alloc(struct net *net, 271nf_conntrack_alloc(struct net *net, u16 zone,
271 const struct nf_conntrack_tuple *orig, 272 const struct nf_conntrack_tuple *orig,
272 const struct nf_conntrack_tuple *repl, 273 const struct nf_conntrack_tuple *repl,
273 gfp_t gfp); 274 gfp_t gfp);
274 275
276static inline int nf_ct_is_template(const struct nf_conn *ct)
277{
278 return test_bit(IPS_TEMPLATE_BIT, &ct->status);
279}
280
275/* It's confirmed if it is, or has been in the hash table. */ 281/* It's confirmed if it is, or has been in the hash table. */
276static inline int nf_ct_is_confirmed(struct nf_conn *ct) 282static inline int nf_ct_is_confirmed(struct nf_conn *ct)
277{ 283{
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 5a449b44ba33..dffde8e6920e 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -49,7 +49,8 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
49 49
50/* Find a connection corresponding to a tuple. */ 50/* Find a connection corresponding to a tuple. */
51extern struct nf_conntrack_tuple_hash * 51extern struct nf_conntrack_tuple_hash *
52nf_conntrack_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); 52nf_conntrack_find_get(struct net *net, u16 zone,
53 const struct nf_conntrack_tuple *tuple);
53 54
54extern int __nf_conntrack_confirm(struct sk_buff *skb); 55extern int __nf_conntrack_confirm(struct sk_buff *skb);
55 56
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 475facc3051a..96ba5f7dcab6 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -12,27 +12,12 @@
12#include <linux/netfilter/nf_conntrack_tuple_common.h> 12#include <linux/netfilter/nf_conntrack_tuple_common.h>
13#include <net/netfilter/nf_conntrack_extend.h> 13#include <net/netfilter/nf_conntrack_extend.h>
14 14
15/* Connection tracking event types */
16enum ip_conntrack_events {
17 IPCT_NEW = 0, /* new conntrack */
18 IPCT_RELATED = 1, /* related conntrack */
19 IPCT_DESTROY = 2, /* destroyed conntrack */
20 IPCT_STATUS = 3, /* status has changed */
21 IPCT_PROTOINFO = 4, /* protocol information has changed */
22 IPCT_HELPER = 5, /* new helper has been set */
23 IPCT_MARK = 6, /* new mark has been set */
24 IPCT_NATSEQADJ = 7, /* NAT is doing sequence adjustment */
25 IPCT_SECMARK = 8, /* new security mark has been set */
26};
27
28enum ip_conntrack_expect_events {
29 IPEXP_NEW = 0, /* new expectation */
30};
31
32struct nf_conntrack_ecache { 15struct nf_conntrack_ecache {
33 unsigned long cache; /* bitops want long */ 16 unsigned long cache; /* bitops want long */
34 unsigned long missed; /* missed events */ 17 unsigned long missed; /* missed events */
35 u32 pid; /* netlink pid of destroyer */ 18 u16 ctmask; /* bitmask of ct events to be delivered */
19 u16 expmask; /* bitmask of expect events to be delivered */
20 u32 pid; /* netlink pid of destroyer */
36}; 21};
37 22
38static inline struct nf_conntrack_ecache * 23static inline struct nf_conntrack_ecache *
@@ -42,14 +27,24 @@ nf_ct_ecache_find(const struct nf_conn *ct)
42} 27}
43 28
44static inline struct nf_conntrack_ecache * 29static inline struct nf_conntrack_ecache *
45nf_ct_ecache_ext_add(struct nf_conn *ct, gfp_t gfp) 30nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp)
46{ 31{
47 struct net *net = nf_ct_net(ct); 32 struct net *net = nf_ct_net(ct);
33 struct nf_conntrack_ecache *e;
48 34
49 if (!net->ct.sysctl_events) 35 if (!ctmask && !expmask && net->ct.sysctl_events) {
36 ctmask = ~0;
37 expmask = ~0;
38 }
39 if (!ctmask && !expmask)
50 return NULL; 40 return NULL;
51 41
52 return nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp); 42 e = nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp);
43 if (e) {
44 e->ctmask = ctmask;
45 e->expmask = expmask;
46 }
47 return e;
53}; 48};
54 49
55#ifdef CONFIG_NF_CONNTRACK_EVENTS 50#ifdef CONFIG_NF_CONNTRACK_EVENTS
@@ -82,6 +77,9 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
82 if (e == NULL) 77 if (e == NULL)
83 return; 78 return;
84 79
80 if (!(e->ctmask & (1 << event)))
81 return;
82
85 set_bit(event, &e->cache); 83 set_bit(event, &e->cache);
86} 84}
87 85
@@ -92,7 +90,6 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
92 int report) 90 int report)
93{ 91{
94 int ret = 0; 92 int ret = 0;
95 struct net *net = nf_ct_net(ct);
96 struct nf_ct_event_notifier *notify; 93 struct nf_ct_event_notifier *notify;
97 struct nf_conntrack_ecache *e; 94 struct nf_conntrack_ecache *e;
98 95
@@ -101,9 +98,6 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
101 if (notify == NULL) 98 if (notify == NULL)
102 goto out_unlock; 99 goto out_unlock;
103 100
104 if (!net->ct.sysctl_events)
105 goto out_unlock;
106
107 e = nf_ct_ecache_find(ct); 101 e = nf_ct_ecache_find(ct);
108 if (e == NULL) 102 if (e == NULL)
109 goto out_unlock; 103 goto out_unlock;
@@ -117,6 +111,9 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
117 /* This is a resent of a destroy event? If so, skip missed */ 111 /* This is a resent of a destroy event? If so, skip missed */
118 unsigned long missed = e->pid ? 0 : e->missed; 112 unsigned long missed = e->pid ? 0 : e->missed;
119 113
114 if (!((eventmask | missed) & e->ctmask))
115 goto out_unlock;
116
120 ret = notify->fcn(eventmask | missed, &item); 117 ret = notify->fcn(eventmask | missed, &item);
121 if (unlikely(ret < 0 || missed)) { 118 if (unlikely(ret < 0 || missed)) {
122 spin_lock_bh(&ct->lock); 119 spin_lock_bh(&ct->lock);
@@ -172,18 +169,19 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
172 u32 pid, 169 u32 pid,
173 int report) 170 int report)
174{ 171{
175 struct net *net = nf_ct_exp_net(exp);
176 struct nf_exp_event_notifier *notify; 172 struct nf_exp_event_notifier *notify;
173 struct nf_conntrack_ecache *e;
177 174
178 rcu_read_lock(); 175 rcu_read_lock();
179 notify = rcu_dereference(nf_expect_event_cb); 176 notify = rcu_dereference(nf_expect_event_cb);
180 if (notify == NULL) 177 if (notify == NULL)
181 goto out_unlock; 178 goto out_unlock;
182 179
183 if (!net->ct.sysctl_events) 180 e = nf_ct_ecache_find(exp->master);
181 if (e == NULL)
184 goto out_unlock; 182 goto out_unlock;
185 183
186 { 184 if (e->expmask & (1 << event)) {
187 struct nf_exp_event item = { 185 struct nf_exp_event item = {
188 .exp = exp, 186 .exp = exp,
189 .pid = pid, 187 .pid = pid,
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index 9a2b9cb52271..11e815084fcf 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -56,16 +56,13 @@ struct nf_conntrack_expect {
56 56
57static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp) 57static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp)
58{ 58{
59#ifdef CONFIG_NET_NS 59 return nf_ct_net(exp->master);
60 return exp->master->ct_net; /* by definition */
61#else
62 return &init_net;
63#endif
64} 60}
65 61
66struct nf_conntrack_expect_policy { 62struct nf_conntrack_expect_policy {
67 unsigned int max_expected; 63 unsigned int max_expected;
68 unsigned int timeout; 64 unsigned int timeout;
65 const char *name;
69}; 66};
70 67
71#define NF_CT_EXPECT_CLASS_DEFAULT 0 68#define NF_CT_EXPECT_CLASS_DEFAULT 0
@@ -77,13 +74,16 @@ int nf_conntrack_expect_init(struct net *net);
77void nf_conntrack_expect_fini(struct net *net); 74void nf_conntrack_expect_fini(struct net *net);
78 75
79struct nf_conntrack_expect * 76struct nf_conntrack_expect *
80__nf_ct_expect_find(struct net *net, const struct nf_conntrack_tuple *tuple); 77__nf_ct_expect_find(struct net *net, u16 zone,
78 const struct nf_conntrack_tuple *tuple);
81 79
82struct nf_conntrack_expect * 80struct nf_conntrack_expect *
83nf_ct_expect_find_get(struct net *net, const struct nf_conntrack_tuple *tuple); 81nf_ct_expect_find_get(struct net *net, u16 zone,
82 const struct nf_conntrack_tuple *tuple);
84 83
85struct nf_conntrack_expect * 84struct nf_conntrack_expect *
86nf_ct_find_expectation(struct net *net, const struct nf_conntrack_tuple *tuple); 85nf_ct_find_expectation(struct net *net, u16 zone,
86 const struct nf_conntrack_tuple *tuple);
87 87
88void nf_ct_unlink_expect(struct nf_conntrack_expect *exp); 88void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
89void nf_ct_remove_expectations(struct nf_conn *ct); 89void nf_ct_remove_expectations(struct nf_conn *ct);
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index e192dc17c583..2d2a1f9a61d8 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -8,6 +8,7 @@ enum nf_ct_ext_id {
8 NF_CT_EXT_NAT, 8 NF_CT_EXT_NAT,
9 NF_CT_EXT_ACCT, 9 NF_CT_EXT_ACCT,
10 NF_CT_EXT_ECACHE, 10 NF_CT_EXT_ECACHE,
11 NF_CT_EXT_ZONE,
11 NF_CT_EXT_NUM, 12 NF_CT_EXT_NUM,
12}; 13};
13 14
@@ -15,6 +16,7 @@ enum nf_ct_ext_id {
15#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat 16#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat
16#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter 17#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter
17#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache 18#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
19#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
18 20
19/* Extensions: optional stuff which isn't permanently in struct. */ 21/* Extensions: optional stuff which isn't permanently in struct. */
20struct nf_ct_ext { 22struct nf_ct_ext {
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index d015de92e03f..32c305dbdab6 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -40,14 +40,18 @@ struct nf_conntrack_helper {
40}; 40};
41 41
42extern struct nf_conntrack_helper * 42extern struct nf_conntrack_helper *
43__nf_conntrack_helper_find_byname(const char *name); 43__nf_conntrack_helper_find(const char *name, u16 l3num, u8 protonum);
44
45extern struct nf_conntrack_helper *
46nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum);
44 47
45extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 48extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
46extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); 49extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
47 50
48extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp); 51extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp);
49 52
50extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags); 53extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
54 gfp_t flags);
51 55
52extern void nf_ct_helper_destroy(struct nf_conn *ct); 56extern void nf_ct_helper_destroy(struct nf_conn *ct);
53 57
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index ca6dcf3445ab..e3d3ee3c06a2 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -49,8 +49,8 @@ struct nf_conntrack_l4proto {
49 /* Called when a conntrack entry is destroyed */ 49 /* Called when a conntrack entry is destroyed */
50 void (*destroy)(struct nf_conn *ct); 50 void (*destroy)(struct nf_conn *ct);
51 51
52 int (*error)(struct net *net, struct sk_buff *skb, unsigned int dataoff, 52 int (*error)(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb,
53 enum ip_conntrack_info *ctinfo, 53 unsigned int dataoff, enum ip_conntrack_info *ctinfo,
54 u_int8_t pf, unsigned int hooknum); 54 u_int8_t pf, unsigned int hooknum);
55 55
56 /* Print out the per-protocol part of the tuple. Return like seq_* */ 56 /* Print out the per-protocol part of the tuple. Return like seq_* */
diff --git a/include/net/netfilter/nf_conntrack_zones.h b/include/net/netfilter/nf_conntrack_zones.h
new file mode 100644
index 000000000000..034efe8d45a5
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_zones.h
@@ -0,0 +1,25 @@
1#ifndef _NF_CONNTRACK_ZONES_H
2#define _NF_CONNTRACK_ZONES_H
3
4#define NF_CT_DEFAULT_ZONE 0
5
6#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
7#include <net/netfilter/nf_conntrack_extend.h>
8
9struct nf_conntrack_zone {
10 u16 id;
11};
12
13static inline u16 nf_ct_zone(const struct nf_conn *ct)
14{
15#ifdef CONFIG_NF_CONNTRACK_ZONES
16 struct nf_conntrack_zone *nf_ct_zone;
17 nf_ct_zone = nf_ct_ext_find(ct, NF_CT_EXT_ZONE);
18 if (nf_ct_zone)
19 return nf_ct_zone->id;
20#endif
21 return NF_CT_DEFAULT_ZONE;
22}
23
24#endif /* CONFIG_NF_CONNTRACK || CONFIG_NF_CONNTRACK_MODULE */
25#endif /* _NF_CONNTRACK_ZONES_H */
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index 4222220920a5..02bb6c29dc3d 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -7,13 +7,27 @@
7struct sk_buff; 7struct sk_buff;
8 8
9/* These return true or false. */ 9/* These return true or false. */
10extern int nf_nat_mangle_tcp_packet(struct sk_buff *skb, 10extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb,
11 struct nf_conn *ct, 11 struct nf_conn *ct,
12 enum ip_conntrack_info ctinfo, 12 enum ip_conntrack_info ctinfo,
13 unsigned int match_offset, 13 unsigned int match_offset,
14 unsigned int match_len, 14 unsigned int match_len,
15 const char *rep_buffer, 15 const char *rep_buffer,
16 unsigned int rep_len); 16 unsigned int rep_len, bool adjust);
17
18static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
19 struct nf_conn *ct,
20 enum ip_conntrack_info ctinfo,
21 unsigned int match_offset,
22 unsigned int match_len,
23 const char *rep_buffer,
24 unsigned int rep_len)
25{
26 return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
27 match_offset, match_len,
28 rep_buffer, rep_len, true);
29}
30
17extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, 31extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
18 struct nf_conn *ct, 32 struct nf_conn *ct,
19 enum ip_conntrack_info ctinfo, 33 enum ip_conntrack_info ctinfo,
@@ -21,6 +35,10 @@ extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
21 unsigned int match_len, 35 unsigned int match_len,
22 const char *rep_buffer, 36 const char *rep_buffer,
23 unsigned int rep_len); 37 unsigned int rep_len);
38
39extern void nf_nat_set_seq_adjust(struct nf_conn *ct,
40 enum ip_conntrack_info ctinfo,
41 __be32 seq, s16 off);
24extern int nf_nat_seq_adjust(struct sk_buff *skb, 42extern int nf_nat_seq_adjust(struct sk_buff *skb,
25 struct nf_conn *ct, 43 struct nf_conn *ct,
26 enum ip_conntrack_info ctinfo); 44 enum ip_conntrack_info ctinfo);
diff --git a/include/net/netlink.h b/include/net/netlink.h
index a63b2192ac1c..f82e463c875a 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -196,7 +196,7 @@ enum {
196 * All other Exact length of attribute payload 196 * All other Exact length of attribute payload
197 * 197 *
198 * Example: 198 * Example:
199 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { 199 * static const struct nla_policy my_policy[ATTR_MAX+1] = {
200 * [ATTR_FOO] = { .type = NLA_U16 }, 200 * [ATTR_FOO] = { .type = NLA_U16 },
201 * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ }, 201 * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ },
202 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, 202 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) },
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index ba1ba0c5efd1..d4958d4c6574 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -11,11 +11,13 @@ struct nf_conntrack_ecache;
11struct netns_ct { 11struct netns_ct {
12 atomic_t count; 12 atomic_t count;
13 unsigned int expect_count; 13 unsigned int expect_count;
14 unsigned int htable_size;
15 struct kmem_cache *nf_conntrack_cachep;
14 struct hlist_nulls_head *hash; 16 struct hlist_nulls_head *hash;
15 struct hlist_head *expect_hash; 17 struct hlist_head *expect_hash;
16 struct hlist_nulls_head unconfirmed; 18 struct hlist_nulls_head unconfirmed;
17 struct hlist_nulls_head dying; 19 struct hlist_nulls_head dying;
18 struct ip_conntrack_stat *stat; 20 struct ip_conntrack_stat __percpu *stat;
19 int sysctl_events; 21 int sysctl_events;
20 unsigned int sysctl_events_retry_timeout; 22 unsigned int sysctl_events_retry_timeout;
21 int sysctl_acct; 23 int sysctl_acct;
@@ -28,5 +30,6 @@ struct netns_ct {
28#endif 30#endif
29 int hash_vmalloc; 31 int hash_vmalloc;
30 int expect_vmalloc; 32 int expect_vmalloc;
33 char *slabname;
31}; 34};
32#endif 35#endif
diff --git a/include/net/netns/core.h b/include/net/netns/core.h
index 24d4be76bbd1..78eb1ff75475 100644
--- a/include/net/netns/core.h
+++ b/include/net/netns/core.h
@@ -10,7 +10,7 @@ struct netns_core {
10 10
11 int sysctl_somaxconn; 11 int sysctl_somaxconn;
12 12
13 struct prot_inuse *inuse; 13 struct prot_inuse __percpu *inuse;
14}; 14};
15 15
16#endif 16#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 2eb3814d6258..2764994c9136 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -37,9 +37,12 @@ struct netns_ipv4 {
37 struct xt_table *iptable_mangle; 37 struct xt_table *iptable_mangle;
38 struct xt_table *iptable_raw; 38 struct xt_table *iptable_raw;
39 struct xt_table *arptable_filter; 39 struct xt_table *arptable_filter;
40#ifdef CONFIG_SECURITY
40 struct xt_table *iptable_security; 41 struct xt_table *iptable_security;
42#endif
41 struct xt_table *nat_table; 43 struct xt_table *nat_table;
42 struct hlist_head *nat_bysource; 44 struct hlist_head *nat_bysource;
45 unsigned int nat_htable_size;
43 int nat_vmalloced; 46 int nat_vmalloced;
44#endif 47#endif
45 48
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index dfeb2d7c425b..1f11ebc22151 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -36,8 +36,10 @@ struct netns_ipv6 {
36 struct xt_table *ip6table_filter; 36 struct xt_table *ip6table_filter;
37 struct xt_table *ip6table_mangle; 37 struct xt_table *ip6table_mangle;
38 struct xt_table *ip6table_raw; 38 struct xt_table *ip6table_raw;
39#ifdef CONFIG_SECURITY
39 struct xt_table *ip6table_security; 40 struct xt_table *ip6table_security;
40#endif 41#endif
42#endif
41 struct rt6_info *ip6_null_entry; 43 struct rt6_info *ip6_null_entry;
42 struct rt6_statistics *rt6_stats; 44 struct rt6_statistics *rt6_stats;
43 struct timer_list ip6_fib_timer; 45 struct timer_list ip6_fib_timer;
diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h
index 637daf698884..cb4e894c0f8d 100644
--- a/include/net/netns/packet.h
+++ b/include/net/netns/packet.h
@@ -4,11 +4,11 @@
4#ifndef __NETNS_PACKET_H__ 4#ifndef __NETNS_PACKET_H__
5#define __NETNS_PACKET_H__ 5#define __NETNS_PACKET_H__
6 6
7#include <linux/list.h> 7#include <linux/rculist.h>
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9 9
10struct netns_packet { 10struct netns_packet {
11 rwlock_t sklist_lock; 11 spinlock_t sklist_lock;
12 struct hlist_head sklist; 12 struct hlist_head sklist;
13}; 13};
14 14
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
index 4c61cdce4e5f..35672b1cf44a 100644
--- a/include/net/phonet/pep.h
+++ b/include/net/phonet/pep.h
@@ -44,6 +44,7 @@ struct pep_sock {
44 u8 rx_fc; /* RX flow control */ 44 u8 rx_fc; /* RX flow control */
45 u8 tx_fc; /* TX flow control */ 45 u8 tx_fc; /* TX flow control */
46 u8 init_enable; /* auto-enable at creation */ 46 u8 init_enable; /* auto-enable at creation */
47 u8 aligned;
47}; 48};
48 49
49static inline struct pep_sock *pep_sk(struct sock *sk) 50static inline struct pep_sock *pep_sk(struct sock *sk)
@@ -77,6 +78,7 @@ static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb)
77 78
78enum { 79enum {
79 PNS_PIPE_DATA = 0x20, 80 PNS_PIPE_DATA = 0x20,
81 PNS_PIPE_ALIGNED_DATA,
80 82
81 PNS_PEP_CONNECT_REQ = 0x40, 83 PNS_PEP_CONNECT_REQ = 0x40,
82 PNS_PEP_CONNECT_RESP, 84 PNS_PEP_CONNECT_RESP,
@@ -138,6 +140,7 @@ enum {
138 PN_PIPE_SB_NEGOTIATED_FC, 140 PN_PIPE_SB_NEGOTIATED_FC,
139 PN_PIPE_SB_REQUIRED_FC_TX, 141 PN_PIPE_SB_REQUIRED_FC_TX,
140 PN_PIPE_SB_PREFERRED_FC_RX, 142 PN_PIPE_SB_PREFERRED_FC_RX,
143 PN_PIPE_SB_ALIGNED_DATA,
141}; 144};
142 145
143/* Phonet pipe flow control models */ 146/* Phonet pipe flow control models */
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 2d567265363e..b6cdc33b39c1 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -71,6 +71,7 @@ extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
71 71
72extern struct Qdisc_ops pfifo_qdisc_ops; 72extern struct Qdisc_ops pfifo_qdisc_ops;
73extern struct Qdisc_ops bfifo_qdisc_ops; 73extern struct Qdisc_ops bfifo_qdisc_ops;
74extern struct Qdisc_ops pfifo_head_drop_qdisc_ops;
74 75
75extern int fifo_set_limit(struct Qdisc *q, unsigned int limit); 76extern int fifo_set_limit(struct Qdisc *q, unsigned int limit);
76extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops, 77extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index 47995b81c5d7..f873ee37f7e4 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -39,6 +39,7 @@ enum environment_cap {
39 * 00 - World regulatory domain 39 * 00 - World regulatory domain
40 * 99 - built by driver but a specific alpha2 cannot be determined 40 * 99 - built by driver but a specific alpha2 cannot be determined
41 * 98 - result of an intersection between two regulatory domains 41 * 98 - result of an intersection between two regulatory domains
42 * 97 - regulatory domain has not yet been configured
42 * @intersect: indicates whether the wireless core should intersect 43 * @intersect: indicates whether the wireless core should intersect
43 * the requested regulatory domain with the presently set regulatory 44 * the requested regulatory domain with the presently set regulatory
44 * domain. 45 * domain.
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index c9b50ebd9ce9..99e6e19b57c2 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -45,6 +45,8 @@ struct request_sock_ops {
45 void (*send_reset)(struct sock *sk, 45 void (*send_reset)(struct sock *sk,
46 struct sk_buff *skb); 46 struct sk_buff *skb);
47 void (*destructor)(struct request_sock *req); 47 void (*destructor)(struct request_sock *req);
48 void (*syn_ack_timeout)(struct sock *sk,
49 struct request_sock *req);
48}; 50};
49 51
50/* struct request_sock - mini sock to represent a connection request 52/* struct request_sock - mini sock to represent a connection request
diff --git a/include/net/route.h b/include/net/route.h
index bce6dd68d27b..2c9fba7f7731 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -101,7 +101,7 @@ struct rt_cache_stat {
101 unsigned int out_hlist_search; 101 unsigned int out_hlist_search;
102}; 102};
103 103
104extern struct ip_rt_acct *ip_rt_acct; 104extern struct ip_rt_acct __percpu *ip_rt_acct;
105 105
106struct in_device; 106struct in_device;
107extern int ip_rt_init(void); 107extern int ip_rt_init(void);
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 48d3efcb0880..af60fd050844 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -87,6 +87,8 @@ extern void rtnl_link_unregister(struct rtnl_link_ops *ops);
87extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]); 87extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
88extern struct net_device *rtnl_create_link(struct net *src_net, struct net *net, 88extern struct net_device *rtnl_create_link(struct net *src_net, struct net *net,
89 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]); 89 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]);
90extern int rtnl_configure_link(struct net_device *dev,
91 const struct ifinfomsg *ifm);
90extern const struct nla_policy ifla_policy[IFLA_MAX+1]; 92extern const struct nla_policy ifla_policy[IFLA_MAX+1];
91 93
92#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) 94#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index dad558bc06fa..67dc08eaaa45 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -427,6 +427,25 @@ static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch)
427 return __qdisc_dequeue_head(sch, &sch->q); 427 return __qdisc_dequeue_head(sch, &sch->q);
428} 428}
429 429
430static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch,
431 struct sk_buff_head *list)
432{
433 struct sk_buff *skb = __qdisc_dequeue_head(sch, list);
434
435 if (likely(skb != NULL)) {
436 unsigned int len = qdisc_pkt_len(skb);
437 kfree_skb(skb);
438 return len;
439 }
440
441 return 0;
442}
443
444static inline unsigned int qdisc_queue_drop_head(struct Qdisc *sch)
445{
446 return __qdisc_queue_drop_head(sch, &sch->q);
447}
448
430static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch, 449static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch,
431 struct sk_buff_head *list) 450 struct sk_buff_head *list)
432{ 451{
diff --git a/include/net/snmp.h b/include/net/snmp.h
index f0d756f2ac99..692ee0061dc4 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -32,7 +32,7 @@
32 * - name of entries. 32 * - name of entries.
33 */ 33 */
34struct snmp_mib { 34struct snmp_mib {
35 char *name; 35 const char *name;
36 int entry; 36 int entry;
37}; 37};
38 38
@@ -129,9 +129,9 @@ struct linux_xfrm_mib {
129 * nonlocked_atomic_inc() primitives -AK 129 * nonlocked_atomic_inc() primitives -AK
130 */ 130 */
131#define DEFINE_SNMP_STAT(type, name) \ 131#define DEFINE_SNMP_STAT(type, name) \
132 __typeof__(type) *name[2] 132 __typeof__(type) __percpu *name[2]
133#define DECLARE_SNMP_STAT(type, name) \ 133#define DECLARE_SNMP_STAT(type, name) \
134 extern __typeof__(type) *name[2] 134 extern __typeof__(type) __percpu *name[2]
135 135
136#define SNMP_STAT_BHPTR(name) (name[0]) 136#define SNMP_STAT_BHPTR(name) (name[0])
137#define SNMP_STAT_USRPTR(name) (name[1]) 137#define SNMP_STAT_USRPTR(name) (name[1])
@@ -148,9 +148,13 @@ struct linux_xfrm_mib {
148 __this_cpu_add(mib[0]->mibs[field], addend) 148 __this_cpu_add(mib[0]->mibs[field], addend)
149#define SNMP_ADD_STATS_USER(mib, field, addend) \ 149#define SNMP_ADD_STATS_USER(mib, field, addend) \
150 this_cpu_add(mib[1]->mibs[field], addend) 150 this_cpu_add(mib[1]->mibs[field], addend)
151/*
152 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr"
153 * to make @ptr a non-percpu pointer.
154 */
151#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
152 do { \ 156 do { \
153 __typeof__(mib[0]) ptr; \ 157 __typeof__(*mib[0]) *ptr; \
154 preempt_disable(); \ 158 preempt_disable(); \
155 ptr = this_cpu_ptr((mib)[!in_softirq()]); \ 159 ptr = this_cpu_ptr((mib)[!in_softirq()]); \
156 ptr->mibs[basefield##PKTS]++; \ 160 ptr->mibs[basefield##PKTS]++; \
@@ -159,7 +163,7 @@ struct linux_xfrm_mib {
159 } while (0) 163 } while (0)
160#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 164#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
161 do { \ 165 do { \
162 __typeof__(mib[0]) ptr = \ 166 __typeof__(*mib[0]) *ptr = \
163 __this_cpu_ptr((mib)[!in_softirq()]); \ 167 __this_cpu_ptr((mib)[!in_softirq()]); \
164 ptr->mibs[basefield##PKTS]++; \ 168 ptr->mibs[basefield##PKTS]++; \
165 ptr->mibs[basefield##OCTETS] += addend;\ 169 ptr->mibs[basefield##OCTETS] += addend;\
diff --git a/include/net/sock.h b/include/net/sock.h
index 3f1a4804bb3f..6cb1676e409a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -317,6 +317,11 @@ struct sock {
317/* 317/*
318 * Hashed lists helper routines 318 * Hashed lists helper routines
319 */ 319 */
320static inline struct sock *sk_entry(const struct hlist_node *node)
321{
322 return hlist_entry(node, struct sock, sk_node);
323}
324
320static inline struct sock *__sk_head(const struct hlist_head *head) 325static inline struct sock *__sk_head(const struct hlist_head *head)
321{ 326{
322 return hlist_entry(head->first, struct sock, sk_node); 327 return hlist_entry(head->first, struct sock, sk_node);
@@ -376,6 +381,7 @@ static __inline__ void __sk_del_node(struct sock *sk)
376 __hlist_del(&sk->sk_node); 381 __hlist_del(&sk->sk_node);
377} 382}
378 383
384/* NB: equivalent to hlist_del_init_rcu */
379static __inline__ int __sk_del_node_init(struct sock *sk) 385static __inline__ int __sk_del_node_init(struct sock *sk)
380{ 386{
381 if (sk_hashed(sk)) { 387 if (sk_hashed(sk)) {
@@ -416,6 +422,7 @@ static __inline__ int sk_del_node_init(struct sock *sk)
416 } 422 }
417 return rc; 423 return rc;
418} 424}
425#define sk_del_node_init_rcu(sk) sk_del_node_init(sk)
419 426
420static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk) 427static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk)
421{ 428{
@@ -449,6 +456,12 @@ static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list)
449 __sk_add_node(sk, list); 456 __sk_add_node(sk, list);
450} 457}
451 458
459static __inline__ void sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
460{
461 sock_hold(sk);
462 hlist_add_head_rcu(&sk->sk_node, list);
463}
464
452static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) 465static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
453{ 466{
454 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); 467 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list);
@@ -473,6 +486,8 @@ static __inline__ void sk_add_bind_node(struct sock *sk,
473 486
474#define sk_for_each(__sk, node, list) \ 487#define sk_for_each(__sk, node, list) \
475 hlist_for_each_entry(__sk, node, list, sk_node) 488 hlist_for_each_entry(__sk, node, list, sk_node)
489#define sk_for_each_rcu(__sk, node, list) \
490 hlist_for_each_entry_rcu(__sk, node, list, sk_node)
476#define sk_nulls_for_each(__sk, node, list) \ 491#define sk_nulls_for_each(__sk, node, list) \
477 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node) 492 hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node)
478#define sk_nulls_for_each_rcu(__sk, node, list) \ 493#define sk_nulls_for_each_rcu(__sk, node, list) \
@@ -1044,7 +1059,7 @@ extern void sk_common_release(struct sock *sk);
1044extern void sock_init_data(struct socket *sock, struct sock *sk); 1059extern void sock_init_data(struct socket *sock, struct sock *sk);
1045 1060
1046/** 1061/**
1047 * sk_filter_release: Release a socket filter 1062 * sk_filter_release - release a socket filter
1048 * @fp: filter to remove 1063 * @fp: filter to remove
1049 * 1064 *
1050 * Remove a filter from a socket and release its resources. 1065 * Remove a filter from a socket and release its resources.
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 34f5cc24d903..56f0aec40ed6 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -196,6 +196,9 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
196#define TCP_NAGLE_CORK 2 /* Socket is corked */ 196#define TCP_NAGLE_CORK 2 /* Socket is corked */
197#define TCP_NAGLE_PUSH 4 /* Cork is overridden for already queued data */ 197#define TCP_NAGLE_PUSH 4 /* Cork is overridden for already queued data */
198 198
199/* TCP thin-stream limits */
200#define TCP_THIN_LINEAR_RETRIES 6 /* After 6 linear retries, do exp. backoff */
201
199extern struct inet_timewait_death_row tcp_death_row; 202extern struct inet_timewait_death_row tcp_death_row;
200 203
201/* sysctl variables for tcp */ 204/* sysctl variables for tcp */
@@ -241,6 +244,8 @@ extern int sysctl_tcp_workaround_signed_windows;
241extern int sysctl_tcp_slow_start_after_idle; 244extern int sysctl_tcp_slow_start_after_idle;
242extern int sysctl_tcp_max_ssthresh; 245extern int sysctl_tcp_max_ssthresh;
243extern int sysctl_tcp_cookie_size; 246extern int sysctl_tcp_cookie_size;
247extern int sysctl_tcp_thin_linear_timeouts;
248extern int sysctl_tcp_thin_dupack;
244 249
245extern atomic_t tcp_memory_allocated; 250extern atomic_t tcp_memory_allocated;
246extern struct percpu_counter tcp_sockets_allocated; 251extern struct percpu_counter tcp_sockets_allocated;
@@ -400,6 +405,8 @@ extern int compat_tcp_setsockopt(struct sock *sk,
400 int level, int optname, 405 int level, int optname,
401 char __user *optval, unsigned int optlen); 406 char __user *optval, unsigned int optlen);
402extern void tcp_set_keepalive(struct sock *sk, int val); 407extern void tcp_set_keepalive(struct sock *sk, int val);
408extern void tcp_syn_ack_timeout(struct sock *sk,
409 struct request_sock *req);
403extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, 410extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
404 struct msghdr *msg, 411 struct msghdr *msg,
405 size_t len, int nonblock, 412 size_t len, int nonblock,
@@ -856,13 +863,6 @@ static inline void tcp_check_probe_timer(struct sock *sk)
856 icsk->icsk_rto, TCP_RTO_MAX); 863 icsk->icsk_rto, TCP_RTO_MAX);
857} 864}
858 865
859static inline void tcp_push_pending_frames(struct sock *sk)
860{
861 struct tcp_sock *tp = tcp_sk(sk);
862
863 __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle);
864}
865
866static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq) 866static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq)
867{ 867{
868 tp->snd_wl1 = seq; 868 tp->snd_wl1 = seq;
@@ -972,7 +972,8 @@ static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
972/* Determine a window scaling and initial window to offer. */ 972/* Determine a window scaling and initial window to offer. */
973extern void tcp_select_initial_window(int __space, __u32 mss, 973extern void tcp_select_initial_window(int __space, __u32 mss,
974 __u32 *rcv_wnd, __u32 *window_clamp, 974 __u32 *rcv_wnd, __u32 *window_clamp,
975 int wscale_ok, __u8 *rcv_wscale); 975 int wscale_ok, __u8 *rcv_wscale,
976 __u32 init_rcv_wnd);
976 977
977static inline int tcp_win_from_space(int space) 978static inline int tcp_win_from_space(int space)
978{ 979{
@@ -1193,7 +1194,7 @@ extern int tcp_v4_md5_do_del(struct sock *sk,
1193#define tcp_twsk_md5_key(twsk) NULL 1194#define tcp_twsk_md5_key(twsk) NULL
1194#endif 1195#endif
1195 1196
1196extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(struct sock *); 1197extern struct tcp_md5sig_pool * __percpu *tcp_alloc_md5sig_pool(struct sock *);
1197extern void tcp_free_md5sig_pool(void); 1198extern void tcp_free_md5sig_pool(void);
1198 1199
1199extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); 1200extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu);
@@ -1342,6 +1343,15 @@ static inline int tcp_write_queue_empty(struct sock *sk)
1342 return skb_queue_empty(&sk->sk_write_queue); 1343 return skb_queue_empty(&sk->sk_write_queue);
1343} 1344}
1344 1345
1346static inline void tcp_push_pending_frames(struct sock *sk)
1347{
1348 if (tcp_send_head(sk)) {
1349 struct tcp_sock *tp = tcp_sk(sk);
1350
1351 __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle);
1352 }
1353}
1354
1345/* Start sequence of the highest skb with SACKed bit, valid only if 1355/* Start sequence of the highest skb with SACKed bit, valid only if
1346 * sacked > 0 or when the caller has ensured validity by itself. 1356 * sacked > 0 or when the caller has ensured validity by itself.
1347 */ 1357 */
@@ -1381,6 +1391,14 @@ static inline void tcp_highest_sack_combine(struct sock *sk,
1381 tcp_sk(sk)->highest_sack = new; 1391 tcp_sk(sk)->highest_sack = new;
1382} 1392}
1383 1393
1394/* Determines whether this is a thin stream (which may suffer from
1395 * increased latency). Used to trigger latency-reducing mechanisms.
1396 */
1397static inline unsigned int tcp_stream_is_thin(struct tcp_sock *tp)
1398{
1399 return tp->packets_out < 4 && !tcp_in_initial_slowstart(tp);
1400}
1401
1384/* /proc */ 1402/* /proc */
1385enum tcp_seq_states { 1403enum tcp_seq_states {
1386 TCP_SEQ_STATE_LISTENING, 1404 TCP_SEQ_STATE_LISTENING,
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 60c27706e7b9..a7df3275b860 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -140,6 +140,7 @@ struct xfrm_state {
140 140
141 struct xfrm_id id; 141 struct xfrm_id id;
142 struct xfrm_selector sel; 142 struct xfrm_selector sel;
143 struct xfrm_mark mark;
143 144
144 u32 genid; 145 u32 genid;
145 146
@@ -317,8 +318,8 @@ extern void xfrm_state_delete_tunnel(struct xfrm_state *x);
317struct xfrm_type { 318struct xfrm_type {
318 char *description; 319 char *description;
319 struct module *owner; 320 struct module *owner;
320 __u8 proto; 321 u8 proto;
321 __u8 flags; 322 u8 flags;
322#define XFRM_TYPE_NON_FRAGMENT 1 323#define XFRM_TYPE_NON_FRAGMENT 1
323#define XFRM_TYPE_REPLAY_PROT 2 324#define XFRM_TYPE_REPLAY_PROT 2
324#define XFRM_TYPE_LOCAL_COADDR 4 325#define XFRM_TYPE_LOCAL_COADDR 4
@@ -434,24 +435,24 @@ struct xfrm_tmpl {
434 435
435 unsigned short encap_family; 436 unsigned short encap_family;
436 437
437 __u32 reqid; 438 u32 reqid;
438 439
439/* Mode: transport, tunnel etc. */ 440/* Mode: transport, tunnel etc. */
440 __u8 mode; 441 u8 mode;
441 442
442/* Sharing mode: unique, this session only, this user only etc. */ 443/* Sharing mode: unique, this session only, this user only etc. */
443 __u8 share; 444 u8 share;
444 445
445/* May skip this transfomration if no SA is found */ 446/* May skip this transfomration if no SA is found */
446 __u8 optional; 447 u8 optional;
447 448
448/* Skip aalgos/ealgos/calgos checks. */ 449/* Skip aalgos/ealgos/calgos checks. */
449 __u8 allalgs; 450 u8 allalgs;
450 451
451/* Bit mask of algos allowed for acquisition */ 452/* Bit mask of algos allowed for acquisition */
452 __u32 aalgos; 453 u32 aalgos;
453 __u32 ealgos; 454 u32 ealgos;
454 __u32 calgos; 455 u32 calgos;
455}; 456};
456 457
457#define XFRM_MAX_DEPTH 6 458#define XFRM_MAX_DEPTH 6
@@ -481,6 +482,7 @@ struct xfrm_policy {
481 482
482 u32 priority; 483 u32 priority;
483 u32 index; 484 u32 index;
485 struct xfrm_mark mark;
484 struct xfrm_selector selector; 486 struct xfrm_selector selector;
485 struct xfrm_lifetime_cfg lft; 487 struct xfrm_lifetime_cfg lft;
486 struct xfrm_lifetime_cur curlft; 488 struct xfrm_lifetime_cur curlft;
@@ -770,7 +772,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
770 int pdw; 772 int pdw;
771 int pbi; 773 int pbi;
772 774
773 pdw = prefixlen >> 5; /* num of whole __u32 in prefix */ 775 pdw = prefixlen >> 5; /* num of whole u32 in prefix */
774 pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */ 776 pbi = prefixlen & 0x1f; /* num of bits in incomplete u32 in prefix */
775 777
776 if (pdw) 778 if (pdw)
@@ -1259,7 +1261,7 @@ struct xfrm_algo_desc {
1259/* XFRM tunnel handlers. */ 1261/* XFRM tunnel handlers. */
1260struct xfrm_tunnel { 1262struct xfrm_tunnel {
1261 int (*handler)(struct sk_buff *skb); 1263 int (*handler)(struct sk_buff *skb);
1262 int (*err_handler)(struct sk_buff *skb, __u32 info); 1264 int (*err_handler)(struct sk_buff *skb, u32 info);
1263 1265
1264 struct xfrm_tunnel *next; 1266 struct xfrm_tunnel *next;
1265 int priority; 1267 int priority;
@@ -1317,7 +1319,7 @@ extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t
1317 struct flowi *fl, struct xfrm_tmpl *tmpl, 1319 struct flowi *fl, struct xfrm_tmpl *tmpl,
1318 struct xfrm_policy *pol, int *err, 1320 struct xfrm_policy *pol, int *err,
1319 unsigned short family); 1321 unsigned short family);
1320extern struct xfrm_state * xfrm_stateonly_find(struct net *net, 1322extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark,
1321 xfrm_address_t *daddr, 1323 xfrm_address_t *daddr,
1322 xfrm_address_t *saddr, 1324 xfrm_address_t *saddr,
1323 unsigned short family, 1325 unsigned short family,
@@ -1326,8 +1328,14 @@ extern int xfrm_state_check_expire(struct xfrm_state *x);
1326extern void xfrm_state_insert(struct xfrm_state *x); 1328extern void xfrm_state_insert(struct xfrm_state *x);
1327extern int xfrm_state_add(struct xfrm_state *x); 1329extern int xfrm_state_add(struct xfrm_state *x);
1328extern int xfrm_state_update(struct xfrm_state *x); 1330extern int xfrm_state_update(struct xfrm_state *x);
1329extern struct xfrm_state *xfrm_state_lookup(struct net *net, xfrm_address_t *daddr, __be32 spi, u8 proto, unsigned short family); 1331extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark,
1330extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, xfrm_address_t *daddr, xfrm_address_t *saddr, u8 proto, unsigned short family); 1332 xfrm_address_t *daddr, __be32 spi,
1333 u8 proto, unsigned short family);
1334extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark,
1335 xfrm_address_t *daddr,
1336 xfrm_address_t *saddr,
1337 u8 proto,
1338 unsigned short family);
1331#ifdef CONFIG_XFRM_SUB_POLICY 1339#ifdef CONFIG_XFRM_SUB_POLICY
1332extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, 1340extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
1333 int n, unsigned short family); 1341 int n, unsigned short family);
@@ -1364,7 +1372,8 @@ struct xfrmk_spdinfo {
1364 u32 spdhmcnt; 1372 u32 spdhmcnt;
1365}; 1373};
1366 1374
1367extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 seq); 1375extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark,
1376 u32 seq);
1368extern int xfrm_state_delete(struct xfrm_state *x); 1377extern int xfrm_state_delete(struct xfrm_state *x);
1369extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); 1378extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info);
1370extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); 1379extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si);
@@ -1408,9 +1417,9 @@ extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1408 xfrm_address_t *saddr, u8 proto); 1417 xfrm_address_t *saddr, u8 proto);
1409extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); 1418extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
1410extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); 1419extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
1411extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); 1420extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
1412extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); 1421extern void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr);
1413extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); 1422extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, xfrm_address_t *saddr);
1414extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1423extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1415extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1424extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1416extern int xfrm6_output(struct sk_buff *skb); 1425extern int xfrm6_output(struct sk_buff *skb);
@@ -1441,17 +1450,20 @@ extern int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
1441 int (*func)(struct xfrm_policy *, int, int, void*), void *); 1450 int (*func)(struct xfrm_policy *, int, int, void*), void *);
1442extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); 1451extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk);
1443int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1452int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1444struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u8 type, int dir, 1453struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark,
1454 u8 type, int dir,
1445 struct xfrm_selector *sel, 1455 struct xfrm_selector *sel,
1446 struct xfrm_sec_ctx *ctx, int delete, 1456 struct xfrm_sec_ctx *ctx, int delete,
1447 int *err); 1457 int *err);
1448struct xfrm_policy *xfrm_policy_byid(struct net *net, u8, int dir, u32 id, int delete, int *err); 1458struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, u32 id, int delete, int *err);
1449int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); 1459int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info);
1450u32 xfrm_get_acqseq(void); 1460u32 xfrm_get_acqseq(void);
1451extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1461extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
1452struct xfrm_state * xfrm_find_acq(struct net *net, u8 mode, u32 reqid, u8 proto, 1462struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark,
1453 xfrm_address_t *daddr, xfrm_address_t *saddr, 1463 u8 mode, u32 reqid, u8 proto,
1454 int create, unsigned short family); 1464 xfrm_address_t *daddr,
1465 xfrm_address_t *saddr, int create,
1466 unsigned short family);
1455extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 1467extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
1456extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, 1468extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
1457 struct flowi *fl, int family, int strict); 1469 struct flowi *fl, int family, int strict);
@@ -1500,7 +1512,7 @@ static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b,
1500 switch (family) { 1512 switch (family) {
1501 default: 1513 default:
1502 case AF_INET: 1514 case AF_INET:
1503 return (__force __u32)a->a4 - (__force __u32)b->a4; 1515 return (__force u32)a->a4 - (__force u32)b->a4;
1504 case AF_INET6: 1516 case AF_INET6:
1505 return ipv6_addr_cmp((struct in6_addr *)a, 1517 return ipv6_addr_cmp((struct in6_addr *)a,
1506 (struct in6_addr *)b); 1518 (struct in6_addr *)b);
@@ -1570,4 +1582,24 @@ static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
1570} 1582}
1571#endif 1583#endif
1572 1584
1585static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
1586{
1587 if (attrs[XFRMA_MARK])
1588 memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(m));
1589 else
1590 m->v = m->m = 0;
1591
1592 return m->v & m->m;
1593}
1594
1595static inline int xfrm_mark_put(struct sk_buff *skb, struct xfrm_mark *m)
1596{
1597 if (m->m | m->v)
1598 NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m);
1599 return 0;
1600
1601nla_put_failure:
1602 return -1;
1603}
1604
1573#endif /* _NET_XFRM_H */ 1605#endif /* _NET_XFRM_H */