aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/addrconf.h1
-rw-r--r--include/net/af_unix.h3
-rw-r--r--include/net/arp.h4
-rw-r--r--include/net/bluetooth/bluetooth.h40
-rw-r--r--include/net/bluetooth/hci.h79
-rw-r--r--include/net/bluetooth/hci_core.h303
-rw-r--r--include/net/bluetooth/hci_mon.h51
-rw-r--r--include/net/bluetooth/l2cap.h87
-rw-r--r--include/net/bluetooth/mgmt.h338
-rw-r--r--include/net/bluetooth/smp.h2
-rw-r--r--include/net/caif/caif_hsi.h1
-rw-r--r--include/net/cfg80211.h186
-rw-r--r--include/net/compat.h2
-rw-r--r--include/net/dcbnl.h4
-rw-r--r--include/net/dn.h1
-rw-r--r--include/net/dst.h1
-rw-r--r--include/net/genetlink.h31
-rw-r--r--include/net/inet_sock.h3
-rw-r--r--include/net/inetpeer.h4
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/ip_vs.h1
-rw-r--r--include/net/iucv/af_iucv.h3
-rw-r--r--include/net/mac80211.h160
-rw-r--r--include/net/ndisc.h1
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h4
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h13
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h23
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h78
-rw-r--r--include/net/netfilter/xt_log.h4
-rw-r--r--include/net/netlink.h35
-rw-r--r--include/net/netns/generic.h1
-rw-r--r--include/net/nfc/nci.h53
-rw-r--r--include/net/nfc/nci_core.h36
-rw-r--r--include/net/nfc/nfc.h39
-rw-r--r--include/net/red.h1
-rw-r--r--include/net/sctp/sctp.h1
-rw-r--r--include/net/sock.h46
-rw-r--r--include/net/tcp.h72
-rw-r--r--include/net/tcp_memcontrol.h2
-rw-r--r--include/net/timewait_sock.h1
-rw-r--r--include/net/udp.h1
-rw-r--r--include/net/udplite.h4
-rw-r--r--include/net/wpan-phy.h1
-rw-r--r--include/net/xfrm.h5
44 files changed, 1125 insertions, 603 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index f68dce2d8d88..757a17638b1b 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -160,7 +160,6 @@ extern void addrconf_prefix_rcv(struct net_device *dev,
160extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr); 160extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr);
161extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr); 161extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr);
162extern void ipv6_sock_ac_close(struct sock *sk); 162extern void ipv6_sock_ac_close(struct sock *sk);
163extern int inet6_ac_check(struct sock *sk, const struct in6_addr *addr, int ifindex);
164 163
165extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); 164extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr);
166extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); 165extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 5a4e29b168c9..ca68e2cef230 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -49,8 +49,7 @@ struct unix_sock {
49 /* WARNING: sk has to be the first member */ 49 /* WARNING: sk has to be the first member */
50 struct sock sk; 50 struct sock sk;
51 struct unix_address *addr; 51 struct unix_address *addr;
52 struct dentry *dentry; 52 struct path path;
53 struct vfsmount *mnt;
54 struct mutex readlock; 53 struct mutex readlock;
55 struct sock *peer; 54 struct sock *peer;
56 struct sock *other; 55 struct sock *other;
diff --git a/include/net/arp.h b/include/net/arp.h
index 0013dc87940b..4a1f3fb562eb 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -15,14 +15,14 @@ static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd
15 return val * hash_rnd; 15 return val * hash_rnd;
16} 16}
17 17
18static inline struct neighbour *__ipv4_neigh_lookup(struct neigh_table *tbl, struct net_device *dev, u32 key) 18static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 key)
19{ 19{
20 struct neigh_hash_table *nht; 20 struct neigh_hash_table *nht;
21 struct neighbour *n; 21 struct neighbour *n;
22 u32 hash_val; 22 u32 hash_val;
23 23
24 rcu_read_lock_bh(); 24 rcu_read_lock_bh();
25 nht = rcu_dereference_bh(tbl->nht); 25 nht = rcu_dereference_bh(arp_tbl.nht);
26 hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift); 26 hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift);
27 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); 27 for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]);
28 n != NULL; 28 n != NULL;
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 4a82ca0bb0b2..262ebd1747d4 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -109,12 +109,14 @@ struct bt_power {
109 */ 109 */
110#define BT_CHANNEL_POLICY_AMP_PREFERRED 2 110#define BT_CHANNEL_POLICY_AMP_PREFERRED 2
111 111
112__printf(2, 3) 112__printf(1, 2)
113int bt_printk(const char *level, const char *fmt, ...); 113int bt_info(const char *fmt, ...);
114__printf(1, 2)
115int bt_err(const char *fmt, ...);
114 116
115#define BT_INFO(fmt, arg...) bt_printk(KERN_INFO, pr_fmt(fmt), ##arg) 117#define BT_INFO(fmt, ...) bt_info(fmt "\n", ##__VA_ARGS__)
116#define BT_ERR(fmt, arg...) bt_printk(KERN_ERR, pr_fmt(fmt), ##arg) 118#define BT_ERR(fmt, ...) bt_err(fmt "\n", ##__VA_ARGS__)
117#define BT_DBG(fmt, arg...) pr_debug(fmt "\n", ##arg) 119#define BT_DBG(fmt, ...) pr_debug(fmt "\n", ##__VA_ARGS__)
118 120
119/* Connection and socket states */ 121/* Connection and socket states */
120enum { 122enum {
@@ -129,6 +131,33 @@ enum {
129 BT_CLOSED 131 BT_CLOSED
130}; 132};
131 133
134/* If unused will be removed by compiler */
135static inline const char *state_to_string(int state)
136{
137 switch (state) {
138 case BT_CONNECTED:
139 return "BT_CONNECTED";
140 case BT_OPEN:
141 return "BT_OPEN";
142 case BT_BOUND:
143 return "BT_BOUND";
144 case BT_LISTEN:
145 return "BT_LISTEN";
146 case BT_CONNECT:
147 return "BT_CONNECT";
148 case BT_CONNECT2:
149 return "BT_CONNECT2";
150 case BT_CONFIG:
151 return "BT_CONFIG";
152 case BT_DISCONN:
153 return "BT_DISCONN";
154 case BT_CLOSED:
155 return "BT_CLOSED";
156 }
157
158 return "invalid state";
159}
160
132/* BD Address */ 161/* BD Address */
133typedef struct { 162typedef struct {
134 __u8 b[6]; 163 __u8 b[6];
@@ -193,7 +222,6 @@ struct bt_skb_cb {
193 __u16 tx_seq; 222 __u16 tx_seq;
194 __u8 retries; 223 __u8 retries;
195 __u8 sar; 224 __u8 sar;
196 unsigned short channel;
197 __u8 force_active; 225 __u8 force_active;
198}; 226};
199#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 227#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 00596e816b4d..d47e523c9d83 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -77,14 +77,6 @@ enum {
77 77
78 HCI_RAW, 78 HCI_RAW,
79 79
80 HCI_SETUP,
81 HCI_AUTO_OFF,
82 HCI_MGMT,
83 HCI_PAIRABLE,
84 HCI_SERVICE_CACHE,
85 HCI_LINK_KEYS,
86 HCI_DEBUG_KEYS,
87
88 HCI_RESET, 80 HCI_RESET,
89}; 81};
90 82
@@ -93,7 +85,23 @@ enum {
93 * states from the controller. 85 * states from the controller.
94 */ 86 */
95enum { 87enum {
88 HCI_SETUP,
89 HCI_AUTO_OFF,
90 HCI_MGMT,
91 HCI_PAIRABLE,
92 HCI_SERVICE_CACHE,
93 HCI_LINK_KEYS,
94 HCI_DEBUG_KEYS,
95 HCI_UNREGISTER,
96
96 HCI_LE_SCAN, 97 HCI_LE_SCAN,
98 HCI_SSP_ENABLED,
99 HCI_HS_ENABLED,
100 HCI_LE_ENABLED,
101 HCI_CONNECTABLE,
102 HCI_DISCOVERABLE,
103 HCI_LINK_SECURITY,
104 HCI_PENDING_CLASS,
97}; 105};
98 106
99/* HCI ioctl defines */ 107/* HCI ioctl defines */
@@ -130,6 +138,7 @@ enum {
130#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 138#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
131#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 139#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
132#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ 140#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */
141#define HCI_ACL_TX_TIMEOUT (45000) /* 45 seconds */
133 142
134/* HCI data types */ 143/* HCI data types */
135#define HCI_COMMAND_PKT 0x01 144#define HCI_COMMAND_PKT 0x01
@@ -229,7 +238,9 @@ enum {
229#define LMP_EXTFEATURES 0x80 238#define LMP_EXTFEATURES 0x80
230 239
231/* Extended LMP features */ 240/* Extended LMP features */
232#define LMP_HOST_LE 0x02 241#define LMP_HOST_SSP 0x01
242#define LMP_HOST_LE 0x02
243#define LMP_HOST_LE_BREDR 0x04
233 244
234/* Connection modes */ 245/* Connection modes */
235#define HCI_CM_ACTIVE 0x0000 246#define HCI_CM_ACTIVE 0x0000
@@ -268,10 +279,11 @@ enum {
268#define HCI_LK_UNAUTH_COMBINATION 0x04 279#define HCI_LK_UNAUTH_COMBINATION 0x04
269#define HCI_LK_AUTH_COMBINATION 0x05 280#define HCI_LK_AUTH_COMBINATION 0x05
270#define HCI_LK_CHANGED_COMBINATION 0x06 281#define HCI_LK_CHANGED_COMBINATION 0x06
271/* The spec doesn't define types for SMP keys */ 282/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
272#define HCI_LK_SMP_LTK 0x81 283#define HCI_SMP_STK 0x80
273#define HCI_LK_SMP_IRK 0x82 284#define HCI_SMP_STK_SLAVE 0x81
274#define HCI_LK_SMP_CSRK 0x83 285#define HCI_SMP_LTK 0x82
286#define HCI_SMP_LTK_SLAVE 0x83
275 287
276/* ---- HCI Error Codes ---- */ 288/* ---- HCI Error Codes ---- */
277#define HCI_ERROR_AUTH_FAILURE 0x05 289#define HCI_ERROR_AUTH_FAILURE 0x05
@@ -284,6 +296,22 @@ enum {
284#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 296#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
285#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 297#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01
286 298
299/* Extended Inquiry Response field types */
300#define EIR_FLAGS 0x01 /* flags */
301#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
302#define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */
303#define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */
304#define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */
305#define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */
306#define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */
307#define EIR_NAME_SHORT 0x08 /* shortened local name */
308#define EIR_NAME_COMPLETE 0x09 /* complete local name */
309#define EIR_TX_POWER 0x0A /* transmit power level */
310#define EIR_CLASS_OF_DEV 0x0D /* Class of Device */
311#define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */
312#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */
313#define EIR_DEVICE_ID 0x10 /* device ID */
314
287/* ----- HCI Commands ---- */ 315/* ----- HCI Commands ---- */
288#define HCI_OP_NOP 0x0000 316#define HCI_OP_NOP 0x0000
289 317
@@ -666,8 +694,8 @@ struct hci_cp_host_buffer_size {
666 694
667#define HCI_OP_WRITE_EIR 0x0c52 695#define HCI_OP_WRITE_EIR 0x0c52
668struct hci_cp_write_eir { 696struct hci_cp_write_eir {
669 uint8_t fec; 697 __u8 fec;
670 uint8_t data[HCI_MAX_EIR_LENGTH]; 698 __u8 data[HCI_MAX_EIR_LENGTH];
671} __packed; 699} __packed;
672 700
673#define HCI_OP_READ_SSP_MODE 0x0c55 701#define HCI_OP_READ_SSP_MODE 0x0c55
@@ -698,8 +726,8 @@ struct hci_rp_read_flow_control_mode {
698 726
699#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d 727#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d
700struct hci_cp_write_le_host_supported { 728struct hci_cp_write_le_host_supported {
701 __u8 le; 729 __u8 le;
702 __u8 simul; 730 __u8 simul;
703} __packed; 731} __packed;
704 732
705#define HCI_OP_READ_LOCAL_VERSION 0x1001 733#define HCI_OP_READ_LOCAL_VERSION 0x1001
@@ -1155,6 +1183,19 @@ struct hci_ev_le_meta {
1155 __u8 subevent; 1183 __u8 subevent;
1156} __packed; 1184} __packed;
1157 1185
1186#define HCI_EV_NUM_COMP_BLOCKS 0x48
1187struct hci_comp_blocks_info {
1188 __le16 handle;
1189 __le16 pkts;
1190 __le16 blocks;
1191} __packed;
1192
1193struct hci_ev_num_comp_blocks {
1194 __le16 num_blocks;
1195 __u8 num_hndl;
1196 struct hci_comp_blocks_info handles[0];
1197} __packed;
1198
1158/* Low energy meta events */ 1199/* Low energy meta events */
1159#define HCI_EV_LE_CONN_COMPLETE 0x01 1200#define HCI_EV_LE_CONN_COMPLETE 0x01
1160struct hci_ev_le_conn_complete { 1201struct hci_ev_le_conn_complete {
@@ -1287,7 +1328,8 @@ struct sockaddr_hci {
1287#define HCI_DEV_NONE 0xffff 1328#define HCI_DEV_NONE 0xffff
1288 1329
1289#define HCI_CHANNEL_RAW 0 1330#define HCI_CHANNEL_RAW 0
1290#define HCI_CHANNEL_CONTROL 1 1331#define HCI_CHANNEL_MONITOR 2
1332#define HCI_CHANNEL_CONTROL 3
1291 1333
1292struct hci_filter { 1334struct hci_filter {
1293 unsigned long type_mask; 1335 unsigned long type_mask;
@@ -1389,5 +1431,6 @@ struct hci_inquiry_req {
1389#define IREQ_CACHE_FLUSH 0x0001 1431#define IREQ_CACHE_FLUSH 0x0001
1390 1432
1391extern bool enable_hs; 1433extern bool enable_hs;
1434extern bool enable_le;
1392 1435
1393#endif /* __HCI_H */ 1436#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 453893b3120e..6822d2595aff 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -44,14 +44,31 @@ struct inquiry_data {
44}; 44};
45 45
46struct inquiry_entry { 46struct inquiry_entry {
47 struct inquiry_entry *next; 47 struct list_head all; /* inq_cache.all */
48 struct list_head list; /* unknown or resolve */
49 enum {
50 NAME_NOT_KNOWN,
51 NAME_NEEDED,
52 NAME_PENDING,
53 NAME_KNOWN,
54 } name_state;
48 __u32 timestamp; 55 __u32 timestamp;
49 struct inquiry_data data; 56 struct inquiry_data data;
50}; 57};
51 58
52struct inquiry_cache { 59struct discovery_state {
60 int type;
61 enum {
62 DISCOVERY_STOPPED,
63 DISCOVERY_STARTING,
64 DISCOVERY_FINDING,
65 DISCOVERY_RESOLVING,
66 DISCOVERY_STOPPING,
67 } state;
68 struct list_head all; /* All devices found during inquiry */
69 struct list_head unknown; /* Name state not known */
70 struct list_head resolve; /* Name needs to be resolved */
53 __u32 timestamp; 71 __u32 timestamp;
54 struct inquiry_entry *list;
55}; 72};
56 73
57struct hci_conn_hash { 74struct hci_conn_hash {
@@ -72,18 +89,16 @@ struct bt_uuid {
72 u8 svc_hint; 89 u8 svc_hint;
73}; 90};
74 91
75struct key_master_id { 92struct smp_ltk {
76 __le16 ediv; 93 struct list_head list;
77 u8 rand[8];
78} __packed;
79
80struct link_key_data {
81 bdaddr_t bdaddr; 94 bdaddr_t bdaddr;
95 u8 bdaddr_type;
96 u8 authenticated;
82 u8 type; 97 u8 type;
98 u8 enc_size;
99 __le16 ediv;
100 u8 rand[8];
83 u8 val[16]; 101 u8 val[16];
84 u8 pin_len;
85 u8 dlen;
86 u8 data[0];
87} __packed; 102} __packed;
88 103
89struct link_key { 104struct link_key {
@@ -92,8 +107,6 @@ struct link_key {
92 u8 type; 107 u8 type;
93 u8 val[16]; 108 u8 val[16];
94 u8 pin_len; 109 u8 pin_len;
95 u8 dlen;
96 u8 data[0];
97}; 110};
98 111
99struct oob_data { 112struct oob_data {
@@ -109,11 +122,19 @@ struct adv_entry {
109 u8 bdaddr_type; 122 u8 bdaddr_type;
110}; 123};
111 124
125struct le_scan_params {
126 u8 type;
127 u16 interval;
128 u16 window;
129 int timeout;
130};
131
132#define HCI_MAX_SHORT_NAME_LENGTH 10
133
112#define NUM_REASSEMBLY 4 134#define NUM_REASSEMBLY 4
113struct hci_dev { 135struct hci_dev {
114 struct list_head list; 136 struct list_head list;
115 struct mutex lock; 137 struct mutex lock;
116 atomic_t refcnt;
117 138
118 char name[8]; 139 char name[8];
119 unsigned long flags; 140 unsigned long flags;
@@ -122,6 +143,7 @@ struct hci_dev {
122 __u8 dev_type; 143 __u8 dev_type;
123 bdaddr_t bdaddr; 144 bdaddr_t bdaddr;
124 __u8 dev_name[HCI_MAX_NAME_LENGTH]; 145 __u8 dev_name[HCI_MAX_NAME_LENGTH];
146 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH];
125 __u8 eir[HCI_MAX_EIR_LENGTH]; 147 __u8 eir[HCI_MAX_EIR_LENGTH];
126 __u8 dev_class[3]; 148 __u8 dev_class[3];
127 __u8 major_class; 149 __u8 major_class;
@@ -129,7 +151,6 @@ struct hci_dev {
129 __u8 features[8]; 151 __u8 features[8];
130 __u8 host_features[8]; 152 __u8 host_features[8];
131 __u8 commands[64]; 153 __u8 commands[64];
132 __u8 ssp_mode;
133 __u8 hci_ver; 154 __u8 hci_ver;
134 __u16 hci_rev; 155 __u16 hci_rev;
135 __u8 lmp_ver; 156 __u8 lmp_ver;
@@ -217,7 +238,7 @@ struct hci_dev {
217 238
218 struct list_head mgmt_pending; 239 struct list_head mgmt_pending;
219 240
220 struct inquiry_cache inq_cache; 241 struct discovery_state discovery;
221 struct hci_conn_hash conn_hash; 242 struct hci_conn_hash conn_hash;
222 struct list_head blacklist; 243 struct list_head blacklist;
223 244
@@ -225,6 +246,8 @@ struct hci_dev {
225 246
226 struct list_head link_keys; 247 struct list_head link_keys;
227 248
249 struct list_head long_term_keys;
250
228 struct list_head remote_oob_data; 251 struct list_head remote_oob_data;
229 252
230 struct list_head adv_entries; 253 struct list_head adv_entries;
@@ -234,7 +257,6 @@ struct hci_dev {
234 257
235 struct sk_buff_head driver_init; 258 struct sk_buff_head driver_init;
236 259
237 void *driver_data;
238 void *core_data; 260 void *core_data;
239 261
240 atomic_t promisc; 262 atomic_t promisc;
@@ -246,15 +268,17 @@ struct hci_dev {
246 268
247 struct rfkill *rfkill; 269 struct rfkill *rfkill;
248 270
249 struct module *owner;
250
251 unsigned long dev_flags; 271 unsigned long dev_flags;
252 272
273 struct delayed_work le_scan_disable;
274
275 struct work_struct le_scan;
276 struct le_scan_params le_scan_params;
277
253 int (*open)(struct hci_dev *hdev); 278 int (*open)(struct hci_dev *hdev);
254 int (*close)(struct hci_dev *hdev); 279 int (*close)(struct hci_dev *hdev);
255 int (*flush)(struct hci_dev *hdev); 280 int (*flush)(struct hci_dev *hdev);
256 int (*send)(struct sk_buff *skb); 281 int (*send)(struct sk_buff *skb);
257 void (*destruct)(struct hci_dev *hdev);
258 void (*notify)(struct hci_dev *hdev, unsigned int evt); 282 void (*notify)(struct hci_dev *hdev, unsigned int evt);
259 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); 283 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
260}; 284};
@@ -270,11 +294,10 @@ struct hci_conn {
270 __u16 state; 294 __u16 state;
271 __u8 mode; 295 __u8 mode;
272 __u8 type; 296 __u8 type;
273 __u8 out; 297 bool out;
274 __u8 attempt; 298 __u8 attempt;
275 __u8 dev_class[3]; 299 __u8 dev_class[3];
276 __u8 features[8]; 300 __u8 features[8];
277 __u8 ssp_mode;
278 __u16 interval; 301 __u16 interval;
279 __u16 pkt_type; 302 __u16 pkt_type;
280 __u16 link_policy; 303 __u16 link_policy;
@@ -286,12 +309,10 @@ struct hci_conn {
286 __u8 pin_length; 309 __u8 pin_length;
287 __u8 enc_key_size; 310 __u8 enc_key_size;
288 __u8 io_capability; 311 __u8 io_capability;
289 __u8 power_save;
290 __u16 disc_timeout; 312 __u16 disc_timeout;
291 unsigned long pend; 313 unsigned long flags;
292 314
293 __u8 remote_cap; 315 __u8 remote_cap;
294 __u8 remote_oob;
295 __u8 remote_auth; 316 __u8 remote_auth;
296 317
297 unsigned int sent; 318 unsigned int sent;
@@ -348,21 +369,26 @@ extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
348#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ 369#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */
349#define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */ 370#define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */
350 371
351static inline void inquiry_cache_init(struct hci_dev *hdev) 372static inline void discovery_init(struct hci_dev *hdev)
352{ 373{
353 struct inquiry_cache *c = &hdev->inq_cache; 374 hdev->discovery.state = DISCOVERY_STOPPED;
354 c->list = NULL; 375 INIT_LIST_HEAD(&hdev->discovery.all);
376 INIT_LIST_HEAD(&hdev->discovery.unknown);
377 INIT_LIST_HEAD(&hdev->discovery.resolve);
355} 378}
356 379
380bool hci_discovery_active(struct hci_dev *hdev);
381
382void hci_discovery_set_state(struct hci_dev *hdev, int state);
383
357static inline int inquiry_cache_empty(struct hci_dev *hdev) 384static inline int inquiry_cache_empty(struct hci_dev *hdev)
358{ 385{
359 struct inquiry_cache *c = &hdev->inq_cache; 386 return list_empty(&hdev->discovery.all);
360 return c->list == NULL;
361} 387}
362 388
363static inline long inquiry_cache_age(struct hci_dev *hdev) 389static inline long inquiry_cache_age(struct hci_dev *hdev)
364{ 390{
365 struct inquiry_cache *c = &hdev->inq_cache; 391 struct discovery_state *c = &hdev->discovery;
366 return jiffies - c->timestamp; 392 return jiffies - c->timestamp;
367} 393}
368 394
@@ -372,8 +398,16 @@ static inline long inquiry_entry_age(struct inquiry_entry *e)
372} 398}
373 399
374struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, 400struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev,
375 bdaddr_t *bdaddr); 401 bdaddr_t *bdaddr);
376void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); 402struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev,
403 bdaddr_t *bdaddr);
404struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev,
405 bdaddr_t *bdaddr,
406 int state);
407void hci_inquiry_cache_update_resolve(struct hci_dev *hdev,
408 struct inquiry_entry *ie);
409bool hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
410 bool name_known, bool *ssp);
377 411
378/* ----- HCI Connections ----- */ 412/* ----- HCI Connections ----- */
379enum { 413enum {
@@ -384,8 +418,19 @@ enum {
384 HCI_CONN_MODE_CHANGE_PEND, 418 HCI_CONN_MODE_CHANGE_PEND,
385 HCI_CONN_SCO_SETUP_PEND, 419 HCI_CONN_SCO_SETUP_PEND,
386 HCI_CONN_LE_SMP_PEND, 420 HCI_CONN_LE_SMP_PEND,
421 HCI_CONN_MGMT_CONNECTED,
422 HCI_CONN_SSP_ENABLED,
423 HCI_CONN_POWER_SAVE,
424 HCI_CONN_REMOTE_OOB,
387}; 425};
388 426
427static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
428{
429 struct hci_dev *hdev = conn->hdev;
430 return (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) &&
431 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags));
432}
433
389static inline void hci_conn_hash_init(struct hci_dev *hdev) 434static inline void hci_conn_hash_init(struct hci_dev *hdev)
390{ 435{
391 struct hci_conn_hash *h = &hdev->conn_hash; 436 struct hci_conn_hash *h = &hdev->conn_hash;
@@ -566,36 +611,33 @@ static inline void hci_conn_put(struct hci_conn *conn)
566} 611}
567 612
568/* ----- HCI Devices ----- */ 613/* ----- HCI Devices ----- */
569static inline void __hci_dev_put(struct hci_dev *d) 614static inline void hci_dev_put(struct hci_dev *d)
570{ 615{
571 if (atomic_dec_and_test(&d->refcnt)) 616 put_device(&d->dev);
572 d->destruct(d);
573} 617}
574 618
575/* 619static inline struct hci_dev *hci_dev_hold(struct hci_dev *d)
576 * hci_dev_put and hci_dev_hold are macros to avoid dragging all the
577 * overhead of all the modular infrastructure into this header.
578 */
579#define hci_dev_put(d) \
580do { \
581 __hci_dev_put(d); \
582 module_put(d->owner); \
583} while (0)
584
585static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d)
586{ 620{
587 atomic_inc(&d->refcnt); 621 get_device(&d->dev);
588 return d; 622 return d;
589} 623}
590 624
591#define hci_dev_hold(d) \
592({ \
593 try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \
594})
595
596#define hci_dev_lock(d) mutex_lock(&d->lock) 625#define hci_dev_lock(d) mutex_lock(&d->lock)
597#define hci_dev_unlock(d) mutex_unlock(&d->lock) 626#define hci_dev_unlock(d) mutex_unlock(&d->lock)
598 627
628#define to_hci_dev(d) container_of(d, struct hci_dev, dev)
629#define to_hci_conn(c) container_of(c, struct hci_conn, dev)
630
631static inline void *hci_get_drvdata(struct hci_dev *hdev)
632{
633 return dev_get_drvdata(&hdev->dev);
634}
635
636static inline void hci_set_drvdata(struct hci_dev *hdev, void *data)
637{
638 dev_set_drvdata(&hdev->dev, data);
639}
640
599struct hci_dev *hci_dev_get(int index); 641struct hci_dev *hci_dev_get(int index);
600struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); 642struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst);
601 643
@@ -619,20 +661,23 @@ int hci_inquiry(void __user *arg);
619 661
620struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); 662struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);
621int hci_blacklist_clear(struct hci_dev *hdev); 663int hci_blacklist_clear(struct hci_dev *hdev);
622int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr); 664int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
623int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr); 665int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
624 666
625int hci_uuids_clear(struct hci_dev *hdev); 667int hci_uuids_clear(struct hci_dev *hdev);
626 668
627int hci_link_keys_clear(struct hci_dev *hdev); 669int hci_link_keys_clear(struct hci_dev *hdev);
628struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 670struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
629int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, 671int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
630 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); 672 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len);
631struct link_key *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); 673struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]);
632struct link_key *hci_find_link_key_type(struct hci_dev *hdev, 674int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type,
633 bdaddr_t *bdaddr, u8 type); 675 int new_key, u8 authenticated, u8 tk[16], u8 enc_size, u16 ediv,
634int hci_add_ltk(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, 676 u8 rand[8]);
635 u8 key_size, __le16 ediv, u8 rand[8], u8 ltk[16]); 677struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
678 u8 addr_type);
679int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr);
680int hci_smp_ltks_clear(struct hci_dev *hdev);
636int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 681int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
637 682
638int hci_remote_oob_data_clear(struct hci_dev *hdev); 683int hci_remote_oob_data_clear(struct hci_dev *hdev);
@@ -674,6 +719,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
674#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 719#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR)
675#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH) 720#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH)
676#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) 721#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
722#define lmp_bredr_capable(dev) (!((dev)->features[4] & LMP_NO_BREDR))
677 723
678/* ----- Extended LMP capabilities ----- */ 724/* ----- Extended LMP capabilities ----- */
679#define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE) 725#define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE)
@@ -755,7 +801,7 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
755 if (conn->type != ACL_LINK && conn->type != LE_LINK) 801 if (conn->type != ACL_LINK && conn->type != LE_LINK)
756 return; 802 return;
757 803
758 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) 804 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
759 return; 805 return;
760 806
761 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 807 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
@@ -796,7 +842,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
796 842
797 hci_proto_auth_cfm(conn, status); 843 hci_proto_auth_cfm(conn, status);
798 844
799 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) 845 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
800 return; 846 return;
801 847
802 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00; 848 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
@@ -859,25 +905,73 @@ static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
859 read_unlock(&hci_cb_list_lock); 905 read_unlock(&hci_cb_list_lock);
860} 906}
861 907
908static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
909{
910 size_t parsed = 0;
911
912 if (data_len < 2)
913 return false;
914
915 while (parsed < data_len - 1) {
916 u8 field_len = data[0];
917
918 if (field_len == 0)
919 break;
920
921 parsed += field_len + 1;
922
923 if (parsed > data_len)
924 break;
925
926 if (data[1] == type)
927 return true;
928
929 data += field_len + 1;
930 }
931
932 return false;
933}
934
935static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
936 u8 data_len)
937{
938 eir[eir_len++] = sizeof(type) + data_len;
939 eir[eir_len++] = type;
940 memcpy(&eir[eir_len], data, data_len);
941 eir_len += data_len;
942
943 return eir_len;
944}
945
862int hci_register_cb(struct hci_cb *hcb); 946int hci_register_cb(struct hci_cb *hcb);
863int hci_unregister_cb(struct hci_cb *hcb); 947int hci_unregister_cb(struct hci_cb *hcb);
864 948
865int hci_register_notifier(struct notifier_block *nb);
866int hci_unregister_notifier(struct notifier_block *nb);
867
868int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); 949int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param);
869void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); 950void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags);
870void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); 951void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
871 952
872void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); 953void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
873 954
874void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data);
875
876/* ----- HCI Sockets ----- */ 955/* ----- HCI Sockets ----- */
877void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb, 956void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb);
878 struct sock *skip_sk); 957void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk);
958void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb);
959
960void hci_sock_dev_event(struct hci_dev *hdev, int event);
879 961
880/* Management interface */ 962/* Management interface */
963#define MGMT_ADDR_BREDR 0x00
964#define MGMT_ADDR_LE_PUBLIC 0x01
965#define MGMT_ADDR_LE_RANDOM 0x02
966#define MGMT_ADDR_INVALID 0xff
967
968#define DISCOV_TYPE_BREDR (BIT(MGMT_ADDR_BREDR))
969#define DISCOV_TYPE_LE (BIT(MGMT_ADDR_LE_PUBLIC) | \
970 BIT(MGMT_ADDR_LE_RANDOM))
971#define DISCOV_TYPE_INTERLEAVED (BIT(MGMT_ADDR_BREDR) | \
972 BIT(MGMT_ADDR_LE_PUBLIC) | \
973 BIT(MGMT_ADDR_LE_RANDOM))
974
881int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 975int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
882int mgmt_index_added(struct hci_dev *hdev); 976int mgmt_index_added(struct hci_dev *hdev);
883int mgmt_index_removed(struct hci_dev *hdev); 977int mgmt_index_removed(struct hci_dev *hdev);
@@ -886,56 +980,67 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
886int mgmt_connectable(struct hci_dev *hdev, u8 connectable); 980int mgmt_connectable(struct hci_dev *hdev, u8 connectable);
887int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 981int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
888int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 982int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
889 u8 persistent); 983 u8 persistent);
890int mgmt_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 984int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
891 u8 addr_type); 985 u8 addr_type, u32 flags, u8 *name, u8 name_len,
892int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 986 u8 *dev_class);
893 u8 addr_type); 987int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
894int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); 988 u8 link_type, u8 addr_type);
989int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
990 u8 link_type, u8 addr_type, u8 status);
895int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 991int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
896 u8 addr_type, u8 status); 992 u8 addr_type, u8 status);
897int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); 993int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
898int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 994int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
899 u8 status); 995 u8 status);
900int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 996int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
901 u8 status); 997 u8 status);
902int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, 998int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
903 __le32 value, u8 confirm_hint); 999 u8 link_type, u8 addr_type, __le32 value,
1000 u8 confirm_hint);
904int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1001int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
905 u8 status); 1002 u8 link_type, u8 addr_type, u8 status);
906int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, 1003int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
907 bdaddr_t *bdaddr, u8 status); 1004 u8 link_type, u8 addr_type, u8 status);
908int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr); 1005int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
1006 u8 link_type, u8 addr_type);
909int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1007int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
910 u8 status); 1008 u8 link_type, u8 addr_type, u8 status);
911int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, 1009int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
912 bdaddr_t *bdaddr, u8 status); 1010 u8 link_type, u8 addr_type, u8 status);
913int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); 1011int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1012 u8 addr_type, u8 status);
1013int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1014int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1015int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1016 u8 status);
914int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1017int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
915int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, 1018int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
916 u8 *randomizer, u8 status); 1019 u8 *randomizer, u8 status);
1020int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
917int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1021int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
918 u8 addr_type, u8 *dev_class, s8 rssi, u8 *eir); 1022 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
919int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name); 1023 u8 ssp, u8 *eir, u16 eir_len);
1024int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1025 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
920int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status); 1026int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
921int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status); 1027int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status);
922int mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1028int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
923int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr); 1029int mgmt_interleaved_discovery(struct hci_dev *hdev);
924int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr); 1030int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1031int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1032
1033int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent);
925 1034
926/* HCI info for socket */ 1035/* HCI info for socket */
927#define hci_pi(sk) ((struct hci_pinfo *) sk) 1036#define hci_pi(sk) ((struct hci_pinfo *) sk)
928 1037
929/* HCI socket flags */
930#define HCI_PI_MGMT_INIT 0
931
932struct hci_pinfo { 1038struct hci_pinfo {
933 struct bt_sock bt; 1039 struct bt_sock bt;
934 struct hci_dev *hdev; 1040 struct hci_dev *hdev;
935 struct hci_filter filter; 1041 struct hci_filter filter;
936 __u32 cmsg_mask; 1042 __u32 cmsg_mask;
937 unsigned short channel; 1043 unsigned short channel;
938 unsigned long flags;
939}; 1044};
940 1045
941/* HCI security filter */ 1046/* HCI security filter */
@@ -966,5 +1071,7 @@ void hci_le_ltk_neg_reply(struct hci_conn *conn);
966 1071
967int hci_do_inquiry(struct hci_dev *hdev, u8 length); 1072int hci_do_inquiry(struct hci_dev *hdev, u8 length);
968int hci_cancel_inquiry(struct hci_dev *hdev); 1073int hci_cancel_inquiry(struct hci_dev *hdev);
1074int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
1075 int timeout);
969 1076
970#endif /* __HCI_CORE_H */ 1077#endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/hci_mon.h b/include/net/bluetooth/hci_mon.h
new file mode 100644
index 000000000000..77d1e5764185
--- /dev/null
+++ b/include/net/bluetooth/hci_mon.h
@@ -0,0 +1,51 @@
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3
4 Copyright (C) 2011-2012 Intel Corporation
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 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
14 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
19 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
20 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
21 SOFTWARE IS DISCLAIMED.
22*/
23
24#ifndef __HCI_MON_H
25#define __HCI_MON_H
26
27struct hci_mon_hdr {
28 __le16 opcode;
29 __le16 index;
30 __le16 len;
31} __packed;
32#define HCI_MON_HDR_SIZE 6
33
34#define HCI_MON_NEW_INDEX 0
35#define HCI_MON_DEL_INDEX 1
36#define HCI_MON_COMMAND_PKT 2
37#define HCI_MON_EVENT_PKT 3
38#define HCI_MON_ACL_TX_PKT 4
39#define HCI_MON_ACL_RX_PKT 5
40#define HCI_MON_SCO_TX_PKT 6
41#define HCI_MON_SCO_RX_PKT 7
42
43struct hci_mon_new_index {
44 __u8 type;
45 __u8 bus;
46 bdaddr_t bdaddr;
47 char name[8];
48} __packed;
49#define HCI_MON_NEW_INDEX_SIZE 16
50
51#endif /* __HCI_MON_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index b1664ed884e6..9b242c6bf55b 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -45,11 +45,11 @@
45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF 45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF 46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF
47 47
48#define L2CAP_DISC_TIMEOUT (100) 48#define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100)
49#define L2CAP_DISC_REJ_TIMEOUT (5000) /* 5 seconds */ 49#define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000)
50#define L2CAP_ENC_TIMEOUT (5000) /* 5 seconds */ 50#define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000)
51#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 51#define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000)
52#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 52#define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000)
53 53
54/* L2CAP socket address */ 54/* L2CAP socket address */
55struct sockaddr_l2 { 55struct sockaddr_l2 {
@@ -492,51 +492,56 @@ struct l2cap_chan {
492 struct sk_buff_head srej_q; 492 struct sk_buff_head srej_q;
493 struct list_head srej_l; 493 struct list_head srej_l;
494 494
495 struct list_head list; 495 struct list_head list;
496 struct list_head global_l; 496 struct list_head global_l;
497 497
498 void *data; 498 void *data;
499 struct l2cap_ops *ops; 499 struct l2cap_ops *ops;
500 struct mutex lock;
500}; 501};
501 502
502struct l2cap_ops { 503struct l2cap_ops {
503 char *name; 504 char *name;
504 505
505 struct l2cap_chan *(*new_connection) (void *data); 506 struct l2cap_chan *(*new_connection) (void *data);
506 int (*recv) (void *data, struct sk_buff *skb); 507 int (*recv) (void *data, struct sk_buff *skb);
507 void (*close) (void *data); 508 void (*close) (void *data);
508 void (*state_change) (void *data, int state); 509 void (*state_change) (void *data, int state);
510 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
511 unsigned long len, int nb, int *err);
512
509}; 513};
510 514
511struct l2cap_conn { 515struct l2cap_conn {
512 struct hci_conn *hcon; 516 struct hci_conn *hcon;
513 struct hci_chan *hchan; 517 struct hci_chan *hchan;
514 518
515 bdaddr_t *dst; 519 bdaddr_t *dst;
516 bdaddr_t *src; 520 bdaddr_t *src;
517 521
518 unsigned int mtu; 522 unsigned int mtu;
519 523
520 __u32 feat_mask; 524 __u32 feat_mask;
525 __u8 fixed_chan_mask;
521 526
522 __u8 info_state; 527 __u8 info_state;
523 __u8 info_ident; 528 __u8 info_ident;
524 529
525 struct delayed_work info_timer; 530 struct delayed_work info_timer;
526 531
527 spinlock_t lock; 532 spinlock_t lock;
528 533
529 struct sk_buff *rx_skb; 534 struct sk_buff *rx_skb;
530 __u32 rx_len; 535 __u32 rx_len;
531 __u8 tx_ident; 536 __u8 tx_ident;
532 537
533 __u8 disc_reason; 538 __u8 disc_reason;
534 539
535 struct delayed_work security_timer; 540 struct delayed_work security_timer;
536 struct smp_chan *smp_chan; 541 struct smp_chan *smp_chan;
537 542
538 struct list_head chan_l; 543 struct list_head chan_l;
539 struct mutex chan_lock; 544 struct mutex chan_lock;
540}; 545};
541 546
542#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 547#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
@@ -551,9 +556,9 @@ struct l2cap_conn {
551#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 556#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
552 557
553struct l2cap_pinfo { 558struct l2cap_pinfo {
554 struct bt_sock bt; 559 struct bt_sock bt;
555 struct l2cap_chan *chan; 560 struct l2cap_chan *chan;
556 struct sk_buff *rx_busy_skb; 561 struct sk_buff *rx_busy_skb;
557}; 562};
558 563
559enum { 564enum {
@@ -606,21 +611,37 @@ static inline void l2cap_chan_put(struct l2cap_chan *c)
606 kfree(c); 611 kfree(c);
607} 612}
608 613
614static inline void l2cap_chan_lock(struct l2cap_chan *chan)
615{
616 mutex_lock(&chan->lock);
617}
618
619static inline void l2cap_chan_unlock(struct l2cap_chan *chan)
620{
621 mutex_unlock(&chan->lock);
622}
623
609static inline void l2cap_set_timer(struct l2cap_chan *chan, 624static inline void l2cap_set_timer(struct l2cap_chan *chan,
610 struct delayed_work *work, long timeout) 625 struct delayed_work *work, long timeout)
611{ 626{
612 BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout); 627 BT_DBG("chan %p state %s timeout %ld", chan,
628 state_to_string(chan->state), timeout);
613 629
614 if (!cancel_delayed_work(work)) 630 if (!cancel_delayed_work(work))
615 l2cap_chan_hold(chan); 631 l2cap_chan_hold(chan);
616 schedule_delayed_work(work, timeout); 632 schedule_delayed_work(work, timeout);
617} 633}
618 634
619static inline void l2cap_clear_timer(struct l2cap_chan *chan, 635static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
620 struct delayed_work *work) 636 struct delayed_work *work)
621{ 637{
622 if (cancel_delayed_work(work)) 638 bool ret;
639
640 ret = cancel_delayed_work(work);
641 if (ret)
623 l2cap_chan_put(chan); 642 l2cap_chan_put(chan);
643
644 return ret;
624} 645}
625 646
626#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) 647#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index be65d3417883..ebfd91fc20f8 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -2,6 +2,7 @@
2 BlueZ - Bluetooth protocol stack for Linux 2 BlueZ - Bluetooth protocol stack for Linux
3 3
4 Copyright (C) 2010 Nokia Corporation 4 Copyright (C) 2010 Nokia Corporation
5 Copyright (C) 2011-2012 Intel Corporation
5 6
6 This program is free software; you can redistribute it and/or modify 7 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 it under the terms of the GNU General Public License version 2 as
@@ -39,29 +40,47 @@
39#define MGMT_STATUS_INVALID_PARAMS 0x0d 40#define MGMT_STATUS_INVALID_PARAMS 0x0d
40#define MGMT_STATUS_DISCONNECTED 0x0e 41#define MGMT_STATUS_DISCONNECTED 0x0e
41#define MGMT_STATUS_NOT_POWERED 0x0f 42#define MGMT_STATUS_NOT_POWERED 0x0f
43#define MGMT_STATUS_CANCELLED 0x10
44#define MGMT_STATUS_INVALID_INDEX 0x11
42 45
43struct mgmt_hdr { 46struct mgmt_hdr {
44 __le16 opcode; 47 __le16 opcode;
45 __le16 index; 48 __le16 index;
46 __le16 len; 49 __le16 len;
47} __packed; 50} __packed;
48 51
52struct mgmt_addr_info {
53 bdaddr_t bdaddr;
54 __u8 type;
55} __packed;
56#define MGMT_ADDR_INFO_SIZE 7
57
49#define MGMT_OP_READ_VERSION 0x0001 58#define MGMT_OP_READ_VERSION 0x0001
59#define MGMT_READ_VERSION_SIZE 0
50struct mgmt_rp_read_version { 60struct mgmt_rp_read_version {
51 __u8 version; 61 __u8 version;
52 __le16 revision; 62 __le16 revision;
63} __packed;
64
65#define MGMT_OP_READ_COMMANDS 0x0002
66#define MGMT_READ_COMMANDS_SIZE 0
67struct mgmt_rp_read_commands {
68 __le16 num_commands;
69 __le16 num_events;
70 __le16 opcodes[0];
53} __packed; 71} __packed;
54 72
55#define MGMT_OP_READ_INDEX_LIST 0x0003 73#define MGMT_OP_READ_INDEX_LIST 0x0003
74#define MGMT_READ_INDEX_LIST_SIZE 0
56struct mgmt_rp_read_index_list { 75struct mgmt_rp_read_index_list {
57 __le16 num_controllers; 76 __le16 num_controllers;
58 __le16 index[0]; 77 __le16 index[0];
59} __packed; 78} __packed;
60 79
61/* Reserve one extra byte for names in management messages so that they 80/* Reserve one extra byte for names in management messages so that they
62 * are always guaranteed to be nul-terminated */ 81 * are always guaranteed to be nul-terminated */
63#define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) 82#define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1)
64#define MGMT_MAX_SHORT_NAME_LENGTH (10 + 1) 83#define MGMT_MAX_SHORT_NAME_LENGTH (HCI_MAX_SHORT_NAME_LENGTH + 1)
65 84
66#define MGMT_SETTING_POWERED 0x00000001 85#define MGMT_SETTING_POWERED 0x00000001
67#define MGMT_SETTING_CONNECTABLE 0x00000002 86#define MGMT_SETTING_CONNECTABLE 0x00000002
@@ -75,28 +94,32 @@ struct mgmt_rp_read_index_list {
75#define MGMT_SETTING_LE 0x00000200 94#define MGMT_SETTING_LE 0x00000200
76 95
77#define MGMT_OP_READ_INFO 0x0004 96#define MGMT_OP_READ_INFO 0x0004
97#define MGMT_READ_INFO_SIZE 0
78struct mgmt_rp_read_info { 98struct mgmt_rp_read_info {
79 bdaddr_t bdaddr; 99 bdaddr_t bdaddr;
80 __u8 version; 100 __u8 version;
81 __le16 manufacturer; 101 __le16 manufacturer;
82 __le32 supported_settings; 102 __le32 supported_settings;
83 __le32 current_settings; 103 __le32 current_settings;
84 __u8 dev_class[3]; 104 __u8 dev_class[3];
85 __u8 name[MGMT_MAX_NAME_LENGTH]; 105 __u8 name[MGMT_MAX_NAME_LENGTH];
86 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; 106 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
87} __packed; 107} __packed;
88 108
89struct mgmt_mode { 109struct mgmt_mode {
90 __u8 val; 110 __u8 val;
91} __packed; 111} __packed;
92 112
113#define MGMT_SETTING_SIZE 1
114
93#define MGMT_OP_SET_POWERED 0x0005 115#define MGMT_OP_SET_POWERED 0x0005
94 116
95#define MGMT_OP_SET_DISCOVERABLE 0x0006 117#define MGMT_OP_SET_DISCOVERABLE 0x0006
96struct mgmt_cp_set_discoverable { 118struct mgmt_cp_set_discoverable {
97 __u8 val; 119 __u8 val;
98 __u16 timeout; 120 __le16 timeout;
99} __packed; 121} __packed;
122#define MGMT_SET_DISCOVERABLE_SIZE 3
100 123
101#define MGMT_OP_SET_CONNECTABLE 0x0007 124#define MGMT_OP_SET_CONNECTABLE 0x0007
102 125
@@ -111,73 +134,76 @@ struct mgmt_cp_set_discoverable {
111#define MGMT_OP_SET_HS 0x000C 134#define MGMT_OP_SET_HS 0x000C
112 135
113#define MGMT_OP_SET_LE 0x000D 136#define MGMT_OP_SET_LE 0x000D
114
115#define MGMT_OP_SET_DEV_CLASS 0x000E 137#define MGMT_OP_SET_DEV_CLASS 0x000E
116struct mgmt_cp_set_dev_class { 138struct mgmt_cp_set_dev_class {
117 __u8 major; 139 __u8 major;
118 __u8 minor; 140 __u8 minor;
119} __packed; 141} __packed;
142#define MGMT_SET_DEV_CLASS_SIZE 2
120 143
121#define MGMT_OP_SET_LOCAL_NAME 0x000F 144#define MGMT_OP_SET_LOCAL_NAME 0x000F
122struct mgmt_cp_set_local_name { 145struct mgmt_cp_set_local_name {
123 __u8 name[MGMT_MAX_NAME_LENGTH]; 146 __u8 name[MGMT_MAX_NAME_LENGTH];
147 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
124} __packed; 148} __packed;
149#define MGMT_SET_LOCAL_NAME_SIZE 260
125 150
126#define MGMT_OP_ADD_UUID 0x0010 151#define MGMT_OP_ADD_UUID 0x0010
127struct mgmt_cp_add_uuid { 152struct mgmt_cp_add_uuid {
128 __u8 uuid[16]; 153 __u8 uuid[16];
129 __u8 svc_hint; 154 __u8 svc_hint;
130} __packed; 155} __packed;
156#define MGMT_ADD_UUID_SIZE 17
131 157
132#define MGMT_OP_REMOVE_UUID 0x0011 158#define MGMT_OP_REMOVE_UUID 0x0011
133struct mgmt_cp_remove_uuid { 159struct mgmt_cp_remove_uuid {
134 __u8 uuid[16]; 160 __u8 uuid[16];
135} __packed; 161} __packed;
162#define MGMT_REMOVE_UUID_SIZE 16
136 163
137struct mgmt_link_key_info { 164struct mgmt_link_key_info {
138 bdaddr_t bdaddr; 165 struct mgmt_addr_info addr;
139 u8 type; 166 __u8 type;
140 u8 val[16]; 167 __u8 val[16];
141 u8 pin_len; 168 __u8 pin_len;
142} __packed; 169} __packed;
143 170
144#define MGMT_OP_LOAD_LINK_KEYS 0x0012 171#define MGMT_OP_LOAD_LINK_KEYS 0x0012
145struct mgmt_cp_load_link_keys { 172struct mgmt_cp_load_link_keys {
146 __u8 debug_keys; 173 __u8 debug_keys;
147 __le16 key_count; 174 __le16 key_count;
148 struct mgmt_link_key_info keys[0]; 175 struct mgmt_link_key_info keys[0];
149} __packed; 176} __packed;
177#define MGMT_LOAD_LINK_KEYS_SIZE 3
150 178
151#define MGMT_OP_REMOVE_KEYS 0x0013 179struct mgmt_ltk_info {
152struct mgmt_cp_remove_keys { 180 struct mgmt_addr_info addr;
153 bdaddr_t bdaddr; 181 __u8 authenticated;
154 __u8 disconnect; 182 __u8 master;
183 __u8 enc_size;
184 __le16 ediv;
185 __u8 rand[8];
186 __u8 val[16];
155} __packed; 187} __packed;
156struct mgmt_rp_remove_keys { 188
157 bdaddr_t bdaddr; 189#define MGMT_OP_LOAD_LONG_TERM_KEYS 0x0013
158 __u8 status; 190struct mgmt_cp_load_long_term_keys {
159}; 191 __le16 key_count;
192 struct mgmt_ltk_info keys[0];
193} __packed;
194#define MGMT_LOAD_LONG_TERM_KEYS_SIZE 2
160 195
161#define MGMT_OP_DISCONNECT 0x0014 196#define MGMT_OP_DISCONNECT 0x0014
162struct mgmt_cp_disconnect { 197struct mgmt_cp_disconnect {
163 bdaddr_t bdaddr; 198 struct mgmt_addr_info addr;
164} __packed; 199} __packed;
200#define MGMT_DISCONNECT_SIZE MGMT_ADDR_INFO_SIZE
165struct mgmt_rp_disconnect { 201struct mgmt_rp_disconnect {
166 bdaddr_t bdaddr; 202 struct mgmt_addr_info addr;
167 __u8 status;
168} __packed;
169
170#define MGMT_ADDR_BREDR 0x00
171#define MGMT_ADDR_LE_PUBLIC 0x01
172#define MGMT_ADDR_LE_RANDOM 0x02
173#define MGMT_ADDR_INVALID 0xff
174
175struct mgmt_addr_info {
176 bdaddr_t bdaddr;
177 __u8 type;
178} __packed; 203} __packed;
179 204
180#define MGMT_OP_GET_CONNECTIONS 0x0015 205#define MGMT_OP_GET_CONNECTIONS 0x0015
206#define MGMT_GET_CONNECTIONS_SIZE 0
181struct mgmt_rp_get_connections { 207struct mgmt_rp_get_connections {
182 __le16 conn_count; 208 __le16 conn_count;
183 struct mgmt_addr_info addr[0]; 209 struct mgmt_addr_info addr[0];
@@ -185,124 +211,152 @@ struct mgmt_rp_get_connections {
185 211
186#define MGMT_OP_PIN_CODE_REPLY 0x0016 212#define MGMT_OP_PIN_CODE_REPLY 0x0016
187struct mgmt_cp_pin_code_reply { 213struct mgmt_cp_pin_code_reply {
188 bdaddr_t bdaddr; 214 struct mgmt_addr_info addr;
189 __u8 pin_len; 215 __u8 pin_len;
190 __u8 pin_code[16]; 216 __u8 pin_code[16];
191} __packed; 217} __packed;
218#define MGMT_PIN_CODE_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 17)
192struct mgmt_rp_pin_code_reply { 219struct mgmt_rp_pin_code_reply {
193 bdaddr_t bdaddr; 220 struct mgmt_addr_info addr;
194 uint8_t status;
195} __packed; 221} __packed;
196 222
197#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017 223#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0017
198struct mgmt_cp_pin_code_neg_reply { 224struct mgmt_cp_pin_code_neg_reply {
199 bdaddr_t bdaddr; 225 struct mgmt_addr_info addr;
200} __packed; 226} __packed;
227#define MGMT_PIN_CODE_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
201 228
202#define MGMT_OP_SET_IO_CAPABILITY 0x0018 229#define MGMT_OP_SET_IO_CAPABILITY 0x0018
203struct mgmt_cp_set_io_capability { 230struct mgmt_cp_set_io_capability {
204 __u8 io_capability; 231 __u8 io_capability;
205} __packed; 232} __packed;
233#define MGMT_SET_IO_CAPABILITY_SIZE 1
206 234
207#define MGMT_OP_PAIR_DEVICE 0x0019 235#define MGMT_OP_PAIR_DEVICE 0x0019
208struct mgmt_cp_pair_device { 236struct mgmt_cp_pair_device {
209 struct mgmt_addr_info addr; 237 struct mgmt_addr_info addr;
210 __u8 io_cap; 238 __u8 io_cap;
211} __packed; 239} __packed;
240#define MGMT_PAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
212struct mgmt_rp_pair_device { 241struct mgmt_rp_pair_device {
213 struct mgmt_addr_info addr; 242 struct mgmt_addr_info addr;
214 __u8 status;
215} __packed; 243} __packed;
216 244
217#define MGMT_OP_USER_CONFIRM_REPLY 0x001A 245#define MGMT_OP_CANCEL_PAIR_DEVICE 0x001A
246#define MGMT_CANCEL_PAIR_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
247
248#define MGMT_OP_UNPAIR_DEVICE 0x001B
249struct mgmt_cp_unpair_device {
250 struct mgmt_addr_info addr;
251 __u8 disconnect;
252} __packed;
253#define MGMT_UNPAIR_DEVICE_SIZE (MGMT_ADDR_INFO_SIZE + 1)
254struct mgmt_rp_unpair_device {
255 struct mgmt_addr_info addr;
256};
257
258#define MGMT_OP_USER_CONFIRM_REPLY 0x001C
218struct mgmt_cp_user_confirm_reply { 259struct mgmt_cp_user_confirm_reply {
219 bdaddr_t bdaddr; 260 struct mgmt_addr_info addr;
220} __packed; 261} __packed;
262#define MGMT_USER_CONFIRM_REPLY_SIZE MGMT_ADDR_INFO_SIZE
221struct mgmt_rp_user_confirm_reply { 263struct mgmt_rp_user_confirm_reply {
222 bdaddr_t bdaddr; 264 struct mgmt_addr_info addr;
223 __u8 status;
224} __packed; 265} __packed;
225 266
226#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001B 267#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x001D
227struct mgmt_cp_user_confirm_neg_reply { 268struct mgmt_cp_user_confirm_neg_reply {
228 bdaddr_t bdaddr; 269 struct mgmt_addr_info addr;
229} __packed; 270} __packed;
271#define MGMT_USER_CONFIRM_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
230 272
231#define MGMT_OP_USER_PASSKEY_REPLY 0x001C 273#define MGMT_OP_USER_PASSKEY_REPLY 0x001E
232struct mgmt_cp_user_passkey_reply { 274struct mgmt_cp_user_passkey_reply {
233 bdaddr_t bdaddr; 275 struct mgmt_addr_info addr;
234 __le32 passkey; 276 __le32 passkey;
235} __packed; 277} __packed;
278#define MGMT_USER_PASSKEY_REPLY_SIZE (MGMT_ADDR_INFO_SIZE + 4)
236struct mgmt_rp_user_passkey_reply { 279struct mgmt_rp_user_passkey_reply {
237 bdaddr_t bdaddr; 280 struct mgmt_addr_info addr;
238 __u8 status;
239} __packed; 281} __packed;
240 282
241#define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001D 283#define MGMT_OP_USER_PASSKEY_NEG_REPLY 0x001F
242struct mgmt_cp_user_passkey_neg_reply { 284struct mgmt_cp_user_passkey_neg_reply {
243 bdaddr_t bdaddr; 285 struct mgmt_addr_info addr;
244} __packed; 286} __packed;
287#define MGMT_USER_PASSKEY_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
245 288
246#define MGMT_OP_READ_LOCAL_OOB_DATA 0x001E 289#define MGMT_OP_READ_LOCAL_OOB_DATA 0x0020
290#define MGMT_READ_LOCAL_OOB_DATA_SIZE 0
247struct mgmt_rp_read_local_oob_data { 291struct mgmt_rp_read_local_oob_data {
248 __u8 hash[16]; 292 __u8 hash[16];
249 __u8 randomizer[16]; 293 __u8 randomizer[16];
250} __packed; 294} __packed;
251 295
252#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x001F 296#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021
253struct mgmt_cp_add_remote_oob_data { 297struct mgmt_cp_add_remote_oob_data {
254 bdaddr_t bdaddr; 298 struct mgmt_addr_info addr;
255 __u8 hash[16]; 299 __u8 hash[16];
256 __u8 randomizer[16]; 300 __u8 randomizer[16];
257} __packed; 301} __packed;
302#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32)
258 303
259#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0020 304#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022
260struct mgmt_cp_remove_remote_oob_data { 305struct mgmt_cp_remove_remote_oob_data {
261 bdaddr_t bdaddr; 306 struct mgmt_addr_info addr;
262} __packed; 307} __packed;
308#define MGMT_REMOVE_REMOTE_OOB_DATA_SIZE MGMT_ADDR_INFO_SIZE
263 309
264#define MGMT_OP_START_DISCOVERY 0x0021 310#define MGMT_OP_START_DISCOVERY 0x0023
265struct mgmt_cp_start_discovery { 311struct mgmt_cp_start_discovery {
266 __u8 type; 312 __u8 type;
267} __packed; 313} __packed;
314#define MGMT_START_DISCOVERY_SIZE 1
268 315
269#define MGMT_OP_STOP_DISCOVERY 0x0022 316#define MGMT_OP_STOP_DISCOVERY 0x0024
317struct mgmt_cp_stop_discovery {
318 __u8 type;
319} __packed;
320#define MGMT_STOP_DISCOVERY_SIZE 1
270 321
271#define MGMT_OP_CONFIRM_NAME 0x0023 322#define MGMT_OP_CONFIRM_NAME 0x0025
272struct mgmt_cp_confirm_name { 323struct mgmt_cp_confirm_name {
273 bdaddr_t bdaddr; 324 struct mgmt_addr_info addr;
274 __u8 name_known; 325 __u8 name_known;
275} __packed; 326} __packed;
327#define MGMT_CONFIRM_NAME_SIZE (MGMT_ADDR_INFO_SIZE + 1)
276struct mgmt_rp_confirm_name { 328struct mgmt_rp_confirm_name {
277 bdaddr_t bdaddr; 329 struct mgmt_addr_info addr;
278 __u8 status;
279} __packed; 330} __packed;
280 331
281#define MGMT_OP_BLOCK_DEVICE 0x0024 332#define MGMT_OP_BLOCK_DEVICE 0x0026
282struct mgmt_cp_block_device { 333struct mgmt_cp_block_device {
283 bdaddr_t bdaddr; 334 struct mgmt_addr_info addr;
284} __packed; 335} __packed;
336#define MGMT_BLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
285 337
286#define MGMT_OP_UNBLOCK_DEVICE 0x0025 338#define MGMT_OP_UNBLOCK_DEVICE 0x0027
287struct mgmt_cp_unblock_device { 339struct mgmt_cp_unblock_device {
288 bdaddr_t bdaddr; 340 struct mgmt_addr_info addr;
289} __packed; 341} __packed;
342#define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
290 343
291#define MGMT_EV_CMD_COMPLETE 0x0001 344#define MGMT_EV_CMD_COMPLETE 0x0001
292struct mgmt_ev_cmd_complete { 345struct mgmt_ev_cmd_complete {
293 __le16 opcode; 346 __le16 opcode;
294 __u8 data[0]; 347 __u8 status;
348 __u8 data[0];
295} __packed; 349} __packed;
296 350
297#define MGMT_EV_CMD_STATUS 0x0002 351#define MGMT_EV_CMD_STATUS 0x0002
298struct mgmt_ev_cmd_status { 352struct mgmt_ev_cmd_status {
299 __u8 status; 353 __le16 opcode;
300 __le16 opcode; 354 __u8 status;
301} __packed; 355} __packed;
302 356
303#define MGMT_EV_CONTROLLER_ERROR 0x0003 357#define MGMT_EV_CONTROLLER_ERROR 0x0003
304struct mgmt_ev_controller_error { 358struct mgmt_ev_controller_error {
305 __u8 error_code; 359 __u8 error_code;
306} __packed; 360} __packed;
307 361
308#define MGMT_EV_INDEX_ADDED 0x0004 362#define MGMT_EV_INDEX_ADDED 0x0004
@@ -313,78 +367,96 @@ struct mgmt_ev_controller_error {
313 367
314#define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007 368#define MGMT_EV_CLASS_OF_DEV_CHANGED 0x0007
315struct mgmt_ev_class_of_dev_changed { 369struct mgmt_ev_class_of_dev_changed {
316 __u8 dev_class[3]; 370 __u8 dev_class[3];
317}; 371};
318 372
319#define MGMT_EV_LOCAL_NAME_CHANGED 0x0008 373#define MGMT_EV_LOCAL_NAME_CHANGED 0x0008
320struct mgmt_ev_local_name_changed { 374struct mgmt_ev_local_name_changed {
321 __u8 name[MGMT_MAX_NAME_LENGTH]; 375 __u8 name[MGMT_MAX_NAME_LENGTH];
322 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH]; 376 __u8 short_name[MGMT_MAX_SHORT_NAME_LENGTH];
323} __packed; 377} __packed;
324 378
325#define MGMT_EV_NEW_LINK_KEY 0x0009 379#define MGMT_EV_NEW_LINK_KEY 0x0009
326struct mgmt_ev_new_link_key { 380struct mgmt_ev_new_link_key {
327 __u8 store_hint; 381 __u8 store_hint;
328 struct mgmt_link_key_info key; 382 struct mgmt_link_key_info key;
329} __packed; 383} __packed;
330 384
331#define MGMT_EV_CONNECTED 0x000A 385#define MGMT_EV_NEW_LONG_TERM_KEY 0x000A
386struct mgmt_ev_new_long_term_key {
387 __u8 store_hint;
388 struct mgmt_ltk_info key;
389} __packed;
332 390
333#define MGMT_EV_DISCONNECTED 0x000B 391#define MGMT_EV_DEVICE_CONNECTED 0x000B
392struct mgmt_ev_device_connected {
393 struct mgmt_addr_info addr;
394 __le32 flags;
395 __le16 eir_len;
396 __u8 eir[0];
397} __packed;
398
399#define MGMT_EV_DEVICE_DISCONNECTED 0x000C
334 400
335#define MGMT_EV_CONNECT_FAILED 0x000C 401#define MGMT_EV_CONNECT_FAILED 0x000D
336struct mgmt_ev_connect_failed { 402struct mgmt_ev_connect_failed {
337 struct mgmt_addr_info addr; 403 struct mgmt_addr_info addr;
338 __u8 status; 404 __u8 status;
339} __packed; 405} __packed;
340 406
341#define MGMT_EV_PIN_CODE_REQUEST 0x000D 407#define MGMT_EV_PIN_CODE_REQUEST 0x000E
342struct mgmt_ev_pin_code_request { 408struct mgmt_ev_pin_code_request {
343 bdaddr_t bdaddr; 409 struct mgmt_addr_info addr;
344 __u8 secure; 410 __u8 secure;
345} __packed; 411} __packed;
346 412
347#define MGMT_EV_USER_CONFIRM_REQUEST 0x000E 413#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
348struct mgmt_ev_user_confirm_request { 414struct mgmt_ev_user_confirm_request {
349 bdaddr_t bdaddr; 415 struct mgmt_addr_info addr;
350 __u8 confirm_hint; 416 __u8 confirm_hint;
351 __le32 value; 417 __le32 value;
352} __packed; 418} __packed;
353 419
354#define MGMT_EV_USER_PASSKEY_REQUEST 0x000F 420#define MGMT_EV_USER_PASSKEY_REQUEST 0x0010
355struct mgmt_ev_user_passkey_request { 421struct mgmt_ev_user_passkey_request {
356 bdaddr_t bdaddr; 422 struct mgmt_addr_info addr;
357} __packed; 423} __packed;
358 424
359#define MGMT_EV_AUTH_FAILED 0x0010 425#define MGMT_EV_AUTH_FAILED 0x0011
360struct mgmt_ev_auth_failed { 426struct mgmt_ev_auth_failed {
361 bdaddr_t bdaddr; 427 struct mgmt_addr_info addr;
362 __u8 status; 428 __u8 status;
363} __packed; 429} __packed;
364 430
365#define MGMT_EV_DEVICE_FOUND 0x0011 431#define MGMT_DEV_FOUND_CONFIRM_NAME 0x01
432#define MGMT_DEV_FOUND_LEGACY_PAIRING 0x02
433
434#define MGMT_EV_DEVICE_FOUND 0x0012
366struct mgmt_ev_device_found { 435struct mgmt_ev_device_found {
367 struct mgmt_addr_info addr; 436 struct mgmt_addr_info addr;
368 __u8 dev_class[3]; 437 __s8 rssi;
369 __s8 rssi; 438 __u8 flags[4];
370 __u8 confirm_name; 439 __le16 eir_len;
371 __u8 eir[HCI_MAX_EIR_LENGTH]; 440 __u8 eir[0];
372} __packed;
373
374#define MGMT_EV_REMOTE_NAME 0x0012
375struct mgmt_ev_remote_name {
376 bdaddr_t bdaddr;
377 __u8 name[MGMT_MAX_NAME_LENGTH];
378} __packed; 441} __packed;
379 442
380#define MGMT_EV_DISCOVERING 0x0013 443#define MGMT_EV_DISCOVERING 0x0013
444struct mgmt_ev_discovering {
445 __u8 type;
446 __u8 discovering;
447} __packed;
381 448
382#define MGMT_EV_DEVICE_BLOCKED 0x0014 449#define MGMT_EV_DEVICE_BLOCKED 0x0014
383struct mgmt_ev_device_blocked { 450struct mgmt_ev_device_blocked {
384 bdaddr_t bdaddr; 451 struct mgmt_addr_info addr;
385} __packed; 452} __packed;
386 453
387#define MGMT_EV_DEVICE_UNBLOCKED 0x0015 454#define MGMT_EV_DEVICE_UNBLOCKED 0x0015
388struct mgmt_ev_device_unblocked { 455struct mgmt_ev_device_unblocked {
389 bdaddr_t bdaddr; 456 struct mgmt_addr_info addr;
457} __packed;
458
459#define MGMT_EV_DEVICE_UNPAIRED 0x0016
460struct mgmt_ev_device_unpaired {
461 struct mgmt_addr_info addr;
390} __packed; 462} __packed;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index aeaf5fa2b9f1..7b3acdd29134 100644
--- a/include/net/bluetooth/smp.h
+++ b/include/net/bluetooth/smp.h
@@ -127,7 +127,7 @@ struct smp_chan {
127 u8 rrnd[16]; /* SMP Pairing Random (remote) */ 127 u8 rrnd[16]; /* SMP Pairing Random (remote) */
128 u8 pcnf[16]; /* SMP Pairing Confirm */ 128 u8 pcnf[16]; /* SMP Pairing Confirm */
129 u8 tk[16]; /* SMP Temporary Key */ 129 u8 tk[16]; /* SMP Temporary Key */
130 u8 smp_key_size; 130 u8 enc_key_size;
131 unsigned long smp_flags; 131 unsigned long smp_flags;
132 struct crypto_blkcipher *tfm; 132 struct crypto_blkcipher *tfm;
133 struct work_struct confirm; 133 struct work_struct confirm;
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index 8d552519ff67..6db8ecf52aa2 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -138,6 +138,7 @@ struct cfhsi {
138 u8 *rx_ptr; 138 u8 *rx_ptr;
139 u8 *tx_buf; 139 u8 *tx_buf;
140 u8 *rx_buf; 140 u8 *rx_buf;
141 u8 *rx_flip_buf;
141 spinlock_t lock; 142 spinlock_t lock;
142 int flow_off_sent; 143 int flow_off_sent;
143 u32 q_low_mark; 144 u32 q_low_mark;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index a067d30ce73e..83d800c31e3c 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -13,6 +13,7 @@
13#include <linux/netdevice.h> 13#include <linux/netdevice.h>
14#include <linux/debugfs.h> 14#include <linux/debugfs.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/bug.h>
16#include <linux/netlink.h> 17#include <linux/netlink.h>
17#include <linux/skbuff.h> 18#include <linux/skbuff.h>
18#include <linux/nl80211.h> 19#include <linux/nl80211.h>
@@ -120,6 +121,7 @@ enum ieee80211_channel_flags {
120 * @band: band this channel belongs to. 121 * @band: band this channel belongs to.
121 * @max_antenna_gain: maximum antenna gain in dBi 122 * @max_antenna_gain: maximum antenna gain in dBi
122 * @max_power: maximum transmission power (in dBm) 123 * @max_power: maximum transmission power (in dBm)
124 * @max_reg_power: maximum regulatory transmission power (in dBm)
123 * @beacon_found: helper to regulatory code to indicate when a beacon 125 * @beacon_found: helper to regulatory code to indicate when a beacon
124 * has been found on this channel. Use regulatory_hint_found_beacon() 126 * has been found on this channel. Use regulatory_hint_found_beacon()
125 * to enable this, this is useful only on 5 GHz band. 127 * to enable this, this is useful only on 5 GHz band.
@@ -133,6 +135,7 @@ struct ieee80211_channel {
133 u32 flags; 135 u32 flags;
134 int max_antenna_gain; 136 int max_antenna_gain;
135 int max_power; 137 int max_power;
138 int max_reg_power;
136 bool beacon_found; 139 bool beacon_found;
137 u32 orig_flags; 140 u32 orig_flags;
138 int orig_mag, orig_mpwr; 141 int orig_mag, orig_mpwr;
@@ -364,25 +367,13 @@ struct cfg80211_crypto_settings {
364}; 367};
365 368
366/** 369/**
367 * struct beacon_parameters - beacon parameters 370 * struct cfg80211_beacon_data - beacon data
368 *
369 * Used to configure the beacon for an interface.
370 *
371 * @head: head portion of beacon (before TIM IE) 371 * @head: head portion of beacon (before TIM IE)
372 * or %NULL if not changed 372 * or %NULL if not changed
373 * @tail: tail portion of beacon (after TIM IE) 373 * @tail: tail portion of beacon (after TIM IE)
374 * or %NULL if not changed 374 * or %NULL if not changed
375 * @interval: beacon interval or zero if not changed
376 * @dtim_period: DTIM period or zero if not changed
377 * @head_len: length of @head 375 * @head_len: length of @head
378 * @tail_len: length of @tail 376 * @tail_len: length of @tail
379 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
380 * user space)
381 * @ssid_len: length of @ssid
382 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
383 * @crypto: crypto settings
384 * @privacy: the BSS uses privacy
385 * @auth_type: Authentication type (algorithm)
386 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL 377 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
387 * @beacon_ies_len: length of beacon_ies in octets 378 * @beacon_ies_len: length of beacon_ies in octets
388 * @proberesp_ies: extra information element(s) to add into Probe Response 379 * @proberesp_ies: extra information element(s) to add into Probe Response
@@ -394,24 +385,48 @@ struct cfg80211_crypto_settings {
394 * @probe_resp_len: length of probe response template (@probe_resp) 385 * @probe_resp_len: length of probe response template (@probe_resp)
395 * @probe_resp: probe response template (AP mode only) 386 * @probe_resp: probe response template (AP mode only)
396 */ 387 */
397struct beacon_parameters { 388struct cfg80211_beacon_data {
398 u8 *head, *tail; 389 const u8 *head, *tail;
399 int interval, dtim_period; 390 const u8 *beacon_ies;
400 int head_len, tail_len; 391 const u8 *proberesp_ies;
392 const u8 *assocresp_ies;
393 const u8 *probe_resp;
394
395 size_t head_len, tail_len;
396 size_t beacon_ies_len;
397 size_t proberesp_ies_len;
398 size_t assocresp_ies_len;
399 size_t probe_resp_len;
400};
401
402/**
403 * struct cfg80211_ap_settings - AP configuration
404 *
405 * Used to configure an AP interface.
406 *
407 * @beacon: beacon data
408 * @beacon_interval: beacon interval
409 * @dtim_period: DTIM period
410 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
411 * user space)
412 * @ssid_len: length of @ssid
413 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
414 * @crypto: crypto settings
415 * @privacy: the BSS uses privacy
416 * @auth_type: Authentication type (algorithm)
417 * @inactivity_timeout: time in seconds to determine station's inactivity.
418 */
419struct cfg80211_ap_settings {
420 struct cfg80211_beacon_data beacon;
421
422 int beacon_interval, dtim_period;
401 const u8 *ssid; 423 const u8 *ssid;
402 size_t ssid_len; 424 size_t ssid_len;
403 enum nl80211_hidden_ssid hidden_ssid; 425 enum nl80211_hidden_ssid hidden_ssid;
404 struct cfg80211_crypto_settings crypto; 426 struct cfg80211_crypto_settings crypto;
405 bool privacy; 427 bool privacy;
406 enum nl80211_auth_type auth_type; 428 enum nl80211_auth_type auth_type;
407 const u8 *beacon_ies; 429 int inactivity_timeout;
408 size_t beacon_ies_len;
409 const u8 *proberesp_ies;
410 size_t proberesp_ies_len;
411 const u8 *assocresp_ies;
412 size_t assocresp_ies_len;
413 int probe_resp_len;
414 u8 *probe_resp;
415}; 430};
416 431
417/** 432/**
@@ -605,8 +620,10 @@ struct sta_bss_parameters {
605 * @llid: mesh local link id 620 * @llid: mesh local link id
606 * @plid: mesh peer link id 621 * @plid: mesh peer link id
607 * @plink_state: mesh peer link state 622 * @plink_state: mesh peer link state
608 * @signal: signal strength of last received packet in dBm 623 * @signal: the signal strength, type depends on the wiphy's signal_type
609 * @signal_avg: signal strength average in dBm 624 NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
625 * @signal_avg: avg signal strength, type depends on the wiphy's signal_type
626 NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
610 * @txrate: current unicast bitrate from this station 627 * @txrate: current unicast bitrate from this station
611 * @rxrate: current unicast bitrate to this station 628 * @rxrate: current unicast bitrate to this station
612 * @rx_packets: packets received from this station 629 * @rx_packets: packets received from this station
@@ -796,6 +813,8 @@ struct mesh_config {
796 * mesh gate, but not necessarily using the gate announcement protocol. 813 * mesh gate, but not necessarily using the gate announcement protocol.
797 * Still keeping the same nomenclature to be in sync with the spec. */ 814 * Still keeping the same nomenclature to be in sync with the spec. */
798 bool dot11MeshGateAnnouncementProtocol; 815 bool dot11MeshGateAnnouncementProtocol;
816 bool dot11MeshForwarding;
817 s32 rssi_threshold;
799}; 818};
800 819
801/** 820/**
@@ -1036,10 +1055,6 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1036 * @key_len: length of WEP key for shared key authentication 1055 * @key_len: length of WEP key for shared key authentication
1037 * @key_idx: index of WEP key for shared key authentication 1056 * @key_idx: index of WEP key for shared key authentication
1038 * @key: WEP key for shared key authentication 1057 * @key: WEP key for shared key authentication
1039 * @local_state_change: This is a request for a local state only, i.e., no
1040 * Authentication frame is to be transmitted and authentication state is
1041 * to be changed without having to wait for a response from the peer STA
1042 * (AP).
1043 */ 1058 */
1044struct cfg80211_auth_request { 1059struct cfg80211_auth_request {
1045 struct cfg80211_bss *bss; 1060 struct cfg80211_bss *bss;
@@ -1048,7 +1063,6 @@ struct cfg80211_auth_request {
1048 enum nl80211_auth_type auth_type; 1063 enum nl80211_auth_type auth_type;
1049 const u8 *key; 1064 const u8 *key;
1050 u8 key_len, key_idx; 1065 u8 key_len, key_idx;
1051 bool local_state_change;
1052}; 1066};
1053 1067
1054/** 1068/**
@@ -1065,7 +1079,11 @@ enum cfg80211_assoc_req_flags {
1065 * 1079 *
1066 * This structure provides information needed to complete IEEE 802.11 1080 * This structure provides information needed to complete IEEE 802.11
1067 * (re)association. 1081 * (re)association.
1068 * @bss: The BSS to associate with. 1082 * @bss: The BSS to associate with. If the call is successful the driver
1083 * is given a reference that it must release, normally via a call to
1084 * cfg80211_send_rx_assoc(), or, if association timed out, with a
1085 * call to cfg80211_put_bss() (in addition to calling
1086 * cfg80211_send_assoc_timeout())
1069 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1087 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1070 * @ie_len: Length of ie buffer in octets 1088 * @ie_len: Length of ie buffer in octets
1071 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1089 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
@@ -1093,19 +1111,16 @@ struct cfg80211_assoc_request {
1093 * This structure provides information needed to complete IEEE 802.11 1111 * This structure provides information needed to complete IEEE 802.11
1094 * deauthentication. 1112 * deauthentication.
1095 * 1113 *
1096 * @bss: the BSS to deauthenticate from 1114 * @bssid: the BSSID of the BSS to deauthenticate from
1097 * @ie: Extra IEs to add to Deauthentication frame or %NULL 1115 * @ie: Extra IEs to add to Deauthentication frame or %NULL
1098 * @ie_len: Length of ie buffer in octets 1116 * @ie_len: Length of ie buffer in octets
1099 * @reason_code: The reason code for the deauthentication 1117 * @reason_code: The reason code for the deauthentication
1100 * @local_state_change: This is a request for a local state only, i.e., no
1101 * Deauthentication frame is to be transmitted.
1102 */ 1118 */
1103struct cfg80211_deauth_request { 1119struct cfg80211_deauth_request {
1104 struct cfg80211_bss *bss; 1120 const u8 *bssid;
1105 const u8 *ie; 1121 const u8 *ie;
1106 size_t ie_len; 1122 size_t ie_len;
1107 u16 reason_code; 1123 u16 reason_code;
1108 bool local_state_change;
1109}; 1124};
1110 1125
1111/** 1126/**
@@ -1148,6 +1163,10 @@ struct cfg80211_disassoc_request {
1148 * @beacon_interval: beacon interval to use 1163 * @beacon_interval: beacon interval to use
1149 * @privacy: this is a protected network, keys will be configured 1164 * @privacy: this is a protected network, keys will be configured
1150 * after joining 1165 * after joining
1166 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
1167 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1168 * required to assume that the port is unauthorized until authorized by
1169 * user space. Otherwise, port is marked authorized by default.
1151 * @basic_rates: bitmap of basic rates to use when creating the IBSS 1170 * @basic_rates: bitmap of basic rates to use when creating the IBSS
1152 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1171 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
1153 */ 1172 */
@@ -1162,6 +1181,7 @@ struct cfg80211_ibss_params {
1162 u32 basic_rates; 1181 u32 basic_rates;
1163 bool channel_fixed; 1182 bool channel_fixed;
1164 bool privacy; 1183 bool privacy;
1184 bool control_port;
1165 int mcast_rate[IEEE80211_NUM_BANDS]; 1185 int mcast_rate[IEEE80211_NUM_BANDS];
1166}; 1186};
1167 1187
@@ -1186,6 +1206,8 @@ struct cfg80211_ibss_params {
1186 * @key_idx: index of WEP key for shared key authentication 1206 * @key_idx: index of WEP key for shared key authentication
1187 * @key: WEP key for shared key authentication 1207 * @key: WEP key for shared key authentication
1188 * @flags: See &enum cfg80211_assoc_req_flags 1208 * @flags: See &enum cfg80211_assoc_req_flags
1209 * @bg_scan_period: Background scan period in seconds
1210 * or -1 to indicate that default value is to be used.
1189 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1211 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
1190 * will be used in ht_capa. Un-supported values will be ignored. 1212 * will be used in ht_capa. Un-supported values will be ignored.
1191 * @ht_capa_mask: The bits of ht_capa which are to be used. 1213 * @ht_capa_mask: The bits of ht_capa which are to be used.
@@ -1203,6 +1225,7 @@ struct cfg80211_connect_params {
1203 const u8 *key; 1225 const u8 *key;
1204 u8 key_len, key_idx; 1226 u8 key_len, key_idx;
1205 u32 flags; 1227 u32 flags;
1228 int bg_scan_period;
1206 struct ieee80211_ht_cap ht_capa; 1229 struct ieee80211_ht_cap ht_capa;
1207 struct ieee80211_ht_cap ht_capa_mask; 1230 struct ieee80211_ht_cap ht_capa_mask;
1208}; 1231};
@@ -1229,8 +1252,7 @@ enum wiphy_params_flags {
1229struct cfg80211_bitrate_mask { 1252struct cfg80211_bitrate_mask {
1230 struct { 1253 struct {
1231 u32 legacy; 1254 u32 legacy;
1232 /* TODO: add support for masking MCS rates; e.g.: */ 1255 u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
1233 /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */
1234 } control[IEEE80211_NUM_BANDS]; 1256 } control[IEEE80211_NUM_BANDS];
1235}; 1257};
1236/** 1258/**
@@ -1343,12 +1365,10 @@ struct cfg80211_gtk_rekey_data {
1343 * 1365 *
1344 * @set_rekey_data: give the data necessary for GTK rekeying to the driver 1366 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
1345 * 1367 *
1346 * @add_beacon: Add a beacon with given parameters, @head, @interval 1368 * @start_ap: Start acting in AP mode defined by the parameters.
1347 * and @dtim_period will be valid, @tail is optional. 1369 * @change_beacon: Change the beacon parameters for an access point mode
1348 * @set_beacon: Change the beacon parameters for an access point mode 1370 * interface. This should reject the call when AP mode wasn't started.
1349 * interface. This should reject the call when no beacon has been 1371 * @stop_ap: Stop being an AP, including stopping beaconing.
1350 * configured.
1351 * @del_beacon: Remove beacon configuration and stop sending the beacon.
1352 * 1372 *
1353 * @add_station: Add a new station. 1373 * @add_station: Add a new station.
1354 * @del_station: Remove a station; @mac may be NULL to remove all stations. 1374 * @del_station: Remove a station; @mac may be NULL to remove all stations.
@@ -1515,11 +1535,11 @@ struct cfg80211_ops {
1515 struct net_device *netdev, 1535 struct net_device *netdev,
1516 u8 key_index); 1536 u8 key_index);
1517 1537
1518 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 1538 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
1519 struct beacon_parameters *info); 1539 struct cfg80211_ap_settings *settings);
1520 int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, 1540 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
1521 struct beacon_parameters *info); 1541 struct cfg80211_beacon_data *info);
1522 int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); 1542 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
1523 1543
1524 1544
1525 int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 1545 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
@@ -1574,11 +1594,9 @@ struct cfg80211_ops {
1574 int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1594 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
1575 struct cfg80211_assoc_request *req); 1595 struct cfg80211_assoc_request *req);
1576 int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 1596 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
1577 struct cfg80211_deauth_request *req, 1597 struct cfg80211_deauth_request *req);
1578 void *cookie);
1579 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1598 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
1580 struct cfg80211_disassoc_request *req, 1599 struct cfg80211_disassoc_request *req);
1581 void *cookie);
1582 1600
1583 int (*connect)(struct wiphy *wiphy, struct net_device *dev, 1601 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
1584 struct cfg80211_connect_params *sme); 1602 struct cfg80211_connect_params *sme);
@@ -2204,8 +2222,6 @@ struct cfg80211_conn;
2204struct cfg80211_internal_bss; 2222struct cfg80211_internal_bss;
2205struct cfg80211_cached_keys; 2223struct cfg80211_cached_keys;
2206 2224
2207#define MAX_AUTH_BSSES 4
2208
2209/** 2225/**
2210 * struct wireless_dev - wireless per-netdev state 2226 * struct wireless_dev - wireless per-netdev state
2211 * 2227 *
@@ -2269,8 +2285,6 @@ struct wireless_dev {
2269 struct list_head event_list; 2285 struct list_head event_list;
2270 spinlock_t event_lock; 2286 spinlock_t event_lock;
2271 2287
2272 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
2273 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
2274 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 2288 struct cfg80211_internal_bss *current_bss; /* associated / joined */
2275 struct ieee80211_channel *channel; 2289 struct ieee80211_channel *channel;
2276 2290
@@ -2686,7 +2700,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
2686 * @wiphy: the wiphy reporting the BSS 2700 * @wiphy: the wiphy reporting the BSS
2687 * @channel: The channel the frame was received on 2701 * @channel: The channel the frame was received on
2688 * @bssid: the BSSID of the BSS 2702 * @bssid: the BSSID of the BSS
2689 * @timestamp: the TSF timestamp sent by the peer 2703 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
2690 * @capability: the capability field sent by the peer 2704 * @capability: the capability field sent by the peer
2691 * @beacon_interval: the beacon interval announced by the peer 2705 * @beacon_interval: the beacon interval announced by the peer
2692 * @ie: additional IEs sent by the peer 2706 * @ie: additional IEs sent by the peer
@@ -2702,9 +2716,8 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
2702struct cfg80211_bss * __must_check 2716struct cfg80211_bss * __must_check
2703cfg80211_inform_bss(struct wiphy *wiphy, 2717cfg80211_inform_bss(struct wiphy *wiphy,
2704 struct ieee80211_channel *channel, 2718 struct ieee80211_channel *channel,
2705 const u8 *bssid, 2719 const u8 *bssid, u64 tsf, u16 capability,
2706 u64 timestamp, u16 capability, u16 beacon_interval, 2720 u16 beacon_interval, const u8 *ie, size_t ielen,
2707 const u8 *ie, size_t ielen,
2708 s32 signal, gfp_t gfp); 2721 s32 signal, gfp_t gfp);
2709 2722
2710struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 2723struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
@@ -2725,6 +2738,20 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
2725 struct ieee80211_channel *channel, 2738 struct ieee80211_channel *channel,
2726 const u8 *meshid, size_t meshidlen, 2739 const u8 *meshid, size_t meshidlen,
2727 const u8 *meshcfg); 2740 const u8 *meshcfg);
2741/**
2742 * cfg80211_ref_bss - reference BSS struct
2743 * @bss: the BSS struct to reference
2744 *
2745 * Increments the refcount of the given BSS struct.
2746 */
2747void cfg80211_ref_bss(struct cfg80211_bss *bss);
2748
2749/**
2750 * cfg80211_put_bss - unref BSS struct
2751 * @bss: the BSS struct
2752 *
2753 * Decrements the refcount of the given BSS struct.
2754 */
2728void cfg80211_put_bss(struct cfg80211_bss *bss); 2755void cfg80211_put_bss(struct cfg80211_bss *bss);
2729 2756
2730/** 2757/**
@@ -2762,20 +2789,10 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
2762void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 2789void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
2763 2790
2764/** 2791/**
2765 * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled
2766 * @dev: network device
2767 * @addr: The MAC address of the device with which the authentication timed out
2768 *
2769 * When a pending authentication had no action yet, the driver may decide
2770 * to not send a deauth frame, but in that case must calls this function
2771 * to tell cfg80211 about this decision. It is only valid to call this
2772 * function within the deauth() callback.
2773 */
2774void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr);
2775
2776/**
2777 * cfg80211_send_rx_assoc - notification of processed association 2792 * cfg80211_send_rx_assoc - notification of processed association
2778 * @dev: network device 2793 * @dev: network device
2794 * @bss: the BSS struct association was requested for, the struct reference
2795 * is owned by cfg80211 after this call
2779 * @buf: (re)association response frame (header + body) 2796 * @buf: (re)association response frame (header + body)
2780 * @len: length of the frame data 2797 * @len: length of the frame data
2781 * 2798 *
@@ -2784,7 +2801,8 @@ void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr);
2784 * function or cfg80211_send_assoc_timeout() to indicate the result of 2801 * function or cfg80211_send_assoc_timeout() to indicate the result of
2785 * cfg80211_ops::assoc() call. This function may sleep. 2802 * cfg80211_ops::assoc() call. This function may sleep.
2786 */ 2803 */
2787void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 2804void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
2805 const u8 *buf, size_t len);
2788 2806
2789/** 2807/**
2790 * cfg80211_send_assoc_timeout - notification of timed out association 2808 * cfg80211_send_assoc_timeout - notification of timed out association
@@ -3176,6 +3194,7 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3176 * cfg80211_rx_mgmt - notification of received, unprocessed management frame 3194 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
3177 * @dev: network device 3195 * @dev: network device
3178 * @freq: Frequency on which the frame was received in MHz 3196 * @freq: Frequency on which the frame was received in MHz
3197 * @sig_dbm: signal strength in mBm, or 0 if unknown
3179 * @buf: Management frame (header + body) 3198 * @buf: Management frame (header + body)
3180 * @len: length of the frame data 3199 * @len: length of the frame data
3181 * @gfp: context flags 3200 * @gfp: context flags
@@ -3188,8 +3207,8 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3188 * This function is called whenever an Action frame is received for a station 3207 * This function is called whenever an Action frame is received for a station
3189 * mode interface, but is not processed in kernel. 3208 * mode interface, but is not processed in kernel.
3190 */ 3209 */
3191bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, 3210bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm,
3192 size_t len, gfp_t gfp); 3211 const u8 *buf, size_t len, gfp_t gfp);
3193 3212
3194/** 3213/**
3195 * cfg80211_mgmt_tx_status - notification of TX status for management frame 3214 * cfg80211_mgmt_tx_status - notification of TX status for management frame
@@ -3302,6 +3321,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3302 * @frame: the frame 3321 * @frame: the frame
3303 * @len: length of the frame 3322 * @len: length of the frame
3304 * @freq: frequency the frame was received on 3323 * @freq: frequency the frame was received on
3324 * @sig_dbm: signal strength in mBm, or 0 if unknown
3305 * @gfp: allocation flags 3325 * @gfp: allocation flags
3306 * 3326 *
3307 * Use this function to report to userspace when a beacon was 3327 * Use this function to report to userspace when a beacon was
@@ -3310,7 +3330,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3310 */ 3330 */
3311void cfg80211_report_obss_beacon(struct wiphy *wiphy, 3331void cfg80211_report_obss_beacon(struct wiphy *wiphy,
3312 const u8 *frame, size_t len, 3332 const u8 *frame, size_t len,
3313 int freq, gfp_t gfp); 3333 int freq, int sig_dbm, gfp_t gfp);
3314 3334
3315/* 3335/*
3316 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used 3336 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used
@@ -3322,6 +3342,14 @@ int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
3322 struct ieee80211_channel *chan, 3342 struct ieee80211_channel *chan,
3323 enum nl80211_channel_type channel_type); 3343 enum nl80211_channel_type channel_type);
3324 3344
3345/*
3346 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
3347 * @rate: given rate_info to calculate bitrate from
3348 *
3349 * return 0 if MCS index >= 32
3350 */
3351u16 cfg80211_calculate_bitrate(struct rate_info *rate);
3352
3325/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3353/* Logging, debugging and troubleshooting/diagnostic helpers. */
3326 3354
3327/* wiphy_printk helpers, similar to dev_printk */ 3355/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/compat.h b/include/net/compat.h
index 9ee75edcc295..a974ae92d182 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -41,7 +41,7 @@ extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
41#endif /* defined(CONFIG_COMPAT) */ 41#endif /* defined(CONFIG_COMPAT) */
42 42
43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); 43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int); 44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr_storage *, int);
45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); 45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned);
46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, 46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
47 unsigned, unsigned); 47 unsigned, unsigned);
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index 2cd66d0be348..f55c980d8e23 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -72,8 +72,8 @@ struct dcbnl_rtnl_ops {
72 void (*getpfccfg)(struct net_device *, int, u8 *); 72 void (*getpfccfg)(struct net_device *, int, u8 *);
73 u8 (*setall)(struct net_device *); 73 u8 (*setall)(struct net_device *);
74 u8 (*getcap)(struct net_device *, int, u8 *); 74 u8 (*getcap)(struct net_device *, int, u8 *);
75 u8 (*getnumtcs)(struct net_device *, int, u8 *); 75 int (*getnumtcs)(struct net_device *, int, u8 *);
76 u8 (*setnumtcs)(struct net_device *, int, u8); 76 int (*setnumtcs)(struct net_device *, int, u8);
77 u8 (*getpfcstate)(struct net_device *); 77 u8 (*getpfcstate)(struct net_device *);
78 void (*setpfcstate)(struct net_device *, u8); 78 void (*setpfcstate)(struct net_device *, u8);
79 void (*getbcncfg)(struct net_device *, int, u32 *); 79 void (*getbcncfg)(struct net_device *, int, u32 *);
diff --git a/include/net/dn.h b/include/net/dn.h
index 298521e0d8a2..814af0b9387d 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/dn.h> 4#include <linux/dn.h>
5#include <net/sock.h> 5#include <net/sock.h>
6#include <net/flow.h>
6#include <asm/byteorder.h> 7#include <asm/byteorder.h>
7#include <asm/unaligned.h> 8#include <asm/unaligned.h>
8 9
diff --git a/include/net/dst.h b/include/net/dst.h
index 344c8dd02874..59c5d18cc385 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -12,6 +12,7 @@
12#include <linux/netdevice.h> 12#include <linux/netdevice.h>
13#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
14#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
15#include <linux/bug.h>
15#include <linux/jiffies.h> 16#include <linux/jiffies.h>
16#include <net/neighbour.h> 17#include <net/neighbour.h>
17#include <asm/processor.h> 18#include <asm/processor.h>
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 7db32995ccd3..ccb68880abf5 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -131,35 +131,8 @@ extern void genl_unregister_mc_group(struct genl_family *family,
131extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid, 131extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid,
132 u32 group, struct nlmsghdr *nlh, gfp_t flags); 132 u32 group, struct nlmsghdr *nlh, gfp_t flags);
133 133
134/** 134void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq,
135 * genlmsg_put - Add generic netlink header to netlink message 135 struct genl_family *family, int flags, u8 cmd);
136 * @skb: socket buffer holding the message
137 * @pid: netlink pid the message is addressed to
138 * @seq: sequence number (usually the one of the sender)
139 * @family: generic netlink family
140 * @flags netlink message flags
141 * @cmd: generic netlink command
142 *
143 * Returns pointer to user specific header
144 */
145static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq,
146 struct genl_family *family, int flags, u8 cmd)
147{
148 struct nlmsghdr *nlh;
149 struct genlmsghdr *hdr;
150
151 nlh = nlmsg_put(skb, pid, seq, family->id, GENL_HDRLEN +
152 family->hdrsize, flags);
153 if (nlh == NULL)
154 return NULL;
155
156 hdr = nlmsg_data(nlh);
157 hdr->cmd = cmd;
158 hdr->version = family->version;
159 hdr->reserved = 0;
160
161 return (char *) hdr + GENL_HDRLEN;
162}
163 136
164/** 137/**
165 * genlmsg_nlhdr - Obtain netlink header from user specified header 138 * genlmsg_nlhdr - Obtain netlink header from user specified header
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index e3e405106afe..ae17e1352d7e 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -132,6 +132,7 @@ struct rtable;
132 * @tos - TOS 132 * @tos - TOS
133 * @mc_ttl - Multicasting TTL 133 * @mc_ttl - Multicasting TTL
134 * @is_icsk - is this an inet_connection_sock? 134 * @is_icsk - is this an inet_connection_sock?
135 * @uc_index - Unicast outgoing device index
135 * @mc_index - Multicast device index 136 * @mc_index - Multicast device index
136 * @mc_list - Group array 137 * @mc_list - Group array
137 * @cork - info to build ip hdr on each ip frag while socket is corked 138 * @cork - info to build ip hdr on each ip frag while socket is corked
@@ -167,6 +168,8 @@ struct inet_sock {
167 transparent:1, 168 transparent:1,
168 mc_all:1, 169 mc_all:1,
169 nodefrag:1; 170 nodefrag:1;
171 __u8 rcv_tos;
172 int uc_index;
170 int mc_index; 173 int mc_index;
171 __be32 mc_addr; 174 __be32 mc_addr;
172 struct ip_mc_socklist __rcu *mc_list; 175 struct ip_mc_socklist __rcu *mc_list;
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 06b795dd5906..b94765e38e80 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -35,12 +35,12 @@ struct inet_peer {
35 35
36 u32 metrics[RTAX_MAX]; 36 u32 metrics[RTAX_MAX];
37 u32 rate_tokens; /* rate limiting for ICMP */ 37 u32 rate_tokens; /* rate limiting for ICMP */
38 int redirect_genid;
39 unsigned long rate_last; 38 unsigned long rate_last;
40 unsigned long pmtu_expires; 39 unsigned long pmtu_expires;
41 u32 pmtu_orig; 40 u32 pmtu_orig;
42 u32 pmtu_learned; 41 u32 pmtu_learned;
43 struct inetpeer_addr_base redirect_learned; 42 struct inetpeer_addr_base redirect_learned;
43 struct list_head gc_list;
44 /* 44 /*
45 * Once inet_peer is queued for deletion (refcnt == -1), following fields 45 * Once inet_peer is queued for deletion (refcnt == -1), following fields
46 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp 46 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp
@@ -96,6 +96,8 @@ static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr,
96extern void inet_putpeer(struct inet_peer *p); 96extern void inet_putpeer(struct inet_peer *p);
97extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); 97extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
98 98
99extern void inetpeer_invalidate_tree(int family);
100
99/* 101/*
100 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, 102 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
101 * tcp_ts_stamp if no refcount is taken on inet_peer 103 * tcp_ts_stamp if no refcount is taken on inet_peer
diff --git a/include/net/ip.h b/include/net/ip.h
index 775009f9eaba..b53d65f24f7b 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -388,7 +388,7 @@ static inline int sk_mc_loop(struct sock *sk)
388 return 1; 388 return 1;
389} 389}
390 390
391extern int ip_call_ra_chain(struct sk_buff *skb); 391extern bool ip_call_ra_chain(struct sk_buff *skb);
392 392
393/* 393/*
394 * Functions provided by ip_fragment.c 394 * Functions provided by ip_fragment.c
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index ebe517f2da9f..2bdee51ba30d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -16,6 +16,7 @@
16#include <linux/atomic.h> /* for struct atomic_t */ 16#include <linux/atomic.h> /* for struct atomic_t */
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/bug.h>
19 20
20#include <net/checksum.h> 21#include <net/checksum.h>
21#include <linux/netfilter.h> /* for union nf_inet_addr */ 22#include <linux/netfilter.h> /* for union nf_inet_addr */
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h
index 0954ec959159..cc7c19732389 100644
--- a/include/net/iucv/af_iucv.h
+++ b/include/net/iucv/af_iucv.h
@@ -62,6 +62,7 @@ struct sock_msg_q {
62#define AF_IUCV_FLAG_SYN 0x2 62#define AF_IUCV_FLAG_SYN 0x2
63#define AF_IUCV_FLAG_FIN 0x4 63#define AF_IUCV_FLAG_FIN 0x4
64#define AF_IUCV_FLAG_WIN 0x8 64#define AF_IUCV_FLAG_WIN 0x8
65#define AF_IUCV_FLAG_SHT 0x10
65 66
66struct af_iucv_trans_hdr { 67struct af_iucv_trans_hdr {
67 u16 magic; 68 u16 magic;
@@ -113,6 +114,7 @@ struct iucv_sock {
113 spinlock_t accept_q_lock; 114 spinlock_t accept_q_lock;
114 struct sock *parent; 115 struct sock *parent;
115 struct iucv_path *path; 116 struct iucv_path *path;
117 struct net_device *hs_dev;
116 struct sk_buff_head send_skb_q; 118 struct sk_buff_head send_skb_q;
117 struct sk_buff_head backlog_skb_q; 119 struct sk_buff_head backlog_skb_q;
118 struct sock_msg_q message_q; 120 struct sock_msg_q message_q;
@@ -131,6 +133,7 @@ struct iucv_sock {
131/* iucv socket options (SOL_IUCV) */ 133/* iucv socket options (SOL_IUCV) */
132#define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ 134#define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */
133#define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ 135#define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */
136#define SO_MSGSIZE 0x0800 /* get maximum msgsize */
134 137
135/* iucv related control messages (scm) */ 138/* iucv related control messages (scm) */
136#define SCM_IUCV_TRGCLS 0x0001 /* target class control message */ 139#define SCM_IUCV_TRGCLS 0x0001 /* target class control message */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d49928ba5d09..9210bdc7bd8d 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -13,10 +13,10 @@
13#ifndef MAC80211_H 13#ifndef MAC80211_H
14#define MAC80211_H 14#define MAC80211_H
15 15
16#include <linux/bug.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/if_ether.h> 18#include <linux/if_ether.h>
18#include <linux/skbuff.h> 19#include <linux/skbuff.h>
19#include <linux/device.h>
20#include <linux/ieee80211.h> 20#include <linux/ieee80211.h>
21#include <net/cfg80211.h> 21#include <net/cfg80211.h>
22#include <asm/unaligned.h> 22#include <asm/unaligned.h>
@@ -87,6 +87,8 @@
87 * 87 *
88 */ 88 */
89 89
90struct device;
91
90/** 92/**
91 * enum ieee80211_max_queues - maximum number of queues 93 * enum ieee80211_max_queues - maximum number of queues
92 * 94 *
@@ -229,7 +231,8 @@ enum ieee80211_rssi_event {
229 * valid in station mode only while @assoc is true and if also 231 * valid in station mode only while @assoc is true and if also
230 * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf 232 * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf
231 * @ps_dtim_period) 233 * @ps_dtim_period)
232 * @timestamp: beacon timestamp 234 * @last_tsf: last beacon's/probe response's TSF timestamp (could be old
235 * as it may have been received during scanning long ago)
233 * @beacon_int: beacon interval 236 * @beacon_int: beacon interval
234 * @assoc_capability: capabilities taken from assoc resp 237 * @assoc_capability: capabilities taken from assoc resp
235 * @basic_rates: bitmap of basic rates, each bit stands for an 238 * @basic_rates: bitmap of basic rates, each bit stands for an
@@ -276,7 +279,7 @@ struct ieee80211_bss_conf {
276 u8 dtim_period; 279 u8 dtim_period;
277 u16 beacon_int; 280 u16 beacon_int;
278 u16 assoc_capability; 281 u16 assoc_capability;
279 u64 timestamp; 282 u64 last_tsf;
280 u32 basic_rates; 283 u32 basic_rates;
281 int mcast_rate[IEEE80211_NUM_BANDS]; 284 int mcast_rate[IEEE80211_NUM_BANDS];
282 u16 ht_operation_mode; 285 u16 ht_operation_mode;
@@ -341,9 +344,9 @@ struct ieee80211_bss_conf {
341 * used to indicate that a frame was already retried due to PS 344 * used to indicate that a frame was already retried due to PS
342 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211, 345 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
343 * used to indicate frame should not be encrypted 346 * used to indicate frame should not be encrypted
344 * @IEEE80211_TX_CTL_POLL_RESPONSE: This frame is a response to a poll 347 * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll
345 * frame (PS-Poll or uAPSD) and should be sent although the station 348 * frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must
346 * is in powersave mode. 349 * be sent although the station is in powersave mode.
347 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the 350 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
348 * transmit function after the current frame, this can be used 351 * transmit function after the current frame, this can be used
349 * by drivers to kick the DMA queue only if unset or when the 352 * by drivers to kick the DMA queue only if unset or when the
@@ -399,7 +402,7 @@ enum mac80211_tx_control_flags {
399 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 402 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
400 IEEE80211_TX_INTFL_RETRIED = BIT(15), 403 IEEE80211_TX_INTFL_RETRIED = BIT(15),
401 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), 404 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
402 IEEE80211_TX_CTL_POLL_RESPONSE = BIT(17), 405 IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17),
403 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), 406 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
404 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), 407 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
405 /* hole at 20, use later */ 408 /* hole at 20, use later */
@@ -425,7 +428,7 @@ enum mac80211_tx_control_flags {
425 IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \ 428 IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \
426 IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \ 429 IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \
427 IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \ 430 IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \
428 IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_POLL_RESPONSE | \ 431 IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER | \
429 IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \ 432 IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \
430 IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP) 433 IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP)
431 434
@@ -659,6 +662,8 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
659 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 662 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
660 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used 663 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
661 * @RX_FLAG_SHORT_GI: Short guard interval was used 664 * @RX_FLAG_SHORT_GI: Short guard interval was used
665 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
666 * Valid only for data frames (mainly A-MPDU)
662 */ 667 */
663enum mac80211_rx_flags { 668enum mac80211_rx_flags {
664 RX_FLAG_MMIC_ERROR = 1<<0, 669 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -672,6 +677,7 @@ enum mac80211_rx_flags {
672 RX_FLAG_HT = 1<<9, 677 RX_FLAG_HT = 1<<9,
673 RX_FLAG_40MHZ = 1<<10, 678 RX_FLAG_40MHZ = 1<<10,
674 RX_FLAG_SHORT_GI = 1<<11, 679 RX_FLAG_SHORT_GI = 1<<11,
680 RX_FLAG_NO_SIGNAL_VAL = 1<<12,
675}; 681};
676 682
677/** 683/**
@@ -852,6 +858,21 @@ struct ieee80211_channel_switch {
852}; 858};
853 859
854/** 860/**
861 * enum ieee80211_vif_flags - virtual interface flags
862 *
863 * @IEEE80211_VIF_BEACON_FILTER: the device performs beacon filtering
864 * on this virtual interface to avoid unnecessary CPU wakeups
865 * @IEEE80211_VIF_SUPPORTS_CQM_RSSI: the device can do connection quality
866 * monitoring on this virtual interface -- i.e. it can monitor
867 * connection quality related parameters, such as the RSSI level and
868 * provide notifications if configured trigger levels are reached.
869 */
870enum ieee80211_vif_flags {
871 IEEE80211_VIF_BEACON_FILTER = BIT(0),
872 IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1),
873};
874
875/**
855 * struct ieee80211_vif - per-interface data 876 * struct ieee80211_vif - per-interface data
856 * 877 *
857 * Data in this structure is continually present for driver 878 * Data in this structure is continually present for driver
@@ -863,6 +884,10 @@ struct ieee80211_channel_switch {
863 * @addr: address of this interface 884 * @addr: address of this interface
864 * @p2p: indicates whether this AP or STA interface is a p2p 885 * @p2p: indicates whether this AP or STA interface is a p2p
865 * interface, i.e. a GO or p2p-sta respectively 886 * interface, i.e. a GO or p2p-sta respectively
887 * @driver_flags: flags/capabilities the driver has for this interface,
888 * these need to be set (or cleared) when the interface is added
889 * or, if supported by the driver, the interface type is changed
890 * at runtime, mac80211 will never touch this field
866 * @drv_priv: data area for driver use, will always be aligned to 891 * @drv_priv: data area for driver use, will always be aligned to
867 * sizeof(void *). 892 * sizeof(void *).
868 */ 893 */
@@ -871,6 +896,7 @@ struct ieee80211_vif {
871 struct ieee80211_bss_conf bss_conf; 896 struct ieee80211_bss_conf bss_conf;
872 u8 addr[ETH_ALEN]; 897 u8 addr[ETH_ALEN];
873 bool p2p; 898 bool p2p;
899 u32 driver_flags;
874 /* must be last */ 900 /* must be last */
875 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 901 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
876}; 902};
@@ -962,6 +988,25 @@ enum set_key_cmd {
962}; 988};
963 989
964/** 990/**
991 * enum ieee80211_sta_state - station state
992 *
993 * @IEEE80211_STA_NOTEXIST: station doesn't exist at all,
994 * this is a special state for add/remove transitions
995 * @IEEE80211_STA_NONE: station exists without special state
996 * @IEEE80211_STA_AUTH: station is authenticated
997 * @IEEE80211_STA_ASSOC: station is associated
998 * @IEEE80211_STA_AUTHORIZED: station is authorized (802.1X)
999 */
1000enum ieee80211_sta_state {
1001 /* NOTE: These need to be ordered correctly! */
1002 IEEE80211_STA_NOTEXIST,
1003 IEEE80211_STA_NONE,
1004 IEEE80211_STA_AUTH,
1005 IEEE80211_STA_ASSOC,
1006 IEEE80211_STA_AUTHORIZED,
1007};
1008
1009/**
965 * struct ieee80211_sta - station table entry 1010 * struct ieee80211_sta - station table entry
966 * 1011 *
967 * A station table entry represents a station we are possibly 1012 * A station table entry represents a station we are possibly
@@ -1079,10 +1124,6 @@ enum sta_notify_cmd {
1079 * @IEEE80211_HW_MFP_CAPABLE: 1124 * @IEEE80211_HW_MFP_CAPABLE:
1080 * Hardware supports management frame protection (MFP, IEEE 802.11w). 1125 * Hardware supports management frame protection (MFP, IEEE 802.11w).
1081 * 1126 *
1082 * @IEEE80211_HW_BEACON_FILTER:
1083 * Hardware supports dropping of irrelevant beacon frames to
1084 * avoid waking up cpu.
1085 *
1086 * @IEEE80211_HW_SUPPORTS_STATIC_SMPS: 1127 * @IEEE80211_HW_SUPPORTS_STATIC_SMPS:
1087 * Hardware supports static spatial multiplexing powersave, 1128 * Hardware supports static spatial multiplexing powersave,
1088 * ie. can turn off all but one chain even on HT connections 1129 * ie. can turn off all but one chain even on HT connections
@@ -1108,11 +1149,6 @@ enum sta_notify_cmd {
1108 * When this flag is set, signaling beacon-loss will cause an immediate 1149 * When this flag is set, signaling beacon-loss will cause an immediate
1109 * change to disassociated state. 1150 * change to disassociated state.
1110 * 1151 *
1111 * @IEEE80211_HW_SUPPORTS_CQM_RSSI:
1112 * Hardware can do connection quality monitoring - i.e. it can monitor
1113 * connection quality related parameters, such as the RSSI level and
1114 * provide notifications if configured trigger levels are reached.
1115 *
1116 * @IEEE80211_HW_NEED_DTIM_PERIOD: 1152 * @IEEE80211_HW_NEED_DTIM_PERIOD:
1117 * This device needs to know the DTIM period for the BSS before 1153 * This device needs to know the DTIM period for the BSS before
1118 * associating. 1154 * associating.
@@ -1134,6 +1170,10 @@ enum sta_notify_cmd {
1134 * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session 1170 * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session
1135 * setup strictly in HW. mac80211 should not attempt to do this in 1171 * setup strictly in HW. mac80211 should not attempt to do this in
1136 * software. 1172 * software.
1173 *
1174 * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while
1175 * being idle (i.e. mac80211 doesn't have to go idle-off during the
1176 * the scan).
1137 */ 1177 */
1138enum ieee80211_hw_flags { 1178enum ieee80211_hw_flags {
1139 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1179 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1150,16 +1190,17 @@ enum ieee80211_hw_flags {
1150 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11, 1190 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11,
1151 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, 1191 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
1152 IEEE80211_HW_MFP_CAPABLE = 1<<13, 1192 IEEE80211_HW_MFP_CAPABLE = 1<<13,
1153 IEEE80211_HW_BEACON_FILTER = 1<<14, 1193 /* reuse bit 14 */
1154 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, 1194 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15,
1155 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, 1195 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
1156 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, 1196 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
1157 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, 1197 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
1158 IEEE80211_HW_CONNECTION_MONITOR = 1<<19, 1198 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
1159 IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, 1199 /* reuse bit 20 */
1160 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, 1200 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
1161 IEEE80211_HW_AP_LINK_PS = 1<<22, 1201 IEEE80211_HW_AP_LINK_PS = 1<<22,
1162 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1202 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
1203 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24,
1163}; 1204};
1164 1205
1165/** 1206/**
@@ -1286,7 +1327,7 @@ static inline struct ieee80211_rate *
1286ieee80211_get_tx_rate(const struct ieee80211_hw *hw, 1327ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
1287 const struct ieee80211_tx_info *c) 1328 const struct ieee80211_tx_info *c)
1288{ 1329{
1289 if (WARN_ON(c->control.rates[0].idx < 0)) 1330 if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
1290 return NULL; 1331 return NULL;
1291 return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx]; 1332 return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
1292} 1333}
@@ -1446,8 +1487,8 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1446 * way the host will only receive beacons where some relevant information 1487 * way the host will only receive beacons where some relevant information
1447 * (for example ERP protection or WMM settings) have changed. 1488 * (for example ERP protection or WMM settings) have changed.
1448 * 1489 *
1449 * Beacon filter support is advertised with the %IEEE80211_HW_BEACON_FILTER 1490 * Beacon filter support is advertised with the %IEEE80211_VIF_BEACON_FILTER
1450 * hardware capability. The driver needs to enable beacon filter support 1491 * interface capability. The driver needs to enable beacon filter support
1451 * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When 1492 * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When
1452 * power save is enabled, the stack will not check for beacon loss and the 1493 * power save is enabled, the stack will not check for beacon loss and the
1453 * driver needs to notify about loss of beacons with ieee80211_beacon_loss(). 1494 * driver needs to notify about loss of beacons with ieee80211_beacon_loss().
@@ -1599,7 +1640,7 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1599 * the station sends a PS-Poll or a uAPSD trigger frame, mac80211 1640 * the station sends a PS-Poll or a uAPSD trigger frame, mac80211
1600 * will inform the driver of this with the @allow_buffered_frames 1641 * will inform the driver of this with the @allow_buffered_frames
1601 * callback; this callback is optional. mac80211 will then transmit 1642 * callback; this callback is optional. mac80211 will then transmit
1602 * the frames as usual and set the %IEEE80211_TX_CTL_POLL_RESPONSE 1643 * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER
1603 * on each frame. The last frame in the service period (or the only 1644 * on each frame. The last frame in the service period (or the only
1604 * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to 1645 * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to
1605 * indicate that it ends the service period; as this frame must have 1646 * indicate that it ends the service period; as this frame must have
@@ -1607,6 +1648,9 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1607 * When TX status is reported for this frame, the service period is 1648 * When TX status is reported for this frame, the service period is
1608 * marked has having ended and a new one can be started by the peer. 1649 * marked has having ended and a new one can be started by the peer.
1609 * 1650 *
1651 * Additionally, non-bufferable MMPDUs can also be transmitted by
1652 * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them.
1653 *
1610 * Another race condition can happen on some devices like iwlwifi 1654 * Another race condition can happen on some devices like iwlwifi
1611 * when there are frames queued for the station and it wakes up 1655 * when there are frames queued for the station and it wakes up
1612 * or polls; the frames that are already queued could end up being 1656 * or polls; the frames that are already queued could end up being
@@ -1725,20 +1769,6 @@ enum ieee80211_ampdu_mlme_action {
1725}; 1769};
1726 1770
1727/** 1771/**
1728 * enum ieee80211_tx_sync_type - TX sync type
1729 * @IEEE80211_TX_SYNC_AUTH: sync TX for authentication
1730 * (and possibly also before direct probe)
1731 * @IEEE80211_TX_SYNC_ASSOC: sync TX for association
1732 * @IEEE80211_TX_SYNC_ACTION: sync TX for action frame
1733 * (not implemented yet)
1734 */
1735enum ieee80211_tx_sync_type {
1736 IEEE80211_TX_SYNC_AUTH,
1737 IEEE80211_TX_SYNC_ASSOC,
1738 IEEE80211_TX_SYNC_ACTION,
1739};
1740
1741/**
1742 * enum ieee80211_frame_release_type - frame release reason 1772 * enum ieee80211_frame_release_type - frame release reason
1743 * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll 1773 * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll
1744 * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to 1774 * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to
@@ -1848,26 +1878,6 @@ enum ieee80211_frame_release_type {
1848 * of the bss parameters has changed when a call is made. The callback 1878 * of the bss parameters has changed when a call is made. The callback
1849 * can sleep. 1879 * can sleep.
1850 * 1880 *
1851 * @tx_sync: Called before a frame is sent to an AP/GO. In the GO case, the
1852 * driver should sync with the GO's powersaving so the device doesn't
1853 * transmit the frame while the GO is asleep. In the regular AP case
1854 * it may be used by drivers for devices implementing other restrictions
1855 * on talking to APs, e.g. due to regulatory enforcement or just HW
1856 * restrictions.
1857 * This function is called for every authentication, association and
1858 * action frame separately since applications might attempt to auth
1859 * with multiple APs before chosing one to associate to. If it returns
1860 * an error, the corresponding authentication, association or frame
1861 * transmission is aborted and reported as having failed. It is always
1862 * called after tuning to the correct channel.
1863 * The callback might be called multiple times before @finish_tx_sync
1864 * (but @finish_tx_sync will be called once for each) but in practice
1865 * this is unlikely to happen. It can also refuse in that case if the
1866 * driver cannot handle that situation.
1867 * This callback can sleep.
1868 * @finish_tx_sync: Called as a counterpart to @tx_sync, unless that returned
1869 * an error. This callback can sleep.
1870 *
1871 * @prepare_multicast: Prepare for multicast filter configuration. 1881 * @prepare_multicast: Prepare for multicast filter configuration.
1872 * This callback is optional, and its return value is passed 1882 * This callback is optional, and its return value is passed
1873 * to configure_filter(). This callback must be atomic. 1883 * to configure_filter(). This callback must be atomic.
@@ -1963,6 +1973,13 @@ enum ieee80211_frame_release_type {
1963 * in AP mode, this callback will not be called when the flag 1973 * in AP mode, this callback will not be called when the flag
1964 * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic. 1974 * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic.
1965 * 1975 *
1976 * @sta_state: Notifies low level driver about state transition of a
1977 * station (which can be the AP, a client, IBSS/WDS/mesh peer etc.)
1978 * This callback is mutually exclusive with @sta_add/@sta_remove.
1979 * It must not fail for down transitions but may fail for transitions
1980 * up the list of states.
1981 * The callback can sleep.
1982 *
1966 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1983 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1967 * bursting) for a hardware TX queue. 1984 * bursting) for a hardware TX queue.
1968 * Returns a negative error code on failure. 1985 * Returns a negative error code on failure.
@@ -2098,7 +2115,7 @@ enum ieee80211_frame_release_type {
2098 * @allow_buffered_frames: Prepare device to allow the given number of frames 2115 * @allow_buffered_frames: Prepare device to allow the given number of frames
2099 * to go out to the given station. The frames will be sent by mac80211 2116 * to go out to the given station. The frames will be sent by mac80211
2100 * via the usual TX path after this call. The TX information for frames 2117 * via the usual TX path after this call. The TX information for frames
2101 * released will also have the %IEEE80211_TX_CTL_POLL_RESPONSE flag set 2118 * released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set
2102 * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case 2119 * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case
2103 * frames from multiple TIDs are released and the driver might reorder 2120 * frames from multiple TIDs are released and the driver might reorder
2104 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag 2121 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
@@ -2132,13 +2149,6 @@ struct ieee80211_ops {
2132 struct ieee80211_bss_conf *info, 2149 struct ieee80211_bss_conf *info,
2133 u32 changed); 2150 u32 changed);
2134 2151
2135 int (*tx_sync)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2136 const u8 *bssid, enum ieee80211_tx_sync_type type);
2137 void (*finish_tx_sync)(struct ieee80211_hw *hw,
2138 struct ieee80211_vif *vif,
2139 const u8 *bssid,
2140 enum ieee80211_tx_sync_type type);
2141
2142 u64 (*prepare_multicast)(struct ieee80211_hw *hw, 2152 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
2143 struct netdev_hw_addr_list *mc_list); 2153 struct netdev_hw_addr_list *mc_list);
2144 void (*configure_filter)(struct ieee80211_hw *hw, 2154 void (*configure_filter)(struct ieee80211_hw *hw,
@@ -2182,6 +2192,10 @@ struct ieee80211_ops {
2182 struct ieee80211_sta *sta); 2192 struct ieee80211_sta *sta);
2183 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2193 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2184 enum sta_notify_cmd, struct ieee80211_sta *sta); 2194 enum sta_notify_cmd, struct ieee80211_sta *sta);
2195 int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2196 struct ieee80211_sta *sta,
2197 enum ieee80211_sta_state old_state,
2198 enum ieee80211_sta_state new_state);
2185 int (*conf_tx)(struct ieee80211_hw *hw, 2199 int (*conf_tx)(struct ieee80211_hw *hw,
2186 struct ieee80211_vif *vif, u16 queue, 2200 struct ieee80211_vif *vif, u16 queue,
2187 const struct ieee80211_tx_queue_params *params); 2201 const struct ieee80211_tx_queue_params *params);
@@ -3316,7 +3330,7 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
3316 * 3330 *
3317 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3331 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3318 * 3332 *
3319 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER and 3333 * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER and
3320 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the 3334 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the
3321 * hardware is not receiving beacons with this function. 3335 * hardware is not receiving beacons with this function.
3322 */ 3336 */
@@ -3327,7 +3341,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif);
3327 * 3341 *
3328 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3342 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3329 * 3343 *
3330 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER, and 3344 * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER, and
3331 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver 3345 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
3332 * needs to inform if the connection to the AP has been lost. 3346 * needs to inform if the connection to the AP has been lost.
3333 * 3347 *
@@ -3397,7 +3411,7 @@ void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif);
3397 * @rssi_event: the RSSI trigger event type 3411 * @rssi_event: the RSSI trigger event type
3398 * @gfp: context flags 3412 * @gfp: context flags
3399 * 3413 *
3400 * When the %IEEE80211_HW_SUPPORTS_CQM_RSSI is set, and a connection quality 3414 * When the %IEEE80211_VIF_SUPPORTS_CQM_RSSI is set, and a connection quality
3401 * monitoring is configured with an rssi threshold, the driver will inform 3415 * monitoring is configured with an rssi threshold, the driver will inform
3402 * whenever the rssi level reaches the threshold. 3416 * whenever the rssi level reaches the threshold.
3403 */ 3417 */
@@ -3516,6 +3530,8 @@ enum rate_control_changed {
3516 * @hw: The hardware the algorithm is invoked for. 3530 * @hw: The hardware the algorithm is invoked for.
3517 * @sband: The band this frame is being transmitted on. 3531 * @sband: The band this frame is being transmitted on.
3518 * @bss_conf: the current BSS configuration 3532 * @bss_conf: the current BSS configuration
3533 * @skb: the skb that will be transmitted, the control information in it needs
3534 * to be filled in
3519 * @reported_rate: The rate control algorithm can fill this in to indicate 3535 * @reported_rate: The rate control algorithm can fill this in to indicate
3520 * which rate should be reported to userspace as the current rate and 3536 * which rate should be reported to userspace as the current rate and
3521 * used for rate calculations in the mesh network. 3537 * used for rate calculations in the mesh network.
@@ -3523,12 +3539,11 @@ enum rate_control_changed {
3523 * RTS threshold 3539 * RTS threshold
3524 * @short_preamble: whether mac80211 will request short-preamble transmission 3540 * @short_preamble: whether mac80211 will request short-preamble transmission
3525 * if the selected rate supports it 3541 * if the selected rate supports it
3526 * @max_rate_idx: user-requested maximum rate (not MCS for now) 3542 * @max_rate_idx: user-requested maximum (legacy) rate
3527 * (deprecated; this will be removed once drivers get updated to use 3543 * (deprecated; this will be removed once drivers get updated to use
3528 * rate_idx_mask) 3544 * rate_idx_mask)
3529 * @rate_idx_mask: user-requested rate mask (not MCS for now) 3545 * @rate_idx_mask: user-requested (legacy) rate mask
3530 * @skb: the skb that will be transmitted, the control information in it needs 3546 * @rate_idx_mcs_mask: user-requested MCS rate mask
3531 * to be filled in
3532 * @bss: whether this frame is sent out in AP or IBSS mode 3547 * @bss: whether this frame is sent out in AP or IBSS mode
3533 */ 3548 */
3534struct ieee80211_tx_rate_control { 3549struct ieee80211_tx_rate_control {
@@ -3540,6 +3555,7 @@ struct ieee80211_tx_rate_control {
3540 bool rts, short_preamble; 3555 bool rts, short_preamble;
3541 u8 max_rate_idx; 3556 u8 max_rate_idx;
3542 u32 rate_idx_mask; 3557 u32 rate_idx_mask;
3558 u8 rate_idx_mcs_mask[IEEE80211_HT_MCS_MASK_LEN];
3543 bool bss; 3559 bool bss;
3544}; 3560};
3545 3561
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index e3133c23980e..6f9c25a76cd1 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -133,7 +133,6 @@ extern void ndisc_send_rs(struct net_device *dev,
133 const struct in6_addr *daddr); 133 const struct in6_addr *daddr);
134 134
135extern void ndisc_send_redirect(struct sk_buff *skb, 135extern void ndisc_send_redirect(struct sk_buff *skb,
136 struct neighbour *neigh,
137 const struct in6_addr *target); 136 const struct in6_addr *target);
138 137
139extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, 138extern int ndisc_mc_map(const struct in6_addr *addr, char *buf,
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 2dcf31703acb..96755c3798a5 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -20,6 +20,9 @@ enum nf_ct_ext_id {
20#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP 20#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
21 NF_CT_EXT_TSTAMP, 21 NF_CT_EXT_TSTAMP,
22#endif 22#endif
23#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
24 NF_CT_EXT_TIMEOUT,
25#endif
23 NF_CT_EXT_NUM, 26 NF_CT_EXT_NUM,
24}; 27};
25 28
@@ -29,6 +32,7 @@ enum nf_ct_ext_id {
29#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache 32#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
30#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone 33#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
31#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp 34#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp
35#define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout
32 36
33/* Extensions: optional stuff which isn't permanently in struct. */ 37/* Extensions: optional stuff which isn't permanently in struct. */
34struct nf_ct_ext { 38struct nf_ct_ext {
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index f1c1311adc2c..5767dc242dee 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -69,4 +69,17 @@ extern int nf_conntrack_broadcast_help(struct sk_buff *skb,
69 enum ip_conntrack_info ctinfo, 69 enum ip_conntrack_info ctinfo,
70 unsigned int timeout); 70 unsigned int timeout);
71 71
72struct nf_ct_helper_expectfn {
73 struct list_head head;
74 const char *name;
75 void (*expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp);
76};
77
78void nf_ct_helper_expectfn_register(struct nf_ct_helper_expectfn *n);
79void nf_ct_helper_expectfn_unregister(struct nf_ct_helper_expectfn *n);
80struct nf_ct_helper_expectfn *
81nf_ct_helper_expectfn_find_by_name(const char *name);
82struct nf_ct_helper_expectfn *
83nf_ct_helper_expectfn_find_by_symbol(const void *symbol);
84
72#endif /*_NF_CONNTRACK_HELPER_H*/ 85#endif /*_NF_CONNTRACK_HELPER_H*/
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index e3d3ee3c06a2..3b572bb20aa2 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -39,12 +39,13 @@ struct nf_conntrack_l4proto {
39 unsigned int dataoff, 39 unsigned int dataoff,
40 enum ip_conntrack_info ctinfo, 40 enum ip_conntrack_info ctinfo,
41 u_int8_t pf, 41 u_int8_t pf,
42 unsigned int hooknum); 42 unsigned int hooknum,
43 unsigned int *timeouts);
43 44
44 /* Called when a new connection for this protocol found; 45 /* Called when a new connection for this protocol found;
45 * returns TRUE if it's OK. If so, packet() called next. */ 46 * returns TRUE if it's OK. If so, packet() called next. */
46 bool (*new)(struct nf_conn *ct, const struct sk_buff *skb, 47 bool (*new)(struct nf_conn *ct, const struct sk_buff *skb,
47 unsigned int dataoff); 48 unsigned int dataoff, unsigned int *timeouts);
48 49
49 /* Called when a conntrack entry is destroyed */ 50 /* Called when a conntrack entry is destroyed */
50 void (*destroy)(struct nf_conn *ct); 51 void (*destroy)(struct nf_conn *ct);
@@ -60,6 +61,9 @@ struct nf_conntrack_l4proto {
60 /* Print out the private part of the conntrack. */ 61 /* Print out the private part of the conntrack. */
61 int (*print_conntrack)(struct seq_file *s, struct nf_conn *); 62 int (*print_conntrack)(struct seq_file *s, struct nf_conn *);
62 63
64 /* Return the array of timeouts for this protocol. */
65 unsigned int *(*get_timeouts)(struct net *net);
66
63 /* convert protoinfo to nfnetink attributes */ 67 /* convert protoinfo to nfnetink attributes */
64 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, 68 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla,
65 struct nf_conn *ct); 69 struct nf_conn *ct);
@@ -79,6 +83,17 @@ struct nf_conntrack_l4proto {
79 83
80 size_t nla_size; 84 size_t nla_size;
81 85
86#if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT)
87 struct {
88 size_t obj_size;
89 int (*nlattr_to_obj)(struct nlattr *tb[], void *data);
90 int (*obj_to_nlattr)(struct sk_buff *skb, const void *data);
91
92 unsigned int nlattr_max;
93 const struct nla_policy *nla_policy;
94 } ctnl_timeout;
95#endif
96
82#ifdef CONFIG_SYSCTL 97#ifdef CONFIG_SYSCTL
83 struct ctl_table_header **ctl_table_header; 98 struct ctl_table_header **ctl_table_header;
84 struct ctl_table *ctl_table; 99 struct ctl_table *ctl_table;
@@ -103,6 +118,10 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
103extern struct nf_conntrack_l4proto * 118extern struct nf_conntrack_l4proto *
104__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); 119__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto);
105 120
121extern struct nf_conntrack_l4proto *
122nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t l4proto);
123extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
124
106/* Protocol registration. */ 125/* Protocol registration. */
107extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto); 126extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto);
108extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto); 127extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto);
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
new file mode 100644
index 000000000000..34ec89f8dbf9
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_timeout.h
@@ -0,0 +1,78 @@
1#ifndef _NF_CONNTRACK_TIMEOUT_H
2#define _NF_CONNTRACK_TIMEOUT_H
3
4#include <net/net_namespace.h>
5#include <linux/netfilter/nf_conntrack_common.h>
6#include <linux/netfilter/nf_conntrack_tuple_common.h>
7#include <net/netfilter/nf_conntrack.h>
8#include <net/netfilter/nf_conntrack_extend.h>
9
10#define CTNL_TIMEOUT_NAME_MAX 32
11
12struct ctnl_timeout {
13 struct list_head head;
14 struct rcu_head rcu_head;
15 atomic_t refcnt;
16 char name[CTNL_TIMEOUT_NAME_MAX];
17 __u16 l3num;
18 struct nf_conntrack_l4proto *l4proto;
19 char data[0];
20};
21
22struct nf_conn_timeout {
23 struct ctnl_timeout *timeout;
24};
25
26#define NF_CT_TIMEOUT_EXT_DATA(__t) (unsigned int *) &((__t)->timeout->data)
27
28static inline
29struct nf_conn_timeout *nf_ct_timeout_find(const struct nf_conn *ct)
30{
31#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
32 return nf_ct_ext_find(ct, NF_CT_EXT_TIMEOUT);
33#else
34 return NULL;
35#endif
36}
37
38static inline
39struct nf_conn_timeout *nf_ct_timeout_ext_add(struct nf_conn *ct,
40 struct ctnl_timeout *timeout,
41 gfp_t gfp)
42{
43#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
44 struct nf_conn_timeout *timeout_ext;
45
46 timeout_ext = nf_ct_ext_add(ct, NF_CT_EXT_TIMEOUT, gfp);
47 if (timeout_ext == NULL)
48 return NULL;
49
50 timeout_ext->timeout = timeout;
51
52 return timeout_ext;
53#else
54 return NULL;
55#endif
56};
57
58#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
59extern int nf_conntrack_timeout_init(struct net *net);
60extern void nf_conntrack_timeout_fini(struct net *net);
61#else
62static inline int nf_conntrack_timeout_init(struct net *net)
63{
64 return 0;
65}
66
67static inline void nf_conntrack_timeout_fini(struct net *net)
68{
69 return;
70}
71#endif /* CONFIG_NF_CONNTRACK_TIMEOUT */
72
73#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
74extern struct ctnl_timeout *(*nf_ct_timeout_find_get_hook)(const char *name);
75extern void (*nf_ct_timeout_put_hook)(struct ctnl_timeout *timeout);
76#endif
77
78#endif /* _NF_CONNTRACK_TIMEOUT_H */
diff --git a/include/net/netfilter/xt_log.h b/include/net/netfilter/xt_log.h
index 0dfb34a5b53c..9d9756cca013 100644
--- a/include/net/netfilter/xt_log.h
+++ b/include/net/netfilter/xt_log.h
@@ -6,7 +6,7 @@ struct sbuff {
6}; 6};
7static struct sbuff emergency, *emergency_ptr = &emergency; 7static struct sbuff emergency, *emergency_ptr = &emergency;
8 8
9static int sb_add(struct sbuff *m, const char *f, ...) 9static __printf(2, 3) int sb_add(struct sbuff *m, const char *f, ...)
10{ 10{
11 va_list args; 11 va_list args;
12 int len; 12 int len;
@@ -47,7 +47,7 @@ static void sb_close(struct sbuff *m)
47 if (likely(m != &emergency)) 47 if (likely(m != &emergency))
48 kfree(m); 48 kfree(m);
49 else { 49 else {
50 xchg(&emergency_ptr, m); 50 emergency_ptr = m;
51 local_bh_enable(); 51 local_bh_enable();
52 } 52 }
53} 53}
diff --git a/include/net/netlink.h b/include/net/netlink.h
index cb1f3504687f..f394fe5d7641 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -441,41 +441,6 @@ static inline int nlmsg_report(const struct nlmsghdr *nlh)
441 nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \ 441 nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \
442 nlmsg_attrlen(nlh, hdrlen), rem) 442 nlmsg_attrlen(nlh, hdrlen), rem)
443 443
444#if 0
445/* FIXME: Enable once all users have been converted */
446
447/**
448 * __nlmsg_put - Add a new netlink message to an skb
449 * @skb: socket buffer to store message in
450 * @pid: netlink process id
451 * @seq: sequence number of message
452 * @type: message type
453 * @payload: length of message payload
454 * @flags: message flags
455 *
456 * The caller is responsible to ensure that the skb provides enough
457 * tailroom for both the netlink header and payload.
458 */
459static inline struct nlmsghdr *__nlmsg_put(struct sk_buff *skb, u32 pid,
460 u32 seq, int type, int payload,
461 int flags)
462{
463 struct nlmsghdr *nlh;
464
465 nlh = (struct nlmsghdr *) skb_put(skb, nlmsg_total_size(payload));
466 nlh->nlmsg_type = type;
467 nlh->nlmsg_len = nlmsg_msg_size(payload);
468 nlh->nlmsg_flags = flags;
469 nlh->nlmsg_pid = pid;
470 nlh->nlmsg_seq = seq;
471
472 memset((unsigned char *) nlmsg_data(nlh) + payload, 0,
473 nlmsg_padlen(payload));
474
475 return nlh;
476}
477#endif
478
479/** 444/**
480 * nlmsg_put - Add a new netlink message to an skb 445 * nlmsg_put - Add a new netlink message to an skb
481 * @skb: socket buffer to store message in 446 * @skb: socket buffer to store message in
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index d55f43443335..0931618c0f7f 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -5,6 +5,7 @@
5#ifndef __NET_GENERIC_H__ 5#ifndef __NET_GENERIC_H__
6#define __NET_GENERIC_H__ 6#define __NET_GENERIC_H__
7 7
8#include <linux/bug.h>
8#include <linux/rcupdate.h> 9#include <linux/rcupdate.h>
9 10
10/* 11/*
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 2be95e2626c0..276094b91d7c 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -116,6 +116,11 @@
116#define NCI_DISC_MAP_MODE_POLL 0x01 116#define NCI_DISC_MAP_MODE_POLL 0x01
117#define NCI_DISC_MAP_MODE_LISTEN 0x02 117#define NCI_DISC_MAP_MODE_LISTEN 0x02
118 118
119/* NCI Discover Notification Type */
120#define NCI_DISCOVER_NTF_TYPE_LAST 0x00
121#define NCI_DISCOVER_NTF_TYPE_LAST_NFCC 0x01
122#define NCI_DISCOVER_NTF_TYPE_MORE 0x02
123
119/* NCI Deactivation Type */ 124/* NCI Deactivation Type */
120#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00 125#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00
121#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01 126#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01
@@ -207,6 +212,13 @@ struct nci_rf_disc_cmd {
207 struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS]; 212 struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS];
208} __packed; 213} __packed;
209 214
215#define NCI_OP_RF_DISCOVER_SELECT_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
216struct nci_rf_discover_select_cmd {
217 __u8 rf_discovery_id;
218 __u8 rf_protocol;
219 __u8 rf_interface;
220} __packed;
221
210#define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 222#define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
211struct nci_rf_deactivate_cmd { 223struct nci_rf_deactivate_cmd {
212 __u8 type; 224 __u8 type;
@@ -244,6 +256,8 @@ struct nci_core_init_rsp_2 {
244 256
245#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) 257#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
246 258
259#define NCI_OP_RF_DISCOVER_SELECT_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x04)
260
247#define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06) 261#define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
248 262
249/* --------------------------- */ 263/* --------------------------- */
@@ -260,13 +274,15 @@ struct nci_core_conn_credit_ntf {
260 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN]; 274 struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN];
261} __packed; 275} __packed;
262 276
277#define NCI_OP_CORE_GENERIC_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x07)
278
263#define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08) 279#define NCI_OP_CORE_INTF_ERROR_NTF nci_opcode_pack(NCI_GID_CORE, 0x08)
264struct nci_core_intf_error_ntf { 280struct nci_core_intf_error_ntf {
265 __u8 status; 281 __u8 status;
266 __u8 conn_id; 282 __u8 conn_id;
267} __packed; 283} __packed;
268 284
269#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05) 285#define NCI_OP_RF_DISCOVER_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
270struct rf_tech_specific_params_nfca_poll { 286struct rf_tech_specific_params_nfca_poll {
271 __u16 sens_res; 287 __u16 sens_res;
272 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ 288 __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */
@@ -275,11 +291,43 @@ struct rf_tech_specific_params_nfca_poll {
275 __u8 sel_res; 291 __u8 sel_res;
276} __packed; 292} __packed;
277 293
294struct rf_tech_specific_params_nfcb_poll {
295 __u8 sensb_res_len;
296 __u8 sensb_res[12]; /* 11 or 12 Bytes */
297} __packed;
298
299struct rf_tech_specific_params_nfcf_poll {
300 __u8 bit_rate;
301 __u8 sensf_res_len;
302 __u8 sensf_res[18]; /* 16 or 18 Bytes */
303} __packed;
304
305struct nci_rf_discover_ntf {
306 __u8 rf_discovery_id;
307 __u8 rf_protocol;
308 __u8 rf_tech_and_mode;
309 __u8 rf_tech_specific_params_len;
310
311 union {
312 struct rf_tech_specific_params_nfca_poll nfca_poll;
313 struct rf_tech_specific_params_nfcb_poll nfcb_poll;
314 struct rf_tech_specific_params_nfcf_poll nfcf_poll;
315 } rf_tech_specific_params;
316
317 __u8 ntf_type;
318} __packed;
319
320#define NCI_OP_RF_INTF_ACTIVATED_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
278struct activation_params_nfca_poll_iso_dep { 321struct activation_params_nfca_poll_iso_dep {
279 __u8 rats_res_len; 322 __u8 rats_res_len;
280 __u8 rats_res[20]; 323 __u8 rats_res[20];
281}; 324};
282 325
326struct activation_params_nfcb_poll_iso_dep {
327 __u8 attrib_res_len;
328 __u8 attrib_res[50];
329};
330
283struct nci_rf_intf_activated_ntf { 331struct nci_rf_intf_activated_ntf {
284 __u8 rf_discovery_id; 332 __u8 rf_discovery_id;
285 __u8 rf_interface; 333 __u8 rf_interface;
@@ -291,6 +339,8 @@ struct nci_rf_intf_activated_ntf {
291 339
292 union { 340 union {
293 struct rf_tech_specific_params_nfca_poll nfca_poll; 341 struct rf_tech_specific_params_nfca_poll nfca_poll;
342 struct rf_tech_specific_params_nfcb_poll nfcb_poll;
343 struct rf_tech_specific_params_nfcf_poll nfcf_poll;
294 } rf_tech_specific_params; 344 } rf_tech_specific_params;
295 345
296 __u8 data_exch_rf_tech_and_mode; 346 __u8 data_exch_rf_tech_and_mode;
@@ -300,6 +350,7 @@ struct nci_rf_intf_activated_ntf {
300 350
301 union { 351 union {
302 struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; 352 struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep;
353 struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep;
303 } activation_params; 354 } activation_params;
304 355
305} __packed; 356} __packed;
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index bccd89e9d4c2..feba74027ff8 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -34,21 +34,31 @@
34#include <net/nfc/nfc.h> 34#include <net/nfc/nfc.h>
35#include <net/nfc/nci.h> 35#include <net/nfc/nci.h>
36 36
37/* NCI device state */ 37/* NCI device flags */
38enum { 38enum nci_flag {
39 NCI_INIT, 39 NCI_INIT,
40 NCI_UP, 40 NCI_UP,
41 NCI_DATA_EXCHANGE,
42 NCI_DATA_EXCHANGE_TO,
43};
44
45/* NCI device states */
46enum nci_state {
47 NCI_IDLE,
41 NCI_DISCOVERY, 48 NCI_DISCOVERY,
49 NCI_W4_ALL_DISCOVERIES,
50 NCI_W4_HOST_SELECT,
42 NCI_POLL_ACTIVE, 51 NCI_POLL_ACTIVE,
43 NCI_DATA_EXCHANGE,
44}; 52};
45 53
46/* NCI timeouts */ 54/* NCI timeouts */
47#define NCI_RESET_TIMEOUT 5000 55#define NCI_RESET_TIMEOUT 5000
48#define NCI_INIT_TIMEOUT 5000 56#define NCI_INIT_TIMEOUT 5000
49#define NCI_RF_DISC_TIMEOUT 5000 57#define NCI_RF_DISC_TIMEOUT 5000
50#define NCI_RF_DEACTIVATE_TIMEOUT 5000 58#define NCI_RF_DISC_SELECT_TIMEOUT 5000
59#define NCI_RF_DEACTIVATE_TIMEOUT 30000
51#define NCI_CMD_TIMEOUT 5000 60#define NCI_CMD_TIMEOUT 5000
61#define NCI_DATA_TIMEOUT 700
52 62
53struct nci_dev; 63struct nci_dev;
54 64
@@ -59,6 +69,7 @@ struct nci_ops {
59}; 69};
60 70
61#define NCI_MAX_SUPPORTED_RF_INTERFACES 4 71#define NCI_MAX_SUPPORTED_RF_INTERFACES 4
72#define NCI_MAX_DISCOVERED_TARGETS 10
62 73
63/* NCI Core structures */ 74/* NCI Core structures */
64struct nci_dev { 75struct nci_dev {
@@ -68,12 +79,14 @@ struct nci_dev {
68 int tx_headroom; 79 int tx_headroom;
69 int tx_tailroom; 80 int tx_tailroom;
70 81
82 atomic_t state;
71 unsigned long flags; 83 unsigned long flags;
72 84
73 atomic_t cmd_cnt; 85 atomic_t cmd_cnt;
74 atomic_t credits_cnt; 86 atomic_t credits_cnt;
75 87
76 struct timer_list cmd_timer; 88 struct timer_list cmd_timer;
89 struct timer_list data_timer;
77 90
78 struct workqueue_struct *cmd_wq; 91 struct workqueue_struct *cmd_wq;
79 struct work_struct cmd_work; 92 struct work_struct cmd_work;
@@ -96,9 +109,11 @@ struct nci_dev {
96 void *driver_data; 109 void *driver_data;
97 110
98 __u32 poll_prots; 111 __u32 poll_prots;
99 __u32 target_available_prots;
100 __u32 target_active_prot; 112 __u32 target_active_prot;
101 113
114 struct nfc_target targets[NCI_MAX_DISCOVERED_TARGETS];
115 int n_targets;
116
102 /* received during NCI_OP_CORE_RESET_RSP */ 117 /* received during NCI_OP_CORE_RESET_RSP */
103 __u8 nci_ver; 118 __u8 nci_ver;
104 119
@@ -126,17 +141,17 @@ struct nci_dev {
126 141
127/* ----- NCI Devices ----- */ 142/* ----- NCI Devices ----- */
128struct nci_dev *nci_allocate_device(struct nci_ops *ops, 143struct nci_dev *nci_allocate_device(struct nci_ops *ops,
129 __u32 supported_protocols, 144 __u32 supported_protocols,
130 int tx_headroom, 145 int tx_headroom,
131 int tx_tailroom); 146 int tx_tailroom);
132void nci_free_device(struct nci_dev *ndev); 147void nci_free_device(struct nci_dev *ndev);
133int nci_register_device(struct nci_dev *ndev); 148int nci_register_device(struct nci_dev *ndev);
134void nci_unregister_device(struct nci_dev *ndev); 149void nci_unregister_device(struct nci_dev *ndev);
135int nci_recv_frame(struct sk_buff *skb); 150int nci_recv_frame(struct sk_buff *skb);
136 151
137static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev, 152static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev,
138 unsigned int len, 153 unsigned int len,
139 gfp_t how) 154 gfp_t how)
140{ 155{
141 struct sk_buff *skb; 156 struct sk_buff *skb;
142 157
@@ -169,6 +184,7 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload);
169int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb); 184int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb);
170void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb, 185void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb,
171 int err); 186 int err);
187void nci_clear_target_list(struct nci_dev *ndev);
172 188
173/* ----- NCI requests ----- */ 189/* ----- NCI requests ----- */
174#define NCI_REQ_DONE 0 190#define NCI_REQ_DONE 0
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 8696b773a695..bac070bf3514 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -24,6 +24,7 @@
24#ifndef __NET_NFC_H 24#ifndef __NET_NFC_H
25#define __NET_NFC_H 25#define __NET_NFC_H
26 26
27#include <linux/nfc.h>
27#include <linux/device.h> 28#include <linux/device.h>
28#include <linux/skbuff.h> 29#include <linux/skbuff.h>
29 30
@@ -52,20 +53,19 @@ struct nfc_ops {
52 int (*dev_down)(struct nfc_dev *dev); 53 int (*dev_down)(struct nfc_dev *dev);
53 int (*start_poll)(struct nfc_dev *dev, u32 protocols); 54 int (*start_poll)(struct nfc_dev *dev, u32 protocols);
54 void (*stop_poll)(struct nfc_dev *dev); 55 void (*stop_poll)(struct nfc_dev *dev);
55 int (*dep_link_up)(struct nfc_dev *dev, int target_idx, 56 int (*dep_link_up)(struct nfc_dev *dev, int target_idx, u8 comm_mode,
56 u8 comm_mode, u8 rf_mode); 57 u8 *gb, size_t gb_len);
57 int (*dep_link_down)(struct nfc_dev *dev); 58 int (*dep_link_down)(struct nfc_dev *dev);
58 int (*activate_target)(struct nfc_dev *dev, u32 target_idx, 59 int (*activate_target)(struct nfc_dev *dev, u32 target_idx,
59 u32 protocol); 60 u32 protocol);
60 void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx); 61 void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx);
61 int (*data_exchange)(struct nfc_dev *dev, u32 target_idx, 62 int (*data_exchange)(struct nfc_dev *dev, u32 target_idx,
62 struct sk_buff *skb, data_exchange_cb_t cb, 63 struct sk_buff *skb, data_exchange_cb_t cb,
63 void *cb_context); 64 void *cb_context);
64}; 65};
65 66
66#define NFC_TARGET_IDX_ANY -1 67#define NFC_TARGET_IDX_ANY -1
67#define NFC_MAX_GT_LEN 48 68#define NFC_MAX_GT_LEN 48
68#define NFC_MAX_NFCID1_LEN 10
69 69
70struct nfc_target { 70struct nfc_target {
71 u32 idx; 71 u32 idx;
@@ -73,7 +73,11 @@ struct nfc_target {
73 u16 sens_res; 73 u16 sens_res;
74 u8 sel_res; 74 u8 sel_res;
75 u8 nfcid1_len; 75 u8 nfcid1_len;
76 u8 nfcid1[NFC_MAX_NFCID1_LEN]; 76 u8 nfcid1[NFC_NFCID1_MAXSIZE];
77 u8 sensb_res_len;
78 u8 sensb_res[NFC_SENSB_RES_MAXSIZE];
79 u8 sensf_res_len;
80 u8 sensf_res[NFC_SENSF_RES_MAXSIZE];
77}; 81};
78 82
79struct nfc_genl_data { 83struct nfc_genl_data {
@@ -83,7 +87,6 @@ struct nfc_genl_data {
83 87
84struct nfc_dev { 88struct nfc_dev {
85 unsigned idx; 89 unsigned idx;
86 unsigned target_idx;
87 struct nfc_target *targets; 90 struct nfc_target *targets;
88 int n_targets; 91 int n_targets;
89 int targets_generation; 92 int targets_generation;
@@ -107,9 +110,9 @@ struct nfc_dev {
107extern struct class nfc_class; 110extern struct class nfc_class;
108 111
109struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops, 112struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
110 u32 supported_protocols, 113 u32 supported_protocols,
111 int tx_headroom, 114 int tx_headroom,
112 int tx_tailroom); 115 int tx_tailroom);
113 116
114/** 117/**
115 * nfc_free_device - free nfc device 118 * nfc_free_device - free nfc device
@@ -132,7 +135,7 @@ void nfc_unregister_device(struct nfc_dev *dev);
132 * @dev: The parent device 135 * @dev: The parent device
133 */ 136 */
134static inline void nfc_set_parent_dev(struct nfc_dev *nfc_dev, 137static inline void nfc_set_parent_dev(struct nfc_dev *nfc_dev,
135 struct device *dev) 138 struct device *dev)
136{ 139{
137 nfc_dev->dev.parent = dev; 140 nfc_dev->dev.parent = dev;
138} 141}
@@ -169,17 +172,15 @@ static inline const char *nfc_device_name(struct nfc_dev *dev)
169} 172}
170 173
171struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk, 174struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk,
172 unsigned int flags, unsigned int size, 175 unsigned int flags, unsigned int size,
173 unsigned int *err); 176 unsigned int *err);
174struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp); 177struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp);
175 178
176int nfc_set_remote_general_bytes(struct nfc_dev *dev, 179int nfc_set_remote_general_bytes(struct nfc_dev *dev,
177 u8 *gt, u8 gt_len); 180 u8 *gt, u8 gt_len);
178 181
179u8 *nfc_get_local_general_bytes(struct nfc_dev *dev, u8 *gt_len); 182int nfc_targets_found(struct nfc_dev *dev,
180 183 struct nfc_target *targets, int ntargets);
181int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets,
182 int ntargets);
183 184
184int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx, 185int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
185 u8 comm_mode, u8 rf_mode); 186 u8 comm_mode, u8 rf_mode);
diff --git a/include/net/red.h b/include/net/red.h
index 28068ec614b2..77d4c3745cb5 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -2,6 +2,7 @@
2#define __NET_SCHED_RED_H 2#define __NET_SCHED_RED_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/bug.h>
5#include <net/pkt_sched.h> 6#include <net/pkt_sched.h>
6#include <net/inet_ecn.h> 7#include <net/inet_ecn.h>
7#include <net/dsfield.h> 8#include <net/dsfield.h>
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index d3685615a8b0..6ee44b24864a 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -413,6 +413,7 @@ static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc)
413/* Look up the association by its id. */ 413/* Look up the association by its id. */
414struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); 414struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
415 415
416int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp);
416 417
417/* A macro to walk a list of skbs. */ 418/* A macro to walk a list of skbs. */
418#define sctp_skb_for_each(pos, head, tmp) \ 419#define sctp_skb_for_each(pos, head, tmp) \
diff --git a/include/net/sock.h b/include/net/sock.h
index 91c1c8baf020..a6ba1f8871fd 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -55,7 +55,9 @@
55#include <linux/uaccess.h> 55#include <linux/uaccess.h>
56#include <linux/memcontrol.h> 56#include <linux/memcontrol.h>
57#include <linux/res_counter.h> 57#include <linux/res_counter.h>
58#include <linux/jump_label.h> 58#include <linux/static_key.h>
59#include <linux/aio.h>
60#include <linux/sched.h>
59 61
60#include <linux/filter.h> 62#include <linux/filter.h>
61#include <linux/rculist_nulls.h> 63#include <linux/rculist_nulls.h>
@@ -69,7 +71,7 @@ struct cgroup;
69struct cgroup_subsys; 71struct cgroup_subsys;
70#ifdef CONFIG_NET 72#ifdef CONFIG_NET
71int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss); 73int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss);
72void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss); 74void mem_cgroup_sockets_destroy(struct cgroup *cgrp);
73#else 75#else
74static inline 76static inline
75int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss) 77int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss)
@@ -77,7 +79,7 @@ int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss)
77 return 0; 79 return 0;
78} 80}
79static inline 81static inline
80void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss) 82void mem_cgroup_sockets_destroy(struct cgroup *cgrp)
81{ 83{
82} 84}
83#endif 85#endif
@@ -357,6 +359,7 @@ struct sock {
357 struct page *sk_sndmsg_page; 359 struct page *sk_sndmsg_page;
358 struct sk_buff *sk_send_head; 360 struct sk_buff *sk_send_head;
359 __u32 sk_sndmsg_off; 361 __u32 sk_sndmsg_off;
362 __s32 sk_peek_off;
360 int sk_write_pending; 363 int sk_write_pending;
361#ifdef CONFIG_SECURITY 364#ifdef CONFIG_SECURITY
362 void *sk_security; 365 void *sk_security;
@@ -373,6 +376,30 @@ struct sock {
373 void (*sk_destruct)(struct sock *sk); 376 void (*sk_destruct)(struct sock *sk);
374}; 377};
375 378
379static inline int sk_peek_offset(struct sock *sk, int flags)
380{
381 if ((flags & MSG_PEEK) && (sk->sk_peek_off >= 0))
382 return sk->sk_peek_off;
383 else
384 return 0;
385}
386
387static inline void sk_peek_offset_bwd(struct sock *sk, int val)
388{
389 if (sk->sk_peek_off >= 0) {
390 if (sk->sk_peek_off >= val)
391 sk->sk_peek_off -= val;
392 else
393 sk->sk_peek_off = 0;
394 }
395}
396
397static inline void sk_peek_offset_fwd(struct sock *sk, int val)
398{
399 if (sk->sk_peek_off >= 0)
400 sk->sk_peek_off += val;
401}
402
376/* 403/*
377 * Hashed lists helper routines 404 * Hashed lists helper routines
378 */ 405 */
@@ -590,6 +617,10 @@ enum sock_flags {
590 SOCK_RXQ_OVFL, 617 SOCK_RXQ_OVFL,
591 SOCK_ZEROCOPY, /* buffers from userspace */ 618 SOCK_ZEROCOPY, /* buffers from userspace */
592 SOCK_WIFI_STATUS, /* push wifi status to userspace */ 619 SOCK_WIFI_STATUS, /* push wifi status to userspace */
620 SOCK_NOFCS, /* Tell NIC not to do the Ethernet FCS.
621 * Will use last 4 bytes of packet sent from
622 * user-space instead.
623 */
593}; 624};
594 625
595static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 626static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -871,8 +902,7 @@ struct proto {
871 */ 902 */
872 int (*init_cgroup)(struct cgroup *cgrp, 903 int (*init_cgroup)(struct cgroup *cgrp,
873 struct cgroup_subsys *ss); 904 struct cgroup_subsys *ss);
874 void (*destroy_cgroup)(struct cgroup *cgrp, 905 void (*destroy_cgroup)(struct cgroup *cgrp);
875 struct cgroup_subsys *ss);
876 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg); 906 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg);
877#endif 907#endif
878}; 908};
@@ -924,13 +954,13 @@ inline void sk_refcnt_debug_release(const struct sock *sk)
924#endif /* SOCK_REFCNT_DEBUG */ 954#endif /* SOCK_REFCNT_DEBUG */
925 955
926#if defined(CONFIG_CGROUP_MEM_RES_CTLR_KMEM) && defined(CONFIG_NET) 956#if defined(CONFIG_CGROUP_MEM_RES_CTLR_KMEM) && defined(CONFIG_NET)
927extern struct jump_label_key memcg_socket_limit_enabled; 957extern struct static_key memcg_socket_limit_enabled;
928static inline struct cg_proto *parent_cg_proto(struct proto *proto, 958static inline struct cg_proto *parent_cg_proto(struct proto *proto,
929 struct cg_proto *cg_proto) 959 struct cg_proto *cg_proto)
930{ 960{
931 return proto->proto_cgroup(parent_mem_cgroup(cg_proto->memcg)); 961 return proto->proto_cgroup(parent_mem_cgroup(cg_proto->memcg));
932} 962}
933#define mem_cgroup_sockets_enabled static_branch(&memcg_socket_limit_enabled) 963#define mem_cgroup_sockets_enabled static_key_false(&memcg_socket_limit_enabled)
934#else 964#else
935#define mem_cgroup_sockets_enabled 0 965#define mem_cgroup_sockets_enabled 0
936static inline struct cg_proto *parent_cg_proto(struct proto *proto, 966static inline struct cg_proto *parent_cg_proto(struct proto *proto,
@@ -1824,7 +1854,7 @@ static inline bool wq_has_sleeper(struct socket_wq *wq)
1824static inline void sock_poll_wait(struct file *filp, 1854static inline void sock_poll_wait(struct file *filp,
1825 wait_queue_head_t *wait_address, poll_table *p) 1855 wait_queue_head_t *wait_address, poll_table *p)
1826{ 1856{
1827 if (p && wait_address) { 1857 if (!poll_does_not_wait(p) && wait_address) {
1828 poll_wait(filp, wait_address, p); 1858 poll_wait(filp, wait_address, p);
1829 /* 1859 /*
1830 * We need to be sure we are in sync with the 1860 * We need to be sure we are in sync with the
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 42c29bfbcee3..f75a04d752cb 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/tcp.h> 24#include <linux/tcp.h>
25#include <linux/bug.h>
25#include <linux/slab.h> 26#include <linux/slab.h>
26#include <linux/cache.h> 27#include <linux/cache.h>
27#include <linux/percpu.h> 28#include <linux/percpu.h>
@@ -1138,35 +1139,27 @@ static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)
1138/* MD5 Signature */ 1139/* MD5 Signature */
1139struct crypto_hash; 1140struct crypto_hash;
1140 1141
1142union tcp_md5_addr {
1143 struct in_addr a4;
1144#if IS_ENABLED(CONFIG_IPV6)
1145 struct in6_addr a6;
1146#endif
1147};
1148
1141/* - key database */ 1149/* - key database */
1142struct tcp_md5sig_key { 1150struct tcp_md5sig_key {
1143 u8 *key; 1151 struct hlist_node node;
1144 u8 keylen; 1152 u8 keylen;
1145}; 1153 u8 family; /* AF_INET or AF_INET6 */
1146 1154 union tcp_md5_addr addr;
1147struct tcp4_md5sig_key { 1155 u8 key[TCP_MD5SIG_MAXKEYLEN];
1148 struct tcp_md5sig_key base; 1156 struct rcu_head rcu;
1149 __be32 addr;
1150};
1151
1152struct tcp6_md5sig_key {
1153 struct tcp_md5sig_key base;
1154#if 0
1155 u32 scope_id; /* XXX */
1156#endif
1157 struct in6_addr addr;
1158}; 1157};
1159 1158
1160/* - sock block */ 1159/* - sock block */
1161struct tcp_md5sig_info { 1160struct tcp_md5sig_info {
1162 struct tcp4_md5sig_key *keys4; 1161 struct hlist_head head;
1163#if IS_ENABLED(CONFIG_IPV6) 1162 struct rcu_head rcu;
1164 struct tcp6_md5sig_key *keys6;
1165 u32 entries6;
1166 u32 alloced6;
1167#endif
1168 u32 entries4;
1169 u32 alloced4;
1170}; 1163};
1171 1164
1172/* - pseudo header */ 1165/* - pseudo header */
@@ -1203,19 +1196,25 @@ extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1203 const struct sock *sk, 1196 const struct sock *sk,
1204 const struct request_sock *req, 1197 const struct request_sock *req,
1205 const struct sk_buff *skb); 1198 const struct sk_buff *skb);
1206extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk, 1199extern int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
1207 struct sock *addr_sk); 1200 int family, const u8 *newkey,
1208extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey, 1201 u8 newkeylen, gfp_t gfp);
1209 u8 newkeylen); 1202extern int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr,
1210extern int tcp_v4_md5_do_del(struct sock *sk, __be32 addr); 1203 int family);
1204extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1205 struct sock *addr_sk);
1211 1206
1212#ifdef CONFIG_TCP_MD5SIG 1207#ifdef CONFIG_TCP_MD5SIG
1213#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ 1208extern struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1214 &(struct tcp_md5sig_key) { \ 1209 const union tcp_md5_addr *addr, int family);
1215 .key = (twsk)->tw_md5_key, \ 1210#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key)
1216 .keylen = (twsk)->tw_md5_keylen, \
1217 } : NULL)
1218#else 1211#else
1212static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1213 const union tcp_md5_addr *addr,
1214 int family)
1215{
1216 return NULL;
1217}
1219#define tcp_twsk_md5_key(twsk) NULL 1218#define tcp_twsk_md5_key(twsk) NULL
1220#endif 1219#endif
1221 1220
@@ -1364,8 +1363,9 @@ static inline void tcp_push_pending_frames(struct sock *sk)
1364 } 1363 }
1365} 1364}
1366 1365
1367/* Start sequence of the highest skb with SACKed bit, valid only if 1366/* Start sequence of the skb just after the highest skb with SACKed
1368 * sacked > 0 or when the caller has ensured validity by itself. 1367 * bit, valid only if sacked_out > 0 or when the caller has ensured
1368 * validity by itself.
1369 */ 1369 */
1370static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp) 1370static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp)
1371{ 1371{
@@ -1470,10 +1470,6 @@ struct tcp_sock_af_ops {
1470 const struct sock *sk, 1470 const struct sock *sk,
1471 const struct request_sock *req, 1471 const struct request_sock *req,
1472 const struct sk_buff *skb); 1472 const struct sk_buff *skb);
1473 int (*md5_add) (struct sock *sk,
1474 struct sock *addr_sk,
1475 u8 *newkey,
1476 u8 len);
1477 int (*md5_parse) (struct sock *sk, 1473 int (*md5_parse) (struct sock *sk,
1478 char __user *optval, 1474 char __user *optval,
1479 int optlen); 1475 int optlen);
diff --git a/include/net/tcp_memcontrol.h b/include/net/tcp_memcontrol.h
index 3512082fa909..48410ff25c9e 100644
--- a/include/net/tcp_memcontrol.h
+++ b/include/net/tcp_memcontrol.h
@@ -13,7 +13,7 @@ struct tcp_memcontrol {
13 13
14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg); 14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg);
15int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss); 15int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss);
16void tcp_destroy_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss); 16void tcp_destroy_cgroup(struct cgroup *cgrp);
17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg); 17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg);
18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx); 18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx);
19#endif /* _TCP_MEMCG_H */ 19#endif /* _TCP_MEMCG_H */
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h
index 053b3cf2c66a..8d6689cb2c66 100644
--- a/include/net/timewait_sock.h
+++ b/include/net/timewait_sock.h
@@ -12,6 +12,7 @@
12#define _TIMEWAIT_SOCK_H 12#define _TIMEWAIT_SOCK_H
13 13
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/bug.h>
15#include <net/sock.h> 16#include <net/sock.h>
16 17
17struct timewait_sock_ops { 18struct timewait_sock_ops {
diff --git a/include/net/udp.h b/include/net/udp.h
index e39592f682c3..5d606d9da9e5 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -23,6 +23,7 @@
23#define _UDP_H 23#define _UDP_H
24 24
25#include <linux/list.h> 25#include <linux/list.h>
26#include <linux/bug.h>
26#include <net/inet_sock.h> 27#include <net/inet_sock.h>
27#include <net/sock.h> 28#include <net/sock.h>
28#include <net/snmp.h> 29#include <net/snmp.h>
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 5f097ca7d5c5..71375459a884 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -40,7 +40,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
40 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets 40 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets
41 * with a zero checksum field are illegal. */ 41 * with a zero checksum field are illegal. */
42 if (uh->check == 0) { 42 if (uh->check == 0) {
43 LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: zeroed checksum field\n"); 43 LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: zeroed checksum field\n");
44 return 1; 44 return 1;
45 } 45 }
46 46
@@ -52,7 +52,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
52 /* 52 /*
53 * Coverage length violates RFC 3828: log and discard silently. 53 * Coverage length violates RFC 3828: log and discard silently.
54 */ 54 */
55 LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: bad csum coverage %d/%d\n", 55 LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: bad csum coverage %d/%d\n",
56 cscov, skb->len); 56 cscov, skb->len);
57 return 1; 57 return 1;
58 58
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
index d86fffd3c03c..ff27f1b078d1 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/wpan-phy.h
@@ -23,6 +23,7 @@
23 23
24#include <linux/netdevice.h> 24#include <linux/netdevice.h>
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/bug.h>
26 27
27struct wpan_phy { 28struct wpan_phy {
28 struct mutex pib_lock; 29 struct mutex pib_lock;
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 89174e29dca9..96239e78e621 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1566,11 +1566,6 @@ extern struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe);
1566extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, 1566extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len,
1567 int probe); 1567 int probe);
1568 1568
1569struct hash_desc;
1570struct scatterlist;
1571typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *,
1572 unsigned int);
1573
1574static inline int xfrm_addr_cmp(const xfrm_address_t *a, 1569static inline int xfrm_addr_cmp(const xfrm_address_t *a,
1575 const xfrm_address_t *b, 1570 const xfrm_address_t *b,
1576 int family) 1571 int family)