diff options
Diffstat (limited to 'include/net')
57 files changed, 2785 insertions, 726 deletions
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h index d184df1d0d41..dc03d77ad23b 100644 --- a/include/net/6lowpan.h +++ b/include/net/6lowpan.h | |||
@@ -372,12 +372,12 @@ lowpan_uncompress_size(const struct sk_buff *skb, u16 *dgram_offset) | |||
372 | return skb->len + uncomp_header - ret; | 372 | return skb->len + uncomp_header - ret; |
373 | } | 373 | } |
374 | 374 | ||
375 | typedef int (*skb_delivery_cb)(struct sk_buff *skb, struct net_device *dev); | 375 | int |
376 | 376 | lowpan_header_decompress(struct sk_buff *skb, struct net_device *dev, | |
377 | int lowpan_process_data(struct sk_buff *skb, struct net_device *dev, | 377 | const u8 *saddr, const u8 saddr_type, |
378 | const u8 *saddr, const u8 saddr_type, const u8 saddr_len, | 378 | const u8 saddr_len, const u8 *daddr, |
379 | const u8 *daddr, const u8 daddr_type, const u8 daddr_len, | 379 | const u8 daddr_type, const u8 daddr_len, |
380 | u8 iphc0, u8 iphc1, skb_delivery_cb skb_deliver); | 380 | u8 iphc0, u8 iphc1); |
381 | int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, | 381 | int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, |
382 | unsigned short type, const void *_daddr, | 382 | unsigned short type, const void *_daddr, |
383 | const void *_saddr, unsigned int len); | 383 | const void *_saddr, unsigned int len); |
diff --git a/include/net/af_ieee802154.h b/include/net/af_ieee802154.h index 085940f7eeec..7d38e2ffd256 100644 --- a/include/net/af_ieee802154.h +++ b/include/net/af_ieee802154.h | |||
@@ -12,10 +12,6 @@ | |||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | * | ||
19 | * Written by: | 15 | * Written by: |
20 | * Sergey Lapin <slapin@ossfans.org> | 16 | * Sergey Lapin <slapin@ossfans.org> |
21 | * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 17 | * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h index 428277869400..0d87674fb775 100644 --- a/include/net/af_vsock.h +++ b/include/net/af_vsock.h | |||
@@ -103,14 +103,14 @@ struct vsock_transport { | |||
103 | int (*dgram_dequeue)(struct kiocb *kiocb, struct vsock_sock *vsk, | 103 | int (*dgram_dequeue)(struct kiocb *kiocb, struct vsock_sock *vsk, |
104 | struct msghdr *msg, size_t len, int flags); | 104 | struct msghdr *msg, size_t len, int flags); |
105 | int (*dgram_enqueue)(struct vsock_sock *, struct sockaddr_vm *, | 105 | int (*dgram_enqueue)(struct vsock_sock *, struct sockaddr_vm *, |
106 | struct iovec *, size_t len); | 106 | struct msghdr *, size_t len); |
107 | bool (*dgram_allow)(u32 cid, u32 port); | 107 | bool (*dgram_allow)(u32 cid, u32 port); |
108 | 108 | ||
109 | /* STREAM. */ | 109 | /* STREAM. */ |
110 | /* TODO: stream_bind() */ | 110 | /* TODO: stream_bind() */ |
111 | ssize_t (*stream_dequeue)(struct vsock_sock *, struct iovec *, | 111 | ssize_t (*stream_dequeue)(struct vsock_sock *, struct msghdr *, |
112 | size_t len, int flags); | 112 | size_t len, int flags); |
113 | ssize_t (*stream_enqueue)(struct vsock_sock *, struct iovec *, | 113 | ssize_t (*stream_enqueue)(struct vsock_sock *, struct msghdr *, |
114 | size_t len); | 114 | size_t len); |
115 | s64 (*stream_has_data)(struct vsock_sock *); | 115 | s64 (*stream_has_data)(struct vsock_sock *); |
116 | s64 (*stream_has_space)(struct vsock_sock *); | 116 | s64 (*stream_has_space)(struct vsock_sock *); |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 6e8f24967308..40129b3838b2 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -129,6 +129,15 @@ enum { | |||
129 | * during the hdev->setup vendor callback. | 129 | * during the hdev->setup vendor callback. |
130 | */ | 130 | */ |
131 | HCI_QUIRK_INVALID_BDADDR, | 131 | HCI_QUIRK_INVALID_BDADDR, |
132 | |||
133 | /* When this quirk is set, the duplicate filtering during | ||
134 | * scanning is based on Bluetooth devices addresses. To allow | ||
135 | * RSSI based updates, restart scanning if needed. | ||
136 | * | ||
137 | * This quirk can be set before hci_register_dev is called or | ||
138 | * during the hdev->setup vendor callback. | ||
139 | */ | ||
140 | HCI_QUIRK_STRICT_DUPLICATE_FILTER, | ||
132 | }; | 141 | }; |
133 | 142 | ||
134 | /* HCI device flags */ | 143 | /* HCI device flags */ |
@@ -154,6 +163,7 @@ enum { | |||
154 | enum { | 163 | enum { |
155 | HCI_DUT_MODE, | 164 | HCI_DUT_MODE, |
156 | HCI_FORCE_SC, | 165 | HCI_FORCE_SC, |
166 | HCI_FORCE_LESC, | ||
157 | HCI_FORCE_STATIC_ADDR, | 167 | HCI_FORCE_STATIC_ADDR, |
158 | }; | 168 | }; |
159 | 169 | ||
@@ -265,6 +275,7 @@ enum { | |||
265 | /* Low Energy links do not have defined link type. Use invented one */ | 275 | /* Low Energy links do not have defined link type. Use invented one */ |
266 | #define LE_LINK 0x80 | 276 | #define LE_LINK 0x80 |
267 | #define AMP_LINK 0x81 | 277 | #define AMP_LINK 0x81 |
278 | #define INVALID_LINK 0xff | ||
268 | 279 | ||
269 | /* LMP features */ | 280 | /* LMP features */ |
270 | #define LMP_3SLOT 0x01 | 281 | #define LMP_3SLOT 0x01 |
@@ -332,6 +343,7 @@ enum { | |||
332 | #define HCI_LE_ENCRYPTION 0x01 | 343 | #define HCI_LE_ENCRYPTION 0x01 |
333 | #define HCI_LE_CONN_PARAM_REQ_PROC 0x02 | 344 | #define HCI_LE_CONN_PARAM_REQ_PROC 0x02 |
334 | #define HCI_LE_PING 0x10 | 345 | #define HCI_LE_PING 0x10 |
346 | #define HCI_LE_EXT_SCAN_POLICY 0x80 | ||
335 | 347 | ||
336 | /* Connection modes */ | 348 | /* Connection modes */ |
337 | #define HCI_CM_ACTIVE 0x0000 | 349 | #define HCI_CM_ACTIVE 0x0000 |
@@ -401,6 +413,7 @@ enum { | |||
401 | 413 | ||
402 | /* The core spec defines 127 as the "not available" value */ | 414 | /* The core spec defines 127 as the "not available" value */ |
403 | #define HCI_TX_POWER_INVALID 127 | 415 | #define HCI_TX_POWER_INVALID 127 |
416 | #define HCI_RSSI_INVALID 127 | ||
404 | 417 | ||
405 | #define HCI_ROLE_MASTER 0x00 | 418 | #define HCI_ROLE_MASTER 0x00 |
406 | #define HCI_ROLE_SLAVE 0x01 | 419 | #define HCI_ROLE_SLAVE 0x01 |
@@ -629,7 +642,7 @@ struct hci_cp_user_passkey_reply { | |||
629 | struct hci_cp_remote_oob_data_reply { | 642 | struct hci_cp_remote_oob_data_reply { |
630 | bdaddr_t bdaddr; | 643 | bdaddr_t bdaddr; |
631 | __u8 hash[16]; | 644 | __u8 hash[16]; |
632 | __u8 randomizer[16]; | 645 | __u8 rand[16]; |
633 | } __packed; | 646 | } __packed; |
634 | 647 | ||
635 | #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 | 648 | #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 |
@@ -721,9 +734,9 @@ struct hci_rp_set_csb { | |||
721 | struct hci_cp_remote_oob_ext_data_reply { | 734 | struct hci_cp_remote_oob_ext_data_reply { |
722 | bdaddr_t bdaddr; | 735 | bdaddr_t bdaddr; |
723 | __u8 hash192[16]; | 736 | __u8 hash192[16]; |
724 | __u8 randomizer192[16]; | 737 | __u8 rand192[16]; |
725 | __u8 hash256[16]; | 738 | __u8 hash256[16]; |
726 | __u8 randomizer256[16]; | 739 | __u8 rand256[16]; |
727 | } __packed; | 740 | } __packed; |
728 | 741 | ||
729 | #define HCI_OP_SNIFF_MODE 0x0803 | 742 | #define HCI_OP_SNIFF_MODE 0x0803 |
@@ -930,7 +943,7 @@ struct hci_cp_write_ssp_mode { | |||
930 | struct hci_rp_read_local_oob_data { | 943 | struct hci_rp_read_local_oob_data { |
931 | __u8 status; | 944 | __u8 status; |
932 | __u8 hash[16]; | 945 | __u8 hash[16]; |
933 | __u8 randomizer[16]; | 946 | __u8 rand[16]; |
934 | } __packed; | 947 | } __packed; |
935 | 948 | ||
936 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 | 949 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 |
@@ -1014,9 +1027,9 @@ struct hci_cp_write_sc_support { | |||
1014 | struct hci_rp_read_local_oob_ext_data { | 1027 | struct hci_rp_read_local_oob_ext_data { |
1015 | __u8 status; | 1028 | __u8 status; |
1016 | __u8 hash192[16]; | 1029 | __u8 hash192[16]; |
1017 | __u8 randomizer192[16]; | 1030 | __u8 rand192[16]; |
1018 | __u8 hash256[16]; | 1031 | __u8 hash256[16]; |
1019 | __u8 randomizer256[16]; | 1032 | __u8 rand256[16]; |
1020 | } __packed; | 1033 | } __packed; |
1021 | 1034 | ||
1022 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 | 1035 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 |
@@ -1463,6 +1476,11 @@ struct hci_ev_cmd_status { | |||
1463 | __le16 opcode; | 1476 | __le16 opcode; |
1464 | } __packed; | 1477 | } __packed; |
1465 | 1478 | ||
1479 | #define HCI_EV_HARDWARE_ERROR 0x10 | ||
1480 | struct hci_ev_hardware_error { | ||
1481 | __u8 code; | ||
1482 | } __packed; | ||
1483 | |||
1466 | #define HCI_EV_ROLE_CHANGE 0x12 | 1484 | #define HCI_EV_ROLE_CHANGE 0x12 |
1467 | struct hci_ev_role_change { | 1485 | struct hci_ev_role_change { |
1468 | __u8 status; | 1486 | __u8 status; |
@@ -1734,6 +1752,25 @@ struct hci_ev_le_conn_complete { | |||
1734 | __u8 clk_accurancy; | 1752 | __u8 clk_accurancy; |
1735 | } __packed; | 1753 | } __packed; |
1736 | 1754 | ||
1755 | /* Advertising report event types */ | ||
1756 | #define LE_ADV_IND 0x00 | ||
1757 | #define LE_ADV_DIRECT_IND 0x01 | ||
1758 | #define LE_ADV_SCAN_IND 0x02 | ||
1759 | #define LE_ADV_NONCONN_IND 0x03 | ||
1760 | #define LE_ADV_SCAN_RSP 0x04 | ||
1761 | |||
1762 | #define ADDR_LE_DEV_PUBLIC 0x00 | ||
1763 | #define ADDR_LE_DEV_RANDOM 0x01 | ||
1764 | |||
1765 | #define HCI_EV_LE_ADVERTISING_REPORT 0x02 | ||
1766 | struct hci_ev_le_advertising_info { | ||
1767 | __u8 evt_type; | ||
1768 | __u8 bdaddr_type; | ||
1769 | bdaddr_t bdaddr; | ||
1770 | __u8 length; | ||
1771 | __u8 data[0]; | ||
1772 | } __packed; | ||
1773 | |||
1737 | #define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03 | 1774 | #define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03 |
1738 | struct hci_ev_le_conn_update_complete { | 1775 | struct hci_ev_le_conn_update_complete { |
1739 | __u8 status; | 1776 | __u8 status; |
@@ -1759,23 +1796,14 @@ struct hci_ev_le_remote_conn_param_req { | |||
1759 | __le16 timeout; | 1796 | __le16 timeout; |
1760 | } __packed; | 1797 | } __packed; |
1761 | 1798 | ||
1762 | /* Advertising report event types */ | 1799 | #define HCI_EV_LE_DIRECT_ADV_REPORT 0x0B |
1763 | #define LE_ADV_IND 0x00 | 1800 | struct hci_ev_le_direct_adv_info { |
1764 | #define LE_ADV_DIRECT_IND 0x01 | ||
1765 | #define LE_ADV_SCAN_IND 0x02 | ||
1766 | #define LE_ADV_NONCONN_IND 0x03 | ||
1767 | #define LE_ADV_SCAN_RSP 0x04 | ||
1768 | |||
1769 | #define ADDR_LE_DEV_PUBLIC 0x00 | ||
1770 | #define ADDR_LE_DEV_RANDOM 0x01 | ||
1771 | |||
1772 | #define HCI_EV_LE_ADVERTISING_REPORT 0x02 | ||
1773 | struct hci_ev_le_advertising_info { | ||
1774 | __u8 evt_type; | 1801 | __u8 evt_type; |
1775 | __u8 bdaddr_type; | 1802 | __u8 bdaddr_type; |
1776 | bdaddr_t bdaddr; | 1803 | bdaddr_t bdaddr; |
1777 | __u8 length; | 1804 | __u8 direct_addr_type; |
1778 | __u8 data[0]; | 1805 | bdaddr_t direct_addr; |
1806 | __s8 rssi; | ||
1779 | } __packed; | 1807 | } __packed; |
1780 | 1808 | ||
1781 | /* Internal events generated by Bluetooth stack */ | 1809 | /* Internal events generated by Bluetooth stack */ |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 37ff1aef0845..3c7827005c25 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -75,6 +75,10 @@ struct discovery_state { | |||
75 | u32 last_adv_flags; | 75 | u32 last_adv_flags; |
76 | u8 last_adv_data[HCI_MAX_AD_LENGTH]; | 76 | u8 last_adv_data[HCI_MAX_AD_LENGTH]; |
77 | u8 last_adv_data_len; | 77 | u8 last_adv_data_len; |
78 | bool report_invalid_rssi; | ||
79 | s8 rssi; | ||
80 | u16 uuid_count; | ||
81 | u8 (*uuids)[16]; | ||
78 | }; | 82 | }; |
79 | 83 | ||
80 | struct hci_conn_hash { | 84 | struct hci_conn_hash { |
@@ -108,6 +112,7 @@ struct smp_csrk { | |||
108 | 112 | ||
109 | struct smp_ltk { | 113 | struct smp_ltk { |
110 | struct list_head list; | 114 | struct list_head list; |
115 | struct rcu_head rcu; | ||
111 | bdaddr_t bdaddr; | 116 | bdaddr_t bdaddr; |
112 | u8 bdaddr_type; | 117 | u8 bdaddr_type; |
113 | u8 authenticated; | 118 | u8 authenticated; |
@@ -120,6 +125,7 @@ struct smp_ltk { | |||
120 | 125 | ||
121 | struct smp_irk { | 126 | struct smp_irk { |
122 | struct list_head list; | 127 | struct list_head list; |
128 | struct rcu_head rcu; | ||
123 | bdaddr_t rpa; | 129 | bdaddr_t rpa; |
124 | bdaddr_t bdaddr; | 130 | bdaddr_t bdaddr; |
125 | u8 addr_type; | 131 | u8 addr_type; |
@@ -128,6 +134,7 @@ struct smp_irk { | |||
128 | 134 | ||
129 | struct link_key { | 135 | struct link_key { |
130 | struct list_head list; | 136 | struct list_head list; |
137 | struct rcu_head rcu; | ||
131 | bdaddr_t bdaddr; | 138 | bdaddr_t bdaddr; |
132 | u8 type; | 139 | u8 type; |
133 | u8 val[HCI_LINK_KEY_SIZE]; | 140 | u8 val[HCI_LINK_KEY_SIZE]; |
@@ -137,10 +144,11 @@ struct link_key { | |||
137 | struct oob_data { | 144 | struct oob_data { |
138 | struct list_head list; | 145 | struct list_head list; |
139 | bdaddr_t bdaddr; | 146 | bdaddr_t bdaddr; |
147 | u8 bdaddr_type; | ||
140 | u8 hash192[16]; | 148 | u8 hash192[16]; |
141 | u8 randomizer192[16]; | 149 | u8 rand192[16]; |
142 | u8 hash256[16]; | 150 | u8 hash256[16]; |
143 | u8 randomizer256[16]; | 151 | u8 rand256[16]; |
144 | }; | 152 | }; |
145 | 153 | ||
146 | #define HCI_MAX_SHORT_NAME_LENGTH 10 | 154 | #define HCI_MAX_SHORT_NAME_LENGTH 10 |
@@ -303,6 +311,7 @@ struct hci_dev { | |||
303 | __u32 req_result; | 311 | __u32 req_result; |
304 | 312 | ||
305 | void *smp_data; | 313 | void *smp_data; |
314 | void *smp_bredr_data; | ||
306 | 315 | ||
307 | struct discovery_state discovery; | 316 | struct discovery_state discovery; |
308 | struct hci_conn_hash conn_hash; | 317 | struct hci_conn_hash conn_hash; |
@@ -398,6 +407,8 @@ struct hci_conn { | |||
398 | __u16 le_conn_interval; | 407 | __u16 le_conn_interval; |
399 | __u16 le_conn_latency; | 408 | __u16 le_conn_latency; |
400 | __u16 le_supv_timeout; | 409 | __u16 le_supv_timeout; |
410 | __u8 le_adv_data[HCI_MAX_AD_LENGTH]; | ||
411 | __u8 le_adv_data_len; | ||
401 | __s8 rssi; | 412 | __s8 rssi; |
402 | __s8 tx_power; | 413 | __s8 tx_power; |
403 | __s8 max_tx_power; | 414 | __s8 max_tx_power; |
@@ -496,6 +507,17 @@ static inline void discovery_init(struct hci_dev *hdev) | |||
496 | INIT_LIST_HEAD(&hdev->discovery.all); | 507 | INIT_LIST_HEAD(&hdev->discovery.all); |
497 | INIT_LIST_HEAD(&hdev->discovery.unknown); | 508 | INIT_LIST_HEAD(&hdev->discovery.unknown); |
498 | INIT_LIST_HEAD(&hdev->discovery.resolve); | 509 | INIT_LIST_HEAD(&hdev->discovery.resolve); |
510 | hdev->discovery.report_invalid_rssi = true; | ||
511 | hdev->discovery.rssi = HCI_RSSI_INVALID; | ||
512 | } | ||
513 | |||
514 | static inline void hci_discovery_filter_clear(struct hci_dev *hdev) | ||
515 | { | ||
516 | hdev->discovery.report_invalid_rssi = true; | ||
517 | hdev->discovery.rssi = HCI_RSSI_INVALID; | ||
518 | hdev->discovery.uuid_count = 0; | ||
519 | kfree(hdev->discovery.uuids); | ||
520 | hdev->discovery.uuids = NULL; | ||
499 | } | 521 | } |
500 | 522 | ||
501 | bool hci_discovery_active(struct hci_dev *hdev); | 523 | bool hci_discovery_active(struct hci_dev *hdev); |
@@ -553,6 +575,8 @@ enum { | |||
553 | HCI_CONN_STK_ENCRYPT, | 575 | HCI_CONN_STK_ENCRYPT, |
554 | HCI_CONN_AUTH_INITIATOR, | 576 | HCI_CONN_AUTH_INITIATOR, |
555 | HCI_CONN_DROP, | 577 | HCI_CONN_DROP, |
578 | HCI_CONN_PARAM_REMOVAL_PEND, | ||
579 | HCI_CONN_NEW_LINK_KEY, | ||
556 | }; | 580 | }; |
557 | 581 | ||
558 | static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) | 582 | static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) |
@@ -643,6 +667,26 @@ static inline unsigned int hci_conn_count(struct hci_dev *hdev) | |||
643 | return c->acl_num + c->amp_num + c->sco_num + c->le_num; | 667 | return c->acl_num + c->amp_num + c->sco_num + c->le_num; |
644 | } | 668 | } |
645 | 669 | ||
670 | static inline __u8 hci_conn_lookup_type(struct hci_dev *hdev, __u16 handle) | ||
671 | { | ||
672 | struct hci_conn_hash *h = &hdev->conn_hash; | ||
673 | struct hci_conn *c; | ||
674 | __u8 type = INVALID_LINK; | ||
675 | |||
676 | rcu_read_lock(); | ||
677 | |||
678 | list_for_each_entry_rcu(c, &h->list, list) { | ||
679 | if (c->handle == handle) { | ||
680 | type = c->type; | ||
681 | break; | ||
682 | } | ||
683 | } | ||
684 | |||
685 | rcu_read_unlock(); | ||
686 | |||
687 | return type; | ||
688 | } | ||
689 | |||
646 | static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, | 690 | static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, |
647 | __u16 handle) | 691 | __u16 handle) |
648 | { | 692 | { |
@@ -853,6 +897,7 @@ int hci_register_dev(struct hci_dev *hdev); | |||
853 | void hci_unregister_dev(struct hci_dev *hdev); | 897 | void hci_unregister_dev(struct hci_dev *hdev); |
854 | int hci_suspend_dev(struct hci_dev *hdev); | 898 | int hci_suspend_dev(struct hci_dev *hdev); |
855 | int hci_resume_dev(struct hci_dev *hdev); | 899 | int hci_resume_dev(struct hci_dev *hdev); |
900 | int hci_reset_dev(struct hci_dev *hdev); | ||
856 | int hci_dev_open(__u16 dev); | 901 | int hci_dev_open(__u16 dev); |
857 | int hci_dev_close(__u16 dev); | 902 | int hci_dev_close(__u16 dev); |
858 | int hci_dev_reset(__u16 dev); | 903 | int hci_dev_reset(__u16 dev); |
@@ -894,13 +939,11 @@ struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | |||
894 | struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, | 939 | struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, |
895 | bdaddr_t *bdaddr, u8 *val, u8 type, | 940 | bdaddr_t *bdaddr, u8 *val, u8 type, |
896 | u8 pin_len, bool *persistent); | 941 | u8 pin_len, bool *persistent); |
897 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, __le64 rand, | ||
898 | u8 role); | ||
899 | struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, | 942 | struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, |
900 | u8 addr_type, u8 type, u8 authenticated, | 943 | u8 addr_type, u8 type, u8 authenticated, |
901 | u8 tk[16], u8 enc_size, __le16 ediv, __le64 rand); | 944 | u8 tk[16], u8 enc_size, __le16 ediv, __le64 rand); |
902 | struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, | 945 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, |
903 | u8 addr_type, u8 role); | 946 | u8 addr_type, u8 role); |
904 | int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type); | 947 | int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type); |
905 | void hci_smp_ltks_clear(struct hci_dev *hdev); | 948 | void hci_smp_ltks_clear(struct hci_dev *hdev); |
906 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 949 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
@@ -915,13 +958,12 @@ void hci_smp_irks_clear(struct hci_dev *hdev); | |||
915 | 958 | ||
916 | void hci_remote_oob_data_clear(struct hci_dev *hdev); | 959 | void hci_remote_oob_data_clear(struct hci_dev *hdev); |
917 | struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, | 960 | struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, |
918 | bdaddr_t *bdaddr); | 961 | bdaddr_t *bdaddr, u8 bdaddr_type); |
919 | int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, | 962 | int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, |
920 | u8 *hash, u8 *randomizer); | 963 | u8 bdaddr_type, u8 *hash192, u8 *rand192, |
921 | int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr, | 964 | u8 *hash256, u8 *rand256); |
922 | u8 *hash192, u8 *randomizer192, | 965 | int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, |
923 | u8 *hash256, u8 *randomizer256); | 966 | u8 bdaddr_type); |
924 | int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
925 | 967 | ||
926 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 968 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
927 | 969 | ||
@@ -972,6 +1014,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn); | |||
972 | 1014 | ||
973 | #define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \ | 1015 | #define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \ |
974 | !test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) | 1016 | !test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) |
1017 | #define bredr_sc_enabled(dev) ((lmp_sc_capable(dev) || \ | ||
1018 | test_bit(HCI_FORCE_SC, &(dev)->dbg_flags)) && \ | ||
1019 | test_bit(HCI_SC_ENABLED, &(dev)->dev_flags)) | ||
975 | 1020 | ||
976 | /* ----- HCI protocols ----- */ | 1021 | /* ----- HCI protocols ----- */ |
977 | #define HCI_PROTO_DEFER 0x01 | 1022 | #define HCI_PROTO_DEFER 0x01 |
@@ -1310,9 +1355,8 @@ int mgmt_update_adv_data(struct hci_dev *hdev); | |||
1310 | void mgmt_discoverable_timeout(struct hci_dev *hdev); | 1355 | void mgmt_discoverable_timeout(struct hci_dev *hdev); |
1311 | void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, | 1356 | void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, |
1312 | bool persistent); | 1357 | bool persistent); |
1313 | void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1358 | void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn, |
1314 | u8 addr_type, u32 flags, u8 *name, u8 name_len, | 1359 | u32 flags, u8 *name, u8 name_len); |
1315 | u8 *dev_class); | ||
1316 | void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, | 1360 | void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, |
1317 | u8 link_type, u8 addr_type, u8 reason, | 1361 | u8 link_type, u8 addr_type, u8 reason, |
1318 | bool mgmt_connected); | 1362 | bool mgmt_connected); |
@@ -1349,8 +1393,8 @@ void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, | |||
1349 | u8 status); | 1393 | u8 status); |
1350 | void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); | 1394 | void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); |
1351 | void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192, | 1395 | void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192, |
1352 | u8 *randomizer192, u8 *hash256, | 1396 | u8 *rand192, u8 *hash256, u8 *rand256, |
1353 | u8 *randomizer256, u8 status); | 1397 | u8 status); |
1354 | void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1398 | void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
1355 | u8 addr_type, u8 *dev_class, s8 rssi, u32 flags, | 1399 | u8 addr_type, u8 *dev_class, s8 rssi, u32 flags, |
1356 | u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len); | 1400 | u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len); |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index ead99f032f7a..d1bb342d083f 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #define __L2CAP_H | 28 | #define __L2CAP_H |
29 | 29 | ||
30 | #include <asm/unaligned.h> | 30 | #include <asm/unaligned.h> |
31 | #include <linux/atomic.h> | ||
31 | 32 | ||
32 | /* L2CAP defaults */ | 33 | /* L2CAP defaults */ |
33 | #define L2CAP_DEFAULT_MTU 672 | 34 | #define L2CAP_DEFAULT_MTU 672 |
@@ -140,6 +141,7 @@ struct l2cap_conninfo { | |||
140 | #define L2CAP_FC_ATT 0x10 | 141 | #define L2CAP_FC_ATT 0x10 |
141 | #define L2CAP_FC_SIG_LE 0x20 | 142 | #define L2CAP_FC_SIG_LE 0x20 |
142 | #define L2CAP_FC_SMP_LE 0x40 | 143 | #define L2CAP_FC_SMP_LE 0x40 |
144 | #define L2CAP_FC_SMP_BREDR 0x80 | ||
143 | 145 | ||
144 | /* L2CAP Control Field bit masks */ | 146 | /* L2CAP Control Field bit masks */ |
145 | #define L2CAP_CTRL_SAR 0xC000 | 147 | #define L2CAP_CTRL_SAR 0xC000 |
@@ -254,6 +256,7 @@ struct l2cap_conn_rsp { | |||
254 | #define L2CAP_CID_ATT 0x0004 | 256 | #define L2CAP_CID_ATT 0x0004 |
255 | #define L2CAP_CID_LE_SIGNALING 0x0005 | 257 | #define L2CAP_CID_LE_SIGNALING 0x0005 |
256 | #define L2CAP_CID_SMP 0x0006 | 258 | #define L2CAP_CID_SMP 0x0006 |
259 | #define L2CAP_CID_SMP_BREDR 0x0007 | ||
257 | #define L2CAP_CID_DYN_START 0x0040 | 260 | #define L2CAP_CID_DYN_START 0x0040 |
258 | #define L2CAP_CID_DYN_END 0xffff | 261 | #define L2CAP_CID_DYN_END 0xffff |
259 | #define L2CAP_CID_LE_DYN_END 0x007f | 262 | #define L2CAP_CID_LE_DYN_END 0x007f |
@@ -481,6 +484,7 @@ struct l2cap_chan { | |||
481 | struct hci_conn *hs_hcon; | 484 | struct hci_conn *hs_hcon; |
482 | struct hci_chan *hs_hchan; | 485 | struct hci_chan *hs_hchan; |
483 | struct kref kref; | 486 | struct kref kref; |
487 | atomic_t nesting; | ||
484 | 488 | ||
485 | __u8 state; | 489 | __u8 state; |
486 | 490 | ||
@@ -604,10 +608,6 @@ struct l2cap_ops { | |||
604 | struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, | 608 | struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, |
605 | unsigned long hdr_len, | 609 | unsigned long hdr_len, |
606 | unsigned long len, int nb); | 610 | unsigned long len, int nb); |
607 | int (*memcpy_fromiovec) (struct l2cap_chan *chan, | ||
608 | unsigned char *kdata, | ||
609 | struct iovec *iov, | ||
610 | int len); | ||
611 | }; | 611 | }; |
612 | 612 | ||
613 | struct l2cap_conn { | 613 | struct l2cap_conn { |
@@ -617,8 +617,8 @@ struct l2cap_conn { | |||
617 | unsigned int mtu; | 617 | unsigned int mtu; |
618 | 618 | ||
619 | __u32 feat_mask; | 619 | __u32 feat_mask; |
620 | __u8 fixed_chan_mask; | 620 | __u8 remote_fixed_chan; |
621 | bool hs_enabled; | 621 | __u8 local_fixed_chan; |
622 | 622 | ||
623 | __u8 info_state; | 623 | __u8 info_state; |
624 | __u8 info_ident; | 624 | __u8 info_ident; |
@@ -713,6 +713,17 @@ enum { | |||
713 | FLAG_HOLD_HCI_CONN, | 713 | FLAG_HOLD_HCI_CONN, |
714 | }; | 714 | }; |
715 | 715 | ||
716 | /* Lock nesting levels for L2CAP channels. We need these because lockdep | ||
717 | * otherwise considers all channels equal and will e.g. complain about a | ||
718 | * connection oriented channel triggering SMP procedures or a listening | ||
719 | * channel creating and locking a child channel. | ||
720 | */ | ||
721 | enum { | ||
722 | L2CAP_NESTING_SMP, | ||
723 | L2CAP_NESTING_NORMAL, | ||
724 | L2CAP_NESTING_PARENT, | ||
725 | }; | ||
726 | |||
716 | enum { | 727 | enum { |
717 | L2CAP_TX_STATE_XMIT, | 728 | L2CAP_TX_STATE_XMIT, |
718 | L2CAP_TX_STATE_WAIT_F, | 729 | L2CAP_TX_STATE_WAIT_F, |
@@ -778,7 +789,7 @@ void l2cap_chan_put(struct l2cap_chan *c); | |||
778 | 789 | ||
779 | static inline void l2cap_chan_lock(struct l2cap_chan *chan) | 790 | static inline void l2cap_chan_lock(struct l2cap_chan *chan) |
780 | { | 791 | { |
781 | mutex_lock(&chan->lock); | 792 | mutex_lock_nested(&chan->lock, atomic_read(&chan->nesting)); |
782 | } | 793 | } |
783 | 794 | ||
784 | static inline void l2cap_chan_unlock(struct l2cap_chan *chan) | 795 | static inline void l2cap_chan_unlock(struct l2cap_chan *chan) |
@@ -890,31 +901,6 @@ static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan) | |||
890 | return 0; | 901 | return 0; |
891 | } | 902 | } |
892 | 903 | ||
893 | static inline int l2cap_chan_no_memcpy_fromiovec(struct l2cap_chan *chan, | ||
894 | unsigned char *kdata, | ||
895 | struct iovec *iov, | ||
896 | int len) | ||
897 | { | ||
898 | /* Following is safe since for compiler definitions of kvec and | ||
899 | * iovec are identical, yielding the same in-core layout and alignment | ||
900 | */ | ||
901 | struct kvec *vec = (struct kvec *)iov; | ||
902 | |||
903 | while (len > 0) { | ||
904 | if (vec->iov_len) { | ||
905 | int copy = min_t(unsigned int, len, vec->iov_len); | ||
906 | memcpy(kdata, vec->iov_base, copy); | ||
907 | len -= copy; | ||
908 | kdata += copy; | ||
909 | vec->iov_base += copy; | ||
910 | vec->iov_len -= copy; | ||
911 | } | ||
912 | vec++; | ||
913 | } | ||
914 | |||
915 | return 0; | ||
916 | } | ||
917 | |||
918 | extern bool disable_ertm; | 904 | extern bool disable_ertm; |
919 | 905 | ||
920 | int l2cap_init_sockets(void); | 906 | int l2cap_init_sockets(void); |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 414cd2f9a437..95c34d5180fa 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -184,6 +184,9 @@ struct mgmt_cp_load_link_keys { | |||
184 | 184 | ||
185 | #define MGMT_LTK_UNAUTHENTICATED 0x00 | 185 | #define MGMT_LTK_UNAUTHENTICATED 0x00 |
186 | #define MGMT_LTK_AUTHENTICATED 0x01 | 186 | #define MGMT_LTK_AUTHENTICATED 0x01 |
187 | #define MGMT_LTK_P256_UNAUTH 0x02 | ||
188 | #define MGMT_LTK_P256_AUTH 0x03 | ||
189 | #define MGMT_LTK_P256_DEBUG 0x04 | ||
187 | 190 | ||
188 | struct mgmt_ltk_info { | 191 | struct mgmt_ltk_info { |
189 | struct mgmt_addr_info addr; | 192 | struct mgmt_addr_info addr; |
@@ -299,28 +302,28 @@ struct mgmt_cp_user_passkey_neg_reply { | |||
299 | #define MGMT_READ_LOCAL_OOB_DATA_SIZE 0 | 302 | #define MGMT_READ_LOCAL_OOB_DATA_SIZE 0 |
300 | struct mgmt_rp_read_local_oob_data { | 303 | struct mgmt_rp_read_local_oob_data { |
301 | __u8 hash[16]; | 304 | __u8 hash[16]; |
302 | __u8 randomizer[16]; | 305 | __u8 rand[16]; |
303 | } __packed; | 306 | } __packed; |
304 | struct mgmt_rp_read_local_oob_ext_data { | 307 | struct mgmt_rp_read_local_oob_ext_data { |
305 | __u8 hash192[16]; | 308 | __u8 hash192[16]; |
306 | __u8 randomizer192[16]; | 309 | __u8 rand192[16]; |
307 | __u8 hash256[16]; | 310 | __u8 hash256[16]; |
308 | __u8 randomizer256[16]; | 311 | __u8 rand256[16]; |
309 | } __packed; | 312 | } __packed; |
310 | 313 | ||
311 | #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 | 314 | #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 |
312 | struct mgmt_cp_add_remote_oob_data { | 315 | struct mgmt_cp_add_remote_oob_data { |
313 | struct mgmt_addr_info addr; | 316 | struct mgmt_addr_info addr; |
314 | __u8 hash[16]; | 317 | __u8 hash[16]; |
315 | __u8 randomizer[16]; | 318 | __u8 rand[16]; |
316 | } __packed; | 319 | } __packed; |
317 | #define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32) | 320 | #define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32) |
318 | struct mgmt_cp_add_remote_oob_ext_data { | 321 | struct mgmt_cp_add_remote_oob_ext_data { |
319 | struct mgmt_addr_info addr; | 322 | struct mgmt_addr_info addr; |
320 | __u8 hash192[16]; | 323 | __u8 hash192[16]; |
321 | __u8 randomizer192[16]; | 324 | __u8 rand192[16]; |
322 | __u8 hash256[16]; | 325 | __u8 hash256[16]; |
323 | __u8 randomizer256[16]; | 326 | __u8 rand256[16]; |
324 | } __packed; | 327 | } __packed; |
325 | #define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64) | 328 | #define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64) |
326 | 329 | ||
@@ -495,6 +498,15 @@ struct mgmt_cp_set_public_address { | |||
495 | } __packed; | 498 | } __packed; |
496 | #define MGMT_SET_PUBLIC_ADDRESS_SIZE 6 | 499 | #define MGMT_SET_PUBLIC_ADDRESS_SIZE 6 |
497 | 500 | ||
501 | #define MGMT_OP_START_SERVICE_DISCOVERY 0x003A | ||
502 | struct mgmt_cp_start_service_discovery { | ||
503 | __u8 type; | ||
504 | __s8 rssi; | ||
505 | __le16 uuid_count; | ||
506 | __u8 uuids[0][16]; | ||
507 | } __packed; | ||
508 | #define MGMT_START_SERVICE_DISCOVERY_SIZE 4 | ||
509 | |||
498 | #define MGMT_EV_CMD_COMPLETE 0x0001 | 510 | #define MGMT_EV_CMD_COMPLETE 0x0001 |
499 | struct mgmt_ev_cmd_complete { | 511 | struct mgmt_ev_cmd_complete { |
500 | __le16 opcode; | 512 | __le16 opcode; |
diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h new file mode 100644 index 000000000000..e01d903633ef --- /dev/null +++ b/include/net/bond_3ad.h | |||
@@ -0,0 +1,283 @@ | |||
1 | /* | ||
2 | * Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the Free | ||
6 | * Software Foundation; either version 2 of the License, or (at your option) | ||
7 | * any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., 59 | ||
16 | * Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | * | ||
18 | * The full GNU General Public License is included in this distribution in the | ||
19 | * file called LICENSE. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef _NET_BOND_3AD_H | ||
24 | #define _NET_BOND_3AD_H | ||
25 | |||
26 | #include <asm/byteorder.h> | ||
27 | #include <linux/skbuff.h> | ||
28 | #include <linux/netdevice.h> | ||
29 | #include <linux/if_ether.h> | ||
30 | |||
31 | /* General definitions */ | ||
32 | #define PKT_TYPE_LACPDU cpu_to_be16(ETH_P_SLOW) | ||
33 | #define AD_TIMER_INTERVAL 100 /*msec*/ | ||
34 | |||
35 | #define MULTICAST_LACPDU_ADDR {0x01, 0x80, 0xC2, 0x00, 0x00, 0x02} | ||
36 | |||
37 | #define AD_LACP_SLOW 0 | ||
38 | #define AD_LACP_FAST 1 | ||
39 | |||
40 | typedef struct mac_addr { | ||
41 | u8 mac_addr_value[ETH_ALEN]; | ||
42 | } __packed mac_addr_t; | ||
43 | |||
44 | enum { | ||
45 | BOND_AD_STABLE = 0, | ||
46 | BOND_AD_BANDWIDTH = 1, | ||
47 | BOND_AD_COUNT = 2, | ||
48 | }; | ||
49 | |||
50 | /* rx machine states(43.4.11 in the 802.3ad standard) */ | ||
51 | typedef enum { | ||
52 | AD_RX_DUMMY, | ||
53 | AD_RX_INITIALIZE, /* rx Machine */ | ||
54 | AD_RX_PORT_DISABLED, /* rx Machine */ | ||
55 | AD_RX_LACP_DISABLED, /* rx Machine */ | ||
56 | AD_RX_EXPIRED, /* rx Machine */ | ||
57 | AD_RX_DEFAULTED, /* rx Machine */ | ||
58 | AD_RX_CURRENT /* rx Machine */ | ||
59 | } rx_states_t; | ||
60 | |||
61 | /* periodic machine states(43.4.12 in the 802.3ad standard) */ | ||
62 | typedef enum { | ||
63 | AD_PERIODIC_DUMMY, | ||
64 | AD_NO_PERIODIC, /* periodic machine */ | ||
65 | AD_FAST_PERIODIC, /* periodic machine */ | ||
66 | AD_SLOW_PERIODIC, /* periodic machine */ | ||
67 | AD_PERIODIC_TX /* periodic machine */ | ||
68 | } periodic_states_t; | ||
69 | |||
70 | /* mux machine states(43.4.13 in the 802.3ad standard) */ | ||
71 | typedef enum { | ||
72 | AD_MUX_DUMMY, | ||
73 | AD_MUX_DETACHED, /* mux machine */ | ||
74 | AD_MUX_WAITING, /* mux machine */ | ||
75 | AD_MUX_ATTACHED, /* mux machine */ | ||
76 | AD_MUX_COLLECTING_DISTRIBUTING /* mux machine */ | ||
77 | } mux_states_t; | ||
78 | |||
79 | /* tx machine states(43.4.15 in the 802.3ad standard) */ | ||
80 | typedef enum { | ||
81 | AD_TX_DUMMY, | ||
82 | AD_TRANSMIT /* tx Machine */ | ||
83 | } tx_states_t; | ||
84 | |||
85 | /* rx indication types */ | ||
86 | typedef enum { | ||
87 | AD_TYPE_LACPDU = 1, /* type lacpdu */ | ||
88 | AD_TYPE_MARKER /* type marker */ | ||
89 | } pdu_type_t; | ||
90 | |||
91 | /* rx marker indication types */ | ||
92 | typedef enum { | ||
93 | AD_MARKER_INFORMATION_SUBTYPE = 1, /* marker imformation subtype */ | ||
94 | AD_MARKER_RESPONSE_SUBTYPE /* marker response subtype */ | ||
95 | } bond_marker_subtype_t; | ||
96 | |||
97 | /* timers types(43.4.9 in the 802.3ad standard) */ | ||
98 | typedef enum { | ||
99 | AD_CURRENT_WHILE_TIMER, | ||
100 | AD_ACTOR_CHURN_TIMER, | ||
101 | AD_PERIODIC_TIMER, | ||
102 | AD_PARTNER_CHURN_TIMER, | ||
103 | AD_WAIT_WHILE_TIMER | ||
104 | } ad_timers_t; | ||
105 | |||
106 | #pragma pack(1) | ||
107 | |||
108 | /* Link Aggregation Control Protocol(LACP) data unit structure(43.4.2.2 in the 802.3ad standard) */ | ||
109 | typedef struct lacpdu { | ||
110 | u8 subtype; /* = LACP(= 0x01) */ | ||
111 | u8 version_number; | ||
112 | u8 tlv_type_actor_info; /* = actor information(type/length/value) */ | ||
113 | u8 actor_information_length; /* = 20 */ | ||
114 | __be16 actor_system_priority; | ||
115 | struct mac_addr actor_system; | ||
116 | __be16 actor_key; | ||
117 | __be16 actor_port_priority; | ||
118 | __be16 actor_port; | ||
119 | u8 actor_state; | ||
120 | u8 reserved_3_1[3]; /* = 0 */ | ||
121 | u8 tlv_type_partner_info; /* = partner information */ | ||
122 | u8 partner_information_length; /* = 20 */ | ||
123 | __be16 partner_system_priority; | ||
124 | struct mac_addr partner_system; | ||
125 | __be16 partner_key; | ||
126 | __be16 partner_port_priority; | ||
127 | __be16 partner_port; | ||
128 | u8 partner_state; | ||
129 | u8 reserved_3_2[3]; /* = 0 */ | ||
130 | u8 tlv_type_collector_info; /* = collector information */ | ||
131 | u8 collector_information_length;/* = 16 */ | ||
132 | __be16 collector_max_delay; | ||
133 | u8 reserved_12[12]; | ||
134 | u8 tlv_type_terminator; /* = terminator */ | ||
135 | u8 terminator_length; /* = 0 */ | ||
136 | u8 reserved_50[50]; /* = 0 */ | ||
137 | } __packed lacpdu_t; | ||
138 | |||
139 | typedef struct lacpdu_header { | ||
140 | struct ethhdr hdr; | ||
141 | struct lacpdu lacpdu; | ||
142 | } __packed lacpdu_header_t; | ||
143 | |||
144 | /* Marker Protocol Data Unit(PDU) structure(43.5.3.2 in the 802.3ad standard) */ | ||
145 | typedef struct bond_marker { | ||
146 | u8 subtype; /* = 0x02 (marker PDU) */ | ||
147 | u8 version_number; /* = 0x01 */ | ||
148 | u8 tlv_type; /* = 0x01 (marker information) */ | ||
149 | /* = 0x02 (marker response information) */ | ||
150 | u8 marker_length; /* = 0x16 */ | ||
151 | u16 requester_port; /* The number assigned to the port by the requester */ | ||
152 | struct mac_addr requester_system; /* The requester's system id */ | ||
153 | u32 requester_transaction_id; /* The transaction id allocated by the requester, */ | ||
154 | u16 pad; /* = 0 */ | ||
155 | u8 tlv_type_terminator; /* = 0x00 */ | ||
156 | u8 terminator_length; /* = 0x00 */ | ||
157 | u8 reserved_90[90]; /* = 0 */ | ||
158 | } __packed bond_marker_t; | ||
159 | |||
160 | typedef struct bond_marker_header { | ||
161 | struct ethhdr hdr; | ||
162 | struct bond_marker marker; | ||
163 | } __packed bond_marker_header_t; | ||
164 | |||
165 | #pragma pack() | ||
166 | |||
167 | struct slave; | ||
168 | struct bonding; | ||
169 | struct ad_info; | ||
170 | struct port; | ||
171 | |||
172 | #ifdef __ia64__ | ||
173 | #pragma pack(8) | ||
174 | #endif | ||
175 | |||
176 | /* aggregator structure(43.4.5 in the 802.3ad standard) */ | ||
177 | typedef struct aggregator { | ||
178 | struct mac_addr aggregator_mac_address; | ||
179 | u16 aggregator_identifier; | ||
180 | bool is_individual; | ||
181 | u16 actor_admin_aggregator_key; | ||
182 | u16 actor_oper_aggregator_key; | ||
183 | struct mac_addr partner_system; | ||
184 | u16 partner_system_priority; | ||
185 | u16 partner_oper_aggregator_key; | ||
186 | u16 receive_state; /* BOOLEAN */ | ||
187 | u16 transmit_state; /* BOOLEAN */ | ||
188 | struct port *lag_ports; | ||
189 | /* ****** PRIVATE PARAMETERS ****** */ | ||
190 | struct slave *slave; /* pointer to the bond slave that this aggregator belongs to */ | ||
191 | u16 is_active; /* BOOLEAN. Indicates if this aggregator is active */ | ||
192 | u16 num_of_ports; | ||
193 | } aggregator_t; | ||
194 | |||
195 | struct port_params { | ||
196 | struct mac_addr system; | ||
197 | u16 system_priority; | ||
198 | u16 key; | ||
199 | u16 port_number; | ||
200 | u16 port_priority; | ||
201 | u16 port_state; | ||
202 | }; | ||
203 | |||
204 | /* port structure(43.4.6 in the 802.3ad standard) */ | ||
205 | typedef struct port { | ||
206 | u16 actor_port_number; | ||
207 | u16 actor_port_priority; | ||
208 | struct mac_addr actor_system; /* This parameter is added here although it is not specified in the standard, just for simplification */ | ||
209 | u16 actor_system_priority; /* This parameter is added here although it is not specified in the standard, just for simplification */ | ||
210 | u16 actor_port_aggregator_identifier; | ||
211 | bool ntt; | ||
212 | u16 actor_admin_port_key; | ||
213 | u16 actor_oper_port_key; | ||
214 | u8 actor_admin_port_state; | ||
215 | u8 actor_oper_port_state; | ||
216 | |||
217 | struct port_params partner_admin; | ||
218 | struct port_params partner_oper; | ||
219 | |||
220 | bool is_enabled; | ||
221 | |||
222 | /* ****** PRIVATE PARAMETERS ****** */ | ||
223 | u16 sm_vars; /* all state machines variables for this port */ | ||
224 | rx_states_t sm_rx_state; /* state machine rx state */ | ||
225 | u16 sm_rx_timer_counter; /* state machine rx timer counter */ | ||
226 | periodic_states_t sm_periodic_state; /* state machine periodic state */ | ||
227 | u16 sm_periodic_timer_counter; /* state machine periodic timer counter */ | ||
228 | mux_states_t sm_mux_state; /* state machine mux state */ | ||
229 | u16 sm_mux_timer_counter; /* state machine mux timer counter */ | ||
230 | tx_states_t sm_tx_state; /* state machine tx state */ | ||
231 | u16 sm_tx_timer_counter; /* state machine tx timer counter(allways on - enter to transmit state 3 time per second) */ | ||
232 | struct slave *slave; /* pointer to the bond slave that this port belongs to */ | ||
233 | struct aggregator *aggregator; /* pointer to an aggregator that this port related to */ | ||
234 | struct port *next_port_in_aggregator; /* Next port on the linked list of the parent aggregator */ | ||
235 | u32 transaction_id; /* continuous number for identification of Marker PDU's; */ | ||
236 | struct lacpdu lacpdu; /* the lacpdu that will be sent for this port */ | ||
237 | } port_t; | ||
238 | |||
239 | /* system structure */ | ||
240 | struct ad_system { | ||
241 | u16 sys_priority; | ||
242 | struct mac_addr sys_mac_addr; | ||
243 | }; | ||
244 | |||
245 | #ifdef __ia64__ | ||
246 | #pragma pack() | ||
247 | #endif | ||
248 | |||
249 | /* ========== AD Exported structures to the main bonding code ========== */ | ||
250 | #define BOND_AD_INFO(bond) ((bond)->ad_info) | ||
251 | #define SLAVE_AD_INFO(slave) ((slave)->ad_info) | ||
252 | |||
253 | struct ad_bond_info { | ||
254 | struct ad_system system; /* 802.3ad system structure */ | ||
255 | u32 agg_select_timer; /* Timer to select aggregator after all adapter's hand shakes */ | ||
256 | u16 aggregator_identifier; | ||
257 | }; | ||
258 | |||
259 | struct ad_slave_info { | ||
260 | struct aggregator aggregator; /* 802.3ad aggregator structure */ | ||
261 | struct port port; /* 802.3ad port structure */ | ||
262 | u16 id; | ||
263 | }; | ||
264 | |||
265 | /* ========== AD Exported functions to the main bonding code ========== */ | ||
266 | void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution); | ||
267 | void bond_3ad_bind_slave(struct slave *slave); | ||
268 | void bond_3ad_unbind_slave(struct slave *slave); | ||
269 | void bond_3ad_state_machine_handler(struct work_struct *); | ||
270 | void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout); | ||
271 | void bond_3ad_adapter_speed_changed(struct slave *slave); | ||
272 | void bond_3ad_adapter_duplex_changed(struct slave *slave); | ||
273 | void bond_3ad_handle_link_change(struct slave *slave, char link); | ||
274 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); | ||
275 | int __bond_3ad_get_active_agg_info(struct bonding *bond, | ||
276 | struct ad_info *ad_info); | ||
277 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); | ||
278 | int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, | ||
279 | struct slave *slave); | ||
280 | int bond_3ad_set_carrier(struct bonding *bond); | ||
281 | void bond_3ad_update_lacp_rate(struct bonding *bond); | ||
282 | #endif /* _NET_BOND_3AD_H */ | ||
283 | |||
diff --git a/include/net/bond_alb.h b/include/net/bond_alb.h new file mode 100644 index 000000000000..313a8d3b3069 --- /dev/null +++ b/include/net/bond_alb.h | |||
@@ -0,0 +1,181 @@ | |||
1 | /* | ||
2 | * Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
12 | * for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | * The full GNU General Public License is included in this distribution in the | ||
18 | * file called LICENSE. | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #ifndef _NET_BOND_ALB_H | ||
23 | #define _NET_BOND_ALB_H | ||
24 | |||
25 | #include <linux/if_ether.h> | ||
26 | |||
27 | struct bonding; | ||
28 | struct slave; | ||
29 | |||
30 | #define BOND_ALB_INFO(bond) ((bond)->alb_info) | ||
31 | #define SLAVE_TLB_INFO(slave) ((slave)->tlb_info) | ||
32 | |||
33 | #define ALB_TIMER_TICKS_PER_SEC 10 /* should be a divisor of HZ */ | ||
34 | #define BOND_TLB_REBALANCE_INTERVAL 10 /* In seconds, periodic re-balancing. | ||
35 | * Used for division - never set | ||
36 | * to zero !!! | ||
37 | */ | ||
38 | #define BOND_ALB_DEFAULT_LP_INTERVAL 1 | ||
39 | #define BOND_ALB_LP_INTERVAL(bond) (bond->params.lp_interval) /* In seconds, periodic send of | ||
40 | * learning packets to the switch | ||
41 | */ | ||
42 | |||
43 | #define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \ | ||
44 | * ALB_TIMER_TICKS_PER_SEC) | ||
45 | |||
46 | #define BOND_ALB_LP_TICKS(bond) (BOND_ALB_LP_INTERVAL(bond) \ | ||
47 | * ALB_TIMER_TICKS_PER_SEC) | ||
48 | |||
49 | #define TLB_HASH_TABLE_SIZE 256 /* The size of the clients hash table. | ||
50 | * Note that this value MUST NOT be smaller | ||
51 | * because the key hash table is BYTE wide ! | ||
52 | */ | ||
53 | |||
54 | |||
55 | #define TLB_NULL_INDEX 0xffffffff | ||
56 | |||
57 | /* rlb defs */ | ||
58 | #define RLB_HASH_TABLE_SIZE 256 | ||
59 | #define RLB_NULL_INDEX 0xffffffff | ||
60 | #define RLB_UPDATE_DELAY (2*ALB_TIMER_TICKS_PER_SEC) /* 2 seconds */ | ||
61 | #define RLB_ARP_BURST_SIZE 2 | ||
62 | #define RLB_UPDATE_RETRY 3 /* 3-ticks - must be smaller than the rlb | ||
63 | * rebalance interval (5 min). | ||
64 | */ | ||
65 | /* RLB_PROMISC_TIMEOUT = 10 sec equals the time that the current slave is | ||
66 | * promiscuous after failover | ||
67 | */ | ||
68 | #define RLB_PROMISC_TIMEOUT (10*ALB_TIMER_TICKS_PER_SEC) | ||
69 | |||
70 | |||
71 | struct tlb_client_info { | ||
72 | struct slave *tx_slave; /* A pointer to slave used for transmiting | ||
73 | * packets to a Client that the Hash function | ||
74 | * gave this entry index. | ||
75 | */ | ||
76 | u32 tx_bytes; /* Each Client accumulates the BytesTx that | ||
77 | * were transmitted to it, and after each | ||
78 | * CallBack the LoadHistory is divided | ||
79 | * by the balance interval | ||
80 | */ | ||
81 | u32 load_history; /* This field contains the amount of Bytes | ||
82 | * that were transmitted to this client by | ||
83 | * the server on the previous balance | ||
84 | * interval in Bps. | ||
85 | */ | ||
86 | u32 next; /* The next Hash table entry index, assigned | ||
87 | * to use the same adapter for transmit. | ||
88 | */ | ||
89 | u32 prev; /* The previous Hash table entry index, | ||
90 | * assigned to use the same | ||
91 | */ | ||
92 | }; | ||
93 | |||
94 | /* ------------------------------------------------------------------------- | ||
95 | * struct rlb_client_info contains all info related to a specific rx client | ||
96 | * connection. This is the Clients Hash Table entry struct. | ||
97 | * Note that this is not a proper hash table; if a new client's IP address | ||
98 | * hash collides with an existing client entry, the old entry is replaced. | ||
99 | * | ||
100 | * There is a linked list (linked by the used_next and used_prev members) | ||
101 | * linking all the used entries of the hash table. This allows updating | ||
102 | * all the clients without walking over all the unused elements of the table. | ||
103 | * | ||
104 | * There are also linked lists of entries with identical hash(ip_src). These | ||
105 | * allow cleaning up the table from ip_src<->mac_src associations that have | ||
106 | * become outdated and would cause sending out invalid ARP updates to the | ||
107 | * network. These are linked by the (src_next and src_prev members). | ||
108 | * ------------------------------------------------------------------------- | ||
109 | */ | ||
110 | struct rlb_client_info { | ||
111 | __be32 ip_src; /* the server IP address */ | ||
112 | __be32 ip_dst; /* the client IP address */ | ||
113 | u8 mac_src[ETH_ALEN]; /* the server MAC address */ | ||
114 | u8 mac_dst[ETH_ALEN]; /* the client MAC address */ | ||
115 | |||
116 | /* list of used hash table entries, starting at rx_hashtbl_used_head */ | ||
117 | u32 used_next; | ||
118 | u32 used_prev; | ||
119 | |||
120 | /* ip_src based hashing */ | ||
121 | u32 src_next; /* next entry with same hash(ip_src) */ | ||
122 | u32 src_prev; /* prev entry with same hash(ip_src) */ | ||
123 | u32 src_first; /* first entry with hash(ip_src) == this entry's index */ | ||
124 | |||
125 | u8 assigned; /* checking whether this entry is assigned */ | ||
126 | u8 ntt; /* flag - need to transmit client info */ | ||
127 | struct slave *slave; /* the slave assigned to this client */ | ||
128 | unsigned short vlan_id; /* VLAN tag associated with IP address */ | ||
129 | }; | ||
130 | |||
131 | struct tlb_slave_info { | ||
132 | u32 head; /* Index to the head of the bi-directional clients | ||
133 | * hash table entries list. The entries in the list | ||
134 | * are the entries that were assigned to use this | ||
135 | * slave for transmit. | ||
136 | */ | ||
137 | u32 load; /* Each slave sums the loadHistory of all clients | ||
138 | * assigned to it | ||
139 | */ | ||
140 | }; | ||
141 | |||
142 | struct alb_bond_info { | ||
143 | struct tlb_client_info *tx_hashtbl; /* Dynamically allocated */ | ||
144 | u32 unbalanced_load; | ||
145 | int tx_rebalance_counter; | ||
146 | int lp_counter; | ||
147 | /* -------- rlb parameters -------- */ | ||
148 | int rlb_enabled; | ||
149 | struct rlb_client_info *rx_hashtbl; /* Receive hash table */ | ||
150 | u32 rx_hashtbl_used_head; | ||
151 | u8 rx_ntt; /* flag - need to transmit | ||
152 | * to all rx clients | ||
153 | */ | ||
154 | struct slave *rx_slave;/* last slave to xmit from */ | ||
155 | u8 primary_is_promisc; /* boolean */ | ||
156 | u32 rlb_promisc_timeout_counter;/* counts primary | ||
157 | * promiscuity time | ||
158 | */ | ||
159 | u32 rlb_update_delay_counter; | ||
160 | u32 rlb_update_retry_counter;/* counter of retries | ||
161 | * of client update | ||
162 | */ | ||
163 | u8 rlb_rebalance; /* flag - indicates that the | ||
164 | * rx traffic should be | ||
165 | * rebalanced | ||
166 | */ | ||
167 | }; | ||
168 | |||
169 | int bond_alb_initialize(struct bonding *bond, int rlb_enabled); | ||
170 | void bond_alb_deinitialize(struct bonding *bond); | ||
171 | int bond_alb_init_slave(struct bonding *bond, struct slave *slave); | ||
172 | void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave); | ||
173 | void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link); | ||
174 | void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave); | ||
175 | int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev); | ||
176 | int bond_tlb_xmit(struct sk_buff *skb, struct net_device *bond_dev); | ||
177 | void bond_alb_monitor(struct work_struct *); | ||
178 | int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr); | ||
179 | void bond_alb_clear_vlan(struct bonding *bond, unsigned short vlan_id); | ||
180 | #endif /* _NET_BOND_ALB_H */ | ||
181 | |||
diff --git a/include/net/bond_options.h b/include/net/bond_options.h new file mode 100644 index 000000000000..ea6546d2c946 --- /dev/null +++ b/include/net/bond_options.h | |||
@@ -0,0 +1,130 @@ | |||
1 | /* | ||
2 | * drivers/net/bond/bond_options.h - bonding options | ||
3 | * Copyright (c) 2013 Nikolay Aleksandrov <nikolay@redhat.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifndef _NET_BOND_OPTIONS_H | ||
12 | #define _NET_BOND_OPTIONS_H | ||
13 | |||
14 | #define BOND_OPT_MAX_NAMELEN 32 | ||
15 | #define BOND_OPT_VALID(opt) ((opt) < BOND_OPT_LAST) | ||
16 | #define BOND_MODE_ALL_EX(x) (~(x)) | ||
17 | |||
18 | /* Option flags: | ||
19 | * BOND_OPTFLAG_NOSLAVES - check if the bond device is empty before setting | ||
20 | * BOND_OPTFLAG_IFDOWN - check if the bond device is down before setting | ||
21 | * BOND_OPTFLAG_RAWVAL - the option parses the value itself | ||
22 | */ | ||
23 | enum { | ||
24 | BOND_OPTFLAG_NOSLAVES = BIT(0), | ||
25 | BOND_OPTFLAG_IFDOWN = BIT(1), | ||
26 | BOND_OPTFLAG_RAWVAL = BIT(2) | ||
27 | }; | ||
28 | |||
29 | /* Value type flags: | ||
30 | * BOND_VALFLAG_DEFAULT - mark the value as default | ||
31 | * BOND_VALFLAG_(MIN|MAX) - mark the value as min/max | ||
32 | */ | ||
33 | enum { | ||
34 | BOND_VALFLAG_DEFAULT = BIT(0), | ||
35 | BOND_VALFLAG_MIN = BIT(1), | ||
36 | BOND_VALFLAG_MAX = BIT(2) | ||
37 | }; | ||
38 | |||
39 | /* Option IDs, their bit positions correspond to their IDs */ | ||
40 | enum { | ||
41 | BOND_OPT_MODE, | ||
42 | BOND_OPT_PACKETS_PER_SLAVE, | ||
43 | BOND_OPT_XMIT_HASH, | ||
44 | BOND_OPT_ARP_VALIDATE, | ||
45 | BOND_OPT_ARP_ALL_TARGETS, | ||
46 | BOND_OPT_FAIL_OVER_MAC, | ||
47 | BOND_OPT_ARP_INTERVAL, | ||
48 | BOND_OPT_ARP_TARGETS, | ||
49 | BOND_OPT_DOWNDELAY, | ||
50 | BOND_OPT_UPDELAY, | ||
51 | BOND_OPT_LACP_RATE, | ||
52 | BOND_OPT_MINLINKS, | ||
53 | BOND_OPT_AD_SELECT, | ||
54 | BOND_OPT_NUM_PEER_NOTIF, | ||
55 | BOND_OPT_MIIMON, | ||
56 | BOND_OPT_PRIMARY, | ||
57 | BOND_OPT_PRIMARY_RESELECT, | ||
58 | BOND_OPT_USE_CARRIER, | ||
59 | BOND_OPT_ACTIVE_SLAVE, | ||
60 | BOND_OPT_QUEUE_ID, | ||
61 | BOND_OPT_ALL_SLAVES_ACTIVE, | ||
62 | BOND_OPT_RESEND_IGMP, | ||
63 | BOND_OPT_LP_INTERVAL, | ||
64 | BOND_OPT_SLAVES, | ||
65 | BOND_OPT_TLB_DYNAMIC_LB, | ||
66 | BOND_OPT_LAST | ||
67 | }; | ||
68 | |||
69 | /* This structure is used for storing option values and for passing option | ||
70 | * values when changing an option. The logic when used as an arg is as follows: | ||
71 | * - if string != NULL -> parse it, if the opt is RAW type then return it, else | ||
72 | * return the parse result | ||
73 | * - if string == NULL -> parse value | ||
74 | */ | ||
75 | struct bond_opt_value { | ||
76 | char *string; | ||
77 | u64 value; | ||
78 | u32 flags; | ||
79 | }; | ||
80 | |||
81 | struct bonding; | ||
82 | |||
83 | struct bond_option { | ||
84 | int id; | ||
85 | const char *name; | ||
86 | const char *desc; | ||
87 | u32 flags; | ||
88 | |||
89 | /* unsuppmodes is used to denote modes in which the option isn't | ||
90 | * supported. | ||
91 | */ | ||
92 | unsigned long unsuppmodes; | ||
93 | /* supported values which this option can have, can be a subset of | ||
94 | * BOND_OPTVAL_RANGE's value range | ||
95 | */ | ||
96 | const struct bond_opt_value *values; | ||
97 | |||
98 | int (*set)(struct bonding *bond, const struct bond_opt_value *val); | ||
99 | }; | ||
100 | |||
101 | int __bond_opt_set(struct bonding *bond, unsigned int option, | ||
102 | struct bond_opt_value *val); | ||
103 | int bond_opt_tryset_rtnl(struct bonding *bond, unsigned int option, char *buf); | ||
104 | |||
105 | const struct bond_opt_value *bond_opt_parse(const struct bond_option *opt, | ||
106 | struct bond_opt_value *val); | ||
107 | const struct bond_option *bond_opt_get(unsigned int option); | ||
108 | const struct bond_option *bond_opt_get_by_name(const char *name); | ||
109 | const struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val); | ||
110 | |||
111 | /* This helper is used to initialize a bond_opt_value structure for parameter | ||
112 | * passing. There should be either a valid string or value, but not both. | ||
113 | * When value is ULLONG_MAX then string will be used. | ||
114 | */ | ||
115 | static inline void __bond_opt_init(struct bond_opt_value *optval, | ||
116 | char *string, u64 value) | ||
117 | { | ||
118 | memset(optval, 0, sizeof(*optval)); | ||
119 | optval->value = ULLONG_MAX; | ||
120 | if (value == ULLONG_MAX) | ||
121 | optval->string = string; | ||
122 | else | ||
123 | optval->value = value; | ||
124 | } | ||
125 | #define bond_opt_initval(optval, value) __bond_opt_init(optval, NULL, value) | ||
126 | #define bond_opt_initstr(optval, str) __bond_opt_init(optval, str, ULLONG_MAX) | ||
127 | |||
128 | void bond_option_arp_ip_targets_clear(struct bonding *bond); | ||
129 | |||
130 | #endif /* _NET_BOND_OPTIONS_H */ | ||
diff --git a/include/net/bonding.h b/include/net/bonding.h new file mode 100644 index 000000000000..983a94b86b95 --- /dev/null +++ b/include/net/bonding.h | |||
@@ -0,0 +1,654 @@ | |||
1 | /* | ||
2 | * Bond several ethernet interfaces into a Cisco, running 'Etherchannel'. | ||
3 | * | ||
4 | * Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes | ||
5 | * NCM: Network and Communications Management, Inc. | ||
6 | * | ||
7 | * BUT, I'm the one who modified it for ethernet, so: | ||
8 | * (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov | ||
9 | * | ||
10 | * This software may be used and distributed according to the terms | ||
11 | * of the GNU Public License, incorporated herein by reference. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef _NET_BONDING_H | ||
16 | #define _NET_BONDING_H | ||
17 | |||
18 | #include <linux/timer.h> | ||
19 | #include <linux/proc_fs.h> | ||
20 | #include <linux/if_bonding.h> | ||
21 | #include <linux/cpumask.h> | ||
22 | #include <linux/in6.h> | ||
23 | #include <linux/netpoll.h> | ||
24 | #include <linux/inetdevice.h> | ||
25 | #include <linux/etherdevice.h> | ||
26 | #include <linux/reciprocal_div.h> | ||
27 | #include <linux/if_link.h> | ||
28 | |||
29 | #include <net/bond_3ad.h> | ||
30 | #include <net/bond_alb.h> | ||
31 | #include <net/bond_options.h> | ||
32 | |||
33 | #define DRV_VERSION "3.7.1" | ||
34 | #define DRV_RELDATE "April 27, 2011" | ||
35 | #define DRV_NAME "bonding" | ||
36 | #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" | ||
37 | |||
38 | #define bond_version DRV_DESCRIPTION ": v" DRV_VERSION " (" DRV_RELDATE ")\n" | ||
39 | |||
40 | #define BOND_MAX_ARP_TARGETS 16 | ||
41 | |||
42 | #define BOND_DEFAULT_MIIMON 100 | ||
43 | |||
44 | /* | ||
45 | * Less bad way to call ioctl from within the kernel; this needs to be | ||
46 | * done some other way to get the call out of interrupt context. | ||
47 | * Needs "ioctl" variable to be supplied by calling context. | ||
48 | */ | ||
49 | #define IOCTL(dev, arg, cmd) ({ \ | ||
50 | int res = 0; \ | ||
51 | mm_segment_t fs = get_fs(); \ | ||
52 | set_fs(get_ds()); \ | ||
53 | res = ioctl(dev, arg, cmd); \ | ||
54 | set_fs(fs); \ | ||
55 | res; }) | ||
56 | |||
57 | #define BOND_MODE(bond) ((bond)->params.mode) | ||
58 | |||
59 | /* slave list primitives */ | ||
60 | #define bond_slave_list(bond) (&(bond)->dev->adj_list.lower) | ||
61 | |||
62 | #define bond_has_slaves(bond) !list_empty(bond_slave_list(bond)) | ||
63 | |||
64 | /* IMPORTANT: bond_first/last_slave can return NULL in case of an empty list */ | ||
65 | #define bond_first_slave(bond) \ | ||
66 | (bond_has_slaves(bond) ? \ | ||
67 | netdev_adjacent_get_private(bond_slave_list(bond)->next) : \ | ||
68 | NULL) | ||
69 | #define bond_last_slave(bond) \ | ||
70 | (bond_has_slaves(bond) ? \ | ||
71 | netdev_adjacent_get_private(bond_slave_list(bond)->prev) : \ | ||
72 | NULL) | ||
73 | |||
74 | /* Caller must have rcu_read_lock */ | ||
75 | #define bond_first_slave_rcu(bond) \ | ||
76 | netdev_lower_get_first_private_rcu(bond->dev) | ||
77 | |||
78 | #define bond_is_first_slave(bond, pos) (pos == bond_first_slave(bond)) | ||
79 | #define bond_is_last_slave(bond, pos) (pos == bond_last_slave(bond)) | ||
80 | |||
81 | /** | ||
82 | * bond_for_each_slave - iterate over all slaves | ||
83 | * @bond: the bond holding this list | ||
84 | * @pos: current slave | ||
85 | * @iter: list_head * iterator | ||
86 | * | ||
87 | * Caller must hold RTNL | ||
88 | */ | ||
89 | #define bond_for_each_slave(bond, pos, iter) \ | ||
90 | netdev_for_each_lower_private((bond)->dev, pos, iter) | ||
91 | |||
92 | /* Caller must have rcu_read_lock */ | ||
93 | #define bond_for_each_slave_rcu(bond, pos, iter) \ | ||
94 | netdev_for_each_lower_private_rcu((bond)->dev, pos, iter) | ||
95 | |||
96 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
97 | extern atomic_t netpoll_block_tx; | ||
98 | |||
99 | static inline void block_netpoll_tx(void) | ||
100 | { | ||
101 | atomic_inc(&netpoll_block_tx); | ||
102 | } | ||
103 | |||
104 | static inline void unblock_netpoll_tx(void) | ||
105 | { | ||
106 | atomic_dec(&netpoll_block_tx); | ||
107 | } | ||
108 | |||
109 | static inline int is_netpoll_tx_blocked(struct net_device *dev) | ||
110 | { | ||
111 | if (unlikely(netpoll_tx_running(dev))) | ||
112 | return atomic_read(&netpoll_block_tx); | ||
113 | return 0; | ||
114 | } | ||
115 | #else | ||
116 | #define block_netpoll_tx() | ||
117 | #define unblock_netpoll_tx() | ||
118 | #define is_netpoll_tx_blocked(dev) (0) | ||
119 | #endif | ||
120 | |||
121 | struct bond_params { | ||
122 | int mode; | ||
123 | int xmit_policy; | ||
124 | int miimon; | ||
125 | u8 num_peer_notif; | ||
126 | int arp_interval; | ||
127 | int arp_validate; | ||
128 | int arp_all_targets; | ||
129 | int use_carrier; | ||
130 | int fail_over_mac; | ||
131 | int updelay; | ||
132 | int downdelay; | ||
133 | int lacp_fast; | ||
134 | unsigned int min_links; | ||
135 | int ad_select; | ||
136 | char primary[IFNAMSIZ]; | ||
137 | int primary_reselect; | ||
138 | __be32 arp_targets[BOND_MAX_ARP_TARGETS]; | ||
139 | int tx_queues; | ||
140 | int all_slaves_active; | ||
141 | int resend_igmp; | ||
142 | int lp_interval; | ||
143 | int packets_per_slave; | ||
144 | int tlb_dynamic_lb; | ||
145 | struct reciprocal_value reciprocal_packets_per_slave; | ||
146 | }; | ||
147 | |||
148 | struct bond_parm_tbl { | ||
149 | char *modename; | ||
150 | int mode; | ||
151 | }; | ||
152 | |||
153 | struct slave { | ||
154 | struct net_device *dev; /* first - useful for panic debug */ | ||
155 | struct bonding *bond; /* our master */ | ||
156 | int delay; | ||
157 | /* all three in jiffies */ | ||
158 | unsigned long last_link_up; | ||
159 | unsigned long last_rx; | ||
160 | unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS]; | ||
161 | s8 link; /* one of BOND_LINK_XXXX */ | ||
162 | s8 new_link; | ||
163 | u8 backup:1, /* indicates backup slave. Value corresponds with | ||
164 | BOND_STATE_ACTIVE and BOND_STATE_BACKUP */ | ||
165 | inactive:1, /* indicates inactive slave */ | ||
166 | should_notify:1; /* indicateds whether the state changed */ | ||
167 | u8 duplex; | ||
168 | u32 original_mtu; | ||
169 | u32 link_failure_count; | ||
170 | u32 speed; | ||
171 | u16 queue_id; | ||
172 | u8 perm_hwaddr[ETH_ALEN]; | ||
173 | struct ad_slave_info *ad_info; | ||
174 | struct tlb_slave_info tlb_info; | ||
175 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
176 | struct netpoll *np; | ||
177 | #endif | ||
178 | struct kobject kobj; | ||
179 | struct rtnl_link_stats64 slave_stats; | ||
180 | }; | ||
181 | |||
182 | struct bond_up_slave { | ||
183 | unsigned int count; | ||
184 | struct rcu_head rcu; | ||
185 | struct slave *arr[0]; | ||
186 | }; | ||
187 | |||
188 | /* | ||
189 | * Link pseudo-state only used internally by monitors | ||
190 | */ | ||
191 | #define BOND_LINK_NOCHANGE -1 | ||
192 | |||
193 | /* | ||
194 | * Here are the locking policies for the two bonding locks: | ||
195 | * Get rcu_read_lock when reading or RTNL when writing slave list. | ||
196 | */ | ||
197 | struct bonding { | ||
198 | struct net_device *dev; /* first - useful for panic debug */ | ||
199 | struct slave __rcu *curr_active_slave; | ||
200 | struct slave __rcu *current_arp_slave; | ||
201 | struct slave __rcu *primary_slave; | ||
202 | struct bond_up_slave __rcu *slave_arr; /* Array of usable slaves */ | ||
203 | bool force_primary; | ||
204 | s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ | ||
205 | int (*recv_probe)(const struct sk_buff *, struct bonding *, | ||
206 | struct slave *); | ||
207 | /* mode_lock is used for mode-specific locking needs, currently used by: | ||
208 | * 3ad mode (4) - protect against running bond_3ad_unbind_slave() and | ||
209 | * bond_3ad_state_machine_handler() concurrently and also | ||
210 | * the access to the state machine shared variables. | ||
211 | * TLB mode (5) - to sync the use and modifications of its hash table | ||
212 | * ALB mode (6) - to sync the use and modifications of its hash table | ||
213 | */ | ||
214 | spinlock_t mode_lock; | ||
215 | u8 send_peer_notif; | ||
216 | u8 igmp_retrans; | ||
217 | #ifdef CONFIG_PROC_FS | ||
218 | struct proc_dir_entry *proc_entry; | ||
219 | char proc_file_name[IFNAMSIZ]; | ||
220 | #endif /* CONFIG_PROC_FS */ | ||
221 | struct list_head bond_list; | ||
222 | u32 rr_tx_counter; | ||
223 | struct ad_bond_info ad_info; | ||
224 | struct alb_bond_info alb_info; | ||
225 | struct bond_params params; | ||
226 | struct workqueue_struct *wq; | ||
227 | struct delayed_work mii_work; | ||
228 | struct delayed_work arp_work; | ||
229 | struct delayed_work alb_work; | ||
230 | struct delayed_work ad_work; | ||
231 | struct delayed_work mcast_work; | ||
232 | struct delayed_work slave_arr_work; | ||
233 | #ifdef CONFIG_DEBUG_FS | ||
234 | /* debugging support via debugfs */ | ||
235 | struct dentry *debug_dir; | ||
236 | #endif /* CONFIG_DEBUG_FS */ | ||
237 | struct rtnl_link_stats64 bond_stats; | ||
238 | }; | ||
239 | |||
240 | #define bond_slave_get_rcu(dev) \ | ||
241 | ((struct slave *) rcu_dereference(dev->rx_handler_data)) | ||
242 | |||
243 | #define bond_slave_get_rtnl(dev) \ | ||
244 | ((struct slave *) rtnl_dereference(dev->rx_handler_data)) | ||
245 | |||
246 | struct bond_vlan_tag { | ||
247 | __be16 vlan_proto; | ||
248 | unsigned short vlan_id; | ||
249 | }; | ||
250 | |||
251 | /** | ||
252 | * Returns NULL if the net_device does not belong to any of the bond's slaves | ||
253 | * | ||
254 | * Caller must hold bond lock for read | ||
255 | */ | ||
256 | static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, | ||
257 | struct net_device *slave_dev) | ||
258 | { | ||
259 | return netdev_lower_dev_get_private(bond->dev, slave_dev); | ||
260 | } | ||
261 | |||
262 | static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) | ||
263 | { | ||
264 | return slave->bond; | ||
265 | } | ||
266 | |||
267 | static inline bool bond_should_override_tx_queue(struct bonding *bond) | ||
268 | { | ||
269 | return BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP || | ||
270 | BOND_MODE(bond) == BOND_MODE_ROUNDROBIN; | ||
271 | } | ||
272 | |||
273 | static inline bool bond_is_lb(const struct bonding *bond) | ||
274 | { | ||
275 | return BOND_MODE(bond) == BOND_MODE_TLB || | ||
276 | BOND_MODE(bond) == BOND_MODE_ALB; | ||
277 | } | ||
278 | |||
279 | static inline bool bond_is_nondyn_tlb(const struct bonding *bond) | ||
280 | { | ||
281 | return (BOND_MODE(bond) == BOND_MODE_TLB) && | ||
282 | (bond->params.tlb_dynamic_lb == 0); | ||
283 | } | ||
284 | |||
285 | static inline bool bond_mode_uses_xmit_hash(const struct bonding *bond) | ||
286 | { | ||
287 | return (BOND_MODE(bond) == BOND_MODE_8023AD || | ||
288 | BOND_MODE(bond) == BOND_MODE_XOR || | ||
289 | bond_is_nondyn_tlb(bond)); | ||
290 | } | ||
291 | |||
292 | static inline bool bond_mode_uses_arp(int mode) | ||
293 | { | ||
294 | return mode != BOND_MODE_8023AD && mode != BOND_MODE_TLB && | ||
295 | mode != BOND_MODE_ALB; | ||
296 | } | ||
297 | |||
298 | static inline bool bond_mode_uses_primary(int mode) | ||
299 | { | ||
300 | return mode == BOND_MODE_ACTIVEBACKUP || mode == BOND_MODE_TLB || | ||
301 | mode == BOND_MODE_ALB; | ||
302 | } | ||
303 | |||
304 | static inline bool bond_uses_primary(struct bonding *bond) | ||
305 | { | ||
306 | return bond_mode_uses_primary(BOND_MODE(bond)); | ||
307 | } | ||
308 | |||
309 | static inline bool bond_slave_is_up(struct slave *slave) | ||
310 | { | ||
311 | return netif_running(slave->dev) && netif_carrier_ok(slave->dev); | ||
312 | } | ||
313 | |||
314 | static inline void bond_set_active_slave(struct slave *slave) | ||
315 | { | ||
316 | if (slave->backup) { | ||
317 | slave->backup = 0; | ||
318 | rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC); | ||
319 | } | ||
320 | } | ||
321 | |||
322 | static inline void bond_set_backup_slave(struct slave *slave) | ||
323 | { | ||
324 | if (!slave->backup) { | ||
325 | slave->backup = 1; | ||
326 | rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC); | ||
327 | } | ||
328 | } | ||
329 | |||
330 | static inline void bond_set_slave_state(struct slave *slave, | ||
331 | int slave_state, bool notify) | ||
332 | { | ||
333 | if (slave->backup == slave_state) | ||
334 | return; | ||
335 | |||
336 | slave->backup = slave_state; | ||
337 | if (notify) { | ||
338 | rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC); | ||
339 | slave->should_notify = 0; | ||
340 | } else { | ||
341 | if (slave->should_notify) | ||
342 | slave->should_notify = 0; | ||
343 | else | ||
344 | slave->should_notify = 1; | ||
345 | } | ||
346 | } | ||
347 | |||
348 | static inline void bond_slave_state_change(struct bonding *bond) | ||
349 | { | ||
350 | struct list_head *iter; | ||
351 | struct slave *tmp; | ||
352 | |||
353 | bond_for_each_slave(bond, tmp, iter) { | ||
354 | if (tmp->link == BOND_LINK_UP) | ||
355 | bond_set_active_slave(tmp); | ||
356 | else if (tmp->link == BOND_LINK_DOWN) | ||
357 | bond_set_backup_slave(tmp); | ||
358 | } | ||
359 | } | ||
360 | |||
361 | static inline void bond_slave_state_notify(struct bonding *bond) | ||
362 | { | ||
363 | struct list_head *iter; | ||
364 | struct slave *tmp; | ||
365 | |||
366 | bond_for_each_slave(bond, tmp, iter) { | ||
367 | if (tmp->should_notify) { | ||
368 | rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_ATOMIC); | ||
369 | tmp->should_notify = 0; | ||
370 | } | ||
371 | } | ||
372 | } | ||
373 | |||
374 | static inline int bond_slave_state(struct slave *slave) | ||
375 | { | ||
376 | return slave->backup; | ||
377 | } | ||
378 | |||
379 | static inline bool bond_is_active_slave(struct slave *slave) | ||
380 | { | ||
381 | return !bond_slave_state(slave); | ||
382 | } | ||
383 | |||
384 | static inline bool bond_slave_can_tx(struct slave *slave) | ||
385 | { | ||
386 | return bond_slave_is_up(slave) && slave->link == BOND_LINK_UP && | ||
387 | bond_is_active_slave(slave); | ||
388 | } | ||
389 | |||
390 | #define BOND_PRI_RESELECT_ALWAYS 0 | ||
391 | #define BOND_PRI_RESELECT_BETTER 1 | ||
392 | #define BOND_PRI_RESELECT_FAILURE 2 | ||
393 | |||
394 | #define BOND_FOM_NONE 0 | ||
395 | #define BOND_FOM_ACTIVE 1 | ||
396 | #define BOND_FOM_FOLLOW 2 | ||
397 | |||
398 | #define BOND_ARP_TARGETS_ANY 0 | ||
399 | #define BOND_ARP_TARGETS_ALL 1 | ||
400 | |||
401 | #define BOND_ARP_VALIDATE_NONE 0 | ||
402 | #define BOND_ARP_VALIDATE_ACTIVE (1 << BOND_STATE_ACTIVE) | ||
403 | #define BOND_ARP_VALIDATE_BACKUP (1 << BOND_STATE_BACKUP) | ||
404 | #define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \ | ||
405 | BOND_ARP_VALIDATE_BACKUP) | ||
406 | #define BOND_ARP_FILTER (BOND_ARP_VALIDATE_ALL + 1) | ||
407 | #define BOND_ARP_FILTER_ACTIVE (BOND_ARP_VALIDATE_ACTIVE | \ | ||
408 | BOND_ARP_FILTER) | ||
409 | #define BOND_ARP_FILTER_BACKUP (BOND_ARP_VALIDATE_BACKUP | \ | ||
410 | BOND_ARP_FILTER) | ||
411 | |||
412 | #define BOND_SLAVE_NOTIFY_NOW true | ||
413 | #define BOND_SLAVE_NOTIFY_LATER false | ||
414 | |||
415 | static inline int slave_do_arp_validate(struct bonding *bond, | ||
416 | struct slave *slave) | ||
417 | { | ||
418 | return bond->params.arp_validate & (1 << bond_slave_state(slave)); | ||
419 | } | ||
420 | |||
421 | static inline int slave_do_arp_validate_only(struct bonding *bond) | ||
422 | { | ||
423 | return bond->params.arp_validate & BOND_ARP_FILTER; | ||
424 | } | ||
425 | |||
426 | static inline int bond_is_ip_target_ok(__be32 addr) | ||
427 | { | ||
428 | return !ipv4_is_lbcast(addr) && !ipv4_is_zeronet(addr); | ||
429 | } | ||
430 | |||
431 | /* Get the oldest arp which we've received on this slave for bond's | ||
432 | * arp_targets. | ||
433 | */ | ||
434 | static inline unsigned long slave_oldest_target_arp_rx(struct bonding *bond, | ||
435 | struct slave *slave) | ||
436 | { | ||
437 | int i = 1; | ||
438 | unsigned long ret = slave->target_last_arp_rx[0]; | ||
439 | |||
440 | for (; (i < BOND_MAX_ARP_TARGETS) && bond->params.arp_targets[i]; i++) | ||
441 | if (time_before(slave->target_last_arp_rx[i], ret)) | ||
442 | ret = slave->target_last_arp_rx[i]; | ||
443 | |||
444 | return ret; | ||
445 | } | ||
446 | |||
447 | static inline unsigned long slave_last_rx(struct bonding *bond, | ||
448 | struct slave *slave) | ||
449 | { | ||
450 | if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL) | ||
451 | return slave_oldest_target_arp_rx(bond, slave); | ||
452 | |||
453 | return slave->last_rx; | ||
454 | } | ||
455 | |||
456 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
457 | static inline void bond_netpoll_send_skb(const struct slave *slave, | ||
458 | struct sk_buff *skb) | ||
459 | { | ||
460 | struct netpoll *np = slave->np; | ||
461 | |||
462 | if (np) | ||
463 | netpoll_send_skb(np, skb); | ||
464 | } | ||
465 | #else | ||
466 | static inline void bond_netpoll_send_skb(const struct slave *slave, | ||
467 | struct sk_buff *skb) | ||
468 | { | ||
469 | } | ||
470 | #endif | ||
471 | |||
472 | static inline void bond_set_slave_inactive_flags(struct slave *slave, | ||
473 | bool notify) | ||
474 | { | ||
475 | if (!bond_is_lb(slave->bond)) | ||
476 | bond_set_slave_state(slave, BOND_STATE_BACKUP, notify); | ||
477 | if (!slave->bond->params.all_slaves_active) | ||
478 | slave->inactive = 1; | ||
479 | } | ||
480 | |||
481 | static inline void bond_set_slave_active_flags(struct slave *slave, | ||
482 | bool notify) | ||
483 | { | ||
484 | bond_set_slave_state(slave, BOND_STATE_ACTIVE, notify); | ||
485 | slave->inactive = 0; | ||
486 | } | ||
487 | |||
488 | static inline bool bond_is_slave_inactive(struct slave *slave) | ||
489 | { | ||
490 | return slave->inactive; | ||
491 | } | ||
492 | |||
493 | static inline __be32 bond_confirm_addr(struct net_device *dev, __be32 dst, __be32 local) | ||
494 | { | ||
495 | struct in_device *in_dev; | ||
496 | __be32 addr = 0; | ||
497 | |||
498 | rcu_read_lock(); | ||
499 | in_dev = __in_dev_get_rcu(dev); | ||
500 | |||
501 | if (in_dev) | ||
502 | addr = inet_confirm_addr(dev_net(dev), in_dev, dst, local, | ||
503 | RT_SCOPE_HOST); | ||
504 | rcu_read_unlock(); | ||
505 | return addr; | ||
506 | } | ||
507 | |||
508 | struct bond_net { | ||
509 | struct net *net; /* Associated network namespace */ | ||
510 | struct list_head dev_list; | ||
511 | #ifdef CONFIG_PROC_FS | ||
512 | struct proc_dir_entry *proc_dir; | ||
513 | #endif | ||
514 | struct class_attribute class_attr_bonding_masters; | ||
515 | }; | ||
516 | |||
517 | int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave); | ||
518 | void bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); | ||
519 | int bond_create(struct net *net, const char *name); | ||
520 | int bond_create_sysfs(struct bond_net *net); | ||
521 | void bond_destroy_sysfs(struct bond_net *net); | ||
522 | void bond_prepare_sysfs_group(struct bonding *bond); | ||
523 | int bond_sysfs_slave_add(struct slave *slave); | ||
524 | void bond_sysfs_slave_del(struct slave *slave); | ||
525 | int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev); | ||
526 | int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); | ||
527 | u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb); | ||
528 | void bond_select_active_slave(struct bonding *bond); | ||
529 | void bond_change_active_slave(struct bonding *bond, struct slave *new_active); | ||
530 | void bond_create_debugfs(void); | ||
531 | void bond_destroy_debugfs(void); | ||
532 | void bond_debug_register(struct bonding *bond); | ||
533 | void bond_debug_unregister(struct bonding *bond); | ||
534 | void bond_debug_reregister(struct bonding *bond); | ||
535 | const char *bond_mode_name(int mode); | ||
536 | void bond_setup(struct net_device *bond_dev); | ||
537 | unsigned int bond_get_num_tx_queues(void); | ||
538 | int bond_netlink_init(void); | ||
539 | void bond_netlink_fini(void); | ||
540 | struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond); | ||
541 | const char *bond_slave_link_status(s8 link); | ||
542 | struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev, | ||
543 | struct net_device *end_dev, | ||
544 | int level); | ||
545 | int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave); | ||
546 | void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay); | ||
547 | |||
548 | #ifdef CONFIG_PROC_FS | ||
549 | void bond_create_proc_entry(struct bonding *bond); | ||
550 | void bond_remove_proc_entry(struct bonding *bond); | ||
551 | void bond_create_proc_dir(struct bond_net *bn); | ||
552 | void bond_destroy_proc_dir(struct bond_net *bn); | ||
553 | #else | ||
554 | static inline void bond_create_proc_entry(struct bonding *bond) | ||
555 | { | ||
556 | } | ||
557 | |||
558 | static inline void bond_remove_proc_entry(struct bonding *bond) | ||
559 | { | ||
560 | } | ||
561 | |||
562 | static inline void bond_create_proc_dir(struct bond_net *bn) | ||
563 | { | ||
564 | } | ||
565 | |||
566 | static inline void bond_destroy_proc_dir(struct bond_net *bn) | ||
567 | { | ||
568 | } | ||
569 | #endif | ||
570 | |||
571 | static inline struct slave *bond_slave_has_mac(struct bonding *bond, | ||
572 | const u8 *mac) | ||
573 | { | ||
574 | struct list_head *iter; | ||
575 | struct slave *tmp; | ||
576 | |||
577 | bond_for_each_slave(bond, tmp, iter) | ||
578 | if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr)) | ||
579 | return tmp; | ||
580 | |||
581 | return NULL; | ||
582 | } | ||
583 | |||
584 | /* Caller must hold rcu_read_lock() for read */ | ||
585 | static inline struct slave *bond_slave_has_mac_rcu(struct bonding *bond, | ||
586 | const u8 *mac) | ||
587 | { | ||
588 | struct list_head *iter; | ||
589 | struct slave *tmp; | ||
590 | |||
591 | bond_for_each_slave_rcu(bond, tmp, iter) | ||
592 | if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr)) | ||
593 | return tmp; | ||
594 | |||
595 | return NULL; | ||
596 | } | ||
597 | |||
598 | /* Caller must hold rcu_read_lock() for read */ | ||
599 | static inline bool bond_slave_has_mac_rx(struct bonding *bond, const u8 *mac) | ||
600 | { | ||
601 | struct list_head *iter; | ||
602 | struct slave *tmp; | ||
603 | struct netdev_hw_addr *ha; | ||
604 | |||
605 | bond_for_each_slave_rcu(bond, tmp, iter) | ||
606 | if (ether_addr_equal_64bits(mac, tmp->dev->dev_addr)) | ||
607 | return true; | ||
608 | |||
609 | if (netdev_uc_empty(bond->dev)) | ||
610 | return false; | ||
611 | |||
612 | netdev_for_each_uc_addr(ha, bond->dev) | ||
613 | if (ether_addr_equal_64bits(mac, ha->addr)) | ||
614 | return true; | ||
615 | |||
616 | return false; | ||
617 | } | ||
618 | |||
619 | /* Check if the ip is present in arp ip list, or first free slot if ip == 0 | ||
620 | * Returns -1 if not found, index if found | ||
621 | */ | ||
622 | static inline int bond_get_targets_ip(__be32 *targets, __be32 ip) | ||
623 | { | ||
624 | int i; | ||
625 | |||
626 | for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) | ||
627 | if (targets[i] == ip) | ||
628 | return i; | ||
629 | else if (targets[i] == 0) | ||
630 | break; | ||
631 | |||
632 | return -1; | ||
633 | } | ||
634 | |||
635 | /* exported from bond_main.c */ | ||
636 | extern int bond_net_id; | ||
637 | extern const struct bond_parm_tbl bond_lacp_tbl[]; | ||
638 | extern const struct bond_parm_tbl xmit_hashtype_tbl[]; | ||
639 | extern const struct bond_parm_tbl arp_validate_tbl[]; | ||
640 | extern const struct bond_parm_tbl arp_all_targets_tbl[]; | ||
641 | extern const struct bond_parm_tbl fail_over_mac_tbl[]; | ||
642 | extern const struct bond_parm_tbl pri_reselect_tbl[]; | ||
643 | extern struct bond_parm_tbl ad_select_tbl[]; | ||
644 | |||
645 | /* exported from bond_netlink.c */ | ||
646 | extern struct rtnl_link_ops bond_link_ops; | ||
647 | |||
648 | static inline void bond_tx_drop(struct net_device *dev, struct sk_buff *skb) | ||
649 | { | ||
650 | atomic_long_inc(&dev->tx_dropped); | ||
651 | dev_kfree_skb_any(skb); | ||
652 | } | ||
653 | |||
654 | #endif /* _NET_BONDING_H */ | ||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index a2ddcf2398fd..4ebb816241fa 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -319,9 +319,12 @@ struct ieee80211_supported_band { | |||
319 | /** | 319 | /** |
320 | * struct vif_params - describes virtual interface parameters | 320 | * struct vif_params - describes virtual interface parameters |
321 | * @use_4addr: use 4-address frames | 321 | * @use_4addr: use 4-address frames |
322 | * @macaddr: address to use for this virtual interface. This will only | 322 | * @macaddr: address to use for this virtual interface. |
323 | * be used for non-netdevice interfaces. If this parameter is set | 323 | * If this parameter is set to zero address the driver may |
324 | * to zero address the driver may determine the address as needed. | 324 | * determine the address as needed. |
325 | * This feature is only fully supported by drivers that enable the | ||
326 | * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating | ||
327 | ** only p2p devices with specified MAC. | ||
325 | */ | 328 | */ |
326 | struct vif_params { | 329 | struct vif_params { |
327 | int use_4addr; | 330 | int use_4addr; |
@@ -799,6 +802,22 @@ struct station_parameters { | |||
799 | }; | 802 | }; |
800 | 803 | ||
801 | /** | 804 | /** |
805 | * struct station_del_parameters - station deletion parameters | ||
806 | * | ||
807 | * Used to delete a station entry (or all stations). | ||
808 | * | ||
809 | * @mac: MAC address of the station to remove or NULL to remove all stations | ||
810 | * @subtype: Management frame subtype to use for indicating removal | ||
811 | * (10 = Disassociation, 12 = Deauthentication) | ||
812 | * @reason_code: Reason code for the Disassociation/Deauthentication frame | ||
813 | */ | ||
814 | struct station_del_parameters { | ||
815 | const u8 *mac; | ||
816 | u8 subtype; | ||
817 | u16 reason_code; | ||
818 | }; | ||
819 | |||
820 | /** | ||
802 | * enum cfg80211_station_type - the type of station being modified | 821 | * enum cfg80211_station_type - the type of station being modified |
803 | * @CFG80211_STA_AP_CLIENT: client of an AP interface | 822 | * @CFG80211_STA_AP_CLIENT: client of an AP interface |
804 | * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has | 823 | * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has |
@@ -1340,6 +1359,16 @@ struct mesh_setup { | |||
1340 | }; | 1359 | }; |
1341 | 1360 | ||
1342 | /** | 1361 | /** |
1362 | * struct ocb_setup - 802.11p OCB mode setup configuration | ||
1363 | * @chandef: defines the channel to use | ||
1364 | * | ||
1365 | * These parameters are fixed when connecting to the network | ||
1366 | */ | ||
1367 | struct ocb_setup { | ||
1368 | struct cfg80211_chan_def chandef; | ||
1369 | }; | ||
1370 | |||
1371 | /** | ||
1343 | * struct ieee80211_txq_params - TX queue parameters | 1372 | * struct ieee80211_txq_params - TX queue parameters |
1344 | * @ac: AC identifier | 1373 | * @ac: AC identifier |
1345 | * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled | 1374 | * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled |
@@ -1408,6 +1437,10 @@ struct cfg80211_ssid { | |||
1408 | * @aborted: (internal) scan request was notified as aborted | 1437 | * @aborted: (internal) scan request was notified as aborted |
1409 | * @notified: (internal) scan request was notified as done or aborted | 1438 | * @notified: (internal) scan request was notified as done or aborted |
1410 | * @no_cck: used to send probe requests at non CCK rate in 2GHz band | 1439 | * @no_cck: used to send probe requests at non CCK rate in 2GHz band |
1440 | * @mac_addr: MAC address used with randomisation | ||
1441 | * @mac_addr_mask: MAC address mask used with randomisation, bits that | ||
1442 | * are 0 in the mask should be randomised, bits that are 1 should | ||
1443 | * be taken from the @mac_addr | ||
1411 | */ | 1444 | */ |
1412 | struct cfg80211_scan_request { | 1445 | struct cfg80211_scan_request { |
1413 | struct cfg80211_ssid *ssids; | 1446 | struct cfg80211_ssid *ssids; |
@@ -1422,6 +1455,9 @@ struct cfg80211_scan_request { | |||
1422 | 1455 | ||
1423 | struct wireless_dev *wdev; | 1456 | struct wireless_dev *wdev; |
1424 | 1457 | ||
1458 | u8 mac_addr[ETH_ALEN] __aligned(2); | ||
1459 | u8 mac_addr_mask[ETH_ALEN] __aligned(2); | ||
1460 | |||
1425 | /* internal */ | 1461 | /* internal */ |
1426 | struct wiphy *wiphy; | 1462 | struct wiphy *wiphy; |
1427 | unsigned long scan_start; | 1463 | unsigned long scan_start; |
@@ -1432,6 +1468,17 @@ struct cfg80211_scan_request { | |||
1432 | struct ieee80211_channel *channels[0]; | 1468 | struct ieee80211_channel *channels[0]; |
1433 | }; | 1469 | }; |
1434 | 1470 | ||
1471 | static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask) | ||
1472 | { | ||
1473 | int i; | ||
1474 | |||
1475 | get_random_bytes(buf, ETH_ALEN); | ||
1476 | for (i = 0; i < ETH_ALEN; i++) { | ||
1477 | buf[i] &= ~mask[i]; | ||
1478 | buf[i] |= addr[i] & mask[i]; | ||
1479 | } | ||
1480 | } | ||
1481 | |||
1435 | /** | 1482 | /** |
1436 | * struct cfg80211_match_set - sets of attributes to match | 1483 | * struct cfg80211_match_set - sets of attributes to match |
1437 | * | 1484 | * |
@@ -1465,6 +1512,10 @@ struct cfg80211_match_set { | |||
1465 | * @channels: channels to scan | 1512 | * @channels: channels to scan |
1466 | * @min_rssi_thold: for drivers only supporting a single threshold, this | 1513 | * @min_rssi_thold: for drivers only supporting a single threshold, this |
1467 | * contains the minimum over all matchsets | 1514 | * contains the minimum over all matchsets |
1515 | * @mac_addr: MAC address used with randomisation | ||
1516 | * @mac_addr_mask: MAC address mask used with randomisation, bits that | ||
1517 | * are 0 in the mask should be randomised, bits that are 1 should | ||
1518 | * be taken from the @mac_addr | ||
1468 | */ | 1519 | */ |
1469 | struct cfg80211_sched_scan_request { | 1520 | struct cfg80211_sched_scan_request { |
1470 | struct cfg80211_ssid *ssids; | 1521 | struct cfg80211_ssid *ssids; |
@@ -1479,6 +1530,9 @@ struct cfg80211_sched_scan_request { | |||
1479 | int n_match_sets; | 1530 | int n_match_sets; |
1480 | s32 min_rssi_thold; | 1531 | s32 min_rssi_thold; |
1481 | 1532 | ||
1533 | u8 mac_addr[ETH_ALEN] __aligned(2); | ||
1534 | u8 mac_addr_mask[ETH_ALEN] __aligned(2); | ||
1535 | |||
1482 | /* internal */ | 1536 | /* internal */ |
1483 | struct wiphy *wiphy; | 1537 | struct wiphy *wiphy; |
1484 | struct net_device *dev; | 1538 | struct net_device *dev; |
@@ -1911,6 +1965,7 @@ struct cfg80211_wowlan_tcp { | |||
1911 | * @rfkill_release: wake up when rfkill is released | 1965 | * @rfkill_release: wake up when rfkill is released |
1912 | * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. | 1966 | * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h. |
1913 | * NULL if not configured. | 1967 | * NULL if not configured. |
1968 | * @nd_config: configuration for the scan to be used for net detect wake. | ||
1914 | */ | 1969 | */ |
1915 | struct cfg80211_wowlan { | 1970 | struct cfg80211_wowlan { |
1916 | bool any, disconnect, magic_pkt, gtk_rekey_failure, | 1971 | bool any, disconnect, magic_pkt, gtk_rekey_failure, |
@@ -1919,6 +1974,7 @@ struct cfg80211_wowlan { | |||
1919 | struct cfg80211_pkt_pattern *patterns; | 1974 | struct cfg80211_pkt_pattern *patterns; |
1920 | struct cfg80211_wowlan_tcp *tcp; | 1975 | struct cfg80211_wowlan_tcp *tcp; |
1921 | int n_patterns; | 1976 | int n_patterns; |
1977 | struct cfg80211_sched_scan_request *nd_config; | ||
1922 | }; | 1978 | }; |
1923 | 1979 | ||
1924 | /** | 1980 | /** |
@@ -1951,6 +2007,35 @@ struct cfg80211_coalesce { | |||
1951 | }; | 2007 | }; |
1952 | 2008 | ||
1953 | /** | 2009 | /** |
2010 | * struct cfg80211_wowlan_nd_match - information about the match | ||
2011 | * | ||
2012 | * @ssid: SSID of the match that triggered the wake up | ||
2013 | * @n_channels: Number of channels where the match occurred. This | ||
2014 | * value may be zero if the driver can't report the channels. | ||
2015 | * @channels: center frequencies of the channels where a match | ||
2016 | * occurred (in MHz) | ||
2017 | */ | ||
2018 | struct cfg80211_wowlan_nd_match { | ||
2019 | struct cfg80211_ssid ssid; | ||
2020 | int n_channels; | ||
2021 | u32 channels[]; | ||
2022 | }; | ||
2023 | |||
2024 | /** | ||
2025 | * struct cfg80211_wowlan_nd_info - net detect wake up information | ||
2026 | * | ||
2027 | * @n_matches: Number of match information instances provided in | ||
2028 | * @matches. This value may be zero if the driver can't provide | ||
2029 | * match information. | ||
2030 | * @matches: Array of pointers to matches containing information about | ||
2031 | * the matches that triggered the wake up. | ||
2032 | */ | ||
2033 | struct cfg80211_wowlan_nd_info { | ||
2034 | int n_matches; | ||
2035 | struct cfg80211_wowlan_nd_match *matches[]; | ||
2036 | }; | ||
2037 | |||
2038 | /** | ||
1954 | * struct cfg80211_wowlan_wakeup - wakeup report | 2039 | * struct cfg80211_wowlan_wakeup - wakeup report |
1955 | * @disconnect: woke up by getting disconnected | 2040 | * @disconnect: woke up by getting disconnected |
1956 | * @magic_pkt: woke up by receiving magic packet | 2041 | * @magic_pkt: woke up by receiving magic packet |
@@ -1969,6 +2054,7 @@ struct cfg80211_coalesce { | |||
1969 | * @tcp_match: TCP wakeup packet received | 2054 | * @tcp_match: TCP wakeup packet received |
1970 | * @tcp_connlost: TCP connection lost or failed to establish | 2055 | * @tcp_connlost: TCP connection lost or failed to establish |
1971 | * @tcp_nomoretokens: TCP data ran out of tokens | 2056 | * @tcp_nomoretokens: TCP data ran out of tokens |
2057 | * @net_detect: if not %NULL, woke up because of net detect | ||
1972 | */ | 2058 | */ |
1973 | struct cfg80211_wowlan_wakeup { | 2059 | struct cfg80211_wowlan_wakeup { |
1974 | bool disconnect, magic_pkt, gtk_rekey_failure, | 2060 | bool disconnect, magic_pkt, gtk_rekey_failure, |
@@ -1978,6 +2064,7 @@ struct cfg80211_wowlan_wakeup { | |||
1978 | s32 pattern_idx; | 2064 | s32 pattern_idx; |
1979 | u32 packet_present_len, packet_len; | 2065 | u32 packet_present_len, packet_len; |
1980 | const void *packet; | 2066 | const void *packet; |
2067 | struct cfg80211_wowlan_nd_info *net_detect; | ||
1981 | }; | 2068 | }; |
1982 | 2069 | ||
1983 | /** | 2070 | /** |
@@ -2132,7 +2219,7 @@ struct cfg80211_qos_map { | |||
2132 | * @stop_ap: Stop being an AP, including stopping beaconing. | 2219 | * @stop_ap: Stop being an AP, including stopping beaconing. |
2133 | * | 2220 | * |
2134 | * @add_station: Add a new station. | 2221 | * @add_station: Add a new station. |
2135 | * @del_station: Remove a station; @mac may be NULL to remove all stations. | 2222 | * @del_station: Remove a station |
2136 | * @change_station: Modify a given station. Note that flags changes are not much | 2223 | * @change_station: Modify a given station. Note that flags changes are not much |
2137 | * validated in cfg80211, in particular the auth/assoc/authorized flags | 2224 | * validated in cfg80211, in particular the auth/assoc/authorized flags |
2138 | * might come to the driver in invalid combinations -- make sure to check | 2225 | * might come to the driver in invalid combinations -- make sure to check |
@@ -2146,6 +2233,8 @@ struct cfg80211_qos_map { | |||
2146 | * @change_mpath: change a given mesh path | 2233 | * @change_mpath: change a given mesh path |
2147 | * @get_mpath: get a mesh path for the given parameters | 2234 | * @get_mpath: get a mesh path for the given parameters |
2148 | * @dump_mpath: dump mesh path callback -- resume dump at index @idx | 2235 | * @dump_mpath: dump mesh path callback -- resume dump at index @idx |
2236 | * @get_mpp: get a mesh proxy path for the given parameters | ||
2237 | * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx | ||
2149 | * @join_mesh: join the mesh network with the specified parameters | 2238 | * @join_mesh: join the mesh network with the specified parameters |
2150 | * (invoked with the wireless_dev mutex held) | 2239 | * (invoked with the wireless_dev mutex held) |
2151 | * @leave_mesh: leave the current mesh network | 2240 | * @leave_mesh: leave the current mesh network |
@@ -2331,6 +2420,17 @@ struct cfg80211_qos_map { | |||
2331 | * with the peer followed by immediate teardown when the addition is later | 2420 | * with the peer followed by immediate teardown when the addition is later |
2332 | * rejected) | 2421 | * rejected) |
2333 | * @del_tx_ts: remove an existing TX TS | 2422 | * @del_tx_ts: remove an existing TX TS |
2423 | * | ||
2424 | * @join_ocb: join the OCB network with the specified parameters | ||
2425 | * (invoked with the wireless_dev mutex held) | ||
2426 | * @leave_ocb: leave the current OCB network | ||
2427 | * (invoked with the wireless_dev mutex held) | ||
2428 | * | ||
2429 | * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver | ||
2430 | * is responsible for continually initiating channel-switching operations | ||
2431 | * and returning to the base channel for communication with the AP. | ||
2432 | * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both | ||
2433 | * peers must be on the base channel when the call completes. | ||
2334 | */ | 2434 | */ |
2335 | struct cfg80211_ops { | 2435 | struct cfg80211_ops { |
2336 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); | 2436 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); |
@@ -2376,7 +2476,7 @@ struct cfg80211_ops { | |||
2376 | const u8 *mac, | 2476 | const u8 *mac, |
2377 | struct station_parameters *params); | 2477 | struct station_parameters *params); |
2378 | int (*del_station)(struct wiphy *wiphy, struct net_device *dev, | 2478 | int (*del_station)(struct wiphy *wiphy, struct net_device *dev, |
2379 | const u8 *mac); | 2479 | struct station_del_parameters *params); |
2380 | int (*change_station)(struct wiphy *wiphy, struct net_device *dev, | 2480 | int (*change_station)(struct wiphy *wiphy, struct net_device *dev, |
2381 | const u8 *mac, | 2481 | const u8 *mac, |
2382 | struct station_parameters *params); | 2482 | struct station_parameters *params); |
@@ -2396,6 +2496,11 @@ struct cfg80211_ops { | |||
2396 | int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, | 2496 | int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, |
2397 | int idx, u8 *dst, u8 *next_hop, | 2497 | int idx, u8 *dst, u8 *next_hop, |
2398 | struct mpath_info *pinfo); | 2498 | struct mpath_info *pinfo); |
2499 | int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev, | ||
2500 | u8 *dst, u8 *mpp, struct mpath_info *pinfo); | ||
2501 | int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev, | ||
2502 | int idx, u8 *dst, u8 *mpp, | ||
2503 | struct mpath_info *pinfo); | ||
2399 | int (*get_mesh_config)(struct wiphy *wiphy, | 2504 | int (*get_mesh_config)(struct wiphy *wiphy, |
2400 | struct net_device *dev, | 2505 | struct net_device *dev, |
2401 | struct mesh_config *conf); | 2506 | struct mesh_config *conf); |
@@ -2407,6 +2512,10 @@ struct cfg80211_ops { | |||
2407 | const struct mesh_setup *setup); | 2512 | const struct mesh_setup *setup); |
2408 | int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); | 2513 | int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); |
2409 | 2514 | ||
2515 | int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev, | ||
2516 | struct ocb_setup *setup); | ||
2517 | int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev); | ||
2518 | |||
2410 | int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, | 2519 | int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, |
2411 | struct bss_parameters *params); | 2520 | struct bss_parameters *params); |
2412 | 2521 | ||
@@ -2577,6 +2686,14 @@ struct cfg80211_ops { | |||
2577 | u16 admitted_time); | 2686 | u16 admitted_time); |
2578 | int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, | 2687 | int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev, |
2579 | u8 tsid, const u8 *peer); | 2688 | u8 tsid, const u8 *peer); |
2689 | |||
2690 | int (*tdls_channel_switch)(struct wiphy *wiphy, | ||
2691 | struct net_device *dev, | ||
2692 | const u8 *addr, u8 oper_class, | ||
2693 | struct cfg80211_chan_def *chandef); | ||
2694 | void (*tdls_cancel_channel_switch)(struct wiphy *wiphy, | ||
2695 | struct net_device *dev, | ||
2696 | const u8 *addr); | ||
2580 | }; | 2697 | }; |
2581 | 2698 | ||
2582 | /* | 2699 | /* |
@@ -2623,13 +2740,9 @@ struct cfg80211_ops { | |||
2623 | * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. | 2740 | * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. |
2624 | * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in | 2741 | * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in |
2625 | * beaconing mode (AP, IBSS, Mesh, ...). | 2742 | * beaconing mode (AP, IBSS, Mesh, ...). |
2626 | * @WIPHY_FLAG_SUPPORTS_WMM_ADMISSION: the device supports setting up WMM | ||
2627 | * TSPEC sessions (TID aka TSID 0-7) with the NL80211_CMD_ADD_TX_TS | ||
2628 | * command. Standard IEEE 802.11 TSPEC setup is not yet supported, it | ||
2629 | * needs to be able to handle Block-Ack agreements and other things. | ||
2630 | */ | 2743 | */ |
2631 | enum wiphy_flags { | 2744 | enum wiphy_flags { |
2632 | WIPHY_FLAG_SUPPORTS_WMM_ADMISSION = BIT(0), | 2745 | /* use hole at 0 */ |
2633 | /* use hole at 1 */ | 2746 | /* use hole at 1 */ |
2634 | /* use hole at 2 */ | 2747 | /* use hole at 2 */ |
2635 | WIPHY_FLAG_NETNS_OK = BIT(3), | 2748 | WIPHY_FLAG_NETNS_OK = BIT(3), |
@@ -2755,6 +2868,7 @@ struct ieee80211_txrx_stypes { | |||
2755 | * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request | 2868 | * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request |
2756 | * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure | 2869 | * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure |
2757 | * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release | 2870 | * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release |
2871 | * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection | ||
2758 | */ | 2872 | */ |
2759 | enum wiphy_wowlan_support_flags { | 2873 | enum wiphy_wowlan_support_flags { |
2760 | WIPHY_WOWLAN_ANY = BIT(0), | 2874 | WIPHY_WOWLAN_ANY = BIT(0), |
@@ -2765,6 +2879,7 @@ enum wiphy_wowlan_support_flags { | |||
2765 | WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), | 2879 | WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), |
2766 | WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), | 2880 | WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), |
2767 | WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), | 2881 | WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), |
2882 | WIPHY_WOWLAN_NET_DETECT = BIT(8), | ||
2768 | }; | 2883 | }; |
2769 | 2884 | ||
2770 | struct wiphy_wowlan_tcp_support { | 2885 | struct wiphy_wowlan_tcp_support { |
@@ -2783,6 +2898,11 @@ struct wiphy_wowlan_tcp_support { | |||
2783 | * @pattern_max_len: maximum length of each pattern | 2898 | * @pattern_max_len: maximum length of each pattern |
2784 | * @pattern_min_len: minimum length of each pattern | 2899 | * @pattern_min_len: minimum length of each pattern |
2785 | * @max_pkt_offset: maximum Rx packet offset | 2900 | * @max_pkt_offset: maximum Rx packet offset |
2901 | * @max_nd_match_sets: maximum number of matchsets for net-detect, | ||
2902 | * similar, but not necessarily identical, to max_match_sets for | ||
2903 | * scheduled scans. | ||
2904 | * See &struct cfg80211_sched_scan_request.@match_sets for more | ||
2905 | * details. | ||
2786 | * @tcp: TCP wakeup support information | 2906 | * @tcp: TCP wakeup support information |
2787 | */ | 2907 | */ |
2788 | struct wiphy_wowlan_support { | 2908 | struct wiphy_wowlan_support { |
@@ -2791,6 +2911,7 @@ struct wiphy_wowlan_support { | |||
2791 | int pattern_max_len; | 2911 | int pattern_max_len; |
2792 | int pattern_min_len; | 2912 | int pattern_min_len; |
2793 | int max_pkt_offset; | 2913 | int max_pkt_offset; |
2914 | int max_nd_match_sets; | ||
2794 | const struct wiphy_wowlan_tcp_support *tcp; | 2915 | const struct wiphy_wowlan_tcp_support *tcp; |
2795 | }; | 2916 | }; |
2796 | 2917 | ||
@@ -3166,6 +3287,23 @@ static inline const char *wiphy_name(const struct wiphy *wiphy) | |||
3166 | } | 3287 | } |
3167 | 3288 | ||
3168 | /** | 3289 | /** |
3290 | * wiphy_new_nm - create a new wiphy for use with cfg80211 | ||
3291 | * | ||
3292 | * @ops: The configuration operations for this device | ||
3293 | * @sizeof_priv: The size of the private area to allocate | ||
3294 | * @requested_name: Request a particular name. | ||
3295 | * NULL is valid value, and means use the default phy%d naming. | ||
3296 | * | ||
3297 | * Create a new wiphy and associate the given operations with it. | ||
3298 | * @sizeof_priv bytes are allocated for private use. | ||
3299 | * | ||
3300 | * Return: A pointer to the new wiphy. This pointer must be | ||
3301 | * assigned to each netdev's ieee80211_ptr for proper operation. | ||
3302 | */ | ||
3303 | struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, | ||
3304 | const char *requested_name); | ||
3305 | |||
3306 | /** | ||
3169 | * wiphy_new - create a new wiphy for use with cfg80211 | 3307 | * wiphy_new - create a new wiphy for use with cfg80211 |
3170 | * | 3308 | * |
3171 | * @ops: The configuration operations for this device | 3309 | * @ops: The configuration operations for this device |
@@ -3177,7 +3315,11 @@ static inline const char *wiphy_name(const struct wiphy *wiphy) | |||
3177 | * Return: A pointer to the new wiphy. This pointer must be | 3315 | * Return: A pointer to the new wiphy. This pointer must be |
3178 | * assigned to each netdev's ieee80211_ptr for proper operation. | 3316 | * assigned to each netdev's ieee80211_ptr for proper operation. |
3179 | */ | 3317 | */ |
3180 | struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); | 3318 | static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops, |
3319 | int sizeof_priv) | ||
3320 | { | ||
3321 | return wiphy_new_nm(ops, sizeof_priv, NULL); | ||
3322 | } | ||
3181 | 3323 | ||
3182 | /** | 3324 | /** |
3183 | * wiphy_register - register a wiphy with cfg80211 | 3325 | * wiphy_register - register a wiphy with cfg80211 |
@@ -4501,33 +4643,6 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, | |||
4501 | gfp_t gfp); | 4643 | gfp_t gfp); |
4502 | 4644 | ||
4503 | /** | 4645 | /** |
4504 | * cfg80211_radar_event - radar detection event | ||
4505 | * @wiphy: the wiphy | ||
4506 | * @chandef: chandef for the current channel | ||
4507 | * @gfp: context flags | ||
4508 | * | ||
4509 | * This function is called when a radar is detected on the current chanenl. | ||
4510 | */ | ||
4511 | void cfg80211_radar_event(struct wiphy *wiphy, | ||
4512 | struct cfg80211_chan_def *chandef, gfp_t gfp); | ||
4513 | |||
4514 | /** | ||
4515 | * cfg80211_cac_event - Channel availability check (CAC) event | ||
4516 | * @netdev: network device | ||
4517 | * @chandef: chandef for the current channel | ||
4518 | * @event: type of event | ||
4519 | * @gfp: context flags | ||
4520 | * | ||
4521 | * This function is called when a Channel availability check (CAC) is finished | ||
4522 | * or aborted. This must be called to notify the completion of a CAC process, | ||
4523 | * also by full-MAC drivers. | ||
4524 | */ | ||
4525 | void cfg80211_cac_event(struct net_device *netdev, | ||
4526 | const struct cfg80211_chan_def *chandef, | ||
4527 | enum nl80211_radar_event event, gfp_t gfp); | ||
4528 | |||
4529 | |||
4530 | /** | ||
4531 | * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer | 4646 | * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer |
4532 | * @dev: network device | 4647 | * @dev: network device |
4533 | * @peer: peer's MAC address | 4648 | * @peer: peer's MAC address |
@@ -4555,6 +4670,42 @@ void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, | |||
4555 | u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); | 4670 | u32 num_packets, u32 rate, u32 intvl, gfp_t gfp); |
4556 | 4671 | ||
4557 | /** | 4672 | /** |
4673 | * cfg80211_cqm_beacon_loss_notify - beacon loss event | ||
4674 | * @dev: network device | ||
4675 | * @gfp: context flags | ||
4676 | * | ||
4677 | * Notify userspace about beacon loss from the connected AP. | ||
4678 | */ | ||
4679 | void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); | ||
4680 | |||
4681 | /** | ||
4682 | * cfg80211_radar_event - radar detection event | ||
4683 | * @wiphy: the wiphy | ||
4684 | * @chandef: chandef for the current channel | ||
4685 | * @gfp: context flags | ||
4686 | * | ||
4687 | * This function is called when a radar is detected on the current chanenl. | ||
4688 | */ | ||
4689 | void cfg80211_radar_event(struct wiphy *wiphy, | ||
4690 | struct cfg80211_chan_def *chandef, gfp_t gfp); | ||
4691 | |||
4692 | /** | ||
4693 | * cfg80211_cac_event - Channel availability check (CAC) event | ||
4694 | * @netdev: network device | ||
4695 | * @chandef: chandef for the current channel | ||
4696 | * @event: type of event | ||
4697 | * @gfp: context flags | ||
4698 | * | ||
4699 | * This function is called when a Channel availability check (CAC) is finished | ||
4700 | * or aborted. This must be called to notify the completion of a CAC process, | ||
4701 | * also by full-MAC drivers. | ||
4702 | */ | ||
4703 | void cfg80211_cac_event(struct net_device *netdev, | ||
4704 | const struct cfg80211_chan_def *chandef, | ||
4705 | enum nl80211_radar_event event, gfp_t gfp); | ||
4706 | |||
4707 | |||
4708 | /** | ||
4558 | * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying | 4709 | * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying |
4559 | * @dev: network device | 4710 | * @dev: network device |
4560 | * @bssid: BSSID of AP (to avoid races) | 4711 | * @bssid: BSSID of AP (to avoid races) |
@@ -4657,6 +4808,20 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy, | |||
4657 | void cfg80211_ch_switch_notify(struct net_device *dev, | 4808 | void cfg80211_ch_switch_notify(struct net_device *dev, |
4658 | struct cfg80211_chan_def *chandef); | 4809 | struct cfg80211_chan_def *chandef); |
4659 | 4810 | ||
4811 | /* | ||
4812 | * cfg80211_ch_switch_started_notify - notify channel switch start | ||
4813 | * @dev: the device on which the channel switch started | ||
4814 | * @chandef: the future channel definition | ||
4815 | * @count: the number of TBTTs until the channel switch happens | ||
4816 | * | ||
4817 | * Inform the userspace about the channel switch that has just | ||
4818 | * started, so that it can take appropriate actions (eg. starting | ||
4819 | * channel switch on other vifs), if necessary. | ||
4820 | */ | ||
4821 | void cfg80211_ch_switch_started_notify(struct net_device *dev, | ||
4822 | struct cfg80211_chan_def *chandef, | ||
4823 | u8 count); | ||
4824 | |||
4660 | /** | 4825 | /** |
4661 | * ieee80211_operating_class_to_band - convert operating class to band | 4826 | * ieee80211_operating_class_to_band - convert operating class to band |
4662 | * | 4827 | * |
diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h new file mode 100644 index 000000000000..7f713acfa106 --- /dev/null +++ b/include/net/cfg802154.h | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007, 2008, 2009 Siemens AG | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 | ||
6 | * as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * Written by: | ||
14 | * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | ||
15 | */ | ||
16 | |||
17 | #ifndef __NET_CFG802154_H | ||
18 | #define __NET_CFG802154_H | ||
19 | |||
20 | #include <linux/ieee802154.h> | ||
21 | #include <linux/netdevice.h> | ||
22 | #include <linux/mutex.h> | ||
23 | #include <linux/bug.h> | ||
24 | |||
25 | #include <net/nl802154.h> | ||
26 | |||
27 | struct wpan_phy; | ||
28 | |||
29 | struct cfg802154_ops { | ||
30 | struct net_device * (*add_virtual_intf_deprecated)(struct wpan_phy *wpan_phy, | ||
31 | const char *name, | ||
32 | int type); | ||
33 | void (*del_virtual_intf_deprecated)(struct wpan_phy *wpan_phy, | ||
34 | struct net_device *dev); | ||
35 | int (*add_virtual_intf)(struct wpan_phy *wpan_phy, | ||
36 | const char *name, | ||
37 | enum nl802154_iftype type, | ||
38 | __le64 extended_addr); | ||
39 | int (*del_virtual_intf)(struct wpan_phy *wpan_phy, | ||
40 | struct wpan_dev *wpan_dev); | ||
41 | int (*set_channel)(struct wpan_phy *wpan_phy, u8 page, u8 channel); | ||
42 | int (*set_pan_id)(struct wpan_phy *wpan_phy, | ||
43 | struct wpan_dev *wpan_dev, __le16 pan_id); | ||
44 | int (*set_short_addr)(struct wpan_phy *wpan_phy, | ||
45 | struct wpan_dev *wpan_dev, __le16 short_addr); | ||
46 | int (*set_backoff_exponent)(struct wpan_phy *wpan_phy, | ||
47 | struct wpan_dev *wpan_dev, u8 min_be, | ||
48 | u8 max_be); | ||
49 | int (*set_max_csma_backoffs)(struct wpan_phy *wpan_phy, | ||
50 | struct wpan_dev *wpan_dev, | ||
51 | u8 max_csma_backoffs); | ||
52 | int (*set_max_frame_retries)(struct wpan_phy *wpan_phy, | ||
53 | struct wpan_dev *wpan_dev, | ||
54 | s8 max_frame_retries); | ||
55 | int (*set_lbt_mode)(struct wpan_phy *wpan_phy, | ||
56 | struct wpan_dev *wpan_dev, bool mode); | ||
57 | }; | ||
58 | |||
59 | struct wpan_phy { | ||
60 | struct mutex pib_lock; | ||
61 | |||
62 | /* If multiple wpan_phys are registered and you're handed e.g. | ||
63 | * a regular netdev with assigned ieee802154_ptr, you won't | ||
64 | * know whether it points to a wpan_phy your driver has registered | ||
65 | * or not. Assign this to something global to your driver to | ||
66 | * help determine whether you own this wpan_phy or not. | ||
67 | */ | ||
68 | const void *privid; | ||
69 | |||
70 | /* | ||
71 | * This is a PIB according to 802.15.4-2011. | ||
72 | * We do not provide timing-related variables, as they | ||
73 | * aren't used outside of driver | ||
74 | */ | ||
75 | u8 current_channel; | ||
76 | u8 current_page; | ||
77 | u32 channels_supported[IEEE802154_MAX_PAGE + 1]; | ||
78 | s8 transmit_power; | ||
79 | u8 cca_mode; | ||
80 | |||
81 | __le64 perm_extended_addr; | ||
82 | |||
83 | s32 cca_ed_level; | ||
84 | |||
85 | /* PHY depended MAC PIB values */ | ||
86 | |||
87 | /* 802.15.4 acronym: Tdsym in usec */ | ||
88 | u8 symbol_duration; | ||
89 | /* lifs and sifs periods timing */ | ||
90 | u16 lifs_period; | ||
91 | u16 sifs_period; | ||
92 | |||
93 | struct device dev; | ||
94 | |||
95 | char priv[0] __aligned(NETDEV_ALIGN); | ||
96 | }; | ||
97 | |||
98 | struct wpan_dev { | ||
99 | struct wpan_phy *wpan_phy; | ||
100 | int iftype; | ||
101 | |||
102 | /* the remainder of this struct should be private to cfg802154 */ | ||
103 | struct list_head list; | ||
104 | struct net_device *netdev; | ||
105 | |||
106 | u32 identifier; | ||
107 | |||
108 | /* MAC PIB */ | ||
109 | __le16 pan_id; | ||
110 | __le16 short_addr; | ||
111 | __le64 extended_addr; | ||
112 | |||
113 | /* MAC BSN field */ | ||
114 | u8 bsn; | ||
115 | /* MAC DSN field */ | ||
116 | u8 dsn; | ||
117 | |||
118 | u8 min_be; | ||
119 | u8 max_be; | ||
120 | u8 csma_retries; | ||
121 | s8 frame_retries; | ||
122 | |||
123 | bool lbt; | ||
124 | |||
125 | bool promiscuous_mode; | ||
126 | }; | ||
127 | |||
128 | #define to_phy(_dev) container_of(_dev, struct wpan_phy, dev) | ||
129 | |||
130 | struct wpan_phy * | ||
131 | wpan_phy_new(const struct cfg802154_ops *ops, size_t priv_size); | ||
132 | static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev) | ||
133 | { | ||
134 | phy->dev.parent = dev; | ||
135 | } | ||
136 | |||
137 | int wpan_phy_register(struct wpan_phy *phy); | ||
138 | void wpan_phy_unregister(struct wpan_phy *phy); | ||
139 | void wpan_phy_free(struct wpan_phy *phy); | ||
140 | /* Same semantics as for class_for_each_device */ | ||
141 | int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data); | ||
142 | |||
143 | static inline void *wpan_phy_priv(struct wpan_phy *phy) | ||
144 | { | ||
145 | BUG_ON(!phy); | ||
146 | return &phy->priv; | ||
147 | } | ||
148 | |||
149 | struct wpan_phy *wpan_phy_find(const char *str); | ||
150 | |||
151 | static inline void wpan_phy_put(struct wpan_phy *phy) | ||
152 | { | ||
153 | put_device(&phy->dev); | ||
154 | } | ||
155 | |||
156 | static inline const char *wpan_phy_name(struct wpan_phy *phy) | ||
157 | { | ||
158 | return dev_name(&phy->dev); | ||
159 | } | ||
160 | |||
161 | #endif /* __NET_CFG802154_H */ | ||
diff --git a/include/net/checksum.h b/include/net/checksum.h index 6465bae80a4f..e339a9513e29 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h | |||
@@ -151,4 +151,20 @@ static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, | |||
151 | (__force __be32)to, pseudohdr); | 151 | (__force __be32)to, pseudohdr); |
152 | } | 152 | } |
153 | 153 | ||
154 | static inline __wsum remcsum_adjust(void *ptr, __wsum csum, | ||
155 | int start, int offset) | ||
156 | { | ||
157 | __sum16 *psum = (__sum16 *)(ptr + offset); | ||
158 | __wsum delta; | ||
159 | |||
160 | /* Subtract out checksum up to start */ | ||
161 | csum = csum_sub(csum, csum_partial(ptr, start, 0)); | ||
162 | |||
163 | /* Set derived checksum in packet */ | ||
164 | delta = csum_sub(csum_fold(csum), *psum); | ||
165 | *psum = csum_fold(csum); | ||
166 | |||
167 | return delta; | ||
168 | } | ||
169 | |||
154 | #endif | 170 | #endif |
diff --git a/include/net/compat.h b/include/net/compat.h index 3b603b199c01..42a9c8431177 100644 --- a/include/net/compat.h +++ b/include/net/compat.h | |||
@@ -40,9 +40,8 @@ int compat_sock_get_timestampns(struct sock *, struct timespec __user *); | |||
40 | #define compat_mmsghdr mmsghdr | 40 | #define compat_mmsghdr mmsghdr |
41 | #endif /* defined(CONFIG_COMPAT) */ | 41 | #endif /* defined(CONFIG_COMPAT) */ |
42 | 42 | ||
43 | int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); | 43 | ssize_t get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *, |
44 | int verify_compat_iovec(struct msghdr *, struct iovec *, | 44 | struct sockaddr __user **, struct iovec **); |
45 | struct sockaddr_storage *, int); | ||
46 | asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *, | 45 | asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *, |
47 | unsigned int); | 46 | unsigned int); |
48 | asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, | 47 | asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, |
diff --git a/include/net/dsa.h b/include/net/dsa.h index b76559293535..ed3c34bbb67a 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h | |||
@@ -38,6 +38,9 @@ struct dsa_chip_data { | |||
38 | struct device *host_dev; | 38 | struct device *host_dev; |
39 | int sw_addr; | 39 | int sw_addr; |
40 | 40 | ||
41 | /* set to size of eeprom if supported by the switch */ | ||
42 | int eeprom_len; | ||
43 | |||
41 | /* Device tree node pointer for this specific switch chip | 44 | /* Device tree node pointer for this specific switch chip |
42 | * used during switch setup in case additional properties | 45 | * used during switch setup in case additional properties |
43 | * and resources needs to be used | 46 | * and resources needs to be used |
@@ -139,6 +142,14 @@ struct dsa_switch { | |||
139 | */ | 142 | */ |
140 | struct device *master_dev; | 143 | struct device *master_dev; |
141 | 144 | ||
145 | #ifdef CONFIG_NET_DSA_HWMON | ||
146 | /* | ||
147 | * Hardware monitoring information | ||
148 | */ | ||
149 | char hwmon_name[IFNAMSIZ + 8]; | ||
150 | struct device *hwmon_dev; | ||
151 | #endif | ||
152 | |||
142 | /* | 153 | /* |
143 | * Slave mii_bus and devices for the individual ports. | 154 | * Slave mii_bus and devices for the individual ports. |
144 | */ | 155 | */ |
@@ -242,6 +253,28 @@ struct dsa_switch_driver { | |||
242 | struct ethtool_eee *e); | 253 | struct ethtool_eee *e); |
243 | int (*get_eee)(struct dsa_switch *ds, int port, | 254 | int (*get_eee)(struct dsa_switch *ds, int port, |
244 | struct ethtool_eee *e); | 255 | struct ethtool_eee *e); |
256 | |||
257 | #ifdef CONFIG_NET_DSA_HWMON | ||
258 | /* Hardware monitoring */ | ||
259 | int (*get_temp)(struct dsa_switch *ds, int *temp); | ||
260 | int (*get_temp_limit)(struct dsa_switch *ds, int *temp); | ||
261 | int (*set_temp_limit)(struct dsa_switch *ds, int temp); | ||
262 | int (*get_temp_alarm)(struct dsa_switch *ds, bool *alarm); | ||
263 | #endif | ||
264 | |||
265 | /* EEPROM access */ | ||
266 | int (*get_eeprom_len)(struct dsa_switch *ds); | ||
267 | int (*get_eeprom)(struct dsa_switch *ds, | ||
268 | struct ethtool_eeprom *eeprom, u8 *data); | ||
269 | int (*set_eeprom)(struct dsa_switch *ds, | ||
270 | struct ethtool_eeprom *eeprom, u8 *data); | ||
271 | |||
272 | /* | ||
273 | * Register access. | ||
274 | */ | ||
275 | int (*get_regs_len)(struct dsa_switch *ds, int port); | ||
276 | void (*get_regs)(struct dsa_switch *ds, int port, | ||
277 | struct ethtool_regs *regs, void *p); | ||
245 | }; | 278 | }; |
246 | 279 | ||
247 | void register_switch_driver(struct dsa_switch_driver *type); | 280 | void register_switch_driver(struct dsa_switch_driver *type); |
diff --git a/include/net/fou.h b/include/net/fou.h new file mode 100644 index 000000000000..19b8a0c62a98 --- /dev/null +++ b/include/net/fou.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef __NET_FOU_H | ||
2 | #define __NET_FOU_H | ||
3 | |||
4 | #include <linux/skbuff.h> | ||
5 | |||
6 | #include <net/flow.h> | ||
7 | #include <net/gue.h> | ||
8 | #include <net/ip_tunnels.h> | ||
9 | #include <net/udp.h> | ||
10 | |||
11 | size_t fou_encap_hlen(struct ip_tunnel_encap *e); | ||
12 | static size_t gue_encap_hlen(struct ip_tunnel_encap *e); | ||
13 | |||
14 | int fou_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, | ||
15 | u8 *protocol, struct flowi4 *fl4); | ||
16 | int gue_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e, | ||
17 | u8 *protocol, struct flowi4 *fl4); | ||
18 | |||
19 | #endif | ||
diff --git a/include/net/gue.h b/include/net/gue.h index b6c332788084..3f28ec7f1c7f 100644 --- a/include/net/gue.h +++ b/include/net/gue.h | |||
@@ -1,23 +1,116 @@ | |||
1 | #ifndef __NET_GUE_H | 1 | #ifndef __NET_GUE_H |
2 | #define __NET_GUE_H | 2 | #define __NET_GUE_H |
3 | 3 | ||
4 | /* Definitions for the GUE header, standard and private flags, lengths | ||
5 | * of optional fields are below. | ||
6 | * | ||
7 | * Diagram of GUE header: | ||
8 | * | ||
9 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
10 | * |Ver|C| Hlen | Proto/ctype | Standard flags |P| | ||
11 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
12 | * | | | ||
13 | * ~ Fields (optional) ~ | ||
14 | * | | | ||
15 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
16 | * | Private flags (optional, P bit is set) | | ||
17 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
18 | * | | | ||
19 | * ~ Private fields (optional) ~ | ||
20 | * | | | ||
21 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
22 | * | ||
23 | * C bit indicates contol message when set, data message when unset. | ||
24 | * For a control message, proto/ctype is interpreted as a type of | ||
25 | * control message. For data messages, proto/ctype is the IP protocol | ||
26 | * of the next header. | ||
27 | * | ||
28 | * P bit indicates private flags field is present. The private flags | ||
29 | * may refer to options placed after this field. | ||
30 | */ | ||
31 | |||
4 | struct guehdr { | 32 | struct guehdr { |
5 | union { | 33 | union { |
6 | struct { | 34 | struct { |
7 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 35 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
8 | __u8 hlen:4, | 36 | __u8 hlen:5, |
9 | version:4; | 37 | control:1, |
38 | version:2; | ||
10 | #elif defined (__BIG_ENDIAN_BITFIELD) | 39 | #elif defined (__BIG_ENDIAN_BITFIELD) |
11 | __u8 version:4, | 40 | __u8 version:2, |
12 | hlen:4; | 41 | control:1, |
42 | hlen:5; | ||
13 | #else | 43 | #else |
14 | #error "Please fix <asm/byteorder.h>" | 44 | #error "Please fix <asm/byteorder.h>" |
15 | #endif | 45 | #endif |
16 | __u8 next_hdr; | 46 | __u8 proto_ctype; |
17 | __u16 flags; | 47 | __u16 flags; |
18 | }; | 48 | }; |
19 | __u32 word; | 49 | __u32 word; |
20 | }; | 50 | }; |
21 | }; | 51 | }; |
22 | 52 | ||
53 | /* Standard flags in GUE header */ | ||
54 | |||
55 | #define GUE_FLAG_PRIV htons(1<<0) /* Private flags are in options */ | ||
56 | #define GUE_LEN_PRIV 4 | ||
57 | |||
58 | #define GUE_FLAGS_ALL (GUE_FLAG_PRIV) | ||
59 | |||
60 | /* Private flags in the private option extension */ | ||
61 | |||
62 | #define GUE_PFLAG_REMCSUM htonl(1 << 31) | ||
63 | #define GUE_PLEN_REMCSUM 4 | ||
64 | |||
65 | #define GUE_PFLAGS_ALL (GUE_PFLAG_REMCSUM) | ||
66 | |||
67 | /* Functions to compute options length corresponding to flags. | ||
68 | * If we ever have a lot of flags this can be potentially be | ||
69 | * converted to a more optimized algorithm (table lookup | ||
70 | * for instance). | ||
71 | */ | ||
72 | static inline size_t guehdr_flags_len(__be16 flags) | ||
73 | { | ||
74 | return ((flags & GUE_FLAG_PRIV) ? GUE_LEN_PRIV : 0); | ||
75 | } | ||
76 | |||
77 | static inline size_t guehdr_priv_flags_len(__be32 flags) | ||
78 | { | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | /* Validate standard and private flags. Returns non-zero (meaning invalid) | ||
83 | * if there is an unknown standard or private flags, or the options length for | ||
84 | * the flags exceeds the options length specific in hlen of the GUE header. | ||
85 | */ | ||
86 | static inline int validate_gue_flags(struct guehdr *guehdr, | ||
87 | size_t optlen) | ||
88 | { | ||
89 | size_t len; | ||
90 | __be32 flags = guehdr->flags; | ||
91 | |||
92 | if (flags & ~GUE_FLAGS_ALL) | ||
93 | return 1; | ||
94 | |||
95 | len = guehdr_flags_len(flags); | ||
96 | if (len > optlen) | ||
97 | return 1; | ||
98 | |||
99 | if (flags & GUE_FLAG_PRIV) { | ||
100 | /* Private flags are last four bytes accounted in | ||
101 | * guehdr_flags_len | ||
102 | */ | ||
103 | flags = *(__be32 *)((void *)&guehdr[1] + len - GUE_LEN_PRIV); | ||
104 | |||
105 | if (flags & ~GUE_PFLAGS_ALL) | ||
106 | return 1; | ||
107 | |||
108 | len += guehdr_priv_flags_len(flags); | ||
109 | if (len > optlen) | ||
110 | return 1; | ||
111 | } | ||
112 | |||
113 | return 0; | ||
114 | } | ||
115 | |||
23 | #endif | 116 | #endif |
diff --git a/include/net/ieee802154.h b/include/net/ieee802154.h deleted file mode 100644 index 0aa7122e8f15..000000000000 --- a/include/net/ieee802154.h +++ /dev/null | |||
@@ -1,195 +0,0 @@ | |||
1 | /* | ||
2 | * IEEE802.15.4-2003 specification | ||
3 | * | ||
4 | * Copyright (C) 2007, 2008 Siemens AG | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 | ||
8 | * as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | * | ||
19 | * Written by: | ||
20 | * Pavel Smolenskiy <pavel.smolenskiy@gmail.com> | ||
21 | * Maxim Gorbachyov <maxim.gorbachev@siemens.com> | ||
22 | * Maxim Osipov <maxim.osipov@siemens.com> | ||
23 | * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | ||
24 | * Alexander Smirnov <alex.bluesman.smirnov@gmail.com> | ||
25 | */ | ||
26 | |||
27 | #ifndef NET_IEEE802154_H | ||
28 | #define NET_IEEE802154_H | ||
29 | |||
30 | #define IEEE802154_MTU 127 | ||
31 | |||
32 | #define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */ | ||
33 | #define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */ | ||
34 | #define IEEE802154_FC_TYPE_ACK 0x2 /* Frame is acknowledgment */ | ||
35 | #define IEEE802154_FC_TYPE_MAC_CMD 0x3 /* Frame is MAC command */ | ||
36 | |||
37 | #define IEEE802154_FC_TYPE_SHIFT 0 | ||
38 | #define IEEE802154_FC_TYPE_MASK ((1 << 3) - 1) | ||
39 | #define IEEE802154_FC_TYPE(x) ((x & IEEE802154_FC_TYPE_MASK) >> IEEE802154_FC_TYPE_SHIFT) | ||
40 | #define IEEE802154_FC_SET_TYPE(v, x) do { \ | ||
41 | v = (((v) & ~IEEE802154_FC_TYPE_MASK) | \ | ||
42 | (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \ | ||
43 | } while (0) | ||
44 | |||
45 | #define IEEE802154_FC_SECEN_SHIFT 3 | ||
46 | #define IEEE802154_FC_SECEN (1 << IEEE802154_FC_SECEN_SHIFT) | ||
47 | #define IEEE802154_FC_FRPEND_SHIFT 4 | ||
48 | #define IEEE802154_FC_FRPEND (1 << IEEE802154_FC_FRPEND_SHIFT) | ||
49 | #define IEEE802154_FC_ACK_REQ_SHIFT 5 | ||
50 | #define IEEE802154_FC_ACK_REQ (1 << IEEE802154_FC_ACK_REQ_SHIFT) | ||
51 | #define IEEE802154_FC_INTRA_PAN_SHIFT 6 | ||
52 | #define IEEE802154_FC_INTRA_PAN (1 << IEEE802154_FC_INTRA_PAN_SHIFT) | ||
53 | |||
54 | #define IEEE802154_FC_SAMODE_SHIFT 14 | ||
55 | #define IEEE802154_FC_SAMODE_MASK (3 << IEEE802154_FC_SAMODE_SHIFT) | ||
56 | #define IEEE802154_FC_DAMODE_SHIFT 10 | ||
57 | #define IEEE802154_FC_DAMODE_MASK (3 << IEEE802154_FC_DAMODE_SHIFT) | ||
58 | |||
59 | #define IEEE802154_FC_VERSION_SHIFT 12 | ||
60 | #define IEEE802154_FC_VERSION_MASK (3 << IEEE802154_FC_VERSION_SHIFT) | ||
61 | #define IEEE802154_FC_VERSION(x) ((x & IEEE802154_FC_VERSION_MASK) >> IEEE802154_FC_VERSION_SHIFT) | ||
62 | |||
63 | #define IEEE802154_FC_SAMODE(x) \ | ||
64 | (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT) | ||
65 | |||
66 | #define IEEE802154_FC_DAMODE(x) \ | ||
67 | (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT) | ||
68 | |||
69 | #define IEEE802154_SCF_SECLEVEL_MASK 7 | ||
70 | #define IEEE802154_SCF_SECLEVEL_SHIFT 0 | ||
71 | #define IEEE802154_SCF_SECLEVEL(x) (x & IEEE802154_SCF_SECLEVEL_MASK) | ||
72 | #define IEEE802154_SCF_KEY_ID_MODE_SHIFT 3 | ||
73 | #define IEEE802154_SCF_KEY_ID_MODE_MASK (3 << IEEE802154_SCF_KEY_ID_MODE_SHIFT) | ||
74 | #define IEEE802154_SCF_KEY_ID_MODE(x) \ | ||
75 | ((x & IEEE802154_SCF_KEY_ID_MODE_MASK) >> IEEE802154_SCF_KEY_ID_MODE_SHIFT) | ||
76 | |||
77 | #define IEEE802154_SCF_KEY_IMPLICIT 0 | ||
78 | #define IEEE802154_SCF_KEY_INDEX 1 | ||
79 | #define IEEE802154_SCF_KEY_SHORT_INDEX 2 | ||
80 | #define IEEE802154_SCF_KEY_HW_INDEX 3 | ||
81 | |||
82 | #define IEEE802154_SCF_SECLEVEL_NONE 0 | ||
83 | #define IEEE802154_SCF_SECLEVEL_MIC32 1 | ||
84 | #define IEEE802154_SCF_SECLEVEL_MIC64 2 | ||
85 | #define IEEE802154_SCF_SECLEVEL_MIC128 3 | ||
86 | #define IEEE802154_SCF_SECLEVEL_ENC 4 | ||
87 | #define IEEE802154_SCF_SECLEVEL_ENC_MIC32 5 | ||
88 | #define IEEE802154_SCF_SECLEVEL_ENC_MIC64 6 | ||
89 | #define IEEE802154_SCF_SECLEVEL_ENC_MIC128 7 | ||
90 | |||
91 | /* MAC footer size */ | ||
92 | #define IEEE802154_MFR_SIZE 2 /* 2 octets */ | ||
93 | |||
94 | /* MAC's Command Frames Identifiers */ | ||
95 | #define IEEE802154_CMD_ASSOCIATION_REQ 0x01 | ||
96 | #define IEEE802154_CMD_ASSOCIATION_RESP 0x02 | ||
97 | #define IEEE802154_CMD_DISASSOCIATION_NOTIFY 0x03 | ||
98 | #define IEEE802154_CMD_DATA_REQ 0x04 | ||
99 | #define IEEE802154_CMD_PANID_CONFLICT_NOTIFY 0x05 | ||
100 | #define IEEE802154_CMD_ORPHAN_NOTIFY 0x06 | ||
101 | #define IEEE802154_CMD_BEACON_REQ 0x07 | ||
102 | #define IEEE802154_CMD_COORD_REALIGN_NOTIFY 0x08 | ||
103 | #define IEEE802154_CMD_GTS_REQ 0x09 | ||
104 | |||
105 | /* | ||
106 | * The return values of MAC operations | ||
107 | */ | ||
108 | enum { | ||
109 | /* | ||
110 | * The requested operation was completed successfully. | ||
111 | * For a transmission request, this value indicates | ||
112 | * a successful transmission. | ||
113 | */ | ||
114 | IEEE802154_SUCCESS = 0x0, | ||
115 | |||
116 | /* The beacon was lost following a synchronization request. */ | ||
117 | IEEE802154_BEACON_LOSS = 0xe0, | ||
118 | /* | ||
119 | * A transmission could not take place due to activity on the | ||
120 | * channel, i.e., the CSMA-CA mechanism has failed. | ||
121 | */ | ||
122 | IEEE802154_CHNL_ACCESS_FAIL = 0xe1, | ||
123 | /* The GTS request has been denied by the PAN coordinator. */ | ||
124 | IEEE802154_DENINED = 0xe2, | ||
125 | /* The attempt to disable the transceiver has failed. */ | ||
126 | IEEE802154_DISABLE_TRX_FAIL = 0xe3, | ||
127 | /* | ||
128 | * The received frame induces a failed security check according to | ||
129 | * the security suite. | ||
130 | */ | ||
131 | IEEE802154_FAILED_SECURITY_CHECK = 0xe4, | ||
132 | /* | ||
133 | * The frame resulting from secure processing has a length that is | ||
134 | * greater than aMACMaxFrameSize. | ||
135 | */ | ||
136 | IEEE802154_FRAME_TOO_LONG = 0xe5, | ||
137 | /* | ||
138 | * The requested GTS transmission failed because the specified GTS | ||
139 | * either did not have a transmit GTS direction or was not defined. | ||
140 | */ | ||
141 | IEEE802154_INVALID_GTS = 0xe6, | ||
142 | /* | ||
143 | * A request to purge an MSDU from the transaction queue was made using | ||
144 | * an MSDU handle that was not found in the transaction table. | ||
145 | */ | ||
146 | IEEE802154_INVALID_HANDLE = 0xe7, | ||
147 | /* A parameter in the primitive is out of the valid range.*/ | ||
148 | IEEE802154_INVALID_PARAMETER = 0xe8, | ||
149 | /* No acknowledgment was received after aMaxFrameRetries. */ | ||
150 | IEEE802154_NO_ACK = 0xe9, | ||
151 | /* A scan operation failed to find any network beacons.*/ | ||
152 | IEEE802154_NO_BEACON = 0xea, | ||
153 | /* No response data were available following a request. */ | ||
154 | IEEE802154_NO_DATA = 0xeb, | ||
155 | /* The operation failed because a short address was not allocated. */ | ||
156 | IEEE802154_NO_SHORT_ADDRESS = 0xec, | ||
157 | /* | ||
158 | * A receiver enable request was unsuccessful because it could not be | ||
159 | * completed within the CAP. | ||
160 | */ | ||
161 | IEEE802154_OUT_OF_CAP = 0xed, | ||
162 | /* | ||
163 | * A PAN identifier conflict has been detected and communicated to the | ||
164 | * PAN coordinator. | ||
165 | */ | ||
166 | IEEE802154_PANID_CONFLICT = 0xee, | ||
167 | /* A coordinator realignment command has been received. */ | ||
168 | IEEE802154_REALIGMENT = 0xef, | ||
169 | /* The transaction has expired and its information discarded. */ | ||
170 | IEEE802154_TRANSACTION_EXPIRED = 0xf0, | ||
171 | /* There is no capacity to store the transaction. */ | ||
172 | IEEE802154_TRANSACTION_OVERFLOW = 0xf1, | ||
173 | /* | ||
174 | * The transceiver was in the transmitter enabled state when the | ||
175 | * receiver was requested to be enabled. | ||
176 | */ | ||
177 | IEEE802154_TX_ACTIVE = 0xf2, | ||
178 | /* The appropriate key is not available in the ACL. */ | ||
179 | IEEE802154_UNAVAILABLE_KEY = 0xf3, | ||
180 | /* | ||
181 | * A SET/GET request was issued with the identifier of a PIB attribute | ||
182 | * that is not supported. | ||
183 | */ | ||
184 | IEEE802154_UNSUPPORTED_ATTR = 0xf4, | ||
185 | /* | ||
186 | * A request to perform a scan operation failed because the MLME was | ||
187 | * in the process of performing a previously initiated scan operation. | ||
188 | */ | ||
189 | IEEE802154_SCAN_IN_PROGRESS = 0xfc, | ||
190 | }; | ||
191 | |||
192 | |||
193 | #endif | ||
194 | |||
195 | |||
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h index 3b53c8e405e4..83bb8a73d23c 100644 --- a/include/net/ieee802154_netdev.h +++ b/include/net/ieee802154_netdev.h | |||
@@ -12,10 +12,6 @@ | |||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | * | ||
19 | * Written by: | 15 | * Written by: |
20 | * Pavel Smolenskiy <pavel.smolenskiy@gmail.com> | 16 | * Pavel Smolenskiy <pavel.smolenskiy@gmail.com> |
21 | * Maxim Gorbachyov <maxim.gorbachev@siemens.com> | 17 | * Maxim Gorbachyov <maxim.gorbachev@siemens.com> |
@@ -27,10 +23,10 @@ | |||
27 | #ifndef IEEE802154_NETDEVICE_H | 23 | #ifndef IEEE802154_NETDEVICE_H |
28 | #define IEEE802154_NETDEVICE_H | 24 | #define IEEE802154_NETDEVICE_H |
29 | 25 | ||
30 | #include <net/ieee802154.h> | ||
31 | #include <net/af_ieee802154.h> | 26 | #include <net/af_ieee802154.h> |
32 | #include <linux/netdevice.h> | 27 | #include <linux/netdevice.h> |
33 | #include <linux/skbuff.h> | 28 | #include <linux/skbuff.h> |
29 | #include <linux/ieee802154.h> | ||
34 | 30 | ||
35 | struct ieee802154_sechdr { | 31 | struct ieee802154_sechdr { |
36 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 32 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
@@ -427,8 +423,6 @@ struct ieee802154_mlme_ops { | |||
427 | 423 | ||
428 | /* The fields below are required. */ | 424 | /* The fields below are required. */ |
429 | 425 | ||
430 | struct wpan_phy *(*get_phy)(const struct net_device *dev); | ||
431 | |||
432 | /* | 426 | /* |
433 | * FIXME: these should become the part of PIB/MIB interface. | 427 | * FIXME: these should become the part of PIB/MIB interface. |
434 | * However we still don't have IB interface of any kind | 428 | * However we still don't have IB interface of any kind |
@@ -438,16 +432,6 @@ struct ieee802154_mlme_ops { | |||
438 | u8 (*get_dsn)(const struct net_device *dev); | 432 | u8 (*get_dsn)(const struct net_device *dev); |
439 | }; | 433 | }; |
440 | 434 | ||
441 | /* The IEEE 802.15.4 standard defines 2 type of the devices: | ||
442 | * - FFD - full functionality device | ||
443 | * - RFD - reduce functionality device | ||
444 | * | ||
445 | * So 2 sets of mlme operations are needed | ||
446 | */ | ||
447 | struct ieee802154_reduced_mlme_ops { | ||
448 | struct wpan_phy *(*get_phy)(const struct net_device *dev); | ||
449 | }; | ||
450 | |||
451 | static inline struct ieee802154_mlme_ops * | 435 | static inline struct ieee802154_mlme_ops * |
452 | ieee802154_mlme_ops(const struct net_device *dev) | 436 | ieee802154_mlme_ops(const struct net_device *dev) |
453 | { | 437 | { |
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index d1d272843b3b..9201afe083fa 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
@@ -99,4 +99,14 @@ struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, | |||
99 | const struct in6_addr *daddr, const __be16 dport, | 99 | const struct in6_addr *daddr, const __be16 dport, |
100 | const int dif); | 100 | const int dif); |
101 | #endif /* IS_ENABLED(CONFIG_IPV6) */ | 101 | #endif /* IS_ENABLED(CONFIG_IPV6) */ |
102 | |||
103 | #define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \ | ||
104 | (((__sk)->sk_portpair == (__ports)) && \ | ||
105 | ((__sk)->sk_family == AF_INET6) && \ | ||
106 | ipv6_addr_equal(&(__sk)->sk_v6_daddr, (__saddr)) && \ | ||
107 | ipv6_addr_equal(&(__sk)->sk_v6_rcv_saddr, (__daddr)) && \ | ||
108 | (!(__sk)->sk_bound_dev_if || \ | ||
109 | ((__sk)->sk_bound_dev_if == (__dif))) && \ | ||
110 | net_eq(sock_net(__sk), (__net))) | ||
111 | |||
102 | #endif /* _INET6_HASHTABLES_H */ | 112 | #endif /* _INET6_HASHTABLES_H */ |
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h index a5593dab6af7..9326c41c2d7f 100644 --- a/include/net/ip6_tunnel.h +++ b/include/net/ip6_tunnel.h | |||
@@ -65,7 +65,8 @@ void ip6_tnl_dst_reset(struct ip6_tnl *t); | |||
65 | void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst); | 65 | void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst); |
66 | int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, | 66 | int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, |
67 | const struct in6_addr *raddr); | 67 | const struct in6_addr *raddr); |
68 | int ip6_tnl_xmit_ctl(struct ip6_tnl *t); | 68 | int ip6_tnl_xmit_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, |
69 | const struct in6_addr *raddr); | ||
69 | __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw); | 70 | __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw); |
70 | __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr, | 71 | __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr, |
71 | const struct in6_addr *raddr); | 72 | const struct in6_addr *raddr); |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index dc9d2a27c315..09a819ee2151 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -201,8 +201,8 @@ void fib_free_table(struct fib_table *tb); | |||
201 | 201 | ||
202 | #ifndef CONFIG_IP_MULTIPLE_TABLES | 202 | #ifndef CONFIG_IP_MULTIPLE_TABLES |
203 | 203 | ||
204 | #define TABLE_LOCAL_INDEX 0 | 204 | #define TABLE_LOCAL_INDEX (RT_TABLE_LOCAL & (FIB_TABLE_HASHSZ - 1)) |
205 | #define TABLE_MAIN_INDEX 1 | 205 | #define TABLE_MAIN_INDEX (RT_TABLE_MAIN & (FIB_TABLE_HASHSZ - 1)) |
206 | 206 | ||
207 | static inline struct fib_table *fib_get_table(struct net *net, u32 id) | 207 | static inline struct fib_table *fib_get_table(struct net *net, u32 id) |
208 | { | 208 | { |
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 5bc6edeb7143..25a59eb388a6 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h | |||
@@ -117,6 +117,22 @@ struct ip_tunnel_net { | |||
117 | struct hlist_head tunnels[IP_TNL_HASH_SIZE]; | 117 | struct hlist_head tunnels[IP_TNL_HASH_SIZE]; |
118 | }; | 118 | }; |
119 | 119 | ||
120 | struct ip_tunnel_encap_ops { | ||
121 | size_t (*encap_hlen)(struct ip_tunnel_encap *e); | ||
122 | int (*build_header)(struct sk_buff *skb, struct ip_tunnel_encap *e, | ||
123 | u8 *protocol, struct flowi4 *fl4); | ||
124 | }; | ||
125 | |||
126 | #define MAX_IPTUN_ENCAP_OPS 8 | ||
127 | |||
128 | extern const struct ip_tunnel_encap_ops __rcu * | ||
129 | iptun_encaps[MAX_IPTUN_ENCAP_OPS]; | ||
130 | |||
131 | int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *op, | ||
132 | unsigned int num); | ||
133 | int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *op, | ||
134 | unsigned int num); | ||
135 | |||
120 | #ifdef CONFIG_INET | 136 | #ifdef CONFIG_INET |
121 | 137 | ||
122 | int ip_tunnel_init(struct net_device *dev); | 138 | int ip_tunnel_init(struct net_device *dev); |
diff --git a/include/net/ipx.h b/include/net/ipx.h index 0143180fecc9..e5cff6811b30 100644 --- a/include/net/ipx.h +++ b/include/net/ipx.h | |||
@@ -42,6 +42,9 @@ struct ipxhdr { | |||
42 | struct ipx_address ipx_source __packed; | 42 | struct ipx_address ipx_source __packed; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | /* From af_ipx.c */ | ||
46 | extern int sysctl_ipx_pprop_broadcasting; | ||
47 | |||
45 | static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) | 48 | static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) |
46 | { | 49 | { |
47 | return (struct ipxhdr *)skb_transport_header(skb); | 50 | return (struct ipxhdr *)skb_transport_header(skb); |
@@ -147,7 +150,7 @@ int ipxrtr_add_route(__be32 network, struct ipx_interface *intrfc, | |||
147 | unsigned char *node); | 150 | unsigned char *node); |
148 | void ipxrtr_del_routes(struct ipx_interface *intrfc); | 151 | void ipxrtr_del_routes(struct ipx_interface *intrfc); |
149 | int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, | 152 | int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, |
150 | struct iovec *iov, size_t len, int noblock); | 153 | struct msghdr *msg, size_t len, int noblock); |
151 | int ipxrtr_route_skb(struct sk_buff *skb); | 154 | int ipxrtr_route_skb(struct sk_buff *skb); |
152 | struct ipx_route *ipxrtr_lookup(__be32 net); | 155 | struct ipx_route *ipxrtr_lookup(__be32 net); |
153 | int ipxrtr_ioctl(unsigned int cmd, void __user *arg); | 156 | int ipxrtr_ioctl(unsigned int cmd, void __user *arg); |
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h index a059465101ff..92c8fb575213 100644 --- a/include/net/irda/irda.h +++ b/include/net/irda/irda.h | |||
@@ -55,16 +55,6 @@ typedef __u32 magic_t; | |||
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | #ifdef CONFIG_IRDA_DEBUG | 57 | #ifdef CONFIG_IRDA_DEBUG |
58 | |||
59 | extern unsigned int irda_debug; | ||
60 | |||
61 | /* use 0 for production, 1 for verification, >2 for debug */ | ||
62 | #define IRDA_DEBUG_LEVEL 0 | ||
63 | |||
64 | #define IRDA_DEBUG(n, args...) \ | ||
65 | do { if (irda_debug >= (n)) \ | ||
66 | printk(KERN_DEBUG args); \ | ||
67 | } while (0) | ||
68 | #define IRDA_ASSERT(expr, func) \ | 58 | #define IRDA_ASSERT(expr, func) \ |
69 | do { if(!(expr)) { \ | 59 | do { if(!(expr)) { \ |
70 | printk( "Assertion failed! %s:%s:%d %s\n", \ | 60 | printk( "Assertion failed! %s:%s:%d %s\n", \ |
@@ -72,15 +62,10 @@ do { if(!(expr)) { \ | |||
72 | func } } while (0) | 62 | func } } while (0) |
73 | #define IRDA_ASSERT_LABEL(label) label | 63 | #define IRDA_ASSERT_LABEL(label) label |
74 | #else | 64 | #else |
75 | #define IRDA_DEBUG(n, args...) do { } while (0) | ||
76 | #define IRDA_ASSERT(expr, func) do { (void)(expr); } while (0) | 65 | #define IRDA_ASSERT(expr, func) do { (void)(expr); } while (0) |
77 | #define IRDA_ASSERT_LABEL(label) | 66 | #define IRDA_ASSERT_LABEL(label) |
78 | #endif /* CONFIG_IRDA_DEBUG */ | 67 | #endif /* CONFIG_IRDA_DEBUG */ |
79 | 68 | ||
80 | #define IRDA_WARNING(args...) do { if (net_ratelimit()) printk(KERN_WARNING args); } while (0) | ||
81 | #define IRDA_MESSAGE(args...) do { if (net_ratelimit()) printk(KERN_INFO args); } while (0) | ||
82 | #define IRDA_ERROR(args...) do { if (net_ratelimit()) printk(KERN_ERR args); } while (0) | ||
83 | |||
84 | /* | 69 | /* |
85 | * Magic numbers used by Linux-IrDA. Random numbers which must be unique to | 70 | * Magic numbers used by Linux-IrDA. Random numbers which must be unique to |
86 | * give the best protection | 71 | * give the best protection |
diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h index fb4b76d5d7f1..6f23e820618c 100644 --- a/include/net/irda/irlap.h +++ b/include/net/irda/irlap.h | |||
@@ -303,7 +303,7 @@ static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state) | |||
303 | if (!self || self->magic != LAP_MAGIC) | 303 | if (!self || self->magic != LAP_MAGIC) |
304 | return; | 304 | return; |
305 | 305 | ||
306 | IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]); | 306 | pr_debug("next LAP state = %s\n", irlap_state[state]); |
307 | */ | 307 | */ |
308 | self->state = state; | 308 | self->state = state; |
309 | } | 309 | } |
diff --git a/include/net/irda/parameters.h b/include/net/irda/parameters.h index 42713c931d1f..2d9cd0007cba 100644 --- a/include/net/irda/parameters.h +++ b/include/net/irda/parameters.h | |||
@@ -71,17 +71,17 @@ typedef int (*PV_HANDLER)(void *self, __u8 *buf, int len, __u8 pi, | |||
71 | PV_TYPE type, PI_HANDLER func); | 71 | PV_TYPE type, PI_HANDLER func); |
72 | 72 | ||
73 | typedef struct { | 73 | typedef struct { |
74 | PI_HANDLER func; /* Handler for this parameter identifier */ | 74 | const PI_HANDLER func; /* Handler for this parameter identifier */ |
75 | PV_TYPE type; /* Data type for this parameter */ | 75 | PV_TYPE type; /* Data type for this parameter */ |
76 | } pi_minor_info_t; | 76 | } pi_minor_info_t; |
77 | 77 | ||
78 | typedef struct { | 78 | typedef struct { |
79 | pi_minor_info_t *pi_minor_call_table; | 79 | const pi_minor_info_t *pi_minor_call_table; |
80 | int len; | 80 | int len; |
81 | } pi_major_info_t; | 81 | } pi_major_info_t; |
82 | 82 | ||
83 | typedef struct { | 83 | typedef struct { |
84 | pi_major_info_t *tables; | 84 | const pi_major_info_t *tables; |
85 | int len; | 85 | int len; |
86 | __u8 pi_mask; | 86 | __u8 pi_mask; |
87 | int pi_major_offset; | 87 | int pi_major_offset; |
diff --git a/include/net/llc_c_st.h b/include/net/llc_c_st.h index 0e79cfba4b3b..48f3f891b2f9 100644 --- a/include/net/llc_c_st.h +++ b/include/net/llc_c_st.h | |||
@@ -35,8 +35,8 @@ | |||
35 | struct llc_conn_state_trans { | 35 | struct llc_conn_state_trans { |
36 | llc_conn_ev_t ev; | 36 | llc_conn_ev_t ev; |
37 | u8 next_state; | 37 | u8 next_state; |
38 | llc_conn_ev_qfyr_t *ev_qualifiers; | 38 | const llc_conn_ev_qfyr_t *ev_qualifiers; |
39 | llc_conn_action_t *ev_actions; | 39 | const llc_conn_action_t *ev_actions; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct llc_conn_state { | 42 | struct llc_conn_state { |
diff --git a/include/net/llc_s_st.h b/include/net/llc_s_st.h index 567c681f1f3e..c4359e203013 100644 --- a/include/net/llc_s_st.h +++ b/include/net/llc_s_st.h | |||
@@ -19,7 +19,7 @@ | |||
19 | struct llc_sap_state_trans { | 19 | struct llc_sap_state_trans { |
20 | llc_sap_ev_t ev; | 20 | llc_sap_ev_t ev; |
21 | u8 next_state; | 21 | u8 next_state; |
22 | llc_sap_action_t *ev_actions; | 22 | const llc_sap_action_t *ev_actions; |
23 | }; | 23 | }; |
24 | 24 | ||
25 | struct llc_sap_state { | 25 | struct llc_sap_state { |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 0ad1f47d2dc7..58d719ddaa60 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -263,6 +263,7 @@ struct ieee80211_vif_chanctx_switch { | |||
263 | * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed, | 263 | * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed, |
264 | * note that this is only called when it changes after the channel | 264 | * note that this is only called when it changes after the channel |
265 | * context had been assigned. | 265 | * context had been assigned. |
266 | * @BSS_CHANGED_OCB: OCB join status changed | ||
266 | */ | 267 | */ |
267 | enum ieee80211_bss_change { | 268 | enum ieee80211_bss_change { |
268 | BSS_CHANGED_ASSOC = 1<<0, | 269 | BSS_CHANGED_ASSOC = 1<<0, |
@@ -287,6 +288,7 @@ enum ieee80211_bss_change { | |||
287 | BSS_CHANGED_P2P_PS = 1<<19, | 288 | BSS_CHANGED_P2P_PS = 1<<19, |
288 | BSS_CHANGED_BEACON_INFO = 1<<20, | 289 | BSS_CHANGED_BEACON_INFO = 1<<20, |
289 | BSS_CHANGED_BANDWIDTH = 1<<21, | 290 | BSS_CHANGED_BANDWIDTH = 1<<21, |
291 | BSS_CHANGED_OCB = 1<<22, | ||
290 | 292 | ||
291 | /* when adding here, make sure to change ieee80211_reconfig */ | 293 | /* when adding here, make sure to change ieee80211_reconfig */ |
292 | }; | 294 | }; |
@@ -739,7 +741,8 @@ struct ieee80211_tx_info { | |||
739 | u8 ampdu_ack_len; | 741 | u8 ampdu_ack_len; |
740 | u8 ampdu_len; | 742 | u8 ampdu_len; |
741 | u8 antenna; | 743 | u8 antenna; |
742 | void *status_driver_data[21 / sizeof(void *)]; | 744 | u16 tx_time; |
745 | void *status_driver_data[19 / sizeof(void *)]; | ||
743 | } status; | 746 | } status; |
744 | struct { | 747 | struct { |
745 | struct ieee80211_tx_rate driver_rates[ | 748 | struct ieee80211_tx_rate driver_rates[ |
@@ -879,6 +882,9 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
879 | * subframes share the same sequence number. Reported subframes can be | 882 | * subframes share the same sequence number. Reported subframes can be |
880 | * either regular MSDU or singly A-MSDUs. Subframes must not be | 883 | * either regular MSDU or singly A-MSDUs. Subframes must not be |
881 | * interleaved with other frames. | 884 | * interleaved with other frames. |
885 | * @RX_FLAG_RADIOTAP_VENDOR_DATA: This frame contains vendor-specific | ||
886 | * radiotap data in the skb->data (before the frame) as described by | ||
887 | * the &struct ieee80211_vendor_radiotap. | ||
882 | */ | 888 | */ |
883 | enum mac80211_rx_flags { | 889 | enum mac80211_rx_flags { |
884 | RX_FLAG_MMIC_ERROR = BIT(0), | 890 | RX_FLAG_MMIC_ERROR = BIT(0), |
@@ -908,6 +914,7 @@ enum mac80211_rx_flags { | |||
908 | RX_FLAG_10MHZ = BIT(28), | 914 | RX_FLAG_10MHZ = BIT(28), |
909 | RX_FLAG_5MHZ = BIT(29), | 915 | RX_FLAG_5MHZ = BIT(29), |
910 | RX_FLAG_AMSDU_MORE = BIT(30), | 916 | RX_FLAG_AMSDU_MORE = BIT(30), |
917 | RX_FLAG_RADIOTAP_VENDOR_DATA = BIT(31), | ||
911 | }; | 918 | }; |
912 | 919 | ||
913 | #define RX_FLAG_STBC_SHIFT 26 | 920 | #define RX_FLAG_STBC_SHIFT 26 |
@@ -979,6 +986,39 @@ struct ieee80211_rx_status { | |||
979 | }; | 986 | }; |
980 | 987 | ||
981 | /** | 988 | /** |
989 | * struct ieee80211_vendor_radiotap - vendor radiotap data information | ||
990 | * @present: presence bitmap for this vendor namespace | ||
991 | * (this could be extended in the future if any vendor needs more | ||
992 | * bits, the radiotap spec does allow for that) | ||
993 | * @align: radiotap vendor namespace alignment. This defines the needed | ||
994 | * alignment for the @data field below, not for the vendor namespace | ||
995 | * description itself (which has a fixed 2-byte alignment) | ||
996 | * Must be a power of two, and be set to at least 1! | ||
997 | * @oui: radiotap vendor namespace OUI | ||
998 | * @subns: radiotap vendor sub namespace | ||
999 | * @len: radiotap vendor sub namespace skip length, if alignment is done | ||
1000 | * then that's added to this, i.e. this is only the length of the | ||
1001 | * @data field. | ||
1002 | * @pad: number of bytes of padding after the @data, this exists so that | ||
1003 | * the skb data alignment can be preserved even if the data has odd | ||
1004 | * length | ||
1005 | * @data: the actual vendor namespace data | ||
1006 | * | ||
1007 | * This struct, including the vendor data, goes into the skb->data before | ||
1008 | * the 802.11 header. It's split up in mac80211 using the align/oui/subns | ||
1009 | * data. | ||
1010 | */ | ||
1011 | struct ieee80211_vendor_radiotap { | ||
1012 | u32 present; | ||
1013 | u8 align; | ||
1014 | u8 oui[3]; | ||
1015 | u8 subns; | ||
1016 | u8 pad; | ||
1017 | u16 len; | ||
1018 | u8 data[]; | ||
1019 | } __packed; | ||
1020 | |||
1021 | /** | ||
982 | * enum ieee80211_conf_flags - configuration flags | 1022 | * enum ieee80211_conf_flags - configuration flags |
983 | * | 1023 | * |
984 | * Flags to define PHY configuration options | 1024 | * Flags to define PHY configuration options |
@@ -1117,6 +1157,8 @@ struct ieee80211_conf { | |||
1117 | * Function (TSF) timer when the frame containing the channel switch | 1157 | * Function (TSF) timer when the frame containing the channel switch |
1118 | * announcement was received. This is simply the rx.mactime parameter | 1158 | * announcement was received. This is simply the rx.mactime parameter |
1119 | * the driver passed into mac80211. | 1159 | * the driver passed into mac80211. |
1160 | * @device_timestamp: arbitrary timestamp for the device, this is the | ||
1161 | * rx.device_timestamp parameter the driver passed to mac80211. | ||
1120 | * @block_tx: Indicates whether transmission must be blocked before the | 1162 | * @block_tx: Indicates whether transmission must be blocked before the |
1121 | * scheduled channel switch, as indicated by the AP. | 1163 | * scheduled channel switch, as indicated by the AP. |
1122 | * @chandef: the new channel to switch to | 1164 | * @chandef: the new channel to switch to |
@@ -1124,6 +1166,7 @@ struct ieee80211_conf { | |||
1124 | */ | 1166 | */ |
1125 | struct ieee80211_channel_switch { | 1167 | struct ieee80211_channel_switch { |
1126 | u64 timestamp; | 1168 | u64 timestamp; |
1169 | u32 device_timestamp; | ||
1127 | bool block_tx; | 1170 | bool block_tx; |
1128 | struct cfg80211_chan_def chandef; | 1171 | struct cfg80211_chan_def chandef; |
1129 | u8 count; | 1172 | u8 count; |
@@ -1423,6 +1466,8 @@ struct ieee80211_sta_rates { | |||
1423 | * @smps_mode: current SMPS mode (off, static or dynamic) | 1466 | * @smps_mode: current SMPS mode (off, static or dynamic) |
1424 | * @rates: rate control selection table | 1467 | * @rates: rate control selection table |
1425 | * @tdls: indicates whether the STA is a TDLS peer | 1468 | * @tdls: indicates whether the STA is a TDLS peer |
1469 | * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only | ||
1470 | * valid if the STA is a TDLS peer in the first place. | ||
1426 | */ | 1471 | */ |
1427 | struct ieee80211_sta { | 1472 | struct ieee80211_sta { |
1428 | u32 supp_rates[IEEE80211_NUM_BANDS]; | 1473 | u32 supp_rates[IEEE80211_NUM_BANDS]; |
@@ -1438,6 +1483,7 @@ struct ieee80211_sta { | |||
1438 | enum ieee80211_smps_mode smps_mode; | 1483 | enum ieee80211_smps_mode smps_mode; |
1439 | struct ieee80211_sta_rates __rcu *rates; | 1484 | struct ieee80211_sta_rates __rcu *rates; |
1440 | bool tdls; | 1485 | bool tdls; |
1486 | bool tdls_initiator; | ||
1441 | 1487 | ||
1442 | /* must be last */ | 1488 | /* must be last */ |
1443 | u8 drv_priv[0] __aligned(sizeof(void *)); | 1489 | u8 drv_priv[0] __aligned(sizeof(void *)); |
@@ -1576,6 +1622,10 @@ struct ieee80211_tx_control { | |||
1576 | * a virtual monitor interface when monitor interfaces are the only | 1622 | * a virtual monitor interface when monitor interfaces are the only |
1577 | * active interfaces. | 1623 | * active interfaces. |
1578 | * | 1624 | * |
1625 | * @IEEE80211_HW_NO_AUTO_VIF: The driver would like for no wlanX to | ||
1626 | * be created. It is expected user-space will create vifs as | ||
1627 | * desired (and thus have them named as desired). | ||
1628 | * | ||
1579 | * @IEEE80211_HW_QUEUE_CONTROL: The driver wants to control per-interface | 1629 | * @IEEE80211_HW_QUEUE_CONTROL: The driver wants to control per-interface |
1580 | * queue mapping in order to use different queues (not just one per AC) | 1630 | * queue mapping in order to use different queues (not just one per AC) |
1581 | * for different virtual interfaces. See the doc section on HW queue | 1631 | * for different virtual interfaces. See the doc section on HW queue |
@@ -1622,7 +1672,8 @@ enum ieee80211_hw_flags { | |||
1622 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, | 1672 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, |
1623 | IEEE80211_HW_MFP_CAPABLE = 1<<13, | 1673 | IEEE80211_HW_MFP_CAPABLE = 1<<13, |
1624 | IEEE80211_HW_WANT_MONITOR_VIF = 1<<14, | 1674 | IEEE80211_HW_WANT_MONITOR_VIF = 1<<14, |
1625 | /* free slots */ | 1675 | IEEE80211_HW_NO_AUTO_VIF = 1<<15, |
1676 | /* free slot */ | ||
1626 | IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, | 1677 | IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, |
1627 | IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, | 1678 | IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, |
1628 | IEEE80211_HW_CONNECTION_MONITOR = 1<<19, | 1679 | IEEE80211_HW_CONNECTION_MONITOR = 1<<19, |
@@ -1776,6 +1827,31 @@ struct ieee80211_scan_request { | |||
1776 | }; | 1827 | }; |
1777 | 1828 | ||
1778 | /** | 1829 | /** |
1830 | * struct ieee80211_tdls_ch_sw_params - TDLS channel switch parameters | ||
1831 | * | ||
1832 | * @sta: peer this TDLS channel-switch request/response came from | ||
1833 | * @chandef: channel referenced in a TDLS channel-switch request | ||
1834 | * @action_code: see &enum ieee80211_tdls_actioncode | ||
1835 | * @status: channel-switch response status | ||
1836 | * @timestamp: time at which the frame was received | ||
1837 | * @switch_time: switch-timing parameter received in the frame | ||
1838 | * @switch_timeout: switch-timing parameter received in the frame | ||
1839 | * @tmpl_skb: TDLS switch-channel response template | ||
1840 | * @ch_sw_tm_ie: offset of the channel-switch timing IE inside @tmpl_skb | ||
1841 | */ | ||
1842 | struct ieee80211_tdls_ch_sw_params { | ||
1843 | struct ieee80211_sta *sta; | ||
1844 | struct cfg80211_chan_def *chandef; | ||
1845 | u8 action_code; | ||
1846 | u32 status; | ||
1847 | u32 timestamp; | ||
1848 | u16 switch_time; | ||
1849 | u16 switch_timeout; | ||
1850 | struct sk_buff *tmpl_skb; | ||
1851 | u32 ch_sw_tm_ie; | ||
1852 | }; | ||
1853 | |||
1854 | /** | ||
1779 | * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy | 1855 | * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy |
1780 | * | 1856 | * |
1781 | * @wiphy: the &struct wiphy which we want to query | 1857 | * @wiphy: the &struct wiphy which we want to query |
@@ -2375,6 +2451,22 @@ enum ieee80211_roc_type { | |||
2375 | }; | 2451 | }; |
2376 | 2452 | ||
2377 | /** | 2453 | /** |
2454 | * enum ieee80211_reconfig_complete_type - reconfig type | ||
2455 | * | ||
2456 | * This enum is used by the reconfig_complete() callback to indicate what | ||
2457 | * reconfiguration type was completed. | ||
2458 | * | ||
2459 | * @IEEE80211_RECONFIG_TYPE_RESTART: hw restart type | ||
2460 | * (also due to resume() callback returning 1) | ||
2461 | * @IEEE80211_RECONFIG_TYPE_SUSPEND: suspend type (regardless | ||
2462 | * of wowlan configuration) | ||
2463 | */ | ||
2464 | enum ieee80211_reconfig_type { | ||
2465 | IEEE80211_RECONFIG_TYPE_RESTART, | ||
2466 | IEEE80211_RECONFIG_TYPE_SUSPEND, | ||
2467 | }; | ||
2468 | |||
2469 | /** | ||
2378 | * struct ieee80211_ops - callbacks from mac80211 to the driver | 2470 | * struct ieee80211_ops - callbacks from mac80211 to the driver |
2379 | * | 2471 | * |
2380 | * This structure contains various callbacks that the driver may | 2472 | * This structure contains various callbacks that the driver may |
@@ -2530,7 +2622,9 @@ enum ieee80211_roc_type { | |||
2530 | * | 2622 | * |
2531 | * @sw_scan_start: Notifier function that is called just before a software scan | 2623 | * @sw_scan_start: Notifier function that is called just before a software scan |
2532 | * is started. Can be NULL, if the driver doesn't need this notification. | 2624 | * is started. Can be NULL, if the driver doesn't need this notification. |
2533 | * The callback can sleep. | 2625 | * The mac_addr parameter allows supporting NL80211_SCAN_FLAG_RANDOM_ADDR, |
2626 | * the driver may set the NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR flag if it | ||
2627 | * can use this parameter. The callback can sleep. | ||
2534 | * | 2628 | * |
2535 | * @sw_scan_complete: Notifier function that is called just after a | 2629 | * @sw_scan_complete: Notifier function that is called just after a |
2536 | * software scan finished. Can be NULL, if the driver doesn't need | 2630 | * software scan finished. Can be NULL, if the driver doesn't need |
@@ -2601,6 +2695,9 @@ enum ieee80211_roc_type { | |||
2601 | * uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since | 2695 | * uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since |
2602 | * otherwise the rate control algorithm is notified directly. | 2696 | * otherwise the rate control algorithm is notified directly. |
2603 | * Must be atomic. | 2697 | * Must be atomic. |
2698 | * @sta_rate_tbl_update: Notifies the driver that the rate table changed. This | ||
2699 | * is only used if the configured rate control algorithm actually uses | ||
2700 | * the new rate table API, and is therefore optional. Must be atomic. | ||
2604 | * | 2701 | * |
2605 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | 2702 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), |
2606 | * bursting) for a hardware TX queue. | 2703 | * bursting) for a hardware TX queue. |
@@ -2809,11 +2906,11 @@ enum ieee80211_roc_type { | |||
2809 | * disabled/enabled via @bss_info_changed. | 2906 | * disabled/enabled via @bss_info_changed. |
2810 | * @stop_ap: Stop operation on the AP interface. | 2907 | * @stop_ap: Stop operation on the AP interface. |
2811 | * | 2908 | * |
2812 | * @restart_complete: Called after a call to ieee80211_restart_hw(), when the | 2909 | * @reconfig_complete: Called after a call to ieee80211_restart_hw() and |
2813 | * reconfiguration has completed. This can help the driver implement the | 2910 | * during resume, when the reconfiguration has completed. |
2814 | * reconfiguration step. Also called when reconfiguring because the | 2911 | * This can help the driver implement the reconfiguration step (and |
2815 | * driver's resume function returned 1, as this is just like an "inline" | 2912 | * indicate mac80211 is ready to receive frames). |
2816 | * hardware restart. This callback may sleep. | 2913 | * This callback may sleep. |
2817 | * | 2914 | * |
2818 | * @ipv6_addr_change: IPv6 address assignment on the given interface changed. | 2915 | * @ipv6_addr_change: IPv6 address assignment on the given interface changed. |
2819 | * Currently, this is only called for managed or P2P client interfaces. | 2916 | * Currently, this is only called for managed or P2P client interfaces. |
@@ -2829,6 +2926,13 @@ enum ieee80211_roc_type { | |||
2829 | * transmitted and then call ieee80211_csa_finish(). | 2926 | * transmitted and then call ieee80211_csa_finish(). |
2830 | * If the CSA count starts as zero or 1, this function will not be called, | 2927 | * If the CSA count starts as zero or 1, this function will not be called, |
2831 | * since there won't be any time to beacon before the switch anyway. | 2928 | * since there won't be any time to beacon before the switch anyway. |
2929 | * @pre_channel_switch: This is an optional callback that is called | ||
2930 | * before a channel switch procedure is started (ie. when a STA | ||
2931 | * gets a CSA or an userspace initiated channel-switch), allowing | ||
2932 | * the driver to prepare for the channel switch. | ||
2933 | * @post_channel_switch: This is an optional callback that is called | ||
2934 | * after a channel switch procedure is completed, allowing the | ||
2935 | * driver to go back to a normal configuration. | ||
2832 | * | 2936 | * |
2833 | * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all | 2937 | * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all |
2834 | * information in bss_conf is set up and the beacon can be retrieved. A | 2938 | * information in bss_conf is set up and the beacon can be retrieved. A |
@@ -2838,6 +2942,26 @@ enum ieee80211_roc_type { | |||
2838 | * @get_expected_throughput: extract the expected throughput towards the | 2942 | * @get_expected_throughput: extract the expected throughput towards the |
2839 | * specified station. The returned value is expressed in Kbps. It returns 0 | 2943 | * specified station. The returned value is expressed in Kbps. It returns 0 |
2840 | * if the RC algorithm does not have proper data to provide. | 2944 | * if the RC algorithm does not have proper data to provide. |
2945 | * | ||
2946 | * @get_txpower: get current maximum tx power (in dBm) based on configuration | ||
2947 | * and hardware limits. | ||
2948 | * | ||
2949 | * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver | ||
2950 | * is responsible for continually initiating channel-switching operations | ||
2951 | * and returning to the base channel for communication with the AP. The | ||
2952 | * driver receives a channel-switch request template and the location of | ||
2953 | * the switch-timing IE within the template as part of the invocation. | ||
2954 | * The template is valid only within the call, and the driver can | ||
2955 | * optionally copy the skb for further re-use. | ||
2956 | * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both | ||
2957 | * peers must be on the base channel when the call completes. | ||
2958 | * @tdls_recv_channel_switch: a TDLS channel-switch related frame (request or | ||
2959 | * response) has been received from a remote peer. The driver gets | ||
2960 | * parameters parsed from the incoming frame and may use them to continue | ||
2961 | * an ongoing channel-switch operation. In addition, a channel-switch | ||
2962 | * response template is provided, together with the location of the | ||
2963 | * switch-timing IE within the template. The skb can only be used within | ||
2964 | * the function call. | ||
2841 | */ | 2965 | */ |
2842 | struct ieee80211_ops { | 2966 | struct ieee80211_ops { |
2843 | void (*tx)(struct ieee80211_hw *hw, | 2967 | void (*tx)(struct ieee80211_hw *hw, |
@@ -2897,8 +3021,11 @@ struct ieee80211_ops { | |||
2897 | struct ieee80211_scan_ies *ies); | 3021 | struct ieee80211_scan_ies *ies); |
2898 | int (*sched_scan_stop)(struct ieee80211_hw *hw, | 3022 | int (*sched_scan_stop)(struct ieee80211_hw *hw, |
2899 | struct ieee80211_vif *vif); | 3023 | struct ieee80211_vif *vif); |
2900 | void (*sw_scan_start)(struct ieee80211_hw *hw); | 3024 | void (*sw_scan_start)(struct ieee80211_hw *hw, |
2901 | void (*sw_scan_complete)(struct ieee80211_hw *hw); | 3025 | struct ieee80211_vif *vif, |
3026 | const u8 *mac_addr); | ||
3027 | void (*sw_scan_complete)(struct ieee80211_hw *hw, | ||
3028 | struct ieee80211_vif *vif); | ||
2902 | int (*get_stats)(struct ieee80211_hw *hw, | 3029 | int (*get_stats)(struct ieee80211_hw *hw, |
2903 | struct ieee80211_low_level_stats *stats); | 3030 | struct ieee80211_low_level_stats *stats); |
2904 | void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, | 3031 | void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, |
@@ -2932,6 +3059,9 @@ struct ieee80211_ops { | |||
2932 | struct ieee80211_vif *vif, | 3059 | struct ieee80211_vif *vif, |
2933 | struct ieee80211_sta *sta, | 3060 | struct ieee80211_sta *sta, |
2934 | u32 changed); | 3061 | u32 changed); |
3062 | void (*sta_rate_tbl_update)(struct ieee80211_hw *hw, | ||
3063 | struct ieee80211_vif *vif, | ||
3064 | struct ieee80211_sta *sta); | ||
2935 | int (*conf_tx)(struct ieee80211_hw *hw, | 3065 | int (*conf_tx)(struct ieee80211_hw *hw, |
2936 | struct ieee80211_vif *vif, u16 ac, | 3066 | struct ieee80211_vif *vif, u16 ac, |
2937 | const struct ieee80211_tx_queue_params *params); | 3067 | const struct ieee80211_tx_queue_params *params); |
@@ -2959,6 +3089,7 @@ struct ieee80211_ops { | |||
2959 | void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 3089 | void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2960 | u32 queues, bool drop); | 3090 | u32 queues, bool drop); |
2961 | void (*channel_switch)(struct ieee80211_hw *hw, | 3091 | void (*channel_switch)(struct ieee80211_hw *hw, |
3092 | struct ieee80211_vif *vif, | ||
2962 | struct ieee80211_channel_switch *ch_switch); | 3093 | struct ieee80211_channel_switch *ch_switch); |
2963 | int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); | 3094 | int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); |
2964 | int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); | 3095 | int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); |
@@ -3025,7 +3156,8 @@ struct ieee80211_ops { | |||
3025 | int n_vifs, | 3156 | int n_vifs, |
3026 | enum ieee80211_chanctx_switch_mode mode); | 3157 | enum ieee80211_chanctx_switch_mode mode); |
3027 | 3158 | ||
3028 | void (*restart_complete)(struct ieee80211_hw *hw); | 3159 | void (*reconfig_complete)(struct ieee80211_hw *hw, |
3160 | enum ieee80211_reconfig_type reconfig_type); | ||
3029 | 3161 | ||
3030 | #if IS_ENABLED(CONFIG_IPV6) | 3162 | #if IS_ENABLED(CONFIG_IPV6) |
3031 | void (*ipv6_addr_change)(struct ieee80211_hw *hw, | 3163 | void (*ipv6_addr_change)(struct ieee80211_hw *hw, |
@@ -3035,14 +3167,54 @@ struct ieee80211_ops { | |||
3035 | void (*channel_switch_beacon)(struct ieee80211_hw *hw, | 3167 | void (*channel_switch_beacon)(struct ieee80211_hw *hw, |
3036 | struct ieee80211_vif *vif, | 3168 | struct ieee80211_vif *vif, |
3037 | struct cfg80211_chan_def *chandef); | 3169 | struct cfg80211_chan_def *chandef); |
3170 | int (*pre_channel_switch)(struct ieee80211_hw *hw, | ||
3171 | struct ieee80211_vif *vif, | ||
3172 | struct ieee80211_channel_switch *ch_switch); | ||
3173 | |||
3174 | int (*post_channel_switch)(struct ieee80211_hw *hw, | ||
3175 | struct ieee80211_vif *vif); | ||
3038 | 3176 | ||
3039 | int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); | 3177 | int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); |
3040 | void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); | 3178 | void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); |
3041 | u32 (*get_expected_throughput)(struct ieee80211_sta *sta); | 3179 | u32 (*get_expected_throughput)(struct ieee80211_sta *sta); |
3180 | int (*get_txpower)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
3181 | int *dbm); | ||
3182 | |||
3183 | int (*tdls_channel_switch)(struct ieee80211_hw *hw, | ||
3184 | struct ieee80211_vif *vif, | ||
3185 | struct ieee80211_sta *sta, u8 oper_class, | ||
3186 | struct cfg80211_chan_def *chandef, | ||
3187 | struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie); | ||
3188 | void (*tdls_cancel_channel_switch)(struct ieee80211_hw *hw, | ||
3189 | struct ieee80211_vif *vif, | ||
3190 | struct ieee80211_sta *sta); | ||
3191 | void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw, | ||
3192 | struct ieee80211_vif *vif, | ||
3193 | struct ieee80211_tdls_ch_sw_params *params); | ||
3042 | }; | 3194 | }; |
3043 | 3195 | ||
3044 | /** | 3196 | /** |
3045 | * ieee80211_alloc_hw - Allocate a new hardware device | 3197 | * ieee80211_alloc_hw_nm - Allocate a new hardware device |
3198 | * | ||
3199 | * This must be called once for each hardware device. The returned pointer | ||
3200 | * must be used to refer to this device when calling other functions. | ||
3201 | * mac80211 allocates a private data area for the driver pointed to by | ||
3202 | * @priv in &struct ieee80211_hw, the size of this area is given as | ||
3203 | * @priv_data_len. | ||
3204 | * | ||
3205 | * @priv_data_len: length of private data | ||
3206 | * @ops: callbacks for this device | ||
3207 | * @requested_name: Requested name for this device. | ||
3208 | * NULL is valid value, and means use the default naming (phy%d) | ||
3209 | * | ||
3210 | * Return: A pointer to the new hardware device, or %NULL on error. | ||
3211 | */ | ||
3212 | struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, | ||
3213 | const struct ieee80211_ops *ops, | ||
3214 | const char *requested_name); | ||
3215 | |||
3216 | /** | ||
3217 | * ieee80211_alloc_hw - Allocate a new hardware device | ||
3046 | * | 3218 | * |
3047 | * This must be called once for each hardware device. The returned pointer | 3219 | * This must be called once for each hardware device. The returned pointer |
3048 | * must be used to refer to this device when calling other functions. | 3220 | * must be used to refer to this device when calling other functions. |
@@ -3055,8 +3227,12 @@ struct ieee80211_ops { | |||
3055 | * | 3227 | * |
3056 | * Return: A pointer to the new hardware device, or %NULL on error. | 3228 | * Return: A pointer to the new hardware device, or %NULL on error. |
3057 | */ | 3229 | */ |
3230 | static inline | ||
3058 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | 3231 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, |
3059 | const struct ieee80211_ops *ops); | 3232 | const struct ieee80211_ops *ops) |
3233 | { | ||
3234 | return ieee80211_alloc_hw_nm(priv_data_len, ops, NULL); | ||
3235 | } | ||
3060 | 3236 | ||
3061 | /** | 3237 | /** |
3062 | * ieee80211_register_hw - Register hardware device | 3238 | * ieee80211_register_hw - Register hardware device |
@@ -3443,6 +3619,26 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, | |||
3443 | struct sk_buff *skb); | 3619 | struct sk_buff *skb); |
3444 | 3620 | ||
3445 | /** | 3621 | /** |
3622 | * ieee80211_tx_status_noskb - transmit status callback without skb | ||
3623 | * | ||
3624 | * This function can be used as a replacement for ieee80211_tx_status | ||
3625 | * in drivers that cannot reliably map tx status information back to | ||
3626 | * specific skbs. | ||
3627 | * | ||
3628 | * Calls to this function for a single hardware must be synchronized | ||
3629 | * against each other. Calls to this function, ieee80211_tx_status_ni() | ||
3630 | * and ieee80211_tx_status_irqsafe() may not be mixed for a single hardware. | ||
3631 | * | ||
3632 | * @hw: the hardware the frame was transmitted by | ||
3633 | * @sta: the receiver station to which this packet is sent | ||
3634 | * (NULL for multicast packets) | ||
3635 | * @info: tx status information | ||
3636 | */ | ||
3637 | void ieee80211_tx_status_noskb(struct ieee80211_hw *hw, | ||
3638 | struct ieee80211_sta *sta, | ||
3639 | struct ieee80211_tx_info *info); | ||
3640 | |||
3641 | /** | ||
3446 | * ieee80211_tx_status_ni - transmit status callback (in process context) | 3642 | * ieee80211_tx_status_ni - transmit status callback (in process context) |
3447 | * | 3643 | * |
3448 | * Like ieee80211_tx_status() but can be called in process context. | 3644 | * Like ieee80211_tx_status() but can be called in process context. |
@@ -3655,7 +3851,7 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, | |||
3655 | /** | 3851 | /** |
3656 | * ieee80211_probereq_get - retrieve a Probe Request template | 3852 | * ieee80211_probereq_get - retrieve a Probe Request template |
3657 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 3853 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
3658 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 3854 | * @src_addr: source MAC address |
3659 | * @ssid: SSID buffer | 3855 | * @ssid: SSID buffer |
3660 | * @ssid_len: length of SSID | 3856 | * @ssid_len: length of SSID |
3661 | * @tailroom: tailroom to reserve at end of SKB for IEs | 3857 | * @tailroom: tailroom to reserve at end of SKB for IEs |
@@ -3666,7 +3862,7 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, | |||
3666 | * Return: The Probe Request template. %NULL on error. | 3862 | * Return: The Probe Request template. %NULL on error. |
3667 | */ | 3863 | */ |
3668 | struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, | 3864 | struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, |
3669 | struct ieee80211_vif *vif, | 3865 | const u8 *src_addr, |
3670 | const u8 *ssid, size_t ssid_len, | 3866 | const u8 *ssid, size_t ssid_len, |
3671 | size_t tailroom); | 3867 | size_t tailroom); |
3672 | 3868 | ||
@@ -4172,6 +4368,22 @@ void ieee80211_iterate_active_interfaces_rtnl(struct ieee80211_hw *hw, | |||
4172 | void *data); | 4368 | void *data); |
4173 | 4369 | ||
4174 | /** | 4370 | /** |
4371 | * ieee80211_iterate_stations_atomic - iterate stations | ||
4372 | * | ||
4373 | * This function iterates over all stations associated with a given | ||
4374 | * hardware that are currently uploaded to the driver and calls the callback | ||
4375 | * function for them. | ||
4376 | * This function requires the iterator callback function to be atomic, | ||
4377 | * | ||
4378 | * @hw: the hardware struct of which the interfaces should be iterated over | ||
4379 | * @iterator: the iterator function to call, cannot sleep | ||
4380 | * @data: first argument of the iterator function | ||
4381 | */ | ||
4382 | void ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw, | ||
4383 | void (*iterator)(void *data, | ||
4384 | struct ieee80211_sta *sta), | ||
4385 | void *data); | ||
4386 | /** | ||
4175 | * ieee80211_queue_work - add work onto the mac80211 workqueue | 4387 | * ieee80211_queue_work - add work onto the mac80211 workqueue |
4176 | * | 4388 | * |
4177 | * Drivers and mac80211 use this to add work onto the mac80211 workqueue. | 4389 | * Drivers and mac80211 use this to add work onto the mac80211 workqueue. |
@@ -4480,6 +4692,14 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, | |||
4480 | gfp_t gfp); | 4692 | gfp_t gfp); |
4481 | 4693 | ||
4482 | /** | 4694 | /** |
4695 | * ieee80211_cqm_beacon_loss_notify - inform CQM of beacon loss | ||
4696 | * | ||
4697 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
4698 | * @gfp: context flags | ||
4699 | */ | ||
4700 | void ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp); | ||
4701 | |||
4702 | /** | ||
4483 | * ieee80211_radar_detected - inform that a radar was detected | 4703 | * ieee80211_radar_detected - inform that a radar was detected |
4484 | * | 4704 | * |
4485 | * @hw: pointer as obtained from ieee80211_alloc_hw() | 4705 | * @hw: pointer as obtained from ieee80211_alloc_hw() |
@@ -4637,6 +4857,10 @@ struct rate_control_ops { | |||
4637 | void (*free_sta)(void *priv, struct ieee80211_sta *sta, | 4857 | void (*free_sta)(void *priv, struct ieee80211_sta *sta, |
4638 | void *priv_sta); | 4858 | void *priv_sta); |
4639 | 4859 | ||
4860 | void (*tx_status_noskb)(void *priv, | ||
4861 | struct ieee80211_supported_band *sband, | ||
4862 | struct ieee80211_sta *sta, void *priv_sta, | ||
4863 | struct ieee80211_tx_info *info); | ||
4640 | void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, | 4864 | void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, |
4641 | struct ieee80211_sta *sta, void *priv_sta, | 4865 | struct ieee80211_sta *sta, void *priv_sta, |
4642 | struct sk_buff *skb); | 4866 | struct sk_buff *skb); |
@@ -4888,4 +5112,69 @@ void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf); | |||
4888 | void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer, | 5112 | void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer, |
4889 | enum nl80211_tdls_operation oper, | 5113 | enum nl80211_tdls_operation oper, |
4890 | u16 reason_code, gfp_t gfp); | 5114 | u16 reason_code, gfp_t gfp); |
5115 | |||
5116 | /** | ||
5117 | * ieee80211_reserve_tid - request to reserve a specific TID | ||
5118 | * | ||
5119 | * There is sometimes a need (such as in TDLS) for blocking the driver from | ||
5120 | * using a specific TID so that the FW can use it for certain operations such | ||
5121 | * as sending PTI requests. To make sure that the driver doesn't use that TID, | ||
5122 | * this function must be called as it flushes out packets on this TID and marks | ||
5123 | * it as blocked, so that any transmit for the station on this TID will be | ||
5124 | * redirected to the alternative TID in the same AC. | ||
5125 | * | ||
5126 | * Note that this function blocks and may call back into the driver, so it | ||
5127 | * should be called without driver locks held. Also note this function should | ||
5128 | * only be called from the driver's @sta_state callback. | ||
5129 | * | ||
5130 | * @sta: the station to reserve the TID for | ||
5131 | * @tid: the TID to reserve | ||
5132 | * | ||
5133 | * Returns: 0 on success, else on failure | ||
5134 | */ | ||
5135 | int ieee80211_reserve_tid(struct ieee80211_sta *sta, u8 tid); | ||
5136 | |||
5137 | /** | ||
5138 | * ieee80211_unreserve_tid - request to unreserve a specific TID | ||
5139 | * | ||
5140 | * Once there is no longer any need for reserving a certain TID, this function | ||
5141 | * should be called, and no longer will packets have their TID modified for | ||
5142 | * preventing use of this TID in the driver. | ||
5143 | * | ||
5144 | * Note that this function blocks and acquires a lock, so it should be called | ||
5145 | * without driver locks held. Also note this function should only be called | ||
5146 | * from the driver's @sta_state callback. | ||
5147 | * | ||
5148 | * @sta: the station | ||
5149 | * @tid: the TID to unreserve | ||
5150 | */ | ||
5151 | void ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid); | ||
5152 | |||
5153 | /** | ||
5154 | * ieee80211_ie_split - split an IE buffer according to ordering | ||
5155 | * | ||
5156 | * @ies: the IE buffer | ||
5157 | * @ielen: the length of the IE buffer | ||
5158 | * @ids: an array with element IDs that are allowed before | ||
5159 | * the split | ||
5160 | * @n_ids: the size of the element ID array | ||
5161 | * @offset: offset where to start splitting in the buffer | ||
5162 | * | ||
5163 | * This function splits an IE buffer by updating the @offset | ||
5164 | * variable to point to the location where the buffer should be | ||
5165 | * split. | ||
5166 | * | ||
5167 | * It assumes that the given IE buffer is well-formed, this | ||
5168 | * has to be guaranteed by the caller! | ||
5169 | * | ||
5170 | * It also assumes that the IEs in the buffer are ordered | ||
5171 | * correctly, if not the result of using this function will not | ||
5172 | * be ordered correctly either, i.e. it does no reordering. | ||
5173 | * | ||
5174 | * The function returns the offset where the next part of the | ||
5175 | * buffer starts, which may be @ielen if the entire (remainder) | ||
5176 | * of the buffer should be used. | ||
5177 | */ | ||
5178 | size_t ieee80211_ie_split(const u8 *ies, size_t ielen, | ||
5179 | const u8 *ids, int n_ids, size_t offset); | ||
4891 | #endif /* MAC80211_H */ | 5180 | #endif /* MAC80211_H */ |
diff --git a/include/net/mac802154.h b/include/net/mac802154.h index 2e67cdd19cdc..c823d910b46c 100644 --- a/include/net/mac802154.h +++ b/include/net/mac802154.h | |||
@@ -12,14 +12,12 @@ | |||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License along | ||
16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | */ | 15 | */ |
19 | #ifndef NET_MAC802154_H | 16 | #ifndef NET_MAC802154_H |
20 | #define NET_MAC802154_H | 17 | #define NET_MAC802154_H |
21 | 18 | ||
22 | #include <net/af_ieee802154.h> | 19 | #include <net/af_ieee802154.h> |
20 | #include <linux/ieee802154.h> | ||
23 | #include <linux/skbuff.h> | 21 | #include <linux/skbuff.h> |
24 | 22 | ||
25 | /* General MAC frame format: | 23 | /* General MAC frame format: |
@@ -35,13 +33,13 @@ | |||
35 | */ | 33 | */ |
36 | 34 | ||
37 | /* indicates that the Short Address changed */ | 35 | /* indicates that the Short Address changed */ |
38 | #define IEEE802515_AFILT_SADDR_CHANGED 0x00000001 | 36 | #define IEEE802154_AFILT_SADDR_CHANGED 0x00000001 |
39 | /* indicates that the IEEE Address changed */ | 37 | /* indicates that the IEEE Address changed */ |
40 | #define IEEE802515_AFILT_IEEEADDR_CHANGED 0x00000002 | 38 | #define IEEE802154_AFILT_IEEEADDR_CHANGED 0x00000002 |
41 | /* indicates that the PAN ID changed */ | 39 | /* indicates that the PAN ID changed */ |
42 | #define IEEE802515_AFILT_PANID_CHANGED 0x00000004 | 40 | #define IEEE802154_AFILT_PANID_CHANGED 0x00000004 |
43 | /* indicates that PAN Coordinator status changed */ | 41 | /* indicates that PAN Coordinator status changed */ |
44 | #define IEEE802515_AFILT_PANC_CHANGED 0x00000008 | 42 | #define IEEE802154_AFILT_PANC_CHANGED 0x00000008 |
45 | 43 | ||
46 | struct ieee802154_hw_addr_filt { | 44 | struct ieee802154_hw_addr_filt { |
47 | __le16 pan_id; /* Each independent PAN selects a unique | 45 | __le16 pan_id; /* Each independent PAN selects a unique |
@@ -55,7 +53,14 @@ struct ieee802154_hw_addr_filt { | |||
55 | u8 pan_coord; | 53 | u8 pan_coord; |
56 | }; | 54 | }; |
57 | 55 | ||
58 | struct ieee802154_dev { | 56 | struct ieee802154_vif { |
57 | int type; | ||
58 | |||
59 | /* must be last */ | ||
60 | u8 drv_priv[0] __aligned(sizeof(void *)); | ||
61 | }; | ||
62 | |||
63 | struct ieee802154_hw { | ||
59 | /* filled by the driver */ | 64 | /* filled by the driver */ |
60 | int extra_tx_headroom; | 65 | int extra_tx_headroom; |
61 | u32 flags; | 66 | u32 flags; |
@@ -65,6 +70,7 @@ struct ieee802154_dev { | |||
65 | struct ieee802154_hw_addr_filt hw_filt; | 70 | struct ieee802154_hw_addr_filt hw_filt; |
66 | void *priv; | 71 | void *priv; |
67 | struct wpan_phy *phy; | 72 | struct wpan_phy *phy; |
73 | size_t vif_data_size; | ||
68 | }; | 74 | }; |
69 | 75 | ||
70 | /* Checksum is in hardware and is omitted from a packet | 76 | /* Checksum is in hardware and is omitted from a packet |
@@ -76,28 +82,43 @@ struct ieee802154_dev { | |||
76 | * however, so you are advised to review these flags carefully. | 82 | * however, so you are advised to review these flags carefully. |
77 | */ | 83 | */ |
78 | 84 | ||
79 | /* Indicates that receiver omits FCS and xmitter will add FCS on it's own. */ | 85 | /* Indicates that xmitter will add FCS on it's own. */ |
80 | #define IEEE802154_HW_OMIT_CKSUM 0x00000001 | 86 | #define IEEE802154_HW_TX_OMIT_CKSUM 0x00000001 |
81 | /* Indicates that receiver will autorespond with ACK frames. */ | 87 | /* Indicates that receiver will autorespond with ACK frames. */ |
82 | #define IEEE802154_HW_AACK 0x00000002 | 88 | #define IEEE802154_HW_AACK 0x00000002 |
83 | /* Indicates that transceiver will support transmit power setting. */ | 89 | /* Indicates that transceiver will support transmit power setting. */ |
84 | #define IEEE802154_HW_TXPOWER 0x00000004 | 90 | #define IEEE802154_HW_TXPOWER 0x00000004 |
85 | /* Indicates that transceiver will support listen before transmit. */ | 91 | /* Indicates that transceiver will support listen before transmit. */ |
86 | #define IEEE802154_HW_LBT 0x00000008 | 92 | #define IEEE802154_HW_LBT 0x00000008 |
87 | /* Indicates that transceiver will support cca mode setting. */ | 93 | /* Indicates that transceiver will support cca mode setting. */ |
88 | #define IEEE802154_HW_CCA_MODE 0x00000010 | 94 | #define IEEE802154_HW_CCA_MODE 0x00000010 |
89 | /* Indicates that transceiver will support cca ed level setting. */ | 95 | /* Indicates that transceiver will support cca ed level setting. */ |
90 | #define IEEE802154_HW_CCA_ED_LEVEL 0x00000020 | 96 | #define IEEE802154_HW_CCA_ED_LEVEL 0x00000020 |
91 | /* Indicates that transceiver will support csma (max_be, min_be, csma retries) | 97 | /* Indicates that transceiver will support csma (max_be, min_be, csma retries) |
92 | * settings. */ | 98 | * settings. */ |
93 | #define IEEE802154_HW_CSMA_PARAMS 0x00000040 | 99 | #define IEEE802154_HW_CSMA_PARAMS 0x00000040 |
94 | /* Indicates that transceiver will support ARET frame retries setting. */ | 100 | /* Indicates that transceiver will support ARET frame retries setting. */ |
95 | #define IEEE802154_HW_FRAME_RETRIES 0x00000080 | 101 | #define IEEE802154_HW_FRAME_RETRIES 0x00000080 |
102 | /* Indicates that transceiver will support hardware address filter setting. */ | ||
103 | #define IEEE802154_HW_AFILT 0x00000100 | ||
104 | /* Indicates that transceiver will support promiscuous mode setting. */ | ||
105 | #define IEEE802154_HW_PROMISCUOUS 0x00000200 | ||
106 | /* Indicates that receiver omits FCS. */ | ||
107 | #define IEEE802154_HW_RX_OMIT_CKSUM 0x00000400 | ||
108 | /* Indicates that receiver will not filter frames with bad checksum. */ | ||
109 | #define IEEE802154_HW_RX_DROP_BAD_CKSUM 0x00000800 | ||
110 | |||
111 | /* Indicates that receiver omits FCS and xmitter will add FCS on it's own. */ | ||
112 | #define IEEE802154_HW_OMIT_CKSUM (IEEE802154_HW_TX_OMIT_CKSUM | \ | ||
113 | IEEE802154_HW_RX_OMIT_CKSUM) | ||
96 | 114 | ||
97 | /* This groups the most common CSMA support fields into one. */ | 115 | /* This groups the most common CSMA support fields into one. */ |
98 | #define IEEE802154_HW_CSMA (IEEE802154_HW_CCA_MODE | \ | 116 | #define IEEE802154_HW_CSMA (IEEE802154_HW_CCA_MODE | \ |
99 | IEEE802154_HW_CCA_ED_LEVEL | \ | 117 | IEEE802154_HW_CCA_ED_LEVEL | \ |
100 | IEEE802154_HW_CSMA_PARAMS | \ | 118 | IEEE802154_HW_CSMA_PARAMS) |
119 | |||
120 | /* This groups the most common ARET support fields into one. */ | ||
121 | #define IEEE802154_HW_ARET (IEEE802154_HW_CSMA | \ | ||
101 | IEEE802154_HW_FRAME_RETRIES) | 122 | IEEE802154_HW_FRAME_RETRIES) |
102 | 123 | ||
103 | /* struct ieee802154_ops - callbacks from mac802154 to the driver | 124 | /* struct ieee802154_ops - callbacks from mac802154 to the driver |
@@ -112,12 +133,24 @@ struct ieee802154_dev { | |||
112 | * stop: Handler that 802.15.4 module calls for device cleanup. | 133 | * stop: Handler that 802.15.4 module calls for device cleanup. |
113 | * This function is called after the last interface is removed. | 134 | * This function is called after the last interface is removed. |
114 | * | 135 | * |
115 | * xmit: Handler that 802.15.4 module calls for each transmitted frame. | 136 | * xmit_sync: |
137 | * Handler that 802.15.4 module calls for each transmitted frame. | ||
138 | * skb cntains the buffer starting from the IEEE 802.15.4 header. | ||
139 | * The low-level driver should send the frame based on available | ||
140 | * configuration. This is called by a workqueue and useful for | ||
141 | * synchronous 802.15.4 drivers. | ||
142 | * This function should return zero or negative errno. | ||
143 | * | ||
144 | * WARNING: | ||
145 | * This will be deprecated soon. We don't accept synced xmit callbacks | ||
146 | * drivers anymore. | ||
147 | * | ||
148 | * xmit_async: | ||
149 | * Handler that 802.15.4 module calls for each transmitted frame. | ||
116 | * skb cntains the buffer starting from the IEEE 802.15.4 header. | 150 | * skb cntains the buffer starting from the IEEE 802.15.4 header. |
117 | * The low-level driver should send the frame based on available | 151 | * The low-level driver should send the frame based on available |
118 | * configuration. | 152 | * configuration. |
119 | * This function should return zero or negative errno. Called with | 153 | * This function should return zero or negative errno. |
120 | * pib_lock held. | ||
121 | * | 154 | * |
122 | * ed: Handler that 802.15.4 module calls for Energy Detection. | 155 | * ed: Handler that 802.15.4 module calls for Energy Detection. |
123 | * This function should place the value for detected energy | 156 | * This function should place the value for detected energy |
@@ -159,40 +192,75 @@ struct ieee802154_dev { | |||
159 | * set_frame_retries | 192 | * set_frame_retries |
160 | * Sets the retransmission attempt limit. Called with pib_lock held. | 193 | * Sets the retransmission attempt limit. Called with pib_lock held. |
161 | * Returns either zero, or negative errno. | 194 | * Returns either zero, or negative errno. |
195 | * | ||
196 | * set_promiscuous_mode | ||
197 | * Enables or disable promiscuous mode. | ||
162 | */ | 198 | */ |
163 | struct ieee802154_ops { | 199 | struct ieee802154_ops { |
164 | struct module *owner; | 200 | struct module *owner; |
165 | int (*start)(struct ieee802154_dev *dev); | 201 | int (*start)(struct ieee802154_hw *hw); |
166 | void (*stop)(struct ieee802154_dev *dev); | 202 | void (*stop)(struct ieee802154_hw *hw); |
167 | int (*xmit)(struct ieee802154_dev *dev, | 203 | int (*xmit_sync)(struct ieee802154_hw *hw, |
168 | struct sk_buff *skb); | 204 | struct sk_buff *skb); |
169 | int (*ed)(struct ieee802154_dev *dev, u8 *level); | 205 | int (*xmit_async)(struct ieee802154_hw *hw, |
170 | int (*set_channel)(struct ieee802154_dev *dev, | 206 | struct sk_buff *skb); |
171 | int page, | 207 | int (*ed)(struct ieee802154_hw *hw, u8 *level); |
172 | int channel); | 208 | int (*set_channel)(struct ieee802154_hw *hw, u8 page, |
173 | int (*set_hw_addr_filt)(struct ieee802154_dev *dev, | 209 | u8 channel); |
174 | struct ieee802154_hw_addr_filt *filt, | 210 | int (*set_hw_addr_filt)(struct ieee802154_hw *hw, |
211 | struct ieee802154_hw_addr_filt *filt, | ||
175 | unsigned long changed); | 212 | unsigned long changed); |
176 | int (*ieee_addr)(struct ieee802154_dev *dev, __le64 addr); | 213 | int (*set_txpower)(struct ieee802154_hw *hw, int db); |
177 | int (*set_txpower)(struct ieee802154_dev *dev, int db); | 214 | int (*set_lbt)(struct ieee802154_hw *hw, bool on); |
178 | int (*set_lbt)(struct ieee802154_dev *dev, bool on); | 215 | int (*set_cca_mode)(struct ieee802154_hw *hw, u8 mode); |
179 | int (*set_cca_mode)(struct ieee802154_dev *dev, u8 mode); | 216 | int (*set_cca_ed_level)(struct ieee802154_hw *hw, |
180 | int (*set_cca_ed_level)(struct ieee802154_dev *dev, | ||
181 | s32 level); | 217 | s32 level); |
182 | int (*set_csma_params)(struct ieee802154_dev *dev, | 218 | int (*set_csma_params)(struct ieee802154_hw *hw, |
183 | u8 min_be, u8 max_be, u8 retries); | 219 | u8 min_be, u8 max_be, u8 retries); |
184 | int (*set_frame_retries)(struct ieee802154_dev *dev, | 220 | int (*set_frame_retries)(struct ieee802154_hw *hw, |
185 | s8 retries); | 221 | s8 retries); |
222 | int (*set_promiscuous_mode)(struct ieee802154_hw *hw, | ||
223 | const bool on); | ||
186 | }; | 224 | }; |
187 | 225 | ||
188 | /* Basic interface to register ieee802154 device */ | 226 | /** |
189 | struct ieee802154_dev * | 227 | * ieee802154_be64_to_le64 - copies and convert be64 to le64 |
190 | ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops); | 228 | * @le64_dst: le64 destination pointer |
191 | void ieee802154_free_device(struct ieee802154_dev *dev); | 229 | * @be64_src: be64 source pointer |
192 | int ieee802154_register_device(struct ieee802154_dev *dev); | 230 | */ |
193 | void ieee802154_unregister_device(struct ieee802154_dev *dev); | 231 | static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src) |
232 | { | ||
233 | __le64 tmp = (__force __le64)swab64p(be64_src); | ||
234 | |||
235 | memcpy(le64_dst, &tmp, IEEE802154_EXTENDED_ADDR_LEN); | ||
236 | } | ||
194 | 237 | ||
195 | void ieee802154_rx_irqsafe(struct ieee802154_dev *dev, struct sk_buff *skb, | 238 | /** |
239 | * ieee802154_le64_to_be64 - copies and convert le64 to be64 | ||
240 | * @be64_dst: be64 destination pointer | ||
241 | * @le64_src: le64 source pointer | ||
242 | */ | ||
243 | static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src) | ||
244 | { | ||
245 | __be64 tmp = (__force __be64)swab64p(le64_src); | ||
246 | |||
247 | memcpy(be64_dst, &tmp, IEEE802154_EXTENDED_ADDR_LEN); | ||
248 | } | ||
249 | |||
250 | /* Basic interface to register ieee802154 hwice */ | ||
251 | struct ieee802154_hw * | ||
252 | ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops); | ||
253 | void ieee802154_free_hw(struct ieee802154_hw *hw); | ||
254 | int ieee802154_register_hw(struct ieee802154_hw *hw); | ||
255 | void ieee802154_unregister_hw(struct ieee802154_hw *hw); | ||
256 | |||
257 | void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb); | ||
258 | void ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, | ||
196 | u8 lqi); | 259 | u8 lqi); |
197 | 260 | ||
261 | void ieee802154_wake_queue(struct ieee802154_hw *hw); | ||
262 | void ieee802154_stop_queue(struct ieee802154_hw *hw); | ||
263 | void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb, | ||
264 | bool ifs_handling); | ||
265 | |||
198 | #endif /* NET_MAC802154_H */ | 266 | #endif /* NET_MAC802154_H */ |
diff --git a/include/net/mpls.h b/include/net/mpls.h new file mode 100644 index 000000000000..5b3b5addfb08 --- /dev/null +++ b/include/net/mpls.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2014 Nicira, Inc. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of version 2 of the GNU General Public | ||
6 | * License as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
11 | * General Public License for more details. | ||
12 | */ | ||
13 | |||
14 | #ifndef _NET_MPLS_H | ||
15 | #define _NET_MPLS_H 1 | ||
16 | |||
17 | #include <linux/if_ether.h> | ||
18 | #include <linux/netdevice.h> | ||
19 | |||
20 | #define MPLS_HLEN 4 | ||
21 | |||
22 | static inline bool eth_p_mpls(__be16 eth_type) | ||
23 | { | ||
24 | return eth_type == htons(ETH_P_MPLS_UC) || | ||
25 | eth_type == htons(ETH_P_MPLS_MC); | ||
26 | } | ||
27 | |||
28 | /* | ||
29 | * For non-MPLS skbs this will correspond to the network header. | ||
30 | * For MPLS skbs it will be before the network_header as the MPLS | ||
31 | * label stack lies between the end of the mac header and the network | ||
32 | * header. That is, for MPLS skbs the end of the mac header | ||
33 | * is the top of the MPLS label stack. | ||
34 | */ | ||
35 | static inline unsigned char *skb_mpls_header(struct sk_buff *skb) | ||
36 | { | ||
37 | return skb_mac_header(skb) + skb->mac_len; | ||
38 | } | ||
39 | #endif | ||
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index f60558d0254c..eb070b3674a1 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -69,7 +69,7 @@ struct neigh_parms { | |||
69 | struct net *net; | 69 | struct net *net; |
70 | #endif | 70 | #endif |
71 | struct net_device *dev; | 71 | struct net_device *dev; |
72 | struct neigh_parms *next; | 72 | struct list_head list; |
73 | int (*neigh_setup)(struct neighbour *); | 73 | int (*neigh_setup)(struct neighbour *); |
74 | void (*neigh_cleanup)(struct neighbour *); | 74 | void (*neigh_cleanup)(struct neighbour *); |
75 | struct neigh_table *tbl; | 75 | struct neigh_table *tbl; |
@@ -203,6 +203,7 @@ struct neigh_table { | |||
203 | void (*proxy_redo)(struct sk_buff *skb); | 203 | void (*proxy_redo)(struct sk_buff *skb); |
204 | char *id; | 204 | char *id; |
205 | struct neigh_parms parms; | 205 | struct neigh_parms parms; |
206 | struct list_head parms_list; | ||
206 | int gc_interval; | 207 | int gc_interval; |
207 | int gc_thresh1; | 208 | int gc_thresh1; |
208 | int gc_thresh2; | 209 | int gc_thresh2; |
@@ -219,6 +220,13 @@ struct neigh_table { | |||
219 | struct pneigh_entry **phash_buckets; | 220 | struct pneigh_entry **phash_buckets; |
220 | }; | 221 | }; |
221 | 222 | ||
223 | enum { | ||
224 | NEIGH_ARP_TABLE = 0, | ||
225 | NEIGH_ND_TABLE = 1, | ||
226 | NEIGH_DN_TABLE = 2, | ||
227 | NEIGH_NR_TABLES, | ||
228 | }; | ||
229 | |||
222 | static inline int neigh_parms_family(struct neigh_parms *p) | 230 | static inline int neigh_parms_family(struct neigh_parms *p) |
223 | { | 231 | { |
224 | return p->tbl->family; | 232 | return p->tbl->family; |
@@ -239,8 +247,8 @@ static inline void *neighbour_priv(const struct neighbour *n) | |||
239 | #define NEIGH_UPDATE_F_ISROUTER 0x40000000 | 247 | #define NEIGH_UPDATE_F_ISROUTER 0x40000000 |
240 | #define NEIGH_UPDATE_F_ADMIN 0x80000000 | 248 | #define NEIGH_UPDATE_F_ADMIN 0x80000000 |
241 | 249 | ||
242 | void neigh_table_init(struct neigh_table *tbl); | 250 | void neigh_table_init(int index, struct neigh_table *tbl); |
243 | int neigh_table_clear(struct neigh_table *tbl); | 251 | int neigh_table_clear(int index, struct neigh_table *tbl); |
244 | struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey, | 252 | struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey, |
245 | struct net_device *dev); | 253 | struct net_device *dev); |
246 | struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net, | 254 | struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net, |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index c8a7db605e03..f0daed2b54d1 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -92,12 +92,18 @@ struct nf_conn { | |||
92 | /* Have we seen traffic both ways yet? (bitset) */ | 92 | /* Have we seen traffic both ways yet? (bitset) */ |
93 | unsigned long status; | 93 | unsigned long status; |
94 | 94 | ||
95 | /* If we were expected by an expectation, this will be it */ | ||
96 | struct nf_conn *master; | ||
97 | |||
98 | /* Timer function; drops refcnt when it goes off. */ | 95 | /* Timer function; drops refcnt when it goes off. */ |
99 | struct timer_list timeout; | 96 | struct timer_list timeout; |
100 | 97 | ||
98 | #ifdef CONFIG_NET_NS | ||
99 | struct net *ct_net; | ||
100 | #endif | ||
101 | /* all members below initialized via memset */ | ||
102 | u8 __nfct_init_offset[0]; | ||
103 | |||
104 | /* If we were expected by an expectation, this will be it */ | ||
105 | struct nf_conn *master; | ||
106 | |||
101 | #if defined(CONFIG_NF_CONNTRACK_MARK) | 107 | #if defined(CONFIG_NF_CONNTRACK_MARK) |
102 | u_int32_t mark; | 108 | u_int32_t mark; |
103 | #endif | 109 | #endif |
@@ -108,9 +114,6 @@ struct nf_conn { | |||
108 | 114 | ||
109 | /* Extensions */ | 115 | /* Extensions */ |
110 | struct nf_ct_ext *ext; | 116 | struct nf_ct_ext *ext; |
111 | #ifdef CONFIG_NET_NS | ||
112 | struct net *ct_net; | ||
113 | #endif | ||
114 | 117 | ||
115 | /* Storage reserved for other modules, must be the last member */ | 118 | /* Storage reserved for other modules, must be the last member */ |
116 | union nf_conntrack_proto proto; | 119 | union nf_conntrack_proto proto; |
diff --git a/include/net/netfilter/nf_nat_redirect.h b/include/net/netfilter/nf_nat_redirect.h new file mode 100644 index 000000000000..73b729543309 --- /dev/null +++ b/include/net/netfilter/nf_nat_redirect.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef _NF_NAT_REDIRECT_H_ | ||
2 | #define _NF_NAT_REDIRECT_H_ | ||
3 | |||
4 | unsigned int | ||
5 | nf_nat_redirect_ipv4(struct sk_buff *skb, | ||
6 | const struct nf_nat_ipv4_multi_range_compat *mr, | ||
7 | unsigned int hooknum); | ||
8 | unsigned int | ||
9 | nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range *range, | ||
10 | unsigned int hooknum); | ||
11 | |||
12 | #endif /* _NF_NAT_REDIRECT_H_ */ | ||
diff --git a/include/net/netfilter/nf_tables_bridge.h b/include/net/netfilter/nf_tables_bridge.h new file mode 100644 index 000000000000..511fb79f6dad --- /dev/null +++ b/include/net/netfilter/nf_tables_bridge.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _NET_NF_TABLES_BRIDGE_H | ||
2 | #define _NET_NF_TABLES_BRIDGE_H | ||
3 | |||
4 | int nft_bridge_iphdr_validate(struct sk_buff *skb); | ||
5 | int nft_bridge_ip6hdr_validate(struct sk_buff *skb); | ||
6 | |||
7 | #endif /* _NET_NF_TABLES_BRIDGE_H */ | ||
diff --git a/include/net/netfilter/nft_redir.h b/include/net/netfilter/nft_redir.h new file mode 100644 index 000000000000..a2d67546afab --- /dev/null +++ b/include/net/netfilter/nft_redir.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef _NFT_REDIR_H_ | ||
2 | #define _NFT_REDIR_H_ | ||
3 | |||
4 | struct nft_redir { | ||
5 | enum nft_registers sreg_proto_min:8; | ||
6 | enum nft_registers sreg_proto_max:8; | ||
7 | u16 flags; | ||
8 | }; | ||
9 | |||
10 | extern const struct nla_policy nft_redir_policy[]; | ||
11 | |||
12 | int nft_redir_init(const struct nft_ctx *ctx, | ||
13 | const struct nft_expr *expr, | ||
14 | const struct nlattr * const tb[]); | ||
15 | |||
16 | int nft_redir_dump(struct sk_buff *skb, const struct nft_expr *expr); | ||
17 | |||
18 | int nft_redir_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, | ||
19 | const struct nft_data **data); | ||
20 | |||
21 | #endif /* _NFT_REDIR_H_ */ | ||
diff --git a/include/net/netlink.h b/include/net/netlink.h index 7b903e1bdbbb..64158353ecb2 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -1185,4 +1185,14 @@ static inline int nla_validate_nested(const struct nlattr *start, int maxtype, | |||
1185 | #define nla_for_each_nested(pos, nla, rem) \ | 1185 | #define nla_for_each_nested(pos, nla, rem) \ |
1186 | nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem) | 1186 | nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem) |
1187 | 1187 | ||
1188 | /** | ||
1189 | * nla_is_last - Test if attribute is last in stream | ||
1190 | * @nla: attribute to test | ||
1191 | * @rem: bytes remaining in stream | ||
1192 | */ | ||
1193 | static inline bool nla_is_last(const struct nlattr *nla, int rem) | ||
1194 | { | ||
1195 | return nla->nla_len == rem; | ||
1196 | } | ||
1197 | |||
1188 | #endif | 1198 | #endif |
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h index 9da798256f0e..730d82ad6ee5 100644 --- a/include/net/netns/xfrm.h +++ b/include/net/netns/xfrm.h | |||
@@ -50,8 +50,8 @@ struct netns_xfrm { | |||
50 | struct list_head policy_all; | 50 | struct list_head policy_all; |
51 | struct hlist_head *policy_byidx; | 51 | struct hlist_head *policy_byidx; |
52 | unsigned int policy_idx_hmask; | 52 | unsigned int policy_idx_hmask; |
53 | struct hlist_head policy_inexact[XFRM_POLICY_MAX * 2]; | 53 | struct hlist_head policy_inexact[XFRM_POLICY_MAX]; |
54 | struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX * 2]; | 54 | struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX]; |
55 | unsigned int policy_count[XFRM_POLICY_MAX * 2]; | 55 | unsigned int policy_count[XFRM_POLICY_MAX * 2]; |
56 | struct work_struct policy_hash_work; | 56 | struct work_struct policy_hash_work; |
57 | struct xfrm_policy_hthresh policy_hthresh; | 57 | struct xfrm_policy_hthresh policy_hthresh; |
diff --git a/include/net/nfc/digital.h b/include/net/nfc/digital.h index d9a5cf7ac1c4..0ae101eef0f4 100644 --- a/include/net/nfc/digital.h +++ b/include/net/nfc/digital.h | |||
@@ -225,6 +225,19 @@ struct nfc_digital_dev { | |||
225 | u8 curr_protocol; | 225 | u8 curr_protocol; |
226 | u8 curr_rf_tech; | 226 | u8 curr_rf_tech; |
227 | u8 curr_nfc_dep_pni; | 227 | u8 curr_nfc_dep_pni; |
228 | u8 did; | ||
229 | |||
230 | u8 local_payload_max; | ||
231 | u8 remote_payload_max; | ||
232 | |||
233 | struct sk_buff *chaining_skb; | ||
234 | struct digital_data_exch *data_exch; | ||
235 | |||
236 | int atn_count; | ||
237 | int nack_count; | ||
238 | |||
239 | struct sk_buff *saved_skb; | ||
240 | unsigned int saved_skb_len; | ||
228 | 241 | ||
229 | u16 target_fsc; | 242 | u16 target_fsc; |
230 | 243 | ||
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h index 7ee8f4cc610b..14bd0e1c47fa 100644 --- a/include/net/nfc/hci.h +++ b/include/net/nfc/hci.h | |||
@@ -57,10 +57,14 @@ struct nfc_hci_ops { | |||
57 | int (*discover_se)(struct nfc_hci_dev *dev); | 57 | int (*discover_se)(struct nfc_hci_dev *dev); |
58 | int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx); | 58 | int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx); |
59 | int (*disable_se)(struct nfc_hci_dev *dev, u32 se_idx); | 59 | int (*disable_se)(struct nfc_hci_dev *dev, u32 se_idx); |
60 | int (*se_io)(struct nfc_hci_dev *dev, u32 se_idx, | ||
61 | u8 *apdu, size_t apdu_length, | ||
62 | se_io_cb_t cb, void *cb_context); | ||
60 | }; | 63 | }; |
61 | 64 | ||
62 | /* Pipes */ | 65 | /* Pipes */ |
63 | #define NFC_HCI_INVALID_PIPE 0x80 | 66 | #define NFC_HCI_INVALID_PIPE 0x80 |
67 | #define NFC_HCI_DO_NOT_CREATE_PIPE 0x81 | ||
64 | #define NFC_HCI_LINK_MGMT_PIPE 0x00 | 68 | #define NFC_HCI_LINK_MGMT_PIPE 0x00 |
65 | #define NFC_HCI_ADMIN_PIPE 0x01 | 69 | #define NFC_HCI_ADMIN_PIPE 0x01 |
66 | 70 | ||
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h index 9eca9ae2280c..e7257a4653b4 100644 --- a/include/net/nfc/nci.h +++ b/include/net/nfc/nci.h | |||
@@ -28,6 +28,8 @@ | |||
28 | #ifndef __NCI_H | 28 | #ifndef __NCI_H |
29 | #define __NCI_H | 29 | #define __NCI_H |
30 | 30 | ||
31 | #include <net/nfc/nfc.h> | ||
32 | |||
31 | /* NCI constants */ | 33 | /* NCI constants */ |
32 | #define NCI_MAX_NUM_MAPPING_CONFIGS 10 | 34 | #define NCI_MAX_NUM_MAPPING_CONFIGS 10 |
33 | #define NCI_MAX_NUM_RF_CONFIGS 10 | 35 | #define NCI_MAX_NUM_RF_CONFIGS 10 |
@@ -73,6 +75,8 @@ | |||
73 | #define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83 | 75 | #define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83 |
74 | #define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85 | 76 | #define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85 |
75 | 77 | ||
78 | #define NCI_RF_TECH_MODE_LISTEN_MASK 0x80 | ||
79 | |||
76 | /* NCI RF Technologies */ | 80 | /* NCI RF Technologies */ |
77 | #define NCI_NFC_RF_TECHNOLOGY_A 0x00 | 81 | #define NCI_NFC_RF_TECHNOLOGY_A 0x00 |
78 | #define NCI_NFC_RF_TECHNOLOGY_B 0x01 | 82 | #define NCI_NFC_RF_TECHNOLOGY_B 0x01 |
@@ -106,6 +110,17 @@ | |||
106 | 110 | ||
107 | /* NCI Configuration Parameter Tags */ | 111 | /* NCI Configuration Parameter Tags */ |
108 | #define NCI_PN_ATR_REQ_GEN_BYTES 0x29 | 112 | #define NCI_PN_ATR_REQ_GEN_BYTES 0x29 |
113 | #define NCI_LN_ATR_RES_GEN_BYTES 0x61 | ||
114 | #define NCI_LA_SEL_INFO 0x32 | ||
115 | #define NCI_LF_PROTOCOL_TYPE 0x50 | ||
116 | #define NCI_LF_CON_BITR_F 0x54 | ||
117 | |||
118 | /* NCI Configuration Parameters masks */ | ||
119 | #define NCI_LA_SEL_INFO_ISO_DEP_MASK 0x20 | ||
120 | #define NCI_LA_SEL_INFO_NFC_DEP_MASK 0x40 | ||
121 | #define NCI_LF_PROTOCOL_TYPE_NFC_DEP_MASK 0x02 | ||
122 | #define NCI_LF_CON_BITR_F_212 0x02 | ||
123 | #define NCI_LF_CON_BITR_F_424 0x04 | ||
109 | 124 | ||
110 | /* NCI Reset types */ | 125 | /* NCI Reset types */ |
111 | #define NCI_RESET_TYPE_KEEP_CONFIG 0x00 | 126 | #define NCI_RESET_TYPE_KEEP_CONFIG 0x00 |
@@ -314,26 +329,31 @@ struct nci_core_intf_error_ntf { | |||
314 | struct rf_tech_specific_params_nfca_poll { | 329 | struct rf_tech_specific_params_nfca_poll { |
315 | __u16 sens_res; | 330 | __u16 sens_res; |
316 | __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ | 331 | __u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */ |
317 | __u8 nfcid1[10]; | 332 | __u8 nfcid1[NFC_NFCID1_MAXSIZE]; |
318 | __u8 sel_res_len; /* 0 or 1 Bytes */ | 333 | __u8 sel_res_len; /* 0 or 1 Bytes */ |
319 | __u8 sel_res; | 334 | __u8 sel_res; |
320 | } __packed; | 335 | } __packed; |
321 | 336 | ||
322 | struct rf_tech_specific_params_nfcb_poll { | 337 | struct rf_tech_specific_params_nfcb_poll { |
323 | __u8 sensb_res_len; | 338 | __u8 sensb_res_len; |
324 | __u8 sensb_res[12]; /* 11 or 12 Bytes */ | 339 | __u8 sensb_res[NFC_SENSB_RES_MAXSIZE]; /* 11 or 12 Bytes */ |
325 | } __packed; | 340 | } __packed; |
326 | 341 | ||
327 | struct rf_tech_specific_params_nfcf_poll { | 342 | struct rf_tech_specific_params_nfcf_poll { |
328 | __u8 bit_rate; | 343 | __u8 bit_rate; |
329 | __u8 sensf_res_len; | 344 | __u8 sensf_res_len; |
330 | __u8 sensf_res[18]; /* 16 or 18 Bytes */ | 345 | __u8 sensf_res[NFC_SENSF_RES_MAXSIZE]; /* 16 or 18 Bytes */ |
331 | } __packed; | 346 | } __packed; |
332 | 347 | ||
333 | struct rf_tech_specific_params_nfcv_poll { | 348 | struct rf_tech_specific_params_nfcv_poll { |
334 | __u8 res_flags; | 349 | __u8 res_flags; |
335 | __u8 dsfid; | 350 | __u8 dsfid; |
336 | __u8 uid[8]; /* 8 Bytes */ | 351 | __u8 uid[NFC_ISO15693_UID_MAXSIZE]; /* 8 Bytes */ |
352 | } __packed; | ||
353 | |||
354 | struct rf_tech_specific_params_nfcf_listen { | ||
355 | __u8 local_nfcid2_len; | ||
356 | __u8 local_nfcid2[NFC_NFCID2_MAXSIZE]; /* 0 or 8 Bytes */ | ||
337 | } __packed; | 357 | } __packed; |
338 | 358 | ||
339 | struct nci_rf_discover_ntf { | 359 | struct nci_rf_discover_ntf { |
@@ -365,7 +385,12 @@ struct activation_params_nfcb_poll_iso_dep { | |||
365 | 385 | ||
366 | struct activation_params_poll_nfc_dep { | 386 | struct activation_params_poll_nfc_dep { |
367 | __u8 atr_res_len; | 387 | __u8 atr_res_len; |
368 | __u8 atr_res[63]; | 388 | __u8 atr_res[NFC_ATR_RES_MAXSIZE - 2]; /* ATR_RES from byte 3 */ |
389 | }; | ||
390 | |||
391 | struct activation_params_listen_nfc_dep { | ||
392 | __u8 atr_req_len; | ||
393 | __u8 atr_req[NFC_ATR_REQ_MAXSIZE - 2]; /* ATR_REQ from byte 3 */ | ||
369 | }; | 394 | }; |
370 | 395 | ||
371 | struct nci_rf_intf_activated_ntf { | 396 | struct nci_rf_intf_activated_ntf { |
@@ -382,6 +407,7 @@ struct nci_rf_intf_activated_ntf { | |||
382 | struct rf_tech_specific_params_nfcb_poll nfcb_poll; | 407 | struct rf_tech_specific_params_nfcb_poll nfcb_poll; |
383 | struct rf_tech_specific_params_nfcf_poll nfcf_poll; | 408 | struct rf_tech_specific_params_nfcf_poll nfcf_poll; |
384 | struct rf_tech_specific_params_nfcv_poll nfcv_poll; | 409 | struct rf_tech_specific_params_nfcv_poll nfcv_poll; |
410 | struct rf_tech_specific_params_nfcf_listen nfcf_listen; | ||
385 | } rf_tech_specific_params; | 411 | } rf_tech_specific_params; |
386 | 412 | ||
387 | __u8 data_exch_rf_tech_and_mode; | 413 | __u8 data_exch_rf_tech_and_mode; |
@@ -393,6 +419,7 @@ struct nci_rf_intf_activated_ntf { | |||
393 | struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; | 419 | struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; |
394 | struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep; | 420 | struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep; |
395 | struct activation_params_poll_nfc_dep poll_nfc_dep; | 421 | struct activation_params_poll_nfc_dep poll_nfc_dep; |
422 | struct activation_params_listen_nfc_dep listen_nfc_dep; | ||
396 | } activation_params; | 423 | } activation_params; |
397 | 424 | ||
398 | } __packed; | 425 | } __packed; |
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h index 75d10e625c49..9e51bb4d841e 100644 --- a/include/net/nfc/nci_core.h +++ b/include/net/nfc/nci_core.h | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (C) 2011 Texas Instruments, Inc. | 5 | * Copyright (C) 2011 Texas Instruments, Inc. |
6 | * Copyright (C) 2013 Intel Corporation. All rights reserved. | 6 | * Copyright (C) 2013 Intel Corporation. All rights reserved. |
7 | * Copyright (C) 2014 Marvell International Ltd. | ||
7 | * | 8 | * |
8 | * Written by Ilan Elias <ilane@ti.com> | 9 | * Written by Ilan Elias <ilane@ti.com> |
9 | * | 10 | * |
@@ -49,6 +50,8 @@ enum nci_state { | |||
49 | NCI_W4_ALL_DISCOVERIES, | 50 | NCI_W4_ALL_DISCOVERIES, |
50 | NCI_W4_HOST_SELECT, | 51 | NCI_W4_HOST_SELECT, |
51 | NCI_POLL_ACTIVE, | 52 | NCI_POLL_ACTIVE, |
53 | NCI_LISTEN_ACTIVE, | ||
54 | NCI_LISTEN_SLEEP, | ||
52 | }; | 55 | }; |
53 | 56 | ||
54 | /* NCI timeouts */ | 57 | /* NCI timeouts */ |
@@ -69,6 +72,12 @@ struct nci_ops { | |||
69 | int (*send)(struct nci_dev *ndev, struct sk_buff *skb); | 72 | int (*send)(struct nci_dev *ndev, struct sk_buff *skb); |
70 | int (*setup)(struct nci_dev *ndev); | 73 | int (*setup)(struct nci_dev *ndev); |
71 | __u32 (*get_rfprotocol)(struct nci_dev *ndev, __u8 rf_protocol); | 74 | __u32 (*get_rfprotocol)(struct nci_dev *ndev, __u8 rf_protocol); |
75 | int (*discover_se)(struct nci_dev *ndev); | ||
76 | int (*disable_se)(struct nci_dev *ndev, u32 se_idx); | ||
77 | int (*enable_se)(struct nci_dev *ndev, u32 se_idx); | ||
78 | int (*se_io)(struct nci_dev *ndev, u32 se_idx, | ||
79 | u8 *apdu, size_t apdu_length, | ||
80 | se_io_cb_t cb, void *cb_context); | ||
72 | }; | 81 | }; |
73 | 82 | ||
74 | #define NCI_MAX_SUPPORTED_RF_INTERFACES 4 | 83 | #define NCI_MAX_SUPPORTED_RF_INTERFACES 4 |
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 6c583e244de2..12adb817c27a 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2011 Instituto Nokia de Tecnologia | 2 | * Copyright (C) 2011 Instituto Nokia de Tecnologia |
3 | * Copyright (C) 2014 Marvell International Ltd. | ||
3 | * | 4 | * |
4 | * Authors: | 5 | * Authors: |
5 | * Lauro Ramos Venancio <lauro.venancio@openbossa.org> | 6 | * Lauro Ramos Venancio <lauro.venancio@openbossa.org> |
@@ -87,6 +88,7 @@ struct nfc_ops { | |||
87 | #define NFC_TARGET_IDX_ANY -1 | 88 | #define NFC_TARGET_IDX_ANY -1 |
88 | #define NFC_MAX_GT_LEN 48 | 89 | #define NFC_MAX_GT_LEN 48 |
89 | #define NFC_ATR_RES_GT_OFFSET 15 | 90 | #define NFC_ATR_RES_GT_OFFSET 15 |
91 | #define NFC_ATR_REQ_GT_OFFSET 14 | ||
90 | 92 | ||
91 | /** | 93 | /** |
92 | * struct nfc_target - NFC target descriptiom | 94 | * struct nfc_target - NFC target descriptiom |
diff --git a/include/net/nl802154.h b/include/net/nl802154.h index b23548e04098..6dbd406ca41b 100644 --- a/include/net/nl802154.h +++ b/include/net/nl802154.h | |||
@@ -1,126 +1,122 @@ | |||
1 | #ifndef __NL802154_H | ||
2 | #define __NL802154_H | ||
1 | /* | 3 | /* |
2 | * nl802154.h | 4 | * 802.15.4 netlink interface public header |
3 | * | 5 | * |
4 | * Copyright (C) 2007, 2008, 2009 Siemens AG | 6 | * Copyright 2014 Alexander Aring <aar@pengutronix.de> |
5 | * | 7 | * |
6 | * This program is free software; you can redistribute it and/or modify | 8 | * Permission to use, copy, modify, and/or distribute this software for any |
7 | * it under the terms of the GNU General Public License version 2 | 9 | * purpose with or without fee is hereby granted, provided that the above |
8 | * as published by the Free Software Foundation. | 10 | * copyright notice and this permission notice appear in all copies. |
9 | * | 11 | * |
10 | * This program is distributed in the hope that it will be useful, | 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
13 | * GNU General Public License for more details. | 15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
14 | * | 16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
15 | * You should have received a copy of the GNU General Public License along | 17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | * with this program; if not, write to the Free Software Foundation, Inc., | 18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | * | 19 | * |
19 | */ | 20 | */ |
20 | 21 | ||
21 | #ifndef IEEE802154_NL_H | 22 | #define NL802154_GENL_NAME "nl802154" |
22 | #define IEEE802154_NL_H | ||
23 | 23 | ||
24 | struct net_device; | 24 | enum nl802154_commands { |
25 | struct ieee802154_addr; | 25 | /* don't change the order or add anything between, this is ABI! */ |
26 | /* currently we don't shipping this file via uapi, ignore the above one */ | ||
27 | NL802154_CMD_UNSPEC, | ||
26 | 28 | ||
27 | /** | 29 | NL802154_CMD_GET_WPAN_PHY, /* can dump */ |
28 | * ieee802154_nl_assoc_indic - Notify userland of an association request. | 30 | NL802154_CMD_SET_WPAN_PHY, |
29 | * @dev: The network device on which this association request was | 31 | NL802154_CMD_NEW_WPAN_PHY, |
30 | * received. | 32 | NL802154_CMD_DEL_WPAN_PHY, |
31 | * @addr: The address of the device requesting association. | ||
32 | * @cap: The capability information field from the device. | ||
33 | * | ||
34 | * This informs a userland coordinator of a device requesting to | ||
35 | * associate with the PAN controlled by the coordinator. | ||
36 | * | ||
37 | * Note: This is in section 7.3.1 of the IEEE 802.15.4-2006 document. | ||
38 | */ | ||
39 | int ieee802154_nl_assoc_indic(struct net_device *dev, | ||
40 | struct ieee802154_addr *addr, u8 cap); | ||
41 | |||
42 | /** | ||
43 | * ieee802154_nl_assoc_confirm - Notify userland of association. | ||
44 | * @dev: The device which has completed association. | ||
45 | * @short_addr: The short address assigned to the device. | ||
46 | * @status: The status of the association. | ||
47 | * | ||
48 | * Inform userland of the result of an association request. If the | ||
49 | * association request included asking the coordinator to allocate | ||
50 | * a short address then it is returned in @short_addr. | ||
51 | * | ||
52 | * Note: This is in section 7.3.2 of the IEEE 802.15.4 document. | ||
53 | */ | ||
54 | int ieee802154_nl_assoc_confirm(struct net_device *dev, | ||
55 | __le16 short_addr, u8 status); | ||
56 | |||
57 | /** | ||
58 | * ieee802154_nl_disassoc_indic - Notify userland of disassociation. | ||
59 | * @dev: The device on which disassociation was indicated. | ||
60 | * @addr: The device which is disassociating. | ||
61 | * @reason: The reason for the disassociation. | ||
62 | * | ||
63 | * Inform userland that a device has disassociated from the network. | ||
64 | * | ||
65 | * Note: This is in section 7.3.3 of the IEEE 802.15.4 document. | ||
66 | */ | ||
67 | int ieee802154_nl_disassoc_indic(struct net_device *dev, | ||
68 | struct ieee802154_addr *addr, u8 reason); | ||
69 | |||
70 | /** | ||
71 | * ieee802154_nl_disassoc_confirm - Notify userland of disassociation | ||
72 | * completion. | ||
73 | * @dev: The device on which disassociation was ordered. | ||
74 | * @status: The result of the disassociation. | ||
75 | * | ||
76 | * Inform userland of the result of requesting that a device | ||
77 | * disassociate, or the result of requesting that we disassociate from | ||
78 | * a PAN managed by another coordinator. | ||
79 | * | ||
80 | * Note: This is in section 7.1.4.3 of the IEEE 802.15.4 document. | ||
81 | */ | ||
82 | int ieee802154_nl_disassoc_confirm(struct net_device *dev, | ||
83 | u8 status); | ||
84 | |||
85 | /** | ||
86 | * ieee802154_nl_scan_confirm - Notify userland of completion of scan. | ||
87 | * @dev: The device which was instructed to scan. | ||
88 | * @status: The status of the scan operation. | ||
89 | * @scan_type: What type of scan was performed. | ||
90 | * @unscanned: Any channels that the device was unable to scan. | ||
91 | * @edl: The energy levels (if a passive scan). | ||
92 | * | ||
93 | * | ||
94 | * Note: This is in section 7.1.11 of the IEEE 802.15.4 document. | ||
95 | * Note: This API does not permit the return of an active scan result. | ||
96 | */ | ||
97 | int ieee802154_nl_scan_confirm(struct net_device *dev, | ||
98 | u8 status, u8 scan_type, u32 unscanned, u8 page, | ||
99 | u8 *edl/*, struct list_head *pan_desc_list */); | ||
100 | |||
101 | /** | ||
102 | * ieee802154_nl_beacon_indic - Notify userland of a received beacon. | ||
103 | * @dev: The device on which a beacon was received. | ||
104 | * @panid: The PAN of the coordinator. | ||
105 | * @coord_addr: The short address of the coordinator on that PAN. | ||
106 | * | ||
107 | * Note: This is in section 7.1.5 of the IEEE 802.15.4 document. | ||
108 | * Note: This API does not provide extended information such as what | ||
109 | * channel the PAN is on or what the LQI of the beacon frame was on | ||
110 | * receipt. | ||
111 | * Note: This API cannot indicate a beacon frame for a coordinator | ||
112 | * operating in long addressing mode. | ||
113 | */ | ||
114 | int ieee802154_nl_beacon_indic(struct net_device *dev, __le16 panid, | ||
115 | __le16 coord_addr); | ||
116 | 33 | ||
117 | /** | 34 | NL802154_CMD_GET_INTERFACE, /* can dump */ |
118 | * ieee802154_nl_start_confirm - Notify userland of completion of start. | 35 | NL802154_CMD_SET_INTERFACE, |
119 | * @dev: The device which was instructed to scan. | 36 | NL802154_CMD_NEW_INTERFACE, |
120 | * @status: The status of the scan operation. | 37 | NL802154_CMD_DEL_INTERFACE, |
121 | * | 38 | |
122 | * Note: This is in section 7.1.14 of the IEEE 802.15.4 document. | 39 | NL802154_CMD_SET_CHANNEL, |
123 | */ | 40 | |
124 | int ieee802154_nl_start_confirm(struct net_device *dev, u8 status); | 41 | NL802154_CMD_SET_PAN_ID, |
42 | NL802154_CMD_SET_SHORT_ADDR, | ||
43 | |||
44 | NL802154_CMD_SET_TX_POWER, | ||
45 | NL802154_CMD_SET_CCA_MODE, | ||
46 | NL802154_CMD_SET_CCA_ED_LEVEL, | ||
47 | |||
48 | NL802154_CMD_SET_MAX_FRAME_RETRIES, | ||
49 | |||
50 | NL802154_CMD_SET_BACKOFF_EXPONENT, | ||
51 | NL802154_CMD_SET_MAX_CSMA_BACKOFFS, | ||
52 | |||
53 | NL802154_CMD_SET_LBT_MODE, | ||
54 | |||
55 | /* add new commands above here */ | ||
56 | |||
57 | /* used to define NL802154_CMD_MAX below */ | ||
58 | __NL802154_CMD_AFTER_LAST, | ||
59 | NL802154_CMD_MAX = __NL802154_CMD_AFTER_LAST - 1 | ||
60 | }; | ||
61 | |||
62 | enum nl802154_attrs { | ||
63 | /* don't change the order or add anything between, this is ABI! */ | ||
64 | /* currently we don't shipping this file via uapi, ignore the above one */ | ||
65 | NL802154_ATTR_UNSPEC, | ||
66 | |||
67 | NL802154_ATTR_WPAN_PHY, | ||
68 | NL802154_ATTR_WPAN_PHY_NAME, | ||
69 | |||
70 | NL802154_ATTR_IFINDEX, | ||
71 | NL802154_ATTR_IFNAME, | ||
72 | NL802154_ATTR_IFTYPE, | ||
73 | |||
74 | NL802154_ATTR_WPAN_DEV, | ||
75 | |||
76 | NL802154_ATTR_PAGE, | ||
77 | NL802154_ATTR_CHANNEL, | ||
78 | |||
79 | NL802154_ATTR_PAN_ID, | ||
80 | NL802154_ATTR_SHORT_ADDR, | ||
81 | |||
82 | NL802154_ATTR_TX_POWER, | ||
83 | |||
84 | NL802154_ATTR_CCA_MODE, | ||
85 | NL802154_ATTR_CCA_MODE3_AND, | ||
86 | NL802154_ATTR_CCA_ED_LEVEL, | ||
87 | |||
88 | NL802154_ATTR_MAX_FRAME_RETRIES, | ||
89 | |||
90 | NL802154_ATTR_MAX_BE, | ||
91 | NL802154_ATTR_MIN_BE, | ||
92 | NL802154_ATTR_MAX_CSMA_BACKOFFS, | ||
93 | |||
94 | NL802154_ATTR_LBT_MODE, | ||
95 | |||
96 | NL802154_ATTR_GENERATION, | ||
97 | |||
98 | NL802154_ATTR_CHANNELS_SUPPORTED, | ||
99 | NL802154_ATTR_SUPPORTED_CHANNEL, | ||
100 | |||
101 | NL802154_ATTR_EXTENDED_ADDR, | ||
102 | |||
103 | /* add attributes here, update the policy in nl802154.c */ | ||
104 | |||
105 | __NL802154_ATTR_AFTER_LAST, | ||
106 | NL802154_ATTR_MAX = __NL802154_ATTR_AFTER_LAST - 1 | ||
107 | }; | ||
108 | |||
109 | enum nl802154_iftype { | ||
110 | /* for backwards compatibility TODO */ | ||
111 | NL802154_IFTYPE_UNSPEC = -1, | ||
112 | |||
113 | NL802154_IFTYPE_NODE, | ||
114 | NL802154_IFTYPE_MONITOR, | ||
115 | NL802154_IFTYPE_COORD, | ||
116 | |||
117 | /* keep last */ | ||
118 | NUM_NL802154_IFTYPES, | ||
119 | NL802154_IFTYPE_MAX = NUM_NL802154_IFTYPES - 1 | ||
120 | }; | ||
125 | 121 | ||
126 | #endif | 122 | #endif /* __NL802154_H */ |
diff --git a/include/net/ping.h b/include/net/ping.h index 026479b61a2d..f074060bc5de 100644 --- a/include/net/ping.h +++ b/include/net/ping.h | |||
@@ -82,7 +82,7 @@ int ping_common_sendmsg(int family, struct msghdr *msg, size_t len, | |||
82 | int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | 82 | int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, |
83 | size_t len); | 83 | size_t len); |
84 | int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); | 84 | int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); |
85 | void ping_rcv(struct sk_buff *skb); | 85 | bool ping_rcv(struct sk_buff *skb); |
86 | 86 | ||
87 | #ifdef CONFIG_PROC_FS | 87 | #ifdef CONFIG_PROC_FS |
88 | struct ping_seq_afinfo { | 88 | struct ping_seq_afinfo { |
diff --git a/include/net/regulatory.h b/include/net/regulatory.h index dad7ab20a8cb..b776d72d84be 100644 --- a/include/net/regulatory.h +++ b/include/net/regulatory.h | |||
@@ -136,6 +136,17 @@ struct regulatory_request { | |||
136 | * otherwise initiating radiation is not allowed. This will enable the | 136 | * otherwise initiating radiation is not allowed. This will enable the |
137 | * relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration | 137 | * relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration |
138 | * option | 138 | * option |
139 | * @REGULATORY_IGNORE_STALE_KICKOFF: the regulatory core will _not_ make sure | ||
140 | * all interfaces on this wiphy reside on allowed channels. If this flag | ||
141 | * is not set, upon a regdomain change, the interfaces are given a grace | ||
142 | * period (currently 60 seconds) to disconnect or move to an allowed | ||
143 | * channel. Interfaces on forbidden channels are forcibly disconnected. | ||
144 | * Currently these types of interfaces are supported for enforcement: | ||
145 | * NL80211_IFTYPE_ADHOC, NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP, | ||
146 | * NL80211_IFTYPE_AP_VLAN, NL80211_IFTYPE_MONITOR, | ||
147 | * NL80211_IFTYPE_P2P_CLIENT, NL80211_IFTYPE_P2P_GO, | ||
148 | * NL80211_IFTYPE_P2P_DEVICE. The flag will be set by default if a device | ||
149 | * includes any modes unsupported for enforcement checking. | ||
139 | */ | 150 | */ |
140 | enum ieee80211_regulatory_flags { | 151 | enum ieee80211_regulatory_flags { |
141 | REGULATORY_CUSTOM_REG = BIT(0), | 152 | REGULATORY_CUSTOM_REG = BIT(0), |
@@ -144,6 +155,7 @@ enum ieee80211_regulatory_flags { | |||
144 | REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3), | 155 | REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3), |
145 | REGULATORY_COUNTRY_IE_IGNORE = BIT(4), | 156 | REGULATORY_COUNTRY_IE_IGNORE = BIT(4), |
146 | REGULATORY_ENABLE_RELAX_NO_IR = BIT(5), | 157 | REGULATORY_ENABLE_RELAX_NO_IR = BIT(5), |
158 | REGULATORY_IGNORE_STALE_KICKOFF = BIT(6), | ||
147 | }; | 159 | }; |
148 | 160 | ||
149 | struct ieee80211_freq_range { | 161 | struct ieee80211_freq_range { |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index d17ed6fb2f70..3d282cbb66bf 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -219,7 +219,6 @@ struct tcf_proto_ops { | |||
219 | void (*destroy)(struct tcf_proto*); | 219 | void (*destroy)(struct tcf_proto*); |
220 | 220 | ||
221 | unsigned long (*get)(struct tcf_proto*, u32 handle); | 221 | unsigned long (*get)(struct tcf_proto*, u32 handle); |
222 | void (*put)(struct tcf_proto*, unsigned long); | ||
223 | int (*change)(struct net *net, struct sk_buff *, | 222 | int (*change)(struct net *net, struct sk_buff *, |
224 | struct tcf_proto*, unsigned long, | 223 | struct tcf_proto*, unsigned long, |
225 | u32 handle, struct nlattr **, | 224 | u32 handle, struct nlattr **, |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index 72a31db47ded..487ef34bbd63 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
@@ -219,7 +219,7 @@ struct sctp_chunk *sctp_make_abort_no_data(const struct sctp_association *, | |||
219 | const struct sctp_chunk *, | 219 | const struct sctp_chunk *, |
220 | __u32 tsn); | 220 | __u32 tsn); |
221 | struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *, | 221 | struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *, |
222 | const struct msghdr *, size_t msg_len); | 222 | struct msghdr *, size_t msg_len); |
223 | struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *, | 223 | struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *, |
224 | const struct sctp_chunk *, | 224 | const struct sctp_chunk *, |
225 | const __u8 *, | 225 | const __u8 *, |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 4ff3f67be62c..2bb2fcf5b11f 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -531,7 +531,7 @@ struct sctp_datamsg { | |||
531 | 531 | ||
532 | struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, | 532 | struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, |
533 | struct sctp_sndrcvinfo *, | 533 | struct sctp_sndrcvinfo *, |
534 | struct msghdr *, int len); | 534 | struct iov_iter *); |
535 | void sctp_datamsg_free(struct sctp_datamsg *); | 535 | void sctp_datamsg_free(struct sctp_datamsg *); |
536 | void sctp_datamsg_put(struct sctp_datamsg *); | 536 | void sctp_datamsg_put(struct sctp_datamsg *); |
537 | void sctp_chunk_fail(struct sctp_chunk *, int error); | 537 | void sctp_chunk_fail(struct sctp_chunk *, int error); |
@@ -647,8 +647,8 @@ struct sctp_chunk { | |||
647 | 647 | ||
648 | void sctp_chunk_hold(struct sctp_chunk *); | 648 | void sctp_chunk_hold(struct sctp_chunk *); |
649 | void sctp_chunk_put(struct sctp_chunk *); | 649 | void sctp_chunk_put(struct sctp_chunk *); |
650 | int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len, | 650 | int sctp_user_addto_chunk(struct sctp_chunk *chunk, int len, |
651 | struct iovec *data); | 651 | struct iov_iter *from); |
652 | void sctp_chunk_free(struct sctp_chunk *); | 652 | void sctp_chunk_free(struct sctp_chunk *); |
653 | void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); | 653 | void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); |
654 | struct sctp_chunk *sctp_chunkify(struct sk_buff *, | 654 | struct sctp_chunk *sctp_chunkify(struct sk_buff *, |
@@ -1116,7 +1116,6 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len, | |||
1116 | sctp_scope_t sctp_scope(const union sctp_addr *); | 1116 | sctp_scope_t sctp_scope(const union sctp_addr *); |
1117 | int sctp_in_scope(struct net *net, const union sctp_addr *addr, const sctp_scope_t scope); | 1117 | int sctp_in_scope(struct net *net, const union sctp_addr *addr, const sctp_scope_t scope); |
1118 | int sctp_is_any(struct sock *sk, const union sctp_addr *addr); | 1118 | int sctp_is_any(struct sock *sk, const union sctp_addr *addr); |
1119 | int sctp_addr_is_valid(const union sctp_addr *addr); | ||
1120 | int sctp_is_ep_boundall(struct sock *sk); | 1119 | int sctp_is_ep_boundall(struct sock *sk); |
1121 | 1120 | ||
1122 | 1121 | ||
diff --git a/include/net/sock.h b/include/net/sock.h index 7ff44e062a38..c3e83c9a8ab8 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -273,6 +273,7 @@ struct cg_proto; | |||
273 | * @sk_rcvtimeo: %SO_RCVTIMEO setting | 273 | * @sk_rcvtimeo: %SO_RCVTIMEO setting |
274 | * @sk_sndtimeo: %SO_SNDTIMEO setting | 274 | * @sk_sndtimeo: %SO_SNDTIMEO setting |
275 | * @sk_rxhash: flow hash received from netif layer | 275 | * @sk_rxhash: flow hash received from netif layer |
276 | * @sk_incoming_cpu: record cpu processing incoming packets | ||
276 | * @sk_txhash: computed flow hash for use on transmit | 277 | * @sk_txhash: computed flow hash for use on transmit |
277 | * @sk_filter: socket filtering instructions | 278 | * @sk_filter: socket filtering instructions |
278 | * @sk_protinfo: private area, net family specific, when not using slab | 279 | * @sk_protinfo: private area, net family specific, when not using slab |
@@ -350,6 +351,12 @@ struct sock { | |||
350 | #ifdef CONFIG_RPS | 351 | #ifdef CONFIG_RPS |
351 | __u32 sk_rxhash; | 352 | __u32 sk_rxhash; |
352 | #endif | 353 | #endif |
354 | u16 sk_incoming_cpu; | ||
355 | /* 16bit hole | ||
356 | * Warned : sk_incoming_cpu can be set from softirq, | ||
357 | * Do not use this hole without fully understanding possible issues. | ||
358 | */ | ||
359 | |||
353 | __u32 sk_txhash; | 360 | __u32 sk_txhash; |
354 | #ifdef CONFIG_NET_RX_BUSY_POLL | 361 | #ifdef CONFIG_NET_RX_BUSY_POLL |
355 | unsigned int sk_napi_id; | 362 | unsigned int sk_napi_id; |
@@ -833,6 +840,11 @@ static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) | |||
833 | return sk->sk_backlog_rcv(sk, skb); | 840 | return sk->sk_backlog_rcv(sk, skb); |
834 | } | 841 | } |
835 | 842 | ||
843 | static inline void sk_incoming_cpu_update(struct sock *sk) | ||
844 | { | ||
845 | sk->sk_incoming_cpu = raw_smp_processor_id(); | ||
846 | } | ||
847 | |||
836 | static inline void sock_rps_record_flow_hash(__u32 hash) | 848 | static inline void sock_rps_record_flow_hash(__u32 hash) |
837 | { | 849 | { |
838 | #ifdef CONFIG_RPS | 850 | #ifdef CONFIG_RPS |
@@ -1865,29 +1877,6 @@ static inline int skb_copy_to_page_nocache(struct sock *sk, char __user *from, | |||
1865 | return 0; | 1877 | return 0; |
1866 | } | 1878 | } |
1867 | 1879 | ||
1868 | static inline int skb_copy_to_page(struct sock *sk, char __user *from, | ||
1869 | struct sk_buff *skb, struct page *page, | ||
1870 | int off, int copy) | ||
1871 | { | ||
1872 | if (skb->ip_summed == CHECKSUM_NONE) { | ||
1873 | int err = 0; | ||
1874 | __wsum csum = csum_and_copy_from_user(from, | ||
1875 | page_address(page) + off, | ||
1876 | copy, 0, &err); | ||
1877 | if (err) | ||
1878 | return err; | ||
1879 | skb->csum = csum_block_add(skb->csum, csum, skb->len); | ||
1880 | } else if (copy_from_user(page_address(page) + off, from, copy)) | ||
1881 | return -EFAULT; | ||
1882 | |||
1883 | skb->len += copy; | ||
1884 | skb->data_len += copy; | ||
1885 | skb->truesize += copy; | ||
1886 | sk->sk_wmem_queued += copy; | ||
1887 | sk_mem_charge(sk, copy); | ||
1888 | return 0; | ||
1889 | } | ||
1890 | |||
1891 | /** | 1880 | /** |
1892 | * sk_wmem_alloc_get - returns write allocations | 1881 | * sk_wmem_alloc_get - returns write allocations |
1893 | * @sk: socket | 1882 | * @sk: socket |
@@ -2269,16 +2258,6 @@ bool sk_ns_capable(const struct sock *sk, | |||
2269 | bool sk_capable(const struct sock *sk, int cap); | 2258 | bool sk_capable(const struct sock *sk, int cap); |
2270 | bool sk_net_capable(const struct sock *sk, int cap); | 2259 | bool sk_net_capable(const struct sock *sk, int cap); |
2271 | 2260 | ||
2272 | /* | ||
2273 | * Enable debug/info messages | ||
2274 | */ | ||
2275 | extern int net_msg_warn; | ||
2276 | #define NETDEBUG(fmt, args...) \ | ||
2277 | do { if (net_msg_warn) printk(fmt,##args); } while (0) | ||
2278 | |||
2279 | #define LIMIT_NETDEBUG(fmt, args...) \ | ||
2280 | do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0) | ||
2281 | |||
2282 | extern __u32 sysctl_wmem_max; | 2261 | extern __u32 sysctl_wmem_max; |
2283 | extern __u32 sysctl_rmem_max; | 2262 | extern __u32 sysctl_rmem_max; |
2284 | 2263 | ||
diff --git a/include/net/switchdev.h b/include/net/switchdev.h new file mode 100644 index 000000000000..8a6d1641fd9b --- /dev/null +++ b/include/net/switchdev.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * include/net/switchdev.h - Switch device API | ||
3 | * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | */ | ||
10 | #ifndef _LINUX_SWITCHDEV_H_ | ||
11 | #define _LINUX_SWITCHDEV_H_ | ||
12 | |||
13 | #include <linux/netdevice.h> | ||
14 | |||
15 | #ifdef CONFIG_NET_SWITCHDEV | ||
16 | |||
17 | int netdev_switch_parent_id_get(struct net_device *dev, | ||
18 | struct netdev_phys_item_id *psid); | ||
19 | int netdev_switch_port_stp_update(struct net_device *dev, u8 state); | ||
20 | |||
21 | #else | ||
22 | |||
23 | static inline int netdev_switch_parent_id_get(struct net_device *dev, | ||
24 | struct netdev_phys_item_id *psid) | ||
25 | { | ||
26 | return -EOPNOTSUPP; | ||
27 | } | ||
28 | |||
29 | static inline int netdev_switch_port_stp_update(struct net_device *dev, | ||
30 | u8 state) | ||
31 | { | ||
32 | return -EOPNOTSUPP; | ||
33 | } | ||
34 | |||
35 | #endif | ||
36 | |||
37 | #endif /* _LINUX_SWITCHDEV_H_ */ | ||
diff --git a/include/net/tc_act/tc_vlan.h b/include/net/tc_act/tc_vlan.h new file mode 100644 index 000000000000..93b70ade1ff3 --- /dev/null +++ b/include/net/tc_act/tc_vlan.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef __NET_TC_VLAN_H | ||
11 | #define __NET_TC_VLAN_H | ||
12 | |||
13 | #include <net/act_api.h> | ||
14 | |||
15 | #define VLAN_F_POP 0x1 | ||
16 | #define VLAN_F_PUSH 0x2 | ||
17 | |||
18 | struct tcf_vlan { | ||
19 | struct tcf_common common; | ||
20 | int tcfv_action; | ||
21 | u16 tcfv_push_vid; | ||
22 | __be16 tcfv_push_proto; | ||
23 | }; | ||
24 | #define to_vlan(a) \ | ||
25 | container_of(a->priv, struct tcf_vlan, common) | ||
26 | |||
27 | #endif /* __NET_TC_VLAN_H */ | ||
diff --git a/include/net/tcp.h b/include/net/tcp.h index 4062b4f0d121..f50f29faf76f 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -55,9 +55,9 @@ void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
55 | #define MAX_TCP_HEADER (128 + MAX_HEADER) | 55 | #define MAX_TCP_HEADER (128 + MAX_HEADER) |
56 | #define MAX_TCP_OPTION_SPACE 40 | 56 | #define MAX_TCP_OPTION_SPACE 40 |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * Never offer a window over 32767 without using window scaling. Some | 59 | * Never offer a window over 32767 without using window scaling. Some |
60 | * poor stacks do signed 16bit maths! | 60 | * poor stacks do signed 16bit maths! |
61 | */ | 61 | */ |
62 | #define MAX_TCP_WINDOW 32767U | 62 | #define MAX_TCP_WINDOW 32767U |
63 | 63 | ||
@@ -70,9 +70,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
70 | /* After receiving this amount of duplicate ACKs fast retransmit starts. */ | 70 | /* After receiving this amount of duplicate ACKs fast retransmit starts. */ |
71 | #define TCP_FASTRETRANS_THRESH 3 | 71 | #define TCP_FASTRETRANS_THRESH 3 |
72 | 72 | ||
73 | /* Maximal reordering. */ | ||
74 | #define TCP_MAX_REORDERING 127 | ||
75 | |||
76 | /* Maximal number of ACKs sent quickly to accelerate slow-start. */ | 73 | /* Maximal number of ACKs sent quickly to accelerate slow-start. */ |
77 | #define TCP_MAX_QUICKACKS 16U | 74 | #define TCP_MAX_QUICKACKS 16U |
78 | 75 | ||
@@ -167,7 +164,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
167 | /* | 164 | /* |
168 | * TCP option | 165 | * TCP option |
169 | */ | 166 | */ |
170 | 167 | ||
171 | #define TCPOPT_NOP 1 /* Padding */ | 168 | #define TCPOPT_NOP 1 /* Padding */ |
172 | #define TCPOPT_EOL 0 /* End of options */ | 169 | #define TCPOPT_EOL 0 /* End of options */ |
173 | #define TCPOPT_MSS 2 /* Segment size negotiating */ | 170 | #define TCPOPT_MSS 2 /* Segment size negotiating */ |
@@ -252,6 +249,7 @@ extern int sysctl_tcp_abort_on_overflow; | |||
252 | extern int sysctl_tcp_max_orphans; | 249 | extern int sysctl_tcp_max_orphans; |
253 | extern int sysctl_tcp_fack; | 250 | extern int sysctl_tcp_fack; |
254 | extern int sysctl_tcp_reordering; | 251 | extern int sysctl_tcp_reordering; |
252 | extern int sysctl_tcp_max_reordering; | ||
255 | extern int sysctl_tcp_dsack; | 253 | extern int sysctl_tcp_dsack; |
256 | extern long sysctl_tcp_mem[3]; | 254 | extern long sysctl_tcp_mem[3]; |
257 | extern int sysctl_tcp_wmem[3]; | 255 | extern int sysctl_tcp_wmem[3]; |
@@ -492,17 +490,16 @@ u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th, | |||
492 | u16 *mssp); | 490 | u16 *mssp); |
493 | __u32 cookie_v4_init_sequence(struct sock *sk, const struct sk_buff *skb, | 491 | __u32 cookie_v4_init_sequence(struct sock *sk, const struct sk_buff *skb, |
494 | __u16 *mss); | 492 | __u16 *mss); |
495 | #endif | ||
496 | |||
497 | __u32 cookie_init_timestamp(struct request_sock *req); | 493 | __u32 cookie_init_timestamp(struct request_sock *req); |
498 | bool cookie_check_timestamp(struct tcp_options_received *opt, struct net *net, | 494 | bool cookie_timestamp_decode(struct tcp_options_received *opt); |
499 | bool *ecn_ok); | 495 | bool cookie_ecn_ok(const struct tcp_options_received *opt, |
496 | const struct net *net, const struct dst_entry *dst); | ||
500 | 497 | ||
501 | /* From net/ipv6/syncookies.c */ | 498 | /* From net/ipv6/syncookies.c */ |
502 | int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th, | 499 | int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th, |
503 | u32 cookie); | 500 | u32 cookie); |
504 | struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); | 501 | struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); |
505 | #ifdef CONFIG_SYN_COOKIES | 502 | |
506 | u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph, | 503 | u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph, |
507 | const struct tcphdr *th, u16 *mssp); | 504 | const struct tcphdr *th, u16 *mssp); |
508 | __u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, | 505 | __u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, |
@@ -1104,16 +1101,16 @@ static inline int tcp_win_from_space(int space) | |||
1104 | space - (space>>sysctl_tcp_adv_win_scale); | 1101 | space - (space>>sysctl_tcp_adv_win_scale); |
1105 | } | 1102 | } |
1106 | 1103 | ||
1107 | /* Note: caller must be prepared to deal with negative returns */ | 1104 | /* Note: caller must be prepared to deal with negative returns */ |
1108 | static inline int tcp_space(const struct sock *sk) | 1105 | static inline int tcp_space(const struct sock *sk) |
1109 | { | 1106 | { |
1110 | return tcp_win_from_space(sk->sk_rcvbuf - | 1107 | return tcp_win_from_space(sk->sk_rcvbuf - |
1111 | atomic_read(&sk->sk_rmem_alloc)); | 1108 | atomic_read(&sk->sk_rmem_alloc)); |
1112 | } | 1109 | } |
1113 | 1110 | ||
1114 | static inline int tcp_full_space(const struct sock *sk) | 1111 | static inline int tcp_full_space(const struct sock *sk) |
1115 | { | 1112 | { |
1116 | return tcp_win_from_space(sk->sk_rcvbuf); | 1113 | return tcp_win_from_space(sk->sk_rcvbuf); |
1117 | } | 1114 | } |
1118 | 1115 | ||
1119 | static inline void tcp_openreq_init(struct request_sock *req, | 1116 | static inline void tcp_openreq_init(struct request_sock *req, |
diff --git a/include/net/udplite.h b/include/net/udplite.h index 2caadabcd07b..ae7c8d1fbcad 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h | |||
@@ -19,7 +19,9 @@ extern struct udp_table udplite_table; | |||
19 | static __inline__ int udplite_getfrag(void *from, char *to, int offset, | 19 | static __inline__ int udplite_getfrag(void *from, char *to, int offset, |
20 | int len, int odd, struct sk_buff *skb) | 20 | int len, int odd, struct sk_buff *skb) |
21 | { | 21 | { |
22 | return memcpy_fromiovecend(to, (struct iovec *) from, offset, len); | 22 | struct msghdr *msg = from; |
23 | /* XXX: stripping const */ | ||
24 | return memcpy_fromiovecend(to, (struct iovec *)msg->msg_iter.iov, offset, len); | ||
23 | } | 25 | } |
24 | 26 | ||
25 | /* Designate sk as UDP-Lite socket */ | 27 | /* Designate sk as UDP-Lite socket */ |
@@ -40,7 +42,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) | |||
40 | * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets | 42 | * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets |
41 | * with a zero checksum field are illegal. */ | 43 | * with a zero checksum field are illegal. */ |
42 | if (uh->check == 0) { | 44 | if (uh->check == 0) { |
43 | LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: zeroed checksum field\n"); | 45 | net_dbg_ratelimited("UDPLite: zeroed checksum field\n"); |
44 | return 1; | 46 | return 1; |
45 | } | 47 | } |
46 | 48 | ||
@@ -52,8 +54,8 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) | |||
52 | /* | 54 | /* |
53 | * Coverage length violates RFC 3828: log and discard silently. | 55 | * Coverage length violates RFC 3828: log and discard silently. |
54 | */ | 56 | */ |
55 | LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: bad csum coverage %d/%d\n", | 57 | net_dbg_ratelimited("UDPLite: bad csum coverage %d/%d\n", |
56 | cscov, skb->len); | 58 | cscov, skb->len); |
57 | return 1; | 59 | return 1; |
58 | 60 | ||
59 | } else if (cscov < skb->len) { | 61 | } else if (cscov < skb->len) { |
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h deleted file mode 100644 index 10ab0fc6d4f7..000000000000 --- a/include/net/wpan-phy.h +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007, 2008, 2009 Siemens AG | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 | ||
6 | * as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along | ||
14 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
16 | * | ||
17 | * Written by: | ||
18 | * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | ||
19 | */ | ||
20 | |||
21 | #ifndef WPAN_PHY_H | ||
22 | #define WPAN_PHY_H | ||
23 | |||
24 | #include <linux/netdevice.h> | ||
25 | #include <linux/mutex.h> | ||
26 | #include <linux/bug.h> | ||
27 | |||
28 | /* According to the IEEE 802.15.4 stadard the upper most significant bits of | ||
29 | * the 32-bit channel bitmaps shall be used as an integer value to specify 32 | ||
30 | * possible channel pages. The lower 27 bits of the channel bit map shall be | ||
31 | * used as a bit mask to specify channel numbers within a channel page. | ||
32 | */ | ||
33 | #define WPAN_NUM_CHANNELS 27 | ||
34 | #define WPAN_NUM_PAGES 32 | ||
35 | |||
36 | struct wpan_phy { | ||
37 | struct mutex pib_lock; | ||
38 | |||
39 | /* | ||
40 | * This is a PIB according to 802.15.4-2011. | ||
41 | * We do not provide timing-related variables, as they | ||
42 | * aren't used outside of driver | ||
43 | */ | ||
44 | u8 current_channel; | ||
45 | u8 current_page; | ||
46 | u32 channels_supported[32]; | ||
47 | s8 transmit_power; | ||
48 | u8 cca_mode; | ||
49 | u8 min_be; | ||
50 | u8 max_be; | ||
51 | u8 csma_retries; | ||
52 | s8 frame_retries; | ||
53 | |||
54 | bool lbt; | ||
55 | s32 cca_ed_level; | ||
56 | |||
57 | struct device dev; | ||
58 | int idx; | ||
59 | |||
60 | struct net_device *(*add_iface)(struct wpan_phy *phy, | ||
61 | const char *name, int type); | ||
62 | void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); | ||
63 | |||
64 | int (*set_txpower)(struct wpan_phy *phy, int db); | ||
65 | int (*set_lbt)(struct wpan_phy *phy, bool on); | ||
66 | int (*set_cca_mode)(struct wpan_phy *phy, u8 cca_mode); | ||
67 | int (*set_cca_ed_level)(struct wpan_phy *phy, int level); | ||
68 | int (*set_csma_params)(struct wpan_phy *phy, u8 min_be, u8 max_be, | ||
69 | u8 retries); | ||
70 | int (*set_frame_retries)(struct wpan_phy *phy, s8 retries); | ||
71 | |||
72 | char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | ||
73 | }; | ||
74 | |||
75 | #define to_phy(_dev) container_of(_dev, struct wpan_phy, dev) | ||
76 | |||
77 | struct wpan_phy *wpan_phy_alloc(size_t priv_size); | ||
78 | static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev) | ||
79 | { | ||
80 | phy->dev.parent = dev; | ||
81 | } | ||
82 | int wpan_phy_register(struct wpan_phy *phy); | ||
83 | void wpan_phy_unregister(struct wpan_phy *phy); | ||
84 | void wpan_phy_free(struct wpan_phy *phy); | ||
85 | /* Same semantics as for class_for_each_device */ | ||
86 | int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data); | ||
87 | |||
88 | static inline void *wpan_phy_priv(struct wpan_phy *phy) | ||
89 | { | ||
90 | BUG_ON(!phy); | ||
91 | return &phy->priv; | ||
92 | } | ||
93 | |||
94 | struct wpan_phy *wpan_phy_find(const char *str); | ||
95 | |||
96 | static inline void wpan_phy_put(struct wpan_phy *phy) | ||
97 | { | ||
98 | put_device(&phy->dev); | ||
99 | } | ||
100 | |||
101 | static inline const char *wpan_phy_name(struct wpan_phy *phy) | ||
102 | { | ||
103 | return dev_name(&phy->dev); | ||
104 | } | ||
105 | #endif | ||