aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/af_ieee802154.h (renamed from include/net/ieee802154/af_ieee802154.h)6
-rw-r--r--include/net/arp.h2
-rw-r--r--include/net/bluetooth/bluetooth.h5
-rw-r--r--include/net/bluetooth/hci_core.h10
-rw-r--r--include/net/bluetooth/l2cap.h134
-rw-r--r--include/net/bluetooth/rfcomm.h2
-rw-r--r--include/net/cfg80211.h570
-rw-r--r--include/net/dcbnl.h2
-rw-r--r--include/net/dst.h23
-rw-r--r--include/net/dst_ops.h28
-rw-r--r--include/net/genetlink.h66
-rw-r--r--include/net/ieee802154.h (renamed from include/net/ieee802154/mac_def.h)4
-rw-r--r--include/net/ieee802154/nl802154.h41
-rw-r--r--include/net/ieee802154_netdev.h (renamed from include/net/ieee802154/netdevice.h)6
-rw-r--r--include/net/ip6_fib.h6
-rw-r--r--include/net/ip_vs.h119
-rw-r--r--include/net/ipv6.h12
-rw-r--r--include/net/irda/ircomm_event.h2
-rw-r--r--include/net/irda/ircomm_tty_attach.h4
-rw-r--r--include/net/irda/irlap_event.h2
-rw-r--r--include/net/irda/irlmp_event.h4
-rw-r--r--include/net/iw_handler.h8
-rw-r--r--include/net/mac80211.h195
-rw-r--r--include/net/neighbour.h6
-rw-r--r--include/net/net_namespace.h26
-rw-r--r--include/net/netns/ipv6.h3
-rw-r--r--include/net/netns/x_tables.h3
-rw-r--r--include/net/nl802154.h126
-rw-r--r--include/net/phonet/pn_dev.h2
-rw-r--r--include/net/pkt_sched.h3
-rw-r--r--include/net/sch_generic.h15
-rw-r--r--include/net/scm.h2
-rw-r--r--include/net/sctp/constants.h4
-rw-r--r--include/net/tcp.h40
-rw-r--r--include/net/udp.h3
-rw-r--r--include/net/wpan-phy.h63
-rw-r--r--include/net/xfrm.h2
37 files changed, 1190 insertions, 359 deletions
diff --git a/include/net/ieee802154/af_ieee802154.h b/include/net/af_ieee802154.h
index 0d78605fb1a6..75e64c7a2960 100644
--- a/include/net/ieee802154/af_ieee802154.h
+++ b/include/net/af_ieee802154.h
@@ -54,7 +54,9 @@ struct sockaddr_ieee802154 {
54 struct ieee802154_addr addr; 54 struct ieee802154_addr addr;
55}; 55};
56 56
57/* master device */ 57/* get/setsockopt */
58#define IEEE802154_SIOC_ADD_SLAVE (SIOCDEVPRIVATE + 0) 58#define SOL_IEEE802154 0
59
60#define WPAN_WANTACK 0
59 61
60#endif 62#endif
diff --git a/include/net/arp.h b/include/net/arp.h
index c236270ec95e..716f43c5c98e 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -26,6 +26,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
26 const unsigned char *target_hw); 26 const unsigned char *target_hw);
27extern void arp_xmit(struct sk_buff *skb); 27extern void arp_xmit(struct sk_buff *skb);
28 28
29extern struct neigh_ops arp_broken_ops; 29extern const struct neigh_ops arp_broken_ops;
30 30
31#endif /* _ARP_H */ 31#endif /* _ARP_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 968166a45f86..718394e2c01e 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -138,8 +138,11 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
138struct bt_skb_cb { 138struct bt_skb_cb {
139 __u8 pkt_type; 139 __u8 pkt_type;
140 __u8 incoming; 140 __u8 incoming;
141 __u8 tx_seq;
142 __u8 retries;
143 __u8 sar;
141}; 144};
142#define bt_cb(skb) ((struct bt_skb_cb *)(skb->cb)) 145#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
143 146
144static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how) 147static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how)
145{ 148{
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index c4ca4228b083..7b640aeddb64 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -117,7 +117,7 @@ struct hci_dev {
117 struct sk_buff *sent_cmd; 117 struct sk_buff *sent_cmd;
118 struct sk_buff *reassembly[3]; 118 struct sk_buff *reassembly[3];
119 119
120 struct semaphore req_lock; 120 struct mutex req_lock;
121 wait_queue_head_t req_wait_q; 121 wait_queue_head_t req_wait_q;
122 __u32 req_status; 122 __u32 req_status;
123 __u32 req_result; 123 __u32 req_result;
@@ -187,6 +187,7 @@ struct hci_conn {
187 struct work_struct work_del; 187 struct work_struct work_del;
188 188
189 struct device dev; 189 struct device dev;
190 atomic_t devref;
190 191
191 struct hci_dev *hdev; 192 struct hci_dev *hdev;
192 void *l2cap_data; 193 void *l2cap_data;
@@ -339,6 +340,9 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
339void hci_conn_enter_active_mode(struct hci_conn *conn); 340void hci_conn_enter_active_mode(struct hci_conn *conn);
340void hci_conn_enter_sniff_mode(struct hci_conn *conn); 341void hci_conn_enter_sniff_mode(struct hci_conn *conn);
341 342
343void hci_conn_hold_device(struct hci_conn *conn);
344void hci_conn_put_device(struct hci_conn *conn);
345
342static inline void hci_conn_hold(struct hci_conn *conn) 346static inline void hci_conn_hold(struct hci_conn *conn)
343{ 347{
344 atomic_inc(&conn->refcnt); 348 atomic_inc(&conn->refcnt);
@@ -700,8 +704,8 @@ struct hci_sec_filter {
700#define HCI_REQ_PEND 1 704#define HCI_REQ_PEND 1
701#define HCI_REQ_CANCELED 2 705#define HCI_REQ_CANCELED 2
702 706
703#define hci_req_lock(d) down(&d->req_lock) 707#define hci_req_lock(d) mutex_lock(&d->req_lock)
704#define hci_req_unlock(d) up(&d->req_lock) 708#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
705 709
706void hci_req_complete(struct hci_dev *hdev, int result); 710void hci_req_complete(struct hci_dev *hdev, int result);
707 711
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index e919fca1072a..9516f4b4a3c2 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -27,12 +27,14 @@
27 27
28/* L2CAP defaults */ 28/* L2CAP defaults */
29#define L2CAP_DEFAULT_MTU 672 29#define L2CAP_DEFAULT_MTU 672
30#define L2CAP_DEFAULT_MIN_MTU 48
30#define L2CAP_DEFAULT_FLUSH_TO 0xffff 31#define L2CAP_DEFAULT_FLUSH_TO 0xffff
31#define L2CAP_DEFAULT_RX_WINDOW 1 32#define L2CAP_DEFAULT_TX_WINDOW 63
32#define L2CAP_DEFAULT_MAX_RECEIVE 1 33#define L2CAP_DEFAULT_NUM_TO_ACK (L2CAP_DEFAULT_TX_WINDOW/5)
33#define L2CAP_DEFAULT_RETRANS_TO 300 /* 300 milliseconds */ 34#define L2CAP_DEFAULT_MAX_TX 3
34#define L2CAP_DEFAULT_MONITOR_TO 1000 /* 1 second */ 35#define L2CAP_DEFAULT_RETRANS_TO 1000 /* 1 second */
35#define L2CAP_DEFAULT_MAX_RX_APDU 0xfff7 36#define L2CAP_DEFAULT_MONITOR_TO 12000 /* 12 seconds */
37#define L2CAP_DEFAULT_MAX_PDU_SIZE 672
36 38
37#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 39#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
38#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 40#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
@@ -52,6 +54,7 @@ struct l2cap_options {
52 __u16 imtu; 54 __u16 imtu;
53 __u16 flush_to; 55 __u16 flush_to;
54 __u8 mode; 56 __u8 mode;
57 __u8 fcs;
55}; 58};
56 59
57#define L2CAP_CONNINFO 0x02 60#define L2CAP_CONNINFO 0x02
@@ -93,6 +96,32 @@ struct l2cap_conninfo {
93#define L2CAP_FCS_NONE 0x00 96#define L2CAP_FCS_NONE 0x00
94#define L2CAP_FCS_CRC16 0x01 97#define L2CAP_FCS_CRC16 0x01
95 98
99/* L2CAP Control Field bit masks */
100#define L2CAP_CTRL_SAR 0xC000
101#define L2CAP_CTRL_REQSEQ 0x3F00
102#define L2CAP_CTRL_TXSEQ 0x007E
103#define L2CAP_CTRL_RETRANS 0x0080
104#define L2CAP_CTRL_FINAL 0x0080
105#define L2CAP_CTRL_POLL 0x0010
106#define L2CAP_CTRL_SUPERVISE 0x000C
107#define L2CAP_CTRL_FRAME_TYPE 0x0001 /* I- or S-Frame */
108
109#define L2CAP_CTRL_TXSEQ_SHIFT 1
110#define L2CAP_CTRL_REQSEQ_SHIFT 8
111#define L2CAP_CTRL_SAR_SHIFT 14
112
113/* L2CAP Supervisory Function */
114#define L2CAP_SUPER_RCV_READY 0x0000
115#define L2CAP_SUPER_REJECT 0x0004
116#define L2CAP_SUPER_RCV_NOT_READY 0x0008
117#define L2CAP_SUPER_SELECT_REJECT 0x000C
118
119/* L2CAP Segmentation and Reassembly */
120#define L2CAP_SDU_UNSEGMENTED 0x0000
121#define L2CAP_SDU_START 0x4000
122#define L2CAP_SDU_END 0x8000
123#define L2CAP_SDU_CONTINUE 0xC000
124
96/* L2CAP structures */ 125/* L2CAP structures */
97struct l2cap_hdr { 126struct l2cap_hdr {
98 __le16 len; 127 __le16 len;
@@ -190,7 +219,7 @@ struct l2cap_conf_rfc {
190#define L2CAP_MODE_RETRANS 0x01 219#define L2CAP_MODE_RETRANS 0x01
191#define L2CAP_MODE_FLOWCTL 0x02 220#define L2CAP_MODE_FLOWCTL 0x02
192#define L2CAP_MODE_ERTM 0x03 221#define L2CAP_MODE_ERTM 0x03
193#define L2CAP_MODE_STREAM 0x04 222#define L2CAP_MODE_STREAMING 0x04
194 223
195struct l2cap_disconn_req { 224struct l2cap_disconn_req {
196 __le16 dcid; 225 __le16 dcid;
@@ -261,6 +290,14 @@ struct l2cap_conn {
261 290
262/* ----- L2CAP channel and socket info ----- */ 291/* ----- L2CAP channel and socket info ----- */
263#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 292#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
293#define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue)
294#define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue)
295#define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list)
296
297struct srej_list {
298 __u8 tx_seq;
299 struct list_head list;
300};
264 301
265struct l2cap_pinfo { 302struct l2cap_pinfo {
266 struct bt_sock bt; 303 struct bt_sock bt;
@@ -271,30 +308,97 @@ struct l2cap_pinfo {
271 __u16 imtu; 308 __u16 imtu;
272 __u16 omtu; 309 __u16 omtu;
273 __u16 flush_to; 310 __u16 flush_to;
274 __u8 sec_level; 311 __u8 mode;
312 __u8 num_conf_req;
313 __u8 num_conf_rsp;
314
315 __u8 fcs;
316 __u8 sec_level;
275 __u8 role_switch; 317 __u8 role_switch;
276 __u8 force_reliable; 318 __u8 force_reliable;
277 319
278 __u8 conf_req[64]; 320 __u8 conf_req[64];
279 __u8 conf_len; 321 __u8 conf_len;
280 __u8 conf_state; 322 __u8 conf_state;
281 __u8 conf_retry; 323 __u8 conn_state;
324
325 __u8 next_tx_seq;
326 __u8 expected_ack_seq;
327 __u8 req_seq;
328 __u8 expected_tx_seq;
329 __u8 buffer_seq;
330 __u8 buffer_seq_srej;
331 __u8 srej_save_reqseq;
332 __u8 unacked_frames;
333 __u8 retry_count;
334 __u8 num_to_ack;
335 __u16 sdu_len;
336 __u16 partial_sdu_len;
337 struct sk_buff *sdu;
282 338
283 __u8 ident; 339 __u8 ident;
284 340
341 __u8 remote_tx_win;
342 __u8 remote_max_tx;
343 __u16 retrans_timeout;
344 __u16 monitor_timeout;
345 __u16 max_pdu_size;
346
285 __le16 sport; 347 __le16 sport;
286 348
349 struct timer_list retrans_timer;
350 struct timer_list monitor_timer;
351 struct sk_buff_head tx_queue;
352 struct sk_buff_head srej_queue;
353 struct srej_list srej_l;
287 struct l2cap_conn *conn; 354 struct l2cap_conn *conn;
288 struct sock *next_c; 355 struct sock *next_c;
289 struct sock *prev_c; 356 struct sock *prev_c;
290}; 357};
291 358
292#define L2CAP_CONF_REQ_SENT 0x01 359#define L2CAP_CONF_REQ_SENT 0x01
293#define L2CAP_CONF_INPUT_DONE 0x02 360#define L2CAP_CONF_INPUT_DONE 0x02
294#define L2CAP_CONF_OUTPUT_DONE 0x04 361#define L2CAP_CONF_OUTPUT_DONE 0x04
295#define L2CAP_CONF_CONNECT_PEND 0x80 362#define L2CAP_CONF_MTU_DONE 0x08
296 363#define L2CAP_CONF_MODE_DONE 0x10
297#define L2CAP_CONF_MAX_RETRIES 2 364#define L2CAP_CONF_CONNECT_PEND 0x20
365#define L2CAP_CONF_NO_FCS_RECV 0x40
366#define L2CAP_CONF_STATE2_DEVICE 0x80
367
368#define L2CAP_CONF_MAX_CONF_REQ 2
369#define L2CAP_CONF_MAX_CONF_RSP 2
370
371#define L2CAP_CONN_SAR_SDU 0x01
372#define L2CAP_CONN_SREJ_SENT 0x02
373#define L2CAP_CONN_WAIT_F 0x04
374#define L2CAP_CONN_SREJ_ACT 0x08
375#define L2CAP_CONN_SEND_PBIT 0x10
376#define L2CAP_CONN_REMOTE_BUSY 0x20
377#define L2CAP_CONN_LOCAL_BUSY 0x40
378
379#define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \
380 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
381#define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \
382 jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
383
384static inline int l2cap_tx_window_full(struct sock *sk)
385{
386 struct l2cap_pinfo *pi = l2cap_pi(sk);
387 int sub;
388
389 sub = (pi->next_tx_seq - pi->expected_ack_seq) % 64;
390
391 if (sub < 0)
392 sub += 64;
393
394 return (sub == pi->remote_tx_win);
395}
396
397#define __get_txseq(ctrl) ((ctrl) & L2CAP_CTRL_TXSEQ) >> 1
398#define __get_reqseq(ctrl) ((ctrl) & L2CAP_CTRL_REQSEQ) >> 8
399#define __is_iframe(ctrl) !((ctrl) & L2CAP_CTRL_FRAME_TYPE)
400#define __is_sframe(ctrl) (ctrl) & L2CAP_CTRL_FRAME_TYPE
401#define __is_sar_start(ctrl) ((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START
298 402
299void l2cap_load(void); 403void l2cap_load(void);
300 404
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index c274993234e3..921d7b3c7f8d 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -29,6 +29,7 @@
29#define RFCOMM_CONN_TIMEOUT (HZ * 30) 29#define RFCOMM_CONN_TIMEOUT (HZ * 30)
30#define RFCOMM_DISC_TIMEOUT (HZ * 20) 30#define RFCOMM_DISC_TIMEOUT (HZ * 20)
31#define RFCOMM_AUTH_TIMEOUT (HZ * 25) 31#define RFCOMM_AUTH_TIMEOUT (HZ * 25)
32#define RFCOMM_IDLE_TIMEOUT (HZ * 2)
32 33
33#define RFCOMM_DEFAULT_MTU 127 34#define RFCOMM_DEFAULT_MTU 127
34#define RFCOMM_DEFAULT_CREDITS 7 35#define RFCOMM_DEFAULT_CREDITS 7
@@ -154,6 +155,7 @@ struct rfcomm_msc {
154struct rfcomm_session { 155struct rfcomm_session {
155 struct list_head list; 156 struct list_head list;
156 struct socket *sock; 157 struct socket *sock;
158 struct timer_list timer;
157 unsigned long state; 159 unsigned long state;
158 unsigned long flags; 160 unsigned long flags;
159 atomic_t refcnt; 161 atomic_t refcnt;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index d1892d66701a..3d874c620219 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -80,7 +80,6 @@ enum ieee80211_channel_flags {
80 * with cfg80211. 80 * with cfg80211.
81 * 81 *
82 * @center_freq: center frequency in MHz 82 * @center_freq: center frequency in MHz
83 * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
84 * @hw_value: hardware-specific value for the channel 83 * @hw_value: hardware-specific value for the channel
85 * @flags: channel flags from &enum ieee80211_channel_flags. 84 * @flags: channel flags from &enum ieee80211_channel_flags.
86 * @orig_flags: channel flags at registration time, used by regulatory 85 * @orig_flags: channel flags at registration time, used by regulatory
@@ -97,7 +96,6 @@ enum ieee80211_channel_flags {
97struct ieee80211_channel { 96struct ieee80211_channel {
98 enum ieee80211_band band; 97 enum ieee80211_band band;
99 u16 center_freq; 98 u16 center_freq;
100 u8 max_bandwidth;
101 u16 hw_value; 99 u16 hw_value;
102 u32 flags; 100 u32 flags;
103 int max_antenna_gain; 101 int max_antenna_gain;
@@ -372,6 +370,10 @@ struct rate_info {
372 * @txrate: current unicast bitrate to this station 370 * @txrate: current unicast bitrate to this station
373 * @rx_packets: packets received from this station 371 * @rx_packets: packets received from this station
374 * @tx_packets: packets transmitted to this station 372 * @tx_packets: packets transmitted to this station
373 * @generation: generation number for nl80211 dumps.
374 * This number should increase every time the list of stations
375 * changes, i.e. when a station is added or removed, so that
376 * userspace can tell whether it got a consistent snapshot.
375 */ 377 */
376struct station_info { 378struct station_info {
377 u32 filled; 379 u32 filled;
@@ -385,6 +387,8 @@ struct station_info {
385 struct rate_info txrate; 387 struct rate_info txrate;
386 u32 rx_packets; 388 u32 rx_packets;
387 u32 tx_packets; 389 u32 tx_packets;
390
391 int generation;
388}; 392};
389 393
390/** 394/**
@@ -444,6 +448,10 @@ enum mpath_info_flags {
444 * @flags: mesh path flags 448 * @flags: mesh path flags
445 * @discovery_timeout: total mesh path discovery timeout, in msecs 449 * @discovery_timeout: total mesh path discovery timeout, in msecs
446 * @discovery_retries: mesh path discovery retries 450 * @discovery_retries: mesh path discovery retries
451 * @generation: generation number for nl80211 dumps.
452 * This number should increase every time the list of mesh paths
453 * changes, i.e. when a station is added or removed, so that
454 * userspace can tell whether it got a consistent snapshot.
447 */ 455 */
448struct mpath_info { 456struct mpath_info {
449 u32 filled; 457 u32 filled;
@@ -454,6 +462,8 @@ struct mpath_info {
454 u32 discovery_timeout; 462 u32 discovery_timeout;
455 u8 discovery_retries; 463 u8 discovery_retries;
456 u8 flags; 464 u8 flags;
465
466 int generation;
457}; 467};
458 468
459/** 469/**
@@ -538,23 +548,26 @@ struct cfg80211_ssid {
538 * @ssids: SSIDs to scan for (active scan only) 548 * @ssids: SSIDs to scan for (active scan only)
539 * @n_ssids: number of SSIDs 549 * @n_ssids: number of SSIDs
540 * @channels: channels to scan on. 550 * @channels: channels to scan on.
541 * @n_channels: number of channels for each band 551 * @n_channels: total number of channels to scan
542 * @ie: optional information element(s) to add into Probe Request or %NULL 552 * @ie: optional information element(s) to add into Probe Request or %NULL
543 * @ie_len: length of ie in octets 553 * @ie_len: length of ie in octets
544 * @wiphy: the wiphy this was for 554 * @wiphy: the wiphy this was for
545 * @ifidx: the interface index 555 * @dev: the interface
546 */ 556 */
547struct cfg80211_scan_request { 557struct cfg80211_scan_request {
548 struct cfg80211_ssid *ssids; 558 struct cfg80211_ssid *ssids;
549 int n_ssids; 559 int n_ssids;
550 struct ieee80211_channel **channels;
551 u32 n_channels; 560 u32 n_channels;
552 const u8 *ie; 561 const u8 *ie;
553 size_t ie_len; 562 size_t ie_len;
554 563
555 /* internal */ 564 /* internal */
556 struct wiphy *wiphy; 565 struct wiphy *wiphy;
557 int ifidx; 566 struct net_device *dev;
567 bool aborted;
568
569 /* keep last */
570 struct ieee80211_channel *channels[0];
558}; 571};
559 572
560/** 573/**
@@ -584,7 +597,6 @@ enum cfg80211_signal_type {
584 * is no guarantee that these are well-formed!) 597 * is no guarantee that these are well-formed!)
585 * @len_information_elements: total length of the information elements 598 * @len_information_elements: total length of the information elements
586 * @signal: signal strength value (type depends on the wiphy's signal_type) 599 * @signal: signal strength value (type depends on the wiphy's signal_type)
587 * @hold: BSS should not expire
588 * @free_priv: function pointer to free private data 600 * @free_priv: function pointer to free private data
589 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 601 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
590 */ 602 */
@@ -605,37 +617,59 @@ struct cfg80211_bss {
605}; 617};
606 618
607/** 619/**
620 * ieee80211_bss_get_ie - find IE with given ID
621 * @bss: the bss to search
622 * @ie: the IE ID
623 * Returns %NULL if not found.
624 */
625const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
626
627
628/**
629 * struct cfg80211_crypto_settings - Crypto settings
630 * @wpa_versions: indicates which, if any, WPA versions are enabled
631 * (from enum nl80211_wpa_versions)
632 * @cipher_group: group key cipher suite (or 0 if unset)
633 * @n_ciphers_pairwise: number of AP supported unicast ciphers
634 * @ciphers_pairwise: unicast key cipher suites
635 * @n_akm_suites: number of AKM suites
636 * @akm_suites: AKM suites
637 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
638 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
639 * required to assume that the port is unauthorized until authorized by
640 * user space. Otherwise, port is marked authorized by default.
641 */
642struct cfg80211_crypto_settings {
643 u32 wpa_versions;
644 u32 cipher_group;
645 int n_ciphers_pairwise;
646 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
647 int n_akm_suites;
648 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
649 bool control_port;
650};
651
652/**
608 * struct cfg80211_auth_request - Authentication request data 653 * struct cfg80211_auth_request - Authentication request data
609 * 654 *
610 * This structure provides information needed to complete IEEE 802.11 655 * This structure provides information needed to complete IEEE 802.11
611 * authentication. 656 * authentication.
612 * NOTE: This structure will likely change when more code from mac80211 is 657 *
613 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too. 658 * @bss: The BSS to authenticate with.
614 * Before using this in a driver that does not use mac80211, it would be better
615 * to check the status of that work and better yet, volunteer to work on it.
616 *
617 * @chan: The channel to use or %NULL if not specified (auto-select based on
618 * scan results)
619 * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case);
620 * this field is required to be present; if the driver wants to help with
621 * BSS selection, it should use (yet to be added) MLME event to allow user
622 * space SME to be notified of roaming candidate, so that the SME can then
623 * use the authentication request with the recommended BSSID and whatever
624 * other data may be needed for authentication/association
625 * @ssid: SSID or %NULL if not yet available
626 * @ssid_len: Length of ssid in octets
627 * @auth_type: Authentication type (algorithm) 659 * @auth_type: Authentication type (algorithm)
628 * @ie: Extra IEs to add to Authentication frame or %NULL 660 * @ie: Extra IEs to add to Authentication frame or %NULL
629 * @ie_len: Length of ie buffer in octets 661 * @ie_len: Length of ie buffer in octets
662 * @key_len: length of WEP key for shared key authentication
663 * @key_idx: index of WEP key for shared key authentication
664 * @key: WEP key for shared key authentication
630 */ 665 */
631struct cfg80211_auth_request { 666struct cfg80211_auth_request {
632 struct ieee80211_channel *chan; 667 struct cfg80211_bss *bss;
633 u8 *peer_addr;
634 const u8 *ssid;
635 size_t ssid_len;
636 enum nl80211_auth_type auth_type;
637 const u8 *ie; 668 const u8 *ie;
638 size_t ie_len; 669 size_t ie_len;
670 enum nl80211_auth_type auth_type;
671 const u8 *key;
672 u8 key_len, key_idx;
639}; 673};
640 674
641/** 675/**
@@ -643,35 +677,19 @@ struct cfg80211_auth_request {
643 * 677 *
644 * This structure provides information needed to complete IEEE 802.11 678 * This structure provides information needed to complete IEEE 802.11
645 * (re)association. 679 * (re)association.
646 * NOTE: This structure will likely change when more code from mac80211 is 680 * @bss: The BSS to associate with.
647 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
648 * Before using this in a driver that does not use mac80211, it would be better
649 * to check the status of that work and better yet, volunteer to work on it.
650 *
651 * @chan: The channel to use or %NULL if not specified (auto-select based on
652 * scan results)
653 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
654 * to be present and the STA must be in State 2 (authenticated) with the
655 * peer STA
656 * @ssid: SSID
657 * @ssid_len: Length of ssid in octets
658 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 681 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
659 * @ie_len: Length of ie buffer in octets 682 * @ie_len: Length of ie buffer in octets
660 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 683 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
661 * @control_port: Whether user space controls IEEE 802.1X port, i.e., 684 * @crypto: crypto settings
662 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 685 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
663 * required to assume that the port is unauthorized until authorized by
664 * user space. Otherwise, port is marked authorized by default.
665 */ 686 */
666struct cfg80211_assoc_request { 687struct cfg80211_assoc_request {
667 struct ieee80211_channel *chan; 688 struct cfg80211_bss *bss;
668 u8 *peer_addr; 689 const u8 *ie, *prev_bssid;
669 const u8 *ssid;
670 size_t ssid_len;
671 const u8 *ie;
672 size_t ie_len; 690 size_t ie_len;
691 struct cfg80211_crypto_settings crypto;
673 bool use_mfp; 692 bool use_mfp;
674 bool control_port;
675}; 693};
676 694
677/** 695/**
@@ -680,16 +698,16 @@ struct cfg80211_assoc_request {
680 * This structure provides information needed to complete IEEE 802.11 698 * This structure provides information needed to complete IEEE 802.11
681 * deauthentication. 699 * deauthentication.
682 * 700 *
683 * @peer_addr: The address of the peer STA (AP BSSID); this field is required 701 * @bss: the BSS to deauthenticate from
684 * to be present and the STA must be authenticated with the peer STA
685 * @ie: Extra IEs to add to Deauthentication frame or %NULL 702 * @ie: Extra IEs to add to Deauthentication frame or %NULL
686 * @ie_len: Length of ie buffer in octets 703 * @ie_len: Length of ie buffer in octets
704 * @reason_code: The reason code for the deauthentication
687 */ 705 */
688struct cfg80211_deauth_request { 706struct cfg80211_deauth_request {
689 u8 *peer_addr; 707 struct cfg80211_bss *bss;
690 u16 reason_code;
691 const u8 *ie; 708 const u8 *ie;
692 size_t ie_len; 709 size_t ie_len;
710 u16 reason_code;
693}; 711};
694 712
695/** 713/**
@@ -698,16 +716,16 @@ struct cfg80211_deauth_request {
698 * This structure provides information needed to complete IEEE 802.11 716 * This structure provides information needed to complete IEEE 802.11
699 * disassocation. 717 * disassocation.
700 * 718 *
701 * @peer_addr: The address of the peer STA (AP BSSID); this field is required 719 * @bss: the BSS to disassociate from
702 * to be present and the STA must be associated with the peer STA
703 * @ie: Extra IEs to add to Disassociation frame or %NULL 720 * @ie: Extra IEs to add to Disassociation frame or %NULL
704 * @ie_len: Length of ie buffer in octets 721 * @ie_len: Length of ie buffer in octets
722 * @reason_code: The reason code for the disassociation
705 */ 723 */
706struct cfg80211_disassoc_request { 724struct cfg80211_disassoc_request {
707 u8 *peer_addr; 725 struct cfg80211_bss *bss;
708 u16 reason_code;
709 const u8 *ie; 726 const u8 *ie;
710 size_t ie_len; 727 size_t ie_len;
728 u16 reason_code;
711}; 729};
712 730
713/** 731/**
@@ -726,6 +744,8 @@ struct cfg80211_disassoc_request {
726 * @ie: information element(s) to include in the beacon 744 * @ie: information element(s) to include in the beacon
727 * @ie_len: length of that 745 * @ie_len: length of that
728 * @beacon_interval: beacon interval to use 746 * @beacon_interval: beacon interval to use
747 * @privacy: this is a protected network, keys will be configured
748 * after joining
729 */ 749 */
730struct cfg80211_ibss_params { 750struct cfg80211_ibss_params {
731 u8 *ssid; 751 u8 *ssid;
@@ -735,6 +755,42 @@ struct cfg80211_ibss_params {
735 u8 ssid_len, ie_len; 755 u8 ssid_len, ie_len;
736 u16 beacon_interval; 756 u16 beacon_interval;
737 bool channel_fixed; 757 bool channel_fixed;
758 bool privacy;
759};
760
761/**
762 * struct cfg80211_connect_params - Connection parameters
763 *
764 * This structure provides information needed to complete IEEE 802.11
765 * authentication and association.
766 *
767 * @channel: The channel to use or %NULL if not specified (auto-select based
768 * on scan results)
769 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
770 * results)
771 * @ssid: SSID
772 * @ssid_len: Length of ssid in octets
773 * @auth_type: Authentication type (algorithm)
774 * @assoc_ie: IEs for association request
775 * @assoc_ie_len: Length of assoc_ie in octets
776 * @privacy: indicates whether privacy-enabled APs should be used
777 * @crypto: crypto settings
778 * @key_len: length of WEP key for shared key authentication
779 * @key_idx: index of WEP key for shared key authentication
780 * @key: WEP key for shared key authentication
781 */
782struct cfg80211_connect_params {
783 struct ieee80211_channel *channel;
784 u8 *bssid;
785 u8 *ssid;
786 size_t ssid_len;
787 enum nl80211_auth_type auth_type;
788 u8 *ie;
789 size_t ie_len;
790 bool privacy;
791 struct cfg80211_crypto_settings crypto;
792 const u8 *key;
793 u8 key_len, key_idx;
738}; 794};
739 795
740/** 796/**
@@ -764,6 +820,26 @@ enum tx_power_setting {
764 TX_POWER_FIXED, 820 TX_POWER_FIXED,
765}; 821};
766 822
823/*
824 * cfg80211_bitrate_mask - masks for bitrate control
825 */
826struct cfg80211_bitrate_mask {
827/*
828 * As discussed in Berlin, this struct really
829 * should look like this:
830
831 struct {
832 u32 legacy;
833 u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
834 } control[IEEE80211_NUM_BANDS];
835
836 * Since we can always fix in-kernel users, let's keep
837 * it simpler for now:
838 */
839 u32 fixed; /* fixed bitrate, 0 == not fixed */
840 u32 maxrate; /* in kbps, 0 == no limit */
841};
842
767/** 843/**
768 * struct cfg80211_ops - backend description for wireless configuration 844 * struct cfg80211_ops - backend description for wireless configuration
769 * 845 *
@@ -781,7 +857,8 @@ enum tx_power_setting {
781 * @resume: wiphy device needs to be resumed 857 * @resume: wiphy device needs to be resumed
782 * 858 *
783 * @add_virtual_intf: create a new virtual interface with the given name, 859 * @add_virtual_intf: create a new virtual interface with the given name,
784 * must set the struct wireless_dev's iftype. 860 * must set the struct wireless_dev's iftype. Beware: You must create
861 * the new netdev in the wiphy's network namespace!
785 * 862 *
786 * @del_virtual_intf: remove the virtual interface determined by ifindex. 863 * @del_virtual_intf: remove the virtual interface determined by ifindex.
787 * 864 *
@@ -841,6 +918,12 @@ enum tx_power_setting {
841 * @deauth: Request to deauthenticate from the specified peer 918 * @deauth: Request to deauthenticate from the specified peer
842 * @disassoc: Request to disassociate from the specified peer 919 * @disassoc: Request to disassociate from the specified peer
843 * 920 *
921 * @connect: Connect to the ESS with the specified parameters. When connected,
922 * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
923 * If the connection fails for some reason, call cfg80211_connect_result()
924 * with the status from the AP.
925 * @disconnect: Disconnect from the BSS/ESS.
926 *
844 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 927 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
845 * cfg80211_ibss_joined(), also call that function when changing BSSID due 928 * cfg80211_ibss_joined(), also call that function when changing BSSID due
846 * to a merge. 929 * to a merge.
@@ -857,6 +940,8 @@ enum tx_power_setting {
857 * 940 *
858 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 941 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
859 * functions to adjust rfkill hw state 942 * functions to adjust rfkill hw state
943 *
944 * @testmode_cmd: run a test mode command
860 */ 945 */
861struct cfg80211_ops { 946struct cfg80211_ops {
862 int (*suspend)(struct wiphy *wiphy); 947 int (*suspend)(struct wiphy *wiphy);
@@ -865,8 +950,9 @@ struct cfg80211_ops {
865 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 950 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
866 enum nl80211_iftype type, u32 *flags, 951 enum nl80211_iftype type, u32 *flags,
867 struct vif_params *params); 952 struct vif_params *params);
868 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); 953 int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev);
869 int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, 954 int (*change_virtual_intf)(struct wiphy *wiphy,
955 struct net_device *dev,
870 enum nl80211_iftype type, u32 *flags, 956 enum nl80211_iftype type, u32 *flags,
871 struct vif_params *params); 957 struct vif_params *params);
872 958
@@ -939,9 +1025,16 @@ struct cfg80211_ops {
939 int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1025 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
940 struct cfg80211_assoc_request *req); 1026 struct cfg80211_assoc_request *req);
941 int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 1027 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
942 struct cfg80211_deauth_request *req); 1028 struct cfg80211_deauth_request *req,
1029 void *cookie);
943 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1030 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
944 struct cfg80211_disassoc_request *req); 1031 struct cfg80211_disassoc_request *req,
1032 void *cookie);
1033
1034 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
1035 struct cfg80211_connect_params *sme);
1036 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
1037 u16 reason_code);
945 1038
946 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 1039 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
947 struct cfg80211_ibss_params *params); 1040 struct cfg80211_ibss_params *params);
@@ -953,7 +1046,23 @@ struct cfg80211_ops {
953 enum tx_power_setting type, int dbm); 1046 enum tx_power_setting type, int dbm);
954 int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 1047 int (*get_tx_power)(struct wiphy *wiphy, int *dbm);
955 1048
1049 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
1050 u8 *addr);
1051
956 void (*rfkill_poll)(struct wiphy *wiphy); 1052 void (*rfkill_poll)(struct wiphy *wiphy);
1053
1054#ifdef CONFIG_NL80211_TESTMODE
1055 int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
1056#endif
1057
1058 int (*set_bitrate_mask)(struct wiphy *wiphy,
1059 struct net_device *dev,
1060 const u8 *peer,
1061 const struct cfg80211_bitrate_mask *mask);
1062
1063 /* some temporary stuff to finish wext */
1064 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1065 bool enabled, int timeout);
957}; 1066};
958 1067
959/* 1068/*
@@ -996,6 +1105,12 @@ struct cfg80211_ops {
996 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 1105 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
997 * -1 = fragmentation disabled, only odd values >= 256 used 1106 * -1 = fragmentation disabled, only odd values >= 256 used
998 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1107 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
1108 * @net: the network namespace this wiphy currently lives in
1109 * @netnsok: if set to false, do not allow changing the netns of this
1110 * wiphy at all
1111 * @ps_default: default for powersave, will be set depending on the
1112 * kernel's default on wiphy_new(), but can be changed by the
1113 * driver if it has a good reason to override the default
999 */ 1114 */
1000struct wiphy { 1115struct wiphy {
1001 /* assign these fields before you register the wiphy */ 1116 /* assign these fields before you register the wiphy */
@@ -1010,6 +1125,9 @@ struct wiphy {
1010 bool strict_regulatory; 1125 bool strict_regulatory;
1011 bool disable_beacon_hints; 1126 bool disable_beacon_hints;
1012 1127
1128 bool netnsok;
1129 bool ps_default;
1130
1013 enum cfg80211_signal_type signal_type; 1131 enum cfg80211_signal_type signal_type;
1014 1132
1015 int bss_priv_size; 1133 int bss_priv_size;
@@ -1048,9 +1166,35 @@ struct wiphy {
1048 /* dir in debugfs: ieee80211/<wiphyname> */ 1166 /* dir in debugfs: ieee80211/<wiphyname> */
1049 struct dentry *debugfsdir; 1167 struct dentry *debugfsdir;
1050 1168
1169#ifdef CONFIG_NET_NS
1170 /* the network namespace this phy lives in currently */
1171 struct net *_net;
1172#endif
1173
1051 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 1174 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
1052}; 1175};
1053 1176
1177#ifdef CONFIG_NET_NS
1178static inline struct net *wiphy_net(struct wiphy *wiphy)
1179{
1180 return wiphy->_net;
1181}
1182
1183static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1184{
1185 wiphy->_net = net;
1186}
1187#else
1188static inline struct net *wiphy_net(struct wiphy *wiphy)
1189{
1190 return &init_net;
1191}
1192
1193static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
1194{
1195}
1196#endif
1197
1054/** 1198/**
1055 * wiphy_priv - return priv from wiphy 1199 * wiphy_priv - return priv from wiphy
1056 * 1200 *
@@ -1063,6 +1207,17 @@ static inline void *wiphy_priv(struct wiphy *wiphy)
1063} 1207}
1064 1208
1065/** 1209/**
1210 * priv_to_wiphy - return the wiphy containing the priv
1211 *
1212 * @priv: a pointer previously returned by wiphy_priv
1213 */
1214static inline struct wiphy *priv_to_wiphy(void *priv)
1215{
1216 BUG_ON(!priv);
1217 return container_of(priv, struct wiphy, priv);
1218}
1219
1220/**
1066 * set_wiphy_dev - set device pointer for wiphy 1221 * set_wiphy_dev - set device pointer for wiphy
1067 * 1222 *
1068 * @wiphy: The wiphy whose device to bind 1223 * @wiphy: The wiphy whose device to bind
@@ -1134,6 +1289,13 @@ extern void wiphy_unregister(struct wiphy *wiphy);
1134 */ 1289 */
1135extern void wiphy_free(struct wiphy *wiphy); 1290extern void wiphy_free(struct wiphy *wiphy);
1136 1291
1292/* internal structs */
1293struct cfg80211_conn;
1294struct cfg80211_internal_bss;
1295struct cfg80211_cached_keys;
1296
1297#define MAX_AUTH_BSSES 4
1298
1137/** 1299/**
1138 * struct wireless_dev - wireless per-netdev state 1300 * struct wireless_dev - wireless per-netdev state
1139 * 1301 *
@@ -1157,22 +1319,45 @@ struct wireless_dev {
1157 struct wiphy *wiphy; 1319 struct wiphy *wiphy;
1158 enum nl80211_iftype iftype; 1320 enum nl80211_iftype iftype;
1159 1321
1160 /* private to the generic wireless code */ 1322 /* the remainder of this struct should be private to cfg80211 */
1161 struct list_head list; 1323 struct list_head list;
1162 struct net_device *netdev; 1324 struct net_device *netdev;
1163 1325
1164 /* currently used for IBSS - might be rearranged in the future */ 1326 struct mutex mtx;
1165 struct cfg80211_bss *current_bss; 1327
1166 u8 bssid[ETH_ALEN]; 1328 struct work_struct cleanup_work;
1329
1330 /* currently used for IBSS and SME - might be rearranged later */
1167 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1331 u8 ssid[IEEE80211_MAX_SSID_LEN];
1168 u8 ssid_len; 1332 u8 ssid_len;
1333 enum {
1334 CFG80211_SME_IDLE,
1335 CFG80211_SME_CONNECTING,
1336 CFG80211_SME_CONNECTED,
1337 } sme_state;
1338 struct cfg80211_conn *conn;
1339 struct cfg80211_cached_keys *connect_keys;
1340
1341 struct list_head event_list;
1342 spinlock_t event_lock;
1343
1344 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
1345 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
1346 struct cfg80211_internal_bss *current_bss; /* associated / joined */
1169 1347
1170#ifdef CONFIG_WIRELESS_EXT 1348#ifdef CONFIG_WIRELESS_EXT
1171 /* wext data */ 1349 /* wext data */
1172 struct { 1350 struct {
1173 struct cfg80211_ibss_params ibss; 1351 struct cfg80211_ibss_params ibss;
1174 u8 bssid[ETH_ALEN]; 1352 struct cfg80211_connect_params connect;
1353 struct cfg80211_cached_keys *keys;
1354 u8 *ie;
1355 size_t ie_len;
1356 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
1357 u8 ssid[IEEE80211_MAX_SSID_LEN];
1175 s8 default_key, default_mgmt_key; 1358 s8 default_key, default_mgmt_key;
1359 bool ps, prev_bssid_valid;
1360 int ps_timeout;
1176 } wext; 1361 } wext;
1177#endif 1362#endif
1178}; 1363};
@@ -1352,20 +1537,6 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb);
1352extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 1537extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
1353 1538
1354/** 1539/**
1355 * regulatory_hint_11d - hints a country IE as a regulatory domain
1356 * @wiphy: the wireless device giving the hint (used only for reporting
1357 * conflicts)
1358 * @country_ie: pointer to the country IE
1359 * @country_ie_len: length of the country IE
1360 *
1361 * We will intersect the rd with the what CRDA tells us should apply
1362 * for the alpha2 this country IE belongs to, this prevents APs from
1363 * sending us incorrect or outdated information against a country.
1364 */
1365extern void regulatory_hint_11d(struct wiphy *wiphy,
1366 u8 *country_ie,
1367 u8 country_ie_len);
1368/**
1369 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 1540 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
1370 * @wiphy: the wireless device we want to process the regulatory domain on 1541 * @wiphy: the wireless device we want to process the regulatory domain on
1371 * @regd: the custom regulatory domain to use for this wiphy 1542 * @regd: the custom regulatory domain to use for this wiphy
@@ -1433,27 +1604,34 @@ int cfg80211_wext_siwmlme(struct net_device *dev,
1433int cfg80211_wext_giwrange(struct net_device *dev, 1604int cfg80211_wext_giwrange(struct net_device *dev,
1434 struct iw_request_info *info, 1605 struct iw_request_info *info,
1435 struct iw_point *data, char *extra); 1606 struct iw_point *data, char *extra);
1436int cfg80211_ibss_wext_siwfreq(struct net_device *dev, 1607int cfg80211_wext_siwgenie(struct net_device *dev,
1437 struct iw_request_info *info, 1608 struct iw_request_info *info,
1438 struct iw_freq *freq, char *extra); 1609 struct iw_point *data, char *extra);
1439int cfg80211_ibss_wext_giwfreq(struct net_device *dev, 1610int cfg80211_wext_siwauth(struct net_device *dev,
1440 struct iw_request_info *info, 1611 struct iw_request_info *info,
1441 struct iw_freq *freq, char *extra); 1612 struct iw_param *data, char *extra);
1442int cfg80211_ibss_wext_siwessid(struct net_device *dev, 1613int cfg80211_wext_giwauth(struct net_device *dev,
1443 struct iw_request_info *info, 1614 struct iw_request_info *info,
1444 struct iw_point *data, char *ssid); 1615 struct iw_param *data, char *extra);
1445int cfg80211_ibss_wext_giwessid(struct net_device *dev,
1446 struct iw_request_info *info,
1447 struct iw_point *data, char *ssid);
1448int cfg80211_ibss_wext_siwap(struct net_device *dev,
1449 struct iw_request_info *info,
1450 struct sockaddr *ap_addr, char *extra);
1451int cfg80211_ibss_wext_giwap(struct net_device *dev,
1452 struct iw_request_info *info,
1453 struct sockaddr *ap_addr, char *extra);
1454 1616
1455struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy, 1617int cfg80211_wext_siwfreq(struct net_device *dev,
1456 struct iw_freq *freq); 1618 struct iw_request_info *info,
1619 struct iw_freq *freq, char *extra);
1620int cfg80211_wext_giwfreq(struct net_device *dev,
1621 struct iw_request_info *info,
1622 struct iw_freq *freq, char *extra);
1623int cfg80211_wext_siwessid(struct net_device *dev,
1624 struct iw_request_info *info,
1625 struct iw_point *data, char *ssid);
1626int cfg80211_wext_giwessid(struct net_device *dev,
1627 struct iw_request_info *info,
1628 struct iw_point *data, char *ssid);
1629int cfg80211_wext_siwrate(struct net_device *dev,
1630 struct iw_request_info *info,
1631 struct iw_param *rate, char *extra);
1632int cfg80211_wext_giwrate(struct net_device *dev,
1633 struct iw_request_info *info,
1634 struct iw_param *rate, char *extra);
1457 1635
1458int cfg80211_wext_siwrts(struct net_device *dev, 1636int cfg80211_wext_siwrts(struct net_device *dev,
1459 struct iw_request_info *info, 1637 struct iw_request_info *info,
@@ -1488,6 +1666,21 @@ int cfg80211_wext_siwtxpower(struct net_device *dev,
1488int cfg80211_wext_giwtxpower(struct net_device *dev, 1666int cfg80211_wext_giwtxpower(struct net_device *dev,
1489 struct iw_request_info *info, 1667 struct iw_request_info *info,
1490 union iwreq_data *data, char *keybuf); 1668 union iwreq_data *data, char *keybuf);
1669struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev);
1670
1671int cfg80211_wext_siwpower(struct net_device *dev,
1672 struct iw_request_info *info,
1673 struct iw_param *wrq, char *extra);
1674int cfg80211_wext_giwpower(struct net_device *dev,
1675 struct iw_request_info *info,
1676 struct iw_param *wrq, char *extra);
1677
1678int cfg80211_wext_siwap(struct net_device *dev,
1679 struct iw_request_info *info,
1680 struct sockaddr *ap_addr, char *extra);
1681int cfg80211_wext_giwap(struct net_device *dev,
1682 struct iw_request_info *info,
1683 struct sockaddr *ap_addr, char *extra);
1491 1684
1492/* 1685/*
1493 * callbacks for asynchronous cfg80211 methods, notification 1686 * callbacks for asynchronous cfg80211 methods, notification
@@ -1569,7 +1762,7 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
1569 * This function is called whenever an authentication has been processed in 1762 * This function is called whenever an authentication has been processed in
1570 * station mode. The driver is required to call either this function or 1763 * station mode. The driver is required to call either this function or
1571 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 1764 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
1572 * call. 1765 * call. This function may sleep.
1573 */ 1766 */
1574void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 1767void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
1575 1768
@@ -1577,6 +1770,8 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
1577 * cfg80211_send_auth_timeout - notification of timed out authentication 1770 * cfg80211_send_auth_timeout - notification of timed out authentication
1578 * @dev: network device 1771 * @dev: network device
1579 * @addr: The MAC address of the device with which the authentication timed out 1772 * @addr: The MAC address of the device with which the authentication timed out
1773 *
1774 * This function may sleep.
1580 */ 1775 */
1581void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 1776void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
1582 1777
@@ -1589,7 +1784,7 @@ void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
1589 * This function is called whenever a (re)association response has been 1784 * This function is called whenever a (re)association response has been
1590 * processed in station mode. The driver is required to call either this 1785 * processed in station mode. The driver is required to call either this
1591 * function or cfg80211_send_assoc_timeout() to indicate the result of 1786 * function or cfg80211_send_assoc_timeout() to indicate the result of
1592 * cfg80211_ops::assoc() call. 1787 * cfg80211_ops::assoc() call. This function may sleep.
1593 */ 1788 */
1594void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 1789void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
1595 1790
@@ -1597,6 +1792,8 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
1597 * cfg80211_send_assoc_timeout - notification of timed out association 1792 * cfg80211_send_assoc_timeout - notification of timed out association
1598 * @dev: network device 1793 * @dev: network device
1599 * @addr: The MAC address of the device with which the association timed out 1794 * @addr: The MAC address of the device with which the association timed out
1795 *
1796 * This function may sleep.
1600 */ 1797 */
1601void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 1798void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1602 1799
@@ -1605,41 +1802,30 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1605 * @dev: network device 1802 * @dev: network device
1606 * @buf: deauthentication frame (header + body) 1803 * @buf: deauthentication frame (header + body)
1607 * @len: length of the frame data 1804 * @len: length of the frame data
1805 * @cookie: cookie from ->deauth if called within that callback,
1806 * %NULL otherwise
1608 * 1807 *
1609 * This function is called whenever deauthentication has been processed in 1808 * This function is called whenever deauthentication has been processed in
1610 * station mode. This includes both received deauthentication frames and 1809 * station mode. This includes both received deauthentication frames and
1611 * locally generated ones. 1810 * locally generated ones. This function may sleep.
1612 */ 1811 */
1613void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); 1812void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len,
1813 void *cookie);
1614 1814
1615/** 1815/**
1616 * cfg80211_send_disassoc - notification of processed disassociation 1816 * cfg80211_send_disassoc - notification of processed disassociation
1617 * @dev: network device 1817 * @dev: network device
1618 * @buf: disassociation response frame (header + body) 1818 * @buf: disassociation response frame (header + body)
1619 * @len: length of the frame data 1819 * @len: length of the frame data
1820 * @cookie: cookie from ->disassoc if called within that callback,
1821 * %NULL otherwise
1620 * 1822 *
1621 * This function is called whenever disassociation has been processed in 1823 * This function is called whenever disassociation has been processed in
1622 * station mode. This includes both received disassociation frames and locally 1824 * station mode. This includes both received disassociation frames and locally
1623 * generated ones. 1825 * generated ones. This function may sleep.
1624 */
1625void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
1626
1627/**
1628 * cfg80211_hold_bss - exclude bss from expiration
1629 * @bss: bss which should not expire
1630 *
1631 * In a case when the BSS is not updated but it shouldn't expire this
1632 * function can be used to mark the BSS to be excluded from expiration.
1633 */
1634void cfg80211_hold_bss(struct cfg80211_bss *bss);
1635
1636/**
1637 * cfg80211_unhold_bss - remove expiration exception from the BSS
1638 * @bss: bss which can expire again
1639 *
1640 * This function marks the BSS to be expirable again.
1641 */ 1826 */
1642void cfg80211_unhold_bss(struct cfg80211_bss *bss); 1827void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len,
1828 void *cookie);
1643 1829
1644/** 1830/**
1645 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 1831 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
@@ -1648,6 +1834,7 @@ void cfg80211_unhold_bss(struct cfg80211_bss *bss);
1648 * @key_type: The key type that the received frame used 1834 * @key_type: The key type that the received frame used
1649 * @key_id: Key identifier (0..3) 1835 * @key_id: Key identifier (0..3)
1650 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 1836 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
1837 * @gfp: allocation flags
1651 * 1838 *
1652 * This function is called whenever the local MAC detects a MIC failure in a 1839 * This function is called whenever the local MAC detects a MIC failure in a
1653 * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 1840 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
@@ -1655,7 +1842,7 @@ void cfg80211_unhold_bss(struct cfg80211_bss *bss);
1655 */ 1842 */
1656void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 1843void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
1657 enum nl80211_key_type key_type, int key_id, 1844 enum nl80211_key_type key_type, int key_id,
1658 const u8 *tsc); 1845 const u8 *tsc, gfp_t gfp);
1659 1846
1660/** 1847/**
1661 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 1848 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
@@ -1692,4 +1879,137 @@ void wiphy_rfkill_start_polling(struct wiphy *wiphy);
1692 */ 1879 */
1693void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 1880void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
1694 1881
1882#ifdef CONFIG_NL80211_TESTMODE
1883/**
1884 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
1885 * @wiphy: the wiphy
1886 * @approxlen: an upper bound of the length of the data that will
1887 * be put into the skb
1888 *
1889 * This function allocates and pre-fills an skb for a reply to
1890 * the testmode command. Since it is intended for a reply, calling
1891 * it outside of the @testmode_cmd operation is invalid.
1892 *
1893 * The returned skb (or %NULL if any errors happen) is pre-filled
1894 * with the wiphy index and set up in a way that any data that is
1895 * put into the skb (with skb_put(), nla_put() or similar) will end
1896 * up being within the %NL80211_ATTR_TESTDATA attribute, so all that
1897 * needs to be done with the skb is adding data for the corresponding
1898 * userspace tool which can then read that data out of the testdata
1899 * attribute. You must not modify the skb in any other way.
1900 *
1901 * When done, call cfg80211_testmode_reply() with the skb and return
1902 * its error code as the result of the @testmode_cmd operation.
1903 */
1904struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
1905 int approxlen);
1906
1907/**
1908 * cfg80211_testmode_reply - send the reply skb
1909 * @skb: The skb, must have been allocated with
1910 * cfg80211_testmode_alloc_reply_skb()
1911 *
1912 * Returns an error code or 0 on success, since calling this
1913 * function will usually be the last thing before returning
1914 * from the @testmode_cmd you should return the error code.
1915 * Note that this function consumes the skb regardless of the
1916 * return value.
1917 */
1918int cfg80211_testmode_reply(struct sk_buff *skb);
1919
1920/**
1921 * cfg80211_testmode_alloc_event_skb - allocate testmode event
1922 * @wiphy: the wiphy
1923 * @approxlen: an upper bound of the length of the data that will
1924 * be put into the skb
1925 * @gfp: allocation flags
1926 *
1927 * This function allocates and pre-fills an skb for an event on the
1928 * testmode multicast group.
1929 *
1930 * The returned skb (or %NULL if any errors happen) is set up in the
1931 * same way as with cfg80211_testmode_alloc_reply_skb() but prepared
1932 * for an event. As there, you should simply add data to it that will
1933 * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must
1934 * not modify the skb in any other way.
1935 *
1936 * When done filling the skb, call cfg80211_testmode_event() with the
1937 * skb to send the event.
1938 */
1939struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
1940 int approxlen, gfp_t gfp);
1941
1942/**
1943 * cfg80211_testmode_event - send the event
1944 * @skb: The skb, must have been allocated with
1945 * cfg80211_testmode_alloc_event_skb()
1946 * @gfp: allocation flags
1947 *
1948 * This function sends the given @skb, which must have been allocated
1949 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
1950 * consumes it.
1951 */
1952void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
1953
1954#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
1955#else
1956#define CFG80211_TESTMODE_CMD(cmd)
1957#endif
1958
1959/**
1960 * cfg80211_connect_result - notify cfg80211 of connection result
1961 *
1962 * @dev: network device
1963 * @bssid: the BSSID of the AP
1964 * @req_ie: association request IEs (maybe be %NULL)
1965 * @req_ie_len: association request IEs length
1966 * @resp_ie: association response IEs (may be %NULL)
1967 * @resp_ie_len: assoc response IEs length
1968 * @status: status code, 0 for successful connection, use
1969 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
1970 * the real status code for failures.
1971 * @gfp: allocation flags
1972 *
1973 * It should be called by the underlying driver whenever connect() has
1974 * succeeded.
1975 */
1976void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
1977 const u8 *req_ie, size_t req_ie_len,
1978 const u8 *resp_ie, size_t resp_ie_len,
1979 u16 status, gfp_t gfp);
1980
1981/**
1982 * cfg80211_roamed - notify cfg80211 of roaming
1983 *
1984 * @dev: network device
1985 * @bssid: the BSSID of the new AP
1986 * @req_ie: association request IEs (maybe be %NULL)
1987 * @req_ie_len: association request IEs length
1988 * @resp_ie: association response IEs (may be %NULL)
1989 * @resp_ie_len: assoc response IEs length
1990 * @gfp: allocation flags
1991 *
1992 * It should be called by the underlying driver whenever it roamed
1993 * from one AP to another while connected.
1994 */
1995void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
1996 const u8 *req_ie, size_t req_ie_len,
1997 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
1998
1999/**
2000 * cfg80211_disconnected - notify cfg80211 that connection was dropped
2001 *
2002 * @dev: network device
2003 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
2004 * @ie_len: length of IEs
2005 * @reason: reason code for the disconnection, set it to 0 if unknown
2006 * @gfp: allocation flags
2007 *
2008 * After it calls this function, the driver should enter an idle state
2009 * and not try to connect to any AP any more.
2010 */
2011void cfg80211_disconnected(struct net_device *dev, u16 reason,
2012 u8 *ie, size_t ie_len, gfp_t gfp);
2013
2014
1695#endif /* __NET_CFG80211_H */ 2015#endif /* __NET_CFG80211_H */
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index 775cfc8055be..b36ac7e0914d 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -48,6 +48,8 @@ struct dcbnl_rtnl_ops {
48 void (*setbcncfg)(struct net_device *, int, u32); 48 void (*setbcncfg)(struct net_device *, int, u32);
49 void (*getbcnrp)(struct net_device *, int, u8 *); 49 void (*getbcnrp)(struct net_device *, int, u8 *);
50 void (*setbcnrp)(struct net_device *, int, u8); 50 void (*setbcnrp)(struct net_device *, int, u8);
51 u8 (*setapp)(struct net_device *, u8, u16, u8);
52 u8 (*getapp)(struct net_device *, u8, u16);
51}; 53};
52 54
53#endif /* __NET_DCBNL_H__ */ 55#endif /* __NET_DCBNL_H__ */
diff --git a/include/net/dst.h b/include/net/dst.h
index 7fc409c19b37..5a900ddcf10d 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -8,6 +8,7 @@
8#ifndef _NET_DST_H 8#ifndef _NET_DST_H
9#define _NET_DST_H 9#define _NET_DST_H
10 10
11#include <net/dst_ops.h>
11#include <linux/netdevice.h> 12#include <linux/netdevice.h>
12#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
13#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
@@ -102,28 +103,6 @@ struct dst_entry
102 }; 103 };
103}; 104};
104 105
105
106struct dst_ops
107{
108 unsigned short family;
109 __be16 protocol;
110 unsigned gc_thresh;
111
112 int (*gc)(struct dst_ops *ops);
113 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
114 void (*destroy)(struct dst_entry *);
115 void (*ifdown)(struct dst_entry *,
116 struct net_device *dev, int how);
117 struct dst_entry * (*negative_advice)(struct dst_entry *);
118 void (*link_failure)(struct sk_buff *);
119 void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
120 int (*local_out)(struct sk_buff *skb);
121
122 atomic_t entries;
123 struct kmem_cache *kmem_cachep;
124 struct net *dst_net;
125};
126
127#ifdef __KERNEL__ 106#ifdef __KERNEL__
128 107
129static inline u32 108static inline u32
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
new file mode 100644
index 000000000000..d1ff9b7e99b8
--- /dev/null
+++ b/include/net/dst_ops.h
@@ -0,0 +1,28 @@
1#ifndef _NET_DST_OPS_H
2#define _NET_DST_OPS_H
3#include <linux/types.h>
4
5struct dst_entry;
6struct kmem_cachep;
7struct net_device;
8struct sk_buff;
9
10struct dst_ops {
11 unsigned short family;
12 __be16 protocol;
13 unsigned gc_thresh;
14
15 int (*gc)(struct dst_ops *ops);
16 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
17 void (*destroy)(struct dst_entry *);
18 void (*ifdown)(struct dst_entry *,
19 struct net_device *dev, int how);
20 struct dst_entry * (*negative_advice)(struct dst_entry *);
21 void (*link_failure)(struct sk_buff *);
22 void (*update_pmtu)(struct dst_entry *dst, u32 mtu);
23 int (*local_out)(struct sk_buff *skb);
24
25 atomic_t entries;
26 struct kmem_cache *kmem_cachep;
27};
28#endif
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 1b0e3ee4ddd8..2a1c06874c42 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/genetlink.h> 4#include <linux/genetlink.h>
5#include <net/netlink.h> 5#include <net/netlink.h>
6#include <net/net_namespace.h>
6 7
7/** 8/**
8 * struct genl_multicast_group - generic netlink multicast group 9 * struct genl_multicast_group - generic netlink multicast group
@@ -27,6 +28,8 @@ struct genl_multicast_group
27 * @name: name of family 28 * @name: name of family
28 * @version: protocol version 29 * @version: protocol version
29 * @maxattr: maximum number of attributes supported 30 * @maxattr: maximum number of attributes supported
31 * @netnsok: set to true if the family can handle network
32 * namespaces and should be presented in all of them
30 * @attrbuf: buffer to store parsed attributes 33 * @attrbuf: buffer to store parsed attributes
31 * @ops_list: list of all assigned operations 34 * @ops_list: list of all assigned operations
32 * @family_list: family list 35 * @family_list: family list
@@ -39,6 +42,7 @@ struct genl_family
39 char name[GENL_NAMSIZ]; 42 char name[GENL_NAMSIZ];
40 unsigned int version; 43 unsigned int version;
41 unsigned int maxattr; 44 unsigned int maxattr;
45 bool netnsok;
42 struct nlattr ** attrbuf; /* private */ 46 struct nlattr ** attrbuf; /* private */
43 struct list_head ops_list; /* private */ 47 struct list_head ops_list; /* private */
44 struct list_head family_list; /* private */ 48 struct list_head family_list; /* private */
@@ -62,8 +66,32 @@ struct genl_info
62 struct genlmsghdr * genlhdr; 66 struct genlmsghdr * genlhdr;
63 void * userhdr; 67 void * userhdr;
64 struct nlattr ** attrs; 68 struct nlattr ** attrs;
69#ifdef CONFIG_NET_NS
70 struct net * _net;
71#endif
65}; 72};
66 73
74#ifdef CONFIG_NET_NS
75static inline struct net *genl_info_net(struct genl_info *info)
76{
77 return info->_net;
78}
79
80static inline void genl_info_net_set(struct genl_info *info, struct net *net)
81{
82 info->_net = net;
83}
84#else
85static inline struct net *genl_info_net(struct genl_info *info)
86{
87 return &init_net;
88}
89
90static inline void genl_info_net_set(struct genl_info *info, struct net *net)
91{
92}
93#endif
94
67/** 95/**
68 * struct genl_ops - generic netlink operations 96 * struct genl_ops - generic netlink operations
69 * @cmd: command identifier 97 * @cmd: command identifier
@@ -98,8 +126,6 @@ extern int genl_register_mc_group(struct genl_family *family,
98extern void genl_unregister_mc_group(struct genl_family *family, 126extern void genl_unregister_mc_group(struct genl_family *family,
99 struct genl_multicast_group *grp); 127 struct genl_multicast_group *grp);
100 128
101extern struct sock *genl_sock;
102
103/** 129/**
104 * genlmsg_put - Add generic netlink header to netlink message 130 * genlmsg_put - Add generic netlink header to netlink message
105 * @skb: socket buffer holding the message 131 * @skb: socket buffer holding the message
@@ -170,7 +196,21 @@ static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
170} 196}
171 197
172/** 198/**
173 * genlmsg_multicast - multicast a netlink message 199 * genlmsg_multicast_netns - multicast a netlink message to a specific netns
200 * @net: the net namespace
201 * @skb: netlink message as socket buffer
202 * @pid: own netlink pid to avoid sending to yourself
203 * @group: multicast group id
204 * @flags: allocation flags
205 */
206static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb,
207 u32 pid, unsigned int group, gfp_t flags)
208{
209 return nlmsg_multicast(net->genl_sock, skb, pid, group, flags);
210}
211
212/**
213 * genlmsg_multicast - multicast a netlink message to the default netns
174 * @skb: netlink message as socket buffer 214 * @skb: netlink message as socket buffer
175 * @pid: own netlink pid to avoid sending to yourself 215 * @pid: own netlink pid to avoid sending to yourself
176 * @group: multicast group id 216 * @group: multicast group id
@@ -179,17 +219,29 @@ static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
179static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid, 219static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid,
180 unsigned int group, gfp_t flags) 220 unsigned int group, gfp_t flags)
181{ 221{
182 return nlmsg_multicast(genl_sock, skb, pid, group, flags); 222 return genlmsg_multicast_netns(&init_net, skb, pid, group, flags);
183} 223}
184 224
185/** 225/**
226 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces
227 * @skb: netlink message as socket buffer
228 * @pid: own netlink pid to avoid sending to yourself
229 * @group: multicast group id
230 * @flags: allocation flags
231 *
232 * This function must hold the RTNL or rcu_read_lock().
233 */
234int genlmsg_multicast_allns(struct sk_buff *skb, u32 pid,
235 unsigned int group, gfp_t flags);
236
237/**
186 * genlmsg_unicast - unicast a netlink message 238 * genlmsg_unicast - unicast a netlink message
187 * @skb: netlink message as socket buffer 239 * @skb: netlink message as socket buffer
188 * @pid: netlink pid of the destination socket 240 * @pid: netlink pid of the destination socket
189 */ 241 */
190static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid) 242static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 pid)
191{ 243{
192 return nlmsg_unicast(genl_sock, skb, pid); 244 return nlmsg_unicast(net->genl_sock, skb, pid);
193} 245}
194 246
195/** 247/**
@@ -199,7 +251,7 @@ static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid)
199 */ 251 */
200static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info) 252static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info)
201{ 253{
202 return genlmsg_unicast(skb, info->snd_pid); 254 return genlmsg_unicast(genl_info_net(info), skb, info->snd_pid);
203} 255}
204 256
205/** 257/**
diff --git a/include/net/ieee802154/mac_def.h b/include/net/ieee802154.h
index 8cb684635650..d52685defb11 100644
--- a/include/net/ieee802154/mac_def.h
+++ b/include/net/ieee802154.h
@@ -23,8 +23,8 @@
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 */ 24 */
25 25
26#ifndef IEEE802154_MAC_DEF_H 26#ifndef NET_IEEE802154_H
27#define IEEE802154_MAC_DEF_H 27#define NET_IEEE802154_H
28 28
29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */ 29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */ 30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
diff --git a/include/net/ieee802154/nl802154.h b/include/net/ieee802154/nl802154.h
deleted file mode 100644
index 78efcdf52b59..000000000000
--- a/include/net/ieee802154/nl802154.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27int ieee802154_nl_assoc_indic(struct net_device *dev,
28 struct ieee802154_addr *addr, u8 cap);
29int ieee802154_nl_assoc_confirm(struct net_device *dev,
30 u16 short_addr, u8 status);
31int ieee802154_nl_disassoc_indic(struct net_device *dev,
32 struct ieee802154_addr *addr, u8 reason);
33int ieee802154_nl_disassoc_confirm(struct net_device *dev,
34 u8 status);
35int ieee802154_nl_scan_confirm(struct net_device *dev,
36 u8 status, u8 scan_type, u32 unscanned,
37 u8 *edl/*, struct list_head *pan_desc_list */);
38int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid,
39 u16 coord_addr);
40
41#endif
diff --git a/include/net/ieee802154/netdevice.h b/include/net/ieee802154_netdev.h
index e2506af3e7c8..5dc6a61952de 100644
--- a/include/net/ieee802154/netdevice.h
+++ b/include/net/ieee802154_netdev.h
@@ -80,7 +80,7 @@ static inline int mac_cb_type(struct sk_buff *skb)
80struct ieee802154_mlme_ops { 80struct ieee802154_mlme_ops {
81 int (*assoc_req)(struct net_device *dev, 81 int (*assoc_req)(struct net_device *dev,
82 struct ieee802154_addr *addr, 82 struct ieee802154_addr *addr,
83 u8 channel, u8 cap); 83 u8 channel, u8 page, u8 cap);
84 int (*assoc_resp)(struct net_device *dev, 84 int (*assoc_resp)(struct net_device *dev,
85 struct ieee802154_addr *addr, 85 struct ieee802154_addr *addr,
86 u16 short_addr, u8 status); 86 u16 short_addr, u8 status);
@@ -89,10 +89,10 @@ struct ieee802154_mlme_ops {
89 u8 reason); 89 u8 reason);
90 int (*start_req)(struct net_device *dev, 90 int (*start_req)(struct net_device *dev,
91 struct ieee802154_addr *addr, 91 struct ieee802154_addr *addr,
92 u8 channel, u8 bcn_ord, u8 sf_ord, 92 u8 channel, u8 page, u8 bcn_ord, u8 sf_ord,
93 u8 pan_coord, u8 blx, u8 coord_realign); 93 u8 pan_coord, u8 blx, u8 coord_realign);
94 int (*scan_req)(struct net_device *dev, 94 int (*scan_req)(struct net_device *dev,
95 u8 type, u32 channels, u8 duration); 95 u8 type, u32 channels, u8 page, u8 duration);
96 96
97 /* 97 /*
98 * FIXME: these should become the part of PIB/MIB interface. 98 * FIXME: these should become the part of PIB/MIB interface.
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 7c5c0f79168a..15b492a9aa79 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -22,6 +22,12 @@
22#include <net/flow.h> 22#include <net/flow.h>
23#include <net/netlink.h> 23#include <net/netlink.h>
24 24
25#ifdef CONFIG_IPV6_MULTIPLE_TABLES
26#define FIB6_TABLE_HASHSZ 256
27#else
28#define FIB6_TABLE_HASHSZ 1
29#endif
30
25struct rt6_info; 31struct rt6_info;
26 32
27struct fib6_config 33struct fib6_config
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index bbae1e87efcd..98978e73f666 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -99,47 +99,47 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
99 return &buf[*idx - len]; 99 return &buf[*idx - len];
100} 100}
101 101
102#define IP_VS_DBG_BUF(level, msg...) \ 102#define IP_VS_DBG_BUF(level, msg, ...) \
103 do { \ 103 do { \
104 char ip_vs_dbg_buf[160]; \ 104 char ip_vs_dbg_buf[160]; \
105 int ip_vs_dbg_idx = 0; \ 105 int ip_vs_dbg_idx = 0; \
106 if (level <= ip_vs_get_debug_level()) \ 106 if (level <= ip_vs_get_debug_level()) \
107 printk(KERN_DEBUG "IPVS: " msg); \ 107 printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
108 } while (0) 108 } while (0)
109#define IP_VS_ERR_BUF(msg...) \ 109#define IP_VS_ERR_BUF(msg...) \
110 do { \ 110 do { \
111 char ip_vs_dbg_buf[160]; \ 111 char ip_vs_dbg_buf[160]; \
112 int ip_vs_dbg_idx = 0; \ 112 int ip_vs_dbg_idx = 0; \
113 printk(KERN_ERR "IPVS: " msg); \ 113 pr_err(msg); \
114 } while (0) 114 } while (0)
115 115
116/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */ 116/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */
117#define IP_VS_DBG_ADDR(af, addr) \ 117#define IP_VS_DBG_ADDR(af, addr) \
118 ip_vs_dbg_addr(af, ip_vs_dbg_buf, \ 118 ip_vs_dbg_addr(af, ip_vs_dbg_buf, \
119 sizeof(ip_vs_dbg_buf), addr, \ 119 sizeof(ip_vs_dbg_buf), addr, \
120 &ip_vs_dbg_idx) 120 &ip_vs_dbg_idx)
121 121
122#define IP_VS_DBG(level, msg...) \ 122#define IP_VS_DBG(level, msg, ...) \
123 do { \ 123 do { \
124 if (level <= ip_vs_get_debug_level()) \ 124 if (level <= ip_vs_get_debug_level()) \
125 printk(KERN_DEBUG "IPVS: " msg); \ 125 printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
126 } while (0) 126 } while (0)
127#define IP_VS_DBG_RL(msg...) \ 127#define IP_VS_DBG_RL(msg, ...) \
128 do { \ 128 do { \
129 if (net_ratelimit()) \ 129 if (net_ratelimit()) \
130 printk(KERN_DEBUG "IPVS: " msg); \ 130 printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
131 } while (0) 131 } while (0)
132#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) \ 132#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) \
133 do { \ 133 do { \
134 if (level <= ip_vs_get_debug_level()) \ 134 if (level <= ip_vs_get_debug_level()) \
135 pp->debug_packet(pp, skb, ofs, msg); \ 135 pp->debug_packet(pp, skb, ofs, msg); \
136 } while (0) 136 } while (0)
137#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \ 137#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \
138 do { \ 138 do { \
139 if (level <= ip_vs_get_debug_level() && \ 139 if (level <= ip_vs_get_debug_level() && \
140 net_ratelimit()) \ 140 net_ratelimit()) \
141 pp->debug_packet(pp, skb, ofs, msg); \ 141 pp->debug_packet(pp, skb, ofs, msg); \
142 } while (0) 142 } while (0)
143#else /* NO DEBUGGING at ALL */ 143#else /* NO DEBUGGING at ALL */
144#define IP_VS_DBG_BUF(level, msg...) do {} while (0) 144#define IP_VS_DBG_BUF(level, msg...) do {} while (0)
145#define IP_VS_ERR_BUF(msg...) do {} while (0) 145#define IP_VS_ERR_BUF(msg...) do {} while (0)
@@ -150,29 +150,27 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
150#endif 150#endif
151 151
152#define IP_VS_BUG() BUG() 152#define IP_VS_BUG() BUG()
153#define IP_VS_ERR(msg...) printk(KERN_ERR "IPVS: " msg) 153#define IP_VS_ERR_RL(msg, ...) \
154#define IP_VS_INFO(msg...) printk(KERN_INFO "IPVS: " msg) 154 do { \
155#define IP_VS_WARNING(msg...) \ 155 if (net_ratelimit()) \
156 printk(KERN_WARNING "IPVS: " msg) 156 pr_err(msg, ##__VA_ARGS__); \
157#define IP_VS_ERR_RL(msg...) \ 157 } while (0)
158 do { \
159 if (net_ratelimit()) \
160 printk(KERN_ERR "IPVS: " msg); \
161 } while (0)
162 158
163#ifdef CONFIG_IP_VS_DEBUG 159#ifdef CONFIG_IP_VS_DEBUG
164#define EnterFunction(level) \ 160#define EnterFunction(level) \
165 do { \ 161 do { \
166 if (level <= ip_vs_get_debug_level()) \ 162 if (level <= ip_vs_get_debug_level()) \
167 printk(KERN_DEBUG "Enter: %s, %s line %i\n", \ 163 printk(KERN_DEBUG \
168 __func__, __FILE__, __LINE__); \ 164 pr_fmt("Enter: %s, %s line %i\n"), \
169 } while (0) 165 __func__, __FILE__, __LINE__); \
170#define LeaveFunction(level) \ 166 } while (0)
171 do { \ 167#define LeaveFunction(level) \
172 if (level <= ip_vs_get_debug_level()) \ 168 do { \
173 printk(KERN_DEBUG "Leave: %s, %s line %i\n", \ 169 if (level <= ip_vs_get_debug_level()) \
174 __func__, __FILE__, __LINE__); \ 170 printk(KERN_DEBUG \
175 } while (0) 171 pr_fmt("Leave: %s, %s line %i\n"), \
172 __func__, __FILE__, __LINE__); \
173 } while (0)
176#else 174#else
177#define EnterFunction(level) do {} while (0) 175#define EnterFunction(level) do {} while (0)
178#define LeaveFunction(level) do {} while (0) 176#define LeaveFunction(level) do {} while (0)
@@ -740,7 +738,8 @@ extern void ip_vs_protocol_cleanup(void);
740extern void ip_vs_protocol_timeout_change(int flags); 738extern void ip_vs_protocol_timeout_change(int flags);
741extern int *ip_vs_create_timeout_table(int *table, int size); 739extern int *ip_vs_create_timeout_table(int *table, int size);
742extern int 740extern int
743ip_vs_set_state_timeout(int *table, int num, char **names, char *name, int to); 741ip_vs_set_state_timeout(int *table, int num, const char *const *names,
742 const char *name, int to);
744extern void 743extern void
745ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, const struct sk_buff *skb, 744ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, const struct sk_buff *skb,
746 int offset, const char *msg); 745 int offset, const char *msg);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index f27fd83d67d8..ad9a51130254 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -441,6 +441,18 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
441 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); 441 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
442} 442}
443 443
444static __inline__ void ipv6_select_ident(struct frag_hdr *fhdr)
445{
446 static u32 ipv6_fragmentation_id = 1;
447 static DEFINE_SPINLOCK(ip6_id_lock);
448
449 spin_lock_bh(&ip6_id_lock);
450 fhdr->identification = htonl(ipv6_fragmentation_id);
451 if (++ipv6_fragmentation_id == 0)
452 ipv6_fragmentation_id = 1;
453 spin_unlock_bh(&ip6_id_lock);
454}
455
444/* 456/*
445 * Prototypes exported by ipv6 457 * Prototypes exported by ipv6
446 */ 458 */
diff --git a/include/net/irda/ircomm_event.h b/include/net/irda/ircomm_event.h
index c290447872d1..bc0c6f31f1c6 100644
--- a/include/net/irda/ircomm_event.h
+++ b/include/net/irda/ircomm_event.h
@@ -74,7 +74,7 @@ struct ircomm_info {
74 struct qos_info *qos; 74 struct qos_info *qos;
75}; 75};
76 76
77extern char *ircomm_state[]; 77extern const char *const ircomm_state[];
78 78
79struct ircomm_cb; /* Forward decl. */ 79struct ircomm_cb; /* Forward decl. */
80 80
diff --git a/include/net/irda/ircomm_tty_attach.h b/include/net/irda/ircomm_tty_attach.h
index f91a5695aa44..0a63bbb972d7 100644
--- a/include/net/irda/ircomm_tty_attach.h
+++ b/include/net/irda/ircomm_tty_attach.h
@@ -66,8 +66,8 @@ struct ircomm_tty_info {
66 __u8 dlsap_sel; 66 __u8 dlsap_sel;
67}; 67};
68 68
69extern char *ircomm_state[]; 69extern const char *const ircomm_state[];
70extern char *ircomm_tty_state[]; 70extern const char *const ircomm_tty_state[];
71 71
72int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, 72int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
73 struct sk_buff *skb, struct ircomm_tty_info *info); 73 struct sk_buff *skb, struct ircomm_tty_info *info);
diff --git a/include/net/irda/irlap_event.h b/include/net/irda/irlap_event.h
index 2ae2e119ef4b..4c90824c50fb 100644
--- a/include/net/irda/irlap_event.h
+++ b/include/net/irda/irlap_event.h
@@ -120,7 +120,7 @@ typedef enum { /* FIXME check the two first reason codes */
120 LAP_PRIMARY_CONFLICT, 120 LAP_PRIMARY_CONFLICT,
121} LAP_REASON; 121} LAP_REASON;
122 122
123extern const char *irlap_state[]; 123extern const char *const irlap_state[];
124 124
125void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event, 125void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
126 struct sk_buff *skb, struct irlap_info *info); 126 struct sk_buff *skb, struct irlap_info *info);
diff --git a/include/net/irda/irlmp_event.h b/include/net/irda/irlmp_event.h
index e03ae4ae3963..9e4ec17a7449 100644
--- a/include/net/irda/irlmp_event.h
+++ b/include/net/irda/irlmp_event.h
@@ -79,8 +79,8 @@ typedef enum {
79 LM_LAP_IDLE_TIMEOUT, 79 LM_LAP_IDLE_TIMEOUT,
80} IRLMP_EVENT; 80} IRLMP_EVENT;
81 81
82extern const char *irlmp_state[]; 82extern const char *const irlmp_state[];
83extern const char *irlsap_state[]; 83extern const char *const irlsap_state[];
84 84
85void irlmp_watchdog_timer_expired(void *data); 85void irlmp_watchdog_timer_expired(void *data);
86void irlmp_discovery_timer_expired(void *data); 86void irlmp_discovery_timer_expired(void *data);
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index 51b9a37de991..e9054a283fde 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -416,13 +416,13 @@ struct iw_spy_data
416 * data (i.e. valid as long as struct net_device exist, same locking rules). 416 * data (i.e. valid as long as struct net_device exist, same locking rules).
417 */ 417 */
418/* Forward declaration */ 418/* Forward declaration */
419struct ieee80211_device; 419struct libipw_device;
420/* The struct */ 420/* The struct */
421struct iw_public_data { 421struct iw_public_data {
422 /* Driver enhanced spy support */ 422 /* Driver enhanced spy support */
423 struct iw_spy_data * spy_data; 423 struct iw_spy_data * spy_data;
424 /* Structure managed by the in-kernel IEEE 802.11 layer */ 424 /* Legacy structure managed by the ipw2x00-specific IEEE 802.11 layer */
425 struct ieee80211_device * ieee80211; 425 struct libipw_device * libipw;
426}; 426};
427 427
428/**************************** PROTOTYPES ****************************/ 428/**************************** PROTOTYPES ****************************/
@@ -443,7 +443,7 @@ extern int dev_get_wireless_info(char * buffer, char **start, off_t offset,
443extern void wireless_send_event(struct net_device * dev, 443extern void wireless_send_event(struct net_device * dev,
444 unsigned int cmd, 444 unsigned int cmd,
445 union iwreq_data * wrqu, 445 union iwreq_data * wrqu,
446 char * extra); 446 const char * extra);
447 447
448/* We may need a function to send a stream of events to user space. 448/* We may need a function to send a stream of events to user space.
449 * More on that later... */ 449 * More on that later... */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c06104476973..466859b285e1 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -73,6 +73,21 @@
73 */ 73 */
74 74
75/** 75/**
76 * DOC: mac80211 workqueue
77 *
78 * mac80211 provides its own workqueue for drivers and internal mac80211 use.
79 * The workqueue is a single threaded workqueue and can only be accessed by
80 * helpers for sanity checking. Drivers must ensure all work added onto the
81 * mac80211 workqueue should be cancelled on the driver stop() callback.
82 *
83 * mac80211 will flushed the workqueue upon interface removal and during
84 * suspend.
85 *
86 * All work performed on the mac80211 workqueue must not acquire the RTNL lock.
87 *
88 */
89
90/**
76 * enum ieee80211_max_queues - maximum number of queues 91 * enum ieee80211_max_queues - maximum number of queues
77 * 92 *
78 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 93 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
@@ -224,7 +239,14 @@ struct ieee80211_bss_conf {
224 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU 239 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
225 * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211. 240 * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211.
226 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted 241 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
227 * because the destination STA was in powersave mode. 242 * because the destination STA was in powersave mode. Note that to
243 * avoid race conditions, the filter must be set by the hardware or
244 * firmware upon receiving a frame that indicates that the station
245 * went to sleep (must be done on device to filter frames already on
246 * the queue) and may only be unset after mac80211 gives the OK for
247 * that by setting the IEEE80211_TX_CTL_CLEAR_PS_FILT (see above),
248 * since only then is it guaranteed that no more frames are in the
249 * hardware queue.
228 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged 250 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
229 * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status 251 * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status
230 * is for the whole aggregation. 252 * is for the whole aggregation.
@@ -241,6 +263,15 @@ struct ieee80211_bss_conf {
241 * it can be sent out. 263 * it can be sent out.
242 * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211, 264 * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211,
243 * used to indicate that a frame was already retried due to PS 265 * used to indicate that a frame was already retried due to PS
266 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
267 * used to indicate frame should not be encrypted
268 * @IEEE80211_TX_CTL_PSPOLL_RESPONSE: (internal?)
269 * This frame is a response to a PS-poll frame and should be sent
270 * although the station is in powersave mode.
271 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
272 * transmit function after the current frame, this can be used
273 * by drivers to kick the DMA queue only if unset or when the
274 * queue gets full.
244 */ 275 */
245enum mac80211_tx_control_flags { 276enum mac80211_tx_control_flags {
246 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 277 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -259,6 +290,9 @@ enum mac80211_tx_control_flags {
259 IEEE80211_TX_INTFL_RCALGO = BIT(13), 290 IEEE80211_TX_INTFL_RCALGO = BIT(13),
260 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 291 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
261 IEEE80211_TX_INTFL_RETRIED = BIT(15), 292 IEEE80211_TX_INTFL_RETRIED = BIT(15),
293 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
294 IEEE80211_TX_CTL_PSPOLL_RESPONSE = BIT(17),
295 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
262}; 296};
263 297
264/** 298/**
@@ -316,6 +350,21 @@ enum mac80211_rate_control_flags {
316 * 350 *
317 * When used for transmit status reporting, the driver should 351 * When used for transmit status reporting, the driver should
318 * always report the rate along with the flags it used. 352 * always report the rate along with the flags it used.
353 *
354 * &struct ieee80211_tx_info contains an array of these structs
355 * in the control information, and it will be filled by the rate
356 * control algorithm according to what should be sent. For example,
357 * if this array contains, in the format { <idx>, <count> } the
358 * information
359 * { 3, 2 }, { 2, 2 }, { 1, 4 }, { -1, 0 }, { -1, 0 }
360 * then this means that the frame should be transmitted
361 * up to twice at rate 3, up to twice at rate 2, and up to four
362 * times at rate 1 if it doesn't get acknowledged. Say it gets
363 * acknowledged by the peer after the fifth attempt, the status
364 * information should then contain
365 * { 3, 2 }, { 2, 2 }, { 1, 1 }, { -1, 0 } ...
366 * since it was transmitted twice at rate 3, twice at rate 2
367 * and once at rate 1 after which we received an acknowledgement.
319 */ 368 */
320struct ieee80211_tx_rate { 369struct ieee80211_tx_rate {
321 s8 idx; 370 s8 idx;
@@ -397,6 +446,11 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
397 return (struct ieee80211_tx_info *)skb->cb; 446 return (struct ieee80211_tx_info *)skb->cb;
398} 447}
399 448
449static inline struct ieee80211_rx_status *IEEE80211_SKB_RXCB(struct sk_buff *skb)
450{
451 return (struct ieee80211_rx_status *)skb->cb;
452}
453
400/** 454/**
401 * ieee80211_tx_info_clear_status - clear TX status 455 * ieee80211_tx_info_clear_status - clear TX status
402 * 456 *
@@ -478,7 +532,7 @@ enum mac80211_rx_flags {
478 * 532 *
479 * The low-level driver should provide this information (the subset 533 * The low-level driver should provide this information (the subset
480 * supported by hardware) to the 802.11 code with each received 534 * supported by hardware) to the 802.11 code with each received
481 * frame. 535 * frame, in the skb's control buffer (cb).
482 * 536 *
483 * @mactime: value in microseconds of the 64-bit Time Synchronization Function 537 * @mactime: value in microseconds of the 64-bit Time Synchronization Function
484 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware. 538 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware.
@@ -529,7 +583,6 @@ enum ieee80211_conf_flags {
529/** 583/**
530 * enum ieee80211_conf_changed - denotes which configuration changed 584 * enum ieee80211_conf_changed - denotes which configuration changed
531 * 585 *
532 * @_IEEE80211_CONF_CHANGE_RADIO_ENABLED: DEPRECATED
533 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 586 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
534 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 587 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
535 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed 588 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
@@ -539,7 +592,6 @@ enum ieee80211_conf_flags {
539 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed 592 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
540 */ 593 */
541enum ieee80211_conf_changed { 594enum ieee80211_conf_changed {
542 _IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
543 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 595 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
544 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 596 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
545 IEEE80211_CONF_CHANGE_PS = BIT(4), 597 IEEE80211_CONF_CHANGE_PS = BIT(4),
@@ -549,14 +601,6 @@ enum ieee80211_conf_changed {
549 IEEE80211_CONF_CHANGE_IDLE = BIT(8), 601 IEEE80211_CONF_CHANGE_IDLE = BIT(8),
550}; 602};
551 603
552static inline __deprecated enum ieee80211_conf_changed
553__IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
554{
555 return _IEEE80211_CONF_CHANGE_RADIO_ENABLED;
556}
557#define IEEE80211_CONF_CHANGE_RADIO_ENABLED \
558 __IEEE80211_CONF_CHANGE_RADIO_ENABLED()
559
560/** 604/**
561 * struct ieee80211_conf - configuration of the device 605 * struct ieee80211_conf - configuration of the device
562 * 606 *
@@ -564,9 +608,6 @@ __IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
564 * 608 *
565 * @flags: configuration flags defined above 609 * @flags: configuration flags defined above
566 * 610 *
567 * @radio_enabled: when zero, driver is required to switch off the radio.
568 * @beacon_int: DEPRECATED, DO NOT USE
569 *
570 * @listen_interval: listen interval in units of beacon interval 611 * @listen_interval: listen interval in units of beacon interval
571 * @max_sleep_period: the maximum number of beacon intervals to sleep for 612 * @max_sleep_period: the maximum number of beacon intervals to sleep for
572 * before checking the beacon for a TIM bit (managed mode only); this 613 * before checking the beacon for a TIM bit (managed mode only); this
@@ -590,13 +631,11 @@ __IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
590 * number of transmissions not the number of retries 631 * number of transmissions not the number of retries
591 */ 632 */
592struct ieee80211_conf { 633struct ieee80211_conf {
593 int __deprecated beacon_int;
594 u32 flags; 634 u32 flags;
595 int power_level, dynamic_ps_timeout; 635 int power_level, dynamic_ps_timeout;
596 int max_sleep_period; 636 int max_sleep_period;
597 637
598 u16 listen_interval; 638 u16 listen_interval;
599 bool __deprecated radio_enabled;
600 639
601 u8 long_frame_max_tx_count, short_frame_max_tx_count; 640 u8 long_frame_max_tx_count, short_frame_max_tx_count;
602 641
@@ -901,12 +940,6 @@ enum ieee80211_hw_flags {
901 * 940 *
902 * @conf: &struct ieee80211_conf, device configuration, don't use. 941 * @conf: &struct ieee80211_conf, device configuration, don't use.
903 * 942 *
904 * @workqueue: single threaded workqueue available for driver use,
905 * allocated by mac80211 on registration and flushed when an
906 * interface is removed.
907 * NOTICE: All work performed on this workqueue must not
908 * acquire the RTNL lock.
909 *
910 * @priv: pointer to private area that was allocated for driver use 943 * @priv: pointer to private area that was allocated for driver use
911 * along with this structure. 944 * along with this structure.
912 * 945 *
@@ -942,7 +975,6 @@ enum ieee80211_hw_flags {
942struct ieee80211_hw { 975struct ieee80211_hw {
943 struct ieee80211_conf conf; 976 struct ieee80211_conf conf;
944 struct wiphy *wiphy; 977 struct wiphy *wiphy;
945 struct workqueue_struct *workqueue;
946 const char *rate_control_algorithm; 978 const char *rate_control_algorithm;
947 void *priv; 979 void *priv;
948 u32 flags; 980 u32 flags;
@@ -1172,10 +1204,13 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1172 * the driver's configure_filter() function which frames should be 1204 * the driver's configure_filter() function which frames should be
1173 * passed to mac80211 and which should be filtered out. 1205 * passed to mac80211 and which should be filtered out.
1174 * 1206 *
1175 * The configure_filter() callback is invoked with the parameters 1207 * Before configure_filter() is invoked, the prepare_multicast()
1176 * @mc_count and @mc_list for the combined multicast address list 1208 * callback is invoked with the parameters @mc_count and @mc_list
1177 * of all virtual interfaces, @changed_flags telling which flags 1209 * for the combined multicast address list of all virtual interfaces.
1178 * were changed and @total_flags with the new flag states. 1210 * It's use is optional, and it returns a u64 that is passed to
1211 * configure_filter(). Additionally, configure_filter() has the
1212 * arguments @changed_flags telling which flags were changed and
1213 * @total_flags with the new flag states.
1179 * 1214 *
1180 * If your device has no multicast address filters your driver will 1215 * If your device has no multicast address filters your driver will
1181 * need to check both the %FIF_ALLMULTI flag and the @mc_count 1216 * need to check both the %FIF_ALLMULTI flag and the @mc_count
@@ -1224,10 +1259,13 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1224 * mac80211 needs to do and the amount of CPU wakeups, so you should 1259 * mac80211 needs to do and the amount of CPU wakeups, so you should
1225 * honour this flag if possible. 1260 * honour this flag if possible.
1226 * 1261 *
1227 * @FIF_CONTROL: pass control frames, if PROMISC_IN_BSS is not set then 1262 * @FIF_CONTROL: pass control frames (except for PS Poll), if PROMISC_IN_BSS
1228 * only those addressed to this station 1263 * is not set then only those addressed to this station.
1229 * 1264 *
1230 * @FIF_OTHER_BSS: pass frames destined to other BSSes 1265 * @FIF_OTHER_BSS: pass frames destined to other BSSes
1266 *
1267 * @FIF_PSPOLL: pass PS Poll frames, if PROMISC_IN_BSS is not set then only
1268 * those addressed to this station.
1231 */ 1269 */
1232enum ieee80211_filter_flags { 1270enum ieee80211_filter_flags {
1233 FIF_PROMISC_IN_BSS = 1<<0, 1271 FIF_PROMISC_IN_BSS = 1<<0,
@@ -1237,6 +1275,7 @@ enum ieee80211_filter_flags {
1237 FIF_BCN_PRBRESP_PROMISC = 1<<4, 1275 FIF_BCN_PRBRESP_PROMISC = 1<<4,
1238 FIF_CONTROL = 1<<5, 1276 FIF_CONTROL = 1<<5,
1239 FIF_OTHER_BSS = 1<<6, 1277 FIF_OTHER_BSS = 1<<6,
1278 FIF_PSPOLL = 1<<7,
1240}; 1279};
1241 1280
1242/** 1281/**
@@ -1289,7 +1328,8 @@ enum ieee80211_ampdu_mlme_action {
1289 * is disabled. This should turn off the hardware (at least 1328 * is disabled. This should turn off the hardware (at least
1290 * it must turn off frame reception.) 1329 * it must turn off frame reception.)
1291 * May be called right after add_interface if that rejects 1330 * May be called right after add_interface if that rejects
1292 * an interface. 1331 * an interface. If you added any work onto the mac80211 workqueue
1332 * you should ensure to cancel it on this callback.
1293 * Must be implemented. 1333 * Must be implemented.
1294 * 1334 *
1295 * @add_interface: Called when a netdevice attached to the hardware is 1335 * @add_interface: Called when a netdevice attached to the hardware is
@@ -1323,9 +1363,13 @@ enum ieee80211_ampdu_mlme_action {
1323 * for association indication. The @changed parameter indicates which 1363 * for association indication. The @changed parameter indicates which
1324 * of the bss parameters has changed when a call is made. 1364 * of the bss parameters has changed when a call is made.
1325 * 1365 *
1366 * @prepare_multicast: Prepare for multicast filter configuration.
1367 * This callback is optional, and its return value is passed
1368 * to configure_filter(). This callback must be atomic.
1369 *
1326 * @configure_filter: Configure the device's RX filter. 1370 * @configure_filter: Configure the device's RX filter.
1327 * See the section "Frame filtering" for more information. 1371 * See the section "Frame filtering" for more information.
1328 * This callback must be implemented and atomic. 1372 * This callback must be implemented.
1329 * 1373 *
1330 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit 1374 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
1331 * must be set or cleared for a given STA. Must be atomic. 1375 * must be set or cleared for a given STA. Must be atomic.
@@ -1411,6 +1455,8 @@ enum ieee80211_ampdu_mlme_action {
1411 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also 1455 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also
1412 * need to set wiphy->rfkill_poll to %true before registration, 1456 * need to set wiphy->rfkill_poll to %true before registration,
1413 * and need to call wiphy_rfkill_set_hw_state() in the callback. 1457 * and need to call wiphy_rfkill_set_hw_state() in the callback.
1458 *
1459 * @testmode_cmd: Implement a cfg80211 test mode command.
1414 */ 1460 */
1415struct ieee80211_ops { 1461struct ieee80211_ops {
1416 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1462 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1425,10 +1471,12 @@ struct ieee80211_ops {
1425 struct ieee80211_vif *vif, 1471 struct ieee80211_vif *vif,
1426 struct ieee80211_bss_conf *info, 1472 struct ieee80211_bss_conf *info,
1427 u32 changed); 1473 u32 changed);
1474 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
1475 int mc_count, struct dev_addr_list *mc_list);
1428 void (*configure_filter)(struct ieee80211_hw *hw, 1476 void (*configure_filter)(struct ieee80211_hw *hw,
1429 unsigned int changed_flags, 1477 unsigned int changed_flags,
1430 unsigned int *total_flags, 1478 unsigned int *total_flags,
1431 int mc_count, struct dev_addr_list *mc_list); 1479 u64 multicast);
1432 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1480 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1433 bool set); 1481 bool set);
1434 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1482 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
@@ -1461,6 +1509,9 @@ struct ieee80211_ops {
1461 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1509 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1462 1510
1463 void (*rfkill_poll)(struct ieee80211_hw *hw); 1511 void (*rfkill_poll)(struct ieee80211_hw *hw);
1512#ifdef CONFIG_NL80211_TESTMODE
1513 int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
1514#endif
1464}; 1515};
1465 1516
1466/** 1517/**
@@ -1606,10 +1657,6 @@ void ieee80211_free_hw(struct ieee80211_hw *hw);
1606 */ 1657 */
1607void ieee80211_restart_hw(struct ieee80211_hw *hw); 1658void ieee80211_restart_hw(struct ieee80211_hw *hw);
1608 1659
1609/* trick to avoid symbol clashes with the ieee80211 subsystem */
1610void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1611 struct ieee80211_rx_status *status);
1612
1613/** 1660/**
1614 * ieee80211_rx - receive frame 1661 * ieee80211_rx - receive frame
1615 * 1662 *
@@ -1624,14 +1671,8 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1624 * 1671 *
1625 * @hw: the hardware this frame came in on 1672 * @hw: the hardware this frame came in on
1626 * @skb: the buffer to receive, owned by mac80211 after this call 1673 * @skb: the buffer to receive, owned by mac80211 after this call
1627 * @status: status of this frame; the status pointer need not be valid
1628 * after this function returns
1629 */ 1674 */
1630static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, 1675void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb);
1631 struct ieee80211_rx_status *status)
1632{
1633 __ieee80211_rx(hw, skb, status);
1634}
1635 1676
1636/** 1677/**
1637 * ieee80211_rx_irqsafe - receive frame 1678 * ieee80211_rx_irqsafe - receive frame
@@ -1644,13 +1685,8 @@ static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1644 * 1685 *
1645 * @hw: the hardware this frame came in on 1686 * @hw: the hardware this frame came in on
1646 * @skb: the buffer to receive, owned by mac80211 after this call 1687 * @skb: the buffer to receive, owned by mac80211 after this call
1647 * @status: status of this frame; the status pointer need not be valid
1648 * after this function returns and is not freed by mac80211,
1649 * it is recommended that it points to a stack area
1650 */ 1688 */
1651void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, 1689void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
1652 struct sk_buff *skb,
1653 struct ieee80211_rx_status *status);
1654 1690
1655/** 1691/**
1656 * ieee80211_tx_status - transmit status callback 1692 * ieee80211_tx_status - transmit status callback
@@ -1917,6 +1953,31 @@ void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
1917 void *data); 1953 void *data);
1918 1954
1919/** 1955/**
1956 * ieee80211_queue_work - add work onto the mac80211 workqueue
1957 *
1958 * Drivers and mac80211 use this to add work onto the mac80211 workqueue.
1959 * This helper ensures drivers are not queueing work when they should not be.
1960 *
1961 * @hw: the hardware struct for the interface we are adding work for
1962 * @work: the work we want to add onto the mac80211 workqueue
1963 */
1964void ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *work);
1965
1966/**
1967 * ieee80211_queue_delayed_work - add work onto the mac80211 workqueue
1968 *
1969 * Drivers and mac80211 use this to queue delayed work onto the mac80211
1970 * workqueue.
1971 *
1972 * @hw: the hardware struct for the interface we are adding work for
1973 * @dwork: delayable work to queue onto the mac80211 workqueue
1974 * @delay: number of jiffies to wait before queueing
1975 */
1976void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
1977 struct delayed_work *dwork,
1978 unsigned long delay);
1979
1980/**
1920 * ieee80211_start_tx_ba_session - Start a tx Block Ack session. 1981 * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
1921 * @hw: pointer as obtained from ieee80211_alloc_hw(). 1982 * @hw: pointer as obtained from ieee80211_alloc_hw().
1922 * @ra: receiver address of the BA session recipient 1983 * @ra: receiver address of the BA session recipient
@@ -2090,6 +2151,29 @@ static inline int rate_supported(struct ieee80211_sta *sta,
2090 return (sta == NULL || sta->supp_rates[band] & BIT(index)); 2151 return (sta == NULL || sta->supp_rates[band] & BIT(index));
2091} 2152}
2092 2153
2154/**
2155 * rate_control_send_low - helper for drivers for management/no-ack frames
2156 *
2157 * Rate control algorithms that agree to use the lowest rate to
2158 * send management frames and NO_ACK data with the respective hw
2159 * retries should use this in the beginning of their mac80211 get_rate
2160 * callback. If true is returned the rate control can simply return.
2161 * If false is returned we guarantee that sta and sta and priv_sta is
2162 * not null.
2163 *
2164 * Rate control algorithms wishing to do more intelligent selection of
2165 * rate for multicast/broadcast frames may choose to not use this.
2166 *
2167 * @sta: &struct ieee80211_sta pointer to the target destination. Note
2168 * that this may be null.
2169 * @priv_sta: private rate control structure. This may be null.
2170 * @txrc: rate control information we sholud populate for mac80211.
2171 */
2172bool rate_control_send_low(struct ieee80211_sta *sta,
2173 void *priv_sta,
2174 struct ieee80211_tx_rate_control *txrc);
2175
2176
2093static inline s8 2177static inline s8
2094rate_lowest_index(struct ieee80211_supported_band *sband, 2178rate_lowest_index(struct ieee80211_supported_band *sband,
2095 struct ieee80211_sta *sta) 2179 struct ieee80211_sta *sta)
@@ -2106,6 +2190,17 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
2106 return 0; 2190 return 0;
2107} 2191}
2108 2192
2193static inline
2194bool rate_usable_index_exists(struct ieee80211_supported_band *sband,
2195 struct ieee80211_sta *sta)
2196{
2197 unsigned int i;
2198
2199 for (i = 0; i < sband->n_bitrates; i++)
2200 if (rate_supported(sta, sband->band, i))
2201 return true;
2202 return false;
2203}
2109 2204
2110int ieee80211_rate_control_register(struct rate_control_ops *ops); 2205int ieee80211_rate_control_register(struct rate_control_ops *ops);
2111void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 2206void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index d8d790e56d3d..3817fda82a80 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -24,6 +24,7 @@
24 24
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/sysctl.h> 26#include <linux/sysctl.h>
27#include <linux/workqueue.h>
27#include <net/rtnetlink.h> 28#include <net/rtnetlink.h>
28 29
29/* 30/*
@@ -117,7 +118,7 @@ struct neighbour
117 int (*output)(struct sk_buff *skb); 118 int (*output)(struct sk_buff *skb);
118 struct sk_buff_head arp_queue; 119 struct sk_buff_head arp_queue;
119 struct timer_list timer; 120 struct timer_list timer;
120 struct neigh_ops *ops; 121 const struct neigh_ops *ops;
121 u8 primary_key[0]; 122 u8 primary_key[0];
122}; 123};
123 124
@@ -167,7 +168,7 @@ struct neigh_table
167 int gc_thresh2; 168 int gc_thresh2;
168 int gc_thresh3; 169 int gc_thresh3;
169 unsigned long last_flush; 170 unsigned long last_flush;
170 struct timer_list gc_timer; 171 struct delayed_work gc_work;
171 struct timer_list proxy_timer; 172 struct timer_list proxy_timer;
172 struct sk_buff_head proxy_queue; 173 struct sk_buff_head proxy_queue;
173 atomic_t entries; 174 atomic_t entries;
@@ -178,7 +179,6 @@ struct neigh_table
178 struct neighbour **hash_buckets; 179 struct neighbour **hash_buckets;
179 unsigned int hash_mask; 180 unsigned int hash_mask;
180 __u32 hash_rnd; 181 __u32 hash_rnd;
181 unsigned int hash_chain_gc;
182 struct pneigh_entry **phash_buckets; 182 struct pneigh_entry **phash_buckets;
183}; 183};
184 184
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index ded434b032a4..a1202841aadd 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -26,6 +26,7 @@ struct net_device;
26struct sock; 26struct sock;
27struct ctl_table_header; 27struct ctl_table_header;
28struct net_generic; 28struct net_generic;
29struct sock;
29 30
30struct net { 31struct net {
31 atomic_t count; /* To decided when the network 32 atomic_t count; /* To decided when the network
@@ -57,6 +58,7 @@ struct net {
57 spinlock_t rules_mod_lock; 58 spinlock_t rules_mod_lock;
58 59
59 struct sock *rtnl; /* rtnetlink socket */ 60 struct sock *rtnl; /* rtnetlink socket */
61 struct sock *genl_sock;
60 62
61 struct netns_core core; 63 struct netns_core core;
62 struct netns_mib mib; 64 struct netns_mib mib;
@@ -78,6 +80,9 @@ struct net {
78#ifdef CONFIG_XFRM 80#ifdef CONFIG_XFRM
79 struct netns_xfrm xfrm; 81 struct netns_xfrm xfrm;
80#endif 82#endif
83#ifdef CONFIG_WIRELESS_EXT
84 struct sk_buff_head wext_nlevents;
85#endif
81 struct net_generic *gen; 86 struct net_generic *gen;
82}; 87};
83 88
@@ -106,6 +111,8 @@ static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns)
106 111
107extern struct list_head net_namespace_list; 112extern struct list_head net_namespace_list;
108 113
114extern struct net *get_net_ns_by_pid(pid_t pid);
115
109#ifdef CONFIG_NET_NS 116#ifdef CONFIG_NET_NS
110extern void __put_net(struct net *net); 117extern void __put_net(struct net *net);
111 118
@@ -208,6 +215,9 @@ static inline struct net *read_pnet(struct net * const *pnet)
208#define for_each_net(VAR) \ 215#define for_each_net(VAR) \
209 list_for_each_entry(VAR, &net_namespace_list, list) 216 list_for_each_entry(VAR, &net_namespace_list, list)
210 217
218#define for_each_net_rcu(VAR) \
219 list_for_each_entry_rcu(VAR, &net_namespace_list, list)
220
211#ifdef CONFIG_NET_NS 221#ifdef CONFIG_NET_NS
212#define __net_init 222#define __net_init
213#define __net_exit 223#define __net_exit
@@ -229,13 +239,15 @@ struct pernet_operations {
229 * needs per network namespace operations use device pernet operations, 239 * needs per network namespace operations use device pernet operations,
230 * otherwise use pernet subsys operations. 240 * otherwise use pernet subsys operations.
231 * 241 *
232 * This is critically important. Most of the network code cleanup 242 * Network interfaces need to be removed from a dying netns _before_
233 * runs with the assumption that dev_remove_pack has been called so no 243 * subsys notifiers can be called, as most of the network code cleanup
234 * new packets will arrive during and after the cleanup functions have 244 * (which is done from subsys notifiers) runs with the assumption that
235 * been called. dev_remove_pack is not per namespace so instead the 245 * dev_remove_pack has been called so no new packets will arrive during
236 * guarantee of no more packets arriving in a network namespace is 246 * and after the cleanup functions have been called. dev_remove_pack
237 * provided by ensuring that all network devices and all sockets have 247 * is not per namespace so instead the guarantee of no more packets
238 * left the network namespace before the cleanup methods are called. 248 * arriving in a network namespace is provided by ensuring that all
249 * network devices and all sockets have left the network namespace
250 * before the cleanup methods are called.
239 * 251 *
240 * For the longest time the ipv4 icmp code was registered as a pernet 252 * For the longest time the ipv4 icmp code was registered as a pernet
241 * device which caused kernel oops, and panics during network 253 * device which caused kernel oops, and panics during network
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index afab4e4cbac7..dfeb2d7c425b 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -6,6 +6,7 @@
6 6
7#ifndef __NETNS_IPV6_H__ 7#ifndef __NETNS_IPV6_H__
8#define __NETNS_IPV6_H__ 8#define __NETNS_IPV6_H__
9#include <net/dst_ops.h>
9 10
10struct ctl_table_header; 11struct ctl_table_header;
11 12
@@ -42,7 +43,7 @@ struct netns_ipv6 {
42 struct timer_list ip6_fib_timer; 43 struct timer_list ip6_fib_timer;
43 struct hlist_head *fib_table_hash; 44 struct hlist_head *fib_table_hash;
44 struct fib6_table *fib6_main_tbl; 45 struct fib6_table *fib6_main_tbl;
45 struct dst_ops *ip6_dst_ops; 46 struct dst_ops ip6_dst_ops;
46 unsigned int ip6_rt_gc_expire; 47 unsigned int ip6_rt_gc_expire;
47 unsigned long ip6_rt_last_gc; 48 unsigned long ip6_rt_last_gc;
48#ifdef CONFIG_IPV6_MULTIPLE_TABLES 49#ifdef CONFIG_IPV6_MULTIPLE_TABLES
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index 9554a644a8f8..591db7d657a3 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -8,8 +8,11 @@ struct ebt_table;
8 8
9struct netns_xt { 9struct netns_xt {
10 struct list_head tables[NFPROTO_NUMPROTO]; 10 struct list_head tables[NFPROTO_NUMPROTO];
11#if defined(CONFIG_BRIDGE_NF_EBTABLES) || \
12 defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE)
11 struct ebt_table *broute_table; 13 struct ebt_table *broute_table;
12 struct ebt_table *frame_filter; 14 struct ebt_table *frame_filter;
13 struct ebt_table *frame_nat; 15 struct ebt_table *frame_nat;
16#endif
14}; 17};
15#endif 18#endif
diff --git a/include/net/nl802154.h b/include/net/nl802154.h
new file mode 100644
index 000000000000..99d2ba1c7e03
--- /dev/null
+++ b/include/net/nl802154.h
@@ -0,0 +1,126 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27/**
28 * ieee802154_nl_assoc_indic - Notify userland of an association request.
29 * @dev: The network device on which this association request was
30 * received.
31 * @addr: The address of the device requesting association.
32 * @cap: The capability information field from the device.
33 *
34 * This informs a userland coordinator of a device requesting to
35 * associate with the PAN controlled by the coordinator.
36 *
37 * Note: This is in section 7.3.1 of the IEEE 802.15.4-2006 document.
38 */
39int ieee802154_nl_assoc_indic(struct net_device *dev,
40 struct ieee802154_addr *addr, u8 cap);
41
42/**
43 * ieee802154_nl_assoc_confirm - Notify userland of association.
44 * @dev: The device which has completed association.
45 * @short_addr: The short address assigned to the device.
46 * @status: The status of the association.
47 *
48 * Inform userland of the result of an association request. If the
49 * association request included asking the coordinator to allocate
50 * a short address then it is returned in @short_addr.
51 *
52 * Note: This is in section 7.3.2 of the IEEE 802.15.4 document.
53 */
54int ieee802154_nl_assoc_confirm(struct net_device *dev,
55 u16 short_addr, u8 status);
56
57/**
58 * ieee802154_nl_disassoc_indic - Notify userland of disassociation.
59 * @dev: The device on which disassociation was indicated.
60 * @addr: The device which is disassociating.
61 * @reason: The reason for the disassociation.
62 *
63 * Inform userland that a device has disassociated from the network.
64 *
65 * Note: This is in section 7.3.3 of the IEEE 802.15.4 document.
66 */
67int ieee802154_nl_disassoc_indic(struct net_device *dev,
68 struct ieee802154_addr *addr, u8 reason);
69
70/**
71 * ieee802154_nl_disassoc_confirm - Notify userland of disassociation
72 * completion.
73 * @dev: The device on which disassociation was ordered.
74 * @status: The result of the disassociation.
75 *
76 * Inform userland of the result of requesting that a device
77 * disassociate, or the result of requesting that we disassociate from
78 * a PAN managed by another coordinator.
79 *
80 * Note: This is in section 7.1.4.3 of the IEEE 802.15.4 document.
81 */
82int ieee802154_nl_disassoc_confirm(struct net_device *dev,
83 u8 status);
84
85/**
86 * ieee802154_nl_scan_confirm - Notify userland of completion of scan.
87 * @dev: The device which was instructed to scan.
88 * @status: The status of the scan operation.
89 * @scan_type: What type of scan was performed.
90 * @unscanned: Any channels that the device was unable to scan.
91 * @edl: The energy levels (if a passive scan).
92 *
93 *
94 * Note: This is in section 7.1.11 of the IEEE 802.15.4 document.
95 * Note: This API does not permit the return of an active scan result.
96 */
97int ieee802154_nl_scan_confirm(struct net_device *dev,
98 u8 status, u8 scan_type, u32 unscanned, u8 page,
99 u8 *edl/*, struct list_head *pan_desc_list */);
100
101/**
102 * ieee802154_nl_beacon_indic - Notify userland of a received beacon.
103 * @dev: The device on which a beacon was received.
104 * @panid: The PAN of the coordinator.
105 * @coord_addr: The short address of the coordinator on that PAN.
106 *
107 * Note: This is in section 7.1.5 of the IEEE 802.15.4 document.
108 * Note: This API does not provide extended information such as what
109 * channel the PAN is on or what the LQI of the beacon frame was on
110 * receipt.
111 * Note: This API cannot indicate a beacon frame for a coordinator
112 * operating in long addressing mode.
113 */
114int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid,
115 u16 coord_addr);
116
117/**
118 * ieee802154_nl_start_confirm - Notify userland of completion of start.
119 * @dev: The device which was instructed to scan.
120 * @status: The status of the scan operation.
121 *
122 * Note: This is in section 7.1.14 of the IEEE 802.15.4 document.
123 */
124int ieee802154_nl_start_confirm(struct net_device *dev, u8 status);
125
126#endif
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index 29d126736611..44c923c9e21d 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -49,4 +49,6 @@ void phonet_address_notify(int event, struct net_device *dev, u8 addr);
49 49
50#define PN_NO_ADDR 0xff 50#define PN_NO_ADDR 0xff
51 51
52extern const struct file_operations pn_sock_seq_fops;
53
52#endif 54#endif
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 82a3191375f5..f911ec7598ef 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -87,6 +87,9 @@ extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
87extern void qdisc_put_rtab(struct qdisc_rate_table *tab); 87extern void qdisc_put_rtab(struct qdisc_rate_table *tab);
88extern void qdisc_put_stab(struct qdisc_size_table *tab); 88extern void qdisc_put_stab(struct qdisc_size_table *tab);
89extern void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc); 89extern void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc);
90extern int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
91 struct net_device *dev, struct netdev_queue *txq,
92 spinlock_t *root_lock);
90 93
91extern void __qdisc_run(struct Qdisc *q); 94extern void __qdisc_run(struct Qdisc *q);
92 95
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 5482e9582f55..a48a4cc7258b 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -45,6 +45,7 @@ struct Qdisc
45#define TCQ_F_BUILTIN 1 45#define TCQ_F_BUILTIN 1
46#define TCQ_F_THROTTLED 2 46#define TCQ_F_THROTTLED 2
47#define TCQ_F_INGRESS 4 47#define TCQ_F_INGRESS 4
48#define TCQ_F_CAN_BYPASS 8
48#define TCQ_F_WARN_NONWC (1 << 16) 49#define TCQ_F_WARN_NONWC (1 << 16)
49 int padded; 50 int padded;
50 struct Qdisc_ops *ops; 51 struct Qdisc_ops *ops;
@@ -182,6 +183,11 @@ struct qdisc_skb_cb {
182 char data[]; 183 char data[];
183}; 184};
184 185
186static inline int qdisc_qlen(struct Qdisc *q)
187{
188 return q->q.qlen;
189}
190
185static inline struct qdisc_skb_cb *qdisc_skb_cb(struct sk_buff *skb) 191static inline struct qdisc_skb_cb *qdisc_skb_cb(struct sk_buff *skb)
186{ 192{
187 return (struct qdisc_skb_cb *)skb->cb; 193 return (struct qdisc_skb_cb *)skb->cb;
@@ -387,13 +393,18 @@ static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch)
387 return qdisc_enqueue(skb, sch) & NET_XMIT_MASK; 393 return qdisc_enqueue(skb, sch) & NET_XMIT_MASK;
388} 394}
389 395
396static inline void __qdisc_update_bstats(struct Qdisc *sch, unsigned int len)
397{
398 sch->bstats.bytes += len;
399 sch->bstats.packets++;
400}
401
390static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, 402static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
391 struct sk_buff_head *list) 403 struct sk_buff_head *list)
392{ 404{
393 __skb_queue_tail(list, skb); 405 __skb_queue_tail(list, skb);
394 sch->qstats.backlog += qdisc_pkt_len(skb); 406 sch->qstats.backlog += qdisc_pkt_len(skb);
395 sch->bstats.bytes += qdisc_pkt_len(skb); 407 __qdisc_update_bstats(sch, qdisc_pkt_len(skb));
396 sch->bstats.packets++;
397 408
398 return NET_XMIT_SUCCESS; 409 return NET_XMIT_SUCCESS;
399} 410}
diff --git a/include/net/scm.h b/include/net/scm.h
index f45bb6eca7d4..cf48c800e926 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -26,7 +26,6 @@ struct scm_cookie
26#ifdef CONFIG_SECURITY_NETWORK 26#ifdef CONFIG_SECURITY_NETWORK
27 u32 secid; /* Passed security ID */ 27 u32 secid; /* Passed security ID */
28#endif 28#endif
29 unsigned long seq; /* Connection seqno */
30}; 29};
31 30
32extern void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm); 31extern void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm);
@@ -59,7 +58,6 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
59 scm->creds.gid = current_gid(); 58 scm->creds.gid = current_gid();
60 scm->creds.pid = task_tgid_vnr(p); 59 scm->creds.pid = task_tgid_vnr(p);
61 scm->fp = NULL; 60 scm->fp = NULL;
62 scm->seq = 0;
63 unix_get_peersec_dgram(sock, scm); 61 unix_get_peersec_dgram(sock, scm);
64 if (msg->msg_controllen <= 0) 62 if (msg->msg_controllen <= 0)
65 return 0; 63 return 0;
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index b05b0557211f..8bc25f7b04ce 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -241,7 +241,9 @@ const char *sctp_tname(const sctp_subtype_t); /* timeouts */
241const char *sctp_pname(const sctp_subtype_t); /* primitives */ 241const char *sctp_pname(const sctp_subtype_t); /* primitives */
242 242
243/* This is a table of printable names of sctp_state_t's. */ 243/* This is a table of printable names of sctp_state_t's. */
244extern const char *sctp_state_tbl[], *sctp_evttype_tbl[], *sctp_status_tbl[]; 244extern const char *const sctp_state_tbl[];
245extern const char *const sctp_evttype_tbl[];
246extern const char *const sctp_status_tbl[];
245 247
246/* Maximum chunk length considering padding requirements. */ 248/* Maximum chunk length considering padding requirements. */
247enum { SCTP_MAX_CHUNK_LEN = ((1<<16) - sizeof(__u32)) }; 249enum { SCTP_MAX_CHUNK_LEN = ((1<<16) - sizeof(__u32)) };
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 88af84306471..df50bc40b5fd 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -469,6 +469,7 @@ extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
469 int nonagle); 469 int nonagle);
470extern int tcp_may_send_now(struct sock *sk); 470extern int tcp_may_send_now(struct sock *sk);
471extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 471extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
472extern void tcp_retransmit_timer(struct sock *sk);
472extern void tcp_xmit_retransmit_queue(struct sock *); 473extern void tcp_xmit_retransmit_queue(struct sock *);
473extern void tcp_simple_retransmit(struct sock *); 474extern void tcp_simple_retransmit(struct sock *);
474extern int tcp_trim_head(struct sock *, struct sk_buff *, u32); 475extern int tcp_trim_head(struct sock *, struct sk_buff *, u32);
@@ -521,6 +522,17 @@ extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
521extern int tcp_mss_to_mtu(struct sock *sk, int mss); 522extern int tcp_mss_to_mtu(struct sock *sk, int mss);
522extern void tcp_mtup_init(struct sock *sk); 523extern void tcp_mtup_init(struct sock *sk);
523 524
525static inline void tcp_bound_rto(const struct sock *sk)
526{
527 if (inet_csk(sk)->icsk_rto > TCP_RTO_MAX)
528 inet_csk(sk)->icsk_rto = TCP_RTO_MAX;
529}
530
531static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
532{
533 return (tp->srtt >> 3) + tp->rttvar;
534}
535
524static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 536static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
525{ 537{
526 tp->pred_flags = htonl((tp->tcp_header_len << 26) | 538 tp->pred_flags = htonl((tp->tcp_header_len << 26) |
@@ -1007,6 +1019,11 @@ static inline int keepalive_time_when(const struct tcp_sock *tp)
1007 return tp->keepalive_time ? : sysctl_tcp_keepalive_time; 1019 return tp->keepalive_time ? : sysctl_tcp_keepalive_time;
1008} 1020}
1009 1021
1022static inline int keepalive_probes(const struct tcp_sock *tp)
1023{
1024 return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes;
1025}
1026
1010static inline int tcp_fin_time(const struct sock *sk) 1027static inline int tcp_fin_time(const struct sock *sk)
1011{ 1028{
1012 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout; 1029 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout;
@@ -1235,6 +1252,29 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu
1235#define tcp_for_write_queue_from_safe(skb, tmp, sk) \ 1252#define tcp_for_write_queue_from_safe(skb, tmp, sk) \
1236 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) 1253 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp)
1237 1254
1255/* This function calculates a "timeout" which is equivalent to the timeout of a
1256 * TCP connection after "boundary" unsucessful, exponentially backed-off
1257 * retransmissions with an initial RTO of TCP_RTO_MIN.
1258 */
1259static inline bool retransmits_timed_out(const struct sock *sk,
1260 unsigned int boundary)
1261{
1262 unsigned int timeout, linear_backoff_thresh;
1263
1264 if (!inet_csk(sk)->icsk_retransmits)
1265 return false;
1266
1267 linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
1268
1269 if (boundary <= linear_backoff_thresh)
1270 timeout = ((2 << boundary) - 1) * TCP_RTO_MIN;
1271 else
1272 timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN +
1273 (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
1274
1275 return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= timeout;
1276}
1277
1238static inline struct sk_buff *tcp_send_head(struct sock *sk) 1278static inline struct sk_buff *tcp_send_head(struct sock *sk)
1239{ 1279{
1240 return sk->sk_send_head; 1280 return sk->sk_send_head;
diff --git a/include/net/udp.h b/include/net/udp.h
index 90e6ce56be65..5fb029f817a3 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -207,4 +207,7 @@ extern void udp4_proc_exit(void);
207#endif 207#endif
208 208
209extern void udp_init(void); 209extern void udp_init(void);
210
211extern int udp4_ufo_send_check(struct sk_buff *skb);
212extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, int features);
210#endif /* _UDP_H */ 213#endif /* _UDP_H */
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
new file mode 100644
index 000000000000..547b1e271ac9
--- /dev/null
+++ b/include/net/wpan-phy.h
@@ -0,0 +1,63 @@
1/*
2 * Copyright (C) 2007, 2008, 2009 Siemens AG
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Written by:
18 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
19 */
20
21#ifndef WPAN_PHY_H
22#define WPAN_PHY_H
23
24#include <linux/netdevice.h>
25#include <linux/mutex.h>
26
27struct wpan_phy {
28 struct mutex pib_lock;
29
30 /*
31 * This is a PIB acording to 802.15.4-2006.
32 * We do not provide timing-related variables, as they
33 * aren't used outside of driver
34 */
35 u8 current_channel;
36 u8 current_page;
37 u32 channels_supported;
38 u8 transmit_power;
39 u8 cca_mode;
40
41 struct device dev;
42 int idx;
43
44 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
45};
46
47struct wpan_phy *wpan_phy_alloc(size_t priv_size);
48int wpan_phy_register(struct device *parent, struct wpan_phy *phy);
49void wpan_phy_unregister(struct wpan_phy *phy);
50void wpan_phy_free(struct wpan_phy *phy);
51
52static inline void *wpan_phy_priv(struct wpan_phy *phy)
53{
54 BUG_ON(!phy);
55 return &phy->priv;
56}
57
58struct wpan_phy *wpan_phy_find(const char *str);
59static inline const char *wpan_phy_name(struct wpan_phy *phy)
60{
61 return dev_name(&phy->dev);
62}
63#endif
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 9e3a3f4c1f60..223e90a44824 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1280,7 +1280,7 @@ struct xfrm6_tunnel {
1280}; 1280};
1281 1281
1282extern void xfrm_init(void); 1282extern void xfrm_init(void);
1283extern void xfrm4_init(void); 1283extern void xfrm4_init(int rt_hash_size);
1284extern int xfrm_state_init(struct net *net); 1284extern int xfrm_state_init(struct net *net);
1285extern void xfrm_state_fini(struct net *net); 1285extern void xfrm_state_fini(struct net *net);
1286extern void xfrm4_state_init(void); 1286extern void xfrm4_state_init(void);