aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/9p/client.h1
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/atmclip.h1
-rw-r--r--include/net/ax88796.h13
-rw-r--r--include/net/bluetooth/bluetooth.h12
-rw-r--r--include/net/bluetooth/hci.h9
-rw-r--r--include/net/bluetooth/hci_core.h93
-rw-r--r--include/net/bluetooth/l2cap.h13
-rw-r--r--include/net/bluetooth/rfcomm.h20
-rw-r--r--include/net/cfg80211.h417
-rw-r--r--include/net/cipso_ipv4.h17
-rw-r--r--include/net/dsa.h42
-rw-r--r--include/net/ethoc.h22
-rw-r--r--include/net/ieee80211.h1185
-rw-r--r--include/net/ieee80211_radiotap.h4
-rw-r--r--include/net/if_inet6.h5
-rw-r--r--include/net/inet_ecn.h4
-rw-r--r--include/net/inet_frag.h3
-rw-r--r--include/net/inet_hashtables.h4
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/ip_vs.h4
-rw-r--r--include/net/ipv6.h4
-rw-r--r--include/net/ipx.h2
-rw-r--r--include/net/mac80211.h342
-rw-r--r--include/net/net_namespace.h27
-rw-r--r--include/net/netfilter/nf_conntrack.h16
-rw-r--r--include/net/netfilter/nf_conntrack_core.h3
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h5
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h2
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h7
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h17
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h6
-rw-r--r--include/net/netfilter/nf_log.h11
-rw-r--r--include/net/netfilter/nf_nat.h1
-rw-r--r--include/net/netlabel.h17
-rw-r--r--include/net/netlink.h1
-rw-r--r--include/net/netns/conntrack.h5
-rw-r--r--include/net/netns/ipv4.h13
-rw-r--r--include/net/netrom.h4
-rw-r--r--include/net/phonet/phonet.h1
-rw-r--r--include/net/phonet/pn_dev.h5
-rw-r--r--include/net/pkt_sched.h1
-rw-r--r--include/net/psnap.h6
-rw-r--r--include/net/sch_generic.h28
-rw-r--r--include/net/sctp/checksum.h14
-rw-r--r--include/net/sctp/command.h3
-rw-r--r--include/net/sctp/sctp.h9
-rw-r--r--include/net/sctp/structs.h7
-rw-r--r--include/net/sock.h49
-rw-r--r--include/net/tcp.h66
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--include/net/wireless.h86
52 files changed, 1164 insertions, 1470 deletions
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 4012e07162e5..e26812274b75 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -98,7 +98,6 @@ enum p9_req_status_t {
98struct p9_req_t { 98struct p9_req_t {
99 int status; 99 int status;
100 int t_err; 100 int t_err;
101 u16 flush_tag;
102 wait_queue_head_t *wq; 101 wait_queue_head_t *wq;
103 struct p9_fcall *tc; 102 struct p9_fcall *tc;
104 struct p9_fcall *rc; 103 struct p9_fcall *rc;
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index c216de528b08..7b55ab215a64 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -88,8 +88,8 @@ extern int ipv6_dev_get_saddr(struct net *net,
88extern int ipv6_get_lladdr(struct net_device *dev, 88extern int ipv6_get_lladdr(struct net_device *dev,
89 struct in6_addr *addr, 89 struct in6_addr *addr,
90 unsigned char banned_flags); 90 unsigned char banned_flags);
91extern int ipv6_rcv_saddr_equal(const struct sock *sk, 91extern int ipv6_rcv_saddr_equal(const struct sock *sk,
92 const struct sock *sk2); 92 const struct sock *sk2);
93extern void addrconf_join_solict(struct net_device *dev, 93extern void addrconf_join_solict(struct net_device *dev,
94 struct in6_addr *addr); 94 struct in6_addr *addr);
95extern void addrconf_leave_solict(struct inet6_dev *idev, 95extern void addrconf_leave_solict(struct inet6_dev *idev,
diff --git a/include/net/atmclip.h b/include/net/atmclip.h
index b5a51a7bb364..467c531b8a7e 100644
--- a/include/net/atmclip.h
+++ b/include/net/atmclip.h
@@ -50,7 +50,6 @@ struct atmarp_entry {
50struct clip_priv { 50struct clip_priv {
51 int number; /* for convenience ... */ 51 int number; /* for convenience ... */
52 spinlock_t xoff_lock; /* ensures that pop is atomic (SMP) */ 52 spinlock_t xoff_lock; /* ensures that pop is atomic (SMP) */
53 struct net_device_stats stats;
54 struct net_device *next; /* next CLIP interface */ 53 struct net_device *next; /* next CLIP interface */
55}; 54};
56 55
diff --git a/include/net/ax88796.h b/include/net/ax88796.h
index 51329dae44e6..b9a3beca0ce4 100644
--- a/include/net/ax88796.h
+++ b/include/net/ax88796.h
@@ -15,14 +15,17 @@
15#define AXFLG_HAS_EEPROM (1<<0) 15#define AXFLG_HAS_EEPROM (1<<0)
16#define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ 16#define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */
17#define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */ 17#define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */
18#define AXFLG_MAC_FROMPLATFORM (1<<3) /* MAC given by platform data */
18 19
19struct ax_plat_data { 20struct ax_plat_data {
20 unsigned int flags; 21 unsigned int flags;
21 unsigned char wordlength; /* 1 or 2 */ 22 unsigned char wordlength; /* 1 or 2 */
22 unsigned char dcr_val; /* default value for DCR */ 23 unsigned char dcr_val; /* default value for DCR */
23 unsigned char rcr_val; /* default value for RCR */ 24 unsigned char rcr_val; /* default value for RCR */
24 unsigned char gpoc_val; /* default value for GPOC */ 25 unsigned char gpoc_val; /* default value for GPOC */
25 u32 *reg_offsets; /* register offsets */ 26 u32 *reg_offsets; /* register offsets */
27 u8 *mac_addr; /* MAC addr (only used when
28 AXFLG_MAC_FROMPLATFORM is used */
26}; 29};
27 30
28#endif /* __NET_AX88796_PLAT_H */ 31#endif /* __NET_AX88796_PLAT_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index a04f8463ac7e..3ad5390a4dd5 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -53,6 +53,17 @@
53#define SOL_SCO 17 53#define SOL_SCO 17
54#define SOL_RFCOMM 18 54#define SOL_RFCOMM 18
55 55
56#define BT_SECURITY 4
57struct bt_security {
58 __u8 level;
59};
60#define BT_SECURITY_SDP 0
61#define BT_SECURITY_LOW 1
62#define BT_SECURITY_MEDIUM 2
63#define BT_SECURITY_HIGH 3
64
65#define BT_DEFER_SETUP 7
66
56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) 67#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
57#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) 68#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
58#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) 69#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg)
@@ -108,6 +119,7 @@ struct bt_sock {
108 bdaddr_t dst; 119 bdaddr_t dst;
109 struct list_head accept_q; 120 struct list_head accept_q;
110 struct sock *parent; 121 struct sock *parent;
122 u32 defer_setup;
111}; 123};
112 124
113struct bt_sock_list { 125struct bt_sock_list {
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 3645139e68c7..ed3aea1605e8 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -101,6 +101,7 @@ enum {
101/* HCI timeouts */ 101/* HCI timeouts */
102#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ 102#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */
103#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ 103#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */
104#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */
104#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 105#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
105#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 106#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
106 107
@@ -133,8 +134,13 @@ enum {
133#define ESCO_EV3 0x0008 134#define ESCO_EV3 0x0008
134#define ESCO_EV4 0x0010 135#define ESCO_EV4 0x0010
135#define ESCO_EV5 0x0020 136#define ESCO_EV5 0x0020
137#define ESCO_2EV3 0x0040
138#define ESCO_3EV3 0x0080
139#define ESCO_2EV5 0x0100
140#define ESCO_3EV5 0x0200
136 141
137#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) 142#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
143#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
138 144
139/* ACL flags */ 145/* ACL flags */
140#define ACL_CONT 0x01 146#define ACL_CONT 0x01
@@ -176,6 +182,9 @@ enum {
176#define LMP_EV5 0x02 182#define LMP_EV5 0x02
177 183
178#define LMP_SNIFF_SUBR 0x02 184#define LMP_SNIFF_SUBR 0x02
185#define LMP_EDR_ESCO_2M 0x20
186#define LMP_EDR_ESCO_3M 0x40
187#define LMP_EDR_3S_ESCO 0x80
179 188
180#define LMP_SIMPLE_PAIR 0x08 189#define LMP_SIMPLE_PAIR 0x08
181 190
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 46a43b721dd6..73aead222b32 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -169,7 +169,9 @@ struct hci_conn {
169 __u16 link_policy; 169 __u16 link_policy;
170 __u32 link_mode; 170 __u32 link_mode;
171 __u8 auth_type; 171 __u8 auth_type;
172 __u8 sec_level;
172 __u8 power_save; 173 __u8 power_save;
174 __u16 disc_timeout;
173 unsigned long pend; 175 unsigned long pend;
174 176
175 unsigned int sent; 177 unsigned int sent;
@@ -179,7 +181,8 @@ struct hci_conn {
179 struct timer_list disc_timer; 181 struct timer_list disc_timer;
180 struct timer_list idle_timer; 182 struct timer_list idle_timer;
181 183
182 struct work_struct work; 184 struct work_struct work_add;
185 struct work_struct work_del;
183 186
184 struct device dev; 187 struct device dev;
185 188
@@ -325,12 +328,11 @@ int hci_conn_del(struct hci_conn *conn);
325void hci_conn_hash_flush(struct hci_dev *hdev); 328void hci_conn_hash_flush(struct hci_dev *hdev);
326void hci_conn_check_pending(struct hci_dev *hdev); 329void hci_conn_check_pending(struct hci_dev *hdev);
327 330
328struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 auth_type); 331struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type);
329int hci_conn_check_link_mode(struct hci_conn *conn); 332int hci_conn_check_link_mode(struct hci_conn *conn);
330int hci_conn_auth(struct hci_conn *conn); 333int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type);
331int hci_conn_encrypt(struct hci_conn *conn);
332int hci_conn_change_link_key(struct hci_conn *conn); 334int hci_conn_change_link_key(struct hci_conn *conn);
333int hci_conn_switch_role(struct hci_conn *conn, uint8_t role); 335int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
334 336
335void hci_conn_enter_active_mode(struct hci_conn *conn); 337void hci_conn_enter_active_mode(struct hci_conn *conn);
336void hci_conn_enter_sniff_mode(struct hci_conn *conn); 338void hci_conn_enter_sniff_mode(struct hci_conn *conn);
@@ -348,9 +350,9 @@ static inline void hci_conn_put(struct hci_conn *conn)
348 if (conn->type == ACL_LINK) { 350 if (conn->type == ACL_LINK) {
349 del_timer(&conn->idle_timer); 351 del_timer(&conn->idle_timer);
350 if (conn->state == BT_CONNECTED) { 352 if (conn->state == BT_CONNECTED) {
351 timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT); 353 timeo = msecs_to_jiffies(conn->disc_timeout);
352 if (!conn->out) 354 if (!conn->out)
353 timeo *= 5; 355 timeo *= 2;
354 } else 356 } else
355 timeo = msecs_to_jiffies(10); 357 timeo = msecs_to_jiffies(10);
356 } else 358 } else
@@ -455,6 +457,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
455 457
456int hci_register_sysfs(struct hci_dev *hdev); 458int hci_register_sysfs(struct hci_dev *hdev);
457void hci_unregister_sysfs(struct hci_dev *hdev); 459void hci_unregister_sysfs(struct hci_dev *hdev);
460void hci_conn_init_sysfs(struct hci_conn *conn);
458void hci_conn_add_sysfs(struct hci_conn *conn); 461void hci_conn_add_sysfs(struct hci_conn *conn);
459void hci_conn_del_sysfs(struct hci_conn *conn); 462void hci_conn_del_sysfs(struct hci_conn *conn);
460 463
@@ -470,26 +473,26 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
470 473
471/* ----- HCI protocols ----- */ 474/* ----- HCI protocols ----- */
472struct hci_proto { 475struct hci_proto {
473 char *name; 476 char *name;
474 unsigned int id; 477 unsigned int id;
475 unsigned long flags; 478 unsigned long flags;
476 479
477 void *priv; 480 void *priv;
478 481
479 int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type); 482 int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type);
480 int (*connect_cfm) (struct hci_conn *conn, __u8 status); 483 int (*connect_cfm) (struct hci_conn *conn, __u8 status);
481 int (*disconn_ind) (struct hci_conn *conn, __u8 reason); 484 int (*disconn_ind) (struct hci_conn *conn);
485 int (*disconn_cfm) (struct hci_conn *conn, __u8 reason);
482 int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb, __u16 flags); 486 int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb, __u16 flags);
483 int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb); 487 int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb);
484 int (*auth_cfm) (struct hci_conn *conn, __u8 status); 488 int (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
485 int (*encrypt_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
486}; 489};
487 490
488static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type) 491static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type)
489{ 492{
490 register struct hci_proto *hp; 493 register struct hci_proto *hp;
491 int mask = 0; 494 int mask = 0;
492 495
493 hp = hci_proto[HCI_PROTO_L2CAP]; 496 hp = hci_proto[HCI_PROTO_L2CAP];
494 if (hp && hp->connect_ind) 497 if (hp && hp->connect_ind)
495 mask |= hp->connect_ind(hdev, bdaddr, type); 498 mask |= hp->connect_ind(hdev, bdaddr, type);
@@ -514,30 +517,52 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
514 hp->connect_cfm(conn, status); 517 hp->connect_cfm(conn, status);
515} 518}
516 519
517static inline void hci_proto_disconn_ind(struct hci_conn *conn, __u8 reason) 520static inline int hci_proto_disconn_ind(struct hci_conn *conn)
518{ 521{
519 register struct hci_proto *hp; 522 register struct hci_proto *hp;
523 int reason = 0x13;
520 524
521 hp = hci_proto[HCI_PROTO_L2CAP]; 525 hp = hci_proto[HCI_PROTO_L2CAP];
522 if (hp && hp->disconn_ind) 526 if (hp && hp->disconn_ind)
523 hp->disconn_ind(conn, reason); 527 reason = hp->disconn_ind(conn);
524 528
525 hp = hci_proto[HCI_PROTO_SCO]; 529 hp = hci_proto[HCI_PROTO_SCO];
526 if (hp && hp->disconn_ind) 530 if (hp && hp->disconn_ind)
527 hp->disconn_ind(conn, reason); 531 reason = hp->disconn_ind(conn);
532
533 return reason;
534}
535
536static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
537{
538 register struct hci_proto *hp;
539
540 hp = hci_proto[HCI_PROTO_L2CAP];
541 if (hp && hp->disconn_cfm)
542 hp->disconn_cfm(conn, reason);
543
544 hp = hci_proto[HCI_PROTO_SCO];
545 if (hp && hp->disconn_cfm)
546 hp->disconn_cfm(conn, reason);
528} 547}
529 548
530static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) 549static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
531{ 550{
532 register struct hci_proto *hp; 551 register struct hci_proto *hp;
552 __u8 encrypt;
553
554 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend))
555 return;
556
557 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
533 558
534 hp = hci_proto[HCI_PROTO_L2CAP]; 559 hp = hci_proto[HCI_PROTO_L2CAP];
535 if (hp && hp->auth_cfm) 560 if (hp && hp->security_cfm)
536 hp->auth_cfm(conn, status); 561 hp->security_cfm(conn, status, encrypt);
537 562
538 hp = hci_proto[HCI_PROTO_SCO]; 563 hp = hci_proto[HCI_PROTO_SCO];
539 if (hp && hp->auth_cfm) 564 if (hp && hp->security_cfm)
540 hp->auth_cfm(conn, status); 565 hp->security_cfm(conn, status, encrypt);
541} 566}
542 567
543static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) 568static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt)
@@ -545,12 +570,12 @@ static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u
545 register struct hci_proto *hp; 570 register struct hci_proto *hp;
546 571
547 hp = hci_proto[HCI_PROTO_L2CAP]; 572 hp = hci_proto[HCI_PROTO_L2CAP];
548 if (hp && hp->encrypt_cfm) 573 if (hp && hp->security_cfm)
549 hp->encrypt_cfm(conn, status, encrypt); 574 hp->security_cfm(conn, status, encrypt);
550 575
551 hp = hci_proto[HCI_PROTO_SCO]; 576 hp = hci_proto[HCI_PROTO_SCO];
552 if (hp && hp->encrypt_cfm) 577 if (hp && hp->security_cfm)
553 hp->encrypt_cfm(conn, status, encrypt); 578 hp->security_cfm(conn, status, encrypt);
554} 579}
555 580
556int hci_register_proto(struct hci_proto *hproto); 581int hci_register_proto(struct hci_proto *hproto);
@@ -562,8 +587,7 @@ struct hci_cb {
562 587
563 char *name; 588 char *name;
564 589
565 void (*auth_cfm) (struct hci_conn *conn, __u8 status); 590 void (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
566 void (*encrypt_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
567 void (*key_change_cfm) (struct hci_conn *conn, __u8 status); 591 void (*key_change_cfm) (struct hci_conn *conn, __u8 status);
568 void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role); 592 void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role);
569}; 593};
@@ -571,14 +595,20 @@ struct hci_cb {
571static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) 595static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
572{ 596{
573 struct list_head *p; 597 struct list_head *p;
598 __u8 encrypt;
574 599
575 hci_proto_auth_cfm(conn, status); 600 hci_proto_auth_cfm(conn, status);
576 601
602 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend))
603 return;
604
605 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
606
577 read_lock_bh(&hci_cb_list_lock); 607 read_lock_bh(&hci_cb_list_lock);
578 list_for_each(p, &hci_cb_list) { 608 list_for_each(p, &hci_cb_list) {
579 struct hci_cb *cb = list_entry(p, struct hci_cb, list); 609 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
580 if (cb->auth_cfm) 610 if (cb->security_cfm)
581 cb->auth_cfm(conn, status); 611 cb->security_cfm(conn, status, encrypt);
582 } 612 }
583 read_unlock_bh(&hci_cb_list_lock); 613 read_unlock_bh(&hci_cb_list_lock);
584} 614}
@@ -587,13 +617,16 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encr
587{ 617{
588 struct list_head *p; 618 struct list_head *p;
589 619
620 if (conn->sec_level == BT_SECURITY_SDP)
621 conn->sec_level = BT_SECURITY_LOW;
622
590 hci_proto_encrypt_cfm(conn, status, encrypt); 623 hci_proto_encrypt_cfm(conn, status, encrypt);
591 624
592 read_lock_bh(&hci_cb_list_lock); 625 read_lock_bh(&hci_cb_list_lock);
593 list_for_each(p, &hci_cb_list) { 626 list_for_each(p, &hci_cb_list) {
594 struct hci_cb *cb = list_entry(p, struct hci_cb, list); 627 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
595 if (cb->encrypt_cfm) 628 if (cb->security_cfm)
596 cb->encrypt_cfm(conn, status, encrypt); 629 cb->security_cfm(conn, status, encrypt);
597 } 630 }
598 read_unlock_bh(&hci_cb_list_lock); 631 read_unlock_bh(&hci_cb_list_lock);
599} 632}
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 73e115bc12dd..f566aa1f0a4c 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -37,6 +37,7 @@ struct sockaddr_l2 {
37 sa_family_t l2_family; 37 sa_family_t l2_family;
38 __le16 l2_psm; 38 __le16 l2_psm;
39 bdaddr_t l2_bdaddr; 39 bdaddr_t l2_bdaddr;
40 __le16 l2_cid;
40}; 41};
41 42
42/* L2CAP socket options */ 43/* L2CAP socket options */
@@ -185,6 +186,7 @@ struct l2cap_info_rsp {
185/* info type */ 186/* info type */
186#define L2CAP_IT_CL_MTU 0x0001 187#define L2CAP_IT_CL_MTU 0x0001
187#define L2CAP_IT_FEAT_MASK 0x0002 188#define L2CAP_IT_FEAT_MASK 0x0002
189#define L2CAP_IT_FIXED_CHAN 0x0003
188 190
189/* info result */ 191/* info result */
190#define L2CAP_IR_SUCCESS 0x0000 192#define L2CAP_IR_SUCCESS 0x0000
@@ -219,11 +221,14 @@ struct l2cap_conn {
219 __u8 rx_ident; 221 __u8 rx_ident;
220 __u8 tx_ident; 222 __u8 tx_ident;
221 223
224 __u8 disc_reason;
225
222 struct l2cap_chan_list chan_list; 226 struct l2cap_chan_list chan_list;
223}; 227};
224 228
225#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 229#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
226#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x02 230#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04
231#define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08
227 232
228/* ----- L2CAP channel and socket info ----- */ 233/* ----- L2CAP channel and socket info ----- */
229#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 234#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
@@ -237,8 +242,9 @@ struct l2cap_pinfo {
237 __u16 imtu; 242 __u16 imtu;
238 __u16 omtu; 243 __u16 omtu;
239 __u16 flush_to; 244 __u16 flush_to;
240 245 __u8 sec_level;
241 __u32 link_mode; 246 __u8 role_switch;
247 __u8 force_reliable;
242 248
243 __u8 conf_req[64]; 249 __u8 conf_req[64];
244 __u8 conf_len; 250 __u8 conf_len;
@@ -257,6 +263,7 @@ struct l2cap_pinfo {
257#define L2CAP_CONF_REQ_SENT 0x01 263#define L2CAP_CONF_REQ_SENT 0x01
258#define L2CAP_CONF_INPUT_DONE 0x02 264#define L2CAP_CONF_INPUT_DONE 0x02
259#define L2CAP_CONF_OUTPUT_DONE 0x04 265#define L2CAP_CONF_OUTPUT_DONE 0x04
266#define L2CAP_CONF_CONNECT_PEND 0x80
260 267
261#define L2CAP_CONF_MAX_RETRIES 2 268#define L2CAP_CONF_MAX_RETRIES 2
262 269
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 4dc8d92a4638..80072611d26a 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -183,8 +183,9 @@ struct rfcomm_dlc {
183 u8 remote_v24_sig; 183 u8 remote_v24_sig;
184 u8 mscex; 184 u8 mscex;
185 u8 out; 185 u8 out;
186 186 u8 sec_level;
187 u32 link_mode; 187 u8 role_switch;
188 u32 defer_setup;
188 189
189 uint mtu; 190 uint mtu;
190 uint cfc; 191 uint cfc;
@@ -202,10 +203,12 @@ struct rfcomm_dlc {
202#define RFCOMM_RX_THROTTLED 0 203#define RFCOMM_RX_THROTTLED 0
203#define RFCOMM_TX_THROTTLED 1 204#define RFCOMM_TX_THROTTLED 1
204#define RFCOMM_TIMED_OUT 2 205#define RFCOMM_TIMED_OUT 2
205#define RFCOMM_MSC_PENDING 3 206#define RFCOMM_MSC_PENDING 3
206#define RFCOMM_AUTH_PENDING 4 207#define RFCOMM_SEC_PENDING 4
207#define RFCOMM_AUTH_ACCEPT 5 208#define RFCOMM_AUTH_PENDING 5
208#define RFCOMM_AUTH_REJECT 6 209#define RFCOMM_AUTH_ACCEPT 6
210#define RFCOMM_AUTH_REJECT 7
211#define RFCOMM_DEFER_SETUP 8
209 212
210/* Scheduling flags and events */ 213/* Scheduling flags and events */
211#define RFCOMM_SCHED_STATE 0 214#define RFCOMM_SCHED_STATE 0
@@ -239,6 +242,7 @@ int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason);
239int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); 242int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb);
240int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); 243int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig);
241int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig); 244int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig);
245void rfcomm_dlc_accept(struct rfcomm_dlc *d);
242 246
243#define rfcomm_dlc_lock(d) spin_lock(&d->lock) 247#define rfcomm_dlc_lock(d) spin_lock(&d->lock)
244#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) 248#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock)
@@ -304,7 +308,8 @@ struct rfcomm_pinfo {
304 struct bt_sock bt; 308 struct bt_sock bt;
305 struct rfcomm_dlc *dlc; 309 struct rfcomm_dlc *dlc;
306 u8 channel; 310 u8 channel;
307 u32 link_mode; 311 u8 sec_level;
312 u8 role_switch;
308}; 313};
309 314
310int rfcomm_init_sockets(void); 315int rfcomm_init_sockets(void);
@@ -333,7 +338,6 @@ struct rfcomm_dev_req {
333 bdaddr_t src; 338 bdaddr_t src;
334 bdaddr_t dst; 339 bdaddr_t dst;
335 u8 channel; 340 u8 channel;
336
337}; 341};
338 342
339struct rfcomm_dev_info { 343struct rfcomm_dev_info {
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 23c0ab74ded6..5389afdc1297 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4,6 +4,10 @@
4#include <linux/netlink.h> 4#include <linux/netlink.h>
5#include <linux/skbuff.h> 5#include <linux/skbuff.h>
6#include <linux/nl80211.h> 6#include <linux/nl80211.h>
7#include <linux/if_ether.h>
8#include <linux/ieee80211.h>
9#include <linux/wireless.h>
10#include <net/iw_handler.h>
7#include <net/genetlink.h> 11#include <net/genetlink.h>
8/* remove once we remove the wext stuff */ 12/* remove once we remove the wext stuff */
9#include <net/iw_handler.h> 13#include <net/iw_handler.h>
@@ -112,12 +116,14 @@ struct beacon_parameters {
112 * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames 116 * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
113 * with short preambles 117 * with short preambles
114 * @STATION_FLAG_WME: station is WME/QoS capable 118 * @STATION_FLAG_WME: station is WME/QoS capable
119 * @STATION_FLAG_MFP: station uses management frame protection
115 */ 120 */
116enum station_flags { 121enum station_flags {
117 STATION_FLAG_CHANGED = 1<<0, 122 STATION_FLAG_CHANGED = 1<<0,
118 STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED, 123 STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED,
119 STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE, 124 STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
120 STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME, 125 STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME,
126 STATION_FLAG_MFP = 1<<NL80211_STA_FLAG_MFP,
121}; 127};
122 128
123/** 129/**
@@ -172,6 +178,8 @@ struct station_parameters {
172 * @STATION_INFO_SIGNAL: @signal filled 178 * @STATION_INFO_SIGNAL: @signal filled
173 * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled 179 * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
174 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 180 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
181 * @STATION_INFO_RX_PACKETS: @rx_packets filled
182 * @STATION_INFO_TX_PACKETS: @tx_packets filled
175 */ 183 */
176enum station_info_flags { 184enum station_info_flags {
177 STATION_INFO_INACTIVE_TIME = 1<<0, 185 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -182,6 +190,8 @@ enum station_info_flags {
182 STATION_INFO_PLINK_STATE = 1<<5, 190 STATION_INFO_PLINK_STATE = 1<<5,
183 STATION_INFO_SIGNAL = 1<<6, 191 STATION_INFO_SIGNAL = 1<<6,
184 STATION_INFO_TX_BITRATE = 1<<7, 192 STATION_INFO_TX_BITRATE = 1<<7,
193 STATION_INFO_RX_PACKETS = 1<<8,
194 STATION_INFO_TX_PACKETS = 1<<9,
185}; 195};
186 196
187/** 197/**
@@ -229,6 +239,8 @@ struct rate_info {
229 * @plink_state: mesh peer link state 239 * @plink_state: mesh peer link state
230 * @signal: signal strength of last received packet in dBm 240 * @signal: signal strength of last received packet in dBm
231 * @txrate: current unicast bitrate to this station 241 * @txrate: current unicast bitrate to this station
242 * @rx_packets: packets received from this station
243 * @tx_packets: packets transmitted to this station
232 */ 244 */
233struct station_info { 245struct station_info {
234 u32 filled; 246 u32 filled;
@@ -240,6 +252,8 @@ struct station_info {
240 u8 plink_state; 252 u8 plink_state;
241 s8 signal; 253 s8 signal;
242 struct rate_info txrate; 254 struct rate_info txrate;
255 u32 rx_packets;
256 u32 tx_packets;
243}; 257};
244 258
245/** 259/**
@@ -335,24 +349,50 @@ struct bss_parameters {
335}; 349};
336 350
337/** 351/**
338 * enum reg_set_by - Indicates who is trying to set the regulatory domain 352 * enum environment_cap - Environment parsed from country IE
339 * @REGDOM_SET_BY_INIT: regulatory domain was set by initialization. We will be 353 * @ENVIRON_ANY: indicates country IE applies to both indoor and
340 * using a static world regulatory domain by default. 354 * outdoor operation.
341 * @REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world regulatory domain. 355 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
342 * @REGDOM_SET_BY_USER: User asked the wireless core to set the 356 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
343 * regulatory domain. 357 */
344 * @REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the wireless core 358enum environment_cap {
345 * it thinks its knows the regulatory domain we should be in. 359 ENVIRON_ANY,
346 * @REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an 802.11 country 360 ENVIRON_INDOOR,
347 * information element with regulatory information it thinks we 361 ENVIRON_OUTDOOR,
348 * should consider. 362};
363
364/**
365 * struct regulatory_request - used to keep track of regulatory requests
366 *
367 * @wiphy_idx: this is set if this request's initiator is
368 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
369 * can be used by the wireless core to deal with conflicts
370 * and potentially inform users of which devices specifically
371 * cased the conflicts.
372 * @initiator: indicates who sent this request, could be any of
373 * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
374 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
375 * regulatory domain. We have a few special codes:
376 * 00 - World regulatory domain
377 * 99 - built by driver but a specific alpha2 cannot be determined
378 * 98 - result of an intersection between two regulatory domains
379 * @intersect: indicates whether the wireless core should intersect
380 * the requested regulatory domain with the presently set regulatory
381 * domain.
382 * @country_ie_checksum: checksum of the last processed and accepted
383 * country IE
384 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
385 * indoor, or if it doesn't matter
386 * @list: used to insert into the reg_requests_list linked list
349 */ 387 */
350enum reg_set_by { 388struct regulatory_request {
351 REGDOM_SET_BY_INIT, 389 int wiphy_idx;
352 REGDOM_SET_BY_CORE, 390 enum nl80211_reg_initiator initiator;
353 REGDOM_SET_BY_USER, 391 char alpha2[2];
354 REGDOM_SET_BY_DRIVER, 392 bool intersect;
355 REGDOM_SET_BY_COUNTRY_IE, 393 u32 country_ie_checksum;
394 enum environment_cap country_ie_env;
395 struct list_head list;
356}; 396};
357 397
358struct ieee80211_freq_range { 398struct ieee80211_freq_range {
@@ -438,6 +478,187 @@ struct wiphy;
438struct ieee80211_channel; 478struct ieee80211_channel;
439 479
440/** 480/**
481 * struct cfg80211_ssid - SSID description
482 * @ssid: the SSID
483 * @ssid_len: length of the ssid
484 */
485struct cfg80211_ssid {
486 u8 ssid[IEEE80211_MAX_SSID_LEN];
487 u8 ssid_len;
488};
489
490/**
491 * struct cfg80211_scan_request - scan request description
492 *
493 * @ssids: SSIDs to scan for (active scan only)
494 * @n_ssids: number of SSIDs
495 * @channels: channels to scan on.
496 * @n_channels: number of channels for each band
497 * @ie: optional information element(s) to add into Probe Request or %NULL
498 * @ie_len: length of ie in octets
499 * @wiphy: the wiphy this was for
500 * @ifidx: the interface index
501 */
502struct cfg80211_scan_request {
503 struct cfg80211_ssid *ssids;
504 int n_ssids;
505 struct ieee80211_channel **channels;
506 u32 n_channels;
507 u8 *ie;
508 size_t ie_len;
509
510 /* internal */
511 struct wiphy *wiphy;
512 int ifidx;
513};
514
515/**
516 * enum cfg80211_signal_type - signal type
517 *
518 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
519 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
520 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
521 */
522enum cfg80211_signal_type {
523 CFG80211_SIGNAL_TYPE_NONE,
524 CFG80211_SIGNAL_TYPE_MBM,
525 CFG80211_SIGNAL_TYPE_UNSPEC,
526};
527
528/**
529 * struct cfg80211_bss - BSS description
530 *
531 * This structure describes a BSS (which may also be a mesh network)
532 * for use in scan results and similar.
533 *
534 * @bssid: BSSID of the BSS
535 * @tsf: timestamp of last received update
536 * @beacon_interval: the beacon interval as from the frame
537 * @capability: the capability field in host byte order
538 * @information_elements: the information elements (Note that there
539 * is no guarantee that these are well-formed!)
540 * @len_information_elements: total length of the information elements
541 * @signal: signal strength value (type depends on the wiphy's signal_type)
542 * @hold: BSS should not expire
543 * @free_priv: function pointer to free private data
544 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
545 */
546struct cfg80211_bss {
547 struct ieee80211_channel *channel;
548
549 u8 bssid[ETH_ALEN];
550 u64 tsf;
551 u16 beacon_interval;
552 u16 capability;
553 u8 *information_elements;
554 size_t len_information_elements;
555
556 s32 signal;
557
558 void (*free_priv)(struct cfg80211_bss *bss);
559 u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
560};
561
562/**
563 * struct cfg80211_auth_request - Authentication request data
564 *
565 * This structure provides information needed to complete IEEE 802.11
566 * authentication.
567 * NOTE: This structure will likely change when more code from mac80211 is
568 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
569 * Before using this in a driver that does not use mac80211, it would be better
570 * to check the status of that work and better yet, volunteer to work on it.
571 *
572 * @chan: The channel to use or %NULL if not specified (auto-select based on
573 * scan results)
574 * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case);
575 * this field is required to be present; if the driver wants to help with
576 * BSS selection, it should use (yet to be added) MLME event to allow user
577 * space SME to be notified of roaming candidate, so that the SME can then
578 * use the authentication request with the recommended BSSID and whatever
579 * other data may be needed for authentication/association
580 * @ssid: SSID or %NULL if not yet available
581 * @ssid_len: Length of ssid in octets
582 * @auth_type: Authentication type (algorithm)
583 * @ie: Extra IEs to add to Authentication frame or %NULL
584 * @ie_len: Length of ie buffer in octets
585 */
586struct cfg80211_auth_request {
587 struct ieee80211_channel *chan;
588 u8 *peer_addr;
589 const u8 *ssid;
590 size_t ssid_len;
591 enum nl80211_auth_type auth_type;
592 const u8 *ie;
593 size_t ie_len;
594};
595
596/**
597 * struct cfg80211_assoc_request - (Re)Association request data
598 *
599 * This structure provides information needed to complete IEEE 802.11
600 * (re)association.
601 * NOTE: This structure will likely change when more code from mac80211 is
602 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
603 * Before using this in a driver that does not use mac80211, it would be better
604 * to check the status of that work and better yet, volunteer to work on it.
605 *
606 * @chan: The channel to use or %NULL if not specified (auto-select based on
607 * scan results)
608 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
609 * to be present and the STA must be in State 2 (authenticated) with the
610 * peer STA
611 * @ssid: SSID
612 * @ssid_len: Length of ssid in octets
613 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
614 * @ie_len: Length of ie buffer in octets
615 */
616struct cfg80211_assoc_request {
617 struct ieee80211_channel *chan;
618 u8 *peer_addr;
619 const u8 *ssid;
620 size_t ssid_len;
621 const u8 *ie;
622 size_t ie_len;
623};
624
625/**
626 * struct cfg80211_deauth_request - Deauthentication request data
627 *
628 * This structure provides information needed to complete IEEE 802.11
629 * deauthentication.
630 *
631 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
632 * to be present and the STA must be authenticated with the peer STA
633 * @ie: Extra IEs to add to Deauthentication frame or %NULL
634 * @ie_len: Length of ie buffer in octets
635 */
636struct cfg80211_deauth_request {
637 u8 *peer_addr;
638 u16 reason_code;
639 const u8 *ie;
640 size_t ie_len;
641};
642
643/**
644 * struct cfg80211_disassoc_request - Disassociation request data
645 *
646 * This structure provides information needed to complete IEEE 802.11
647 * disassocation.
648 *
649 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
650 * to be present and the STA must be associated with the peer STA
651 * @ie: Extra IEs to add to Disassociation frame or %NULL
652 * @ie_len: Length of ie buffer in octets
653 */
654struct cfg80211_disassoc_request {
655 u8 *peer_addr;
656 u16 reason_code;
657 const u8 *ie;
658 size_t ie_len;
659};
660
661/**
441 * struct cfg80211_ops - backend description for wireless configuration 662 * struct cfg80211_ops - backend description for wireless configuration
442 * 663 *
443 * This struct is registered by fullmac card drivers and/or wireless stacks 664 * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -450,6 +671,9 @@ struct ieee80211_channel;
450 * wireless extensions but this is subject to reevaluation as soon as this 671 * wireless extensions but this is subject to reevaluation as soon as this
451 * code is used more widely and we have a first user without wext. 672 * code is used more widely and we have a first user without wext.
452 * 673 *
674 * @suspend: wiphy device needs to be suspended
675 * @resume: wiphy device needs to be resumed
676 *
453 * @add_virtual_intf: create a new virtual interface with the given name, 677 * @add_virtual_intf: create a new virtual interface with the given name,
454 * must set the struct wireless_dev's iftype. 678 * must set the struct wireless_dev's iftype.
455 * 679 *
@@ -471,6 +695,8 @@ struct ieee80211_channel;
471 * 695 *
472 * @set_default_key: set the default key on an interface 696 * @set_default_key: set the default key on an interface
473 * 697 *
698 * @set_default_mgmt_key: set the default management frame key on an interface
699 *
474 * @add_beacon: Add a beacon with given parameters, @head, @interval 700 * @add_beacon: Add a beacon with given parameters, @head, @interval
475 * and @dtim_period will be valid, @tail is optional. 701 * and @dtim_period will be valid, @tail is optional.
476 * @set_beacon: Change the beacon parameters for an access point mode 702 * @set_beacon: Change the beacon parameters for an access point mode
@@ -497,8 +723,21 @@ struct ieee80211_channel;
497 * @set_txq_params: Set TX queue parameters 723 * @set_txq_params: Set TX queue parameters
498 * 724 *
499 * @set_channel: Set channel 725 * @set_channel: Set channel
726 *
727 * @scan: Request to do a scan. If returning zero, the scan request is given
728 * the driver, and will be valid until passed to cfg80211_scan_done().
729 * For scan results, call cfg80211_inform_bss(); you can call this outside
730 * the scan/scan_done bracket too.
731 *
732 * @auth: Request to authenticate with the specified peer
733 * @assoc: Request to (re)associate with the specified peer
734 * @deauth: Request to deauthenticate from the specified peer
735 * @disassoc: Request to disassociate from the specified peer
500 */ 736 */
501struct cfg80211_ops { 737struct cfg80211_ops {
738 int (*suspend)(struct wiphy *wiphy);
739 int (*resume)(struct wiphy *wiphy);
740
502 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 741 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
503 enum nl80211_iftype type, u32 *flags, 742 enum nl80211_iftype type, u32 *flags,
504 struct vif_params *params); 743 struct vif_params *params);
@@ -518,6 +757,9 @@ struct cfg80211_ops {
518 int (*set_default_key)(struct wiphy *wiphy, 757 int (*set_default_key)(struct wiphy *wiphy,
519 struct net_device *netdev, 758 struct net_device *netdev,
520 u8 key_index); 759 u8 key_index);
760 int (*set_default_mgmt_key)(struct wiphy *wiphy,
761 struct net_device *netdev,
762 u8 key_index);
521 763
522 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 764 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
523 struct beacon_parameters *info); 765 struct beacon_parameters *info);
@@ -564,6 +806,18 @@ struct cfg80211_ops {
564 int (*set_channel)(struct wiphy *wiphy, 806 int (*set_channel)(struct wiphy *wiphy,
565 struct ieee80211_channel *chan, 807 struct ieee80211_channel *chan,
566 enum nl80211_channel_type channel_type); 808 enum nl80211_channel_type channel_type);
809
810 int (*scan)(struct wiphy *wiphy, struct net_device *dev,
811 struct cfg80211_scan_request *request);
812
813 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
814 struct cfg80211_auth_request *req);
815 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
816 struct cfg80211_assoc_request *req);
817 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
818 struct cfg80211_deauth_request *req);
819 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
820 struct cfg80211_disassoc_request *req);
567}; 821};
568 822
569/* temporary wext handlers */ 823/* temporary wext handlers */
@@ -574,5 +828,134 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
574 u32 *mode, char *extra); 828 u32 *mode, char *extra);
575int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, 829int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
576 u32 *mode, char *extra); 830 u32 *mode, char *extra);
831int cfg80211_wext_siwscan(struct net_device *dev,
832 struct iw_request_info *info,
833 union iwreq_data *wrqu, char *extra);
834int cfg80211_wext_giwscan(struct net_device *dev,
835 struct iw_request_info *info,
836 struct iw_point *data, char *extra);
837int cfg80211_wext_giwrange(struct net_device *dev,
838 struct iw_request_info *info,
839 struct iw_point *data, char *extra);
840
841/**
842 * cfg80211_scan_done - notify that scan finished
843 *
844 * @request: the corresponding scan request
845 * @aborted: set to true if the scan was aborted for any reason,
846 * userspace will be notified of that
847 */
848void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
849
850/**
851 * cfg80211_inform_bss - inform cfg80211 of a new BSS
852 *
853 * @wiphy: the wiphy reporting the BSS
854 * @bss: the found BSS
855 * @signal: the signal strength, type depends on the wiphy's signal_type
856 * @gfp: context flags
857 *
858 * This informs cfg80211 that BSS information was found and
859 * the BSS should be updated/added.
860 */
861struct cfg80211_bss*
862cfg80211_inform_bss_frame(struct wiphy *wiphy,
863 struct ieee80211_channel *channel,
864 struct ieee80211_mgmt *mgmt, size_t len,
865 s32 signal, gfp_t gfp);
866
867struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
868 struct ieee80211_channel *channel,
869 const u8 *bssid,
870 const u8 *ssid, size_t ssid_len,
871 u16 capa_mask, u16 capa_val);
872static inline struct cfg80211_bss *
873cfg80211_get_ibss(struct wiphy *wiphy,
874 struct ieee80211_channel *channel,
875 const u8 *ssid, size_t ssid_len)
876{
877 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
878 WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
879}
880
881struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
882 struct ieee80211_channel *channel,
883 const u8 *meshid, size_t meshidlen,
884 const u8 *meshcfg);
885void cfg80211_put_bss(struct cfg80211_bss *bss);
886/**
887 * cfg80211_unlink_bss - unlink BSS from internal data structures
888 * @wiphy: the wiphy
889 * @bss: the bss to remove
890 *
891 * This function removes the given BSS from the internal data structures
892 * thereby making it no longer show up in scan results etc. Use this
893 * function when you detect a BSS is gone. Normally BSSes will also time
894 * out, so it is not necessary to use this function at all.
895 */
896void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
897
898/**
899 * cfg80211_send_rx_auth - notification of processed authentication
900 * @dev: network device
901 * @buf: authentication frame (header + body)
902 * @len: length of the frame data
903 *
904 * This function is called whenever an authentication has been processed in
905 * station mode.
906 */
907void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
908
909/**
910 * cfg80211_send_rx_assoc - notification of processed association
911 * @dev: network device
912 * @buf: (re)association response frame (header + body)
913 * @len: length of the frame data
914 *
915 * This function is called whenever a (re)association response has been
916 * processed in station mode.
917 */
918void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
919
920/**
921 * cfg80211_send_rx_deauth - notification of processed deauthentication
922 * @dev: network device
923 * @buf: deauthentication frame (header + body)
924 * @len: length of the frame data
925 *
926 * This function is called whenever deauthentication has been processed in
927 * station mode.
928 */
929void cfg80211_send_rx_deauth(struct net_device *dev, const u8 *buf,
930 size_t len);
931
932/**
933 * cfg80211_send_rx_disassoc - notification of processed disassociation
934 * @dev: network device
935 * @buf: disassociation response frame (header + body)
936 * @len: length of the frame data
937 *
938 * This function is called whenever disassociation has been processed in
939 * station mode.
940 */
941void cfg80211_send_rx_disassoc(struct net_device *dev, const u8 *buf,
942 size_t len);
943
944/**
945 * cfg80211_hold_bss - exclude bss from expiration
946 * @bss: bss which should not expire
947 *
948 * In a case when the BSS is not updated but it shouldn't expire this
949 * function can be used to mark the BSS to be excluded from expiration.
950 */
951void cfg80211_hold_bss(struct cfg80211_bss *bss);
952
953/**
954 * cfg80211_unhold_bss - remove expiration exception from the BSS
955 * @bss: bss which can expire again
956 *
957 * This function marks the BSS to be expirable again.
958 */
959void cfg80211_unhold_bss(struct cfg80211_bss *bss);
577 960
578#endif /* __NET_CFG80211_H */ 961#endif /* __NET_CFG80211_H */
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index bedc7f62e35d..abd443604c9f 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -40,6 +40,7 @@
40#include <linux/net.h> 40#include <linux/net.h>
41#include <linux/skbuff.h> 41#include <linux/skbuff.h>
42#include <net/netlabel.h> 42#include <net/netlabel.h>
43#include <net/request_sock.h>
43#include <asm/atomic.h> 44#include <asm/atomic.h>
44 45
45/* known doi values */ 46/* known doi values */
@@ -215,6 +216,10 @@ int cipso_v4_sock_setattr(struct sock *sk,
215 const struct netlbl_lsm_secattr *secattr); 216 const struct netlbl_lsm_secattr *secattr);
216void cipso_v4_sock_delattr(struct sock *sk); 217void cipso_v4_sock_delattr(struct sock *sk);
217int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr); 218int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr);
219int cipso_v4_req_setattr(struct request_sock *req,
220 const struct cipso_v4_doi *doi_def,
221 const struct netlbl_lsm_secattr *secattr);
222void cipso_v4_req_delattr(struct request_sock *req);
218int cipso_v4_skbuff_setattr(struct sk_buff *skb, 223int cipso_v4_skbuff_setattr(struct sk_buff *skb,
219 const struct cipso_v4_doi *doi_def, 224 const struct cipso_v4_doi *doi_def,
220 const struct netlbl_lsm_secattr *secattr); 225 const struct netlbl_lsm_secattr *secattr);
@@ -247,6 +252,18 @@ static inline int cipso_v4_sock_getattr(struct sock *sk,
247 return -ENOSYS; 252 return -ENOSYS;
248} 253}
249 254
255static inline int cipso_v4_req_setattr(struct request_sock *req,
256 const struct cipso_v4_doi *doi_def,
257 const struct netlbl_lsm_secattr *secattr)
258{
259 return -ENOSYS;
260}
261
262static inline void cipso_v4_req_delattr(struct request_sock *req)
263{
264 return;
265}
266
250static inline int cipso_v4_skbuff_setattr(struct sk_buff *skb, 267static inline int cipso_v4_skbuff_setattr(struct sk_buff *skb,
251 const struct cipso_v4_doi *doi_def, 268 const struct cipso_v4_doi *doi_def,
252 const struct netlbl_lsm_secattr *secattr) 269 const struct netlbl_lsm_secattr *secattr)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 52e97bfca5a1..839f768f9e35 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * include/net/dsa.h - Driver for Distributed Switch Architecture switch chips 2 * include/net/dsa.h - Driver for Distributed Switch Architecture switch chips
3 * Copyright (c) 2008 Marvell Semiconductor 3 * Copyright (c) 2008-2009 Marvell Semiconductor
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -11,23 +11,47 @@
11#ifndef __LINUX_NET_DSA_H 11#ifndef __LINUX_NET_DSA_H
12#define __LINUX_NET_DSA_H 12#define __LINUX_NET_DSA_H
13 13
14#define DSA_MAX_PORTS 12 14#define DSA_MAX_SWITCHES 4
15#define DSA_MAX_PORTS 12
16
17struct dsa_chip_data {
18 /*
19 * How to access the switch configuration registers.
20 */
21 struct device *mii_bus;
22 int sw_addr;
23
24 /*
25 * The names of the switch's ports. Use "cpu" to
26 * designate the switch port that the cpu is connected to,
27 * "dsa" to indicate that this port is a DSA link to
28 * another switch, NULL to indicate the port is unused,
29 * or any other string to indicate this is a physical port.
30 */
31 char *port_names[DSA_MAX_PORTS];
32
33 /*
34 * An array (with nr_chips elements) of which element [a]
35 * indicates which port on this switch should be used to
36 * send packets to that are destined for switch a. Can be
37 * NULL if there is only one switch chip.
38 */
39 s8 *rtable;
40};
15 41
16struct dsa_platform_data { 42struct dsa_platform_data {
17 /* 43 /*
18 * Reference to a Linux network interface that connects 44 * Reference to a Linux network interface that connects
19 * to the switch chip. 45 * to the root switch chip of the tree.
20 */ 46 */
21 struct device *netdev; 47 struct device *netdev;
22 48
23 /* 49 /*
24 * How to access the switch configuration registers, and 50 * Info structs describing each of the switch chips
25 * the names of the switch ports (use "cpu" to designate 51 * connected via this network interface.
26 * the switch port that the cpu is connected to).
27 */ 52 */
28 struct device *mii_bus; 53 int nr_chips;
29 int sw_addr; 54 struct dsa_chip_data *chip;
30 char *port_names[DSA_MAX_PORTS];
31}; 55};
32 56
33extern bool dsa_uses_dsa_tags(void *dsa_ptr); 57extern bool dsa_uses_dsa_tags(void *dsa_ptr);
diff --git a/include/net/ethoc.h b/include/net/ethoc.h
new file mode 100644
index 000000000000..96f3789b27bc
--- /dev/null
+++ b/include/net/ethoc.h
@@ -0,0 +1,22 @@
1/*
2 * linux/include/net/ethoc.h
3 *
4 * Copyright (C) 2008-2009 Avionic Design GmbH
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 as
8 * published by the Free Software Foundation.
9 *
10 * Written by Thierry Reding <thierry.reding@avionic-design.de>
11 */
12
13#ifndef LINUX_NET_ETHOC_H
14#define LINUX_NET_ETHOC_H 1
15
16struct ethoc_platform_data {
17 u8 hwaddr[IFHWADDRLEN];
18 s8 phy_id;
19};
20
21#endif /* !LINUX_NET_ETHOC_H */
22
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
deleted file mode 100644
index adb7cf31f781..000000000000
--- a/include/net/ieee80211.h
+++ /dev/null
@@ -1,1185 +0,0 @@
1/*
2 * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11
3 * remains copyright by the original authors
4 *
5 * Portions of the merged code are based on Host AP (software wireless
6 * LAN access point) driver for Intersil Prism2/2.5/3.
7 *
8 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
9 * <j@w1.fi>
10 * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
11 *
12 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
13 * <jketreno@linux.intel.com>
14 * Copyright (c) 2004-2005, Intel Corporation
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation. See README and COPYING for
19 * more details.
20 *
21 * API Version History
22 * 1.0.x -- Initial version
23 * 1.1.x -- Added radiotap, QoS, TIM, ieee80211_geo APIs,
24 * various structure changes, and crypto API init method
25 */
26#ifndef IEEE80211_H
27#define IEEE80211_H
28#include <linux/if_ether.h> /* ETH_ALEN */
29#include <linux/kernel.h> /* ARRAY_SIZE */
30#include <linux/wireless.h>
31#include <linux/ieee80211.h>
32
33#include <net/lib80211.h>
34
35#define IEEE80211_VERSION "git-1.1.13"
36
37#define IEEE80211_DATA_LEN 2304
38/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
39 6.2.1.1.2.
40
41 The figure in section 7.1.2 suggests a body size of up to 2312
42 bytes is allowed, which is a bit confusing, I suspect this
43 represents the 2304 bytes of real data, plus a possible 8 bytes of
44 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
45
46#define IEEE80211_1ADDR_LEN 10
47#define IEEE80211_2ADDR_LEN 16
48#define IEEE80211_3ADDR_LEN 24
49#define IEEE80211_4ADDR_LEN 30
50#define IEEE80211_FCS_LEN 4
51#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
52#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
53
54#define MIN_FRAG_THRESHOLD 256U
55#define MAX_FRAG_THRESHOLD 2346U
56
57/* Frame control field constants */
58#define IEEE80211_FCTL_VERS 0x0003
59#define IEEE80211_FCTL_FTYPE 0x000c
60#define IEEE80211_FCTL_STYPE 0x00f0
61#define IEEE80211_FCTL_TODS 0x0100
62#define IEEE80211_FCTL_FROMDS 0x0200
63#define IEEE80211_FCTL_MOREFRAGS 0x0400
64#define IEEE80211_FCTL_RETRY 0x0800
65#define IEEE80211_FCTL_PM 0x1000
66#define IEEE80211_FCTL_MOREDATA 0x2000
67#define IEEE80211_FCTL_PROTECTED 0x4000
68#define IEEE80211_FCTL_ORDER 0x8000
69
70#define IEEE80211_FTYPE_MGMT 0x0000
71#define IEEE80211_FTYPE_CTL 0x0004
72#define IEEE80211_FTYPE_DATA 0x0008
73
74/* management */
75#define IEEE80211_STYPE_ASSOC_REQ 0x0000
76#define IEEE80211_STYPE_ASSOC_RESP 0x0010
77#define IEEE80211_STYPE_REASSOC_REQ 0x0020
78#define IEEE80211_STYPE_REASSOC_RESP 0x0030
79#define IEEE80211_STYPE_PROBE_REQ 0x0040
80#define IEEE80211_STYPE_PROBE_RESP 0x0050
81#define IEEE80211_STYPE_BEACON 0x0080
82#define IEEE80211_STYPE_ATIM 0x0090
83#define IEEE80211_STYPE_DISASSOC 0x00A0
84#define IEEE80211_STYPE_AUTH 0x00B0
85#define IEEE80211_STYPE_DEAUTH 0x00C0
86#define IEEE80211_STYPE_ACTION 0x00D0
87
88/* control */
89#define IEEE80211_STYPE_PSPOLL 0x00A0
90#define IEEE80211_STYPE_RTS 0x00B0
91#define IEEE80211_STYPE_CTS 0x00C0
92#define IEEE80211_STYPE_ACK 0x00D0
93#define IEEE80211_STYPE_CFEND 0x00E0
94#define IEEE80211_STYPE_CFENDACK 0x00F0
95
96/* data */
97#define IEEE80211_STYPE_DATA 0x0000
98#define IEEE80211_STYPE_DATA_CFACK 0x0010
99#define IEEE80211_STYPE_DATA_CFPOLL 0x0020
100#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
101#define IEEE80211_STYPE_NULLFUNC 0x0040
102#define IEEE80211_STYPE_CFACK 0x0050
103#define IEEE80211_STYPE_CFPOLL 0x0060
104#define IEEE80211_STYPE_CFACKPOLL 0x0070
105#define IEEE80211_STYPE_QOS_DATA 0x0080
106
107#define IEEE80211_SCTL_FRAG 0x000F
108#define IEEE80211_SCTL_SEQ 0xFFF0
109
110/* QOS control */
111#define IEEE80211_QCTL_TID 0x000F
112
113/* debug macros */
114
115#ifdef CONFIG_IEEE80211_DEBUG
116extern u32 ieee80211_debug_level;
117#define IEEE80211_DEBUG(level, fmt, args...) \
118do { if (ieee80211_debug_level & (level)) \
119 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \
120 in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
121static inline bool ieee80211_ratelimit_debug(u32 level)
122{
123 return (ieee80211_debug_level & level) && net_ratelimit();
124}
125#else
126#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
127static inline bool ieee80211_ratelimit_debug(u32 level)
128{
129 return false;
130}
131#endif /* CONFIG_IEEE80211_DEBUG */
132
133/*
134 * To use the debug system:
135 *
136 * If you are defining a new debug classification, simply add it to the #define
137 * list here in the form of:
138 *
139 * #define IEEE80211_DL_xxxx VALUE
140 *
141 * shifting value to the left one bit from the previous entry. xxxx should be
142 * the name of the classification (for example, WEP)
143 *
144 * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your
145 * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want
146 * to send output to that classification.
147 *
148 * To add your debug level to the list of levels seen when you perform
149 *
150 * % cat /proc/net/ieee80211/debug_level
151 *
152 * you simply need to add your entry to the ieee80211_debug_level array.
153 *
154 * If you do not see debug_level in /proc/net/ieee80211 then you do not have
155 * CONFIG_IEEE80211_DEBUG defined in your kernel configuration
156 *
157 */
158
159#define IEEE80211_DL_INFO (1<<0)
160#define IEEE80211_DL_WX (1<<1)
161#define IEEE80211_DL_SCAN (1<<2)
162#define IEEE80211_DL_STATE (1<<3)
163#define IEEE80211_DL_MGMT (1<<4)
164#define IEEE80211_DL_FRAG (1<<5)
165#define IEEE80211_DL_DROP (1<<7)
166
167#define IEEE80211_DL_TX (1<<8)
168#define IEEE80211_DL_RX (1<<9)
169#define IEEE80211_DL_QOS (1<<31)
170
171#define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a)
172#define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a)
173#define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a)
174
175#define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a)
176#define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a)
177#define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a)
178#define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a)
179#define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a)
180#define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a)
181#define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a)
182#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)
183#define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a)
184#include <linux/netdevice.h>
185#include <linux/if_arp.h> /* ARPHRD_ETHER */
186
187#ifndef WIRELESS_SPY
188#define WIRELESS_SPY /* enable iwspy support */
189#endif
190#include <net/iw_handler.h> /* new driver API */
191
192#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
193
194#ifndef ETH_P_80211_RAW
195#define ETH_P_80211_RAW (ETH_P_ECONET + 1)
196#endif
197
198/* IEEE 802.11 defines */
199
200#define P80211_OUI_LEN 3
201
202struct ieee80211_snap_hdr {
203
204 u8 dsap; /* always 0xAA */
205 u8 ssap; /* always 0xAA */
206 u8 ctrl; /* always 0x03 */
207 u8 oui[P80211_OUI_LEN]; /* organizational universal id */
208
209} __attribute__ ((packed));
210
211#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
212
213#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)
214#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
215#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
216
217#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
218#define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
219
220/* Action categories - 802.11h */
221enum ieee80211_actioncategories {
222 WLAN_ACTION_SPECTRUM_MGMT = 0,
223 /* Reserved 1-127 */
224 /* Error 128-255 */
225};
226
227/* Action details - 802.11h */
228enum ieee80211_actiondetails {
229 WLAN_ACTION_CATEGORY_MEASURE_REQUEST = 0,
230 WLAN_ACTION_CATEGORY_MEASURE_REPORT = 1,
231 WLAN_ACTION_CATEGORY_TPC_REQUEST = 2,
232 WLAN_ACTION_CATEGORY_TPC_REPORT = 3,
233 WLAN_ACTION_CATEGORY_CHANNEL_SWITCH = 4,
234 /* 5 - 255 Reserved */
235};
236
237#define IEEE80211_STATMASK_SIGNAL (1<<0)
238#define IEEE80211_STATMASK_RSSI (1<<1)
239#define IEEE80211_STATMASK_NOISE (1<<2)
240#define IEEE80211_STATMASK_RATE (1<<3)
241#define IEEE80211_STATMASK_WEMASK 0x7
242
243#define IEEE80211_CCK_MODULATION (1<<0)
244#define IEEE80211_OFDM_MODULATION (1<<1)
245
246#define IEEE80211_24GHZ_BAND (1<<0)
247#define IEEE80211_52GHZ_BAND (1<<1)
248
249#define IEEE80211_CCK_RATE_1MB 0x02
250#define IEEE80211_CCK_RATE_2MB 0x04
251#define IEEE80211_CCK_RATE_5MB 0x0B
252#define IEEE80211_CCK_RATE_11MB 0x16
253#define IEEE80211_OFDM_RATE_6MB 0x0C
254#define IEEE80211_OFDM_RATE_9MB 0x12
255#define IEEE80211_OFDM_RATE_12MB 0x18
256#define IEEE80211_OFDM_RATE_18MB 0x24
257#define IEEE80211_OFDM_RATE_24MB 0x30
258#define IEEE80211_OFDM_RATE_36MB 0x48
259#define IEEE80211_OFDM_RATE_48MB 0x60
260#define IEEE80211_OFDM_RATE_54MB 0x6C
261#define IEEE80211_BASIC_RATE_MASK 0x80
262
263#define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
264#define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
265#define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
266#define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
267#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
268#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
269#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
270#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
271#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
272#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
273#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
274#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
275
276#define IEEE80211_CCK_RATES_MASK 0x0000000F
277#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
278 IEEE80211_CCK_RATE_2MB_MASK)
279#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
280 IEEE80211_CCK_RATE_5MB_MASK | \
281 IEEE80211_CCK_RATE_11MB_MASK)
282
283#define IEEE80211_OFDM_RATES_MASK 0x00000FF0
284#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
285 IEEE80211_OFDM_RATE_12MB_MASK | \
286 IEEE80211_OFDM_RATE_24MB_MASK)
287#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
288 IEEE80211_OFDM_RATE_9MB_MASK | \
289 IEEE80211_OFDM_RATE_18MB_MASK | \
290 IEEE80211_OFDM_RATE_36MB_MASK | \
291 IEEE80211_OFDM_RATE_48MB_MASK | \
292 IEEE80211_OFDM_RATE_54MB_MASK)
293#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
294 IEEE80211_CCK_DEFAULT_RATES_MASK)
295
296#define IEEE80211_NUM_OFDM_RATES 8
297#define IEEE80211_NUM_CCK_RATES 4
298#define IEEE80211_OFDM_SHIFT_MASK_A 4
299
300/* NOTE: This data is for statistical purposes; not all hardware provides this
301 * information for frames received.
302 * For ieee80211_rx_mgt, you need to set at least the 'len' parameter.
303 */
304struct ieee80211_rx_stats {
305 u32 mac_time;
306 s8 rssi;
307 u8 signal;
308 u8 noise;
309 u16 rate; /* in 100 kbps */
310 u8 received_channel;
311 u8 control;
312 u8 mask;
313 u8 freq;
314 u16 len;
315 u64 tsf;
316 u32 beacon_time;
317};
318
319/* IEEE 802.11 requires that STA supports concurrent reception of at least
320 * three fragmented frames. This define can be increased to support more
321 * concurrent frames, but it should be noted that each entry can consume about
322 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
323#define IEEE80211_FRAG_CACHE_LEN 4
324
325struct ieee80211_frag_entry {
326 unsigned long first_frag_time;
327 unsigned int seq;
328 unsigned int last_frag;
329 struct sk_buff *skb;
330 u8 src_addr[ETH_ALEN];
331 u8 dst_addr[ETH_ALEN];
332};
333
334struct ieee80211_stats {
335 unsigned int tx_unicast_frames;
336 unsigned int tx_multicast_frames;
337 unsigned int tx_fragments;
338 unsigned int tx_unicast_octets;
339 unsigned int tx_multicast_octets;
340 unsigned int tx_deferred_transmissions;
341 unsigned int tx_single_retry_frames;
342 unsigned int tx_multiple_retry_frames;
343 unsigned int tx_retry_limit_exceeded;
344 unsigned int tx_discards;
345 unsigned int rx_unicast_frames;
346 unsigned int rx_multicast_frames;
347 unsigned int rx_fragments;
348 unsigned int rx_unicast_octets;
349 unsigned int rx_multicast_octets;
350 unsigned int rx_fcs_errors;
351 unsigned int rx_discards_no_buffer;
352 unsigned int tx_discards_wrong_sa;
353 unsigned int rx_discards_undecryptable;
354 unsigned int rx_message_in_msg_fragments;
355 unsigned int rx_message_in_bad_msg_fragments;
356};
357
358struct ieee80211_device;
359
360#define SEC_KEY_1 (1<<0)
361#define SEC_KEY_2 (1<<1)
362#define SEC_KEY_3 (1<<2)
363#define SEC_KEY_4 (1<<3)
364#define SEC_ACTIVE_KEY (1<<4)
365#define SEC_AUTH_MODE (1<<5)
366#define SEC_UNICAST_GROUP (1<<6)
367#define SEC_LEVEL (1<<7)
368#define SEC_ENABLED (1<<8)
369#define SEC_ENCRYPT (1<<9)
370
371#define SEC_LEVEL_0 0 /* None */
372#define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
373#define SEC_LEVEL_2 2 /* Level 1 + TKIP */
374#define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
375#define SEC_LEVEL_3 4 /* Level 2 + CCMP */
376
377#define SEC_ALG_NONE 0
378#define SEC_ALG_WEP 1
379#define SEC_ALG_TKIP 2
380#define SEC_ALG_CCMP 3
381
382#define WEP_KEYS 4
383#define WEP_KEY_LEN 13
384#define SCM_KEY_LEN 32
385#define SCM_TEMPORAL_KEY_LENGTH 16
386
387struct ieee80211_security {
388 u16 active_key:2, enabled:1, unicast_uses_group:1, encrypt:1;
389 u8 auth_mode;
390 u8 encode_alg[WEP_KEYS];
391 u8 key_sizes[WEP_KEYS];
392 u8 keys[WEP_KEYS][SCM_KEY_LEN];
393 u8 level;
394 u16 flags;
395} __attribute__ ((packed));
396
397/*
398
399 802.11 data frame from AP
400
401 ,-------------------------------------------------------------------.
402Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
403 |------|------|---------|---------|---------|------|---------|------|
404Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
405 | | tion | (BSSID) | | | ence | data | |
406 `-------------------------------------------------------------------'
407
408Total: 28-2340 bytes
409
410*/
411
412#define BEACON_PROBE_SSID_ID_POSITION 12
413
414/* Management Frame Information Element Types */
415enum ieee80211_mfie {
416 MFIE_TYPE_SSID = 0,
417 MFIE_TYPE_RATES = 1,
418 MFIE_TYPE_FH_SET = 2,
419 MFIE_TYPE_DS_SET = 3,
420 MFIE_TYPE_CF_SET = 4,
421 MFIE_TYPE_TIM = 5,
422 MFIE_TYPE_IBSS_SET = 6,
423 MFIE_TYPE_COUNTRY = 7,
424 MFIE_TYPE_HOP_PARAMS = 8,
425 MFIE_TYPE_HOP_TABLE = 9,
426 MFIE_TYPE_REQUEST = 10,
427 MFIE_TYPE_CHALLENGE = 16,
428 MFIE_TYPE_POWER_CONSTRAINT = 32,
429 MFIE_TYPE_POWER_CAPABILITY = 33,
430 MFIE_TYPE_TPC_REQUEST = 34,
431 MFIE_TYPE_TPC_REPORT = 35,
432 MFIE_TYPE_SUPP_CHANNELS = 36,
433 MFIE_TYPE_CSA = 37,
434 MFIE_TYPE_MEASURE_REQUEST = 38,
435 MFIE_TYPE_MEASURE_REPORT = 39,
436 MFIE_TYPE_QUIET = 40,
437 MFIE_TYPE_IBSS_DFS = 41,
438 MFIE_TYPE_ERP_INFO = 42,
439 MFIE_TYPE_RSN = 48,
440 MFIE_TYPE_RATES_EX = 50,
441 MFIE_TYPE_GENERIC = 221,
442 MFIE_TYPE_QOS_PARAMETER = 222,
443};
444
445struct ieee80211_hdr_1addr {
446 __le16 frame_ctl;
447 __le16 duration_id;
448 u8 addr1[ETH_ALEN];
449 u8 payload[0];
450} __attribute__ ((packed));
451
452struct ieee80211_hdr_2addr {
453 __le16 frame_ctl;
454 __le16 duration_id;
455 u8 addr1[ETH_ALEN];
456 u8 addr2[ETH_ALEN];
457 u8 payload[0];
458} __attribute__ ((packed));
459
460struct ieee80211_hdr_3addr {
461 __le16 frame_ctl;
462 __le16 duration_id;
463 u8 addr1[ETH_ALEN];
464 u8 addr2[ETH_ALEN];
465 u8 addr3[ETH_ALEN];
466 __le16 seq_ctl;
467 u8 payload[0];
468} __attribute__ ((packed));
469
470struct ieee80211_hdr_4addr {
471 __le16 frame_ctl;
472 __le16 duration_id;
473 u8 addr1[ETH_ALEN];
474 u8 addr2[ETH_ALEN];
475 u8 addr3[ETH_ALEN];
476 __le16 seq_ctl;
477 u8 addr4[ETH_ALEN];
478 u8 payload[0];
479} __attribute__ ((packed));
480
481struct ieee80211_hdr_3addrqos {
482 __le16 frame_ctl;
483 __le16 duration_id;
484 u8 addr1[ETH_ALEN];
485 u8 addr2[ETH_ALEN];
486 u8 addr3[ETH_ALEN];
487 __le16 seq_ctl;
488 u8 payload[0];
489 __le16 qos_ctl;
490} __attribute__ ((packed));
491
492struct ieee80211_info_element {
493 u8 id;
494 u8 len;
495 u8 data[0];
496} __attribute__ ((packed));
497
498/*
499 * These are the data types that can make up management packets
500 *
501 u16 auth_algorithm;
502 u16 auth_sequence;
503 u16 beacon_interval;
504 u16 capability;
505 u8 current_ap[ETH_ALEN];
506 u16 listen_interval;
507 struct {
508 u16 association_id:14, reserved:2;
509 } __attribute__ ((packed));
510 u32 time_stamp[2];
511 u16 reason;
512 u16 status;
513*/
514
515struct ieee80211_auth {
516 struct ieee80211_hdr_3addr header;
517 __le16 algorithm;
518 __le16 transaction;
519 __le16 status;
520 /* challenge */
521 struct ieee80211_info_element info_element[0];
522} __attribute__ ((packed));
523
524struct ieee80211_channel_switch {
525 u8 id;
526 u8 len;
527 u8 mode;
528 u8 channel;
529 u8 count;
530} __attribute__ ((packed));
531
532struct ieee80211_action {
533 struct ieee80211_hdr_3addr header;
534 u8 category;
535 u8 action;
536 union {
537 struct ieee80211_action_exchange {
538 u8 token;
539 struct ieee80211_info_element info_element[0];
540 } exchange;
541 struct ieee80211_channel_switch channel_switch;
542
543 } format;
544} __attribute__ ((packed));
545
546struct ieee80211_disassoc {
547 struct ieee80211_hdr_3addr header;
548 __le16 reason;
549} __attribute__ ((packed));
550
551/* Alias deauth for disassoc */
552#define ieee80211_deauth ieee80211_disassoc
553
554struct ieee80211_probe_request {
555 struct ieee80211_hdr_3addr header;
556 /* SSID, supported rates */
557 struct ieee80211_info_element info_element[0];
558} __attribute__ ((packed));
559
560struct ieee80211_probe_response {
561 struct ieee80211_hdr_3addr header;
562 __le32 time_stamp[2];
563 __le16 beacon_interval;
564 __le16 capability;
565 /* SSID, supported rates, FH params, DS params,
566 * CF params, IBSS params, TIM (if beacon), RSN */
567 struct ieee80211_info_element info_element[0];
568} __attribute__ ((packed));
569
570/* Alias beacon for probe_response */
571#define ieee80211_beacon ieee80211_probe_response
572
573struct ieee80211_assoc_request {
574 struct ieee80211_hdr_3addr header;
575 __le16 capability;
576 __le16 listen_interval;
577 /* SSID, supported rates, RSN */
578 struct ieee80211_info_element info_element[0];
579} __attribute__ ((packed));
580
581struct ieee80211_reassoc_request {
582 struct ieee80211_hdr_3addr header;
583 __le16 capability;
584 __le16 listen_interval;
585 u8 current_ap[ETH_ALEN];
586 struct ieee80211_info_element info_element[0];
587} __attribute__ ((packed));
588
589struct ieee80211_assoc_response {
590 struct ieee80211_hdr_3addr header;
591 __le16 capability;
592 __le16 status;
593 __le16 aid;
594 /* supported rates */
595 struct ieee80211_info_element info_element[0];
596} __attribute__ ((packed));
597
598struct ieee80211_txb {
599 u8 nr_frags;
600 u8 encrypted;
601 u8 rts_included;
602 u8 reserved;
603 u16 frag_size;
604 u16 payload_size;
605 struct sk_buff *fragments[0];
606};
607
608/* SWEEP TABLE ENTRIES NUMBER */
609#define MAX_SWEEP_TAB_ENTRIES 42
610#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
611/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
612 * only use 8, and then use extended rates for the remaining supported
613 * rates. Other APs, however, stick all of their supported rates on the
614 * main rates information element... */
615#define MAX_RATES_LENGTH ((u8)12)
616#define MAX_RATES_EX_LENGTH ((u8)16)
617#define MAX_NETWORK_COUNT 128
618
619#define CRC_LENGTH 4U
620
621#define MAX_WPA_IE_LEN 64
622
623#define NETWORK_HAS_OFDM (1<<1)
624#define NETWORK_HAS_CCK (1<<2)
625
626/* QoS structure */
627#define NETWORK_HAS_QOS_PARAMETERS (1<<3)
628#define NETWORK_HAS_QOS_INFORMATION (1<<4)
629#define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
630 NETWORK_HAS_QOS_INFORMATION)
631
632/* 802.11h */
633#define NETWORK_HAS_POWER_CONSTRAINT (1<<5)
634#define NETWORK_HAS_CSA (1<<6)
635#define NETWORK_HAS_QUIET (1<<7)
636#define NETWORK_HAS_IBSS_DFS (1<<8)
637#define NETWORK_HAS_TPC_REPORT (1<<9)
638
639#define NETWORK_HAS_ERP_VALUE (1<<10)
640
641#define QOS_QUEUE_NUM 4
642#define QOS_OUI_LEN 3
643#define QOS_OUI_TYPE 2
644#define QOS_ELEMENT_ID 221
645#define QOS_OUI_INFO_SUB_TYPE 0
646#define QOS_OUI_PARAM_SUB_TYPE 1
647#define QOS_VERSION_1 1
648#define QOS_AIFSN_MIN_VALUE 2
649
650struct ieee80211_qos_information_element {
651 u8 elementID;
652 u8 length;
653 u8 qui[QOS_OUI_LEN];
654 u8 qui_type;
655 u8 qui_subtype;
656 u8 version;
657 u8 ac_info;
658} __attribute__ ((packed));
659
660struct ieee80211_qos_ac_parameter {
661 u8 aci_aifsn;
662 u8 ecw_min_max;
663 __le16 tx_op_limit;
664} __attribute__ ((packed));
665
666struct ieee80211_qos_parameter_info {
667 struct ieee80211_qos_information_element info_element;
668 u8 reserved;
669 struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
670} __attribute__ ((packed));
671
672struct ieee80211_qos_parameters {
673 __le16 cw_min[QOS_QUEUE_NUM];
674 __le16 cw_max[QOS_QUEUE_NUM];
675 u8 aifs[QOS_QUEUE_NUM];
676 u8 flag[QOS_QUEUE_NUM];
677 __le16 tx_op_limit[QOS_QUEUE_NUM];
678} __attribute__ ((packed));
679
680struct ieee80211_qos_data {
681 struct ieee80211_qos_parameters parameters;
682 int active;
683 int supported;
684 u8 param_count;
685 u8 old_param_count;
686};
687
688struct ieee80211_tim_parameters {
689 u8 tim_count;
690 u8 tim_period;
691} __attribute__ ((packed));
692
693/*******************************************************/
694
695enum { /* ieee80211_basic_report.map */
696 IEEE80211_BASIC_MAP_BSS = (1 << 0),
697 IEEE80211_BASIC_MAP_OFDM = (1 << 1),
698 IEEE80211_BASIC_MAP_UNIDENTIFIED = (1 << 2),
699 IEEE80211_BASIC_MAP_RADAR = (1 << 3),
700 IEEE80211_BASIC_MAP_UNMEASURED = (1 << 4),
701 /* Bits 5-7 are reserved */
702
703};
704struct ieee80211_basic_report {
705 u8 channel;
706 __le64 start_time;
707 __le16 duration;
708 u8 map;
709} __attribute__ ((packed));
710
711enum { /* ieee80211_measurement_request.mode */
712 /* Bit 0 is reserved */
713 IEEE80211_MEASUREMENT_ENABLE = (1 << 1),
714 IEEE80211_MEASUREMENT_REQUEST = (1 << 2),
715 IEEE80211_MEASUREMENT_REPORT = (1 << 3),
716 /* Bits 4-7 are reserved */
717};
718
719enum {
720 IEEE80211_REPORT_BASIC = 0, /* required */
721 IEEE80211_REPORT_CCA = 1, /* optional */
722 IEEE80211_REPORT_RPI = 2, /* optional */
723 /* 3-255 reserved */
724};
725
726struct ieee80211_measurement_params {
727 u8 channel;
728 __le64 start_time;
729 __le16 duration;
730} __attribute__ ((packed));
731
732struct ieee80211_measurement_request {
733 struct ieee80211_info_element ie;
734 u8 token;
735 u8 mode;
736 u8 type;
737 struct ieee80211_measurement_params params[0];
738} __attribute__ ((packed));
739
740struct ieee80211_measurement_report {
741 struct ieee80211_info_element ie;
742 u8 token;
743 u8 mode;
744 u8 type;
745 union {
746 struct ieee80211_basic_report basic[0];
747 } u;
748} __attribute__ ((packed));
749
750struct ieee80211_tpc_report {
751 u8 transmit_power;
752 u8 link_margin;
753} __attribute__ ((packed));
754
755struct ieee80211_channel_map {
756 u8 channel;
757 u8 map;
758} __attribute__ ((packed));
759
760struct ieee80211_ibss_dfs {
761 struct ieee80211_info_element ie;
762 u8 owner[ETH_ALEN];
763 u8 recovery_interval;
764 struct ieee80211_channel_map channel_map[0];
765};
766
767struct ieee80211_csa {
768 u8 mode;
769 u8 channel;
770 u8 count;
771} __attribute__ ((packed));
772
773struct ieee80211_quiet {
774 u8 count;
775 u8 period;
776 u8 duration;
777 u8 offset;
778} __attribute__ ((packed));
779
780struct ieee80211_network {
781 /* These entries are used to identify a unique network */
782 u8 bssid[ETH_ALEN];
783 u8 channel;
784 /* Ensure null-terminated for any debug msgs */
785 u8 ssid[IW_ESSID_MAX_SIZE + 1];
786 u8 ssid_len;
787
788 struct ieee80211_qos_data qos_data;
789
790 /* These are network statistics */
791 struct ieee80211_rx_stats stats;
792 u16 capability;
793 u8 rates[MAX_RATES_LENGTH];
794 u8 rates_len;
795 u8 rates_ex[MAX_RATES_EX_LENGTH];
796 u8 rates_ex_len;
797 unsigned long last_scanned;
798 u8 mode;
799 u32 flags;
800 u32 last_associate;
801 u32 time_stamp[2];
802 u16 beacon_interval;
803 u16 listen_interval;
804 u16 atim_window;
805 u8 erp_value;
806 u8 wpa_ie[MAX_WPA_IE_LEN];
807 size_t wpa_ie_len;
808 u8 rsn_ie[MAX_WPA_IE_LEN];
809 size_t rsn_ie_len;
810 struct ieee80211_tim_parameters tim;
811
812 /* 802.11h info */
813
814 /* Power Constraint - mandatory if spctrm mgmt required */
815 u8 power_constraint;
816
817 /* TPC Report - mandatory if spctrm mgmt required */
818 struct ieee80211_tpc_report tpc_report;
819
820 /* IBSS DFS - mandatory if spctrm mgmt required and IBSS
821 * NOTE: This is variable length and so must be allocated dynamically */
822 struct ieee80211_ibss_dfs *ibss_dfs;
823
824 /* Channel Switch Announcement - optional if spctrm mgmt required */
825 struct ieee80211_csa csa;
826
827 /* Quiet - optional if spctrm mgmt required */
828 struct ieee80211_quiet quiet;
829
830 struct list_head list;
831};
832
833enum ieee80211_state {
834 IEEE80211_UNINITIALIZED = 0,
835 IEEE80211_INITIALIZED,
836 IEEE80211_ASSOCIATING,
837 IEEE80211_ASSOCIATED,
838 IEEE80211_AUTHENTICATING,
839 IEEE80211_AUTHENTICATED,
840 IEEE80211_SHUTDOWN
841};
842
843#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
844#define DEFAULT_FTS 2346
845
846#define CFG_IEEE80211_RESERVE_FCS (1<<0)
847#define CFG_IEEE80211_COMPUTE_FCS (1<<1)
848#define CFG_IEEE80211_RTS (1<<2)
849
850#define IEEE80211_24GHZ_MIN_CHANNEL 1
851#define IEEE80211_24GHZ_MAX_CHANNEL 14
852#define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \
853 IEEE80211_24GHZ_MIN_CHANNEL + 1)
854
855#define IEEE80211_52GHZ_MIN_CHANNEL 34
856#define IEEE80211_52GHZ_MAX_CHANNEL 165
857#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
858 IEEE80211_52GHZ_MIN_CHANNEL + 1)
859
860enum {
861 IEEE80211_CH_PASSIVE_ONLY = (1 << 0),
862 IEEE80211_CH_80211H_RULES = (1 << 1),
863 IEEE80211_CH_B_ONLY = (1 << 2),
864 IEEE80211_CH_NO_IBSS = (1 << 3),
865 IEEE80211_CH_UNIFORM_SPREADING = (1 << 4),
866 IEEE80211_CH_RADAR_DETECT = (1 << 5),
867 IEEE80211_CH_INVALID = (1 << 6),
868};
869
870struct ieee80211_channel {
871 u32 freq; /* in MHz */
872 u8 channel;
873 u8 flags;
874 u8 max_power; /* in dBm */
875};
876
877struct ieee80211_geo {
878 u8 name[4];
879 u8 bg_channels;
880 u8 a_channels;
881 struct ieee80211_channel bg[IEEE80211_24GHZ_CHANNELS];
882 struct ieee80211_channel a[IEEE80211_52GHZ_CHANNELS];
883};
884
885struct ieee80211_device {
886 struct net_device *dev;
887 struct ieee80211_security sec;
888
889 /* Bookkeeping structures */
890 struct net_device_stats stats;
891 struct ieee80211_stats ieee_stats;
892
893 struct ieee80211_geo geo;
894
895 /* Probe / Beacon management */
896 struct list_head network_free_list;
897 struct list_head network_list;
898 struct ieee80211_network *networks;
899 int scans;
900 int scan_age;
901
902 int iw_mode; /* operating mode (IW_MODE_*) */
903 struct iw_spy_data spy_data; /* iwspy support */
904
905 spinlock_t lock;
906
907 int tx_headroom; /* Set to size of any additional room needed at front
908 * of allocated Tx SKBs */
909 u32 config;
910
911 /* WEP and other encryption related settings at the device level */
912 int open_wep; /* Set to 1 to allow unencrypted frames */
913
914 int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
915 * WEP key changes */
916
917 /* If the host performs {en,de}cryption, then set to 1 */
918 int host_encrypt;
919 int host_encrypt_msdu;
920 int host_decrypt;
921 /* host performs multicast decryption */
922 int host_mc_decrypt;
923
924 /* host should strip IV and ICV from protected frames */
925 /* meaningful only when hardware decryption is being used */
926 int host_strip_iv_icv;
927
928 int host_open_frag;
929 int host_build_iv;
930 int ieee802_1x; /* is IEEE 802.1X used */
931
932 /* WPA data */
933 int wpa_enabled;
934 int drop_unencrypted;
935 int privacy_invoked;
936 size_t wpa_ie_len;
937 u8 *wpa_ie;
938
939 struct lib80211_crypt_info crypt_info;
940
941 int bcrx_sta_key; /* use individual keys to override default keys even
942 * with RX of broad/multicast frames */
943
944 /* Fragmentation structures */
945 struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN];
946 unsigned int frag_next_idx;
947 u16 fts; /* Fragmentation Threshold */
948 u16 rts; /* RTS threshold */
949
950 /* Association info */
951 u8 bssid[ETH_ALEN];
952
953 enum ieee80211_state state;
954
955 int mode; /* A, B, G */
956 int modulation; /* CCK, OFDM */
957 int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
958 int abg_true; /* ABG flag */
959
960 int perfect_rssi;
961 int worst_rssi;
962
963 u16 prev_seq_ctl; /* used to drop duplicate frames */
964
965 /* Callback functions */
966 void (*set_security) (struct net_device * dev,
967 struct ieee80211_security * sec);
968 int (*hard_start_xmit) (struct ieee80211_txb * txb,
969 struct net_device * dev, int pri);
970 int (*reset_port) (struct net_device * dev);
971 int (*is_queue_full) (struct net_device * dev, int pri);
972
973 int (*handle_management) (struct net_device * dev,
974 struct ieee80211_network * network, u16 type);
975 int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
976
977 /* Typical STA methods */
978 int (*handle_auth) (struct net_device * dev,
979 struct ieee80211_auth * auth);
980 int (*handle_deauth) (struct net_device * dev,
981 struct ieee80211_deauth * auth);
982 int (*handle_action) (struct net_device * dev,
983 struct ieee80211_action * action,
984 struct ieee80211_rx_stats * stats);
985 int (*handle_disassoc) (struct net_device * dev,
986 struct ieee80211_disassoc * assoc);
987 int (*handle_beacon) (struct net_device * dev,
988 struct ieee80211_beacon * beacon,
989 struct ieee80211_network * network);
990 int (*handle_probe_response) (struct net_device * dev,
991 struct ieee80211_probe_response * resp,
992 struct ieee80211_network * network);
993 int (*handle_probe_request) (struct net_device * dev,
994 struct ieee80211_probe_request * req,
995 struct ieee80211_rx_stats * stats);
996 int (*handle_assoc_response) (struct net_device * dev,
997 struct ieee80211_assoc_response * resp,
998 struct ieee80211_network * network);
999
1000 /* Typical AP methods */
1001 int (*handle_assoc_request) (struct net_device * dev);
1002 int (*handle_reassoc_request) (struct net_device * dev,
1003 struct ieee80211_reassoc_request * req);
1004
1005 /* This must be the last item so that it points to the data
1006 * allocated beyond this structure by alloc_ieee80211 */
1007 u8 priv[0];
1008};
1009
1010#define IEEE_A (1<<0)
1011#define IEEE_B (1<<1)
1012#define IEEE_G (1<<2)
1013#define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
1014
1015static inline void *ieee80211_priv(struct net_device *dev)
1016{
1017 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
1018}
1019
1020static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee,
1021 int mode)
1022{
1023 /*
1024 * It is possible for both access points and our device to support
1025 * combinations of modes, so as long as there is one valid combination
1026 * of ap/device supported modes, then return success
1027 *
1028 */
1029 if ((mode & IEEE_A) &&
1030 (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
1031 (ieee->freq_band & IEEE80211_52GHZ_BAND))
1032 return 1;
1033
1034 if ((mode & IEEE_G) &&
1035 (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
1036 (ieee->freq_band & IEEE80211_24GHZ_BAND))
1037 return 1;
1038
1039 if ((mode & IEEE_B) &&
1040 (ieee->modulation & IEEE80211_CCK_MODULATION) &&
1041 (ieee->freq_band & IEEE80211_24GHZ_BAND))
1042 return 1;
1043
1044 return 0;
1045}
1046
1047static inline int ieee80211_get_hdrlen(u16 fc)
1048{
1049 int hdrlen = IEEE80211_3ADDR_LEN;
1050 u16 stype = WLAN_FC_GET_STYPE(fc);
1051
1052 switch (WLAN_FC_GET_TYPE(fc)) {
1053 case IEEE80211_FTYPE_DATA:
1054 if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
1055 hdrlen = IEEE80211_4ADDR_LEN;
1056 if (stype & IEEE80211_STYPE_QOS_DATA)
1057 hdrlen += 2;
1058 break;
1059 case IEEE80211_FTYPE_CTL:
1060 switch (WLAN_FC_GET_STYPE(fc)) {
1061 case IEEE80211_STYPE_CTS:
1062 case IEEE80211_STYPE_ACK:
1063 hdrlen = IEEE80211_1ADDR_LEN;
1064 break;
1065 default:
1066 hdrlen = IEEE80211_2ADDR_LEN;
1067 break;
1068 }
1069 break;
1070 }
1071
1072 return hdrlen;
1073}
1074
1075static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr)
1076{
1077 switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control))) {
1078 case IEEE80211_1ADDR_LEN:
1079 return ((struct ieee80211_hdr_1addr *)hdr)->payload;
1080 case IEEE80211_2ADDR_LEN:
1081 return ((struct ieee80211_hdr_2addr *)hdr)->payload;
1082 case IEEE80211_3ADDR_LEN:
1083 return ((struct ieee80211_hdr_3addr *)hdr)->payload;
1084 case IEEE80211_4ADDR_LEN:
1085 return ((struct ieee80211_hdr_4addr *)hdr)->payload;
1086 }
1087 return NULL;
1088}
1089
1090static inline int ieee80211_is_ofdm_rate(u8 rate)
1091{
1092 switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
1093 case IEEE80211_OFDM_RATE_6MB:
1094 case IEEE80211_OFDM_RATE_9MB:
1095 case IEEE80211_OFDM_RATE_12MB:
1096 case IEEE80211_OFDM_RATE_18MB:
1097 case IEEE80211_OFDM_RATE_24MB:
1098 case IEEE80211_OFDM_RATE_36MB:
1099 case IEEE80211_OFDM_RATE_48MB:
1100 case IEEE80211_OFDM_RATE_54MB:
1101 return 1;
1102 }
1103 return 0;
1104}
1105
1106static inline int ieee80211_is_cck_rate(u8 rate)
1107{
1108 switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
1109 case IEEE80211_CCK_RATE_1MB:
1110 case IEEE80211_CCK_RATE_2MB:
1111 case IEEE80211_CCK_RATE_5MB:
1112 case IEEE80211_CCK_RATE_11MB:
1113 return 1;
1114 }
1115 return 0;
1116}
1117
1118/* ieee80211.c */
1119extern void free_ieee80211(struct net_device *dev);
1120extern struct net_device *alloc_ieee80211(int sizeof_priv);
1121
1122extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
1123
1124/* ieee80211_tx.c */
1125extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev);
1126extern void ieee80211_txb_free(struct ieee80211_txb *);
1127
1128/* ieee80211_rx.c */
1129extern void ieee80211_rx_any(struct ieee80211_device *ieee,
1130 struct sk_buff *skb, struct ieee80211_rx_stats *stats);
1131extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1132 struct ieee80211_rx_stats *rx_stats);
1133/* make sure to set stats->len */
1134extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
1135 struct ieee80211_hdr_4addr *header,
1136 struct ieee80211_rx_stats *stats);
1137extern void ieee80211_network_reset(struct ieee80211_network *network);
1138
1139/* ieee80211_geo.c */
1140extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device
1141 *ieee);
1142extern int ieee80211_set_geo(struct ieee80211_device *ieee,
1143 const struct ieee80211_geo *geo);
1144
1145extern int ieee80211_is_valid_channel(struct ieee80211_device *ieee,
1146 u8 channel);
1147extern int ieee80211_channel_to_index(struct ieee80211_device *ieee,
1148 u8 channel);
1149extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq);
1150extern u8 ieee80211_get_channel_flags(struct ieee80211_device *ieee,
1151 u8 channel);
1152extern const struct ieee80211_channel *ieee80211_get_channel(struct
1153 ieee80211_device
1154 *ieee, u8 channel);
1155extern u32 ieee80211_channel_to_freq(struct ieee80211_device * ieee,
1156 u8 channel);
1157
1158/* ieee80211_wx.c */
1159extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
1160 struct iw_request_info *info,
1161 union iwreq_data *wrqu, char *key);
1162extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
1163 struct iw_request_info *info,
1164 union iwreq_data *wrqu, char *key);
1165extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
1166 struct iw_request_info *info,
1167 union iwreq_data *wrqu, char *key);
1168extern int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee,
1169 struct iw_request_info *info,
1170 union iwreq_data *wrqu, char *extra);
1171extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee,
1172 struct iw_request_info *info,
1173 union iwreq_data *wrqu, char *extra);
1174
1175static inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
1176{
1177 ieee->scans++;
1178}
1179
1180static inline int ieee80211_get_scans(struct ieee80211_device *ieee)
1181{
1182 return ieee->scans;
1183}
1184
1185#endif /* IEEE80211_H */
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 384698cb773a..23c3f3d97779 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -230,8 +230,10 @@ enum ieee80211_radiotap_type {
230 * 802.11 header and payload 230 * 802.11 header and payload
231 * (to 32-bit boundary) 231 * (to 32-bit boundary)
232 */ 232 */
233#define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* bad FCS */
234
233/* For IEEE80211_RADIOTAP_RX_FLAGS */ 235/* For IEEE80211_RADIOTAP_RX_FLAGS */
234#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */ 236#define IEEE80211_RADIOTAP_F_RX_BADPLCP 0x0002 /* frame has bad PLCP */
235 237
236/* For IEEE80211_RADIOTAP_TX_FLAGS */ 238/* For IEEE80211_RADIOTAP_TX_FLAGS */
237#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive 239#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index c8effa4b1feb..38b78132019b 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -39,8 +39,6 @@ struct inet6_ifaddr
39 39
40 __u32 valid_lft; 40 __u32 valid_lft;
41 __u32 prefered_lft; 41 __u32 prefered_lft;
42 unsigned long cstamp; /* created timestamp */
43 unsigned long tstamp; /* updated timestamp */
44 atomic_t refcnt; 42 atomic_t refcnt;
45 spinlock_t lock; 43 spinlock_t lock;
46 44
@@ -49,6 +47,9 @@ struct inet6_ifaddr
49 47
50 __u16 scope; 48 __u16 scope;
51 49
50 unsigned long cstamp; /* created timestamp */
51 unsigned long tstamp; /* updated timestamp */
52
52 struct timer_list timer; 53 struct timer_list timer;
53 54
54 struct inet6_dev *idev; 55 struct inet6_dev *idev;
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index 7040a782c656..9b5d08f4f6e8 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -113,12 +113,12 @@ static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner)
113static inline int INET_ECN_set_ce(struct sk_buff *skb) 113static inline int INET_ECN_set_ce(struct sk_buff *skb)
114{ 114{
115 switch (skb->protocol) { 115 switch (skb->protocol) {
116 case __constant_htons(ETH_P_IP): 116 case cpu_to_be16(ETH_P_IP):
117 if (skb->network_header + sizeof(struct iphdr) <= skb->tail) 117 if (skb->network_header + sizeof(struct iphdr) <= skb->tail)
118 return IP_ECN_set_ce(ip_hdr(skb)); 118 return IP_ECN_set_ce(ip_hdr(skb));
119 break; 119 break;
120 120
121 case __constant_htons(ETH_P_IPV6): 121 case cpu_to_be16(ETH_P_IPV6):
122 if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail) 122 if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail)
123 return IP6_ECN_set_ce(ipv6_hdr(skb)); 123 return IP6_ECN_set_ce(ipv6_hdr(skb));
124 break; 124 break;
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index e081eefd6f47..39f2dc943908 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -61,7 +61,8 @@ void inet_frag_destroy(struct inet_frag_queue *q,
61 struct inet_frags *f, int *work); 61 struct inet_frags *f, int *work);
62int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f); 62int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f);
63struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, 63struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
64 struct inet_frags *f, void *key, unsigned int hash); 64 struct inet_frags *f, void *key, unsigned int hash)
65 __releases(&f->lock);
65 66
66static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) 67static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f)
67{ 68{
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index d0a043153cc6..a44e2248b2ef 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -82,6 +82,7 @@ struct inet_bind_bucket {
82#endif 82#endif
83 unsigned short port; 83 unsigned short port;
84 signed short fastreuse; 84 signed short fastreuse;
85 int num_owners;
85 struct hlist_node node; 86 struct hlist_node node;
86 struct hlist_head owners; 87 struct hlist_head owners;
87}; 88};
@@ -133,7 +134,7 @@ struct inet_hashinfo {
133 struct inet_bind_hashbucket *bhash; 134 struct inet_bind_hashbucket *bhash;
134 135
135 unsigned int bhash_size; 136 unsigned int bhash_size;
136 /* Note : 4 bytes padding on 64 bit arches */ 137 /* 4 bytes hole on 64 bit */
137 138
138 struct kmem_cache *bind_bucket_cachep; 139 struct kmem_cache *bind_bucket_cachep;
139 140
@@ -150,6 +151,7 @@ struct inet_hashinfo {
150 struct inet_listen_hashbucket listening_hash[INET_LHTABLE_SIZE] 151 struct inet_listen_hashbucket listening_hash[INET_LHTABLE_SIZE]
151 ____cacheline_aligned_in_smp; 152 ____cacheline_aligned_in_smp;
152 153
154 atomic_t bsockets;
153}; 155};
154 156
155static inline struct inet_ehash_bucket *inet_ehash_bucket( 157static inline struct inet_ehash_bucket *inet_ehash_bucket(
diff --git a/include/net/ip.h b/include/net/ip.h
index 10868139e656..4ac7577f98d0 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -55,6 +55,7 @@ struct ipcm_cookie
55 __be32 addr; 55 __be32 addr;
56 int oif; 56 int oif;
57 struct ip_options *opt; 57 struct ip_options *opt;
58 union skb_shared_tx shtx;
58}; 59};
59 60
60#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) 61#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb))
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index ab9b003ab671..bbae1e87efcd 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -184,8 +184,8 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
184/* 184/*
185 * The port number of FTP service (in network order). 185 * The port number of FTP service (in network order).
186 */ 186 */
187#define FTPPORT __constant_htons(21) 187#define FTPPORT cpu_to_be16(21)
188#define FTPDATA __constant_htons(20) 188#define FTPDATA cpu_to_be16(20)
189 189
190/* 190/*
191 * TCP State Values 191 * TCP State Values
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 6d5b58a1c743..c1f16fc49ade 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -196,8 +196,8 @@ struct ip6_flowlabel
196 struct net *fl_net; 196 struct net *fl_net;
197}; 197};
198 198
199#define IPV6_FLOWINFO_MASK __constant_htonl(0x0FFFFFFF) 199#define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF)
200#define IPV6_FLOWLABEL_MASK __constant_htonl(0x000FFFFF) 200#define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF)
201 201
202struct ipv6_fl_socklist 202struct ipv6_fl_socklist
203{ 203{
diff --git a/include/net/ipx.h b/include/net/ipx.h
index 4cc0b4eca948..a14121dd1932 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -27,7 +27,7 @@ struct ipx_address {
27 27
28struct ipxhdr { 28struct ipxhdr {
29 __be16 ipx_checksum __attribute__ ((packed)); 29 __be16 ipx_checksum __attribute__ ((packed));
30#define IPX_NO_CHECKSUM __constant_htons(0xFFFF) 30#define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF)
31 __be16 ipx_pktsize __attribute__ ((packed)); 31 __be16 ipx_pktsize __attribute__ ((packed));
32 __u8 ipx_tctrl; 32 __u8 ipx_tctrl;
33 __u8 ipx_type; 33 __u8 ipx_type;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 559422fc0943..3b83a80e3fe0 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -93,12 +93,9 @@ struct ieee80211_ht_bss_info {
93 * enum ieee80211_max_queues - maximum number of queues 93 * enum ieee80211_max_queues - maximum number of queues
94 * 94 *
95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
96 * @IEEE80211_MAX_AMPDU_QUEUES: Maximum number of queues usable
97 * for A-MPDU operation.
98 */ 96 */
99enum ieee80211_max_queues { 97enum ieee80211_max_queues {
100 IEEE80211_MAX_QUEUES = 16, 98 IEEE80211_MAX_QUEUES = 4,
101 IEEE80211_MAX_AMPDU_QUEUES = 16,
102}; 99};
103 100
104/** 101/**
@@ -207,7 +204,7 @@ struct ieee80211_bss_conf {
207 u16 beacon_int; 204 u16 beacon_int;
208 u16 assoc_capability; 205 u16 assoc_capability;
209 u64 timestamp; 206 u64 timestamp;
210 u64 basic_rates; 207 u32 basic_rates;
211 struct ieee80211_bss_ht_conf ht; 208 struct ieee80211_bss_ht_conf ht;
212}; 209};
213 210
@@ -245,6 +242,12 @@ struct ieee80211_bss_conf {
245 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be 242 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
246 * set by rate control algorithms to indicate probe rate, will 243 * set by rate control algorithms to indicate probe rate, will
247 * be cleared for fragmented frames (except on the last fragment) 244 * be cleared for fragmented frames (except on the last fragment)
245 * @IEEE80211_TX_INTFL_RCALGO: mac80211 internal flag, do not test or
246 * set this flag in the driver; indicates that the rate control
247 * algorithm was used and should be notified of TX status
248 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211,
249 * used to indicate that a pending frame requires TX processing before
250 * it can be sent out.
248 */ 251 */
249enum mac80211_tx_control_flags { 252enum mac80211_tx_control_flags {
250 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 253 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -260,8 +263,30 @@ enum mac80211_tx_control_flags {
260 IEEE80211_TX_STAT_AMPDU = BIT(10), 263 IEEE80211_TX_STAT_AMPDU = BIT(10),
261 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), 264 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
262 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), 265 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
266 IEEE80211_TX_INTFL_RCALGO = BIT(13),
267 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
263}; 268};
264 269
270/**
271 * enum mac80211_rate_control_flags - per-rate flags set by the
272 * Rate Control algorithm.
273 *
274 * These flags are set by the Rate control algorithm for each rate during tx,
275 * in the @flags member of struct ieee80211_tx_rate.
276 *
277 * @IEEE80211_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate.
278 * @IEEE80211_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required.
279 * This is set if the current BSS requires ERP protection.
280 * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
281 * @IEEE80211_TX_RC_MCS: HT rate.
282 * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in
283 * Greenfield mode.
284 * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz.
285 * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the
286 * adjacent 20 MHz channels, if the current channel type is
287 * NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
288 * @IEEE80211_TX_RC_SHORT_GI: Short Guard interval should be used for this rate.
289 */
265enum mac80211_rate_control_flags { 290enum mac80211_rate_control_flags {
266 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0), 291 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0),
267 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1), 292 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1),
@@ -500,17 +525,6 @@ enum ieee80211_conf_flags {
500 IEEE80211_CONF_PS = (1<<1), 525 IEEE80211_CONF_PS = (1<<1),
501}; 526};
502 527
503/* XXX: remove all this once drivers stop trying to use it */
504static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
505{
506 return 0;
507}
508#define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
509
510struct ieee80211_ht_conf {
511 bool enabled;
512 enum nl80211_channel_type channel_type;
513};
514 528
515/** 529/**
516 * enum ieee80211_conf_changed - denotes which configuration changed 530 * enum ieee80211_conf_changed - denotes which configuration changed
@@ -520,10 +534,10 @@ struct ieee80211_ht_conf {
520 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 534 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
521 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 535 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
522 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed 536 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed
537 * @IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT: the dynamic PS timeout changed
523 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed 538 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
524 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed 539 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
525 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 540 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
526 * @IEEE80211_CONF_CHANGE_HT: HT configuration changed
527 */ 541 */
528enum ieee80211_conf_changed { 542enum ieee80211_conf_changed {
529 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), 543 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
@@ -531,10 +545,10 @@ enum ieee80211_conf_changed {
531 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 545 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
532 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 546 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
533 IEEE80211_CONF_CHANGE_PS = BIT(4), 547 IEEE80211_CONF_CHANGE_PS = BIT(4),
534 IEEE80211_CONF_CHANGE_POWER = BIT(5), 548 IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT = BIT(5),
535 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), 549 IEEE80211_CONF_CHANGE_POWER = BIT(6),
536 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), 550 IEEE80211_CONF_CHANGE_CHANNEL = BIT(7),
537 IEEE80211_CONF_CHANGE_HT = BIT(8), 551 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(8),
538}; 552};
539 553
540/** 554/**
@@ -547,8 +561,9 @@ enum ieee80211_conf_changed {
547 * @listen_interval: listen interval in units of beacon interval 561 * @listen_interval: listen interval in units of beacon interval
548 * @flags: configuration flags defined above 562 * @flags: configuration flags defined above
549 * @power_level: requested transmit power (in dBm) 563 * @power_level: requested transmit power (in dBm)
564 * @dynamic_ps_timeout: dynamic powersave timeout (in ms)
550 * @channel: the channel to tune to 565 * @channel: the channel to tune to
551 * @ht: the HT configuration for the device 566 * @channel_type: the channel (HT) type
552 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame 567 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
553 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, 568 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
554 * but actually means the number of transmissions not the number of retries 569 * but actually means the number of transmissions not the number of retries
@@ -559,7 +574,7 @@ enum ieee80211_conf_changed {
559struct ieee80211_conf { 574struct ieee80211_conf {
560 int beacon_int; 575 int beacon_int;
561 u32 flags; 576 u32 flags;
562 int power_level; 577 int power_level, dynamic_ps_timeout;
563 578
564 u16 listen_interval; 579 u16 listen_interval;
565 bool radio_enabled; 580 bool radio_enabled;
@@ -567,7 +582,7 @@ struct ieee80211_conf {
567 u8 long_frame_max_tx_count, short_frame_max_tx_count; 582 u8 long_frame_max_tx_count, short_frame_max_tx_count;
568 583
569 struct ieee80211_channel *channel; 584 struct ieee80211_channel *channel;
570 struct ieee80211_ht_conf ht; 585 enum nl80211_channel_type channel_type;
571}; 586};
572 587
573/** 588/**
@@ -630,10 +645,12 @@ struct ieee80211_if_init_conf {
630 * @IEEE80211_IFCC_BSSID: The BSSID changed. 645 * @IEEE80211_IFCC_BSSID: The BSSID changed.
631 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed 646 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed
632 * (currently AP and MESH only), use ieee80211_beacon_get(). 647 * (currently AP and MESH only), use ieee80211_beacon_get().
648 * @IEEE80211_IFCC_BEACON_ENABLED: The enable_beacon value changed.
633 */ 649 */
634enum ieee80211_if_conf_change { 650enum ieee80211_if_conf_change {
635 IEEE80211_IFCC_BSSID = BIT(0), 651 IEEE80211_IFCC_BSSID = BIT(0),
636 IEEE80211_IFCC_BEACON = BIT(1), 652 IEEE80211_IFCC_BEACON = BIT(1),
653 IEEE80211_IFCC_BEACON_ENABLED = BIT(2),
637}; 654};
638 655
639/** 656/**
@@ -641,13 +658,16 @@ enum ieee80211_if_conf_change {
641 * 658 *
642 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change. 659 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change.
643 * @bssid: BSSID of the network we are associated to/creating. 660 * @bssid: BSSID of the network we are associated to/creating.
661 * @enable_beacon: Indicates whether beacons can be sent.
662 * This is valid only for AP/IBSS/MESH modes.
644 * 663 *
645 * This structure is passed to the config_interface() callback of 664 * This structure is passed to the config_interface() callback of
646 * &struct ieee80211_hw. 665 * &struct ieee80211_hw.
647 */ 666 */
648struct ieee80211_if_conf { 667struct ieee80211_if_conf {
649 u32 changed; 668 u32 changed;
650 u8 *bssid; 669 const u8 *bssid;
670 bool enable_beacon;
651}; 671};
652 672
653/** 673/**
@@ -655,11 +675,13 @@ struct ieee80211_if_conf {
655 * @ALG_WEP: WEP40 or WEP104 675 * @ALG_WEP: WEP40 or WEP104
656 * @ALG_TKIP: TKIP 676 * @ALG_TKIP: TKIP
657 * @ALG_CCMP: CCMP (AES) 677 * @ALG_CCMP: CCMP (AES)
678 * @ALG_AES_CMAC: AES-128-CMAC
658 */ 679 */
659enum ieee80211_key_alg { 680enum ieee80211_key_alg {
660 ALG_WEP, 681 ALG_WEP,
661 ALG_TKIP, 682 ALG_TKIP,
662 ALG_CCMP, 683 ALG_CCMP,
684 ALG_AES_CMAC,
663}; 685};
664 686
665/** 687/**
@@ -688,12 +710,16 @@ enum ieee80211_key_len {
688 * generation in software. 710 * generation in software.
689 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates 711 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
690 * that the key is pairwise rather then a shared key. 712 * that the key is pairwise rather then a shared key.
713 * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a
714 * CCMP key if it requires CCMP encryption of management frames (MFP) to
715 * be done in software.
691 */ 716 */
692enum ieee80211_key_flags { 717enum ieee80211_key_flags {
693 IEEE80211_KEY_FLAG_WMM_STA = 1<<0, 718 IEEE80211_KEY_FLAG_WMM_STA = 1<<0,
694 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, 719 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1,
695 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 720 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
696 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, 721 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3,
722 IEEE80211_KEY_FLAG_SW_MGMT = 1<<4,
697}; 723};
698 724
699/** 725/**
@@ -714,8 +740,8 @@ enum ieee80211_key_flags {
714 * - Temporal Encryption Key (128 bits) 740 * - Temporal Encryption Key (128 bits)
715 * - Temporal Authenticator Tx MIC Key (64 bits) 741 * - Temporal Authenticator Tx MIC Key (64 bits)
716 * - Temporal Authenticator Rx MIC Key (64 bits) 742 * - Temporal Authenticator Rx MIC Key (64 bits)
717 * @icv_len: FIXME 743 * @icv_len: The ICV length for this key type
718 * @iv_len: FIXME 744 * @iv_len: The IV length for this key type
719 */ 745 */
720struct ieee80211_key_conf { 746struct ieee80211_key_conf {
721 enum ieee80211_key_alg alg; 747 enum ieee80211_key_alg alg;
@@ -759,7 +785,7 @@ enum set_key_cmd {
759 * sizeof(void *), size is determined in hw information. 785 * sizeof(void *), size is determined in hw information.
760 */ 786 */
761struct ieee80211_sta { 787struct ieee80211_sta {
762 u64 supp_rates[IEEE80211_NUM_BANDS]; 788 u32 supp_rates[IEEE80211_NUM_BANDS];
763 u8 addr[ETH_ALEN]; 789 u8 addr[ETH_ALEN];
764 u16 aid; 790 u16 aid;
765 struct ieee80211_sta_ht_cap ht_cap; 791 struct ieee80211_sta_ht_cap ht_cap;
@@ -833,11 +859,6 @@ enum ieee80211_tkip_key_type {
833 * expect values between 0 and @max_signal. 859 * expect values between 0 and @max_signal.
834 * If possible please provide dB or dBm instead. 860 * If possible please provide dB or dBm instead.
835 * 861 *
836 * @IEEE80211_HW_SIGNAL_DB:
837 * Hardware gives signal values in dB, decibel difference from an
838 * arbitrary, fixed reference. We expect values between 0 and @max_signal.
839 * If possible please provide dBm instead.
840 *
841 * @IEEE80211_HW_SIGNAL_DBM: 862 * @IEEE80211_HW_SIGNAL_DBM:
842 * Hardware gives signal values in dBm, decibel difference from 863 * Hardware gives signal values in dBm, decibel difference from
843 * one milliwatt. This is the preferred method since it is standardized 864 * one milliwatt. This is the preferred method since it is standardized
@@ -854,10 +875,22 @@ enum ieee80211_tkip_key_type {
854 * @IEEE80211_HW_AMPDU_AGGREGATION: 875 * @IEEE80211_HW_AMPDU_AGGREGATION:
855 * Hardware supports 11n A-MPDU aggregation. 876 * Hardware supports 11n A-MPDU aggregation.
856 * 877 *
857 * @IEEE80211_HW_NO_STACK_DYNAMIC_PS: 878 * @IEEE80211_HW_SUPPORTS_PS:
858 * Hardware which has dynamic power save support, meaning 879 * Hardware has power save support (i.e. can go to sleep).
859 * that power save is enabled in idle periods, and don't need support 880 *
860 * from stack. 881 * @IEEE80211_HW_PS_NULLFUNC_STACK:
882 * Hardware requires nullfunc frame handling in stack, implies
883 * stack support for dynamic PS.
884 *
885 * @IEEE80211_HW_SUPPORTS_DYNAMIC_PS:
886 * Hardware has support for dynamic PS.
887 *
888 * @IEEE80211_HW_MFP_CAPABLE:
889 * Hardware supports management frame protection (MFP, IEEE 802.11w).
890 *
891 * @IEEE80211_HW_BEACON_FILTER:
892 * Hardware supports dropping of irrelevant beacon frames to
893 * avoid waking up cpu.
861 */ 894 */
862enum ieee80211_hw_flags { 895enum ieee80211_hw_flags {
863 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, 896 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
@@ -865,12 +898,15 @@ enum ieee80211_hw_flags {
865 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, 898 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3,
866 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, 899 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
867 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, 900 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5,
868 IEEE80211_HW_SIGNAL_DB = 1<<6, 901 IEEE80211_HW_SIGNAL_DBM = 1<<6,
869 IEEE80211_HW_SIGNAL_DBM = 1<<7, 902 IEEE80211_HW_NOISE_DBM = 1<<7,
870 IEEE80211_HW_NOISE_DBM = 1<<8, 903 IEEE80211_HW_SPECTRUM_MGMT = 1<<8,
871 IEEE80211_HW_SPECTRUM_MGMT = 1<<9, 904 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9,
872 IEEE80211_HW_AMPDU_AGGREGATION = 1<<10, 905 IEEE80211_HW_SUPPORTS_PS = 1<<10,
873 IEEE80211_HW_NO_STACK_DYNAMIC_PS = 1<<11, 906 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11,
907 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
908 IEEE80211_HW_MFP_CAPABLE = 1<<13,
909 IEEE80211_HW_BEACON_FILTER = 1<<14,
874}; 910};
875 911
876/** 912/**
@@ -890,9 +926,8 @@ enum ieee80211_hw_flags {
890 * @workqueue: single threaded workqueue available for driver use, 926 * @workqueue: single threaded workqueue available for driver use,
891 * allocated by mac80211 on registration and flushed when an 927 * allocated by mac80211 on registration and flushed when an
892 * interface is removed. 928 * interface is removed.
893 * NOTICE: All work performed on this workqueue should NEVER 929 * NOTICE: All work performed on this workqueue must not
894 * acquire the RTNL lock (i.e. Don't use the function 930 * acquire the RTNL lock.
895 * ieee80211_iterate_active_interfaces())
896 * 931 *
897 * @priv: pointer to private area that was allocated for driver use 932 * @priv: pointer to private area that was allocated for driver use
898 * along with this structure. 933 * along with this structure.
@@ -914,12 +949,6 @@ enum ieee80211_hw_flags {
914 * data packets. WMM/QoS requires at least four, these 949 * data packets. WMM/QoS requires at least four, these
915 * queues need to have configurable access parameters. 950 * queues need to have configurable access parameters.
916 * 951 *
917 * @ampdu_queues: number of available hardware transmit queues
918 * for A-MPDU packets, these have no access parameters
919 * because they're used only for A-MPDU frames. Note that
920 * mac80211 will not currently use any of the regular queues
921 * for aggregation.
922 *
923 * @rate_control_algorithm: rate control algorithm for this hardware. 952 * @rate_control_algorithm: rate control algorithm for this hardware.
924 * If unset (NULL), the default algorithm will be used. Must be 953 * If unset (NULL), the default algorithm will be used. Must be
925 * set before calling ieee80211_register_hw(). 954 * set before calling ieee80211_register_hw().
@@ -944,7 +973,6 @@ struct ieee80211_hw {
944 int vif_data_size; 973 int vif_data_size;
945 int sta_data_size; 974 int sta_data_size;
946 u16 queues; 975 u16 queues;
947 u16 ampdu_queues;
948 u16 max_listen_interval; 976 u16 max_listen_interval;
949 s8 max_signal; 977 s8 max_signal;
950 u8 max_rates; 978 u8 max_rates;
@@ -952,6 +980,19 @@ struct ieee80211_hw {
952}; 980};
953 981
954/** 982/**
983 * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
984 *
985 * @wiphy: the &struct wiphy which we want to query
986 *
987 * mac80211 drivers can use this to get to their respective
988 * &struct ieee80211_hw. Drivers wishing to get to their own private
989 * structure can then access it via hw->priv. Note that mac802111 drivers should
990 * not use wiphy_priv() to try to get their private driver structure as this
991 * is already used internally by mac80211.
992 */
993struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy);
994
995/**
955 * SET_IEEE80211_DEV - set device for 802.11 hardware 996 * SET_IEEE80211_DEV - set device for 802.11 hardware
956 * 997 *
957 * @hw: the &struct ieee80211_hw to set the device for 998 * @hw: the &struct ieee80211_hw to set the device for
@@ -973,16 +1014,6 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
973 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); 1014 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
974} 1015}
975 1016
976static inline int ieee80211_num_regular_queues(struct ieee80211_hw *hw)
977{
978 return hw->queues;
979}
980
981static inline int ieee80211_num_queues(struct ieee80211_hw *hw)
982{
983 return hw->queues + hw->ampdu_queues;
984}
985
986static inline struct ieee80211_rate * 1017static inline struct ieee80211_rate *
987ieee80211_get_tx_rate(const struct ieee80211_hw *hw, 1018ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
988 const struct ieee80211_tx_info *c) 1019 const struct ieee80211_tx_info *c)
@@ -1018,16 +1049,12 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1018 * 1049 *
1019 * The set_key() callback in the &struct ieee80211_ops for a given 1050 * The set_key() callback in the &struct ieee80211_ops for a given
1020 * device is called to enable hardware acceleration of encryption and 1051 * device is called to enable hardware acceleration of encryption and
1021 * decryption. The callback takes an @address parameter that will be 1052 * decryption. The callback takes a @sta parameter that will be NULL
1022 * the broadcast address for default keys, the other station's hardware 1053 * for default keys or keys used for transmission only, or point to
1023 * address for individual keys or the zero address for keys that will 1054 * the station information for the peer for individual keys.
1024 * be used only for transmission.
1025 * Multiple transmission keys with the same key index may be used when 1055 * Multiple transmission keys with the same key index may be used when
1026 * VLANs are configured for an access point. 1056 * VLANs are configured for an access point.
1027 * 1057 *
1028 * The @local_address parameter will always be set to our own address,
1029 * this is only relevant if you support multiple local addresses.
1030 *
1031 * When transmitting, the TX control data will use the @hw_key_idx 1058 * When transmitting, the TX control data will use the @hw_key_idx
1032 * selected by the driver by modifying the &struct ieee80211_key_conf 1059 * selected by the driver by modifying the &struct ieee80211_key_conf
1033 * pointed to by the @key parameter to the set_key() function. 1060 * pointed to by the @key parameter to the set_key() function.
@@ -1061,6 +1088,60 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1061 */ 1088 */
1062 1089
1063/** 1090/**
1091 * DOC: Powersave support
1092 *
1093 * mac80211 has support for various powersave implementations.
1094 *
1095 * First, it can support hardware that handles all powersaving by
1096 * itself, such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS
1097 * hardware flag. In that case, it will be told about the desired
1098 * powersave mode depending on the association status, and the driver
1099 * must take care of sending nullfunc frames when necessary, i.e. when
1100 * entering and leaving powersave mode. The driver is required to look at
1101 * the AID in beacons and signal to the AP that it woke up when it finds
1102 * traffic directed to it. This mode supports dynamic PS by simply
1103 * enabling/disabling PS.
1104 *
1105 * Additionally, such hardware may set the %IEEE80211_HW_SUPPORTS_DYNAMIC_PS
1106 * flag to indicate that it can support dynamic PS mode itself (see below).
1107 *
1108 * Other hardware designs cannot send nullfunc frames by themselves and also
1109 * need software support for parsing the TIM bitmap. This is also supported
1110 * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
1111 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
1112 * required to pass up beacons. Additionally, in this case, mac80211 will
1113 * wake up the hardware when multicast traffic is announced in the beacon.
1114 *
1115 * FIXME: I don't think we can be fast enough in software when we want to
1116 * receive multicast traffic?
1117 *
1118 * Dynamic powersave mode is an extension to normal powersave mode in which
1119 * the hardware stays awake for a user-specified period of time after sending
1120 * a frame so that reply frames need not be buffered and therefore delayed
1121 * to the next wakeup. This can either be supported by hardware, in which case
1122 * the driver needs to look at the @dynamic_ps_timeout hardware configuration
1123 * value, or by the stack if all nullfunc handling is in the stack.
1124 */
1125
1126/**
1127 * DOC: Beacon filter support
1128 *
1129 * Some hardware have beacon filter support to reduce host cpu wakeups
1130 * which will reduce system power consumption. It usuallly works so that
1131 * the firmware creates a checksum of the beacon but omits all constantly
1132 * changing elements (TSF, TIM etc). Whenever the checksum changes the
1133 * beacon is forwarded to the host, otherwise it will be just dropped. That
1134 * way the host will only receive beacons where some relevant information
1135 * (for example ERP protection or WMM settings) have changed.
1136 *
1137 * Beacon filter support is informed with %IEEE80211_HW_BEACON_FILTER flag.
1138 * The driver needs to enable beacon filter support whenever power save is
1139 * enabled, that is %IEEE80211_CONF_PS is set. When power save is enabled,
1140 * the stack will not check for beacon miss at all and the driver needs to
1141 * notify about complete loss of beacons with ieee80211_beacon_loss().
1142 */
1143
1144/**
1064 * DOC: Frame filtering 1145 * DOC: Frame filtering
1065 * 1146 *
1066 * mac80211 requires to see many management frames for proper 1147 * mac80211 requires to see many management frames for proper
@@ -1149,14 +1230,14 @@ enum ieee80211_filter_flags {
1149 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation 1230 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
1150 * @IEEE80211_AMPDU_TX_START: start Tx aggregation 1231 * @IEEE80211_AMPDU_TX_START: start Tx aggregation
1151 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation 1232 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation
1152 * @IEEE80211_AMPDU_TX_RESUME: resume TX aggregation 1233 * @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational
1153 */ 1234 */
1154enum ieee80211_ampdu_mlme_action { 1235enum ieee80211_ampdu_mlme_action {
1155 IEEE80211_AMPDU_RX_START, 1236 IEEE80211_AMPDU_RX_START,
1156 IEEE80211_AMPDU_RX_STOP, 1237 IEEE80211_AMPDU_RX_STOP,
1157 IEEE80211_AMPDU_TX_START, 1238 IEEE80211_AMPDU_TX_START,
1158 IEEE80211_AMPDU_TX_STOP, 1239 IEEE80211_AMPDU_TX_STOP,
1159 IEEE80211_AMPDU_TX_RESUME, 1240 IEEE80211_AMPDU_TX_OPERATIONAL,
1160}; 1241};
1161 1242
1162/** 1243/**
@@ -1172,6 +1253,8 @@ enum ieee80211_ampdu_mlme_action {
1172 * configuration in the TX control data. This handler should, 1253 * configuration in the TX control data. This handler should,
1173 * preferably, never fail and stop queues appropriately, more 1254 * preferably, never fail and stop queues appropriately, more
1174 * importantly, however, it must never fail for A-MPDU-queues. 1255 * importantly, however, it must never fail for A-MPDU-queues.
1256 * This function should return NETDEV_TX_OK except in very
1257 * limited cases.
1175 * Must be implemented and atomic. 1258 * Must be implemented and atomic.
1176 * 1259 *
1177 * @start: Called before the first netdevice attached to the hardware 1260 * @start: Called before the first netdevice attached to the hardware
@@ -1212,9 +1295,12 @@ enum ieee80211_ampdu_mlme_action {
1212 * 1295 *
1213 * @config: Handler for configuration requests. IEEE 802.11 code calls this 1296 * @config: Handler for configuration requests. IEEE 802.11 code calls this
1214 * function to change hardware configuration, e.g., channel. 1297 * function to change hardware configuration, e.g., channel.
1298 * This function should never fail but returns a negative error code
1299 * if it does.
1215 * 1300 *
1216 * @config_interface: Handler for configuration requests related to interfaces 1301 * @config_interface: Handler for configuration requests related to interfaces
1217 * (e.g. BSSID changes.) 1302 * (e.g. BSSID changes.)
1303 * Returns a negative error code which will be seen in userspace.
1218 * 1304 *
1219 * @bss_info_changed: Handler for configuration requests related to BSS 1305 * @bss_info_changed: Handler for configuration requests related to BSS
1220 * parameters that may vary during BSS's lifespan, and may affect low 1306 * parameters that may vary during BSS's lifespan, and may affect low
@@ -1232,8 +1318,9 @@ enum ieee80211_ampdu_mlme_action {
1232 * 1318 *
1233 * @set_key: See the section "Hardware crypto acceleration" 1319 * @set_key: See the section "Hardware crypto acceleration"
1234 * This callback can sleep, and is only called between add_interface 1320 * This callback can sleep, and is only called between add_interface
1235 * and remove_interface calls, i.e. while the interface with the 1321 * and remove_interface calls, i.e. while the given virtual interface
1236 * given local_address is enabled. 1322 * is enabled.
1323 * Returns a negative error code if the key can't be added.
1237 * 1324 *
1238 * @update_tkip_key: See the section "Hardware crypto acceleration" 1325 * @update_tkip_key: See the section "Hardware crypto acceleration"
1239 * This callback will be called in the context of Rx. Called for drivers 1326 * This callback will be called in the context of Rx. Called for drivers
@@ -1241,12 +1328,22 @@ enum ieee80211_ampdu_mlme_action {
1241 * 1328 *
1242 * @hw_scan: Ask the hardware to service the scan request, no need to start 1329 * @hw_scan: Ask the hardware to service the scan request, no need to start
1243 * the scan state machine in stack. The scan must honour the channel 1330 * the scan state machine in stack. The scan must honour the channel
1244 * configuration done by the regulatory agent in the wiphy's registered 1331 * configuration done by the regulatory agent in the wiphy's
1245 * bands. When the scan finishes, ieee80211_scan_completed() must be 1332 * registered bands. The hardware (or the driver) needs to make sure
1246 * called; note that it also must be called when the scan cannot finish 1333 * that power save is disabled. When the scan finishes,
1247 * because the hardware is turned off! Anything else is a bug! 1334 * ieee80211_scan_completed() must be called; note that it also must
1335 * be called when the scan cannot finish because the hardware is
1336 * turned off! Anything else is a bug! Returns a negative error code
1337 * which will be seen in userspace.
1338 *
1339 * @sw_scan_start: Notifier function that is called just before a software scan
1340 * is started. Can be NULL, if the driver doesn't need this notification.
1341 *
1342 * @sw_scan_complete: Notifier function that is called just after a software scan
1343 * finished. Can be NULL, if the driver doesn't need this notification.
1248 * 1344 *
1249 * @get_stats: return low-level statistics 1345 * @get_stats: Return low-level statistics.
1346 * Returns zero if statistics are available.
1250 * 1347 *
1251 * @get_tkip_seq: If your device implements TKIP encryption in hardware this 1348 * @get_tkip_seq: If your device implements TKIP encryption in hardware this
1252 * callback should be provided to read the TKIP transmit IVs (both IV32 1349 * callback should be provided to read the TKIP transmit IVs (both IV32
@@ -1260,16 +1357,21 @@ enum ieee80211_ampdu_mlme_action {
1260 * 1357 *
1261 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1358 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1262 * bursting) for a hardware TX queue. 1359 * bursting) for a hardware TX queue.
1360 * Returns a negative error code on failure.
1263 * 1361 *
1264 * @get_tx_stats: Get statistics of the current TX queue status. This is used 1362 * @get_tx_stats: Get statistics of the current TX queue status. This is used
1265 * to get number of currently queued packets (queue length), maximum queue 1363 * to get number of currently queued packets (queue length), maximum queue
1266 * size (limit), and total number of packets sent using each TX queue 1364 * size (limit), and total number of packets sent using each TX queue
1267 * (count). The 'stats' pointer points to an array that has hw->queues + 1365 * (count). The 'stats' pointer points to an array that has hw->queues
1268 * hw->ampdu_queues items. 1366 * items.
1269 * 1367 *
1270 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, 1368 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
1271 * this is only used for IBSS mode debugging and, as such, is not a 1369 * this is only used for IBSS mode BSSID merging and debugging. Is not a
1272 * required function. Must be atomic. 1370 * required function.
1371 *
1372 * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
1373 * Currently, this is only used for IBSS mode debugging. Is not a
1374 * required function.
1273 * 1375 *
1274 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize 1376 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
1275 * with other STAs in the IBSS. This is only used in IBSS mode. This 1377 * with other STAs in the IBSS. This is only used in IBSS mode. This
@@ -1279,13 +1381,15 @@ enum ieee80211_ampdu_mlme_action {
1279 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. 1381 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
1280 * This is needed only for IBSS mode and the result of this function is 1382 * This is needed only for IBSS mode and the result of this function is
1281 * used to determine whether to reply to Probe Requests. 1383 * used to determine whether to reply to Probe Requests.
1384 * Returns non-zero if this device sent the last beacon.
1282 * 1385 *
1283 * @ampdu_action: Perform a certain A-MPDU action 1386 * @ampdu_action: Perform a certain A-MPDU action
1284 * The RA/TID combination determines the destination and TID we want 1387 * The RA/TID combination determines the destination and TID we want
1285 * the ampdu action to be performed for. The action is defined through 1388 * the ampdu action to be performed for. The action is defined through
1286 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) 1389 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn)
1287 * is the first frame we expect to perform the action on. notice 1390 * is the first frame we expect to perform the action on. Notice
1288 * that TX/RX_STOP can pass NULL for this parameter. 1391 * that TX/RX_STOP can pass NULL for this parameter.
1392 * Returns a negative error code on failure.
1289 */ 1393 */
1290struct ieee80211_ops { 1394struct ieee80211_ops {
1291 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1395 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1310,12 +1414,15 @@ struct ieee80211_ops {
1310 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1414 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1311 bool set); 1415 bool set);
1312 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1416 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1313 const u8 *local_address, const u8 *address, 1417 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
1314 struct ieee80211_key_conf *key); 1418 struct ieee80211_key_conf *key);
1315 void (*update_tkip_key)(struct ieee80211_hw *hw, 1419 void (*update_tkip_key)(struct ieee80211_hw *hw,
1316 struct ieee80211_key_conf *conf, const u8 *address, 1420 struct ieee80211_key_conf *conf, const u8 *address,
1317 u32 iv32, u16 *phase1key); 1421 u32 iv32, u16 *phase1key);
1318 int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); 1422 int (*hw_scan)(struct ieee80211_hw *hw,
1423 struct cfg80211_scan_request *req);
1424 void (*sw_scan_start)(struct ieee80211_hw *hw);
1425 void (*sw_scan_complete)(struct ieee80211_hw *hw);
1319 int (*get_stats)(struct ieee80211_hw *hw, 1426 int (*get_stats)(struct ieee80211_hw *hw,
1320 struct ieee80211_low_level_stats *stats); 1427 struct ieee80211_low_level_stats *stats);
1321 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 1428 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
@@ -1328,6 +1435,7 @@ struct ieee80211_ops {
1328 int (*get_tx_stats)(struct ieee80211_hw *hw, 1435 int (*get_tx_stats)(struct ieee80211_hw *hw,
1329 struct ieee80211_tx_queue_stats *stats); 1436 struct ieee80211_tx_queue_stats *stats);
1330 u64 (*get_tsf)(struct ieee80211_hw *hw); 1437 u64 (*get_tsf)(struct ieee80211_hw *hw);
1438 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf);
1331 void (*reset_tsf)(struct ieee80211_hw *hw); 1439 void (*reset_tsf)(struct ieee80211_hw *hw);
1332 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1440 int (*tx_last_beacon)(struct ieee80211_hw *hw);
1333 int (*ampdu_action)(struct ieee80211_hw *hw, 1441 int (*ampdu_action)(struct ieee80211_hw *hw,
@@ -1752,8 +1860,9 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
1752 * mac80211 that the scan finished. 1860 * mac80211 that the scan finished.
1753 * 1861 *
1754 * @hw: the hardware that finished the scan 1862 * @hw: the hardware that finished the scan
1863 * @aborted: set to true if scan was aborted
1755 */ 1864 */
1756void ieee80211_scan_completed(struct ieee80211_hw *hw); 1865void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted);
1757 1866
1758/** 1867/**
1759 * ieee80211_iterate_active_interfaces - iterate active interfaces 1868 * ieee80211_iterate_active_interfaces - iterate active interfaces
@@ -1882,10 +1991,30 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
1882struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, 1991struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
1883 const u8 *addr); 1992 const u8 *addr);
1884 1993
1994/**
1995 * ieee80211_beacon_loss - inform hardware does not receive beacons
1996 *
1997 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1998 *
1999 * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and
2000 * IEEE80211_CONF_PS is set, the driver needs to inform whenever the
2001 * hardware is not receiving beacons with this function.
2002 */
2003void ieee80211_beacon_loss(struct ieee80211_vif *vif);
1885 2004
1886/* Rate control API */ 2005/* Rate control API */
1887 2006
1888/** 2007/**
2008 * enum rate_control_changed - flags to indicate which parameter changed
2009 *
2010 * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have
2011 * changed, rate control algorithm can update its internal state if needed.
2012 */
2013enum rate_control_changed {
2014 IEEE80211_RC_HT_CHANGED = BIT(0)
2015};
2016
2017/**
1889 * struct ieee80211_tx_rate_control - rate control information for/from RC algo 2018 * struct ieee80211_tx_rate_control - rate control information for/from RC algo
1890 * 2019 *
1891 * @hw: The hardware the algorithm is invoked for. 2020 * @hw: The hardware the algorithm is invoked for.
@@ -1921,6 +2050,9 @@ struct rate_control_ops {
1921 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); 2050 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
1922 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, 2051 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
1923 struct ieee80211_sta *sta, void *priv_sta); 2052 struct ieee80211_sta *sta, void *priv_sta);
2053 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
2054 struct ieee80211_sta *sta,
2055 void *priv_sta, u32 changed);
1924 void (*free_sta)(void *priv, struct ieee80211_sta *sta, 2056 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
1925 void *priv_sta); 2057 void *priv_sta);
1926 2058
@@ -1962,4 +2094,34 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
1962int ieee80211_rate_control_register(struct rate_control_ops *ops); 2094int ieee80211_rate_control_register(struct rate_control_ops *ops);
1963void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 2095void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
1964 2096
2097static inline bool
2098conf_is_ht20(struct ieee80211_conf *conf)
2099{
2100 return conf->channel_type == NL80211_CHAN_HT20;
2101}
2102
2103static inline bool
2104conf_is_ht40_minus(struct ieee80211_conf *conf)
2105{
2106 return conf->channel_type == NL80211_CHAN_HT40MINUS;
2107}
2108
2109static inline bool
2110conf_is_ht40_plus(struct ieee80211_conf *conf)
2111{
2112 return conf->channel_type == NL80211_CHAN_HT40PLUS;
2113}
2114
2115static inline bool
2116conf_is_ht40(struct ieee80211_conf *conf)
2117{
2118 return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf);
2119}
2120
2121static inline bool
2122conf_is_ht(struct ieee80211_conf *conf)
2123{
2124 return conf->channel_type != NL80211_CHAN_NO_HT;
2125}
2126
1965#endif /* MAC80211_H */ 2127#endif /* MAC80211_H */
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 6fc13d905c5f..ded434b032a4 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -109,11 +109,6 @@ extern struct list_head net_namespace_list;
109#ifdef CONFIG_NET_NS 109#ifdef CONFIG_NET_NS
110extern void __put_net(struct net *net); 110extern void __put_net(struct net *net);
111 111
112static inline int net_alive(struct net *net)
113{
114 return net && atomic_read(&net->count);
115}
116
117static inline struct net *get_net(struct net *net) 112static inline struct net *get_net(struct net *net)
118{ 113{
119 atomic_inc(&net->count); 114 atomic_inc(&net->count);
@@ -145,11 +140,6 @@ int net_eq(const struct net *net1, const struct net *net2)
145} 140}
146#else 141#else
147 142
148static inline int net_alive(struct net *net)
149{
150 return 1;
151}
152
153static inline struct net *get_net(struct net *net) 143static inline struct net *get_net(struct net *net)
154{ 144{
155 return net; 145 return net;
@@ -234,6 +224,23 @@ struct pernet_operations {
234 void (*exit)(struct net *net); 224 void (*exit)(struct net *net);
235}; 225};
236 226
227/*
228 * Use these carefully. If you implement a network device and it
229 * needs per network namespace operations use device pernet operations,
230 * otherwise use pernet subsys operations.
231 *
232 * This is critically important. Most of the network code cleanup
233 * runs with the assumption that dev_remove_pack has been called so no
234 * new packets will arrive during and after the cleanup functions have
235 * been called. dev_remove_pack is not per namespace so instead the
236 * guarantee of no more packets arriving in a network namespace is
237 * provided by ensuring that all network devices and all sockets have
238 * left the network namespace before the cleanup methods are called.
239 *
240 * For the longest time the ipv4 icmp code was registered as a pernet
241 * device which caused kernel oops, and panics during network
242 * namespace cleanup. So please don't get this wrong.
243 */
237extern int register_pernet_subsys(struct pernet_operations *); 244extern int register_pernet_subsys(struct pernet_operations *);
238extern void unregister_pernet_subsys(struct pernet_operations *); 245extern void unregister_pernet_subsys(struct pernet_operations *);
239extern int register_pernet_gen_subsys(int *id, struct pernet_operations *); 246extern int register_pernet_gen_subsys(int *id, struct pernet_operations *);
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 2e0c53641cbe..6c3f964de9e1 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -91,8 +91,7 @@ struct nf_conn_help {
91#include <net/netfilter/ipv4/nf_conntrack_ipv4.h> 91#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
92#include <net/netfilter/ipv6/nf_conntrack_ipv6.h> 92#include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
93 93
94struct nf_conn 94struct nf_conn {
95{
96 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb, 95 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
97 plus 1 for any connection(s) we are `master' for */ 96 plus 1 for any connection(s) we are `master' for */
98 struct nf_conntrack ct_general; 97 struct nf_conntrack ct_general;
@@ -126,7 +125,6 @@ struct nf_conn
126#ifdef CONFIG_NET_NS 125#ifdef CONFIG_NET_NS
127 struct net *ct_net; 126 struct net *ct_net;
128#endif 127#endif
129 struct rcu_head rcu;
130}; 128};
131 129
132static inline struct nf_conn * 130static inline struct nf_conn *
@@ -190,9 +188,13 @@ static inline void nf_ct_put(struct nf_conn *ct)
190extern int nf_ct_l3proto_try_module_get(unsigned short l3proto); 188extern int nf_ct_l3proto_try_module_get(unsigned short l3proto);
191extern void nf_ct_l3proto_module_put(unsigned short l3proto); 189extern void nf_ct_l3proto_module_put(unsigned short l3proto);
192 190
193extern struct hlist_head *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced); 191/*
194extern void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced, 192 * Allocate a hashtable of hlist_head (if nulls == 0),
195 unsigned int size); 193 * or hlist_nulls_head (if nulls == 1)
194 */
195extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls);
196
197extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size);
196 198
197extern struct nf_conntrack_tuple_hash * 199extern struct nf_conntrack_tuple_hash *
198__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); 200__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple);
@@ -287,7 +289,7 @@ static inline int nf_ct_is_untracked(const struct sk_buff *skb)
287 289
288extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); 290extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
289extern unsigned int nf_conntrack_htable_size; 291extern unsigned int nf_conntrack_htable_size;
290extern int nf_conntrack_max; 292extern unsigned int nf_conntrack_max;
291 293
292#define NF_CT_STAT_INC(net, count) \ 294#define NF_CT_STAT_INC(net, count) \
293 (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++) 295 (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++)
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index c25068e38516..5a449b44ba33 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -62,7 +62,8 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
62 if (ct && ct != &nf_conntrack_untracked) { 62 if (ct && ct != &nf_conntrack_untracked) {
63 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) 63 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
64 ret = __nf_conntrack_confirm(skb); 64 ret = __nf_conntrack_confirm(skb);
65 nf_ct_deliver_cached_events(ct); 65 if (likely(ret == NF_ACCEPT))
66 nf_ct_deliver_cached_events(ct);
66 } 67 }
67 return ret; 68 return ret;
68} 69}
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index ab17a159ac66..a9652806d0df 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -99,9 +99,12 @@ void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
99 const union nf_inet_addr *, 99 const union nf_inet_addr *,
100 u_int8_t, const __be16 *, const __be16 *); 100 u_int8_t, const __be16 *, const __be16 *);
101void nf_ct_expect_put(struct nf_conntrack_expect *exp); 101void nf_ct_expect_put(struct nf_conntrack_expect *exp);
102int nf_ct_expect_related(struct nf_conntrack_expect *expect);
103int nf_ct_expect_related_report(struct nf_conntrack_expect *expect, 102int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
104 u32 pid, int report); 103 u32 pid, int report);
104static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect)
105{
106 return nf_ct_expect_related_report(expect, 0, 0);
107}
105 108
106#endif /*_NF_CONNTRACK_EXPECT_H*/ 109#endif /*_NF_CONNTRACK_EXPECT_H*/
107 110
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 66d65a7caa39..ee2a4b369a04 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -14,6 +14,8 @@
14 14
15struct module; 15struct module;
16 16
17#define NF_CT_HELPER_NAME_LEN 16
18
17struct nf_conntrack_helper 19struct nf_conntrack_helper
18{ 20{
19 struct hlist_node hnode; /* Internal use. */ 21 struct hlist_node hnode; /* Internal use. */
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 0378676c3dd8..9f99d36d5de9 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -53,10 +53,17 @@ struct nf_conntrack_l3proto
53 int (*tuple_to_nlattr)(struct sk_buff *skb, 53 int (*tuple_to_nlattr)(struct sk_buff *skb,
54 const struct nf_conntrack_tuple *t); 54 const struct nf_conntrack_tuple *t);
55 55
56 /*
57 * Calculate size of tuple nlattr
58 */
59 int (*nlattr_tuple_size)(void);
60
56 int (*nlattr_to_tuple)(struct nlattr *tb[], 61 int (*nlattr_to_tuple)(struct nlattr *tb[],
57 struct nf_conntrack_tuple *t); 62 struct nf_conntrack_tuple *t);
58 const struct nla_policy *nla_policy; 63 const struct nla_policy *nla_policy;
59 64
65 size_t nla_size;
66
60#ifdef CONFIG_SYSCTL 67#ifdef CONFIG_SYSCTL
61 struct ctl_table_header *ctl_table_header; 68 struct ctl_table_header *ctl_table_header;
62 struct ctl_path *ctl_table_path; 69 struct ctl_path *ctl_table_path;
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index debdaf75cecf..ba32ed7bdabe 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -64,16 +64,22 @@ struct nf_conntrack_l4proto
64 /* convert protoinfo to nfnetink attributes */ 64 /* convert protoinfo to nfnetink attributes */
65 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, 65 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla,
66 const struct nf_conn *ct); 66 const struct nf_conn *ct);
67 /* Calculate protoinfo nlattr size */
68 int (*nlattr_size)(void);
67 69
68 /* convert nfnetlink attributes to protoinfo */ 70 /* convert nfnetlink attributes to protoinfo */
69 int (*from_nlattr)(struct nlattr *tb[], struct nf_conn *ct); 71 int (*from_nlattr)(struct nlattr *tb[], struct nf_conn *ct);
70 72
71 int (*tuple_to_nlattr)(struct sk_buff *skb, 73 int (*tuple_to_nlattr)(struct sk_buff *skb,
72 const struct nf_conntrack_tuple *t); 74 const struct nf_conntrack_tuple *t);
75 /* Calculate tuple nlattr size */
76 int (*nlattr_tuple_size)(void);
73 int (*nlattr_to_tuple)(struct nlattr *tb[], 77 int (*nlattr_to_tuple)(struct nlattr *tb[],
74 struct nf_conntrack_tuple *t); 78 struct nf_conntrack_tuple *t);
75 const struct nla_policy *nla_policy; 79 const struct nla_policy *nla_policy;
76 80
81 size_t nla_size;
82
77#ifdef CONFIG_SYSCTL 83#ifdef CONFIG_SYSCTL
78 struct ctl_table_header **ctl_table_header; 84 struct ctl_table_header **ctl_table_header;
79 struct ctl_table *ctl_table; 85 struct ctl_table *ctl_table;
@@ -90,10 +96,7 @@ struct nf_conntrack_l4proto
90 struct module *me; 96 struct module *me;
91}; 97};
92 98
93/* Existing built-in protocols */ 99/* Existing built-in generic protocol */
94extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;
95extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
96extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
97extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic; 100extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
98 101
99#define MAX_NF_CT_PROTO 256 102#define MAX_NF_CT_PROTO 256
@@ -101,11 +104,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
101extern struct nf_conntrack_l4proto * 104extern struct nf_conntrack_l4proto *
102__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); 105__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto);
103 106
104extern struct nf_conntrack_l4proto *
105nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t protocol);
106
107extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
108
109/* Protocol registration. */ 107/* Protocol registration. */
110extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto); 108extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto);
111extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto); 109extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto);
@@ -115,6 +113,7 @@ extern int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
115 const struct nf_conntrack_tuple *tuple); 113 const struct nf_conntrack_tuple *tuple);
116extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[], 114extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
117 struct nf_conntrack_tuple *t); 115 struct nf_conntrack_tuple *t);
116extern int nf_ct_port_nlattr_tuple_size(void);
118extern const struct nla_policy nf_ct_port_nla_policy[]; 117extern const struct nla_policy nf_ct_port_nla_policy[];
119 118
120#ifdef CONFIG_SYSCTL 119#ifdef CONFIG_SYSCTL
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index f2f6aa73dc10..2628c154d40e 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -12,6 +12,7 @@
12 12
13#include <linux/netfilter/x_tables.h> 13#include <linux/netfilter/x_tables.h>
14#include <linux/netfilter/nf_conntrack_tuple_common.h> 14#include <linux/netfilter/nf_conntrack_tuple_common.h>
15#include <linux/list_nulls.h>
15 16
16/* A `tuple' is a structure containing the information to uniquely 17/* A `tuple' is a structure containing the information to uniquely
17 identify a connection. ie. if two packets have the same tuple, they 18 identify a connection. ie. if two packets have the same tuple, they
@@ -146,9 +147,8 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t)
146 ((enum ip_conntrack_dir)(h)->tuple.dst.dir) 147 ((enum ip_conntrack_dir)(h)->tuple.dst.dir)
147 148
148/* Connections have two entries in the hash table: one for each way */ 149/* Connections have two entries in the hash table: one for each way */
149struct nf_conntrack_tuple_hash 150struct nf_conntrack_tuple_hash {
150{ 151 struct hlist_nulls_node hnnode;
151 struct hlist_node hnode;
152 struct nf_conntrack_tuple tuple; 152 struct nf_conntrack_tuple tuple;
153}; 153};
154 154
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
index 7182c06974f4..920997f1aff0 100644
--- a/include/net/netfilter/nf_log.h
+++ b/include/net/netfilter/nf_log.h
@@ -1,6 +1,8 @@
1#ifndef _NF_LOG_H 1#ifndef _NF_LOG_H
2#define _NF_LOG_H 2#define _NF_LOG_H
3 3
4#include <linux/netfilter.h>
5
4/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will 6/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will
5 * disappear once iptables is replaced with pkttables. Please DO NOT use them 7 * disappear once iptables is replaced with pkttables. Please DO NOT use them
6 * for any new code! */ 8 * for any new code! */
@@ -40,12 +42,15 @@ struct nf_logger {
40 struct module *me; 42 struct module *me;
41 nf_logfn *logfn; 43 nf_logfn *logfn;
42 char *name; 44 char *name;
45 struct list_head list[NFPROTO_NUMPROTO];
43}; 46};
44 47
45/* Function to register/unregister log function. */ 48/* Function to register/unregister log function. */
46int nf_log_register(u_int8_t pf, const struct nf_logger *logger); 49int nf_log_register(u_int8_t pf, struct nf_logger *logger);
47void nf_log_unregister(const struct nf_logger *logger); 50void nf_log_unregister(struct nf_logger *logger);
48void nf_log_unregister_pf(u_int8_t pf); 51
52int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger);
53void nf_log_unbind_pf(u_int8_t pf);
49 54
50/* Calls the registered backend logging function */ 55/* Calls the registered backend logging function */
51void nf_log_packet(u_int8_t pf, 56void nf_log_packet(u_int8_t pf,
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 9dc1039ff78b..8df0b7f7fc6e 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -18,6 +18,7 @@ enum nf_nat_manip_type
18#define IP_NAT_RANGE_MAP_IPS 1 18#define IP_NAT_RANGE_MAP_IPS 1
19#define IP_NAT_RANGE_PROTO_SPECIFIED 2 19#define IP_NAT_RANGE_PROTO_SPECIFIED 2
20#define IP_NAT_RANGE_PROTO_RANDOM 4 20#define IP_NAT_RANGE_PROTO_RANDOM 4
21#define IP_NAT_RANGE_PERSISTENT 8
21 22
22/* NAT sequence number modifications */ 23/* NAT sequence number modifications */
23struct nf_nat_seq { 24struct nf_nat_seq {
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 749011eedc0b..60ebbc1fef46 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -36,6 +36,7 @@
36#include <linux/in.h> 36#include <linux/in.h>
37#include <linux/in6.h> 37#include <linux/in6.h>
38#include <net/netlink.h> 38#include <net/netlink.h>
39#include <net/request_sock.h>
39#include <asm/atomic.h> 40#include <asm/atomic.h>
40 41
41struct cipso_v4_doi; 42struct cipso_v4_doi;
@@ -406,6 +407,7 @@ int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap,
406 */ 407 */
407int netlbl_enabled(void); 408int netlbl_enabled(void);
408int netlbl_sock_setattr(struct sock *sk, 409int netlbl_sock_setattr(struct sock *sk,
410 u16 family,
409 const struct netlbl_lsm_secattr *secattr); 411 const struct netlbl_lsm_secattr *secattr);
410void netlbl_sock_delattr(struct sock *sk); 412void netlbl_sock_delattr(struct sock *sk);
411int netlbl_sock_getattr(struct sock *sk, 413int netlbl_sock_getattr(struct sock *sk,
@@ -413,6 +415,9 @@ int netlbl_sock_getattr(struct sock *sk,
413int netlbl_conn_setattr(struct sock *sk, 415int netlbl_conn_setattr(struct sock *sk,
414 struct sockaddr *addr, 416 struct sockaddr *addr,
415 const struct netlbl_lsm_secattr *secattr); 417 const struct netlbl_lsm_secattr *secattr);
418int netlbl_req_setattr(struct request_sock *req,
419 const struct netlbl_lsm_secattr *secattr);
420void netlbl_req_delattr(struct request_sock *req);
416int netlbl_skbuff_setattr(struct sk_buff *skb, 421int netlbl_skbuff_setattr(struct sk_buff *skb,
417 u16 family, 422 u16 family,
418 const struct netlbl_lsm_secattr *secattr); 423 const struct netlbl_lsm_secattr *secattr);
@@ -519,7 +524,8 @@ static inline int netlbl_enabled(void)
519 return 0; 524 return 0;
520} 525}
521static inline int netlbl_sock_setattr(struct sock *sk, 526static inline int netlbl_sock_setattr(struct sock *sk,
522 const struct netlbl_lsm_secattr *secattr) 527 u16 family,
528 const struct netlbl_lsm_secattr *secattr)
523{ 529{
524 return -ENOSYS; 530 return -ENOSYS;
525} 531}
@@ -537,6 +543,15 @@ static inline int netlbl_conn_setattr(struct sock *sk,
537{ 543{
538 return -ENOSYS; 544 return -ENOSYS;
539} 545}
546static inline int netlbl_req_setattr(struct request_sock *req,
547 const struct netlbl_lsm_secattr *secattr)
548{
549 return -ENOSYS;
550}
551static inline void netlbl_req_delattr(struct request_sock *req)
552{
553 return;
554}
540static inline int netlbl_skbuff_setattr(struct sk_buff *skb, 555static inline int netlbl_skbuff_setattr(struct sk_buff *skb,
541 u16 family, 556 u16 family,
542 const struct netlbl_lsm_secattr *secattr) 557 const struct netlbl_lsm_secattr *secattr)
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 8a6150a3f4c7..eddb50289d6d 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -230,6 +230,7 @@ extern int nla_validate(struct nlattr *head, int len, int maxtype,
230extern int nla_parse(struct nlattr *tb[], int maxtype, 230extern int nla_parse(struct nlattr *tb[], int maxtype,
231 struct nlattr *head, int len, 231 struct nlattr *head, int len,
232 const struct nla_policy *policy); 232 const struct nla_policy *policy);
233extern int nla_policy_len(const struct nla_policy *, int);
233extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); 234extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype);
234extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, 235extern size_t nla_strlcpy(char *dst, const struct nlattr *nla,
235 size_t dstsize); 236 size_t dstsize);
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index f4498a62881b..9dc58402bc09 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -2,6 +2,7 @@
2#define __NETNS_CONNTRACK_H 2#define __NETNS_CONNTRACK_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/list_nulls.h>
5#include <asm/atomic.h> 6#include <asm/atomic.h>
6 7
7struct ctl_table_header; 8struct ctl_table_header;
@@ -10,9 +11,9 @@ struct nf_conntrack_ecache;
10struct netns_ct { 11struct netns_ct {
11 atomic_t count; 12 atomic_t count;
12 unsigned int expect_count; 13 unsigned int expect_count;
13 struct hlist_head *hash; 14 struct hlist_nulls_head *hash;
14 struct hlist_head *expect_hash; 15 struct hlist_head *expect_hash;
15 struct hlist_head unconfirmed; 16 struct hlist_nulls_head unconfirmed;
16 struct ip_conntrack_stat *stat; 17 struct ip_conntrack_stat *stat;
17#ifdef CONFIG_NF_CONNTRACK_EVENTS 18#ifdef CONFIG_NF_CONNTRACK_EVENTS
18 struct nf_conntrack_ecache *ecache; 19 struct nf_conntrack_ecache *ecache;
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 977f482d97a9..2eb3814d6258 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -54,5 +54,18 @@ struct netns_ipv4 {
54 54
55 struct timer_list rt_secret_timer; 55 struct timer_list rt_secret_timer;
56 atomic_t rt_genid; 56 atomic_t rt_genid;
57
58#ifdef CONFIG_IP_MROUTE
59 struct sock *mroute_sk;
60 struct mfc_cache **mfc_cache_array;
61 struct vif_device *vif_table;
62 int maxvif;
63 atomic_t cache_resolve_queue_len;
64 int mroute_do_assert;
65 int mroute_do_pim;
66#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2)
67 int mroute_reg_vif_num;
68#endif
69#endif
57}; 70};
58#endif 71#endif
diff --git a/include/net/netrom.h b/include/net/netrom.h
index f06852bba62a..15696b1fd30f 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -59,10 +59,6 @@ enum {
59#define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */ 59#define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */
60#define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */ 60#define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */
61 61
62struct nr_private {
63 struct net_device_stats stats;
64};
65
66struct nr_sock { 62struct nr_sock {
67 struct sock sock; 63 struct sock sock;
68 ax25_address user_addr, source_addr, dest_addr; 64 ax25_address user_addr, source_addr, dest_addr;
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
index 057b0a8a2885..d43f71b5ec00 100644
--- a/include/net/phonet/phonet.h
+++ b/include/net/phonet/phonet.h
@@ -105,7 +105,6 @@ void phonet_proto_unregister(int protocol, struct phonet_protocol *pp);
105 105
106int phonet_sysctl_init(void); 106int phonet_sysctl_init(void);
107void phonet_sysctl_exit(void); 107void phonet_sysctl_exit(void);
108void phonet_netlink_register(void);
109int isi_register(void); 108int isi_register(void);
110void isi_unregister(void); 109void isi_unregister(void);
111 110
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index aa1c59a1d33f..5054dc5ea2c2 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -28,7 +28,7 @@ struct phonet_device_list {
28 spinlock_t lock; 28 spinlock_t lock;
29}; 29};
30 30
31extern struct phonet_device_list pndevs; 31struct phonet_device_list *phonet_device_list(struct net *net);
32 32
33struct phonet_device { 33struct phonet_device {
34 struct list_head list; 34 struct list_head list;
@@ -36,8 +36,9 @@ struct phonet_device {
36 DECLARE_BITMAP(addrs, 64); 36 DECLARE_BITMAP(addrs, 64);
37}; 37};
38 38
39void phonet_device_init(void); 39int phonet_device_init(void);
40void phonet_device_exit(void); 40void phonet_device_exit(void);
41int phonet_netlink_register(void);
41struct net_device *phonet_device_get(struct net *net); 42struct net_device *phonet_device_get(struct net *net);
42 43
43int phonet_address_add(struct net_device *dev, u8 addr); 44int phonet_address_add(struct net_device *dev, u8 addr);
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 4082f39f5079..e37fe3129c17 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -85,6 +85,7 @@ extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
85 struct nlattr *tab); 85 struct nlattr *tab);
86extern void qdisc_put_rtab(struct qdisc_rate_table *tab); 86extern void qdisc_put_rtab(struct qdisc_rate_table *tab);
87extern void qdisc_put_stab(struct qdisc_size_table *tab); 87extern void qdisc_put_stab(struct qdisc_size_table *tab);
88extern void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc);
88 89
89extern void __qdisc_run(struct Qdisc *q); 90extern void __qdisc_run(struct Qdisc *q);
90 91
diff --git a/include/net/psnap.h b/include/net/psnap.h
index b2e01cc3fc8a..fe456c295b04 100644
--- a/include/net/psnap.h
+++ b/include/net/psnap.h
@@ -1,7 +1,11 @@
1#ifndef _NET_PSNAP_H 1#ifndef _NET_PSNAP_H
2#define _NET_PSNAP_H 2#define _NET_PSNAP_H
3 3
4extern struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *orig_dev)); 4extern struct datalink_proto *
5register_snap_client(const unsigned char *desc,
6 int (*rcvfunc)(struct sk_buff *, struct net_device *,
7 struct packet_type *,
8 struct net_device *orig_dev));
5extern void unregister_snap_client(struct datalink_proto *proto); 9extern void unregister_snap_client(struct datalink_proto *proto);
6 10
7#endif 11#endif
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index f8c47429044a..964ffa0d8815 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -42,24 +42,17 @@ struct Qdisc
42 int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev); 42 int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev);
43 struct sk_buff * (*dequeue)(struct Qdisc *dev); 43 struct sk_buff * (*dequeue)(struct Qdisc *dev);
44 unsigned flags; 44 unsigned flags;
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_WARN_NONWC (1 << 16)
48 int padded; 49 int padded;
49 struct Qdisc_ops *ops; 50 struct Qdisc_ops *ops;
50 struct qdisc_size_table *stab; 51 struct qdisc_size_table *stab;
52 struct list_head list;
51 u32 handle; 53 u32 handle;
52 u32 parent; 54 u32 parent;
53 atomic_t refcnt; 55 atomic_t refcnt;
54 unsigned long state;
55 struct sk_buff *gso_skb;
56 struct sk_buff_head q;
57 struct netdev_queue *dev_queue;
58 struct Qdisc *next_sched;
59 struct list_head list;
60
61 struct gnet_stats_basic bstats;
62 struct gnet_stats_queue qstats;
63 struct gnet_stats_rate_est rate_est; 56 struct gnet_stats_rate_est rate_est;
64 int (*reshape_fail)(struct sk_buff *skb, 57 int (*reshape_fail)(struct sk_buff *skb,
65 struct Qdisc *q); 58 struct Qdisc *q);
@@ -70,6 +63,17 @@ struct Qdisc
70 * and it will live until better solution will be invented. 63 * and it will live until better solution will be invented.
71 */ 64 */
72 struct Qdisc *__parent; 65 struct Qdisc *__parent;
66 struct netdev_queue *dev_queue;
67 struct Qdisc *next_sched;
68
69 struct sk_buff *gso_skb;
70 /*
71 * For performance sake on SMP, we put highly modified fields at the end
72 */
73 unsigned long state;
74 struct sk_buff_head q;
75 struct gnet_stats_basic bstats;
76 struct gnet_stats_queue qstats;
73}; 77};
74 78
75struct Qdisc_class_ops 79struct Qdisc_class_ops
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index 2fec3c366e81..befc8d2a1b9f 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -46,14 +46,14 @@
46#include <net/sctp/sctp.h> 46#include <net/sctp/sctp.h>
47#include <linux/crc32c.h> 47#include <linux/crc32c.h>
48 48
49static inline __be32 sctp_crc32c(__be32 crc, u8 *buffer, u16 length) 49static inline __u32 sctp_crc32c(__u32 crc, u8 *buffer, u16 length)
50{ 50{
51 return (__force __be32)crc32c((__force u32)crc, buffer, length); 51 return crc32c(crc, buffer, length);
52} 52}
53 53
54static inline __be32 sctp_start_cksum(__u8 *buffer, __u16 length) 54static inline __u32 sctp_start_cksum(__u8 *buffer, __u16 length)
55{ 55{
56 __be32 crc = ~cpu_to_be32(0); 56 __u32 crc = ~(__u32)0;
57 __u8 zero[sizeof(__u32)] = {0}; 57 __u8 zero[sizeof(__u32)] = {0};
58 58
59 /* Optimize this routine to be SCTP specific, knowing how 59 /* Optimize this routine to be SCTP specific, knowing how
@@ -72,12 +72,12 @@ static inline __be32 sctp_start_cksum(__u8 *buffer, __u16 length)
72 return crc; 72 return crc;
73} 73}
74 74
75static inline __be32 sctp_update_cksum(__u8 *buffer, __u16 length, __be32 crc32) 75static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
76{ 76{
77 return sctp_crc32c(crc32, buffer, length); 77 return sctp_crc32c(crc32, buffer, length);
78} 78}
79 79
80static inline __be32 sctp_end_cksum(__be32 crc32) 80static inline __le32 sctp_end_cksum(__be32 crc32)
81{ 81{
82 return (__force __be32)~cpu_to_le32((__force u32)crc32); 82 return cpu_to_le32(~crc32);
83} 83}
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 88988ab03d75..3b966802e05d 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -77,7 +77,8 @@ typedef enum {
77 SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */ 77 SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */
78 SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */ 78 SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */
79 SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */ 79 SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */
80 SCTP_CMD_TRANSPORT_RESET, /* Reset the status of a transport. */ 80 SCTP_CMD_TRANSPORT_HB_SENT, /* Reset the status of a transport. */
81 SCTP_CMD_TRANSPORT_IDLE, /* Do manipulations on idle transport */
81 SCTP_CMD_TRANSPORT_ON, /* Mark the transport as active. */ 82 SCTP_CMD_TRANSPORT_ON, /* Mark the transport as active. */
82 SCTP_CMD_REPORT_ERROR, /* Pass this error back out of the sm. */ 83 SCTP_CMD_REPORT_ERROR, /* Pass this error back out of the sm. */
83 SCTP_CMD_REPORT_BAD_TAG, /* Verification tags didn't match. */ 84 SCTP_CMD_REPORT_BAD_TAG, /* Verification tags didn't match. */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index bbb7742195b0..9f80a7668289 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -62,13 +62,6 @@
62 * and will continue to evolve. 62 * and will continue to evolve.
63 */ 63 */
64 64
65
66
67#ifdef TEST_FRAME
68#undef CONFIG_SCTP_DBG_OBJCNT
69#undef CONFIG_SYSCTL
70#endif /* TEST_FRAME */
71
72#include <linux/types.h> 65#include <linux/types.h>
73#include <linux/slab.h> 66#include <linux/slab.h>
74#include <linux/in.h> 67#include <linux/in.h>
@@ -138,6 +131,8 @@ void sctp_write_space(struct sock *sk);
138unsigned int sctp_poll(struct file *file, struct socket *sock, 131unsigned int sctp_poll(struct file *file, struct socket *sock,
139 poll_table *wait); 132 poll_table *wait);
140void sctp_sock_rfree(struct sk_buff *skb); 133void sctp_sock_rfree(struct sk_buff *skb);
134void sctp_copy_sock(struct sock *newsk, struct sock *sk,
135 struct sctp_association *asoc);
141extern struct percpu_counter sctp_sockets_allocated; 136extern struct percpu_counter sctp_sockets_allocated;
142 137
143/* 138/*
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 9661d7b765f0..23f08fe1d50a 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -218,6 +218,10 @@ extern struct sctp_globals {
218 218
219 /* Flag to idicate if SCTP-AUTH is enabled */ 219 /* Flag to idicate if SCTP-AUTH is enabled */
220 int auth_enable; 220 int auth_enable;
221
222 /* Flag to indicate whether computing and verifying checksum
223 * is disabled. */
224 int checksum_disable;
221} sctp_globals; 225} sctp_globals;
222 226
223#define sctp_rto_initial (sctp_globals.rto_initial) 227#define sctp_rto_initial (sctp_globals.rto_initial)
@@ -252,6 +256,7 @@ extern struct sctp_globals {
252#define sctp_addip_noauth (sctp_globals.addip_noauth_enable) 256#define sctp_addip_noauth (sctp_globals.addip_noauth_enable)
253#define sctp_prsctp_enable (sctp_globals.prsctp_enable) 257#define sctp_prsctp_enable (sctp_globals.prsctp_enable)
254#define sctp_auth_enable (sctp_globals.auth_enable) 258#define sctp_auth_enable (sctp_globals.auth_enable)
259#define sctp_checksum_disable (sctp_globals.checksum_disable)
255 260
256/* SCTP Socket type: UDP or TCP style. */ 261/* SCTP Socket type: UDP or TCP style. */
257typedef enum { 262typedef enum {
@@ -905,8 +910,10 @@ struct sctp_transport {
905 * should be set. Every time the RTT 910 * should be set. Every time the RTT
906 * calculation completes (i.e. the DATA chunk 911 * calculation completes (i.e. the DATA chunk
907 * is SACK'd) clear this flag. 912 * is SACK'd) clear this flag.
913 * hb_sent : a flag that signals that we have a pending heartbeat.
908 */ 914 */
909 __u8 rto_pending; 915 __u8 rto_pending;
916 __u8 hb_sent;
910 917
911 /* Flag to track the current fast recovery state */ 918 /* Flag to track the current fast recovery state */
912 __u8 fast_recovery; 919 __u8 fast_recovery;
diff --git a/include/net/sock.h b/include/net/sock.h
index eefeeaf7fc46..4bb1ff9fd15b 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -158,7 +158,7 @@ struct sock_common {
158 * @sk_allocation: allocation mode 158 * @sk_allocation: allocation mode
159 * @sk_sndbuf: size of send buffer in bytes 159 * @sk_sndbuf: size of send buffer in bytes
160 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, 160 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
161 * %SO_OOBINLINE settings 161 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
162 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 162 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
163 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 163 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
164 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) 164 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
@@ -488,6 +488,13 @@ enum sock_flags {
488 SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */ 488 SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */
489 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ 489 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
490 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ 490 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
491 SOCK_TIMESTAMPING_TX_HARDWARE, /* %SOF_TIMESTAMPING_TX_HARDWARE */
492 SOCK_TIMESTAMPING_TX_SOFTWARE, /* %SOF_TIMESTAMPING_TX_SOFTWARE */
493 SOCK_TIMESTAMPING_RX_HARDWARE, /* %SOF_TIMESTAMPING_RX_HARDWARE */
494 SOCK_TIMESTAMPING_RX_SOFTWARE, /* %SOF_TIMESTAMPING_RX_SOFTWARE */
495 SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */
496 SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */
497 SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */
491}; 498};
492 499
493static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 500static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -944,6 +951,11 @@ extern struct sk_buff *sock_alloc_send_skb(struct sock *sk,
944 unsigned long size, 951 unsigned long size,
945 int noblock, 952 int noblock,
946 int *errcode); 953 int *errcode);
954extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
955 unsigned long header_len,
956 unsigned long data_len,
957 int noblock,
958 int *errcode);
947extern void *sock_kmalloc(struct sock *sk, int size, 959extern void *sock_kmalloc(struct sock *sk, int size,
948 gfp_t priority); 960 gfp_t priority);
949extern void sock_kfree_s(struct sock *sk, void *mem, int size); 961extern void sock_kfree_s(struct sock *sk, void *mem, int size);
@@ -1340,14 +1352,45 @@ static __inline__ void
1340sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 1352sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1341{ 1353{
1342 ktime_t kt = skb->tstamp; 1354 ktime_t kt = skb->tstamp;
1355 struct skb_shared_hwtstamps *hwtstamps = skb_hwtstamps(skb);
1343 1356
1344 if (sock_flag(sk, SOCK_RCVTSTAMP)) 1357 /*
1358 * generate control messages if
1359 * - receive time stamping in software requested (SOCK_RCVTSTAMP
1360 * or SOCK_TIMESTAMPING_RX_SOFTWARE)
1361 * - software time stamp available and wanted
1362 * (SOCK_TIMESTAMPING_SOFTWARE)
1363 * - hardware time stamps available and wanted
1364 * (SOCK_TIMESTAMPING_SYS_HARDWARE or
1365 * SOCK_TIMESTAMPING_RAW_HARDWARE)
1366 */
1367 if (sock_flag(sk, SOCK_RCVTSTAMP) ||
1368 sock_flag(sk, SOCK_TIMESTAMPING_RX_SOFTWARE) ||
1369 (kt.tv64 && sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE)) ||
1370 (hwtstamps->hwtstamp.tv64 &&
1371 sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE)) ||
1372 (hwtstamps->syststamp.tv64 &&
1373 sock_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE)))
1345 __sock_recv_timestamp(msg, sk, skb); 1374 __sock_recv_timestamp(msg, sk, skb);
1346 else 1375 else
1347 sk->sk_stamp = kt; 1376 sk->sk_stamp = kt;
1348} 1377}
1349 1378
1350/** 1379/**
1380 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
1381 * @msg: outgoing packet
1382 * @sk: socket sending this packet
1383 * @shtx: filled with instructions for time stamping
1384 *
1385 * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if
1386 * parameters are invalid.
1387 */
1388extern int sock_tx_timestamp(struct msghdr *msg,
1389 struct sock *sk,
1390 union skb_shared_tx *shtx);
1391
1392
1393/**
1351 * sk_eat_skb - Release a skb if it is no longer needed 1394 * sk_eat_skb - Release a skb if it is no longer needed
1352 * @sk: socket to eat this skb from 1395 * @sk: socket to eat this skb from
1353 * @skb: socket buffer to eat 1396 * @skb: socket buffer to eat
@@ -1415,7 +1458,7 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb)
1415 return NULL; 1458 return NULL;
1416} 1459}
1417 1460
1418extern void sock_enable_timestamp(struct sock *sk); 1461extern void sock_enable_timestamp(struct sock *sk, int flag);
1419extern int sock_get_timestamp(struct sock *, struct timeval __user *); 1462extern int sock_get_timestamp(struct sock *, struct timeval __user *);
1420extern int sock_get_timestampns(struct sock *, struct timespec __user *); 1463extern int sock_get_timestampns(struct sock *, struct timespec __user *);
1421 1464
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 218235de8963..646dbe3962ea 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -41,6 +41,7 @@
41#include <net/ip.h> 41#include <net/ip.h>
42#include <net/tcp_states.h> 42#include <net/tcp_states.h>
43#include <net/inet_ecn.h> 43#include <net/inet_ecn.h>
44#include <net/dst.h>
44 45
45#include <linux/seq_file.h> 46#include <linux/seq_file.h>
46 47
@@ -481,7 +482,16 @@ static inline void tcp_clear_xmit_timers(struct sock *sk)
481} 482}
482 483
483extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); 484extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu);
484extern unsigned int tcp_current_mss(struct sock *sk, int large); 485extern unsigned int tcp_current_mss(struct sock *sk);
486
487/* Bound MSS / TSO packet size with the half of the window */
488static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
489{
490 if (tp->max_window && pktsize > (tp->max_window >> 1))
491 return max(tp->max_window >> 1, 68U - tp->tcp_header_len);
492 else
493 return pktsize;
494}
485 495
486/* tcp.c */ 496/* tcp.c */
487extern void tcp_get_info(struct sock *, struct tcp_info *); 497extern void tcp_get_info(struct sock *, struct tcp_info *);
@@ -521,6 +531,17 @@ static inline void tcp_fast_path_check(struct sock *sk)
521 tcp_fast_path_on(tp); 531 tcp_fast_path_on(tp);
522} 532}
523 533
534/* Compute the actual rto_min value */
535static inline u32 tcp_rto_min(struct sock *sk)
536{
537 struct dst_entry *dst = __sk_dst_get(sk);
538 u32 rto_min = TCP_RTO_MIN;
539
540 if (dst && dst_metric_locked(dst, RTAX_RTO_MIN))
541 rto_min = dst_metric_rtt(dst, RTAX_RTO_MIN);
542 return rto_min;
543}
544
524/* Compute the actual receive window we are currently advertising. 545/* Compute the actual receive window we are currently advertising.
525 * Rcv_nxt can be after the window if our peer push more data 546 * Rcv_nxt can be after the window if our peer push more data
526 * than the offered window. 547 * than the offered window.
@@ -607,21 +628,6 @@ static inline int tcp_skb_mss(const struct sk_buff *skb)
607 return skb_shinfo(skb)->gso_size; 628 return skb_shinfo(skb)->gso_size;
608} 629}
609 630
610static inline void tcp_dec_pcount_approx_int(__u32 *count, const int decr)
611{
612 if (*count) {
613 *count -= decr;
614 if ((int)*count < 0)
615 *count = 0;
616 }
617}
618
619static inline void tcp_dec_pcount_approx(__u32 *count,
620 const struct sk_buff *skb)
621{
622 tcp_dec_pcount_approx_int(count, tcp_skb_pcount(skb));
623}
624
625/* Events passed to congestion control interface */ 631/* Events passed to congestion control interface */
626enum tcp_ca_event { 632enum tcp_ca_event {
627 CA_EVENT_TX_START, /* first transmit when no packets in flight */ 633 CA_EVENT_TX_START, /* first transmit when no packets in flight */
@@ -685,6 +691,7 @@ extern void tcp_get_allowed_congestion_control(char *buf, size_t len);
685extern int tcp_set_allowed_congestion_control(char *allowed); 691extern int tcp_set_allowed_congestion_control(char *allowed);
686extern int tcp_set_congestion_control(struct sock *sk, const char *name); 692extern int tcp_set_congestion_control(struct sock *sk, const char *name);
687extern void tcp_slow_start(struct tcp_sock *tp); 693extern void tcp_slow_start(struct tcp_sock *tp);
694extern void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
688 695
689extern struct tcp_congestion_ops tcp_init_congestion_ops; 696extern struct tcp_congestion_ops tcp_init_congestion_ops;
690extern u32 tcp_reno_ssthresh(struct sock *sk); 697extern u32 tcp_reno_ssthresh(struct sock *sk);
@@ -821,15 +828,15 @@ static inline void tcp_push_pending_frames(struct sock *sk)
821{ 828{
822 struct tcp_sock *tp = tcp_sk(sk); 829 struct tcp_sock *tp = tcp_sk(sk);
823 830
824 __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp->nonagle); 831 __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle);
825} 832}
826 833
827static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) 834static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq)
828{ 835{
829 tp->snd_wl1 = seq; 836 tp->snd_wl1 = seq;
830} 837}
831 838
832static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) 839static inline void tcp_update_wl(struct tcp_sock *tp, u32 seq)
833{ 840{
834 tp->snd_wl1 = seq; 841 tp->snd_wl1 = seq;
835} 842}
@@ -900,7 +907,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
900 wake_up_interruptible(sk->sk_sleep); 907 wake_up_interruptible(sk->sk_sleep);
901 if (!inet_csk_ack_scheduled(sk)) 908 if (!inet_csk_ack_scheduled(sk))
902 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 909 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
903 (3 * TCP_RTO_MIN) / 4, 910 (3 * tcp_rto_min(sk)) / 4,
904 TCP_RTO_MAX); 911 TCP_RTO_MAX);
905 } 912 }
906 return 1; 913 return 1;
@@ -925,7 +932,6 @@ extern void tcp_done(struct sock *sk);
925static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) 932static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
926{ 933{
927 rx_opt->dsack = 0; 934 rx_opt->dsack = 0;
928 rx_opt->eff_sacks = 0;
929 rx_opt->num_sacks = 0; 935 rx_opt->num_sacks = 0;
930} 936}
931 937
@@ -997,11 +1003,21 @@ static inline int tcp_fin_time(const struct sock *sk)
997 return fin_timeout; 1003 return fin_timeout;
998} 1004}
999 1005
1000static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int rst) 1006static inline int tcp_paws_check(const struct tcp_options_received *rx_opt,
1007 int paws_win)
1001{ 1008{
1002 if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) 1009 if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win)
1003 return 0; 1010 return 1;
1004 if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) 1011 if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS))
1012 return 1;
1013
1014 return 0;
1015}
1016
1017static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt,
1018 int rst)
1019{
1020 if (tcp_paws_check(rx_opt, 0))
1005 return 0; 1021 return 0;
1006 1022
1007 /* RST segments are not recommended to carry timestamp, 1023 /* RST segments are not recommended to carry timestamp,
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 876b6f2bb4fd..bfb240c6cf79 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -46,7 +46,7 @@ extern int datagram_send_ctl(struct net *net,
46 struct ipv6_txoptions *opt, 46 struct ipv6_txoptions *opt,
47 int *hlimit, int *tclass); 47 int *hlimit, int *tclass);
48 48
49#define LOOPBACK4_IPV6 __constant_htonl(0x7f000006) 49#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
50 50
51/* 51/*
52 * address family specific functions 52 * address family specific functions
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 21c5d966142d..64a76208580c 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -69,6 +69,9 @@ enum ieee80211_channel_flags {
69 * @band: band this channel belongs to. 69 * @band: band this channel belongs to.
70 * @max_antenna_gain: maximum antenna gain in dBi 70 * @max_antenna_gain: maximum antenna gain in dBi
71 * @max_power: maximum transmission power (in dBm) 71 * @max_power: maximum transmission power (in dBm)
72 * @beacon_found: helper to regulatory code to indicate when a beacon
73 * has been found on this channel. Use regulatory_hint_found_beacon()
74 * to enable this, this is is useful only on 5 GHz band.
72 * @orig_mag: internal use 75 * @orig_mag: internal use
73 * @orig_mpwr: internal use 76 * @orig_mpwr: internal use
74 */ 77 */
@@ -80,6 +83,7 @@ struct ieee80211_channel {
80 u32 flags; 83 u32 flags;
81 int max_antenna_gain; 84 int max_antenna_gain;
82 int max_power; 85 int max_power;
86 bool beacon_found;
83 u32 orig_flags; 87 u32 orig_flags;
84 int orig_mag, orig_mpwr; 88 int orig_mag, orig_mpwr;
85}; 89};
@@ -181,12 +185,26 @@ struct ieee80211_supported_band {
181 * struct wiphy - wireless hardware description 185 * struct wiphy - wireless hardware description
182 * @idx: the wiphy index assigned to this item 186 * @idx: the wiphy index assigned to this item
183 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 187 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
184 * @fw_handles_regulatory: tells us the firmware for this device 188 * @custom_regulatory: tells us the driver for this device
185 * has its own regulatory solution and cannot identify the 189 * has its own custom regulatory domain and cannot identify the
186 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 190 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
187 * we will disregard the first regulatory hint (when the 191 * we will disregard the first regulatory hint (when the
188 * initiator is %REGDOM_SET_BY_CORE). 192 * initiator is %REGDOM_SET_BY_CORE).
193 * @strict_regulatory: tells us the driver for this device will ignore
194 * regulatory domain settings until it gets its own regulatory domain
195 * via its regulatory_hint(). After its gets its own regulatory domain
196 * it will only allow further regulatory domain settings to further
197 * enhance compliance. For example if channel 13 and 14 are disabled
198 * by this regulatory domain no user regulatory domain can enable these
199 * channels at a later time. This can be used for devices which do not
200 * have calibration information gauranteed for frequencies or settings
201 * outside of its regulatory domain.
189 * @reg_notifier: the driver's regulatory notification callback 202 * @reg_notifier: the driver's regulatory notification callback
203 * @regd: the driver's regulatory domain, if one was requested via
204 * the regulatory_hint() API. This can be used by the driver
205 * on the reg_notifier() if it chooses to ignore future
206 * regulatory domain changes caused by other drivers.
207 * @signal_type: signal type reported in &struct cfg80211_bss.
190 */ 208 */
191struct wiphy { 209struct wiphy {
192 /* assign these fields before you register the wiphy */ 210 /* assign these fields before you register the wiphy */
@@ -197,7 +215,13 @@ struct wiphy {
197 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 215 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
198 u16 interface_modes; 216 u16 interface_modes;
199 217
200 bool fw_handles_regulatory; 218 bool custom_regulatory;
219 bool strict_regulatory;
220
221 enum cfg80211_signal_type signal_type;
222
223 int bss_priv_size;
224 u8 max_scan_ssids;
201 225
202 /* If multiple wiphys are registered and you're handed e.g. 226 /* If multiple wiphys are registered and you're handed e.g.
203 * a regular netdev with assigned ieee80211_ptr, you won't 227 * a regular netdev with assigned ieee80211_ptr, you won't
@@ -209,10 +233,13 @@ struct wiphy {
209 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 233 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
210 234
211 /* Lets us get back the wiphy on the callback */ 235 /* Lets us get back the wiphy on the callback */
212 int (*reg_notifier)(struct wiphy *wiphy, enum reg_set_by setby); 236 int (*reg_notifier)(struct wiphy *wiphy,
237 struct regulatory_request *request);
213 238
214 /* fields below are read-only, assigned by cfg80211 */ 239 /* fields below are read-only, assigned by cfg80211 */
215 240
241 const struct ieee80211_regdomain *regd;
242
216 /* the item in /sys/class/ieee80211/ points to this, 243 /* the item in /sys/class/ieee80211/ points to this,
217 * you need use set_wiphy_dev() (see below) */ 244 * you need use set_wiphy_dev() (see below) */
218 struct device dev; 245 struct device dev;
@@ -361,7 +388,7 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq)
361 */ 388 */
362struct ieee80211_rate * 389struct ieee80211_rate *
363ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 390ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
364 u64 basic_rates, int bitrate); 391 u32 basic_rates, int bitrate);
365 392
366/** 393/**
367 * regulatory_hint - driver hint to the wireless core a regulatory domain 394 * regulatory_hint - driver hint to the wireless core a regulatory domain
@@ -378,8 +405,15 @@ ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
378 * domain should be in or by providing a completely build regulatory domain. 405 * domain should be in or by providing a completely build regulatory domain.
379 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 406 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
380 * for a regulatory domain structure for the respective country. 407 * for a regulatory domain structure for the respective country.
408 *
409 * The wiphy must have been registered to cfg80211 prior to this call.
410 * For cfg80211 drivers this means you must first use wiphy_register(),
411 * for mac80211 drivers you must first use ieee80211_register_hw().
412 *
413 * Drivers should check the return value, its possible you can get
414 * an -ENOMEM.
381 */ 415 */
382extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2); 416extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
383 417
384/** 418/**
385 * regulatory_hint_11d - hints a country IE as a regulatory domain 419 * regulatory_hint_11d - hints a country IE as a regulatory domain
@@ -395,4 +429,44 @@ extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2);
395extern void regulatory_hint_11d(struct wiphy *wiphy, 429extern void regulatory_hint_11d(struct wiphy *wiphy,
396 u8 *country_ie, 430 u8 *country_ie,
397 u8 country_ie_len); 431 u8 country_ie_len);
432/**
433 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
434 * @wiphy: the wireless device we want to process the regulatory domain on
435 * @regd: the custom regulatory domain to use for this wiphy
436 *
437 * Drivers can sometimes have custom regulatory domains which do not apply
438 * to a specific country. Drivers can use this to apply such custom regulatory
439 * domains. This routine must be called prior to wiphy registration. The
440 * custom regulatory domain will be trusted completely and as such previous
441 * default channel settings will be disregarded. If no rule is found for a
442 * channel on the regulatory domain the channel will be disabled.
443 */
444extern void wiphy_apply_custom_regulatory(
445 struct wiphy *wiphy,
446 const struct ieee80211_regdomain *regd);
447
448/**
449 * freq_reg_info - get regulatory information for the given frequency
450 * @wiphy: the wiphy for which we want to process this rule for
451 * @center_freq: Frequency in KHz for which we want regulatory information for
452 * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
453 * you can set this to 0. If this frequency is allowed we then set
454 * this value to the maximum allowed bandwidth.
455 * @reg_rule: the regulatory rule which we have for this frequency
456 *
457 * Use this function to get the regulatory rule for a specific frequency on
458 * a given wireless device. If the device has a specific regulatory domain
459 * it wants to follow we respect that unless a country IE has been received
460 * and processed already.
461 *
462 * Returns 0 if it was able to find a valid regulatory rule which does
463 * apply to the given center_freq otherwise it returns non-zero. It will
464 * also return -ERANGE if we determine the given center_freq does not even have
465 * a regulatory rule for a frequency range in the center_freq's band. See
466 * freq_in_rule_band() for our current definition of a band -- this is purely
467 * subjective and right now its 802.11 specific.
468 */
469extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
470 const struct ieee80211_reg_rule **reg_rule);
471
398#endif /* __NET_WIRELESS_H */ 472#endif /* __NET_WIRELESS_H */