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.h42
-rw-r--r--include/net/bluetooth/hci.h76
-rw-r--r--include/net/bluetooth/hci_core.h307
-rw-r--r--include/net/bluetooth/hci_mon.h51
-rw-r--r--include/net/bluetooth/l2cap.h97
-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.h179
-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/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/iucv/af_iucv.h3
-rw-r--r--include/net/mac80211.h154
-rw-r--r--include/net/ndisc.h1
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-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.h19
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h78
-rw-r--r--include/net/netfilter/xt_log.h2
-rw-r--r--include/net/netlink.h35
-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/rtnetlink.h2
-rw-r--r--include/net/sctp/sctp.h1
-rw-r--r--include/net/sock.h46
-rw-r--r--include/net/tcp.h71
-rw-r--r--include/net/tcp_memcontrol.h2
-rw-r--r--include/net/udplite.h4
-rw-r--r--include/net/xfrm.h5
39 files changed, 1111 insertions, 607 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 abaad6ed9b83..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))
@@ -256,4 +284,6 @@ void l2cap_exit(void);
256int sco_init(void); 284int sco_init(void);
257void sco_exit(void); 285void sco_exit(void);
258 286
287void bt_sock_reclassify_lock(struct sock *sk, int proto);
288
259#endif /* __BLUETOOTH_H */ 289#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 00596e816b4d..344b0f972828 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,22 @@ 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
96 HCI_LE_SCAN, 96 HCI_LE_SCAN,
97 HCI_SSP_ENABLED,
98 HCI_HS_ENABLED,
99 HCI_LE_ENABLED,
100 HCI_CONNECTABLE,
101 HCI_DISCOVERABLE,
102 HCI_LINK_SECURITY,
103 HCI_PENDING_CLASS,
97}; 104};
98 105
99/* HCI ioctl defines */ 106/* HCI ioctl defines */
@@ -130,6 +137,7 @@ enum {
130#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 137#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
131#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 138#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
132#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */ 139#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */
140#define HCI_ACL_TX_TIMEOUT (45000) /* 45 seconds */
133 141
134/* HCI data types */ 142/* HCI data types */
135#define HCI_COMMAND_PKT 0x01 143#define HCI_COMMAND_PKT 0x01
@@ -229,7 +237,9 @@ enum {
229#define LMP_EXTFEATURES 0x80 237#define LMP_EXTFEATURES 0x80
230 238
231/* Extended LMP features */ 239/* Extended LMP features */
232#define LMP_HOST_LE 0x02 240#define LMP_HOST_SSP 0x01
241#define LMP_HOST_LE 0x02
242#define LMP_HOST_LE_BREDR 0x04
233 243
234/* Connection modes */ 244/* Connection modes */
235#define HCI_CM_ACTIVE 0x0000 245#define HCI_CM_ACTIVE 0x0000
@@ -268,10 +278,11 @@ enum {
268#define HCI_LK_UNAUTH_COMBINATION 0x04 278#define HCI_LK_UNAUTH_COMBINATION 0x04
269#define HCI_LK_AUTH_COMBINATION 0x05 279#define HCI_LK_AUTH_COMBINATION 0x05
270#define HCI_LK_CHANGED_COMBINATION 0x06 280#define HCI_LK_CHANGED_COMBINATION 0x06
271/* The spec doesn't define types for SMP keys */ 281/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
272#define HCI_LK_SMP_LTK 0x81 282#define HCI_SMP_STK 0x80
273#define HCI_LK_SMP_IRK 0x82 283#define HCI_SMP_STK_SLAVE 0x81
274#define HCI_LK_SMP_CSRK 0x83 284#define HCI_SMP_LTK 0x82
285#define HCI_SMP_LTK_SLAVE 0x83
275 286
276/* ---- HCI Error Codes ---- */ 287/* ---- HCI Error Codes ---- */
277#define HCI_ERROR_AUTH_FAILURE 0x05 288#define HCI_ERROR_AUTH_FAILURE 0x05
@@ -284,6 +295,22 @@ enum {
284#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 295#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
285#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 296#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01
286 297
298/* Extended Inquiry Response field types */
299#define EIR_FLAGS 0x01 /* flags */
300#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
301#define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */
302#define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */
303#define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */
304#define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */
305#define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */
306#define EIR_NAME_SHORT 0x08 /* shortened local name */
307#define EIR_NAME_COMPLETE 0x09 /* complete local name */
308#define EIR_TX_POWER 0x0A /* transmit power level */
309#define EIR_CLASS_OF_DEV 0x0D /* Class of Device */
310#define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */
311#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */
312#define EIR_DEVICE_ID 0x10 /* device ID */
313
287/* ----- HCI Commands ---- */ 314/* ----- HCI Commands ---- */
288#define HCI_OP_NOP 0x0000 315#define HCI_OP_NOP 0x0000
289 316
@@ -666,8 +693,8 @@ struct hci_cp_host_buffer_size {
666 693
667#define HCI_OP_WRITE_EIR 0x0c52 694#define HCI_OP_WRITE_EIR 0x0c52
668struct hci_cp_write_eir { 695struct hci_cp_write_eir {
669 uint8_t fec; 696 __u8 fec;
670 uint8_t data[HCI_MAX_EIR_LENGTH]; 697 __u8 data[HCI_MAX_EIR_LENGTH];
671} __packed; 698} __packed;
672 699
673#define HCI_OP_READ_SSP_MODE 0x0c55 700#define HCI_OP_READ_SSP_MODE 0x0c55
@@ -698,8 +725,8 @@ struct hci_rp_read_flow_control_mode {
698 725
699#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d 726#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d
700struct hci_cp_write_le_host_supported { 727struct hci_cp_write_le_host_supported {
701 __u8 le; 728 __u8 le;
702 __u8 simul; 729 __u8 simul;
703} __packed; 730} __packed;
704 731
705#define HCI_OP_READ_LOCAL_VERSION 0x1001 732#define HCI_OP_READ_LOCAL_VERSION 0x1001
@@ -1155,6 +1182,19 @@ struct hci_ev_le_meta {
1155 __u8 subevent; 1182 __u8 subevent;
1156} __packed; 1183} __packed;
1157 1184
1185#define HCI_EV_NUM_COMP_BLOCKS 0x48
1186struct hci_comp_blocks_info {
1187 __le16 handle;
1188 __le16 pkts;
1189 __le16 blocks;
1190} __packed;
1191
1192struct hci_ev_num_comp_blocks {
1193 __le16 num_blocks;
1194 __u8 num_hndl;
1195 struct hci_comp_blocks_info handles[0];
1196} __packed;
1197
1158/* Low energy meta events */ 1198/* Low energy meta events */
1159#define HCI_EV_LE_CONN_COMPLETE 0x01 1199#define HCI_EV_LE_CONN_COMPLETE 0x01
1160struct hci_ev_le_conn_complete { 1200struct hci_ev_le_conn_complete {
@@ -1288,6 +1328,7 @@ struct sockaddr_hci {
1288 1328
1289#define HCI_CHANNEL_RAW 0 1329#define HCI_CHANNEL_RAW 0
1290#define HCI_CHANNEL_CONTROL 1 1330#define HCI_CHANNEL_CONTROL 1
1331#define HCI_CHANNEL_MONITOR 2
1291 1332
1292struct hci_filter { 1333struct hci_filter {
1293 unsigned long type_mask; 1334 unsigned long type_mask;
@@ -1389,5 +1430,6 @@ struct hci_inquiry_req {
1389#define IREQ_CACHE_FLUSH 0x0001 1430#define IREQ_CACHE_FLUSH 0x0001
1390 1431
1391extern bool enable_hs; 1432extern bool enable_hs;
1433extern bool enable_le;
1392 1434
1393#endif /* __HCI_H */ 1435#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index ea9231f4935f..daefaac51131 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->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;
@@ -540,7 +585,7 @@ void hci_conn_put_device(struct hci_conn *conn);
540static inline void hci_conn_hold(struct hci_conn *conn) 585static inline void hci_conn_hold(struct hci_conn *conn)
541{ 586{
542 atomic_inc(&conn->refcnt); 587 atomic_inc(&conn->refcnt);
543 cancel_delayed_work_sync(&conn->disc_work); 588 cancel_delayed_work(&conn->disc_work);
544} 589}
545 590
546static inline void hci_conn_put(struct hci_conn *conn) 591static inline void hci_conn_put(struct hci_conn *conn)
@@ -559,43 +604,40 @@ static inline void hci_conn_put(struct hci_conn *conn)
559 } else { 604 } else {
560 timeo = msecs_to_jiffies(10); 605 timeo = msecs_to_jiffies(10);
561 } 606 }
562 cancel_delayed_work_sync(&conn->disc_work); 607 cancel_delayed_work(&conn->disc_work);
563 queue_delayed_work(conn->hdev->workqueue, 608 queue_delayed_work(conn->hdev->workqueue,
564 &conn->disc_work, jiffies + timeo); 609 &conn->disc_work, timeo);
565 } 610 }
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,71 @@ 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 u8 field_len;
911 size_t parsed;
912
913 for (parsed = 0; parsed < data_len - 1; parsed += field_len) {
914 field_len = data[0];
915
916 if (field_len == 0)
917 break;
918
919 parsed += field_len + 1;
920
921 if (parsed > data_len)
922 break;
923
924 if (data[1] == type)
925 return true;
926
927 data += field_len + 1;
928 }
929
930 return false;
931}
932
933static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
934 u8 data_len)
935{
936 eir[eir_len++] = sizeof(type) + data_len;
937 eir[eir_len++] = type;
938 memcpy(&eir[eir_len], data, data_len);
939 eir_len += data_len;
940
941 return eir_len;
942}
943
862int hci_register_cb(struct hci_cb *hcb); 944int hci_register_cb(struct hci_cb *hcb);
863int hci_unregister_cb(struct hci_cb *hcb); 945int hci_unregister_cb(struct hci_cb *hcb);
864 946
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); 947int 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); 948void 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); 949void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb);
871 950
872void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); 951void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
873 952
874void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data);
875
876/* ----- HCI Sockets ----- */ 953/* ----- HCI Sockets ----- */
877void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb, 954void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb);
878 struct sock *skip_sk); 955void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk);
956void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb);
957
958void hci_sock_dev_event(struct hci_dev *hdev, int event);
879 959
880/* Management interface */ 960/* Management interface */
961#define MGMT_ADDR_BREDR 0x00
962#define MGMT_ADDR_LE_PUBLIC 0x01
963#define MGMT_ADDR_LE_RANDOM 0x02
964#define MGMT_ADDR_INVALID 0xff
965
966#define DISCOV_TYPE_BREDR (BIT(MGMT_ADDR_BREDR))
967#define DISCOV_TYPE_LE (BIT(MGMT_ADDR_LE_PUBLIC) | \
968 BIT(MGMT_ADDR_LE_RANDOM))
969#define DISCOV_TYPE_INTERLEAVED (BIT(MGMT_ADDR_BREDR) | \
970 BIT(MGMT_ADDR_LE_PUBLIC) | \
971 BIT(MGMT_ADDR_LE_RANDOM))
972
881int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 973int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
882int mgmt_index_added(struct hci_dev *hdev); 974int mgmt_index_added(struct hci_dev *hdev);
883int mgmt_index_removed(struct hci_dev *hdev); 975int mgmt_index_removed(struct hci_dev *hdev);
@@ -886,56 +978,67 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
886int mgmt_connectable(struct hci_dev *hdev, u8 connectable); 978int mgmt_connectable(struct hci_dev *hdev, u8 connectable);
887int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 979int 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, 980int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
889 u8 persistent); 981 u8 persistent);
890int mgmt_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 982int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
891 u8 addr_type); 983 u8 addr_type, u32 flags, u8 *name, u8 name_len,
892int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 984 u8 *dev_class);
893 u8 addr_type); 985int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
894int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); 986 u8 link_type, u8 addr_type);
987int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
988 u8 link_type, u8 addr_type, u8 status);
895int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 989int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
896 u8 addr_type, u8 status); 990 u8 addr_type, u8 status);
897int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); 991int 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, 992int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
899 u8 status); 993 u8 status);
900int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 994int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
901 u8 status); 995 u8 status);
902int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, 996int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
903 __le32 value, u8 confirm_hint); 997 u8 link_type, u8 addr_type, __le32 value,
998 u8 confirm_hint);
904int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 999int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
905 u8 status); 1000 u8 link_type, u8 addr_type, u8 status);
906int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, 1001int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
907 bdaddr_t *bdaddr, u8 status); 1002 u8 link_type, u8 addr_type, u8 status);
908int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr); 1003int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
1004 u8 link_type, u8 addr_type);
909int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1005int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
910 u8 status); 1006 u8 link_type, u8 addr_type, u8 status);
911int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, 1007int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
912 bdaddr_t *bdaddr, u8 status); 1008 u8 link_type, u8 addr_type, u8 status);
913int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); 1009int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1010 u8 addr_type, u8 status);
1011int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1012int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1013int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1014 u8 status);
914int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1015int 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, 1016int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
916 u8 *randomizer, u8 status); 1017 u8 *randomizer, u8 status);
1018int 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, 1019int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
918 u8 addr_type, u8 *dev_class, s8 rssi, u8 *eir); 1020 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
919int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name); 1021 u8 ssp, u8 *eir, u16 eir_len);
1022int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1023 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
920int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status); 1024int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
921int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status); 1025int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status);
922int mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1026int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
923int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr); 1027int mgmt_interleaved_discovery(struct hci_dev *hdev);
924int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr); 1028int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1029int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1030
1031int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent);
925 1032
926/* HCI info for socket */ 1033/* HCI info for socket */
927#define hci_pi(sk) ((struct hci_pinfo *) sk) 1034#define hci_pi(sk) ((struct hci_pinfo *) sk)
928 1035
929/* HCI socket flags */
930#define HCI_PI_MGMT_INIT 0
931
932struct hci_pinfo { 1036struct hci_pinfo {
933 struct bt_sock bt; 1037 struct bt_sock bt;
934 struct hci_dev *hdev; 1038 struct hci_dev *hdev;
935 struct hci_filter filter; 1039 struct hci_filter filter;
936 __u32 cmsg_mask; 1040 __u32 cmsg_mask;
937 unsigned short channel; 1041 unsigned short channel;
938 unsigned long flags;
939}; 1042};
940 1043
941/* HCI security filter */ 1044/* HCI security filter */
@@ -966,5 +1069,7 @@ void hci_le_ltk_neg_reply(struct hci_conn *conn);
966 1069
967int hci_do_inquiry(struct hci_dev *hdev, u8 length); 1070int hci_do_inquiry(struct hci_dev *hdev, u8 length);
968int hci_cancel_inquiry(struct hci_dev *hdev); 1071int hci_cancel_inquiry(struct hci_dev *hdev);
1072int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
1073 int timeout);
969 1074
970#endif /* __HCI_CORE_H */ 1075#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 68f589150692..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,33 +611,49 @@ 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))
627#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) 648#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer)
628#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ 649#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \
629 L2CAP_DEFAULT_RETRANS_TO); 650 msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
630#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer) 651#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer)
631#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \ 652#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \
632 L2CAP_DEFAULT_MONITOR_TO); 653 msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
633#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer) 654#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer)
634#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \ 655#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \
635 L2CAP_DEFAULT_ACK_TO); 656 msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO));
636#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer) 657#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer)
637 658
638static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2) 659static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2)
@@ -834,7 +855,7 @@ int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
834struct l2cap_chan *l2cap_chan_create(struct sock *sk); 855struct l2cap_chan *l2cap_chan_create(struct sock *sk);
835void l2cap_chan_close(struct l2cap_chan *chan, int reason); 856void l2cap_chan_close(struct l2cap_chan *chan, int reason);
836void l2cap_chan_destroy(struct l2cap_chan *chan); 857void l2cap_chan_destroy(struct l2cap_chan *chan);
837inline int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, 858int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
838 bdaddr_t *dst); 859 bdaddr_t *dst);
839int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, 860int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
840 u32 priority); 861 u32 priority);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index be65d3417883..ffc1377e092e 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 __u16 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 85b44ca54ac6..248fb05feb63 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -121,6 +121,7 @@ enum ieee80211_channel_flags {
121 * @band: band this channel belongs to. 121 * @band: band this channel belongs to.
122 * @max_antenna_gain: maximum antenna gain in dBi 122 * @max_antenna_gain: maximum antenna gain in dBi
123 * @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)
124 * @beacon_found: helper to regulatory code to indicate when a beacon 125 * @beacon_found: helper to regulatory code to indicate when a beacon
125 * has been found on this channel. Use regulatory_hint_found_beacon() 126 * has been found on this channel. Use regulatory_hint_found_beacon()
126 * to enable this, this is useful only on 5 GHz band. 127 * to enable this, this is useful only on 5 GHz band.
@@ -134,6 +135,7 @@ struct ieee80211_channel {
134 u32 flags; 135 u32 flags;
135 int max_antenna_gain; 136 int max_antenna_gain;
136 int max_power; 137 int max_power;
138 int max_reg_power;
137 bool beacon_found; 139 bool beacon_found;
138 u32 orig_flags; 140 u32 orig_flags;
139 int orig_mag, orig_mpwr; 141 int orig_mag, orig_mpwr;
@@ -365,25 +367,13 @@ struct cfg80211_crypto_settings {
365}; 367};
366 368
367/** 369/**
368 * struct beacon_parameters - beacon parameters 370 * struct cfg80211_beacon_data - beacon data
369 *
370 * Used to configure the beacon for an interface.
371 *
372 * @head: head portion of beacon (before TIM IE) 371 * @head: head portion of beacon (before TIM IE)
373 * or %NULL if not changed 372 * or %NULL if not changed
374 * @tail: tail portion of beacon (after TIM IE) 373 * @tail: tail portion of beacon (after TIM IE)
375 * or %NULL if not changed 374 * or %NULL if not changed
376 * @interval: beacon interval or zero if not changed
377 * @dtim_period: DTIM period or zero if not changed
378 * @head_len: length of @head 375 * @head_len: length of @head
379 * @tail_len: length of @tail 376 * @tail_len: length of @tail
380 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
381 * user space)
382 * @ssid_len: length of @ssid
383 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
384 * @crypto: crypto settings
385 * @privacy: the BSS uses privacy
386 * @auth_type: Authentication type (algorithm)
387 * @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
388 * @beacon_ies_len: length of beacon_ies in octets 378 * @beacon_ies_len: length of beacon_ies in octets
389 * @proberesp_ies: extra information element(s) to add into Probe Response 379 * @proberesp_ies: extra information element(s) to add into Probe Response
@@ -395,24 +385,48 @@ struct cfg80211_crypto_settings {
395 * @probe_resp_len: length of probe response template (@probe_resp) 385 * @probe_resp_len: length of probe response template (@probe_resp)
396 * @probe_resp: probe response template (AP mode only) 386 * @probe_resp: probe response template (AP mode only)
397 */ 387 */
398struct beacon_parameters { 388struct cfg80211_beacon_data {
399 u8 *head, *tail; 389 const u8 *head, *tail;
400 int interval, dtim_period; 390 const u8 *beacon_ies;
401 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;
402 const u8 *ssid; 423 const u8 *ssid;
403 size_t ssid_len; 424 size_t ssid_len;
404 enum nl80211_hidden_ssid hidden_ssid; 425 enum nl80211_hidden_ssid hidden_ssid;
405 struct cfg80211_crypto_settings crypto; 426 struct cfg80211_crypto_settings crypto;
406 bool privacy; 427 bool privacy;
407 enum nl80211_auth_type auth_type; 428 enum nl80211_auth_type auth_type;
408 const u8 *beacon_ies; 429 int inactivity_timeout;
409 size_t beacon_ies_len;
410 const u8 *proberesp_ies;
411 size_t proberesp_ies_len;
412 const u8 *assocresp_ies;
413 size_t assocresp_ies_len;
414 int probe_resp_len;
415 u8 *probe_resp;
416}; 430};
417 431
418/** 432/**
@@ -797,6 +811,8 @@ struct mesh_config {
797 * mesh gate, but not necessarily using the gate announcement protocol. 811 * mesh gate, but not necessarily using the gate announcement protocol.
798 * Still keeping the same nomenclature to be in sync with the spec. */ 812 * Still keeping the same nomenclature to be in sync with the spec. */
799 bool dot11MeshGateAnnouncementProtocol; 813 bool dot11MeshGateAnnouncementProtocol;
814 bool dot11MeshForwarding;
815 s32 rssi_threshold;
800}; 816};
801 817
802/** 818/**
@@ -1037,10 +1053,6 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1037 * @key_len: length of WEP key for shared key authentication 1053 * @key_len: length of WEP key for shared key authentication
1038 * @key_idx: index of WEP key for shared key authentication 1054 * @key_idx: index of WEP key for shared key authentication
1039 * @key: WEP key for shared key authentication 1055 * @key: WEP key for shared key authentication
1040 * @local_state_change: This is a request for a local state only, i.e., no
1041 * Authentication frame is to be transmitted and authentication state is
1042 * to be changed without having to wait for a response from the peer STA
1043 * (AP).
1044 */ 1056 */
1045struct cfg80211_auth_request { 1057struct cfg80211_auth_request {
1046 struct cfg80211_bss *bss; 1058 struct cfg80211_bss *bss;
@@ -1049,7 +1061,6 @@ struct cfg80211_auth_request {
1049 enum nl80211_auth_type auth_type; 1061 enum nl80211_auth_type auth_type;
1050 const u8 *key; 1062 const u8 *key;
1051 u8 key_len, key_idx; 1063 u8 key_len, key_idx;
1052 bool local_state_change;
1053}; 1064};
1054 1065
1055/** 1066/**
@@ -1066,7 +1077,11 @@ enum cfg80211_assoc_req_flags {
1066 * 1077 *
1067 * This structure provides information needed to complete IEEE 802.11 1078 * This structure provides information needed to complete IEEE 802.11
1068 * (re)association. 1079 * (re)association.
1069 * @bss: The BSS to associate with. 1080 * @bss: The BSS to associate with. If the call is successful the driver
1081 * is given a reference that it must release, normally via a call to
1082 * cfg80211_send_rx_assoc(), or, if association timed out, with a
1083 * call to cfg80211_put_bss() (in addition to calling
1084 * cfg80211_send_assoc_timeout())
1070 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 1085 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1071 * @ie_len: Length of ie buffer in octets 1086 * @ie_len: Length of ie buffer in octets
1072 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 1087 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
@@ -1094,19 +1109,16 @@ struct cfg80211_assoc_request {
1094 * This structure provides information needed to complete IEEE 802.11 1109 * This structure provides information needed to complete IEEE 802.11
1095 * deauthentication. 1110 * deauthentication.
1096 * 1111 *
1097 * @bss: the BSS to deauthenticate from 1112 * @bssid: the BSSID of the BSS to deauthenticate from
1098 * @ie: Extra IEs to add to Deauthentication frame or %NULL 1113 * @ie: Extra IEs to add to Deauthentication frame or %NULL
1099 * @ie_len: Length of ie buffer in octets 1114 * @ie_len: Length of ie buffer in octets
1100 * @reason_code: The reason code for the deauthentication 1115 * @reason_code: The reason code for the deauthentication
1101 * @local_state_change: This is a request for a local state only, i.e., no
1102 * Deauthentication frame is to be transmitted.
1103 */ 1116 */
1104struct cfg80211_deauth_request { 1117struct cfg80211_deauth_request {
1105 struct cfg80211_bss *bss; 1118 const u8 *bssid;
1106 const u8 *ie; 1119 const u8 *ie;
1107 size_t ie_len; 1120 size_t ie_len;
1108 u16 reason_code; 1121 u16 reason_code;
1109 bool local_state_change;
1110}; 1122};
1111 1123
1112/** 1124/**
@@ -1149,6 +1161,10 @@ struct cfg80211_disassoc_request {
1149 * @beacon_interval: beacon interval to use 1161 * @beacon_interval: beacon interval to use
1150 * @privacy: this is a protected network, keys will be configured 1162 * @privacy: this is a protected network, keys will be configured
1151 * after joining 1163 * after joining
1164 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
1165 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1166 * required to assume that the port is unauthorized until authorized by
1167 * user space. Otherwise, port is marked authorized by default.
1152 * @basic_rates: bitmap of basic rates to use when creating the IBSS 1168 * @basic_rates: bitmap of basic rates to use when creating the IBSS
1153 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1169 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
1154 */ 1170 */
@@ -1163,6 +1179,7 @@ struct cfg80211_ibss_params {
1163 u32 basic_rates; 1179 u32 basic_rates;
1164 bool channel_fixed; 1180 bool channel_fixed;
1165 bool privacy; 1181 bool privacy;
1182 bool control_port;
1166 int mcast_rate[IEEE80211_NUM_BANDS]; 1183 int mcast_rate[IEEE80211_NUM_BANDS];
1167}; 1184};
1168 1185
@@ -1187,6 +1204,8 @@ struct cfg80211_ibss_params {
1187 * @key_idx: index of WEP key for shared key authentication 1204 * @key_idx: index of WEP key for shared key authentication
1188 * @key: WEP key for shared key authentication 1205 * @key: WEP key for shared key authentication
1189 * @flags: See &enum cfg80211_assoc_req_flags 1206 * @flags: See &enum cfg80211_assoc_req_flags
1207 * @bg_scan_period: Background scan period in seconds
1208 * or -1 to indicate that default value is to be used.
1190 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1209 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
1191 * will be used in ht_capa. Un-supported values will be ignored. 1210 * will be used in ht_capa. Un-supported values will be ignored.
1192 * @ht_capa_mask: The bits of ht_capa which are to be used. 1211 * @ht_capa_mask: The bits of ht_capa which are to be used.
@@ -1204,6 +1223,7 @@ struct cfg80211_connect_params {
1204 const u8 *key; 1223 const u8 *key;
1205 u8 key_len, key_idx; 1224 u8 key_len, key_idx;
1206 u32 flags; 1225 u32 flags;
1226 int bg_scan_period;
1207 struct ieee80211_ht_cap ht_capa; 1227 struct ieee80211_ht_cap ht_capa;
1208 struct ieee80211_ht_cap ht_capa_mask; 1228 struct ieee80211_ht_cap ht_capa_mask;
1209}; 1229};
@@ -1230,8 +1250,7 @@ enum wiphy_params_flags {
1230struct cfg80211_bitrate_mask { 1250struct cfg80211_bitrate_mask {
1231 struct { 1251 struct {
1232 u32 legacy; 1252 u32 legacy;
1233 /* TODO: add support for masking MCS rates; e.g.: */ 1253 u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
1234 /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */
1235 } control[IEEE80211_NUM_BANDS]; 1254 } control[IEEE80211_NUM_BANDS];
1236}; 1255};
1237/** 1256/**
@@ -1344,12 +1363,10 @@ struct cfg80211_gtk_rekey_data {
1344 * 1363 *
1345 * @set_rekey_data: give the data necessary for GTK rekeying to the driver 1364 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
1346 * 1365 *
1347 * @add_beacon: Add a beacon with given parameters, @head, @interval 1366 * @start_ap: Start acting in AP mode defined by the parameters.
1348 * and @dtim_period will be valid, @tail is optional. 1367 * @change_beacon: Change the beacon parameters for an access point mode
1349 * @set_beacon: Change the beacon parameters for an access point mode 1368 * interface. This should reject the call when AP mode wasn't started.
1350 * interface. This should reject the call when no beacon has been 1369 * @stop_ap: Stop being an AP, including stopping beaconing.
1351 * configured.
1352 * @del_beacon: Remove beacon configuration and stop sending the beacon.
1353 * 1370 *
1354 * @add_station: Add a new station. 1371 * @add_station: Add a new station.
1355 * @del_station: Remove a station; @mac may be NULL to remove all stations. 1372 * @del_station: Remove a station; @mac may be NULL to remove all stations.
@@ -1516,11 +1533,11 @@ struct cfg80211_ops {
1516 struct net_device *netdev, 1533 struct net_device *netdev,
1517 u8 key_index); 1534 u8 key_index);
1518 1535
1519 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 1536 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
1520 struct beacon_parameters *info); 1537 struct cfg80211_ap_settings *settings);
1521 int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, 1538 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
1522 struct beacon_parameters *info); 1539 struct cfg80211_beacon_data *info);
1523 int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); 1540 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
1524 1541
1525 1542
1526 int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 1543 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
@@ -1575,11 +1592,9 @@ struct cfg80211_ops {
1575 int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1592 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
1576 struct cfg80211_assoc_request *req); 1593 struct cfg80211_assoc_request *req);
1577 int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 1594 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
1578 struct cfg80211_deauth_request *req, 1595 struct cfg80211_deauth_request *req);
1579 void *cookie);
1580 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1596 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
1581 struct cfg80211_disassoc_request *req, 1597 struct cfg80211_disassoc_request *req);
1582 void *cookie);
1583 1598
1584 int (*connect)(struct wiphy *wiphy, struct net_device *dev, 1599 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
1585 struct cfg80211_connect_params *sme); 1600 struct cfg80211_connect_params *sme);
@@ -2205,8 +2220,6 @@ struct cfg80211_conn;
2205struct cfg80211_internal_bss; 2220struct cfg80211_internal_bss;
2206struct cfg80211_cached_keys; 2221struct cfg80211_cached_keys;
2207 2222
2208#define MAX_AUTH_BSSES 4
2209
2210/** 2223/**
2211 * struct wireless_dev - wireless per-netdev state 2224 * struct wireless_dev - wireless per-netdev state
2212 * 2225 *
@@ -2270,8 +2283,6 @@ struct wireless_dev {
2270 struct list_head event_list; 2283 struct list_head event_list;
2271 spinlock_t event_lock; 2284 spinlock_t event_lock;
2272 2285
2273 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
2274 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
2275 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 2286 struct cfg80211_internal_bss *current_bss; /* associated / joined */
2276 struct ieee80211_channel *channel; 2287 struct ieee80211_channel *channel;
2277 2288
@@ -2687,7 +2698,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
2687 * @wiphy: the wiphy reporting the BSS 2698 * @wiphy: the wiphy reporting the BSS
2688 * @channel: The channel the frame was received on 2699 * @channel: The channel the frame was received on
2689 * @bssid: the BSSID of the BSS 2700 * @bssid: the BSSID of the BSS
2690 * @timestamp: the TSF timestamp sent by the peer 2701 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
2691 * @capability: the capability field sent by the peer 2702 * @capability: the capability field sent by the peer
2692 * @beacon_interval: the beacon interval announced by the peer 2703 * @beacon_interval: the beacon interval announced by the peer
2693 * @ie: additional IEs sent by the peer 2704 * @ie: additional IEs sent by the peer
@@ -2703,9 +2714,8 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
2703struct cfg80211_bss * __must_check 2714struct cfg80211_bss * __must_check
2704cfg80211_inform_bss(struct wiphy *wiphy, 2715cfg80211_inform_bss(struct wiphy *wiphy,
2705 struct ieee80211_channel *channel, 2716 struct ieee80211_channel *channel,
2706 const u8 *bssid, 2717 const u8 *bssid, u64 tsf, u16 capability,
2707 u64 timestamp, u16 capability, u16 beacon_interval, 2718 u16 beacon_interval, const u8 *ie, size_t ielen,
2708 const u8 *ie, size_t ielen,
2709 s32 signal, gfp_t gfp); 2719 s32 signal, gfp_t gfp);
2710 2720
2711struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 2721struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
@@ -2726,6 +2736,20 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
2726 struct ieee80211_channel *channel, 2736 struct ieee80211_channel *channel,
2727 const u8 *meshid, size_t meshidlen, 2737 const u8 *meshid, size_t meshidlen,
2728 const u8 *meshcfg); 2738 const u8 *meshcfg);
2739/**
2740 * cfg80211_ref_bss - reference BSS struct
2741 * @bss: the BSS struct to reference
2742 *
2743 * Increments the refcount of the given BSS struct.
2744 */
2745void cfg80211_ref_bss(struct cfg80211_bss *bss);
2746
2747/**
2748 * cfg80211_put_bss - unref BSS struct
2749 * @bss: the BSS struct
2750 *
2751 * Decrements the refcount of the given BSS struct.
2752 */
2729void cfg80211_put_bss(struct cfg80211_bss *bss); 2753void cfg80211_put_bss(struct cfg80211_bss *bss);
2730 2754
2731/** 2755/**
@@ -2763,20 +2787,10 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
2763void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 2787void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
2764 2788
2765/** 2789/**
2766 * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled
2767 * @dev: network device
2768 * @addr: The MAC address of the device with which the authentication timed out
2769 *
2770 * When a pending authentication had no action yet, the driver may decide
2771 * to not send a deauth frame, but in that case must calls this function
2772 * to tell cfg80211 about this decision. It is only valid to call this
2773 * function within the deauth() callback.
2774 */
2775void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr);
2776
2777/**
2778 * cfg80211_send_rx_assoc - notification of processed association 2790 * cfg80211_send_rx_assoc - notification of processed association
2779 * @dev: network device 2791 * @dev: network device
2792 * @bss: the BSS struct association was requested for, the struct reference
2793 * is owned by cfg80211 after this call
2780 * @buf: (re)association response frame (header + body) 2794 * @buf: (re)association response frame (header + body)
2781 * @len: length of the frame data 2795 * @len: length of the frame data
2782 * 2796 *
@@ -2785,7 +2799,8 @@ void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr);
2785 * function or cfg80211_send_assoc_timeout() to indicate the result of 2799 * function or cfg80211_send_assoc_timeout() to indicate the result of
2786 * cfg80211_ops::assoc() call. This function may sleep. 2800 * cfg80211_ops::assoc() call. This function may sleep.
2787 */ 2801 */
2788void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 2802void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
2803 const u8 *buf, size_t len);
2789 2804
2790/** 2805/**
2791 * cfg80211_send_assoc_timeout - notification of timed out association 2806 * cfg80211_send_assoc_timeout - notification of timed out association
@@ -3177,6 +3192,7 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3177 * cfg80211_rx_mgmt - notification of received, unprocessed management frame 3192 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
3178 * @dev: network device 3193 * @dev: network device
3179 * @freq: Frequency on which the frame was received in MHz 3194 * @freq: Frequency on which the frame was received in MHz
3195 * @sig_dbm: signal strength in mBm, or 0 if unknown
3180 * @buf: Management frame (header + body) 3196 * @buf: Management frame (header + body)
3181 * @len: length of the frame data 3197 * @len: length of the frame data
3182 * @gfp: context flags 3198 * @gfp: context flags
@@ -3189,8 +3205,8 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3189 * This function is called whenever an Action frame is received for a station 3205 * This function is called whenever an Action frame is received for a station
3190 * mode interface, but is not processed in kernel. 3206 * mode interface, but is not processed in kernel.
3191 */ 3207 */
3192bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, 3208bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm,
3193 size_t len, gfp_t gfp); 3209 const u8 *buf, size_t len, gfp_t gfp);
3194 3210
3195/** 3211/**
3196 * cfg80211_mgmt_tx_status - notification of TX status for management frame 3212 * cfg80211_mgmt_tx_status - notification of TX status for management frame
@@ -3303,6 +3319,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3303 * @frame: the frame 3319 * @frame: the frame
3304 * @len: length of the frame 3320 * @len: length of the frame
3305 * @freq: frequency the frame was received on 3321 * @freq: frequency the frame was received on
3322 * @sig_dbm: signal strength in mBm, or 0 if unknown
3306 * @gfp: allocation flags 3323 * @gfp: allocation flags
3307 * 3324 *
3308 * Use this function to report to userspace when a beacon was 3325 * Use this function to report to userspace when a beacon was
@@ -3311,7 +3328,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
3311 */ 3328 */
3312void cfg80211_report_obss_beacon(struct wiphy *wiphy, 3329void cfg80211_report_obss_beacon(struct wiphy *wiphy,
3313 const u8 *frame, size_t len, 3330 const u8 *frame, size_t len,
3314 int freq, gfp_t gfp); 3331 int freq, int sig_dbm, gfp_t gfp);
3315 3332
3316/* 3333/*
3317 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used 3334 * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used
@@ -3323,6 +3340,14 @@ int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
3323 struct ieee80211_channel *chan, 3340 struct ieee80211_channel *chan,
3324 enum nl80211_channel_type channel_type); 3341 enum nl80211_channel_type channel_type);
3325 3342
3343/*
3344 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
3345 * @rate: given rate_info to calculate bitrate from
3346 *
3347 * return 0 if MCS index >= 32
3348 */
3349u16 cfg80211_calculate_bitrate(struct rate_info *rate);
3350
3326/* Logging, debugging and troubleshooting/diagnostic helpers. */ 3351/* Logging, debugging and troubleshooting/diagnostic helpers. */
3327 3352
3328/* wiphy_printk helpers, similar to dev_printk */ 3353/* 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/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/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 8294f44c425a..774cd3e0dcb6 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -230,7 +230,8 @@ enum ieee80211_rssi_event {
230 * valid in station mode only while @assoc is true and if also 230 * valid in station mode only while @assoc is true and if also
231 * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf 231 * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf
232 * @ps_dtim_period) 232 * @ps_dtim_period)
233 * @timestamp: beacon timestamp 233 * @last_tsf: last beacon's/probe response's TSF timestamp (could be old
234 * as it may have been received during scanning long ago)
234 * @beacon_int: beacon interval 235 * @beacon_int: beacon interval
235 * @assoc_capability: capabilities taken from assoc resp 236 * @assoc_capability: capabilities taken from assoc resp
236 * @basic_rates: bitmap of basic rates, each bit stands for an 237 * @basic_rates: bitmap of basic rates, each bit stands for an
@@ -277,7 +278,7 @@ struct ieee80211_bss_conf {
277 u8 dtim_period; 278 u8 dtim_period;
278 u16 beacon_int; 279 u16 beacon_int;
279 u16 assoc_capability; 280 u16 assoc_capability;
280 u64 timestamp; 281 u64 last_tsf;
281 u32 basic_rates; 282 u32 basic_rates;
282 int mcast_rate[IEEE80211_NUM_BANDS]; 283 int mcast_rate[IEEE80211_NUM_BANDS];
283 u16 ht_operation_mode; 284 u16 ht_operation_mode;
@@ -342,9 +343,9 @@ struct ieee80211_bss_conf {
342 * used to indicate that a frame was already retried due to PS 343 * used to indicate that a frame was already retried due to PS
343 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211, 344 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
344 * used to indicate frame should not be encrypted 345 * used to indicate frame should not be encrypted
345 * @IEEE80211_TX_CTL_POLL_RESPONSE: This frame is a response to a poll 346 * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll
346 * frame (PS-Poll or uAPSD) and should be sent although the station 347 * frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must
347 * is in powersave mode. 348 * be sent although the station is in powersave mode.
348 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the 349 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
349 * transmit function after the current frame, this can be used 350 * transmit function after the current frame, this can be used
350 * by drivers to kick the DMA queue only if unset or when the 351 * by drivers to kick the DMA queue only if unset or when the
@@ -400,7 +401,7 @@ enum mac80211_tx_control_flags {
400 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 401 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
401 IEEE80211_TX_INTFL_RETRIED = BIT(15), 402 IEEE80211_TX_INTFL_RETRIED = BIT(15),
402 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), 403 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
403 IEEE80211_TX_CTL_POLL_RESPONSE = BIT(17), 404 IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17),
404 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), 405 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
405 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), 406 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
406 /* hole at 20, use later */ 407 /* hole at 20, use later */
@@ -426,7 +427,7 @@ enum mac80211_tx_control_flags {
426 IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \ 427 IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \
427 IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \ 428 IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \
428 IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \ 429 IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \
429 IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_POLL_RESPONSE | \ 430 IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER | \
430 IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \ 431 IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \
431 IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP) 432 IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP)
432 433
@@ -660,6 +661,8 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
660 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 661 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
661 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used 662 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
662 * @RX_FLAG_SHORT_GI: Short guard interval was used 663 * @RX_FLAG_SHORT_GI: Short guard interval was used
664 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
665 * Valid only for data frames (mainly A-MPDU)
663 */ 666 */
664enum mac80211_rx_flags { 667enum mac80211_rx_flags {
665 RX_FLAG_MMIC_ERROR = 1<<0, 668 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -673,6 +676,7 @@ enum mac80211_rx_flags {
673 RX_FLAG_HT = 1<<9, 676 RX_FLAG_HT = 1<<9,
674 RX_FLAG_40MHZ = 1<<10, 677 RX_FLAG_40MHZ = 1<<10,
675 RX_FLAG_SHORT_GI = 1<<11, 678 RX_FLAG_SHORT_GI = 1<<11,
679 RX_FLAG_NO_SIGNAL_VAL = 1<<12,
676}; 680};
677 681
678/** 682/**
@@ -853,6 +857,21 @@ struct ieee80211_channel_switch {
853}; 857};
854 858
855/** 859/**
860 * enum ieee80211_vif_flags - virtual interface flags
861 *
862 * @IEEE80211_VIF_BEACON_FILTER: the device performs beacon filtering
863 * on this virtual interface to avoid unnecessary CPU wakeups
864 * @IEEE80211_VIF_SUPPORTS_CQM_RSSI: the device can do connection quality
865 * monitoring on this virtual interface -- i.e. it can monitor
866 * connection quality related parameters, such as the RSSI level and
867 * provide notifications if configured trigger levels are reached.
868 */
869enum ieee80211_vif_flags {
870 IEEE80211_VIF_BEACON_FILTER = BIT(0),
871 IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1),
872};
873
874/**
856 * struct ieee80211_vif - per-interface data 875 * struct ieee80211_vif - per-interface data
857 * 876 *
858 * Data in this structure is continually present for driver 877 * Data in this structure is continually present for driver
@@ -864,6 +883,10 @@ struct ieee80211_channel_switch {
864 * @addr: address of this interface 883 * @addr: address of this interface
865 * @p2p: indicates whether this AP or STA interface is a p2p 884 * @p2p: indicates whether this AP or STA interface is a p2p
866 * interface, i.e. a GO or p2p-sta respectively 885 * interface, i.e. a GO or p2p-sta respectively
886 * @driver_flags: flags/capabilities the driver has for this interface,
887 * these need to be set (or cleared) when the interface is added
888 * or, if supported by the driver, the interface type is changed
889 * at runtime, mac80211 will never touch this field
867 * @drv_priv: data area for driver use, will always be aligned to 890 * @drv_priv: data area for driver use, will always be aligned to
868 * sizeof(void *). 891 * sizeof(void *).
869 */ 892 */
@@ -872,6 +895,7 @@ struct ieee80211_vif {
872 struct ieee80211_bss_conf bss_conf; 895 struct ieee80211_bss_conf bss_conf;
873 u8 addr[ETH_ALEN]; 896 u8 addr[ETH_ALEN];
874 bool p2p; 897 bool p2p;
898 u32 driver_flags;
875 /* must be last */ 899 /* must be last */
876 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 900 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
877}; 901};
@@ -963,6 +987,25 @@ enum set_key_cmd {
963}; 987};
964 988
965/** 989/**
990 * enum ieee80211_sta_state - station state
991 *
992 * @IEEE80211_STA_NOTEXIST: station doesn't exist at all,
993 * this is a special state for add/remove transitions
994 * @IEEE80211_STA_NONE: station exists without special state
995 * @IEEE80211_STA_AUTH: station is authenticated
996 * @IEEE80211_STA_ASSOC: station is associated
997 * @IEEE80211_STA_AUTHORIZED: station is authorized (802.1X)
998 */
999enum ieee80211_sta_state {
1000 /* NOTE: These need to be ordered correctly! */
1001 IEEE80211_STA_NOTEXIST,
1002 IEEE80211_STA_NONE,
1003 IEEE80211_STA_AUTH,
1004 IEEE80211_STA_ASSOC,
1005 IEEE80211_STA_AUTHORIZED,
1006};
1007
1008/**
966 * struct ieee80211_sta - station table entry 1009 * struct ieee80211_sta - station table entry
967 * 1010 *
968 * A station table entry represents a station we are possibly 1011 * A station table entry represents a station we are possibly
@@ -1080,10 +1123,6 @@ enum sta_notify_cmd {
1080 * @IEEE80211_HW_MFP_CAPABLE: 1123 * @IEEE80211_HW_MFP_CAPABLE:
1081 * Hardware supports management frame protection (MFP, IEEE 802.11w). 1124 * Hardware supports management frame protection (MFP, IEEE 802.11w).
1082 * 1125 *
1083 * @IEEE80211_HW_BEACON_FILTER:
1084 * Hardware supports dropping of irrelevant beacon frames to
1085 * avoid waking up cpu.
1086 *
1087 * @IEEE80211_HW_SUPPORTS_STATIC_SMPS: 1126 * @IEEE80211_HW_SUPPORTS_STATIC_SMPS:
1088 * Hardware supports static spatial multiplexing powersave, 1127 * Hardware supports static spatial multiplexing powersave,
1089 * ie. can turn off all but one chain even on HT connections 1128 * ie. can turn off all but one chain even on HT connections
@@ -1109,11 +1148,6 @@ enum sta_notify_cmd {
1109 * When this flag is set, signaling beacon-loss will cause an immediate 1148 * When this flag is set, signaling beacon-loss will cause an immediate
1110 * change to disassociated state. 1149 * change to disassociated state.
1111 * 1150 *
1112 * @IEEE80211_HW_SUPPORTS_CQM_RSSI:
1113 * Hardware can do connection quality monitoring - i.e. it can monitor
1114 * connection quality related parameters, such as the RSSI level and
1115 * provide notifications if configured trigger levels are reached.
1116 *
1117 * @IEEE80211_HW_NEED_DTIM_PERIOD: 1151 * @IEEE80211_HW_NEED_DTIM_PERIOD:
1118 * This device needs to know the DTIM period for the BSS before 1152 * This device needs to know the DTIM period for the BSS before
1119 * associating. 1153 * associating.
@@ -1135,6 +1169,10 @@ enum sta_notify_cmd {
1135 * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session 1169 * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session
1136 * setup strictly in HW. mac80211 should not attempt to do this in 1170 * setup strictly in HW. mac80211 should not attempt to do this in
1137 * software. 1171 * software.
1172 *
1173 * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while
1174 * being idle (i.e. mac80211 doesn't have to go idle-off during the
1175 * the scan).
1138 */ 1176 */
1139enum ieee80211_hw_flags { 1177enum ieee80211_hw_flags {
1140 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1178 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1151,16 +1189,17 @@ enum ieee80211_hw_flags {
1151 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11, 1189 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11,
1152 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, 1190 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
1153 IEEE80211_HW_MFP_CAPABLE = 1<<13, 1191 IEEE80211_HW_MFP_CAPABLE = 1<<13,
1154 IEEE80211_HW_BEACON_FILTER = 1<<14, 1192 /* reuse bit 14 */
1155 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, 1193 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15,
1156 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, 1194 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
1157 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, 1195 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
1158 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, 1196 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
1159 IEEE80211_HW_CONNECTION_MONITOR = 1<<19, 1197 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
1160 IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, 1198 /* reuse bit 20 */
1161 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, 1199 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
1162 IEEE80211_HW_AP_LINK_PS = 1<<22, 1200 IEEE80211_HW_AP_LINK_PS = 1<<22,
1163 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1201 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
1202 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24,
1164}; 1203};
1165 1204
1166/** 1205/**
@@ -1447,8 +1486,8 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1447 * way the host will only receive beacons where some relevant information 1486 * way the host will only receive beacons where some relevant information
1448 * (for example ERP protection or WMM settings) have changed. 1487 * (for example ERP protection or WMM settings) have changed.
1449 * 1488 *
1450 * Beacon filter support is advertised with the %IEEE80211_HW_BEACON_FILTER 1489 * Beacon filter support is advertised with the %IEEE80211_VIF_BEACON_FILTER
1451 * hardware capability. The driver needs to enable beacon filter support 1490 * interface capability. The driver needs to enable beacon filter support
1452 * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When 1491 * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When
1453 * power save is enabled, the stack will not check for beacon loss and the 1492 * power save is enabled, the stack will not check for beacon loss and the
1454 * driver needs to notify about loss of beacons with ieee80211_beacon_loss(). 1493 * driver needs to notify about loss of beacons with ieee80211_beacon_loss().
@@ -1600,7 +1639,7 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1600 * the station sends a PS-Poll or a uAPSD trigger frame, mac80211 1639 * the station sends a PS-Poll or a uAPSD trigger frame, mac80211
1601 * will inform the driver of this with the @allow_buffered_frames 1640 * will inform the driver of this with the @allow_buffered_frames
1602 * callback; this callback is optional. mac80211 will then transmit 1641 * callback; this callback is optional. mac80211 will then transmit
1603 * the frames as usual and set the %IEEE80211_TX_CTL_POLL_RESPONSE 1642 * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER
1604 * on each frame. The last frame in the service period (or the only 1643 * on each frame. The last frame in the service period (or the only
1605 * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to 1644 * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to
1606 * indicate that it ends the service period; as this frame must have 1645 * indicate that it ends the service period; as this frame must have
@@ -1608,6 +1647,9 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1608 * When TX status is reported for this frame, the service period is 1647 * When TX status is reported for this frame, the service period is
1609 * marked has having ended and a new one can be started by the peer. 1648 * marked has having ended and a new one can be started by the peer.
1610 * 1649 *
1650 * Additionally, non-bufferable MMPDUs can also be transmitted by
1651 * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them.
1652 *
1611 * Another race condition can happen on some devices like iwlwifi 1653 * Another race condition can happen on some devices like iwlwifi
1612 * when there are frames queued for the station and it wakes up 1654 * when there are frames queued for the station and it wakes up
1613 * or polls; the frames that are already queued could end up being 1655 * or polls; the frames that are already queued could end up being
@@ -1726,20 +1768,6 @@ enum ieee80211_ampdu_mlme_action {
1726}; 1768};
1727 1769
1728/** 1770/**
1729 * enum ieee80211_tx_sync_type - TX sync type
1730 * @IEEE80211_TX_SYNC_AUTH: sync TX for authentication
1731 * (and possibly also before direct probe)
1732 * @IEEE80211_TX_SYNC_ASSOC: sync TX for association
1733 * @IEEE80211_TX_SYNC_ACTION: sync TX for action frame
1734 * (not implemented yet)
1735 */
1736enum ieee80211_tx_sync_type {
1737 IEEE80211_TX_SYNC_AUTH,
1738 IEEE80211_TX_SYNC_ASSOC,
1739 IEEE80211_TX_SYNC_ACTION,
1740};
1741
1742/**
1743 * enum ieee80211_frame_release_type - frame release reason 1771 * enum ieee80211_frame_release_type - frame release reason
1744 * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll 1772 * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll
1745 * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to 1773 * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to
@@ -1849,26 +1877,6 @@ enum ieee80211_frame_release_type {
1849 * of the bss parameters has changed when a call is made. The callback 1877 * of the bss parameters has changed when a call is made. The callback
1850 * can sleep. 1878 * can sleep.
1851 * 1879 *
1852 * @tx_sync: Called before a frame is sent to an AP/GO. In the GO case, the
1853 * driver should sync with the GO's powersaving so the device doesn't
1854 * transmit the frame while the GO is asleep. In the regular AP case
1855 * it may be used by drivers for devices implementing other restrictions
1856 * on talking to APs, e.g. due to regulatory enforcement or just HW
1857 * restrictions.
1858 * This function is called for every authentication, association and
1859 * action frame separately since applications might attempt to auth
1860 * with multiple APs before chosing one to associate to. If it returns
1861 * an error, the corresponding authentication, association or frame
1862 * transmission is aborted and reported as having failed. It is always
1863 * called after tuning to the correct channel.
1864 * The callback might be called multiple times before @finish_tx_sync
1865 * (but @finish_tx_sync will be called once for each) but in practice
1866 * this is unlikely to happen. It can also refuse in that case if the
1867 * driver cannot handle that situation.
1868 * This callback can sleep.
1869 * @finish_tx_sync: Called as a counterpart to @tx_sync, unless that returned
1870 * an error. This callback can sleep.
1871 *
1872 * @prepare_multicast: Prepare for multicast filter configuration. 1880 * @prepare_multicast: Prepare for multicast filter configuration.
1873 * This callback is optional, and its return value is passed 1881 * This callback is optional, and its return value is passed
1874 * to configure_filter(). This callback must be atomic. 1882 * to configure_filter(). This callback must be atomic.
@@ -1964,6 +1972,13 @@ enum ieee80211_frame_release_type {
1964 * in AP mode, this callback will not be called when the flag 1972 * in AP mode, this callback will not be called when the flag
1965 * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic. 1973 * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic.
1966 * 1974 *
1975 * @sta_state: Notifies low level driver about state transition of a
1976 * station (which can be the AP, a client, IBSS/WDS/mesh peer etc.)
1977 * This callback is mutually exclusive with @sta_add/@sta_remove.
1978 * It must not fail for down transitions but may fail for transitions
1979 * up the list of states.
1980 * The callback can sleep.
1981 *
1967 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1982 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1968 * bursting) for a hardware TX queue. 1983 * bursting) for a hardware TX queue.
1969 * Returns a negative error code on failure. 1984 * Returns a negative error code on failure.
@@ -2099,7 +2114,7 @@ enum ieee80211_frame_release_type {
2099 * @allow_buffered_frames: Prepare device to allow the given number of frames 2114 * @allow_buffered_frames: Prepare device to allow the given number of frames
2100 * to go out to the given station. The frames will be sent by mac80211 2115 * to go out to the given station. The frames will be sent by mac80211
2101 * via the usual TX path after this call. The TX information for frames 2116 * via the usual TX path after this call. The TX information for frames
2102 * released will also have the %IEEE80211_TX_CTL_POLL_RESPONSE flag set 2117 * released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set
2103 * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case 2118 * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case
2104 * frames from multiple TIDs are released and the driver might reorder 2119 * frames from multiple TIDs are released and the driver might reorder
2105 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag 2120 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
@@ -2133,13 +2148,6 @@ struct ieee80211_ops {
2133 struct ieee80211_bss_conf *info, 2148 struct ieee80211_bss_conf *info,
2134 u32 changed); 2149 u32 changed);
2135 2150
2136 int (*tx_sync)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2137 const u8 *bssid, enum ieee80211_tx_sync_type type);
2138 void (*finish_tx_sync)(struct ieee80211_hw *hw,
2139 struct ieee80211_vif *vif,
2140 const u8 *bssid,
2141 enum ieee80211_tx_sync_type type);
2142
2143 u64 (*prepare_multicast)(struct ieee80211_hw *hw, 2151 u64 (*prepare_multicast)(struct ieee80211_hw *hw,
2144 struct netdev_hw_addr_list *mc_list); 2152 struct netdev_hw_addr_list *mc_list);
2145 void (*configure_filter)(struct ieee80211_hw *hw, 2153 void (*configure_filter)(struct ieee80211_hw *hw,
@@ -2183,6 +2191,10 @@ struct ieee80211_ops {
2183 struct ieee80211_sta *sta); 2191 struct ieee80211_sta *sta);
2184 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2192 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2185 enum sta_notify_cmd, struct ieee80211_sta *sta); 2193 enum sta_notify_cmd, struct ieee80211_sta *sta);
2194 int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2195 struct ieee80211_sta *sta,
2196 enum ieee80211_sta_state old_state,
2197 enum ieee80211_sta_state new_state);
2186 int (*conf_tx)(struct ieee80211_hw *hw, 2198 int (*conf_tx)(struct ieee80211_hw *hw,
2187 struct ieee80211_vif *vif, u16 queue, 2199 struct ieee80211_vif *vif, u16 queue,
2188 const struct ieee80211_tx_queue_params *params); 2200 const struct ieee80211_tx_queue_params *params);
@@ -3317,7 +3329,7 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
3317 * 3329 *
3318 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3330 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3319 * 3331 *
3320 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER and 3332 * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER and
3321 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the 3333 * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the
3322 * hardware is not receiving beacons with this function. 3334 * hardware is not receiving beacons with this function.
3323 */ 3335 */
@@ -3328,7 +3340,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif);
3328 * 3340 *
3329 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3341 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3330 * 3342 *
3331 * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER, and 3343 * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER, and
3332 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver 3344 * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
3333 * needs to inform if the connection to the AP has been lost. 3345 * needs to inform if the connection to the AP has been lost.
3334 * 3346 *
@@ -3398,7 +3410,7 @@ void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif);
3398 * @rssi_event: the RSSI trigger event type 3410 * @rssi_event: the RSSI trigger event type
3399 * @gfp: context flags 3411 * @gfp: context flags
3400 * 3412 *
3401 * When the %IEEE80211_HW_SUPPORTS_CQM_RSSI is set, and a connection quality 3413 * When the %IEEE80211_VIF_SUPPORTS_CQM_RSSI is set, and a connection quality
3402 * monitoring is configured with an rssi threshold, the driver will inform 3414 * monitoring is configured with an rssi threshold, the driver will inform
3403 * whenever the rssi level reaches the threshold. 3415 * whenever the rssi level reaches the threshold.
3404 */ 3416 */
@@ -3517,6 +3529,8 @@ enum rate_control_changed {
3517 * @hw: The hardware the algorithm is invoked for. 3529 * @hw: The hardware the algorithm is invoked for.
3518 * @sband: The band this frame is being transmitted on. 3530 * @sband: The band this frame is being transmitted on.
3519 * @bss_conf: the current BSS configuration 3531 * @bss_conf: the current BSS configuration
3532 * @skb: the skb that will be transmitted, the control information in it needs
3533 * to be filled in
3520 * @reported_rate: The rate control algorithm can fill this in to indicate 3534 * @reported_rate: The rate control algorithm can fill this in to indicate
3521 * which rate should be reported to userspace as the current rate and 3535 * which rate should be reported to userspace as the current rate and
3522 * used for rate calculations in the mesh network. 3536 * used for rate calculations in the mesh network.
@@ -3524,12 +3538,11 @@ enum rate_control_changed {
3524 * RTS threshold 3538 * RTS threshold
3525 * @short_preamble: whether mac80211 will request short-preamble transmission 3539 * @short_preamble: whether mac80211 will request short-preamble transmission
3526 * if the selected rate supports it 3540 * if the selected rate supports it
3527 * @max_rate_idx: user-requested maximum rate (not MCS for now) 3541 * @max_rate_idx: user-requested maximum (legacy) rate
3528 * (deprecated; this will be removed once drivers get updated to use 3542 * (deprecated; this will be removed once drivers get updated to use
3529 * rate_idx_mask) 3543 * rate_idx_mask)
3530 * @rate_idx_mask: user-requested rate mask (not MCS for now) 3544 * @rate_idx_mask: user-requested (legacy) rate mask
3531 * @skb: the skb that will be transmitted, the control information in it needs 3545 * @rate_idx_mcs_mask: user-requested MCS rate mask
3532 * to be filled in
3533 * @bss: whether this frame is sent out in AP or IBSS mode 3546 * @bss: whether this frame is sent out in AP or IBSS mode
3534 */ 3547 */
3535struct ieee80211_tx_rate_control { 3548struct ieee80211_tx_rate_control {
@@ -3541,6 +3554,7 @@ struct ieee80211_tx_rate_control {
3541 bool rts, short_preamble; 3554 bool rts, short_preamble;
3542 u8 max_rate_idx; 3555 u8 max_rate_idx;
3543 u32 rate_idx_mask; 3556 u32 rate_idx_mask;
3557 u8 rate_idx_mcs_mask[IEEE80211_HT_MCS_MASK_LEN];
3544 bool bss; 3558 bool bss;
3545}; 3559};
3546 3560
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.h b/include/net/netfilter/nf_conntrack.h
index 8a2b0ae7dbd2..ab86036bbf0c 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -209,7 +209,7 @@ extern struct nf_conntrack_tuple_hash *
209__nf_conntrack_find(struct net *net, u16 zone, 209__nf_conntrack_find(struct net *net, u16 zone,
210 const struct nf_conntrack_tuple *tuple); 210 const struct nf_conntrack_tuple *tuple);
211 211
212extern void nf_conntrack_hash_insert(struct nf_conn *ct); 212extern int nf_conntrack_hash_check_insert(struct nf_conn *ct);
213extern void nf_ct_delete_from_lists(struct nf_conn *ct); 213extern void nf_ct_delete_from_lists(struct nf_conn *ct);
214extern void nf_ct_insert_dying_list(struct nf_conn *ct); 214extern void nf_ct_insert_dying_list(struct nf_conn *ct);
215 215
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..90c67c7db7e9 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;
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
new file mode 100644
index 000000000000..0e04db4a0865
--- /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 __u8 l4num;
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..7e1544e8f70d 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;
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/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/rtnetlink.h b/include/net/rtnetlink.h
index 678f1ffaf843..370293901971 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -6,7 +6,7 @@
6 6
7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); 7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); 8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9typedef u16 (*rtnl_calcit_func)(struct sk_buff *); 9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *);
10 10
11extern int __rtnl_register(int protocol, int msgtype, 11extern int __rtnl_register(int protocol, int msgtype,
12 rtnl_doit_func, rtnl_dumpit_func, 12 rtnl_doit_func, rtnl_dumpit_func,
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 ad8d0a865551..f75a04d752cb 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1139,35 +1139,27 @@ static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)
1139/* MD5 Signature */ 1139/* MD5 Signature */
1140struct crypto_hash; 1140struct crypto_hash;
1141 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
1142/* - key database */ 1149/* - key database */
1143struct tcp_md5sig_key { 1150struct tcp_md5sig_key {
1144 u8 *key; 1151 struct hlist_node node;
1145 u8 keylen; 1152 u8 keylen;
1146}; 1153 u8 family; /* AF_INET or AF_INET6 */
1147 1154 union tcp_md5_addr addr;
1148struct tcp4_md5sig_key { 1155 u8 key[TCP_MD5SIG_MAXKEYLEN];
1149 struct tcp_md5sig_key base; 1156 struct rcu_head rcu;
1150 __be32 addr;
1151};
1152
1153struct tcp6_md5sig_key {
1154 struct tcp_md5sig_key base;
1155#if 0
1156 u32 scope_id; /* XXX */
1157#endif
1158 struct in6_addr addr;
1159}; 1157};
1160 1158
1161/* - sock block */ 1159/* - sock block */
1162struct tcp_md5sig_info { 1160struct tcp_md5sig_info {
1163 struct tcp4_md5sig_key *keys4; 1161 struct hlist_head head;
1164#if IS_ENABLED(CONFIG_IPV6) 1162 struct rcu_head rcu;
1165 struct tcp6_md5sig_key *keys6;
1166 u32 entries6;
1167 u32 alloced6;
1168#endif
1169 u32 entries4;
1170 u32 alloced4;
1171}; 1163};
1172 1164
1173/* - pseudo header */ 1165/* - pseudo header */
@@ -1204,19 +1196,25 @@ extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1204 const struct sock *sk, 1196 const struct sock *sk,
1205 const struct request_sock *req, 1197 const struct request_sock *req,
1206 const struct sk_buff *skb); 1198 const struct sk_buff *skb);
1207extern 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,
1208 struct sock *addr_sk); 1200 int family, const u8 *newkey,
1209extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey, 1201 u8 newkeylen, gfp_t gfp);
1210 u8 newkeylen); 1202extern int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr,
1211extern 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);
1212 1206
1213#ifdef CONFIG_TCP_MD5SIG 1207#ifdef CONFIG_TCP_MD5SIG
1214#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ 1208extern struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1215 &(struct tcp_md5sig_key) { \ 1209 const union tcp_md5_addr *addr, int family);
1216 .key = (twsk)->tw_md5_key, \ 1210#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key)
1217 .keylen = (twsk)->tw_md5_keylen, \
1218 } : NULL)
1219#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}
1220#define tcp_twsk_md5_key(twsk) NULL 1218#define tcp_twsk_md5_key(twsk) NULL
1221#endif 1219#endif
1222 1220
@@ -1365,8 +1363,9 @@ static inline void tcp_push_pending_frames(struct sock *sk)
1365 } 1363 }
1366} 1364}
1367 1365
1368/* 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
1369 * 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.
1370 */ 1369 */
1371static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp) 1370static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp)
1372{ 1371{
@@ -1471,10 +1470,6 @@ struct tcp_sock_af_ops {
1471 const struct sock *sk, 1470 const struct sock *sk,
1472 const struct request_sock *req, 1471 const struct request_sock *req,
1473 const struct sk_buff *skb); 1472 const struct sk_buff *skb);
1474 int (*md5_add) (struct sock *sk,
1475 struct sock *addr_sk,
1476 u8 *newkey,
1477 u8 len);
1478 int (*md5_parse) (struct sock *sk, 1473 int (*md5_parse) (struct sock *sk,
1479 char __user *optval, 1474 char __user *optval,
1480 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/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/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)