diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 00:04:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 00:04:47 -0400 |
commit | 3b59bf081622b6446db77ad06c93fe23677bc533 (patch) | |
tree | 3f4bb5a27c90cc86994a1f6d3c53fbf9208003cb /include/net | |
parent | e45836fafe157df137a837093037f741ad8f4c90 (diff) | |
parent | bbdb32cb5b73597386913d052165423b9d736145 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking merge from David Miller:
"1) Move ixgbe driver over to purely page based buffering on receive.
From Alexander Duyck.
2) Add receive packet steering support to e1000e, from Bruce Allan.
3) Convert TCP MD5 support over to RCU, from Eric Dumazet.
4) Reduce cpu usage in handling out-of-order TCP packets on modern
systems, also from Eric Dumazet.
5) Support the IP{,V6}_UNICAST_IF socket options, making the wine
folks happy, from Erich Hoover.
6) Support VLAN trunking from guests in hyperv driver, from Haiyang
Zhang.
7) Support byte-queue-limtis in r8169, from Igor Maravic.
8) Outline code intended for IP_RECVTOS in IP_PKTOPTIONS existed but
was never properly implemented, Jiri Benc fixed that.
9) 64-bit statistics support in r8169 and 8139too, from Junchang Wang.
10) Support kernel side dump filtering by ctmark in netfilter
ctnetlink, from Pablo Neira Ayuso.
11) Support byte-queue-limits in gianfar driver, from Paul Gortmaker.
12) Add new peek socket options to assist with socket migration, from
Pavel Emelyanov.
13) Add sch_plug packet scheduler whose queue is controlled by
userland daemons using explicit freeze and release commands. From
Shriram Rajagopalan.
14) Fix FCOE checksum offload handling on transmit, from Yi Zou."
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1846 commits)
Fix pppol2tp getsockname()
Remove printk from rds_sendmsg
ipv6: fix incorrent ipv6 ipsec packet fragment
cpsw: Hook up default ndo_change_mtu.
net: qmi_wwan: fix build error due to cdc-wdm dependecy
netdev: driver: ethernet: Add TI CPSW driver
netdev: driver: ethernet: add cpsw address lookup engine support
phy: add am79c874 PHY support
mlx4_core: fix race on comm channel
bonding: send igmp report for its master
fs_enet: Add MPC5125 FEC support and PHY interface selection
net: bpf_jit: fix BPF_S_LDX_B_MSH compilation
net: update the usage of CHECKSUM_UNNECESSARY
fcoe: use CHECKSUM_UNNECESSARY instead of CHECKSUM_PARTIAL on tx
net: do not do gso for CHECKSUM_UNNECESSARY in netif_needs_gso
ixgbe: Fix issues with SR-IOV loopback when flow control is disabled
net/hyperv: Fix the code handling tx busy
ixgbe: fix namespace issues when FCoE/DCB is not enabled
rtlwifi: Remove unused ETH_ADDR_LEN defines
igbvf: Use ETH_ALEN
...
Fix up fairly trivial conflicts in drivers/isdn/gigaset/interface.c and
drivers/net/usb/{Kconfig,qmi_wwan.c} as per David.
Diffstat (limited to 'include/net')
34 files changed, 1082 insertions, 583 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, | |||
160 | extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr); | 160 | extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr); |
161 | extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr); | 161 | extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr); |
162 | extern void ipv6_sock_ac_close(struct sock *sk); | 162 | extern void ipv6_sock_ac_close(struct sock *sk); |
163 | extern int inet6_ac_check(struct sock *sk, const struct in6_addr *addr, int ifindex); | ||
164 | 163 | ||
165 | extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); | 164 | extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); |
166 | extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); | 165 | extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); |
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 | ||
18 | static inline struct neighbour *__ipv4_neigh_lookup(struct neigh_table *tbl, struct net_device *dev, u32 key) | 18 | static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 key) |
19 | { | 19 | { |
20 | struct neigh_hash_table *nht; | 20 | struct neigh_hash_table *nht; |
21 | struct neighbour *n; | 21 | struct neighbour *n; |
22 | u32 hash_val; | 22 | u32 hash_val; |
23 | 23 | ||
24 | rcu_read_lock_bh(); | 24 | rcu_read_lock_bh(); |
25 | nht = rcu_dereference_bh(tbl->nht); | 25 | nht = rcu_dereference_bh(arp_tbl.nht); |
26 | hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift); | 26 | hash_val = arp_hashfn(key, dev, nht->hash_rnd[0]) >> (32 - nht->hash_shift); |
27 | for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); | 27 | for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); |
28 | n != NULL; | 28 | n != NULL; |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 4a82ca0bb0b2..262ebd1747d4 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -109,12 +109,14 @@ struct bt_power { | |||
109 | */ | 109 | */ |
110 | #define BT_CHANNEL_POLICY_AMP_PREFERRED 2 | 110 | #define BT_CHANNEL_POLICY_AMP_PREFERRED 2 |
111 | 111 | ||
112 | __printf(2, 3) | 112 | __printf(1, 2) |
113 | int bt_printk(const char *level, const char *fmt, ...); | 113 | int bt_info(const char *fmt, ...); |
114 | __printf(1, 2) | ||
115 | int 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 */ |
120 | enum { | 122 | enum { |
@@ -129,6 +131,33 @@ enum { | |||
129 | BT_CLOSED | 131 | BT_CLOSED |
130 | }; | 132 | }; |
131 | 133 | ||
134 | /* If unused will be removed by compiler */ | ||
135 | static 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 */ |
133 | typedef struct { | 162 | typedef struct { |
134 | __u8 b[6]; | 163 | __u8 b[6]; |
@@ -193,7 +222,6 @@ struct bt_skb_cb { | |||
193 | __u16 tx_seq; | 222 | __u16 tx_seq; |
194 | __u8 retries; | 223 | __u8 retries; |
195 | __u8 sar; | 224 | __u8 sar; |
196 | unsigned short channel; | ||
197 | __u8 force_active; | 225 | __u8 force_active; |
198 | }; | 226 | }; |
199 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) | 227 | #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 00596e816b4d..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 | */ |
95 | enum { | 87 | enum { |
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 |
668 | struct hci_cp_write_eir { | 695 | struct 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 |
700 | struct hci_cp_write_le_host_supported { | 727 | struct 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 | ||
1186 | struct hci_comp_blocks_info { | ||
1187 | __le16 handle; | ||
1188 | __le16 pkts; | ||
1189 | __le16 blocks; | ||
1190 | } __packed; | ||
1191 | |||
1192 | struct 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 |
1160 | struct hci_ev_le_conn_complete { | 1200 | struct 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 | ||
1292 | struct hci_filter { | 1333 | struct 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 | ||
1391 | extern bool enable_hs; | 1432 | extern bool enable_hs; |
1433 | extern 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 453893b3120e..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 | ||
46 | struct inquiry_entry { | 46 | struct 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 | ||
52 | struct inquiry_cache { | 59 | struct 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 | ||
57 | struct hci_conn_hash { | 74 | struct hci_conn_hash { |
@@ -72,18 +89,16 @@ struct bt_uuid { | |||
72 | u8 svc_hint; | 89 | u8 svc_hint; |
73 | }; | 90 | }; |
74 | 91 | ||
75 | struct key_master_id { | 92 | struct smp_ltk { |
76 | __le16 ediv; | 93 | struct list_head list; |
77 | u8 rand[8]; | ||
78 | } __packed; | ||
79 | |||
80 | struct 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 | ||
89 | struct link_key { | 104 | struct 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 | ||
99 | struct oob_data { | 112 | struct oob_data { |
@@ -109,11 +122,19 @@ struct adv_entry { | |||
109 | u8 bdaddr_type; | 122 | u8 bdaddr_type; |
110 | }; | 123 | }; |
111 | 124 | ||
125 | struct 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 |
113 | struct hci_dev { | 135 | struct 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 | ||
351 | static inline void inquiry_cache_init(struct hci_dev *hdev) | 372 | static 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 | ||
380 | bool hci_discovery_active(struct hci_dev *hdev); | ||
381 | |||
382 | void hci_discovery_set_state(struct hci_dev *hdev, int state); | ||
383 | |||
357 | static inline int inquiry_cache_empty(struct hci_dev *hdev) | 384 | static 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 | ||
363 | static inline long inquiry_cache_age(struct hci_dev *hdev) | 389 | static 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 | ||
374 | struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, | 400 | struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, |
375 | bdaddr_t *bdaddr); | 401 | bdaddr_t *bdaddr); |
376 | void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); | 402 | struct inquiry_entry *hci_inquiry_cache_lookup_unknown(struct hci_dev *hdev, |
403 | bdaddr_t *bdaddr); | ||
404 | struct inquiry_entry *hci_inquiry_cache_lookup_resolve(struct hci_dev *hdev, | ||
405 | bdaddr_t *bdaddr, | ||
406 | int state); | ||
407 | void hci_inquiry_cache_update_resolve(struct hci_dev *hdev, | ||
408 | struct inquiry_entry *ie); | ||
409 | bool 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 ----- */ |
379 | enum { | 413 | enum { |
@@ -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 | ||
427 | static 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 | |||
389 | static inline void hci_conn_hash_init(struct hci_dev *hdev) | 434 | static inline void hci_conn_hash_init(struct hci_dev *hdev) |
390 | { | 435 | { |
391 | struct hci_conn_hash *h = &hdev->conn_hash; | 436 | struct hci_conn_hash *h = &hdev->conn_hash; |
@@ -566,36 +611,33 @@ static inline void hci_conn_put(struct hci_conn *conn) | |||
566 | } | 611 | } |
567 | 612 | ||
568 | /* ----- HCI Devices ----- */ | 613 | /* ----- HCI Devices ----- */ |
569 | static inline void __hci_dev_put(struct hci_dev *d) | 614 | static 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 | /* | 619 | static 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) \ | ||
580 | do { \ | ||
581 | __hci_dev_put(d); \ | ||
582 | module_put(d->owner); \ | ||
583 | } while (0) | ||
584 | |||
585 | static 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 | |||
631 | static inline void *hci_get_drvdata(struct hci_dev *hdev) | ||
632 | { | ||
633 | return dev_get_drvdata(&hdev->dev); | ||
634 | } | ||
635 | |||
636 | static inline void hci_set_drvdata(struct hci_dev *hdev, void *data) | ||
637 | { | ||
638 | dev_set_drvdata(&hdev->dev, data); | ||
639 | } | ||
640 | |||
599 | struct hci_dev *hci_dev_get(int index); | 641 | struct hci_dev *hci_dev_get(int index); |
600 | struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); | 642 | struct 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 | ||
620 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); | 662 | struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); |
621 | int hci_blacklist_clear(struct hci_dev *hdev); | 663 | int hci_blacklist_clear(struct hci_dev *hdev); |
622 | int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr); | 664 | int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
623 | int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr); | 665 | int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
624 | 666 | ||
625 | int hci_uuids_clear(struct hci_dev *hdev); | 667 | int hci_uuids_clear(struct hci_dev *hdev); |
626 | 668 | ||
627 | int hci_link_keys_clear(struct hci_dev *hdev); | 669 | int hci_link_keys_clear(struct hci_dev *hdev); |
628 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 670 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
629 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | 671 | int 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); |
631 | struct link_key *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); | 673 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); |
632 | struct link_key *hci_find_link_key_type(struct hci_dev *hdev, | 674 | int 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, |
634 | int 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]); | 677 | struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, |
678 | u8 addr_type); | ||
679 | int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
680 | int hci_smp_ltks_clear(struct hci_dev *hdev); | ||
636 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 681 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
637 | 682 | ||
638 | int hci_remote_oob_data_clear(struct hci_dev *hdev); | 683 | int 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 | ||
908 | static 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 | |||
933 | static 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 | |||
862 | int hci_register_cb(struct hci_cb *hcb); | 944 | int hci_register_cb(struct hci_cb *hcb); |
863 | int hci_unregister_cb(struct hci_cb *hcb); | 945 | int hci_unregister_cb(struct hci_cb *hcb); |
864 | 946 | ||
865 | int hci_register_notifier(struct notifier_block *nb); | ||
866 | int hci_unregister_notifier(struct notifier_block *nb); | ||
867 | |||
868 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); | 947 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); |
869 | void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); | 948 | void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); |
870 | void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); | 949 | void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); |
871 | 950 | ||
872 | void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); | 951 | void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode); |
873 | 952 | ||
874 | void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); | ||
875 | |||
876 | /* ----- HCI Sockets ----- */ | 953 | /* ----- HCI Sockets ----- */ |
877 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb, | 954 | void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb); |
878 | struct sock *skip_sk); | 955 | void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk); |
956 | void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb); | ||
957 | |||
958 | void 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 | |||
881 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); | 973 | int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); |
882 | int mgmt_index_added(struct hci_dev *hdev); | 974 | int mgmt_index_added(struct hci_dev *hdev); |
883 | int mgmt_index_removed(struct hci_dev *hdev); | 975 | int mgmt_index_removed(struct hci_dev *hdev); |
@@ -886,56 +978,67 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); | |||
886 | int mgmt_connectable(struct hci_dev *hdev, u8 connectable); | 978 | int mgmt_connectable(struct hci_dev *hdev, u8 connectable); |
887 | int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); | 979 | int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); |
888 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, | 980 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, |
889 | u8 persistent); | 981 | u8 persistent); |
890 | int mgmt_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 982 | int 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, |
892 | int mgmt_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 984 | u8 *dev_class); |
893 | u8 addr_type); | 985 | int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, |
894 | int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); | 986 | u8 link_type, u8 addr_type); |
987 | int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, | ||
988 | u8 link_type, u8 addr_type, u8 status); | ||
895 | int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 989 | int 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); |
897 | int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); | 991 | int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); |
898 | int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 992 | int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
899 | u8 status); | 993 | u8 status); |
900 | int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 994 | int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
901 | u8 status); | 995 | u8 status); |
902 | int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, | 996 | int 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); | ||
904 | int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 999 | int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
905 | u8 status); | 1000 | u8 link_type, u8 addr_type, u8 status); |
906 | int mgmt_user_confirm_neg_reply_complete(struct hci_dev *hdev, | 1001 | int 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); |
908 | int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr); | 1003 | int mgmt_user_passkey_request(struct hci_dev *hdev, bdaddr_t *bdaddr, |
1004 | u8 link_type, u8 addr_type); | ||
909 | int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 1005 | int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
910 | u8 status); | 1006 | u8 link_type, u8 addr_type, u8 status); |
911 | int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, | 1007 | int 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); |
913 | int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 status); | 1009 | int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
1010 | u8 addr_type, u8 status); | ||
1011 | int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); | ||
1012 | int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); | ||
1013 | int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, | ||
1014 | u8 status); | ||
914 | int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); | 1015 | int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); |
915 | int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, | 1016 | int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, |
916 | u8 *randomizer, u8 status); | 1017 | u8 *randomizer, u8 status); |
1018 | int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); | ||
917 | int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1019 | int 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, |
919 | int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *name); | 1021 | u8 ssp, u8 *eir, u16 eir_len); |
1022 | int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | ||
1023 | u8 addr_type, s8 rssi, u8 *name, u8 name_len); | ||
920 | int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status); | 1024 | int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status); |
921 | int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status); | 1025 | int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status); |
922 | int mgmt_discovering(struct hci_dev *hdev, u8 discovering); | 1026 | int mgmt_discovering(struct hci_dev *hdev, u8 discovering); |
923 | int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr); | 1027 | int mgmt_interleaved_discovery(struct hci_dev *hdev); |
924 | int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr); | 1028 | int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); |
1029 | int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); | ||
1030 | |||
1031 | int 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 | |||
932 | struct hci_pinfo { | 1036 | struct 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 | ||
967 | int hci_do_inquiry(struct hci_dev *hdev, u8 length); | 1070 | int hci_do_inquiry(struct hci_dev *hdev, u8 length); |
968 | int hci_cancel_inquiry(struct hci_dev *hdev); | 1071 | int hci_cancel_inquiry(struct hci_dev *hdev); |
1072 | int 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 | |||
27 | struct 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 | |||
43 | struct hci_mon_new_index { | ||
44 | __u8 type; | ||
45 | __u8 bus; | ||
46 | bdaddr_t bdaddr; | ||
47 | char name[8]; | ||
48 | } __packed; | ||
49 | #define HCI_MON_NEW_INDEX_SIZE 16 | ||
50 | |||
51 | #endif /* __HCI_MON_H */ | ||
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index b1664ed884e6..9b242c6bf55b 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -45,11 +45,11 @@ | |||
45 | #define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF | 45 | #define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF |
46 | #define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF | 46 | #define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF |
47 | 47 | ||
48 | #define L2CAP_DISC_TIMEOUT (100) | 48 | #define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100) |
49 | #define L2CAP_DISC_REJ_TIMEOUT (5000) /* 5 seconds */ | 49 | #define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000) |
50 | #define L2CAP_ENC_TIMEOUT (5000) /* 5 seconds */ | 50 | #define L2CAP_ENC_TIMEOUT msecs_to_jiffies(5000) |
51 | #define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ | 51 | #define L2CAP_CONN_TIMEOUT msecs_to_jiffies(40000) |
52 | #define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ | 52 | #define L2CAP_INFO_TIMEOUT msecs_to_jiffies(4000) |
53 | 53 | ||
54 | /* L2CAP socket address */ | 54 | /* L2CAP socket address */ |
55 | struct sockaddr_l2 { | 55 | struct 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 | ||
502 | struct l2cap_ops { | 503 | struct 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 | ||
511 | struct l2cap_conn { | 515 | struct 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 | ||
553 | struct l2cap_pinfo { | 558 | struct 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 | ||
559 | enum { | 564 | enum { |
@@ -606,21 +611,37 @@ static inline void l2cap_chan_put(struct l2cap_chan *c) | |||
606 | kfree(c); | 611 | kfree(c); |
607 | } | 612 | } |
608 | 613 | ||
614 | static inline void l2cap_chan_lock(struct l2cap_chan *chan) | ||
615 | { | ||
616 | mutex_lock(&chan->lock); | ||
617 | } | ||
618 | |||
619 | static inline void l2cap_chan_unlock(struct l2cap_chan *chan) | ||
620 | { | ||
621 | mutex_unlock(&chan->lock); | ||
622 | } | ||
623 | |||
609 | static inline void l2cap_set_timer(struct l2cap_chan *chan, | 624 | static 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 | ||
619 | static inline void l2cap_clear_timer(struct l2cap_chan *chan, | 635 | static inline bool l2cap_clear_timer(struct l2cap_chan *chan, |
620 | struct delayed_work *work) | 636 | struct delayed_work *work) |
621 | { | 637 | { |
622 | if (cancel_delayed_work(work)) | 638 | bool ret; |
639 | |||
640 | ret = cancel_delayed_work(work); | ||
641 | if (ret) | ||
623 | l2cap_chan_put(chan); | 642 | l2cap_chan_put(chan); |
643 | |||
644 | return ret; | ||
624 | } | 645 | } |
625 | 646 | ||
626 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) | 647 | #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index be65d3417883..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 | ||
43 | struct mgmt_hdr { | 46 | struct 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 | ||
52 | struct 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 | ||
50 | struct mgmt_rp_read_version { | 60 | struct 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 | ||
67 | struct 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 | ||
56 | struct mgmt_rp_read_index_list { | 75 | struct 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 | ||
78 | struct mgmt_rp_read_info { | 98 | struct 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 | ||
89 | struct mgmt_mode { | 109 | struct 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 |
96 | struct mgmt_cp_set_discoverable { | 118 | struct 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 |
116 | struct mgmt_cp_set_dev_class { | 138 | struct 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 |
122 | struct mgmt_cp_set_local_name { | 145 | struct 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 |
127 | struct mgmt_cp_add_uuid { | 152 | struct 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 |
133 | struct mgmt_cp_remove_uuid { | 159 | struct 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 | ||
137 | struct mgmt_link_key_info { | 164 | struct 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 |
145 | struct mgmt_cp_load_link_keys { | 172 | struct 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 | 179 | struct mgmt_ltk_info { |
152 | struct 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; |
156 | struct mgmt_rp_remove_keys { | 188 | |
157 | bdaddr_t bdaddr; | 189 | #define MGMT_OP_LOAD_LONG_TERM_KEYS 0x0013 |
158 | __u8 status; | 190 | struct 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 |
162 | struct mgmt_cp_disconnect { | 197 | struct 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 | ||
165 | struct mgmt_rp_disconnect { | 201 | struct 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 | |||
175 | struct 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 | ||
181 | struct mgmt_rp_get_connections { | 207 | struct 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 |
187 | struct mgmt_cp_pin_code_reply { | 213 | struct 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) | ||
192 | struct mgmt_rp_pin_code_reply { | 219 | struct 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 |
198 | struct mgmt_cp_pin_code_neg_reply { | 224 | struct 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 |
203 | struct mgmt_cp_set_io_capability { | 230 | struct 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 |
208 | struct mgmt_cp_pair_device { | 236 | struct 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) | ||
212 | struct mgmt_rp_pair_device { | 241 | struct 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 | ||
249 | struct 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) | ||
254 | struct mgmt_rp_unpair_device { | ||
255 | struct mgmt_addr_info addr; | ||
256 | }; | ||
257 | |||
258 | #define MGMT_OP_USER_CONFIRM_REPLY 0x001C | ||
218 | struct mgmt_cp_user_confirm_reply { | 259 | struct 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 | ||
221 | struct mgmt_rp_user_confirm_reply { | 263 | struct 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 |
227 | struct mgmt_cp_user_confirm_neg_reply { | 268 | struct 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 |
232 | struct mgmt_cp_user_passkey_reply { | 274 | struct 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) | ||
236 | struct mgmt_rp_user_passkey_reply { | 279 | struct 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 |
242 | struct mgmt_cp_user_passkey_neg_reply { | 284 | struct 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 | ||
247 | struct mgmt_rp_read_local_oob_data { | 291 | struct 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 |
253 | struct mgmt_cp_add_remote_oob_data { | 297 | struct 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 |
260 | struct mgmt_cp_remove_remote_oob_data { | 305 | struct 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 |
265 | struct mgmt_cp_start_discovery { | 311 | struct 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 |
317 | struct 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 |
272 | struct mgmt_cp_confirm_name { | 323 | struct 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) | ||
276 | struct mgmt_rp_confirm_name { | 328 | struct 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 |
282 | struct mgmt_cp_block_device { | 333 | struct 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 |
287 | struct mgmt_cp_unblock_device { | 339 | struct 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 |
292 | struct mgmt_ev_cmd_complete { | 345 | struct 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 |
298 | struct mgmt_ev_cmd_status { | 352 | struct 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 |
304 | struct mgmt_ev_controller_error { | 358 | struct 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 |
315 | struct mgmt_ev_class_of_dev_changed { | 369 | struct 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 |
320 | struct mgmt_ev_local_name_changed { | 374 | struct 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 |
326 | struct mgmt_ev_new_link_key { | 380 | struct 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 |
386 | struct 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 |
392 | struct 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 |
336 | struct mgmt_ev_connect_failed { | 402 | struct 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 |
342 | struct mgmt_ev_pin_code_request { | 408 | struct 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 |
348 | struct mgmt_ev_user_confirm_request { | 414 | struct 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 |
355 | struct mgmt_ev_user_passkey_request { | 421 | struct 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 |
360 | struct mgmt_ev_auth_failed { | 426 | struct 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 | ||
366 | struct mgmt_ev_device_found { | 435 | struct 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 | ||
375 | struct 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 |
444 | struct 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 |
383 | struct mgmt_ev_device_blocked { | 450 | struct 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 |
388 | struct mgmt_ev_device_unblocked { | 455 | struct mgmt_ev_device_unblocked { |
389 | bdaddr_t bdaddr; | 456 | struct mgmt_addr_info addr; |
457 | } __packed; | ||
458 | |||
459 | #define MGMT_EV_DEVICE_UNPAIRED 0x0016 | ||
460 | struct mgmt_ev_device_unpaired { | ||
461 | struct mgmt_addr_info addr; | ||
390 | } __packed; | 462 | } __packed; |
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h index aeaf5fa2b9f1..7b3acdd29134 100644 --- a/include/net/bluetooth/smp.h +++ b/include/net/bluetooth/smp.h | |||
@@ -127,7 +127,7 @@ struct smp_chan { | |||
127 | u8 rrnd[16]; /* SMP Pairing Random (remote) */ | 127 | u8 rrnd[16]; /* SMP Pairing Random (remote) */ |
128 | u8 pcnf[16]; /* SMP Pairing Confirm */ | 128 | u8 pcnf[16]; /* SMP Pairing Confirm */ |
129 | u8 tk[16]; /* SMP Temporary Key */ | 129 | u8 tk[16]; /* SMP Temporary Key */ |
130 | u8 smp_key_size; | 130 | u8 enc_key_size; |
131 | unsigned long smp_flags; | 131 | unsigned long smp_flags; |
132 | struct crypto_blkcipher *tfm; | 132 | struct crypto_blkcipher *tfm; |
133 | struct work_struct confirm; | 133 | struct work_struct confirm; |
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h index 8d552519ff67..6db8ecf52aa2 100644 --- a/include/net/caif/caif_hsi.h +++ b/include/net/caif/caif_hsi.h | |||
@@ -138,6 +138,7 @@ struct cfhsi { | |||
138 | u8 *rx_ptr; | 138 | u8 *rx_ptr; |
139 | u8 *tx_buf; | 139 | u8 *tx_buf; |
140 | u8 *rx_buf; | 140 | u8 *rx_buf; |
141 | u8 *rx_flip_buf; | ||
141 | spinlock_t lock; | 142 | spinlock_t lock; |
142 | int flow_off_sent; | 143 | int flow_off_sent; |
143 | u32 q_low_mark; | 144 | u32 q_low_mark; |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index a067d30ce73e..69b7ad3a9925 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -120,6 +120,7 @@ enum ieee80211_channel_flags { | |||
120 | * @band: band this channel belongs to. | 120 | * @band: band this channel belongs to. |
121 | * @max_antenna_gain: maximum antenna gain in dBi | 121 | * @max_antenna_gain: maximum antenna gain in dBi |
122 | * @max_power: maximum transmission power (in dBm) | 122 | * @max_power: maximum transmission power (in dBm) |
123 | * @max_reg_power: maximum regulatory transmission power (in dBm) | ||
123 | * @beacon_found: helper to regulatory code to indicate when a beacon | 124 | * @beacon_found: helper to regulatory code to indicate when a beacon |
124 | * has been found on this channel. Use regulatory_hint_found_beacon() | 125 | * has been found on this channel. Use regulatory_hint_found_beacon() |
125 | * to enable this, this is useful only on 5 GHz band. | 126 | * to enable this, this is useful only on 5 GHz band. |
@@ -133,6 +134,7 @@ struct ieee80211_channel { | |||
133 | u32 flags; | 134 | u32 flags; |
134 | int max_antenna_gain; | 135 | int max_antenna_gain; |
135 | int max_power; | 136 | int max_power; |
137 | int max_reg_power; | ||
136 | bool beacon_found; | 138 | bool beacon_found; |
137 | u32 orig_flags; | 139 | u32 orig_flags; |
138 | int orig_mag, orig_mpwr; | 140 | int orig_mag, orig_mpwr; |
@@ -364,25 +366,13 @@ struct cfg80211_crypto_settings { | |||
364 | }; | 366 | }; |
365 | 367 | ||
366 | /** | 368 | /** |
367 | * struct beacon_parameters - beacon parameters | 369 | * struct cfg80211_beacon_data - beacon data |
368 | * | ||
369 | * Used to configure the beacon for an interface. | ||
370 | * | ||
371 | * @head: head portion of beacon (before TIM IE) | 370 | * @head: head portion of beacon (before TIM IE) |
372 | * or %NULL if not changed | 371 | * or %NULL if not changed |
373 | * @tail: tail portion of beacon (after TIM IE) | 372 | * @tail: tail portion of beacon (after TIM IE) |
374 | * or %NULL if not changed | 373 | * or %NULL if not changed |
375 | * @interval: beacon interval or zero if not changed | ||
376 | * @dtim_period: DTIM period or zero if not changed | ||
377 | * @head_len: length of @head | 374 | * @head_len: length of @head |
378 | * @tail_len: length of @tail | 375 | * @tail_len: length of @tail |
379 | * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from | ||
380 | * user space) | ||
381 | * @ssid_len: length of @ssid | ||
382 | * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames | ||
383 | * @crypto: crypto settings | ||
384 | * @privacy: the BSS uses privacy | ||
385 | * @auth_type: Authentication type (algorithm) | ||
386 | * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL | 376 | * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL |
387 | * @beacon_ies_len: length of beacon_ies in octets | 377 | * @beacon_ies_len: length of beacon_ies in octets |
388 | * @proberesp_ies: extra information element(s) to add into Probe Response | 378 | * @proberesp_ies: extra information element(s) to add into Probe Response |
@@ -394,24 +384,48 @@ struct cfg80211_crypto_settings { | |||
394 | * @probe_resp_len: length of probe response template (@probe_resp) | 384 | * @probe_resp_len: length of probe response template (@probe_resp) |
395 | * @probe_resp: probe response template (AP mode only) | 385 | * @probe_resp: probe response template (AP mode only) |
396 | */ | 386 | */ |
397 | struct beacon_parameters { | 387 | struct cfg80211_beacon_data { |
398 | u8 *head, *tail; | 388 | const u8 *head, *tail; |
399 | int interval, dtim_period; | 389 | const u8 *beacon_ies; |
400 | int head_len, tail_len; | 390 | const u8 *proberesp_ies; |
391 | const u8 *assocresp_ies; | ||
392 | const u8 *probe_resp; | ||
393 | |||
394 | size_t head_len, tail_len; | ||
395 | size_t beacon_ies_len; | ||
396 | size_t proberesp_ies_len; | ||
397 | size_t assocresp_ies_len; | ||
398 | size_t probe_resp_len; | ||
399 | }; | ||
400 | |||
401 | /** | ||
402 | * struct cfg80211_ap_settings - AP configuration | ||
403 | * | ||
404 | * Used to configure an AP interface. | ||
405 | * | ||
406 | * @beacon: beacon data | ||
407 | * @beacon_interval: beacon interval | ||
408 | * @dtim_period: DTIM period | ||
409 | * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from | ||
410 | * user space) | ||
411 | * @ssid_len: length of @ssid | ||
412 | * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames | ||
413 | * @crypto: crypto settings | ||
414 | * @privacy: the BSS uses privacy | ||
415 | * @auth_type: Authentication type (algorithm) | ||
416 | * @inactivity_timeout: time in seconds to determine station's inactivity. | ||
417 | */ | ||
418 | struct cfg80211_ap_settings { | ||
419 | struct cfg80211_beacon_data beacon; | ||
420 | |||
421 | int beacon_interval, dtim_period; | ||
401 | const u8 *ssid; | 422 | const u8 *ssid; |
402 | size_t ssid_len; | 423 | size_t ssid_len; |
403 | enum nl80211_hidden_ssid hidden_ssid; | 424 | enum nl80211_hidden_ssid hidden_ssid; |
404 | struct cfg80211_crypto_settings crypto; | 425 | struct cfg80211_crypto_settings crypto; |
405 | bool privacy; | 426 | bool privacy; |
406 | enum nl80211_auth_type auth_type; | 427 | enum nl80211_auth_type auth_type; |
407 | const u8 *beacon_ies; | 428 | int inactivity_timeout; |
408 | size_t beacon_ies_len; | ||
409 | const u8 *proberesp_ies; | ||
410 | size_t proberesp_ies_len; | ||
411 | const u8 *assocresp_ies; | ||
412 | size_t assocresp_ies_len; | ||
413 | int probe_resp_len; | ||
414 | u8 *probe_resp; | ||
415 | }; | 429 | }; |
416 | 430 | ||
417 | /** | 431 | /** |
@@ -796,6 +810,8 @@ struct mesh_config { | |||
796 | * mesh gate, but not necessarily using the gate announcement protocol. | 810 | * mesh gate, but not necessarily using the gate announcement protocol. |
797 | * Still keeping the same nomenclature to be in sync with the spec. */ | 811 | * Still keeping the same nomenclature to be in sync with the spec. */ |
798 | bool dot11MeshGateAnnouncementProtocol; | 812 | bool dot11MeshGateAnnouncementProtocol; |
813 | bool dot11MeshForwarding; | ||
814 | s32 rssi_threshold; | ||
799 | }; | 815 | }; |
800 | 816 | ||
801 | /** | 817 | /** |
@@ -1036,10 +1052,6 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); | |||
1036 | * @key_len: length of WEP key for shared key authentication | 1052 | * @key_len: length of WEP key for shared key authentication |
1037 | * @key_idx: index of WEP key for shared key authentication | 1053 | * @key_idx: index of WEP key for shared key authentication |
1038 | * @key: WEP key for shared key authentication | 1054 | * @key: WEP key for shared key authentication |
1039 | * @local_state_change: This is a request for a local state only, i.e., no | ||
1040 | * Authentication frame is to be transmitted and authentication state is | ||
1041 | * to be changed without having to wait for a response from the peer STA | ||
1042 | * (AP). | ||
1043 | */ | 1055 | */ |
1044 | struct cfg80211_auth_request { | 1056 | struct cfg80211_auth_request { |
1045 | struct cfg80211_bss *bss; | 1057 | struct cfg80211_bss *bss; |
@@ -1048,7 +1060,6 @@ struct cfg80211_auth_request { | |||
1048 | enum nl80211_auth_type auth_type; | 1060 | enum nl80211_auth_type auth_type; |
1049 | const u8 *key; | 1061 | const u8 *key; |
1050 | u8 key_len, key_idx; | 1062 | u8 key_len, key_idx; |
1051 | bool local_state_change; | ||
1052 | }; | 1063 | }; |
1053 | 1064 | ||
1054 | /** | 1065 | /** |
@@ -1065,7 +1076,11 @@ enum cfg80211_assoc_req_flags { | |||
1065 | * | 1076 | * |
1066 | * This structure provides information needed to complete IEEE 802.11 | 1077 | * This structure provides information needed to complete IEEE 802.11 |
1067 | * (re)association. | 1078 | * (re)association. |
1068 | * @bss: The BSS to associate with. | 1079 | * @bss: The BSS to associate with. If the call is successful the driver |
1080 | * is given a reference that it must release, normally via a call to | ||
1081 | * cfg80211_send_rx_assoc(), or, if association timed out, with a | ||
1082 | * call to cfg80211_put_bss() (in addition to calling | ||
1083 | * cfg80211_send_assoc_timeout()) | ||
1069 | * @ie: Extra IEs to add to (Re)Association Request frame or %NULL | 1084 | * @ie: Extra IEs to add to (Re)Association Request frame or %NULL |
1070 | * @ie_len: Length of ie buffer in octets | 1085 | * @ie_len: Length of ie buffer in octets |
1071 | * @use_mfp: Use management frame protection (IEEE 802.11w) in this association | 1086 | * @use_mfp: Use management frame protection (IEEE 802.11w) in this association |
@@ -1093,19 +1108,16 @@ struct cfg80211_assoc_request { | |||
1093 | * This structure provides information needed to complete IEEE 802.11 | 1108 | * This structure provides information needed to complete IEEE 802.11 |
1094 | * deauthentication. | 1109 | * deauthentication. |
1095 | * | 1110 | * |
1096 | * @bss: the BSS to deauthenticate from | 1111 | * @bssid: the BSSID of the BSS to deauthenticate from |
1097 | * @ie: Extra IEs to add to Deauthentication frame or %NULL | 1112 | * @ie: Extra IEs to add to Deauthentication frame or %NULL |
1098 | * @ie_len: Length of ie buffer in octets | 1113 | * @ie_len: Length of ie buffer in octets |
1099 | * @reason_code: The reason code for the deauthentication | 1114 | * @reason_code: The reason code for the deauthentication |
1100 | * @local_state_change: This is a request for a local state only, i.e., no | ||
1101 | * Deauthentication frame is to be transmitted. | ||
1102 | */ | 1115 | */ |
1103 | struct cfg80211_deauth_request { | 1116 | struct cfg80211_deauth_request { |
1104 | struct cfg80211_bss *bss; | 1117 | const u8 *bssid; |
1105 | const u8 *ie; | 1118 | const u8 *ie; |
1106 | size_t ie_len; | 1119 | size_t ie_len; |
1107 | u16 reason_code; | 1120 | u16 reason_code; |
1108 | bool local_state_change; | ||
1109 | }; | 1121 | }; |
1110 | 1122 | ||
1111 | /** | 1123 | /** |
@@ -1148,6 +1160,10 @@ struct cfg80211_disassoc_request { | |||
1148 | * @beacon_interval: beacon interval to use | 1160 | * @beacon_interval: beacon interval to use |
1149 | * @privacy: this is a protected network, keys will be configured | 1161 | * @privacy: this is a protected network, keys will be configured |
1150 | * after joining | 1162 | * after joining |
1163 | * @control_port: whether user space controls IEEE 802.1X port, i.e., | ||
1164 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is | ||
1165 | * required to assume that the port is unauthorized until authorized by | ||
1166 | * user space. Otherwise, port is marked authorized by default. | ||
1151 | * @basic_rates: bitmap of basic rates to use when creating the IBSS | 1167 | * @basic_rates: bitmap of basic rates to use when creating the IBSS |
1152 | * @mcast_rate: per-band multicast rate index + 1 (0: disabled) | 1168 | * @mcast_rate: per-band multicast rate index + 1 (0: disabled) |
1153 | */ | 1169 | */ |
@@ -1162,6 +1178,7 @@ struct cfg80211_ibss_params { | |||
1162 | u32 basic_rates; | 1178 | u32 basic_rates; |
1163 | bool channel_fixed; | 1179 | bool channel_fixed; |
1164 | bool privacy; | 1180 | bool privacy; |
1181 | bool control_port; | ||
1165 | int mcast_rate[IEEE80211_NUM_BANDS]; | 1182 | int mcast_rate[IEEE80211_NUM_BANDS]; |
1166 | }; | 1183 | }; |
1167 | 1184 | ||
@@ -1186,6 +1203,8 @@ struct cfg80211_ibss_params { | |||
1186 | * @key_idx: index of WEP key for shared key authentication | 1203 | * @key_idx: index of WEP key for shared key authentication |
1187 | * @key: WEP key for shared key authentication | 1204 | * @key: WEP key for shared key authentication |
1188 | * @flags: See &enum cfg80211_assoc_req_flags | 1205 | * @flags: See &enum cfg80211_assoc_req_flags |
1206 | * @bg_scan_period: Background scan period in seconds | ||
1207 | * or -1 to indicate that default value is to be used. | ||
1189 | * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask | 1208 | * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask |
1190 | * will be used in ht_capa. Un-supported values will be ignored. | 1209 | * will be used in ht_capa. Un-supported values will be ignored. |
1191 | * @ht_capa_mask: The bits of ht_capa which are to be used. | 1210 | * @ht_capa_mask: The bits of ht_capa which are to be used. |
@@ -1203,6 +1222,7 @@ struct cfg80211_connect_params { | |||
1203 | const u8 *key; | 1222 | const u8 *key; |
1204 | u8 key_len, key_idx; | 1223 | u8 key_len, key_idx; |
1205 | u32 flags; | 1224 | u32 flags; |
1225 | int bg_scan_period; | ||
1206 | struct ieee80211_ht_cap ht_capa; | 1226 | struct ieee80211_ht_cap ht_capa; |
1207 | struct ieee80211_ht_cap ht_capa_mask; | 1227 | struct ieee80211_ht_cap ht_capa_mask; |
1208 | }; | 1228 | }; |
@@ -1229,8 +1249,7 @@ enum wiphy_params_flags { | |||
1229 | struct cfg80211_bitrate_mask { | 1249 | struct cfg80211_bitrate_mask { |
1230 | struct { | 1250 | struct { |
1231 | u32 legacy; | 1251 | u32 legacy; |
1232 | /* TODO: add support for masking MCS rates; e.g.: */ | 1252 | u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; |
1233 | /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */ | ||
1234 | } control[IEEE80211_NUM_BANDS]; | 1253 | } control[IEEE80211_NUM_BANDS]; |
1235 | }; | 1254 | }; |
1236 | /** | 1255 | /** |
@@ -1343,12 +1362,10 @@ struct cfg80211_gtk_rekey_data { | |||
1343 | * | 1362 | * |
1344 | * @set_rekey_data: give the data necessary for GTK rekeying to the driver | 1363 | * @set_rekey_data: give the data necessary for GTK rekeying to the driver |
1345 | * | 1364 | * |
1346 | * @add_beacon: Add a beacon with given parameters, @head, @interval | 1365 | * @start_ap: Start acting in AP mode defined by the parameters. |
1347 | * and @dtim_period will be valid, @tail is optional. | 1366 | * @change_beacon: Change the beacon parameters for an access point mode |
1348 | * @set_beacon: Change the beacon parameters for an access point mode | 1367 | * interface. This should reject the call when AP mode wasn't started. |
1349 | * interface. This should reject the call when no beacon has been | 1368 | * @stop_ap: Stop being an AP, including stopping beaconing. |
1350 | * configured. | ||
1351 | * @del_beacon: Remove beacon configuration and stop sending the beacon. | ||
1352 | * | 1369 | * |
1353 | * @add_station: Add a new station. | 1370 | * @add_station: Add a new station. |
1354 | * @del_station: Remove a station; @mac may be NULL to remove all stations. | 1371 | * @del_station: Remove a station; @mac may be NULL to remove all stations. |
@@ -1515,11 +1532,11 @@ struct cfg80211_ops { | |||
1515 | struct net_device *netdev, | 1532 | struct net_device *netdev, |
1516 | u8 key_index); | 1533 | u8 key_index); |
1517 | 1534 | ||
1518 | int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, | 1535 | int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, |
1519 | struct beacon_parameters *info); | 1536 | struct cfg80211_ap_settings *settings); |
1520 | int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, | 1537 | int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, |
1521 | struct beacon_parameters *info); | 1538 | struct cfg80211_beacon_data *info); |
1522 | int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); | 1539 | int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); |
1523 | 1540 | ||
1524 | 1541 | ||
1525 | int (*add_station)(struct wiphy *wiphy, struct net_device *dev, | 1542 | int (*add_station)(struct wiphy *wiphy, struct net_device *dev, |
@@ -1574,11 +1591,9 @@ struct cfg80211_ops { | |||
1574 | int (*assoc)(struct wiphy *wiphy, struct net_device *dev, | 1591 | int (*assoc)(struct wiphy *wiphy, struct net_device *dev, |
1575 | struct cfg80211_assoc_request *req); | 1592 | struct cfg80211_assoc_request *req); |
1576 | int (*deauth)(struct wiphy *wiphy, struct net_device *dev, | 1593 | int (*deauth)(struct wiphy *wiphy, struct net_device *dev, |
1577 | struct cfg80211_deauth_request *req, | 1594 | struct cfg80211_deauth_request *req); |
1578 | void *cookie); | ||
1579 | int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, | 1595 | int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, |
1580 | struct cfg80211_disassoc_request *req, | 1596 | struct cfg80211_disassoc_request *req); |
1581 | void *cookie); | ||
1582 | 1597 | ||
1583 | int (*connect)(struct wiphy *wiphy, struct net_device *dev, | 1598 | int (*connect)(struct wiphy *wiphy, struct net_device *dev, |
1584 | struct cfg80211_connect_params *sme); | 1599 | struct cfg80211_connect_params *sme); |
@@ -2204,8 +2219,6 @@ struct cfg80211_conn; | |||
2204 | struct cfg80211_internal_bss; | 2219 | struct cfg80211_internal_bss; |
2205 | struct cfg80211_cached_keys; | 2220 | struct cfg80211_cached_keys; |
2206 | 2221 | ||
2207 | #define MAX_AUTH_BSSES 4 | ||
2208 | |||
2209 | /** | 2222 | /** |
2210 | * struct wireless_dev - wireless per-netdev state | 2223 | * struct wireless_dev - wireless per-netdev state |
2211 | * | 2224 | * |
@@ -2269,8 +2282,6 @@ struct wireless_dev { | |||
2269 | struct list_head event_list; | 2282 | struct list_head event_list; |
2270 | spinlock_t event_lock; | 2283 | spinlock_t event_lock; |
2271 | 2284 | ||
2272 | struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES]; | ||
2273 | struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; | ||
2274 | struct cfg80211_internal_bss *current_bss; /* associated / joined */ | 2285 | struct cfg80211_internal_bss *current_bss; /* associated / joined */ |
2275 | struct ieee80211_channel *channel; | 2286 | struct ieee80211_channel *channel; |
2276 | 2287 | ||
@@ -2686,7 +2697,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
2686 | * @wiphy: the wiphy reporting the BSS | 2697 | * @wiphy: the wiphy reporting the BSS |
2687 | * @channel: The channel the frame was received on | 2698 | * @channel: The channel the frame was received on |
2688 | * @bssid: the BSSID of the BSS | 2699 | * @bssid: the BSSID of the BSS |
2689 | * @timestamp: the TSF timestamp sent by the peer | 2700 | * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) |
2690 | * @capability: the capability field sent by the peer | 2701 | * @capability: the capability field sent by the peer |
2691 | * @beacon_interval: the beacon interval announced by the peer | 2702 | * @beacon_interval: the beacon interval announced by the peer |
2692 | * @ie: additional IEs sent by the peer | 2703 | * @ie: additional IEs sent by the peer |
@@ -2702,9 +2713,8 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
2702 | struct cfg80211_bss * __must_check | 2713 | struct cfg80211_bss * __must_check |
2703 | cfg80211_inform_bss(struct wiphy *wiphy, | 2714 | cfg80211_inform_bss(struct wiphy *wiphy, |
2704 | struct ieee80211_channel *channel, | 2715 | struct ieee80211_channel *channel, |
2705 | const u8 *bssid, | 2716 | const u8 *bssid, u64 tsf, u16 capability, |
2706 | u64 timestamp, u16 capability, u16 beacon_interval, | 2717 | u16 beacon_interval, const u8 *ie, size_t ielen, |
2707 | const u8 *ie, size_t ielen, | ||
2708 | s32 signal, gfp_t gfp); | 2718 | s32 signal, gfp_t gfp); |
2709 | 2719 | ||
2710 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, | 2720 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, |
@@ -2725,6 +2735,20 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, | |||
2725 | struct ieee80211_channel *channel, | 2735 | struct ieee80211_channel *channel, |
2726 | const u8 *meshid, size_t meshidlen, | 2736 | const u8 *meshid, size_t meshidlen, |
2727 | const u8 *meshcfg); | 2737 | const u8 *meshcfg); |
2738 | /** | ||
2739 | * cfg80211_ref_bss - reference BSS struct | ||
2740 | * @bss: the BSS struct to reference | ||
2741 | * | ||
2742 | * Increments the refcount of the given BSS struct. | ||
2743 | */ | ||
2744 | void cfg80211_ref_bss(struct cfg80211_bss *bss); | ||
2745 | |||
2746 | /** | ||
2747 | * cfg80211_put_bss - unref BSS struct | ||
2748 | * @bss: the BSS struct | ||
2749 | * | ||
2750 | * Decrements the refcount of the given BSS struct. | ||
2751 | */ | ||
2728 | void cfg80211_put_bss(struct cfg80211_bss *bss); | 2752 | void cfg80211_put_bss(struct cfg80211_bss *bss); |
2729 | 2753 | ||
2730 | /** | 2754 | /** |
@@ -2762,20 +2786,10 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); | |||
2762 | void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); | 2786 | void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); |
2763 | 2787 | ||
2764 | /** | 2788 | /** |
2765 | * __cfg80211_auth_canceled - notify cfg80211 that authentication was canceled | ||
2766 | * @dev: network device | ||
2767 | * @addr: The MAC address of the device with which the authentication timed out | ||
2768 | * | ||
2769 | * When a pending authentication had no action yet, the driver may decide | ||
2770 | * to not send a deauth frame, but in that case must calls this function | ||
2771 | * to tell cfg80211 about this decision. It is only valid to call this | ||
2772 | * function within the deauth() callback. | ||
2773 | */ | ||
2774 | void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr); | ||
2775 | |||
2776 | /** | ||
2777 | * cfg80211_send_rx_assoc - notification of processed association | 2789 | * cfg80211_send_rx_assoc - notification of processed association |
2778 | * @dev: network device | 2790 | * @dev: network device |
2791 | * @bss: the BSS struct association was requested for, the struct reference | ||
2792 | * is owned by cfg80211 after this call | ||
2779 | * @buf: (re)association response frame (header + body) | 2793 | * @buf: (re)association response frame (header + body) |
2780 | * @len: length of the frame data | 2794 | * @len: length of the frame data |
2781 | * | 2795 | * |
@@ -2784,7 +2798,8 @@ void __cfg80211_auth_canceled(struct net_device *dev, const u8 *addr); | |||
2784 | * function or cfg80211_send_assoc_timeout() to indicate the result of | 2798 | * function or cfg80211_send_assoc_timeout() to indicate the result of |
2785 | * cfg80211_ops::assoc() call. This function may sleep. | 2799 | * cfg80211_ops::assoc() call. This function may sleep. |
2786 | */ | 2800 | */ |
2787 | void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); | 2801 | void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss, |
2802 | const u8 *buf, size_t len); | ||
2788 | 2803 | ||
2789 | /** | 2804 | /** |
2790 | * cfg80211_send_assoc_timeout - notification of timed out association | 2805 | * cfg80211_send_assoc_timeout - notification of timed out association |
@@ -3176,6 +3191,7 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); | |||
3176 | * cfg80211_rx_mgmt - notification of received, unprocessed management frame | 3191 | * cfg80211_rx_mgmt - notification of received, unprocessed management frame |
3177 | * @dev: network device | 3192 | * @dev: network device |
3178 | * @freq: Frequency on which the frame was received in MHz | 3193 | * @freq: Frequency on which the frame was received in MHz |
3194 | * @sig_dbm: signal strength in mBm, or 0 if unknown | ||
3179 | * @buf: Management frame (header + body) | 3195 | * @buf: Management frame (header + body) |
3180 | * @len: length of the frame data | 3196 | * @len: length of the frame data |
3181 | * @gfp: context flags | 3197 | * @gfp: context flags |
@@ -3188,8 +3204,8 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); | |||
3188 | * This function is called whenever an Action frame is received for a station | 3204 | * This function is called whenever an Action frame is received for a station |
3189 | * mode interface, but is not processed in kernel. | 3205 | * mode interface, but is not processed in kernel. |
3190 | */ | 3206 | */ |
3191 | bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, | 3207 | bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm, |
3192 | size_t len, gfp_t gfp); | 3208 | const u8 *buf, size_t len, gfp_t gfp); |
3193 | 3209 | ||
3194 | /** | 3210 | /** |
3195 | * cfg80211_mgmt_tx_status - notification of TX status for management frame | 3211 | * cfg80211_mgmt_tx_status - notification of TX status for management frame |
@@ -3302,6 +3318,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr, | |||
3302 | * @frame: the frame | 3318 | * @frame: the frame |
3303 | * @len: length of the frame | 3319 | * @len: length of the frame |
3304 | * @freq: frequency the frame was received on | 3320 | * @freq: frequency the frame was received on |
3321 | * @sig_dbm: signal strength in mBm, or 0 if unknown | ||
3305 | * @gfp: allocation flags | 3322 | * @gfp: allocation flags |
3306 | * | 3323 | * |
3307 | * Use this function to report to userspace when a beacon was | 3324 | * Use this function to report to userspace when a beacon was |
@@ -3310,7 +3327,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr, | |||
3310 | */ | 3327 | */ |
3311 | void cfg80211_report_obss_beacon(struct wiphy *wiphy, | 3328 | void cfg80211_report_obss_beacon(struct wiphy *wiphy, |
3312 | const u8 *frame, size_t len, | 3329 | const u8 *frame, size_t len, |
3313 | int freq, gfp_t gfp); | 3330 | int freq, int sig_dbm, gfp_t gfp); |
3314 | 3331 | ||
3315 | /* | 3332 | /* |
3316 | * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used | 3333 | * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used |
@@ -3322,6 +3339,14 @@ int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, | |||
3322 | struct ieee80211_channel *chan, | 3339 | struct ieee80211_channel *chan, |
3323 | enum nl80211_channel_type channel_type); | 3340 | enum nl80211_channel_type channel_type); |
3324 | 3341 | ||
3342 | /* | ||
3343 | * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) | ||
3344 | * @rate: given rate_info to calculate bitrate from | ||
3345 | * | ||
3346 | * return 0 if MCS index >= 32 | ||
3347 | */ | ||
3348 | u16 cfg80211_calculate_bitrate(struct rate_info *rate); | ||
3349 | |||
3325 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 3350 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
3326 | 3351 | ||
3327 | /* wiphy_printk helpers, similar to dev_printk */ | 3352 | /* 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 | ||
43 | extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); | 43 | extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); |
44 | extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int); | 44 | extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr_storage *, int); |
45 | extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); | 45 | extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); |
46 | extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, | 46 | extern 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, | |||
131 | extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid, | 131 | extern 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 | /** | 134 | void *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 | */ | ||
145 | static 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/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 | ||
391 | extern int ip_call_ra_chain(struct sk_buff *skb); | 391 | extern 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 | ||
66 | struct af_iucv_trans_hdr { | 67 | struct af_iucv_trans_hdr { |
67 | u16 magic; | 68 | u16 magic; |
@@ -113,6 +114,7 @@ struct iucv_sock { | |||
113 | spinlock_t accept_q_lock; | 114 | spinlock_t accept_q_lock; |
114 | struct sock *parent; | 115 | struct sock *parent; |
115 | struct iucv_path *path; | 116 | struct iucv_path *path; |
117 | struct net_device *hs_dev; | ||
116 | struct sk_buff_head send_skb_q; | 118 | struct sk_buff_head send_skb_q; |
117 | struct sk_buff_head backlog_skb_q; | 119 | struct sk_buff_head backlog_skb_q; |
118 | struct sock_msg_q message_q; | 120 | struct sock_msg_q message_q; |
@@ -131,6 +133,7 @@ struct iucv_sock { | |||
131 | /* iucv socket options (SOL_IUCV) */ | 133 | /* iucv socket options (SOL_IUCV) */ |
132 | #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ | 134 | #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */ |
133 | #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ | 135 | #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */ |
136 | #define SO_MSGSIZE 0x0800 /* get maximum msgsize */ | ||
134 | 137 | ||
135 | /* iucv related control messages (scm) */ | 138 | /* iucv related control messages (scm) */ |
136 | #define SCM_IUCV_TRGCLS 0x0001 /* target class control message */ | 139 | #define SCM_IUCV_TRGCLS 0x0001 /* target class control message */ |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index d49928ba5d09..9a012be615ff 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -229,7 +229,8 @@ enum ieee80211_rssi_event { | |||
229 | * valid in station mode only while @assoc is true and if also | 229 | * valid in station mode only while @assoc is true and if also |
230 | * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf | 230 | * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf |
231 | * @ps_dtim_period) | 231 | * @ps_dtim_period) |
232 | * @timestamp: beacon timestamp | 232 | * @last_tsf: last beacon's/probe response's TSF timestamp (could be old |
233 | * as it may have been received during scanning long ago) | ||
233 | * @beacon_int: beacon interval | 234 | * @beacon_int: beacon interval |
234 | * @assoc_capability: capabilities taken from assoc resp | 235 | * @assoc_capability: capabilities taken from assoc resp |
235 | * @basic_rates: bitmap of basic rates, each bit stands for an | 236 | * @basic_rates: bitmap of basic rates, each bit stands for an |
@@ -276,7 +277,7 @@ struct ieee80211_bss_conf { | |||
276 | u8 dtim_period; | 277 | u8 dtim_period; |
277 | u16 beacon_int; | 278 | u16 beacon_int; |
278 | u16 assoc_capability; | 279 | u16 assoc_capability; |
279 | u64 timestamp; | 280 | u64 last_tsf; |
280 | u32 basic_rates; | 281 | u32 basic_rates; |
281 | int mcast_rate[IEEE80211_NUM_BANDS]; | 282 | int mcast_rate[IEEE80211_NUM_BANDS]; |
282 | u16 ht_operation_mode; | 283 | u16 ht_operation_mode; |
@@ -341,9 +342,9 @@ struct ieee80211_bss_conf { | |||
341 | * used to indicate that a frame was already retried due to PS | 342 | * used to indicate that a frame was already retried due to PS |
342 | * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211, | 343 | * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211, |
343 | * used to indicate frame should not be encrypted | 344 | * used to indicate frame should not be encrypted |
344 | * @IEEE80211_TX_CTL_POLL_RESPONSE: This frame is a response to a poll | 345 | * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll |
345 | * frame (PS-Poll or uAPSD) and should be sent although the station | 346 | * frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must |
346 | * is in powersave mode. | 347 | * be sent although the station is in powersave mode. |
347 | * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the | 348 | * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the |
348 | * transmit function after the current frame, this can be used | 349 | * transmit function after the current frame, this can be used |
349 | * by drivers to kick the DMA queue only if unset or when the | 350 | * by drivers to kick the DMA queue only if unset or when the |
@@ -399,7 +400,7 @@ enum mac80211_tx_control_flags { | |||
399 | IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), | 400 | IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), |
400 | IEEE80211_TX_INTFL_RETRIED = BIT(15), | 401 | IEEE80211_TX_INTFL_RETRIED = BIT(15), |
401 | IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), | 402 | IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), |
402 | IEEE80211_TX_CTL_POLL_RESPONSE = BIT(17), | 403 | IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17), |
403 | IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), | 404 | IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), |
404 | IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), | 405 | IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), |
405 | /* hole at 20, use later */ | 406 | /* hole at 20, use later */ |
@@ -425,7 +426,7 @@ enum mac80211_tx_control_flags { | |||
425 | IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \ | 426 | IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \ |
426 | IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \ | 427 | IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \ |
427 | IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \ | 428 | IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \ |
428 | IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_POLL_RESPONSE | \ | 429 | IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER | \ |
429 | IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \ | 430 | IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \ |
430 | IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP) | 431 | IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP) |
431 | 432 | ||
@@ -659,6 +660,8 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
659 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index | 660 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index |
660 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used | 661 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used |
661 | * @RX_FLAG_SHORT_GI: Short guard interval was used | 662 | * @RX_FLAG_SHORT_GI: Short guard interval was used |
663 | * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present. | ||
664 | * Valid only for data frames (mainly A-MPDU) | ||
662 | */ | 665 | */ |
663 | enum mac80211_rx_flags { | 666 | enum mac80211_rx_flags { |
664 | RX_FLAG_MMIC_ERROR = 1<<0, | 667 | RX_FLAG_MMIC_ERROR = 1<<0, |
@@ -672,6 +675,7 @@ enum mac80211_rx_flags { | |||
672 | RX_FLAG_HT = 1<<9, | 675 | RX_FLAG_HT = 1<<9, |
673 | RX_FLAG_40MHZ = 1<<10, | 676 | RX_FLAG_40MHZ = 1<<10, |
674 | RX_FLAG_SHORT_GI = 1<<11, | 677 | RX_FLAG_SHORT_GI = 1<<11, |
678 | RX_FLAG_NO_SIGNAL_VAL = 1<<12, | ||
675 | }; | 679 | }; |
676 | 680 | ||
677 | /** | 681 | /** |
@@ -852,6 +856,21 @@ struct ieee80211_channel_switch { | |||
852 | }; | 856 | }; |
853 | 857 | ||
854 | /** | 858 | /** |
859 | * enum ieee80211_vif_flags - virtual interface flags | ||
860 | * | ||
861 | * @IEEE80211_VIF_BEACON_FILTER: the device performs beacon filtering | ||
862 | * on this virtual interface to avoid unnecessary CPU wakeups | ||
863 | * @IEEE80211_VIF_SUPPORTS_CQM_RSSI: the device can do connection quality | ||
864 | * monitoring on this virtual interface -- i.e. it can monitor | ||
865 | * connection quality related parameters, such as the RSSI level and | ||
866 | * provide notifications if configured trigger levels are reached. | ||
867 | */ | ||
868 | enum ieee80211_vif_flags { | ||
869 | IEEE80211_VIF_BEACON_FILTER = BIT(0), | ||
870 | IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1), | ||
871 | }; | ||
872 | |||
873 | /** | ||
855 | * struct ieee80211_vif - per-interface data | 874 | * struct ieee80211_vif - per-interface data |
856 | * | 875 | * |
857 | * Data in this structure is continually present for driver | 876 | * Data in this structure is continually present for driver |
@@ -863,6 +882,10 @@ struct ieee80211_channel_switch { | |||
863 | * @addr: address of this interface | 882 | * @addr: address of this interface |
864 | * @p2p: indicates whether this AP or STA interface is a p2p | 883 | * @p2p: indicates whether this AP or STA interface is a p2p |
865 | * interface, i.e. a GO or p2p-sta respectively | 884 | * interface, i.e. a GO or p2p-sta respectively |
885 | * @driver_flags: flags/capabilities the driver has for this interface, | ||
886 | * these need to be set (or cleared) when the interface is added | ||
887 | * or, if supported by the driver, the interface type is changed | ||
888 | * at runtime, mac80211 will never touch this field | ||
866 | * @drv_priv: data area for driver use, will always be aligned to | 889 | * @drv_priv: data area for driver use, will always be aligned to |
867 | * sizeof(void *). | 890 | * sizeof(void *). |
868 | */ | 891 | */ |
@@ -871,6 +894,7 @@ struct ieee80211_vif { | |||
871 | struct ieee80211_bss_conf bss_conf; | 894 | struct ieee80211_bss_conf bss_conf; |
872 | u8 addr[ETH_ALEN]; | 895 | u8 addr[ETH_ALEN]; |
873 | bool p2p; | 896 | bool p2p; |
897 | u32 driver_flags; | ||
874 | /* must be last */ | 898 | /* must be last */ |
875 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | 899 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); |
876 | }; | 900 | }; |
@@ -962,6 +986,25 @@ enum set_key_cmd { | |||
962 | }; | 986 | }; |
963 | 987 | ||
964 | /** | 988 | /** |
989 | * enum ieee80211_sta_state - station state | ||
990 | * | ||
991 | * @IEEE80211_STA_NOTEXIST: station doesn't exist at all, | ||
992 | * this is a special state for add/remove transitions | ||
993 | * @IEEE80211_STA_NONE: station exists without special state | ||
994 | * @IEEE80211_STA_AUTH: station is authenticated | ||
995 | * @IEEE80211_STA_ASSOC: station is associated | ||
996 | * @IEEE80211_STA_AUTHORIZED: station is authorized (802.1X) | ||
997 | */ | ||
998 | enum ieee80211_sta_state { | ||
999 | /* NOTE: These need to be ordered correctly! */ | ||
1000 | IEEE80211_STA_NOTEXIST, | ||
1001 | IEEE80211_STA_NONE, | ||
1002 | IEEE80211_STA_AUTH, | ||
1003 | IEEE80211_STA_ASSOC, | ||
1004 | IEEE80211_STA_AUTHORIZED, | ||
1005 | }; | ||
1006 | |||
1007 | /** | ||
965 | * struct ieee80211_sta - station table entry | 1008 | * struct ieee80211_sta - station table entry |
966 | * | 1009 | * |
967 | * A station table entry represents a station we are possibly | 1010 | * A station table entry represents a station we are possibly |
@@ -1079,10 +1122,6 @@ enum sta_notify_cmd { | |||
1079 | * @IEEE80211_HW_MFP_CAPABLE: | 1122 | * @IEEE80211_HW_MFP_CAPABLE: |
1080 | * Hardware supports management frame protection (MFP, IEEE 802.11w). | 1123 | * Hardware supports management frame protection (MFP, IEEE 802.11w). |
1081 | * | 1124 | * |
1082 | * @IEEE80211_HW_BEACON_FILTER: | ||
1083 | * Hardware supports dropping of irrelevant beacon frames to | ||
1084 | * avoid waking up cpu. | ||
1085 | * | ||
1086 | * @IEEE80211_HW_SUPPORTS_STATIC_SMPS: | 1125 | * @IEEE80211_HW_SUPPORTS_STATIC_SMPS: |
1087 | * Hardware supports static spatial multiplexing powersave, | 1126 | * Hardware supports static spatial multiplexing powersave, |
1088 | * ie. can turn off all but one chain even on HT connections | 1127 | * ie. can turn off all but one chain even on HT connections |
@@ -1108,11 +1147,6 @@ enum sta_notify_cmd { | |||
1108 | * When this flag is set, signaling beacon-loss will cause an immediate | 1147 | * When this flag is set, signaling beacon-loss will cause an immediate |
1109 | * change to disassociated state. | 1148 | * change to disassociated state. |
1110 | * | 1149 | * |
1111 | * @IEEE80211_HW_SUPPORTS_CQM_RSSI: | ||
1112 | * Hardware can do connection quality monitoring - i.e. it can monitor | ||
1113 | * connection quality related parameters, such as the RSSI level and | ||
1114 | * provide notifications if configured trigger levels are reached. | ||
1115 | * | ||
1116 | * @IEEE80211_HW_NEED_DTIM_PERIOD: | 1150 | * @IEEE80211_HW_NEED_DTIM_PERIOD: |
1117 | * This device needs to know the DTIM period for the BSS before | 1151 | * This device needs to know the DTIM period for the BSS before |
1118 | * associating. | 1152 | * associating. |
@@ -1134,6 +1168,10 @@ enum sta_notify_cmd { | |||
1134 | * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session | 1168 | * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session |
1135 | * setup strictly in HW. mac80211 should not attempt to do this in | 1169 | * setup strictly in HW. mac80211 should not attempt to do this in |
1136 | * software. | 1170 | * software. |
1171 | * | ||
1172 | * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while | ||
1173 | * being idle (i.e. mac80211 doesn't have to go idle-off during the | ||
1174 | * the scan). | ||
1137 | */ | 1175 | */ |
1138 | enum ieee80211_hw_flags { | 1176 | enum ieee80211_hw_flags { |
1139 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, | 1177 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, |
@@ -1150,16 +1188,17 @@ enum ieee80211_hw_flags { | |||
1150 | IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11, | 1188 | IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11, |
1151 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, | 1189 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, |
1152 | IEEE80211_HW_MFP_CAPABLE = 1<<13, | 1190 | IEEE80211_HW_MFP_CAPABLE = 1<<13, |
1153 | IEEE80211_HW_BEACON_FILTER = 1<<14, | 1191 | /* reuse bit 14 */ |
1154 | IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, | 1192 | IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, |
1155 | IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, | 1193 | IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, |
1156 | IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, | 1194 | IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, |
1157 | IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, | 1195 | IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, |
1158 | IEEE80211_HW_CONNECTION_MONITOR = 1<<19, | 1196 | IEEE80211_HW_CONNECTION_MONITOR = 1<<19, |
1159 | IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, | 1197 | /* reuse bit 20 */ |
1160 | IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, | 1198 | IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, |
1161 | IEEE80211_HW_AP_LINK_PS = 1<<22, | 1199 | IEEE80211_HW_AP_LINK_PS = 1<<22, |
1162 | IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, | 1200 | IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, |
1201 | IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24, | ||
1163 | }; | 1202 | }; |
1164 | 1203 | ||
1165 | /** | 1204 | /** |
@@ -1446,8 +1485,8 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
1446 | * way the host will only receive beacons where some relevant information | 1485 | * way the host will only receive beacons where some relevant information |
1447 | * (for example ERP protection or WMM settings) have changed. | 1486 | * (for example ERP protection or WMM settings) have changed. |
1448 | * | 1487 | * |
1449 | * Beacon filter support is advertised with the %IEEE80211_HW_BEACON_FILTER | 1488 | * Beacon filter support is advertised with the %IEEE80211_VIF_BEACON_FILTER |
1450 | * hardware capability. The driver needs to enable beacon filter support | 1489 | * interface capability. The driver needs to enable beacon filter support |
1451 | * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When | 1490 | * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When |
1452 | * power save is enabled, the stack will not check for beacon loss and the | 1491 | * power save is enabled, the stack will not check for beacon loss and the |
1453 | * driver needs to notify about loss of beacons with ieee80211_beacon_loss(). | 1492 | * driver needs to notify about loss of beacons with ieee80211_beacon_loss(). |
@@ -1599,7 +1638,7 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
1599 | * the station sends a PS-Poll or a uAPSD trigger frame, mac80211 | 1638 | * the station sends a PS-Poll or a uAPSD trigger frame, mac80211 |
1600 | * will inform the driver of this with the @allow_buffered_frames | 1639 | * will inform the driver of this with the @allow_buffered_frames |
1601 | * callback; this callback is optional. mac80211 will then transmit | 1640 | * callback; this callback is optional. mac80211 will then transmit |
1602 | * the frames as usual and set the %IEEE80211_TX_CTL_POLL_RESPONSE | 1641 | * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER |
1603 | * on each frame. The last frame in the service period (or the only | 1642 | * on each frame. The last frame in the service period (or the only |
1604 | * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to | 1643 | * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to |
1605 | * indicate that it ends the service period; as this frame must have | 1644 | * indicate that it ends the service period; as this frame must have |
@@ -1607,6 +1646,9 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
1607 | * When TX status is reported for this frame, the service period is | 1646 | * When TX status is reported for this frame, the service period is |
1608 | * marked has having ended and a new one can be started by the peer. | 1647 | * marked has having ended and a new one can be started by the peer. |
1609 | * | 1648 | * |
1649 | * Additionally, non-bufferable MMPDUs can also be transmitted by | ||
1650 | * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them. | ||
1651 | * | ||
1610 | * Another race condition can happen on some devices like iwlwifi | 1652 | * Another race condition can happen on some devices like iwlwifi |
1611 | * when there are frames queued for the station and it wakes up | 1653 | * when there are frames queued for the station and it wakes up |
1612 | * or polls; the frames that are already queued could end up being | 1654 | * or polls; the frames that are already queued could end up being |
@@ -1725,20 +1767,6 @@ enum ieee80211_ampdu_mlme_action { | |||
1725 | }; | 1767 | }; |
1726 | 1768 | ||
1727 | /** | 1769 | /** |
1728 | * enum ieee80211_tx_sync_type - TX sync type | ||
1729 | * @IEEE80211_TX_SYNC_AUTH: sync TX for authentication | ||
1730 | * (and possibly also before direct probe) | ||
1731 | * @IEEE80211_TX_SYNC_ASSOC: sync TX for association | ||
1732 | * @IEEE80211_TX_SYNC_ACTION: sync TX for action frame | ||
1733 | * (not implemented yet) | ||
1734 | */ | ||
1735 | enum ieee80211_tx_sync_type { | ||
1736 | IEEE80211_TX_SYNC_AUTH, | ||
1737 | IEEE80211_TX_SYNC_ASSOC, | ||
1738 | IEEE80211_TX_SYNC_ACTION, | ||
1739 | }; | ||
1740 | |||
1741 | /** | ||
1742 | * enum ieee80211_frame_release_type - frame release reason | 1770 | * enum ieee80211_frame_release_type - frame release reason |
1743 | * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll | 1771 | * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll |
1744 | * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to | 1772 | * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to |
@@ -1848,26 +1876,6 @@ enum ieee80211_frame_release_type { | |||
1848 | * of the bss parameters has changed when a call is made. The callback | 1876 | * of the bss parameters has changed when a call is made. The callback |
1849 | * can sleep. | 1877 | * can sleep. |
1850 | * | 1878 | * |
1851 | * @tx_sync: Called before a frame is sent to an AP/GO. In the GO case, the | ||
1852 | * driver should sync with the GO's powersaving so the device doesn't | ||
1853 | * transmit the frame while the GO is asleep. In the regular AP case | ||
1854 | * it may be used by drivers for devices implementing other restrictions | ||
1855 | * on talking to APs, e.g. due to regulatory enforcement or just HW | ||
1856 | * restrictions. | ||
1857 | * This function is called for every authentication, association and | ||
1858 | * action frame separately since applications might attempt to auth | ||
1859 | * with multiple APs before chosing one to associate to. If it returns | ||
1860 | * an error, the corresponding authentication, association or frame | ||
1861 | * transmission is aborted and reported as having failed. It is always | ||
1862 | * called after tuning to the correct channel. | ||
1863 | * The callback might be called multiple times before @finish_tx_sync | ||
1864 | * (but @finish_tx_sync will be called once for each) but in practice | ||
1865 | * this is unlikely to happen. It can also refuse in that case if the | ||
1866 | * driver cannot handle that situation. | ||
1867 | * This callback can sleep. | ||
1868 | * @finish_tx_sync: Called as a counterpart to @tx_sync, unless that returned | ||
1869 | * an error. This callback can sleep. | ||
1870 | * | ||
1871 | * @prepare_multicast: Prepare for multicast filter configuration. | 1879 | * @prepare_multicast: Prepare for multicast filter configuration. |
1872 | * This callback is optional, and its return value is passed | 1880 | * This callback is optional, and its return value is passed |
1873 | * to configure_filter(). This callback must be atomic. | 1881 | * to configure_filter(). This callback must be atomic. |
@@ -1963,6 +1971,13 @@ enum ieee80211_frame_release_type { | |||
1963 | * in AP mode, this callback will not be called when the flag | 1971 | * in AP mode, this callback will not be called when the flag |
1964 | * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic. | 1972 | * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic. |
1965 | * | 1973 | * |
1974 | * @sta_state: Notifies low level driver about state transition of a | ||
1975 | * station (which can be the AP, a client, IBSS/WDS/mesh peer etc.) | ||
1976 | * This callback is mutually exclusive with @sta_add/@sta_remove. | ||
1977 | * It must not fail for down transitions but may fail for transitions | ||
1978 | * up the list of states. | ||
1979 | * The callback can sleep. | ||
1980 | * | ||
1966 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | 1981 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), |
1967 | * bursting) for a hardware TX queue. | 1982 | * bursting) for a hardware TX queue. |
1968 | * Returns a negative error code on failure. | 1983 | * Returns a negative error code on failure. |
@@ -2098,7 +2113,7 @@ enum ieee80211_frame_release_type { | |||
2098 | * @allow_buffered_frames: Prepare device to allow the given number of frames | 2113 | * @allow_buffered_frames: Prepare device to allow the given number of frames |
2099 | * to go out to the given station. The frames will be sent by mac80211 | 2114 | * to go out to the given station. The frames will be sent by mac80211 |
2100 | * via the usual TX path after this call. The TX information for frames | 2115 | * via the usual TX path after this call. The TX information for frames |
2101 | * released will also have the %IEEE80211_TX_CTL_POLL_RESPONSE flag set | 2116 | * released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set |
2102 | * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case | 2117 | * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case |
2103 | * frames from multiple TIDs are released and the driver might reorder | 2118 | * frames from multiple TIDs are released and the driver might reorder |
2104 | * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag | 2119 | * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag |
@@ -2132,13 +2147,6 @@ struct ieee80211_ops { | |||
2132 | struct ieee80211_bss_conf *info, | 2147 | struct ieee80211_bss_conf *info, |
2133 | u32 changed); | 2148 | u32 changed); |
2134 | 2149 | ||
2135 | int (*tx_sync)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
2136 | const u8 *bssid, enum ieee80211_tx_sync_type type); | ||
2137 | void (*finish_tx_sync)(struct ieee80211_hw *hw, | ||
2138 | struct ieee80211_vif *vif, | ||
2139 | const u8 *bssid, | ||
2140 | enum ieee80211_tx_sync_type type); | ||
2141 | |||
2142 | u64 (*prepare_multicast)(struct ieee80211_hw *hw, | 2150 | u64 (*prepare_multicast)(struct ieee80211_hw *hw, |
2143 | struct netdev_hw_addr_list *mc_list); | 2151 | struct netdev_hw_addr_list *mc_list); |
2144 | void (*configure_filter)(struct ieee80211_hw *hw, | 2152 | void (*configure_filter)(struct ieee80211_hw *hw, |
@@ -2182,6 +2190,10 @@ struct ieee80211_ops { | |||
2182 | struct ieee80211_sta *sta); | 2190 | struct ieee80211_sta *sta); |
2183 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 2191 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2184 | enum sta_notify_cmd, struct ieee80211_sta *sta); | 2192 | enum sta_notify_cmd, struct ieee80211_sta *sta); |
2193 | int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
2194 | struct ieee80211_sta *sta, | ||
2195 | enum ieee80211_sta_state old_state, | ||
2196 | enum ieee80211_sta_state new_state); | ||
2185 | int (*conf_tx)(struct ieee80211_hw *hw, | 2197 | int (*conf_tx)(struct ieee80211_hw *hw, |
2186 | struct ieee80211_vif *vif, u16 queue, | 2198 | struct ieee80211_vif *vif, u16 queue, |
2187 | const struct ieee80211_tx_queue_params *params); | 2199 | const struct ieee80211_tx_queue_params *params); |
@@ -3316,7 +3328,7 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw, | |||
3316 | * | 3328 | * |
3317 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 3329 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
3318 | * | 3330 | * |
3319 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER and | 3331 | * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER and |
3320 | * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the | 3332 | * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the |
3321 | * hardware is not receiving beacons with this function. | 3333 | * hardware is not receiving beacons with this function. |
3322 | */ | 3334 | */ |
@@ -3327,7 +3339,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif); | |||
3327 | * | 3339 | * |
3328 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 3340 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
3329 | * | 3341 | * |
3330 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER, and | 3342 | * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER, and |
3331 | * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver | 3343 | * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver |
3332 | * needs to inform if the connection to the AP has been lost. | 3344 | * needs to inform if the connection to the AP has been lost. |
3333 | * | 3345 | * |
@@ -3397,7 +3409,7 @@ void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif); | |||
3397 | * @rssi_event: the RSSI trigger event type | 3409 | * @rssi_event: the RSSI trigger event type |
3398 | * @gfp: context flags | 3410 | * @gfp: context flags |
3399 | * | 3411 | * |
3400 | * When the %IEEE80211_HW_SUPPORTS_CQM_RSSI is set, and a connection quality | 3412 | * When the %IEEE80211_VIF_SUPPORTS_CQM_RSSI is set, and a connection quality |
3401 | * monitoring is configured with an rssi threshold, the driver will inform | 3413 | * monitoring is configured with an rssi threshold, the driver will inform |
3402 | * whenever the rssi level reaches the threshold. | 3414 | * whenever the rssi level reaches the threshold. |
3403 | */ | 3415 | */ |
@@ -3516,6 +3528,8 @@ enum rate_control_changed { | |||
3516 | * @hw: The hardware the algorithm is invoked for. | 3528 | * @hw: The hardware the algorithm is invoked for. |
3517 | * @sband: The band this frame is being transmitted on. | 3529 | * @sband: The band this frame is being transmitted on. |
3518 | * @bss_conf: the current BSS configuration | 3530 | * @bss_conf: the current BSS configuration |
3531 | * @skb: the skb that will be transmitted, the control information in it needs | ||
3532 | * to be filled in | ||
3519 | * @reported_rate: The rate control algorithm can fill this in to indicate | 3533 | * @reported_rate: The rate control algorithm can fill this in to indicate |
3520 | * which rate should be reported to userspace as the current rate and | 3534 | * which rate should be reported to userspace as the current rate and |
3521 | * used for rate calculations in the mesh network. | 3535 | * used for rate calculations in the mesh network. |
@@ -3523,12 +3537,11 @@ enum rate_control_changed { | |||
3523 | * RTS threshold | 3537 | * RTS threshold |
3524 | * @short_preamble: whether mac80211 will request short-preamble transmission | 3538 | * @short_preamble: whether mac80211 will request short-preamble transmission |
3525 | * if the selected rate supports it | 3539 | * if the selected rate supports it |
3526 | * @max_rate_idx: user-requested maximum rate (not MCS for now) | 3540 | * @max_rate_idx: user-requested maximum (legacy) rate |
3527 | * (deprecated; this will be removed once drivers get updated to use | 3541 | * (deprecated; this will be removed once drivers get updated to use |
3528 | * rate_idx_mask) | 3542 | * rate_idx_mask) |
3529 | * @rate_idx_mask: user-requested rate mask (not MCS for now) | 3543 | * @rate_idx_mask: user-requested (legacy) rate mask |
3530 | * @skb: the skb that will be transmitted, the control information in it needs | 3544 | * @rate_idx_mcs_mask: user-requested MCS rate mask |
3531 | * to be filled in | ||
3532 | * @bss: whether this frame is sent out in AP or IBSS mode | 3545 | * @bss: whether this frame is sent out in AP or IBSS mode |
3533 | */ | 3546 | */ |
3534 | struct ieee80211_tx_rate_control { | 3547 | struct ieee80211_tx_rate_control { |
@@ -3540,6 +3553,7 @@ struct ieee80211_tx_rate_control { | |||
3540 | bool rts, short_preamble; | 3553 | bool rts, short_preamble; |
3541 | u8 max_rate_idx; | 3554 | u8 max_rate_idx; |
3542 | u32 rate_idx_mask; | 3555 | u32 rate_idx_mask; |
3556 | u8 rate_idx_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]; | ||
3543 | bool bss; | 3557 | bool bss; |
3544 | }; | 3558 | }; |
3545 | 3559 | ||
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 | ||
135 | extern void ndisc_send_redirect(struct sk_buff *skb, | 135 | extern 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 | ||
139 | extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, | 138 | extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, |
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h index 2dcf31703acb..96755c3798a5 100644 --- a/include/net/netfilter/nf_conntrack_extend.h +++ b/include/net/netfilter/nf_conntrack_extend.h | |||
@@ -20,6 +20,9 @@ enum nf_ct_ext_id { | |||
20 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP | 20 | #ifdef CONFIG_NF_CONNTRACK_TIMESTAMP |
21 | NF_CT_EXT_TSTAMP, | 21 | NF_CT_EXT_TSTAMP, |
22 | #endif | 22 | #endif |
23 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
24 | NF_CT_EXT_TIMEOUT, | ||
25 | #endif | ||
23 | NF_CT_EXT_NUM, | 26 | NF_CT_EXT_NUM, |
24 | }; | 27 | }; |
25 | 28 | ||
@@ -29,6 +32,7 @@ enum nf_ct_ext_id { | |||
29 | #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache | 32 | #define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache |
30 | #define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone | 33 | #define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone |
31 | #define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp | 34 | #define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp |
35 | #define NF_CT_EXT_TIMEOUT_TYPE struct nf_conn_timeout | ||
32 | 36 | ||
33 | /* Extensions: optional stuff which isn't permanently in struct. */ | 37 | /* Extensions: optional stuff which isn't permanently in struct. */ |
34 | struct nf_ct_ext { | 38 | struct 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 | ||
72 | struct 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 | |||
78 | void nf_ct_helper_expectfn_register(struct nf_ct_helper_expectfn *n); | ||
79 | void nf_ct_helper_expectfn_unregister(struct nf_ct_helper_expectfn *n); | ||
80 | struct nf_ct_helper_expectfn * | ||
81 | nf_ct_helper_expectfn_find_by_name(const char *name); | ||
82 | struct nf_ct_helper_expectfn * | ||
83 | nf_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 | |||
12 | struct 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 | |||
22 | struct nf_conn_timeout { | ||
23 | struct ctnl_timeout *timeout; | ||
24 | }; | ||
25 | |||
26 | #define NF_CT_TIMEOUT_EXT_DATA(__t) (unsigned int *) &((__t)->timeout->data) | ||
27 | |||
28 | static inline | ||
29 | struct 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 | |||
38 | static inline | ||
39 | struct 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 | ||
59 | extern int nf_conntrack_timeout_init(struct net *net); | ||
60 | extern void nf_conntrack_timeout_fini(struct net *net); | ||
61 | #else | ||
62 | static inline int nf_conntrack_timeout_init(struct net *net) | ||
63 | { | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static 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 | ||
74 | extern struct ctnl_timeout *(*nf_ct_timeout_find_get_hook)(const char *name); | ||
75 | extern 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 | }; |
7 | static struct sbuff emergency, *emergency_ptr = &emergency; | 7 | static struct sbuff emergency, *emergency_ptr = &emergency; |
8 | 8 | ||
9 | static int sb_add(struct sbuff *m, const char *f, ...) | 9 | static __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 | */ | ||
459 | static 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) | ||
216 | struct 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) |
211 | struct nci_rf_deactivate_cmd { | 223 | struct 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) |
264 | struct nci_core_intf_error_ntf { | 280 | struct 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) |
270 | struct rf_tech_specific_params_nfca_poll { | 286 | struct 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 | ||
294 | struct rf_tech_specific_params_nfcb_poll { | ||
295 | __u8 sensb_res_len; | ||
296 | __u8 sensb_res[12]; /* 11 or 12 Bytes */ | ||
297 | } __packed; | ||
298 | |||
299 | struct 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 | |||
305 | struct 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) | ||
278 | struct activation_params_nfca_poll_iso_dep { | 321 | struct 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 | ||
326 | struct activation_params_nfcb_poll_iso_dep { | ||
327 | __u8 attrib_res_len; | ||
328 | __u8 attrib_res[50]; | ||
329 | }; | ||
330 | |||
283 | struct nci_rf_intf_activated_ntf { | 331 | struct 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 */ |
38 | enum { | 38 | enum 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 */ | ||
46 | enum 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 | ||
53 | struct nci_dev; | 63 | struct 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 */ |
64 | struct nci_dev { | 75 | struct 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 ----- */ |
128 | struct nci_dev *nci_allocate_device(struct nci_ops *ops, | 143 | struct 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); |
132 | void nci_free_device(struct nci_dev *ndev); | 147 | void nci_free_device(struct nci_dev *ndev); |
133 | int nci_register_device(struct nci_dev *ndev); | 148 | int nci_register_device(struct nci_dev *ndev); |
134 | void nci_unregister_device(struct nci_dev *ndev); | 149 | void nci_unregister_device(struct nci_dev *ndev); |
135 | int nci_recv_frame(struct sk_buff *skb); | 150 | int nci_recv_frame(struct sk_buff *skb); |
136 | 151 | ||
137 | static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev, | 152 | static 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); | |||
169 | int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb); | 184 | int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb); |
170 | void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb, | 185 | void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb, |
171 | int err); | 186 | int err); |
187 | void 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 | ||
70 | struct nfc_target { | 70 | struct 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 | ||
79 | struct nfc_genl_data { | 83 | struct nfc_genl_data { |
@@ -83,7 +87,6 @@ struct nfc_genl_data { | |||
83 | 87 | ||
84 | struct nfc_dev { | 88 | struct 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 { | |||
107 | extern struct class nfc_class; | 110 | extern struct class nfc_class; |
108 | 111 | ||
109 | struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops, | 112 | struct 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 | */ |
134 | static inline void nfc_set_parent_dev(struct nfc_dev *nfc_dev, | 137 | static 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 | ||
171 | struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk, | 174 | struct 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); |
174 | struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp); | 177 | struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp); |
175 | 178 | ||
176 | int nfc_set_remote_general_bytes(struct nfc_dev *dev, | 179 | int nfc_set_remote_general_bytes(struct nfc_dev *dev, |
177 | u8 *gt, u8 gt_len); | 180 | u8 *gt, u8 gt_len); |
178 | 181 | ||
179 | u8 *nfc_get_local_general_bytes(struct nfc_dev *dev, u8 *gt_len); | 182 | int nfc_targets_found(struct nfc_dev *dev, |
180 | 183 | struct nfc_target *targets, int ntargets); | |
181 | int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets, | ||
182 | int ntargets); | ||
183 | 184 | ||
184 | int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx, | 185 | int 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/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. */ |
414 | struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); | 414 | struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); |
415 | 415 | ||
416 | int 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 7ef5c58f3f49..f84be9ed6110 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -357,6 +357,7 @@ struct sock { | |||
357 | struct page *sk_sndmsg_page; | 357 | struct page *sk_sndmsg_page; |
358 | struct sk_buff *sk_send_head; | 358 | struct sk_buff *sk_send_head; |
359 | __u32 sk_sndmsg_off; | 359 | __u32 sk_sndmsg_off; |
360 | __s32 sk_peek_off; | ||
360 | int sk_write_pending; | 361 | int sk_write_pending; |
361 | #ifdef CONFIG_SECURITY | 362 | #ifdef CONFIG_SECURITY |
362 | void *sk_security; | 363 | void *sk_security; |
@@ -373,6 +374,30 @@ struct sock { | |||
373 | void (*sk_destruct)(struct sock *sk); | 374 | void (*sk_destruct)(struct sock *sk); |
374 | }; | 375 | }; |
375 | 376 | ||
377 | static inline int sk_peek_offset(struct sock *sk, int flags) | ||
378 | { | ||
379 | if ((flags & MSG_PEEK) && (sk->sk_peek_off >= 0)) | ||
380 | return sk->sk_peek_off; | ||
381 | else | ||
382 | return 0; | ||
383 | } | ||
384 | |||
385 | static inline void sk_peek_offset_bwd(struct sock *sk, int val) | ||
386 | { | ||
387 | if (sk->sk_peek_off >= 0) { | ||
388 | if (sk->sk_peek_off >= val) | ||
389 | sk->sk_peek_off -= val; | ||
390 | else | ||
391 | sk->sk_peek_off = 0; | ||
392 | } | ||
393 | } | ||
394 | |||
395 | static inline void sk_peek_offset_fwd(struct sock *sk, int val) | ||
396 | { | ||
397 | if (sk->sk_peek_off >= 0) | ||
398 | sk->sk_peek_off += val; | ||
399 | } | ||
400 | |||
376 | /* | 401 | /* |
377 | * Hashed lists helper routines | 402 | * Hashed lists helper routines |
378 | */ | 403 | */ |
@@ -590,6 +615,10 @@ enum sock_flags { | |||
590 | SOCK_RXQ_OVFL, | 615 | SOCK_RXQ_OVFL, |
591 | SOCK_ZEROCOPY, /* buffers from userspace */ | 616 | SOCK_ZEROCOPY, /* buffers from userspace */ |
592 | SOCK_WIFI_STATUS, /* push wifi status to userspace */ | 617 | SOCK_WIFI_STATUS, /* push wifi status to userspace */ |
618 | SOCK_NOFCS, /* Tell NIC not to do the Ethernet FCS. | ||
619 | * Will use last 4 bytes of packet sent from | ||
620 | * user-space instead. | ||
621 | */ | ||
593 | }; | 622 | }; |
594 | 623 | ||
595 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) | 624 | static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 2d80c291fffb..8607e6aad42b 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1138,35 +1138,27 @@ static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) | |||
1138 | /* MD5 Signature */ | 1138 | /* MD5 Signature */ |
1139 | struct crypto_hash; | 1139 | struct crypto_hash; |
1140 | 1140 | ||
1141 | union tcp_md5_addr { | ||
1142 | struct in_addr a4; | ||
1143 | #if IS_ENABLED(CONFIG_IPV6) | ||
1144 | struct in6_addr a6; | ||
1145 | #endif | ||
1146 | }; | ||
1147 | |||
1141 | /* - key database */ | 1148 | /* - key database */ |
1142 | struct tcp_md5sig_key { | 1149 | struct tcp_md5sig_key { |
1143 | u8 *key; | 1150 | struct hlist_node node; |
1144 | u8 keylen; | 1151 | u8 keylen; |
1145 | }; | 1152 | u8 family; /* AF_INET or AF_INET6 */ |
1146 | 1153 | union tcp_md5_addr addr; | |
1147 | struct tcp4_md5sig_key { | 1154 | u8 key[TCP_MD5SIG_MAXKEYLEN]; |
1148 | struct tcp_md5sig_key base; | 1155 | struct rcu_head rcu; |
1149 | __be32 addr; | ||
1150 | }; | ||
1151 | |||
1152 | struct tcp6_md5sig_key { | ||
1153 | struct tcp_md5sig_key base; | ||
1154 | #if 0 | ||
1155 | u32 scope_id; /* XXX */ | ||
1156 | #endif | ||
1157 | struct in6_addr addr; | ||
1158 | }; | 1156 | }; |
1159 | 1157 | ||
1160 | /* - sock block */ | 1158 | /* - sock block */ |
1161 | struct tcp_md5sig_info { | 1159 | struct tcp_md5sig_info { |
1162 | struct tcp4_md5sig_key *keys4; | 1160 | struct hlist_head head; |
1163 | #if IS_ENABLED(CONFIG_IPV6) | 1161 | struct rcu_head rcu; |
1164 | struct tcp6_md5sig_key *keys6; | ||
1165 | u32 entries6; | ||
1166 | u32 alloced6; | ||
1167 | #endif | ||
1168 | u32 entries4; | ||
1169 | u32 alloced4; | ||
1170 | }; | 1162 | }; |
1171 | 1163 | ||
1172 | /* - pseudo header */ | 1164 | /* - pseudo header */ |
@@ -1203,19 +1195,25 @@ extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | |||
1203 | const struct sock *sk, | 1195 | const struct sock *sk, |
1204 | const struct request_sock *req, | 1196 | const struct request_sock *req, |
1205 | const struct sk_buff *skb); | 1197 | const struct sk_buff *skb); |
1206 | extern struct tcp_md5sig_key * tcp_v4_md5_lookup(struct sock *sk, | 1198 | extern int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, |
1207 | struct sock *addr_sk); | 1199 | int family, const u8 *newkey, |
1208 | extern int tcp_v4_md5_do_add(struct sock *sk, __be32 addr, u8 *newkey, | 1200 | u8 newkeylen, gfp_t gfp); |
1209 | u8 newkeylen); | 1201 | extern int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, |
1210 | extern int tcp_v4_md5_do_del(struct sock *sk, __be32 addr); | 1202 | int family); |
1203 | extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, | ||
1204 | struct sock *addr_sk); | ||
1211 | 1205 | ||
1212 | #ifdef CONFIG_TCP_MD5SIG | 1206 | #ifdef CONFIG_TCP_MD5SIG |
1213 | #define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_keylen ? \ | 1207 | extern struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, |
1214 | &(struct tcp_md5sig_key) { \ | 1208 | const union tcp_md5_addr *addr, int family); |
1215 | .key = (twsk)->tw_md5_key, \ | 1209 | #define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key) |
1216 | .keylen = (twsk)->tw_md5_keylen, \ | ||
1217 | } : NULL) | ||
1218 | #else | 1210 | #else |
1211 | static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, | ||
1212 | const union tcp_md5_addr *addr, | ||
1213 | int family) | ||
1214 | { | ||
1215 | return NULL; | ||
1216 | } | ||
1219 | #define tcp_twsk_md5_key(twsk) NULL | 1217 | #define tcp_twsk_md5_key(twsk) NULL |
1220 | #endif | 1218 | #endif |
1221 | 1219 | ||
@@ -1471,10 +1469,6 @@ struct tcp_sock_af_ops { | |||
1471 | const struct sock *sk, | 1469 | const struct sock *sk, |
1472 | const struct request_sock *req, | 1470 | const struct request_sock *req, |
1473 | const struct sk_buff *skb); | 1471 | 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, | 1472 | int (*md5_parse) (struct sock *sk, |
1479 | char __user *optval, | 1473 | char __user *optval, |
1480 | int optlen); | 1474 | int optlen); |
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); | |||
1566 | extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, | 1566 | extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, |
1567 | int probe); | 1567 | int probe); |
1568 | 1568 | ||
1569 | struct hash_desc; | ||
1570 | struct scatterlist; | ||
1571 | typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *, | ||
1572 | unsigned int); | ||
1573 | |||
1574 | static inline int xfrm_addr_cmp(const xfrm_address_t *a, | 1569 | static 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) |