aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-11-18 03:32:36 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-11-18 03:32:44 -0500
commit760a52e80fdf018a9f83a499427923e18e3bd582 (patch)
treeb37743abb28d9109ce6278b8a896712e713bb25a /include/net
parent0395442ad25853f50d515f4dc00e3475b0df920d (diff)
parent47b6308b643302e642ca2a5cb6470926f7e1c428 (diff)
Merge remote-tracking branch 'wireless-next/master' into mac80211-next
This brings in some mwifiex changes that further patches will need to work on top to not cause merge conflicts. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/6lowpan.h12
-rw-r--r--include/net/af_ieee802154.h4
-rw-r--r--include/net/bluetooth/hci.h15
-rw-r--r--include/net/bluetooth/hci_core.h29
-rw-r--r--include/net/cfg802154.h (renamed from include/net/wpan-phy.h)44
-rw-r--r--include/net/dsa.h1
-rw-r--r--include/net/dst_ops.h2
-rw-r--r--include/net/ieee802154.h195
-rw-r--r--include/net/ieee802154_netdev.h18
-rw-r--r--include/net/if_inet6.h1
-rw-r--r--include/net/inet6_hashtables.h5
-rw-r--r--include/net/inet_frag.h2
-rw-r--r--include/net/lib80211.h5
-rw-r--r--include/net/mac802154.h157
-rw-r--r--include/net/netfilter/ipv6/nf_reject.h157
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-rw-r--r--include/net/netlink.h2
-rw-r--r--include/net/nl802154.h126
-rw-r--r--include/net/sctp/sctp.h5
-rw-r--r--include/net/sctp/sm.h6
-rw-r--r--include/net/snmp.h6
-rw-r--r--include/net/tcp.h34
22 files changed, 236 insertions, 592 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
375typedef int (*skb_delivery_cb)(struct sk_buff *skb, struct net_device *dev); 375int
376 376lowpan_header_decompress(struct sk_buff *skb, struct net_device *dev,
377int 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);
381int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev, 381int 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/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 6e8f24967308..d5f85d7746bc 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 */
@@ -265,6 +274,7 @@ enum {
265/* Low Energy links do not have defined link type. Use invented one */ 274/* Low Energy links do not have defined link type. Use invented one */
266#define LE_LINK 0x80 275#define LE_LINK 0x80
267#define AMP_LINK 0x81 276#define AMP_LINK 0x81
277#define INVALID_LINK 0xff
268 278
269/* LMP features */ 279/* LMP features */
270#define LMP_3SLOT 0x01 280#define LMP_3SLOT 0x01
@@ -1463,6 +1473,11 @@ struct hci_ev_cmd_status {
1463 __le16 opcode; 1473 __le16 opcode;
1464} __packed; 1474} __packed;
1465 1475
1476#define HCI_EV_HARDWARE_ERROR 0x10
1477struct hci_ev_hardware_error {
1478 __u8 code;
1479} __packed;
1480
1466#define HCI_EV_ROLE_CHANGE 0x12 1481#define HCI_EV_ROLE_CHANGE 0x12
1467struct hci_ev_role_change { 1482struct hci_ev_role_change {
1468 __u8 status; 1483 __u8 status;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 37ff1aef0845..4e39a5adfcab 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -398,6 +398,8 @@ struct hci_conn {
398 __u16 le_conn_interval; 398 __u16 le_conn_interval;
399 __u16 le_conn_latency; 399 __u16 le_conn_latency;
400 __u16 le_supv_timeout; 400 __u16 le_supv_timeout;
401 __u8 le_adv_data[HCI_MAX_AD_LENGTH];
402 __u8 le_adv_data_len;
401 __s8 rssi; 403 __s8 rssi;
402 __s8 tx_power; 404 __s8 tx_power;
403 __s8 max_tx_power; 405 __s8 max_tx_power;
@@ -553,6 +555,7 @@ enum {
553 HCI_CONN_STK_ENCRYPT, 555 HCI_CONN_STK_ENCRYPT,
554 HCI_CONN_AUTH_INITIATOR, 556 HCI_CONN_AUTH_INITIATOR,
555 HCI_CONN_DROP, 557 HCI_CONN_DROP,
558 HCI_CONN_PARAM_REMOVAL_PEND,
556}; 559};
557 560
558static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) 561static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
@@ -643,6 +646,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; 646 return c->acl_num + c->amp_num + c->sco_num + c->le_num;
644} 647}
645 648
649static inline __u8 hci_conn_lookup_type(struct hci_dev *hdev, __u16 handle)
650{
651 struct hci_conn_hash *h = &hdev->conn_hash;
652 struct hci_conn *c;
653 __u8 type = INVALID_LINK;
654
655 rcu_read_lock();
656
657 list_for_each_entry_rcu(c, &h->list, list) {
658 if (c->handle == handle) {
659 type = c->type;
660 break;
661 }
662 }
663
664 rcu_read_unlock();
665
666 return type;
667}
668
646static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, 669static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
647 __u16 handle) 670 __u16 handle)
648{ 671{
@@ -853,6 +876,7 @@ int hci_register_dev(struct hci_dev *hdev);
853void hci_unregister_dev(struct hci_dev *hdev); 876void hci_unregister_dev(struct hci_dev *hdev);
854int hci_suspend_dev(struct hci_dev *hdev); 877int hci_suspend_dev(struct hci_dev *hdev);
855int hci_resume_dev(struct hci_dev *hdev); 878int hci_resume_dev(struct hci_dev *hdev);
879int hci_reset_dev(struct hci_dev *hdev);
856int hci_dev_open(__u16 dev); 880int hci_dev_open(__u16 dev);
857int hci_dev_close(__u16 dev); 881int hci_dev_close(__u16 dev);
858int hci_dev_reset(__u16 dev); 882int hci_dev_reset(__u16 dev);
@@ -1310,9 +1334,8 @@ int mgmt_update_adv_data(struct hci_dev *hdev);
1310void mgmt_discoverable_timeout(struct hci_dev *hdev); 1334void mgmt_discoverable_timeout(struct hci_dev *hdev);
1311void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1335void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1312 bool persistent); 1336 bool persistent);
1313void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1337void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
1314 u8 addr_type, u32 flags, u8 *name, u8 name_len, 1338 u32 flags, u8 *name, u8 name_len);
1315 u8 *dev_class);
1316void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, 1339void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
1317 u8 link_type, u8 addr_type, u8 reason, 1340 u8 link_type, u8 addr_type, u8 reason,
1318 bool mgmt_connected); 1341 bool mgmt_connected);
diff --git a/include/net/wpan-phy.h b/include/net/cfg802154.h
index 10ab0fc6d4f7..9d99b9655760 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/cfg802154.h
@@ -10,16 +10,12 @@
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details. 11 * GNU General Public License for more details.
12 * 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: 13 * Written by:
18 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 14 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
19 */ 15 */
20 16
21#ifndef WPAN_PHY_H 17#ifndef __NET_CFG802154_H
22#define WPAN_PHY_H 18#define __NET_CFG802154_H
23 19
24#include <linux/netdevice.h> 20#include <linux/netdevice.h>
25#include <linux/mutex.h> 21#include <linux/mutex.h>
@@ -33,6 +29,16 @@
33#define WPAN_NUM_CHANNELS 27 29#define WPAN_NUM_CHANNELS 27
34#define WPAN_NUM_PAGES 32 30#define WPAN_NUM_PAGES 32
35 31
32struct wpan_phy;
33
34struct cfg802154_ops {
35 struct net_device * (*add_virtual_intf_deprecated)(struct wpan_phy *wpan_phy,
36 const char *name,
37 int type);
38 void (*del_virtual_intf_deprecated)(struct wpan_phy *wpan_phy,
39 struct net_device *dev);
40};
41
36struct wpan_phy { 42struct wpan_phy {
37 struct mutex pib_lock; 43 struct mutex pib_lock;
38 44
@@ -51,34 +57,29 @@ struct wpan_phy {
51 u8 csma_retries; 57 u8 csma_retries;
52 s8 frame_retries; 58 s8 frame_retries;
53 59
60 __le64 perm_extended_addr;
61
54 bool lbt; 62 bool lbt;
55 s32 cca_ed_level; 63 s32 cca_ed_level;
56 64
57 struct device dev; 65 struct device dev;
58 int idx;
59 66
60 struct net_device *(*add_iface)(struct wpan_phy *phy, 67 char priv[0] __aligned(NETDEV_ALIGN);
61 const char *name, int type); 68};
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 69
72 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 70struct wpan_dev {
71 struct wpan_phy *wpan_phy;
73}; 72};
74 73
75#define to_phy(_dev) container_of(_dev, struct wpan_phy, dev) 74#define to_phy(_dev) container_of(_dev, struct wpan_phy, dev)
76 75
77struct wpan_phy *wpan_phy_alloc(size_t priv_size); 76struct wpan_phy *
77wpan_phy_alloc(const struct cfg802154_ops *ops, size_t priv_size);
78static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev) 78static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev)
79{ 79{
80 phy->dev.parent = dev; 80 phy->dev.parent = dev;
81} 81}
82
82int wpan_phy_register(struct wpan_phy *phy); 83int wpan_phy_register(struct wpan_phy *phy);
83void wpan_phy_unregister(struct wpan_phy *phy); 84void wpan_phy_unregister(struct wpan_phy *phy);
84void wpan_phy_free(struct wpan_phy *phy); 85void wpan_phy_free(struct wpan_phy *phy);
@@ -102,4 +103,5 @@ static inline const char *wpan_phy_name(struct wpan_phy *phy)
102{ 103{
103 return dev_name(&phy->dev); 104 return dev_name(&phy->dev);
104} 105}
105#endif 106
107#endif /* __NET_CFG802154_H */
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 58ad8c6492db..b76559293535 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -18,6 +18,7 @@
18#include <linux/of.h> 18#include <linux/of.h>
19#include <linux/phy.h> 19#include <linux/phy.h>
20#include <linux/phy_fixed.h> 20#include <linux/phy_fixed.h>
21#include <linux/ethtool.h>
21 22
22enum dsa_tag_protocol { 23enum dsa_tag_protocol {
23 DSA_TAG_PROTO_NONE = 0, 24 DSA_TAG_PROTO_NONE = 0,
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
index 2f26dfb8450e..1f99a1de0e4f 100644
--- a/include/net/dst_ops.h
+++ b/include/net/dst_ops.h
@@ -63,7 +63,7 @@ static inline void dst_entries_add(struct dst_ops *dst, int val)
63 63
64static inline int dst_entries_init(struct dst_ops *dst) 64static inline int dst_entries_init(struct dst_ops *dst)
65{ 65{
66 return percpu_counter_init(&dst->pcpuc_entries, 0); 66 return percpu_counter_init(&dst->pcpuc_entries, 0, GFP_KERNEL);
67} 67}
68 68
69static inline void dst_entries_destroy(struct dst_ops *dst) 69static inline void dst_entries_destroy(struct dst_ops *dst)
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 */
108enum {
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
35struct ieee802154_sechdr { 31struct 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 */
447struct ieee802154_reduced_mlme_ops {
448 struct wpan_phy *(*get_phy)(const struct net_device *dev);
449};
450
451static inline struct ieee802154_mlme_ops * 435static inline struct ieee802154_mlme_ops *
452ieee802154_mlme_ops(const struct net_device *dev) 436ieee802154_mlme_ops(const struct net_device *dev)
453{ 437{
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 55a8d4056cc9..98e5f9578f86 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -146,7 +146,6 @@ struct ifacaddr6 {
146 struct ifacaddr6 *aca_next; 146 struct ifacaddr6 *aca_next;
147 int aca_users; 147 int aca_users;
148 atomic_t aca_refcnt; 148 atomic_t aca_refcnt;
149 spinlock_t aca_lock;
150 unsigned long aca_cstamp; 149 unsigned long aca_cstamp;
151 unsigned long aca_tstamp; 150 unsigned long aca_tstamp;
152}; 151};
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index ae0613544308..d1d272843b3b 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -80,7 +80,8 @@ static inline struct sock *__inet6_lookup(struct net *net,
80static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, 80static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
81 struct sk_buff *skb, 81 struct sk_buff *skb,
82 const __be16 sport, 82 const __be16 sport,
83 const __be16 dport) 83 const __be16 dport,
84 int iif)
84{ 85{
85 struct sock *sk = skb_steal_sock(skb); 86 struct sock *sk = skb_steal_sock(skb);
86 87
@@ -90,7 +91,7 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
90 return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo, 91 return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo,
91 &ipv6_hdr(skb)->saddr, sport, 92 &ipv6_hdr(skb)->saddr, sport,
92 &ipv6_hdr(skb)->daddr, ntohs(dport), 93 &ipv6_hdr(skb)->daddr, ntohs(dport),
93 inet6_iif(skb)); 94 iif);
94} 95}
95 96
96struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, 97struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 65a8855e99fe..8d1765577acc 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -151,7 +151,7 @@ static inline void add_frag_mem_limit(struct inet_frag_queue *q, int i)
151 151
152static inline void init_frag_mem_limit(struct netns_frags *nf) 152static inline void init_frag_mem_limit(struct netns_frags *nf)
153{ 153{
154 percpu_counter_init(&nf->mem, 0); 154 percpu_counter_init(&nf->mem, 0, GFP_KERNEL);
155} 155}
156 156
157static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf) 157static inline unsigned int sum_frag_mem_limit(struct netns_frags *nf)
diff --git a/include/net/lib80211.h b/include/net/lib80211.h
index be95b9262801..aab0f427edb5 100644
--- a/include/net/lib80211.h
+++ b/include/net/lib80211.h
@@ -32,11 +32,6 @@
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/seq_file.h> 33#include <linux/seq_file.h>
34 34
35/* print_ssid() is intended to be used in debug (and possibly error)
36 * messages. It should never be used for passing ssid to user space. */
37const char *print_ssid(char *buf, const char *ssid, u8 ssid_len);
38#define DECLARE_SSID_BUF(var) char var[IEEE80211_MAX_SSID_LEN * 4 + 1] __maybe_unused
39
40#define NUM_WEP_KEYS 4 35#define NUM_WEP_KEYS 4
41 36
42enum { 37enum {
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index 2e67cdd19cdc..632f6566adb5 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
46struct ieee802154_hw_addr_filt { 44struct 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
58struct ieee802154_dev { 56struct ieee802154_vif {
57 int type;
58
59 /* must be last */
60 u8 drv_priv[0] __aligned(sizeof(void *));
61};
62
63struct 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,74 @@ 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 */
163struct ieee802154_ops { 199struct 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/**
189struct ieee802154_dev * 227 * ieee802154_be64_to_le64 - copies and convert be64 to le64
190ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops); 228 * @le64_dst: le64 destination pointer
191void ieee802154_free_device(struct ieee802154_dev *dev); 229 * @be64_src: be64 source pointer
192int ieee802154_register_device(struct ieee802154_dev *dev); 230 */
193void ieee802154_unregister_device(struct ieee802154_dev *dev); 231static 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
195void 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 */
243static 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 */
251struct ieee802154_hw *
252ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops);
253void ieee802154_free_hw(struct ieee802154_hw *hw);
254int ieee802154_register_hw(struct ieee802154_hw *hw);
255void ieee802154_unregister_hw(struct ieee802154_hw *hw);
256
257void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb);
258void ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb,
196 u8 lqi); 259 u8 lqi);
197 260
261void ieee802154_wake_queue(struct ieee802154_hw *hw);
262void ieee802154_stop_queue(struct ieee802154_hw *hw);
263void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb);
264
198#endif /* NET_MAC802154_H */ 265#endif /* NET_MAC802154_H */
diff --git a/include/net/netfilter/ipv6/nf_reject.h b/include/net/netfilter/ipv6/nf_reject.h
index 7a10cfcd8e33..48e18810a9be 100644
--- a/include/net/netfilter/ipv6/nf_reject.h
+++ b/include/net/netfilter/ipv6/nf_reject.h
@@ -1,11 +1,7 @@
1#ifndef _IPV6_NF_REJECT_H 1#ifndef _IPV6_NF_REJECT_H
2#define _IPV6_NF_REJECT_H 2#define _IPV6_NF_REJECT_H
3 3
4#include <net/ipv6.h> 4#include <linux/icmpv6.h>
5#include <net/ip6_route.h>
6#include <net/ip6_fib.h>
7#include <net/ip6_checksum.h>
8#include <linux/netfilter_ipv6.h>
9 5
10static inline void 6static inline void
11nf_send_unreach6(struct net *net, struct sk_buff *skb_in, unsigned char code, 7nf_send_unreach6(struct net *net, struct sk_buff *skb_in, unsigned char code,
@@ -17,155 +13,6 @@ nf_send_unreach6(struct net *net, struct sk_buff *skb_in, unsigned char code,
17 icmpv6_send(skb_in, ICMPV6_DEST_UNREACH, code, 0); 13 icmpv6_send(skb_in, ICMPV6_DEST_UNREACH, code, 0);
18} 14}
19 15
20/* Send RST reply */ 16void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook);
21static void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook)
22{
23 struct sk_buff *nskb;
24 struct tcphdr otcph, *tcph;
25 unsigned int otcplen, hh_len;
26 int tcphoff, needs_ack;
27 const struct ipv6hdr *oip6h = ipv6_hdr(oldskb);
28 struct ipv6hdr *ip6h;
29#define DEFAULT_TOS_VALUE 0x0U
30 const __u8 tclass = DEFAULT_TOS_VALUE;
31 struct dst_entry *dst = NULL;
32 u8 proto;
33 __be16 frag_off;
34 struct flowi6 fl6;
35
36 if ((!(ipv6_addr_type(&oip6h->saddr) & IPV6_ADDR_UNICAST)) ||
37 (!(ipv6_addr_type(&oip6h->daddr) & IPV6_ADDR_UNICAST))) {
38 pr_debug("addr is not unicast.\n");
39 return;
40 }
41
42 proto = oip6h->nexthdr;
43 tcphoff = ipv6_skip_exthdr(oldskb, ((u8*)(oip6h+1) - oldskb->data), &proto, &frag_off);
44
45 if ((tcphoff < 0) || (tcphoff > oldskb->len)) {
46 pr_debug("Cannot get TCP header.\n");
47 return;
48 }
49
50 otcplen = oldskb->len - tcphoff;
51
52 /* IP header checks: fragment, too short. */
53 if (proto != IPPROTO_TCP || otcplen < sizeof(struct tcphdr)) {
54 pr_debug("proto(%d) != IPPROTO_TCP, "
55 "or too short. otcplen = %d\n",
56 proto, otcplen);
57 return;
58 }
59
60 if (skb_copy_bits(oldskb, tcphoff, &otcph, sizeof(struct tcphdr)))
61 BUG();
62
63 /* No RST for RST. */
64 if (otcph.rst) {
65 pr_debug("RST is set\n");
66 return;
67 }
68
69 /* Check checksum. */
70 if (nf_ip6_checksum(oldskb, hook, tcphoff, IPPROTO_TCP)) {
71 pr_debug("TCP checksum is invalid\n");
72 return;
73 }
74
75 memset(&fl6, 0, sizeof(fl6));
76 fl6.flowi6_proto = IPPROTO_TCP;
77 fl6.saddr = oip6h->daddr;
78 fl6.daddr = oip6h->saddr;
79 fl6.fl6_sport = otcph.dest;
80 fl6.fl6_dport = otcph.source;
81 security_skb_classify_flow(oldskb, flowi6_to_flowi(&fl6));
82 dst = ip6_route_output(net, NULL, &fl6);
83 if (dst == NULL || dst->error) {
84 dst_release(dst);
85 return;
86 }
87 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0);
88 if (IS_ERR(dst))
89 return;
90
91 hh_len = (dst->dev->hard_header_len + 15)&~15;
92 nskb = alloc_skb(hh_len + 15 + dst->header_len + sizeof(struct ipv6hdr)
93 + sizeof(struct tcphdr) + dst->trailer_len,
94 GFP_ATOMIC);
95
96 if (!nskb) {
97 net_dbg_ratelimited("cannot alloc skb\n");
98 dst_release(dst);
99 return;
100 }
101
102 skb_dst_set(nskb, dst);
103
104 skb_reserve(nskb, hh_len + dst->header_len);
105
106 skb_put(nskb, sizeof(struct ipv6hdr));
107 skb_reset_network_header(nskb);
108 ip6h = ipv6_hdr(nskb);
109 ip6_flow_hdr(ip6h, tclass, 0);
110 ip6h->hop_limit = ip6_dst_hoplimit(dst);
111 ip6h->nexthdr = IPPROTO_TCP;
112 ip6h->saddr = oip6h->daddr;
113 ip6h->daddr = oip6h->saddr;
114
115 skb_reset_transport_header(nskb);
116 tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr));
117 /* Truncate to length (no data) */
118 tcph->doff = sizeof(struct tcphdr)/4;
119 tcph->source = otcph.dest;
120 tcph->dest = otcph.source;
121
122 if (otcph.ack) {
123 needs_ack = 0;
124 tcph->seq = otcph.ack_seq;
125 tcph->ack_seq = 0;
126 } else {
127 needs_ack = 1;
128 tcph->ack_seq = htonl(ntohl(otcph.seq) + otcph.syn + otcph.fin
129 + otcplen - (otcph.doff<<2));
130 tcph->seq = 0;
131 }
132
133 /* Reset flags */
134 ((u_int8_t *)tcph)[13] = 0;
135 tcph->rst = 1;
136 tcph->ack = needs_ack;
137 tcph->window = 0;
138 tcph->urg_ptr = 0;
139 tcph->check = 0;
140
141 /* Adjust TCP checksum */
142 tcph->check = csum_ipv6_magic(&ipv6_hdr(nskb)->saddr,
143 &ipv6_hdr(nskb)->daddr,
144 sizeof(struct tcphdr), IPPROTO_TCP,
145 csum_partial(tcph,
146 sizeof(struct tcphdr), 0));
147
148 nf_ct_attach(nskb, oldskb);
149
150#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
151 /* If we use ip6_local_out for bridged traffic, the MAC source on
152 * the RST will be ours, instead of the destination's. This confuses
153 * some routers/firewalls, and they drop the packet. So we need to
154 * build the eth header using the original destination's MAC as the
155 * source, and send the RST packet directly.
156 */
157 if (oldskb->nf_bridge) {
158 struct ethhdr *oeth = eth_hdr(oldskb);
159 nskb->dev = oldskb->nf_bridge->physindev;
160 nskb->protocol = htons(ETH_P_IPV6);
161 ip6h->payload_len = htons(sizeof(struct tcphdr));
162 if (dev_hard_header(nskb, nskb->dev, ntohs(nskb->protocol),
163 oeth->h_source, oeth->h_dest, nskb->len) < 0)
164 return;
165 dev_queue_xmit(nskb);
166 } else
167#endif
168 ip6_local_out(nskb);
169}
170 17
171#endif /* _IPV6_NF_REJECT_H */ 18#endif /* _IPV6_NF_REJECT_H */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 37252f71a380..c8a7db605e03 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -242,7 +242,7 @@ extern s32 (*nf_ct_nat_offset)(const struct nf_conn *ct,
242DECLARE_PER_CPU(struct nf_conn, nf_conntrack_untracked); 242DECLARE_PER_CPU(struct nf_conn, nf_conntrack_untracked);
243static inline struct nf_conn *nf_ct_untracked_get(void) 243static inline struct nf_conn *nf_ct_untracked_get(void)
244{ 244{
245 return &__raw_get_cpu_var(nf_conntrack_untracked); 245 return raw_cpu_ptr(&nf_conntrack_untracked);
246} 246}
247void nf_ct_untracked_status_or(unsigned long bits); 247void nf_ct_untracked_status_or(unsigned long bits);
248 248
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 6c1076275aaa..7b903e1bdbbb 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -431,7 +431,7 @@ static inline int nlmsg_report(const struct nlmsghdr *nlh)
431/** 431/**
432 * nlmsg_put - Add a new netlink message to an skb 432 * nlmsg_put - Add a new netlink message to an skb
433 * @skb: socket buffer to store message in 433 * @skb: socket buffer to store message in
434 * @portid: netlink process id 434 * @portid: netlink PORTID of requesting application
435 * @seq: sequence number of message 435 * @seq: sequence number of message
436 * @type: message type 436 * @type: message type
437 * @payload: length of message payload 437 * @payload: length of message payload
diff --git a/include/net/nl802154.h b/include/net/nl802154.h
deleted file mode 100644
index b23548e04098..000000000000
--- a/include/net/nl802154.h
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 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 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27/**
28 * ieee802154_nl_assoc_indic - Notify userland of an association request.
29 * @dev: The network device on which this association request was
30 * received.
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 */
39int 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 */
54int 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 */
67int 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 */
82int 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 */
97int 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 */
114int ieee802154_nl_beacon_indic(struct net_device *dev, __le16 panid,
115 __le16 coord_addr);
116
117/**
118 * ieee802154_nl_start_confirm - Notify userland of completion of start.
119 * @dev: The device which was instructed to scan.
120 * @status: The status of the scan operation.
121 *
122 * Note: This is in section 7.1.14 of the IEEE 802.15.4 document.
123 */
124int ieee802154_nl_start_confirm(struct net_device *dev, u8 status);
125
126#endif
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 9fbd856e6713..856f01cb51dd 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -426,6 +426,11 @@ static inline void sctp_assoc_pending_pmtu(struct sock *sk, struct sctp_associat
426 asoc->pmtu_pending = 0; 426 asoc->pmtu_pending = 0;
427} 427}
428 428
429static inline bool sctp_chunk_pending(const struct sctp_chunk *chunk)
430{
431 return !list_empty(&chunk->list);
432}
433
429/* Walk through a list of TLV parameters. Don't trust the 434/* Walk through a list of TLV parameters. Don't trust the
430 * individual parameter lengths and instead depend on 435 * individual parameter lengths and instead depend on
431 * the chunk length to indicate when to stop. Make sure 436 * the chunk length to indicate when to stop. Make sure
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 7f4eeb340a54..72a31db47ded 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -248,9 +248,9 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *,
248 int, __be16); 248 int, __be16);
249struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, 249struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc,
250 union sctp_addr *addr); 250 union sctp_addr *addr);
251int sctp_verify_asconf(const struct sctp_association *asoc, 251bool sctp_verify_asconf(const struct sctp_association *asoc,
252 struct sctp_paramhdr *param_hdr, void *chunk_end, 252 struct sctp_chunk *chunk, bool addr_param_needed,
253 struct sctp_paramhdr **errp); 253 struct sctp_paramhdr **errp);
254struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, 254struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
255 struct sctp_chunk *asconf); 255 struct sctp_chunk *asconf);
256int sctp_process_asconf_ack(struct sctp_association *asoc, 256int sctp_process_asconf_ack(struct sctp_association *asoc,
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 8fd2f498782e..35512ac6dcfb 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -164,7 +164,7 @@ struct linux_xfrm_mib {
164 164
165#define SNMP_ADD_STATS64_BH(mib, field, addend) \ 165#define SNMP_ADD_STATS64_BH(mib, field, addend) \
166 do { \ 166 do { \
167 __typeof__(*mib) *ptr = __this_cpu_ptr(mib); \ 167 __typeof__(*mib) *ptr = raw_cpu_ptr(mib); \
168 u64_stats_update_begin(&ptr->syncp); \ 168 u64_stats_update_begin(&ptr->syncp); \
169 ptr->mibs[field] += addend; \ 169 ptr->mibs[field] += addend; \
170 u64_stats_update_end(&ptr->syncp); \ 170 u64_stats_update_end(&ptr->syncp); \
@@ -185,8 +185,8 @@ struct linux_xfrm_mib {
185#define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1) 185#define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1)
186#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \ 186#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \
187 do { \ 187 do { \
188 __typeof__(*mib) *ptr; \ 188 __typeof__(*mib) *ptr; \
189 ptr = __this_cpu_ptr(mib); \ 189 ptr = raw_cpu_ptr((mib)); \
190 u64_stats_update_begin(&ptr->syncp); \ 190 u64_stats_update_begin(&ptr->syncp); \
191 ptr->mibs[basefield##PKTS]++; \ 191 ptr->mibs[basefield##PKTS]++; \
192 ptr->mibs[basefield##OCTETS] += addend; \ 192 ptr->mibs[basefield##OCTETS] += addend; \
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 74efeda994b3..4062b4f0d121 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -468,8 +468,7 @@ void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb);
468/* From syncookies.c */ 468/* From syncookies.c */
469int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th, 469int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
470 u32 cookie); 470 u32 cookie);
471struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, 471struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb);
472 struct ip_options *opt);
473#ifdef CONFIG_SYN_COOKIES 472#ifdef CONFIG_SYN_COOKIES
474 473
475/* Syncookies use a monotonic timer which increments every 60 seconds. 474/* Syncookies use a monotonic timer which increments every 60 seconds.
@@ -730,6 +729,17 @@ struct tcp_skb_cb {
730 729
731#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0])) 730#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0]))
732 731
732
733#if IS_ENABLED(CONFIG_IPV6)
734/* This is the variant of inet6_iif() that must be used by TCP,
735 * as TCP moves IP6CB into a different location in skb->cb[]
736 */
737static inline int tcp_v6_iif(const struct sk_buff *skb)
738{
739 return TCP_SKB_CB(skb)->header.h6.iif;
740}
741#endif
742
733/* Due to TSO, an SKB can be composed of multiple actual 743/* Due to TSO, an SKB can be composed of multiple actual
734 * packets. To keep these tracked properly, we use this. 744 * packets. To keep these tracked properly, we use this.
735 */ 745 */
@@ -1666,4 +1676,24 @@ int tcpv4_offload_init(void);
1666void tcp_v4_init(void); 1676void tcp_v4_init(void);
1667void tcp_init(void); 1677void tcp_init(void);
1668 1678
1679/*
1680 * Save and compile IPv4 options, return a pointer to it
1681 */
1682static inline struct ip_options_rcu *tcp_v4_save_options(struct sk_buff *skb)
1683{
1684 const struct ip_options *opt = &TCP_SKB_CB(skb)->header.h4.opt;
1685 struct ip_options_rcu *dopt = NULL;
1686
1687 if (opt->optlen) {
1688 int opt_size = sizeof(*dopt) + opt->optlen;
1689
1690 dopt = kmalloc(opt_size, GFP_ATOMIC);
1691 if (dopt && __ip_options_echo(&dopt->opt, skb, opt)) {
1692 kfree(dopt);
1693 dopt = NULL;
1694 }
1695 }
1696 return dopt;
1697}
1698
1669#endif /* _TCP_H */ 1699#endif /* _TCP_H */