aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/hash.h9
-rw-r--r--include/linux/ath9k_platform.h3
-rw-r--r--include/linux/bcma/bcma.h2
-rw-r--r--include/linux/bcma/bcma_driver_mips.h4
-rw-r--r--include/linux/bpf.h11
-rw-r--r--include/linux/can/dev.h3
-rw-r--r--include/linux/etherdevice.h12
-rw-r--r--include/linux/ethtool.h42
-rw-r--r--include/linux/filter.h1
-rw-r--r--include/linux/hash.h35
-rw-r--r--include/linux/hyperv.h2
-rw-r--r--include/linux/ieee80211.h71
-rw-r--r--include/linux/ieee802154.h (renamed from include/net/ieee802154.h)61
-rw-r--r--include/linux/if_bridge.h31
-rw-r--r--include/linux/if_vlan.h107
-rw-r--r--include/linux/ipv6.h11
-rw-r--r--include/linux/marvell_phy.h1
-rw-r--r--include/linux/micrel_phy.h1
-rw-r--r--include/linux/mlx4/cmd.h31
-rw-r--r--include/linux/mlx4/device.h127
-rw-r--r--include/linux/mlx4/qp.h4
-rw-r--r--include/linux/mlx5/device.h8
-rw-r--r--include/linux/mlx5/driver.h8
-rw-r--r--include/linux/netdev_features.h9
-rw-r--r--include/linux/netdevice.h134
-rw-r--r--include/linux/nl802154.h4
-rw-r--r--include/linux/phy.h26
-rw-r--r--include/linux/platform_data/bcmgenet.h18
-rw-r--r--include/linux/platform_data/st21nfca.h1
-rw-r--r--include/linux/platform_data/st21nfcb.h1
-rw-r--r--include/linux/pxa168_eth.h3
-rw-r--r--include/linux/rculist.h9
-rw-r--r--include/linux/rhashtable.h15
-rw-r--r--include/linux/rtnetlink.h14
-rw-r--r--include/linux/skbuff.h188
-rw-r--r--include/linux/socket.h24
-rw-r--r--include/linux/syscalls.h6
-rw-r--r--include/linux/tcp.h8
-rw-r--r--include/linux/uio.h1
-rw-r--r--include/linux/vmw_vmci_api.h5
-rw-r--r--include/net/6lowpan.h12
-rw-r--r--include/net/af_ieee802154.h4
-rw-r--r--include/net/af_vsock.h6
-rw-r--r--include/net/bluetooth/hci.h68
-rw-r--r--include/net/bluetooth/hci_core.h78
-rw-r--r--include/net/bluetooth/l2cap.h50
-rw-r--r--include/net/bluetooth/mgmt.h24
-rw-r--r--include/net/bond_3ad.h283
-rw-r--r--include/net/bond_alb.h181
-rw-r--r--include/net/bond_options.h130
-rw-r--r--include/net/bonding.h654
-rw-r--r--include/net/cfg80211.h241
-rw-r--r--include/net/cfg802154.h161
-rw-r--r--include/net/checksum.h16
-rw-r--r--include/net/compat.h5
-rw-r--r--include/net/dsa.h33
-rw-r--r--include/net/fou.h19
-rw-r--r--include/net/gue.h103
-rw-r--r--include/net/ieee802154_netdev.h18
-rw-r--r--include/net/inet6_hashtables.h10
-rw-r--r--include/net/ip6_tunnel.h3
-rw-r--r--include/net/ip_fib.h4
-rw-r--r--include/net/ip_tunnels.h16
-rw-r--r--include/net/ipx.h5
-rw-r--r--include/net/irda/irda.h15
-rw-r--r--include/net/irda/irlap.h2
-rw-r--r--include/net/irda/parameters.h6
-rw-r--r--include/net/llc_c_st.h4
-rw-r--r--include/net/llc_s_st.h2
-rw-r--r--include/net/mac80211.h319
-rw-r--r--include/net/mac802154.h158
-rw-r--r--include/net/mpls.h39
-rw-r--r--include/net/neighbour.h14
-rw-r--r--include/net/netfilter/nf_conntrack.h15
-rw-r--r--include/net/netfilter/nf_nat_redirect.h12
-rw-r--r--include/net/netfilter/nf_tables_bridge.h7
-rw-r--r--include/net/netfilter/nft_redir.h21
-rw-r--r--include/net/netlink.h10
-rw-r--r--include/net/netns/xfrm.h4
-rw-r--r--include/net/nfc/digital.h13
-rw-r--r--include/net/nfc/hci.h4
-rw-r--r--include/net/nfc/nci.h37
-rw-r--r--include/net/nfc/nci_core.h9
-rw-r--r--include/net/nfc/nfc.h2
-rw-r--r--include/net/nl802154.h226
-rw-r--r--include/net/ping.h2
-rw-r--r--include/net/regulatory.h12
-rw-r--r--include/net/sch_generic.h1
-rw-r--r--include/net/sctp/sm.h2
-rw-r--r--include/net/sctp/structs.h7
-rw-r--r--include/net/sock.h45
-rw-r--r--include/net/switchdev.h37
-rw-r--r--include/net/tc_act/tc_vlan.h27
-rw-r--r--include/net/tcp.h25
-rw-r--r--include/net/udplite.h10
-rw-r--r--include/net/wpan-phy.h105
-rw-r--r--include/uapi/asm-generic/socket.h5
-rw-r--r--include/uapi/linux/Kbuild91
-rw-r--r--include/uapi/linux/bpf.h14
-rw-r--r--include/uapi/linux/can/error.h1
-rw-r--r--include/uapi/linux/ethtool.h28
-rw-r--r--include/uapi/linux/if_bridge.h1
-rw-r--r--include/uapi/linux/if_link.h18
-rw-r--r--include/uapi/linux/if_tunnel.h1
-rw-r--r--include/uapi/linux/ipv6.h1
-rw-r--r--include/uapi/linux/neighbour.h6
-rw-r--r--include/uapi/linux/net_tstamp.h3
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set.h8
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h18
-rw-r--r--include/uapi/linux/netfilter/xt_set.h13
-rw-r--r--include/uapi/linux/nfc.h23
-rw-r--r--include/uapi/linux/nl80211.h147
-rw-r--r--include/uapi/linux/openvswitch.h53
-rw-r--r--include/uapi/linux/rtnetlink.h1
-rw-r--r--include/uapi/linux/snmp.h5
-rw-r--r--include/uapi/linux/tc_act/Kbuild1
-rw-r--r--include/uapi/linux/tc_act/tc_vlan.h35
-rw-r--r--include/uapi/linux/tipc_netlink.h244
118 files changed, 4186 insertions, 898 deletions
diff --git a/include/asm-generic/hash.h b/include/asm-generic/hash.h
deleted file mode 100644
index b6312843dbd9..000000000000
--- a/include/asm-generic/hash.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __ASM_GENERIC_HASH_H
2#define __ASM_GENERIC_HASH_H
3
4struct fast_hash_ops;
5static inline void setup_arch_fast_hash(struct fast_hash_ops *ops)
6{
7}
8
9#endif /* __ASM_GENERIC_HASH_H */
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
index a495a959e8a7..33eb274cd0e6 100644
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -31,8 +31,11 @@ struct ath9k_platform_data {
31 u32 gpio_mask; 31 u32 gpio_mask;
32 u32 gpio_val; 32 u32 gpio_val;
33 33
34 bool endian_check;
34 bool is_clk_25mhz; 35 bool is_clk_25mhz;
35 bool tx_gain_buffalo; 36 bool tx_gain_buffalo;
37 bool disable_2ghz;
38 bool disable_5ghz;
36 39
37 int (*get_mac_revision)(void); 40 int (*get_mac_revision)(void);
38 int (*external_reset)(void); 41 int (*external_reset)(void);
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 729f48e6b20b..eb1c6a47b67f 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -447,4 +447,6 @@ extern u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset);
447#define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */ 447#define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */
448extern u32 bcma_core_dma_translation(struct bcma_device *core); 448extern u32 bcma_core_dma_translation(struct bcma_device *core);
449 449
450extern unsigned int bcma_core_irq(struct bcma_device *core, int num);
451
450#endif /* LINUX_BCMA_H_ */ 452#endif /* LINUX_BCMA_H_ */
diff --git a/include/linux/bcma/bcma_driver_mips.h b/include/linux/bcma/bcma_driver_mips.h
index fb61f3fb4ddb..0b3b32aeeb8a 100644
--- a/include/linux/bcma/bcma_driver_mips.h
+++ b/include/linux/bcma/bcma_driver_mips.h
@@ -43,12 +43,12 @@ struct bcma_drv_mips {
43extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); 43extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore); 44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
45 45
46extern unsigned int bcma_core_irq(struct bcma_device *core); 46extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
47#else 47#else
48static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } 48static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
49static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { } 49static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
50 50
51static inline unsigned int bcma_core_irq(struct bcma_device *core) 51static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
52{ 52{
53 return 0; 53 return 0;
54} 54}
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 3cf91754a957..bbfceb756452 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -22,7 +22,7 @@ struct bpf_map_ops {
22 22
23 /* funcs callable from userspace and from eBPF programs */ 23 /* funcs callable from userspace and from eBPF programs */
24 void *(*map_lookup_elem)(struct bpf_map *map, void *key); 24 void *(*map_lookup_elem)(struct bpf_map *map, void *key);
25 int (*map_update_elem)(struct bpf_map *map, void *key, void *value); 25 int (*map_update_elem)(struct bpf_map *map, void *key, void *value, u64 flags);
26 int (*map_delete_elem)(struct bpf_map *map, void *key); 26 int (*map_delete_elem)(struct bpf_map *map, void *key);
27}; 27};
28 28
@@ -128,9 +128,18 @@ struct bpf_prog_aux {
128 struct work_struct work; 128 struct work_struct work;
129}; 129};
130 130
131#ifdef CONFIG_BPF_SYSCALL
131void bpf_prog_put(struct bpf_prog *prog); 132void bpf_prog_put(struct bpf_prog *prog);
133#else
134static inline void bpf_prog_put(struct bpf_prog *prog) {}
135#endif
132struct bpf_prog *bpf_prog_get(u32 ufd); 136struct bpf_prog *bpf_prog_get(u32 ufd);
133/* verify correctness of eBPF program */ 137/* verify correctness of eBPF program */
134int bpf_check(struct bpf_prog *fp, union bpf_attr *attr); 138int bpf_check(struct bpf_prog *fp, union bpf_attr *attr);
135 139
140/* verifier prototypes for helper functions called from eBPF programs */
141extern struct bpf_func_proto bpf_map_lookup_elem_proto;
142extern struct bpf_func_proto bpf_map_update_elem_proto;
143extern struct bpf_func_proto bpf_map_delete_elem_proto;
144
136#endif /* _LINUX_BPF_H */ 145#endif /* _LINUX_BPF_H */
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index b37ea95bc348..c05ff0f9f9a5 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -127,6 +127,9 @@ void unregister_candev(struct net_device *dev);
127int can_restart_now(struct net_device *dev); 127int can_restart_now(struct net_device *dev);
128void can_bus_off(struct net_device *dev); 128void can_bus_off(struct net_device *dev);
129 129
130void can_change_state(struct net_device *dev, struct can_frame *cf,
131 enum can_state tx_state, enum can_state rx_state);
132
130void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, 133void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
131 unsigned int idx); 134 unsigned int idx);
132unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx); 135unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 733980fce8e3..41c891d05f04 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -392,4 +392,16 @@ static inline unsigned long compare_ether_header(const void *a, const void *b)
392#endif 392#endif
393} 393}
394 394
395/**
396 * eth_skb_pad - Pad buffer to mininum number of octets for Ethernet frame
397 * @skb: Buffer to pad
398 *
399 * An Ethernet frame should have a minimum size of 60 bytes. This function
400 * takes short frames and pads them with zeros up to the 60 byte limit.
401 */
402static inline int eth_skb_pad(struct sk_buff *skb)
403{
404 return skb_put_padto(skb, ETH_ZLEN);
405}
406
395#endif /* _LINUX_ETHERDEVICE_H */ 407#endif /* _LINUX_ETHERDEVICE_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c1a2d60dfb82..653dc9c4ebac 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -59,6 +59,26 @@ enum ethtool_phys_id_state {
59 ETHTOOL_ID_OFF 59 ETHTOOL_ID_OFF
60}; 60};
61 61
62enum {
63 ETH_RSS_HASH_TOP_BIT, /* Configurable RSS hash function - Toeplitz */
64 ETH_RSS_HASH_XOR_BIT, /* Configurable RSS hash function - Xor */
65
66 /*
67 * Add your fresh new hash function bits above and remember to update
68 * rss_hash_func_strings[] in ethtool.c
69 */
70 ETH_RSS_HASH_FUNCS_COUNT
71};
72
73#define __ETH_RSS_HASH_BIT(bit) ((u32)1 << (bit))
74#define __ETH_RSS_HASH(name) __ETH_RSS_HASH_BIT(ETH_RSS_HASH_##name##_BIT)
75
76#define ETH_RSS_HASH_TOP __ETH_RSS_HASH(TOP)
77#define ETH_RSS_HASH_XOR __ETH_RSS_HASH(XOR)
78
79#define ETH_RSS_HASH_UNKNOWN 0
80#define ETH_RSS_HASH_NO_CHANGE 0
81
62struct net_device; 82struct net_device;
63 83
64/* Some generic methods drivers may use in their ethtool_ops */ 84/* Some generic methods drivers may use in their ethtool_ops */
@@ -158,17 +178,14 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
158 * Returns zero if not supported for this specific device. 178 * Returns zero if not supported for this specific device.
159 * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table. 179 * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table.
160 * Returns zero if not supported for this specific device. 180 * Returns zero if not supported for this specific device.
161 * @get_rxfh: Get the contents of the RX flow hash indirection table and hash 181 * @get_rxfh: Get the contents of the RX flow hash indirection table, hash key
162 * key. 182 * and/or hash function.
163 * Will only be called if one or both of @get_rxfh_indir_size and
164 * @get_rxfh_key_size are implemented and return non-zero.
165 * Returns a negative error code or zero.
166 * @set_rxfh: Set the contents of the RX flow hash indirection table and/or
167 * hash key. In case only the indirection table or hash key is to be
168 * changed, the other argument will be %NULL.
169 * Will only be called if one or both of @get_rxfh_indir_size and
170 * @get_rxfh_key_size are implemented and return non-zero.
171 * Returns a negative error code or zero. 183 * Returns a negative error code or zero.
184 * @set_rxfh: Set the contents of the RX flow hash indirection table, hash
185 * key, and/or hash function. Arguments which are set to %NULL or zero
186 * will remain unchanged.
187 * Returns a negative error code or zero. An error code must be returned
188 * if at least one unsupported change was requested.
172 * @get_channels: Get number of channels. 189 * @get_channels: Get number of channels.
173 * @set_channels: Set number of channels. Returns a negative error code or 190 * @set_channels: Set number of channels. Returns a negative error code or
174 * zero. 191 * zero.
@@ -241,9 +258,10 @@ struct ethtool_ops {
241 int (*reset)(struct net_device *, u32 *); 258 int (*reset)(struct net_device *, u32 *);
242 u32 (*get_rxfh_key_size)(struct net_device *); 259 u32 (*get_rxfh_key_size)(struct net_device *);
243 u32 (*get_rxfh_indir_size)(struct net_device *); 260 u32 (*get_rxfh_indir_size)(struct net_device *);
244 int (*get_rxfh)(struct net_device *, u32 *indir, u8 *key); 261 int (*get_rxfh)(struct net_device *, u32 *indir, u8 *key,
262 u8 *hfunc);
245 int (*set_rxfh)(struct net_device *, const u32 *indir, 263 int (*set_rxfh)(struct net_device *, const u32 *indir,
246 const u8 *key); 264 const u8 *key, const u8 hfunc);
247 void (*get_channels)(struct net_device *, struct ethtool_channels *); 265 void (*get_channels)(struct net_device *, struct ethtool_channels *);
248 int (*set_channels)(struct net_device *, struct ethtool_channels *); 266 int (*set_channels)(struct net_device *, struct ethtool_channels *);
249 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); 267 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *);
diff --git a/include/linux/filter.h b/include/linux/filter.h
index ca95abd2bed1..caac2087a4d5 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -381,6 +381,7 @@ int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog);
381void bpf_prog_destroy(struct bpf_prog *fp); 381void bpf_prog_destroy(struct bpf_prog *fp);
382 382
383int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 383int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
384int sk_attach_bpf(u32 ufd, struct sock *sk);
384int sk_detach_filter(struct sock *sk); 385int sk_detach_filter(struct sock *sk);
385 386
386int bpf_check_classic(const struct sock_filter *filter, unsigned int flen); 387int bpf_check_classic(const struct sock_filter *filter, unsigned int flen);
diff --git a/include/linux/hash.h b/include/linux/hash.h
index d0494c399392..1afde47e1528 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -15,7 +15,6 @@
15 */ 15 */
16 16
17#include <asm/types.h> 17#include <asm/types.h>
18#include <asm/hash.h>
19#include <linux/compiler.h> 18#include <linux/compiler.h>
20 19
21/* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ 20/* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */
@@ -84,38 +83,4 @@ static inline u32 hash32_ptr(const void *ptr)
84 return (u32)val; 83 return (u32)val;
85} 84}
86 85
87struct fast_hash_ops {
88 u32 (*hash)(const void *data, u32 len, u32 seed);
89 u32 (*hash2)(const u32 *data, u32 len, u32 seed);
90};
91
92/**
93 * arch_fast_hash - Caclulates a hash over a given buffer that can have
94 * arbitrary size. This function will eventually use an
95 * architecture-optimized hashing implementation if
96 * available, and trades off distribution for speed.
97 *
98 * @data: buffer to hash
99 * @len: length of buffer in bytes
100 * @seed: start seed
101 *
102 * Returns 32bit hash.
103 */
104extern u32 arch_fast_hash(const void *data, u32 len, u32 seed);
105
106/**
107 * arch_fast_hash2 - Caclulates a hash over a given buffer that has a
108 * size that is of a multiple of 32bit words. This
109 * function will eventually use an architecture-
110 * optimized hashing implementation if available,
111 * and trades off distribution for speed.
112 *
113 * @data: buffer to hash (must be 32bit padded)
114 * @len: number of 32bit words
115 * @seed: start seed
116 *
117 * Returns 32bit hash.
118 */
119extern u32 arch_fast_hash2(const u32 *data, u32 len, u32 seed);
120
121#endif /* _LINUX_HASH_H */ 86#endif /* _LINUX_HASH_H */
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 08cfaff8a072..476c685ca6f9 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -650,6 +650,8 @@ struct vmbus_channel {
650 u8 monitor_grp; 650 u8 monitor_grp;
651 u8 monitor_bit; 651 u8 monitor_bit;
652 652
653 bool rescind; /* got rescind msg */
654
653 u32 ringbuffer_gpadlhandle; 655 u32 ringbuffer_gpadlhandle;
654 656
655 /* Allocated memory for ring buffer */ 657 /* Allocated memory for ring buffer */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index b1be39c76931..4f4eea8a6288 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -19,6 +19,7 @@
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/if_ether.h> 20#include <linux/if_ether.h>
21#include <asm/byteorder.h> 21#include <asm/byteorder.h>
22#include <asm/unaligned.h>
22 23
23/* 24/*
24 * DS bit usage 25 * DS bit usage
@@ -1066,6 +1067,12 @@ struct ieee80211_pspoll {
1066 1067
1067/* TDLS */ 1068/* TDLS */
1068 1069
1070/* Channel switch timing */
1071struct ieee80211_ch_switch_timing {
1072 __le16 switch_time;
1073 __le16 switch_timeout;
1074} __packed;
1075
1069/* Link-id information element */ 1076/* Link-id information element */
1070struct ieee80211_tdls_lnkie { 1077struct ieee80211_tdls_lnkie {
1071 u8 ie_type; /* Link Identifier IE */ 1078 u8 ie_type; /* Link Identifier IE */
@@ -1107,6 +1114,15 @@ struct ieee80211_tdls_data {
1107 u8 dialog_token; 1114 u8 dialog_token;
1108 u8 variable[0]; 1115 u8 variable[0];
1109 } __packed discover_req; 1116 } __packed discover_req;
1117 struct {
1118 u8 target_channel;
1119 u8 oper_class;
1120 u8 variable[0];
1121 } __packed chan_switch_req;
1122 struct {
1123 __le16 status_code;
1124 u8 variable[0];
1125 } __packed chan_switch_resp;
1110 } u; 1126 } u;
1111} __packed; 1127} __packed;
1112 1128
@@ -1274,7 +1290,7 @@ struct ieee80211_ht_cap {
1274#define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2 1290#define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2
1275 1291
1276/* 1292/*
1277 * Maximum length of AMPDU that the STA can receive. 1293 * Maximum length of AMPDU that the STA can receive in high-throughput (HT).
1278 * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets) 1294 * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
1279 */ 1295 */
1280enum ieee80211_max_ampdu_length_exp { 1296enum ieee80211_max_ampdu_length_exp {
@@ -1284,6 +1300,21 @@ enum ieee80211_max_ampdu_length_exp {
1284 IEEE80211_HT_MAX_AMPDU_64K = 3 1300 IEEE80211_HT_MAX_AMPDU_64K = 3
1285}; 1301};
1286 1302
1303/*
1304 * Maximum length of AMPDU that the STA can receive in VHT.
1305 * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
1306 */
1307enum ieee80211_vht_max_ampdu_length_exp {
1308 IEEE80211_VHT_MAX_AMPDU_8K = 0,
1309 IEEE80211_VHT_MAX_AMPDU_16K = 1,
1310 IEEE80211_VHT_MAX_AMPDU_32K = 2,
1311 IEEE80211_VHT_MAX_AMPDU_64K = 3,
1312 IEEE80211_VHT_MAX_AMPDU_128K = 4,
1313 IEEE80211_VHT_MAX_AMPDU_256K = 5,
1314 IEEE80211_VHT_MAX_AMPDU_512K = 6,
1315 IEEE80211_VHT_MAX_AMPDU_1024K = 7
1316};
1317
1287#define IEEE80211_HT_MAX_AMPDU_FACTOR 13 1318#define IEEE80211_HT_MAX_AMPDU_FACTOR 13
1288 1319
1289/* Minimum MPDU start spacing */ 1320/* Minimum MPDU start spacing */
@@ -1998,6 +2029,16 @@ enum ieee80211_tdls_actioncode {
1998 WLAN_TDLS_DISCOVERY_REQUEST = 10, 2029 WLAN_TDLS_DISCOVERY_REQUEST = 10,
1999}; 2030};
2000 2031
2032/* Extended Channel Switching capability to be set in the 1st byte of
2033 * the @WLAN_EID_EXT_CAPABILITY information element
2034 */
2035#define WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING BIT(2)
2036
2037/* TDLS capabilities in the the 4th byte of @WLAN_EID_EXT_CAPABILITY */
2038#define WLAN_EXT_CAPA4_TDLS_BUFFER_STA BIT(4)
2039#define WLAN_EXT_CAPA4_TDLS_PEER_PSM BIT(5)
2040#define WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH BIT(6)
2041
2001/* Interworking capabilities are set in 7th bit of 4th byte of the 2042/* Interworking capabilities are set in 7th bit of 4th byte of the
2002 * @WLAN_EID_EXT_CAPABILITY information element 2043 * @WLAN_EID_EXT_CAPABILITY information element
2003 */ 2044 */
@@ -2009,6 +2050,7 @@ enum ieee80211_tdls_actioncode {
2009 */ 2050 */
2010#define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5) 2051#define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5)
2011#define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6) 2052#define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6)
2053#define WLAN_EXT_CAPA5_TDLS_CH_SW_PROHIBITED BIT(7)
2012 2054
2013#define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6) 2055#define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6)
2014#define WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED BIT(7) 2056#define WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED BIT(7)
@@ -2016,6 +2058,9 @@ enum ieee80211_tdls_actioncode {
2016/* TDLS specific payload type in the LLC/SNAP header */ 2058/* TDLS specific payload type in the LLC/SNAP header */
2017#define WLAN_TDLS_SNAP_RFTYPE 0x2 2059#define WLAN_TDLS_SNAP_RFTYPE 0x2
2018 2060
2061/* BSS Coex IE information field bits */
2062#define WLAN_BSS_COEX_INFORMATION_REQUEST BIT(0)
2063
2019/** 2064/**
2020 * enum - mesh synchronization method identifier 2065 * enum - mesh synchronization method identifier
2021 * 2066 *
@@ -2398,6 +2443,30 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
2398 return !!(tim->virtual_map[index] & mask); 2443 return !!(tim->virtual_map[index] & mask);
2399} 2444}
2400 2445
2446/**
2447 * ieee80211_get_tdls_action - get tdls packet action (or -1, if not tdls packet)
2448 * @skb: the skb containing the frame, length will not be checked
2449 * @hdr_size: the size of the ieee80211_hdr that starts at skb->data
2450 *
2451 * This function assumes the frame is a data frame, and that the network header
2452 * is in the correct place.
2453 */
2454static inline int ieee80211_get_tdls_action(struct sk_buff *skb, u32 hdr_size)
2455{
2456 if (!skb_is_nonlinear(skb) &&
2457 skb->len > (skb_network_offset(skb) + 2)) {
2458 /* Point to where the indication of TDLS should start */
2459 const u8 *tdls_data = skb_network_header(skb) - 2;
2460
2461 if (get_unaligned_be16(tdls_data) == ETH_P_TDLS &&
2462 tdls_data[2] == WLAN_TDLS_SNAP_RFTYPE &&
2463 tdls_data[3] == WLAN_CATEGORY_TDLS)
2464 return tdls_data[4];
2465 }
2466
2467 return -1;
2468}
2469
2401/* convert time units */ 2470/* convert time units */
2402#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) 2471#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024))
2403#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) 2472#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x))
diff --git a/include/net/ieee802154.h b/include/linux/ieee802154.h
index 0aa7122e8f15..6e82d888287c 100644
--- a/include/net/ieee802154.h
+++ b/include/linux/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 * 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>
@@ -24,10 +20,27 @@
24 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com> 20 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
25 */ 21 */
26 22
27#ifndef NET_IEEE802154_H 23#ifndef LINUX_IEEE802154_H
28#define NET_IEEE802154_H 24#define LINUX_IEEE802154_H
25
26#include <linux/types.h>
27#include <linux/random.h>
28#include <asm/byteorder.h>
29 29
30#define IEEE802154_MTU 127 30#define IEEE802154_MTU 127
31#define IEEE802154_MIN_PSDU_LEN 5
32
33#define IEEE802154_PAN_ID_BROADCAST 0xffff
34#define IEEE802154_ADDR_SHORT_BROADCAST 0xffff
35#define IEEE802154_ADDR_SHORT_UNSPEC 0xfffe
36
37#define IEEE802154_EXTENDED_ADDR_LEN 8
38
39#define IEEE802154_LIFS_PERIOD 40
40#define IEEE802154_SIFS_PERIOD 12
41
42#define IEEE802154_MAX_CHANNEL 26
43#define IEEE802154_MAX_PAGE 31
31 44
32#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */ 45#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
33#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */ 46#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
@@ -189,7 +202,41 @@ enum {
189 IEEE802154_SCAN_IN_PROGRESS = 0xfc, 202 IEEE802154_SCAN_IN_PROGRESS = 0xfc,
190}; 203};
191 204
205/**
206 * ieee802154_is_valid_psdu_len - check if psdu len is valid
207 * @len: psdu len with (MHR + payload + MFR)
208 */
209static inline bool ieee802154_is_valid_psdu_len(const u8 len)
210{
211 return (len >= IEEE802154_MIN_PSDU_LEN && len <= IEEE802154_MTU);
212}
213
214/**
215 * ieee802154_is_valid_psdu_len - check if extended addr is valid
216 * @addr: extended addr to check
217 */
218static inline bool ieee802154_is_valid_extended_addr(const __le64 addr)
219{
220 /* These EUI-64 addresses are reserved by IEEE. 0xffffffffffffffff
221 * is used internally as extended to short address broadcast mapping.
222 * This is currently a workaround because neighbor discovery can't
223 * deal with short addresses types right now.
224 */
225 return ((addr != cpu_to_le64(0x0000000000000000ULL)) &&
226 (addr != cpu_to_le64(0xffffffffffffffffULL)));
227}
192 228
193#endif 229/**
230 * ieee802154_random_extended_addr - generates a random extended address
231 * @addr: extended addr pointer to place the random address
232 */
233static inline void ieee802154_random_extended_addr(__le64 *addr)
234{
235 get_random_bytes(addr, IEEE802154_EXTENDED_ADDR_LEN);
194 236
237 /* toggle some bit if we hit an invalid extended addr */
238 if (!ieee802154_is_valid_extended_addr(*addr))
239 ((u8 *)addr)[IEEE802154_EXTENDED_ADDR_LEN - 1] ^= 0x01;
240}
195 241
242#endif /* LINUX_IEEE802154_H */
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 808dcb8cc04f..0a8ce762a47f 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/netdevice.h> 16#include <linux/netdevice.h>
17#include <uapi/linux/if_bridge.h> 17#include <uapi/linux/if_bridge.h>
18#include <linux/bitops.h>
18 19
19struct br_ip { 20struct br_ip {
20 union { 21 union {
@@ -32,11 +33,41 @@ struct br_ip_list {
32 struct br_ip addr; 33 struct br_ip addr;
33}; 34};
34 35
36#define BR_HAIRPIN_MODE BIT(0)
37#define BR_BPDU_GUARD BIT(1)
38#define BR_ROOT_BLOCK BIT(2)
39#define BR_MULTICAST_FAST_LEAVE BIT(3)
40#define BR_ADMIN_COST BIT(4)
41#define BR_LEARNING BIT(5)
42#define BR_FLOOD BIT(6)
43#define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING)
44#define BR_PROMISC BIT(7)
45#define BR_PROXYARP BIT(8)
46#define BR_LEARNING_SYNC BIT(9)
47
35extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 48extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
36 49
37typedef int br_should_route_hook_t(struct sk_buff *skb); 50typedef int br_should_route_hook_t(struct sk_buff *skb);
38extern br_should_route_hook_t __rcu *br_should_route_hook; 51extern br_should_route_hook_t __rcu *br_should_route_hook;
39 52
53#if IS_ENABLED(CONFIG_BRIDGE)
54int br_fdb_external_learn_add(struct net_device *dev,
55 const unsigned char *addr, u16 vid);
56int br_fdb_external_learn_del(struct net_device *dev,
57 const unsigned char *addr, u16 vid);
58#else
59static inline int br_fdb_external_learn_add(struct net_device *dev,
60 const unsigned char *addr, u16 vid)
61{
62 return 0;
63}
64static inline int br_fdb_external_learn_del(struct net_device *dev,
65 const unsigned char *addr, u16 vid)
66{
67 return 0;
68}
69#endif
70
40#if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING) 71#if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_IGMP_SNOOPING)
41int br_multicast_list_adjacent(struct net_device *dev, 72int br_multicast_list_adjacent(struct net_device *dev,
42 struct list_head *br_ip_list); 73 struct list_head *br_ip_list);
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index d69f0577a319..515a35e2a48a 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -282,28 +282,24 @@ static inline bool vlan_hw_offload_capable(netdev_features_t features,
282} 282}
283 283
284/** 284/**
285 * vlan_insert_tag - regular VLAN tag inserting 285 * __vlan_insert_tag - regular VLAN tag inserting
286 * @skb: skbuff to tag 286 * @skb: skbuff to tag
287 * @vlan_proto: VLAN encapsulation protocol 287 * @vlan_proto: VLAN encapsulation protocol
288 * @vlan_tci: VLAN TCI to insert 288 * @vlan_tci: VLAN TCI to insert
289 * 289 *
290 * Inserts the VLAN tag into @skb as part of the payload 290 * Inserts the VLAN tag into @skb as part of the payload
291 * Returns a VLAN tagged skb. If a new skb is created, @skb is freed. 291 * Returns error if skb_cow_head failes.
292 *
293 * Following the skb_unshare() example, in case of error, the calling function
294 * doesn't have to worry about freeing the original skb.
295 * 292 *
296 * Does not change skb->protocol so this function can be used during receive. 293 * Does not change skb->protocol so this function can be used during receive.
297 */ 294 */
298static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, 295static inline int __vlan_insert_tag(struct sk_buff *skb,
299 __be16 vlan_proto, u16 vlan_tci) 296 __be16 vlan_proto, u16 vlan_tci)
300{ 297{
301 struct vlan_ethhdr *veth; 298 struct vlan_ethhdr *veth;
302 299
303 if (skb_cow_head(skb, VLAN_HLEN) < 0) { 300 if (skb_cow_head(skb, VLAN_HLEN) < 0)
304 dev_kfree_skb_any(skb); 301 return -ENOMEM;
305 return NULL; 302
306 }
307 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); 303 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
308 304
309 /* Move the mac addresses to the beginning of the new header. */ 305 /* Move the mac addresses to the beginning of the new header. */
@@ -316,12 +312,40 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
316 /* now, the TCI */ 312 /* now, the TCI */
317 veth->h_vlan_TCI = htons(vlan_tci); 313 veth->h_vlan_TCI = htons(vlan_tci);
318 314
315 return 0;
316}
317
318/**
319 * vlan_insert_tag - regular VLAN tag inserting
320 * @skb: skbuff to tag
321 * @vlan_proto: VLAN encapsulation protocol
322 * @vlan_tci: VLAN TCI to insert
323 *
324 * Inserts the VLAN tag into @skb as part of the payload
325 * Returns a VLAN tagged skb. If a new skb is created, @skb is freed.
326 *
327 * Following the skb_unshare() example, in case of error, the calling function
328 * doesn't have to worry about freeing the original skb.
329 *
330 * Does not change skb->protocol so this function can be used during receive.
331 */
332static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
333 __be16 vlan_proto, u16 vlan_tci)
334{
335 int err;
336
337 err = __vlan_insert_tag(skb, vlan_proto, vlan_tci);
338 if (err) {
339 dev_kfree_skb_any(skb);
340 return NULL;
341 }
319 return skb; 342 return skb;
320} 343}
321 344
322/** 345/**
323 * __vlan_put_tag - regular VLAN tag inserting 346 * vlan_insert_tag_set_proto - regular VLAN tag inserting
324 * @skb: skbuff to tag 347 * @skb: skbuff to tag
348 * @vlan_proto: VLAN encapsulation protocol
325 * @vlan_tci: VLAN TCI to insert 349 * @vlan_tci: VLAN TCI to insert
326 * 350 *
327 * Inserts the VLAN tag into @skb as part of the payload 351 * Inserts the VLAN tag into @skb as part of the payload
@@ -330,8 +354,9 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
330 * Following the skb_unshare() example, in case of error, the calling function 354 * Following the skb_unshare() example, in case of error, the calling function
331 * doesn't have to worry about freeing the original skb. 355 * doesn't have to worry about freeing the original skb.
332 */ 356 */
333static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, 357static inline struct sk_buff *vlan_insert_tag_set_proto(struct sk_buff *skb,
334 __be16 vlan_proto, u16 vlan_tci) 358 __be16 vlan_proto,
359 u16 vlan_tci)
335{ 360{
336 skb = vlan_insert_tag(skb, vlan_proto, vlan_tci); 361 skb = vlan_insert_tag(skb, vlan_proto, vlan_tci);
337 if (skb) 362 if (skb)
@@ -339,39 +364,53 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb,
339 return skb; 364 return skb;
340} 365}
341 366
342/** 367/*
343 * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting 368 * __vlan_hwaccel_push_inside - pushes vlan tag to the payload
344 * @skb: skbuff to tag 369 * @skb: skbuff to tag
345 * @vlan_proto: VLAN encapsulation protocol
346 * @vlan_tci: VLAN TCI to insert
347 * 370 *
348 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest 371 * Pushes the VLAN tag from @skb->vlan_tci inside to the payload.
372 *
373 * Following the skb_unshare() example, in case of error, the calling function
374 * doesn't have to worry about freeing the original skb.
349 */ 375 */
350static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, 376static inline struct sk_buff *__vlan_hwaccel_push_inside(struct sk_buff *skb)
351 __be16 vlan_proto,
352 u16 vlan_tci)
353{ 377{
354 skb->vlan_proto = vlan_proto; 378 skb = vlan_insert_tag_set_proto(skb, skb->vlan_proto,
355 skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci; 379 vlan_tx_tag_get(skb));
380 if (likely(skb))
381 skb->vlan_tci = 0;
382 return skb;
383}
384/*
385 * vlan_hwaccel_push_inside - pushes vlan tag to the payload
386 * @skb: skbuff to tag
387 *
388 * Checks is tag is present in @skb->vlan_tci and if it is, it pushes the
389 * VLAN tag from @skb->vlan_tci inside to the payload.
390 *
391 * Following the skb_unshare() example, in case of error, the calling function
392 * doesn't have to worry about freeing the original skb.
393 */
394static inline struct sk_buff *vlan_hwaccel_push_inside(struct sk_buff *skb)
395{
396 if (vlan_tx_tag_present(skb))
397 skb = __vlan_hwaccel_push_inside(skb);
356 return skb; 398 return skb;
357} 399}
358 400
359/** 401/**
360 * vlan_put_tag - inserts VLAN tag according to device features 402 * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting
361 * @skb: skbuff to tag 403 * @skb: skbuff to tag
404 * @vlan_proto: VLAN encapsulation protocol
362 * @vlan_tci: VLAN TCI to insert 405 * @vlan_tci: VLAN TCI to insert
363 * 406 *
364 * Assumes skb->dev is the target that will xmit this frame. 407 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest
365 * Returns a VLAN tagged skb.
366 */ 408 */
367static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, 409static inline void __vlan_hwaccel_put_tag(struct sk_buff *skb,
368 __be16 vlan_proto, u16 vlan_tci) 410 __be16 vlan_proto, u16 vlan_tci)
369{ 411{
370 if (vlan_hw_offload_capable(skb->dev->features, vlan_proto)) { 412 skb->vlan_proto = vlan_proto;
371 return __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci); 413 skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci;
372 } else {
373 return __vlan_put_tag(skb, vlan_proto, vlan_tci);
374 }
375} 414}
376 415
377/** 416/**
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index ff560537dd61..c694e7baa621 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -42,6 +42,7 @@ struct ipv6_devconf {
42 __s32 accept_ra_from_local; 42 __s32 accept_ra_from_local;
43#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 43#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
44 __s32 optimistic_dad; 44 __s32 optimistic_dad;
45 __s32 use_optimistic;
45#endif 46#endif
46#ifdef CONFIG_IPV6_MROUTE 47#ifdef CONFIG_IPV6_MROUTE
47 __s32 mc_forwarding; 48 __s32 mc_forwarding;
@@ -316,14 +317,4 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
316#define tcp_twsk_ipv6only(__sk) 0 317#define tcp_twsk_ipv6only(__sk) 0
317#define inet_v6_ipv6only(__sk) 0 318#define inet_v6_ipv6only(__sk) 0
318#endif /* IS_ENABLED(CONFIG_IPV6) */ 319#endif /* IS_ENABLED(CONFIG_IPV6) */
319
320#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \
321 (((__sk)->sk_portpair == (__ports)) && \
322 ((__sk)->sk_family == AF_INET6) && \
323 ipv6_addr_equal(&(__sk)->sk_v6_daddr, (__saddr)) && \
324 ipv6_addr_equal(&(__sk)->sk_v6_rcv_saddr, (__daddr)) && \
325 (!(__sk)->sk_bound_dev_if || \
326 ((__sk)->sk_bound_dev_if == (__dif))) && \
327 net_eq(sock_net(__sk), (__net)))
328
329#endif /* _IPV6_H */ 320#endif /* _IPV6_H */
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index 8e9a029e093d..e6982ac3200d 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -16,6 +16,7 @@
16#define MARVELL_PHY_ID_88E1318S 0x01410e90 16#define MARVELL_PHY_ID_88E1318S 0x01410e90
17#define MARVELL_PHY_ID_88E1116R 0x01410e40 17#define MARVELL_PHY_ID_88E1116R 0x01410e40
18#define MARVELL_PHY_ID_88E1510 0x01410dd0 18#define MARVELL_PHY_ID_88E1510 0x01410dd0
19#define MARVELL_PHY_ID_88E3016 0x01410e60
19 20
20/* struct phy_device dev_flags definitions */ 21/* struct phy_device dev_flags definitions */
21#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001 22#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 53d33dee70e1..2e5b194b9b19 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -37,7 +37,6 @@
37 37
38/* struct phy_device dev_flags definitions */ 38/* struct phy_device dev_flags definitions */
39#define MICREL_PHY_50MHZ_CLK 0x00000001 39#define MICREL_PHY_50MHZ_CLK 0x00000001
40#define MICREL_PHY_25MHZ_CLK 0x00000002
41 40
42#define MICREL_KSZ9021_EXTREG_CTRL 0xB 41#define MICREL_KSZ9021_EXTREG_CTRL 0xB
43#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC 42#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 379c02648ab3..64d25941b329 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -67,6 +67,8 @@ enum {
67 MLX4_CMD_MAP_ICM_AUX = 0xffc, 67 MLX4_CMD_MAP_ICM_AUX = 0xffc,
68 MLX4_CMD_UNMAP_ICM_AUX = 0xffb, 68 MLX4_CMD_UNMAP_ICM_AUX = 0xffb,
69 MLX4_CMD_SET_ICM_SIZE = 0xffd, 69 MLX4_CMD_SET_ICM_SIZE = 0xffd,
70 MLX4_CMD_ACCESS_REG = 0x3b,
71
70 /*master notify fw on finish for slave's flr*/ 72 /*master notify fw on finish for slave's flr*/
71 MLX4_CMD_INFORM_FLR_DONE = 0x5b, 73 MLX4_CMD_INFORM_FLR_DONE = 0x5b,
72 MLX4_CMD_GET_OP_REQ = 0x59, 74 MLX4_CMD_GET_OP_REQ = 0x59,
@@ -197,6 +199,33 @@ enum {
197 MLX4_CMD_NATIVE 199 MLX4_CMD_NATIVE
198}; 200};
199 201
202/*
203 * MLX4_RX_CSUM_MODE_VAL_NON_TCP_UDP -
204 * Receive checksum value is reported in CQE also for non TCP/UDP packets.
205 *
206 * MLX4_RX_CSUM_MODE_L4 -
207 * L4_CSUM bit in CQE, which indicates whether or not L4 checksum
208 * was validated correctly, is supported.
209 *
210 * MLX4_RX_CSUM_MODE_IP_OK_IP_NON_TCP_UDP -
211 * IP_OK CQE's field is supported also for non TCP/UDP IP packets.
212 *
213 * MLX4_RX_CSUM_MODE_MULTI_VLAN -
214 * Receive Checksum offload is supported for packets with more than 2 vlan headers.
215 */
216enum mlx4_rx_csum_mode {
217 MLX4_RX_CSUM_MODE_VAL_NON_TCP_UDP = 1UL << 0,
218 MLX4_RX_CSUM_MODE_L4 = 1UL << 1,
219 MLX4_RX_CSUM_MODE_IP_OK_IP_NON_TCP_UDP = 1UL << 2,
220 MLX4_RX_CSUM_MODE_MULTI_VLAN = 1UL << 3
221};
222
223struct mlx4_config_dev_params {
224 u16 vxlan_udp_dport;
225 u8 rx_csum_flags_port_1;
226 u8 rx_csum_flags_port_2;
227};
228
200struct mlx4_dev; 229struct mlx4_dev;
201 230
202struct mlx4_cmd_mailbox { 231struct mlx4_cmd_mailbox {
@@ -248,6 +277,8 @@ int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
248int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); 277int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
249int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); 278int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
250int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state); 279int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state);
280int mlx4_config_dev_retrieval(struct mlx4_dev *dev,
281 struct mlx4_config_dev_params *params);
251/* 282/*
252 * mlx4_get_slave_default_vlan - 283 * mlx4_get_slave_default_vlan -
253 * return true if VST ( default vlan) 284 * return true if VST ( default vlan)
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 37e4404d0227..25c791e295fd 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -95,7 +95,7 @@ enum {
95 95
96enum { 96enum {
97 MLX4_MAX_NUM_PF = 16, 97 MLX4_MAX_NUM_PF = 16,
98 MLX4_MAX_NUM_VF = 64, 98 MLX4_MAX_NUM_VF = 126,
99 MLX4_MAX_NUM_VF_P_PORT = 64, 99 MLX4_MAX_NUM_VF_P_PORT = 64,
100 MLX4_MFUNC_MAX = 80, 100 MLX4_MFUNC_MAX = 80,
101 MLX4_MAX_EQ_NUM = 1024, 101 MLX4_MAX_EQ_NUM = 1024,
@@ -117,6 +117,14 @@ enum {
117 MLX4_STEERING_MODE_DEVICE_MANAGED 117 MLX4_STEERING_MODE_DEVICE_MANAGED
118}; 118};
119 119
120enum {
121 MLX4_STEERING_DMFS_A0_DEFAULT,
122 MLX4_STEERING_DMFS_A0_DYNAMIC,
123 MLX4_STEERING_DMFS_A0_STATIC,
124 MLX4_STEERING_DMFS_A0_DISABLE,
125 MLX4_STEERING_DMFS_A0_NOT_SUPPORTED
126};
127
120static inline const char *mlx4_steering_mode_str(int steering_mode) 128static inline const char *mlx4_steering_mode_str(int steering_mode)
121{ 129{
122 switch (steering_mode) { 130 switch (steering_mode) {
@@ -186,7 +194,31 @@ enum {
186 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10, 194 MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS = 1LL << 10,
187 MLX4_DEV_CAP_FLAG2_MAD_DEMUX = 1LL << 11, 195 MLX4_DEV_CAP_FLAG2_MAD_DEMUX = 1LL << 11,
188 MLX4_DEV_CAP_FLAG2_CQE_STRIDE = 1LL << 12, 196 MLX4_DEV_CAP_FLAG2_CQE_STRIDE = 1LL << 12,
189 MLX4_DEV_CAP_FLAG2_EQE_STRIDE = 1LL << 13 197 MLX4_DEV_CAP_FLAG2_EQE_STRIDE = 1LL << 13,
198 MLX4_DEV_CAP_FLAG2_ETH_PROT_CTRL = 1LL << 14,
199 MLX4_DEV_CAP_FLAG2_ETH_BACKPL_AN_REP = 1LL << 15,
200 MLX4_DEV_CAP_FLAG2_CONFIG_DEV = 1LL << 16,
201 MLX4_DEV_CAP_FLAG2_SYS_EQS = 1LL << 17,
202 MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18,
203 MLX4_DEV_CAP_FLAG2_FS_A0 = 1LL << 19
204};
205
206enum {
207 MLX4_QUERY_FUNC_FLAGS_BF_RES_QP = 1LL << 0,
208 MLX4_QUERY_FUNC_FLAGS_A0_RES_QP = 1LL << 1
209};
210
211/* bit enums for an 8-bit flags field indicating special use
212 * QPs which require special handling in qp_reserve_range.
213 * Currently, this only includes QPs used by the ETH interface,
214 * where we expect to use blueflame. These QPs must not have
215 * bits 6 and 7 set in their qp number.
216 *
217 * This enum may use only bits 0..7.
218 */
219enum {
220 MLX4_RESERVE_A0_QP = 1 << 6,
221 MLX4_RESERVE_ETH_BF_QP = 1 << 7,
190}; 222};
191 223
192enum { 224enum {
@@ -202,7 +234,8 @@ enum {
202 234
203enum { 235enum {
204 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0, 236 MLX4_FUNC_CAP_64B_EQE_CQE = 1L << 0,
205 MLX4_FUNC_CAP_EQE_CQE_STRIDE = 1L << 1 237 MLX4_FUNC_CAP_EQE_CQE_STRIDE = 1L << 1,
238 MLX4_FUNC_CAP_DMFS_A0_STATIC = 1L << 2
206}; 239};
207 240
208 241
@@ -328,6 +361,8 @@ enum {
328 361
329enum mlx4_qp_region { 362enum mlx4_qp_region {
330 MLX4_QP_REGION_FW = 0, 363 MLX4_QP_REGION_FW = 0,
364 MLX4_QP_REGION_RSS_RAW_ETH,
365 MLX4_QP_REGION_BOTTOM = MLX4_QP_REGION_RSS_RAW_ETH,
331 MLX4_QP_REGION_ETH_ADDR, 366 MLX4_QP_REGION_ETH_ADDR,
332 MLX4_QP_REGION_FC_ADDR, 367 MLX4_QP_REGION_FC_ADDR,
333 MLX4_QP_REGION_FC_EXCH, 368 MLX4_QP_REGION_FC_EXCH,
@@ -379,6 +414,13 @@ enum {
379#define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \ 414#define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \
380 MLX4_EQ_PORT_INFO_MSTR_SM_LID_CHANGE_MASK) 415 MLX4_EQ_PORT_INFO_MSTR_SM_LID_CHANGE_MASK)
381 416
417enum mlx4_module_id {
418 MLX4_MODULE_ID_SFP = 0x3,
419 MLX4_MODULE_ID_QSFP = 0xC,
420 MLX4_MODULE_ID_QSFP_PLUS = 0xD,
421 MLX4_MODULE_ID_QSFP28 = 0x11,
422};
423
382static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) 424static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
383{ 425{
384 return (major << 32) | (minor << 16) | subminor; 426 return (major << 32) | (minor << 16) | subminor;
@@ -433,6 +475,7 @@ struct mlx4_caps {
433 int num_cqs; 475 int num_cqs;
434 int max_cqes; 476 int max_cqes;
435 int reserved_cqs; 477 int reserved_cqs;
478 int num_sys_eqs;
436 int num_eqs; 479 int num_eqs;
437 int reserved_eqs; 480 int reserved_eqs;
438 int num_comp_vectors; 481 int num_comp_vectors;
@@ -449,6 +492,7 @@ struct mlx4_caps {
449 int reserved_mcgs; 492 int reserved_mcgs;
450 int num_qp_per_mgm; 493 int num_qp_per_mgm;
451 int steering_mode; 494 int steering_mode;
495 int dmfs_high_steer_mode;
452 int fs_log_max_ucast_qp_range_size; 496 int fs_log_max_ucast_qp_range_size;
453 int num_pds; 497 int num_pds;
454 int reserved_pds; 498 int reserved_pds;
@@ -487,6 +531,10 @@ struct mlx4_caps {
487 u16 hca_core_clock; 531 u16 hca_core_clock;
488 u64 phys_port_id[MLX4_MAX_PORTS + 1]; 532 u64 phys_port_id[MLX4_MAX_PORTS + 1];
489 int tunnel_offload_mode; 533 int tunnel_offload_mode;
534 u8 rx_checksum_flags_port[MLX4_MAX_PORTS + 1];
535 u8 alloc_res_qp_mask;
536 u32 dmfs_high_rate_qpn_base;
537 u32 dmfs_high_rate_qpn_range;
490}; 538};
491 539
492struct mlx4_buf_list { 540struct mlx4_buf_list {
@@ -607,6 +655,11 @@ struct mlx4_cq {
607 655
608 atomic_t refcount; 656 atomic_t refcount;
609 struct completion free; 657 struct completion free;
658 struct {
659 struct list_head list;
660 void (*comp)(struct mlx4_cq *);
661 void *priv;
662 } tasklet_ctx;
610}; 663};
611 664
612struct mlx4_qp { 665struct mlx4_qp {
@@ -799,6 +852,26 @@ struct mlx4_init_port_param {
799 u64 si_guid; 852 u64 si_guid;
800}; 853};
801 854
855#define MAD_IFC_DATA_SZ 192
856/* MAD IFC Mailbox */
857struct mlx4_mad_ifc {
858 u8 base_version;
859 u8 mgmt_class;
860 u8 class_version;
861 u8 method;
862 __be16 status;
863 __be16 class_specific;
864 __be64 tid;
865 __be16 attr_id;
866 __be16 resv;
867 __be32 attr_mod;
868 __be64 mkey;
869 __be16 dr_slid;
870 __be16 dr_dlid;
871 u8 reserved[28];
872 u8 data[MAD_IFC_DATA_SZ];
873} __packed;
874
802#define mlx4_foreach_port(port, dev, type) \ 875#define mlx4_foreach_port(port, dev, type) \
803 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 876 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
804 if ((type) == (dev)->caps.port_mask[(port)]) 877 if ((type) == (dev)->caps.port_mask[(port)])
@@ -835,7 +908,9 @@ static inline int mlx4_num_reserved_sqps(struct mlx4_dev *dev)
835static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn) 908static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn)
836{ 909{
837 return (qpn < dev->phys_caps.base_sqpn + 8 + 910 return (qpn < dev->phys_caps.base_sqpn + 8 +
838 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev)); 911 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev) &&
912 qpn >= dev->phys_caps.base_sqpn) ||
913 (qpn < dev->caps.reserved_qps_cnt[MLX4_QP_REGION_FW]);
839} 914}
840 915
841static inline int mlx4_is_guest_proxy(struct mlx4_dev *dev, int slave, u32 qpn) 916static inline int mlx4_is_guest_proxy(struct mlx4_dev *dev, int slave, u32 qpn)
@@ -911,8 +986,8 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
911 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, 986 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq,
912 unsigned vector, int collapsed, int timestamp_en); 987 unsigned vector, int collapsed, int timestamp_en);
913void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); 988void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
914 989int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align,
915int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); 990 int *base, u8 flags);
916void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt); 991void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt);
917 992
918int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp, 993int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp,
@@ -1283,10 +1358,50 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr,
1283 u64 iova, u64 size, int npages, 1358 u64 iova, u64 size, int npages,
1284 int page_shift, struct mlx4_mpt_entry *mpt_entry); 1359 int page_shift, struct mlx4_mpt_entry *mpt_entry);
1285 1360
1361int mlx4_get_module_info(struct mlx4_dev *dev, u8 port,
1362 u16 offset, u16 size, u8 *data);
1363
1286/* Returns true if running in low memory profile (kdump kernel) */ 1364/* Returns true if running in low memory profile (kdump kernel) */
1287static inline bool mlx4_low_memory_profile(void) 1365static inline bool mlx4_low_memory_profile(void)
1288{ 1366{
1289 return is_kdump_kernel(); 1367 return is_kdump_kernel();
1290} 1368}
1291 1369
1370/* ACCESS REG commands */
1371enum mlx4_access_reg_method {
1372 MLX4_ACCESS_REG_QUERY = 0x1,
1373 MLX4_ACCESS_REG_WRITE = 0x2,
1374};
1375
1376/* ACCESS PTYS Reg command */
1377enum mlx4_ptys_proto {
1378 MLX4_PTYS_IB = 1<<0,
1379 MLX4_PTYS_EN = 1<<2,
1380};
1381
1382struct mlx4_ptys_reg {
1383 u8 resrvd1;
1384 u8 local_port;
1385 u8 resrvd2;
1386 u8 proto_mask;
1387 __be32 resrvd3[2];
1388 __be32 eth_proto_cap;
1389 __be16 ib_width_cap;
1390 __be16 ib_speed_cap;
1391 __be32 resrvd4;
1392 __be32 eth_proto_admin;
1393 __be16 ib_width_admin;
1394 __be16 ib_speed_admin;
1395 __be32 resrvd5;
1396 __be32 eth_proto_oper;
1397 __be16 ib_width_oper;
1398 __be16 ib_speed_oper;
1399 __be32 resrvd6;
1400 __be32 eth_proto_lp_adv;
1401} __packed;
1402
1403int mlx4_ACCESS_PTYS_REG(struct mlx4_dev *dev,
1404 enum mlx4_access_reg_method method,
1405 struct mlx4_ptys_reg *ptys_reg);
1406
1292#endif /* MLX4_DEVICE_H */ 1407#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 5f4e36cf0091..467ccdf94c98 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -120,13 +120,15 @@ enum {
120 MLX4_RSS_QPC_FLAG_OFFSET = 13, 120 MLX4_RSS_QPC_FLAG_OFFSET = 13,
121}; 121};
122 122
123#define MLX4_EN_RSS_KEY_SIZE 40
124
123struct mlx4_rss_context { 125struct mlx4_rss_context {
124 __be32 base_qpn; 126 __be32 base_qpn;
125 __be32 default_qpn; 127 __be32 default_qpn;
126 u16 reserved; 128 u16 reserved;
127 u8 hash_fn; 129 u8 hash_fn;
128 u8 flags; 130 u8 flags;
129 __be32 rss_key[10]; 131 __be32 rss_key[MLX4_EN_RSS_KEY_SIZE / sizeof(__be32)];
130 __be32 base_qpn_udp; 132 __be32 base_qpn_udp;
131}; 133};
132 134
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 1d67fd32e71c..ea4f1c46f761 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -219,23 +219,15 @@ enum {
219}; 219};
220 220
221enum { 221enum {
222 MLX5_DEV_CAP_FLAG_RC = 1LL << 0,
223 MLX5_DEV_CAP_FLAG_UC = 1LL << 1,
224 MLX5_DEV_CAP_FLAG_UD = 1LL << 2,
225 MLX5_DEV_CAP_FLAG_XRC = 1LL << 3, 222 MLX5_DEV_CAP_FLAG_XRC = 1LL << 3,
226 MLX5_DEV_CAP_FLAG_SRQ = 1LL << 6,
227 MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8, 223 MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8,
228 MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9, 224 MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9,
229 MLX5_DEV_CAP_FLAG_APM = 1LL << 17, 225 MLX5_DEV_CAP_FLAG_APM = 1LL << 17,
230 MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18, 226 MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18,
231 MLX5_DEV_CAP_FLAG_BLOCK_MCAST = 1LL << 23, 227 MLX5_DEV_CAP_FLAG_BLOCK_MCAST = 1LL << 23,
232 MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24,
233 MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29, 228 MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29,
234 MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30, 229 MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30,
235 MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32,
236 MLX5_DEV_CAP_FLAG_DCT = 1LL << 37, 230 MLX5_DEV_CAP_FLAG_DCT = 1LL << 37,
237 MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38,
238 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
239 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40, 231 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
240 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46, 232 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 3LL << 46,
241}; 233};
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 246310dc8bef..b1bf41556b32 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -633,14 +633,6 @@ static inline void *mlx5_vzalloc(unsigned long size)
633 return rtn; 633 return rtn;
634} 634}
635 635
636static inline void mlx5_vfree(const void *addr)
637{
638 if (addr && is_vmalloc_addr(addr))
639 vfree(addr);
640 else
641 kfree(addr);
642}
643
644static inline u32 mlx5_base_mkey(const u32 key) 636static inline u32 mlx5_base_mkey(const u32 key)
645{ 637{
646 return key & 0xffffff00u; 638 return key & 0xffffff00u;
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index dcfdecbfa0b7..8e30685affeb 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -47,9 +47,9 @@ enum {
47 NETIF_F_GSO_SIT_BIT, /* ... SIT tunnel with TSO */ 47 NETIF_F_GSO_SIT_BIT, /* ... SIT tunnel with TSO */
48 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */ 48 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
49 NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,/* ... UDP TUNNEL with TSO & CSUM */ 49 NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,/* ... UDP TUNNEL with TSO & CSUM */
50 NETIF_F_GSO_MPLS_BIT, /* ... MPLS segmentation */ 50 NETIF_F_GSO_TUNNEL_REMCSUM_BIT, /* ... TUNNEL with TSO & REMCSUM */
51 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ 51 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
52 NETIF_F_GSO_MPLS_BIT, 52 NETIF_F_GSO_TUNNEL_REMCSUM_BIT,
53 53
54 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ 54 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
55 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ 55 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
@@ -118,7 +118,7 @@ enum {
118#define NETIF_F_GSO_SIT __NETIF_F(GSO_SIT) 118#define NETIF_F_GSO_SIT __NETIF_F(GSO_SIT)
119#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL) 119#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL)
120#define NETIF_F_GSO_UDP_TUNNEL_CSUM __NETIF_F(GSO_UDP_TUNNEL_CSUM) 120#define NETIF_F_GSO_UDP_TUNNEL_CSUM __NETIF_F(GSO_UDP_TUNNEL_CSUM)
121#define NETIF_F_GSO_MPLS __NETIF_F(GSO_MPLS) 121#define NETIF_F_GSO_TUNNEL_REMCSUM __NETIF_F(GSO_TUNNEL_REMCSUM)
122#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) 122#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
123#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 123#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
124#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 124#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
@@ -181,7 +181,6 @@ enum {
181 NETIF_F_GSO_IPIP | \ 181 NETIF_F_GSO_IPIP | \
182 NETIF_F_GSO_SIT | \ 182 NETIF_F_GSO_SIT | \
183 NETIF_F_GSO_UDP_TUNNEL | \ 183 NETIF_F_GSO_UDP_TUNNEL | \
184 NETIF_F_GSO_UDP_TUNNEL_CSUM | \ 184 NETIF_F_GSO_UDP_TUNNEL_CSUM)
185 NETIF_F_GSO_MPLS)
186 185
187#endif /* _LINUX_NETDEV_FEATURES_H */ 186#endif /* _LINUX_NETDEV_FEATURES_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 74fd5d37f15a..c31f74d76ebd 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -57,6 +57,8 @@ struct device;
57struct phy_device; 57struct phy_device;
58/* 802.11 specific */ 58/* 802.11 specific */
59struct wireless_dev; 59struct wireless_dev;
60/* 802.15.4 specific */
61struct wpan_dev;
60 62
61void netdev_set_default_ethtool_ops(struct net_device *dev, 63void netdev_set_default_ethtool_ops(struct net_device *dev,
62 const struct ethtool_ops *ops); 64 const struct ethtool_ops *ops);
@@ -314,6 +316,7 @@ struct napi_struct {
314 struct net_device *dev; 316 struct net_device *dev;
315 struct sk_buff *gro_list; 317 struct sk_buff *gro_list;
316 struct sk_buff *skb; 318 struct sk_buff *skb;
319 struct hrtimer timer;
317 struct list_head dev_list; 320 struct list_head dev_list;
318 struct hlist_node napi_hash_node; 321 struct hlist_node napi_hash_node;
319 unsigned int napi_id; 322 unsigned int napi_id;
@@ -386,6 +389,7 @@ typedef enum rx_handler_result rx_handler_result_t;
386typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); 389typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
387 390
388void __napi_schedule(struct napi_struct *n); 391void __napi_schedule(struct napi_struct *n);
392void __napi_schedule_irqoff(struct napi_struct *n);
389 393
390static inline bool napi_disable_pending(struct napi_struct *n) 394static inline bool napi_disable_pending(struct napi_struct *n)
391{ 395{
@@ -420,6 +424,18 @@ static inline void napi_schedule(struct napi_struct *n)
420 __napi_schedule(n); 424 __napi_schedule(n);
421} 425}
422 426
427/**
428 * napi_schedule_irqoff - schedule NAPI poll
429 * @n: napi context
430 *
431 * Variant of napi_schedule(), assuming hard irqs are masked.
432 */
433static inline void napi_schedule_irqoff(struct napi_struct *n)
434{
435 if (napi_schedule_prep(n))
436 __napi_schedule_irqoff(n);
437}
438
423/* Try to reschedule poll. Called by dev->poll() after napi_complete(). */ 439/* Try to reschedule poll. Called by dev->poll() after napi_complete(). */
424static inline bool napi_reschedule(struct napi_struct *napi) 440static inline bool napi_reschedule(struct napi_struct *napi)
425{ 441{
@@ -430,14 +446,19 @@ static inline bool napi_reschedule(struct napi_struct *napi)
430 return false; 446 return false;
431} 447}
432 448
449void __napi_complete(struct napi_struct *n);
450void napi_complete_done(struct napi_struct *n, int work_done);
433/** 451/**
434 * napi_complete - NAPI processing complete 452 * napi_complete - NAPI processing complete
435 * @n: napi context 453 * @n: napi context
436 * 454 *
437 * Mark NAPI processing as complete. 455 * Mark NAPI processing as complete.
456 * Consider using napi_complete_done() instead.
438 */ 457 */
439void __napi_complete(struct napi_struct *n); 458static inline void napi_complete(struct napi_struct *n)
440void napi_complete(struct napi_struct *n); 459{
460 return napi_complete_done(n, 0);
461}
441 462
442/** 463/**
443 * napi_by_id - lookup a NAPI by napi_id 464 * napi_by_id - lookup a NAPI by napi_id
@@ -472,14 +493,7 @@ void napi_hash_del(struct napi_struct *napi);
472 * Stop NAPI from being scheduled on this context. 493 * Stop NAPI from being scheduled on this context.
473 * Waits till any outstanding processing completes. 494 * Waits till any outstanding processing completes.
474 */ 495 */
475static inline void napi_disable(struct napi_struct *n) 496void napi_disable(struct napi_struct *n);
476{
477 might_sleep();
478 set_bit(NAPI_STATE_DISABLE, &n->state);
479 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
480 msleep(1);
481 clear_bit(NAPI_STATE_DISABLE, &n->state);
482}
483 497
484/** 498/**
485 * napi_enable - enable NAPI scheduling 499 * napi_enable - enable NAPI scheduling
@@ -740,13 +754,13 @@ struct netdev_fcoe_hbainfo {
740}; 754};
741#endif 755#endif
742 756
743#define MAX_PHYS_PORT_ID_LEN 32 757#define MAX_PHYS_ITEM_ID_LEN 32
744 758
745/* This structure holds a unique identifier to identify the 759/* This structure holds a unique identifier to identify some
746 * physical port used by a netdevice. 760 * physical item (port for example) used by a netdevice.
747 */ 761 */
748struct netdev_phys_port_id { 762struct netdev_phys_item_id {
749 unsigned char id[MAX_PHYS_PORT_ID_LEN]; 763 unsigned char id[MAX_PHYS_ITEM_ID_LEN];
750 unsigned char id_len; 764 unsigned char id_len;
751}; 765};
752 766
@@ -937,11 +951,11 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
937 * 951 *
938 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct nlattr *tb[], 952 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct nlattr *tb[],
939 * struct net_device *dev, 953 * struct net_device *dev,
940 * const unsigned char *addr, u16 flags) 954 * const unsigned char *addr, u16 vid, u16 flags)
941 * Adds an FDB entry to dev for addr. 955 * Adds an FDB entry to dev for addr.
942 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[], 956 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[],
943 * struct net_device *dev, 957 * struct net_device *dev,
944 * const unsigned char *addr) 958 * const unsigned char *addr, u16 vid)
945 * Deletes the FDB entry from dev coresponding to addr. 959 * Deletes the FDB entry from dev coresponding to addr.
946 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, 960 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
947 * struct net_device *dev, struct net_device *filter_dev, 961 * struct net_device *dev, struct net_device *filter_dev,
@@ -962,7 +976,7 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
962 * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function. 976 * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function.
963 * 977 *
964 * int (*ndo_get_phys_port_id)(struct net_device *dev, 978 * int (*ndo_get_phys_port_id)(struct net_device *dev,
965 * struct netdev_phys_port_id *ppid); 979 * struct netdev_phys_item_id *ppid);
966 * Called to get ID of physical port of this device. If driver does 980 * Called to get ID of physical port of this device. If driver does
967 * not implement this, it is assumed that the hw is not able to have 981 * not implement this, it is assumed that the hw is not able to have
968 * multiple net devices on single physical port. 982 * multiple net devices on single physical port.
@@ -1004,6 +1018,15 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
1004 * performing GSO on a packet. The device returns true if it is 1018 * performing GSO on a packet. The device returns true if it is
1005 * able to GSO the packet, false otherwise. If the return value is 1019 * able to GSO the packet, false otherwise. If the return value is
1006 * false the stack will do software GSO. 1020 * false the stack will do software GSO.
1021 *
1022 * int (*ndo_switch_parent_id_get)(struct net_device *dev,
1023 * struct netdev_phys_item_id *psid);
1024 * Called to get an ID of the switch chip this port is part of.
1025 * If driver implements this, it indicates that it represents a port
1026 * of a switch chip.
1027 * int (*ndo_switch_port_stp_update)(struct net_device *dev, u8 state);
1028 * Called to notify switch device port of bridge port STP
1029 * state change.
1007 */ 1030 */
1008struct net_device_ops { 1031struct net_device_ops {
1009 int (*ndo_init)(struct net_device *dev); 1032 int (*ndo_init)(struct net_device *dev);
@@ -1114,11 +1137,13 @@ struct net_device_ops {
1114 struct nlattr *tb[], 1137 struct nlattr *tb[],
1115 struct net_device *dev, 1138 struct net_device *dev,
1116 const unsigned char *addr, 1139 const unsigned char *addr,
1140 u16 vid,
1117 u16 flags); 1141 u16 flags);
1118 int (*ndo_fdb_del)(struct ndmsg *ndm, 1142 int (*ndo_fdb_del)(struct ndmsg *ndm,
1119 struct nlattr *tb[], 1143 struct nlattr *tb[],
1120 struct net_device *dev, 1144 struct net_device *dev,
1121 const unsigned char *addr); 1145 const unsigned char *addr,
1146 u16 vid);
1122 int (*ndo_fdb_dump)(struct sk_buff *skb, 1147 int (*ndo_fdb_dump)(struct sk_buff *skb,
1123 struct netlink_callback *cb, 1148 struct netlink_callback *cb,
1124 struct net_device *dev, 1149 struct net_device *dev,
@@ -1136,7 +1161,7 @@ struct net_device_ops {
1136 int (*ndo_change_carrier)(struct net_device *dev, 1161 int (*ndo_change_carrier)(struct net_device *dev,
1137 bool new_carrier); 1162 bool new_carrier);
1138 int (*ndo_get_phys_port_id)(struct net_device *dev, 1163 int (*ndo_get_phys_port_id)(struct net_device *dev,
1139 struct netdev_phys_port_id *ppid); 1164 struct netdev_phys_item_id *ppid);
1140 void (*ndo_add_vxlan_port)(struct net_device *dev, 1165 void (*ndo_add_vxlan_port)(struct net_device *dev,
1141 sa_family_t sa_family, 1166 sa_family_t sa_family,
1142 __be16 port); 1167 __be16 port);
@@ -1155,6 +1180,12 @@ struct net_device_ops {
1155 int (*ndo_get_lock_subclass)(struct net_device *dev); 1180 int (*ndo_get_lock_subclass)(struct net_device *dev);
1156 bool (*ndo_gso_check) (struct sk_buff *skb, 1181 bool (*ndo_gso_check) (struct sk_buff *skb,
1157 struct net_device *dev); 1182 struct net_device *dev);
1183#ifdef CONFIG_NET_SWITCHDEV
1184 int (*ndo_switch_parent_id_get)(struct net_device *dev,
1185 struct netdev_phys_item_id *psid);
1186 int (*ndo_switch_port_stp_update)(struct net_device *dev,
1187 u8 state);
1188#endif
1158}; 1189};
1159 1190
1160/** 1191/**
@@ -1216,6 +1247,8 @@ enum netdev_priv_flags {
1216 IFF_LIVE_ADDR_CHANGE = 1<<20, 1247 IFF_LIVE_ADDR_CHANGE = 1<<20,
1217 IFF_MACVLAN = 1<<21, 1248 IFF_MACVLAN = 1<<21,
1218 IFF_XMIT_DST_RELEASE_PERM = 1<<22, 1249 IFF_XMIT_DST_RELEASE_PERM = 1<<22,
1250 IFF_IPVLAN_MASTER = 1<<23,
1251 IFF_IPVLAN_SLAVE = 1<<24,
1219}; 1252};
1220 1253
1221#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN 1254#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1241,6 +1274,8 @@ enum netdev_priv_flags {
1241#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE 1274#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
1242#define IFF_MACVLAN IFF_MACVLAN 1275#define IFF_MACVLAN IFF_MACVLAN
1243#define IFF_XMIT_DST_RELEASE_PERM IFF_XMIT_DST_RELEASE_PERM 1276#define IFF_XMIT_DST_RELEASE_PERM IFF_XMIT_DST_RELEASE_PERM
1277#define IFF_IPVLAN_MASTER IFF_IPVLAN_MASTER
1278#define IFF_IPVLAN_SLAVE IFF_IPVLAN_SLAVE
1244 1279
1245/** 1280/**
1246 * struct net_device - The DEVICE structure. 1281 * struct net_device - The DEVICE structure.
@@ -1572,6 +1607,7 @@ struct net_device {
1572 struct inet6_dev __rcu *ip6_ptr; 1607 struct inet6_dev __rcu *ip6_ptr;
1573 void *ax25_ptr; 1608 void *ax25_ptr;
1574 struct wireless_dev *ieee80211_ptr; 1609 struct wireless_dev *ieee80211_ptr;
1610 struct wpan_dev *ieee802154_ptr;
1575 1611
1576/* 1612/*
1577 * Cache lines mostly used on receive path (including eth_type_trans()) 1613 * Cache lines mostly used on receive path (including eth_type_trans())
@@ -1590,6 +1626,7 @@ struct net_device {
1590 1626
1591#endif 1627#endif
1592 1628
1629 unsigned long gro_flush_timeout;
1593 rx_handler_func_t __rcu *rx_handler; 1630 rx_handler_func_t __rcu *rx_handler;
1594 void __rcu *rx_handler_data; 1631 void __rcu *rx_handler_data;
1595 1632
@@ -2316,10 +2353,7 @@ extern int netdev_flow_limit_table_len;
2316 * Incoming packets are placed on per-cpu queues 2353 * Incoming packets are placed on per-cpu queues
2317 */ 2354 */
2318struct softnet_data { 2355struct softnet_data {
2319 struct Qdisc *output_queue;
2320 struct Qdisc **output_queue_tailp;
2321 struct list_head poll_list; 2356 struct list_head poll_list;
2322 struct sk_buff *completion_queue;
2323 struct sk_buff_head process_queue; 2357 struct sk_buff_head process_queue;
2324 2358
2325 /* stats */ 2359 /* stats */
@@ -2327,10 +2361,17 @@ struct softnet_data {
2327 unsigned int time_squeeze; 2361 unsigned int time_squeeze;
2328 unsigned int cpu_collision; 2362 unsigned int cpu_collision;
2329 unsigned int received_rps; 2363 unsigned int received_rps;
2330
2331#ifdef CONFIG_RPS 2364#ifdef CONFIG_RPS
2332 struct softnet_data *rps_ipi_list; 2365 struct softnet_data *rps_ipi_list;
2366#endif
2367#ifdef CONFIG_NET_FLOW_LIMIT
2368 struct sd_flow_limit __rcu *flow_limit;
2369#endif
2370 struct Qdisc *output_queue;
2371 struct Qdisc **output_queue_tailp;
2372 struct sk_buff *completion_queue;
2333 2373
2374#ifdef CONFIG_RPS
2334 /* Elements below can be accessed between CPUs for RPS */ 2375 /* Elements below can be accessed between CPUs for RPS */
2335 struct call_single_data csd ____cacheline_aligned_in_smp; 2376 struct call_single_data csd ____cacheline_aligned_in_smp;
2336 struct softnet_data *rps_ipi_next; 2377 struct softnet_data *rps_ipi_next;
@@ -2342,9 +2383,6 @@ struct softnet_data {
2342 struct sk_buff_head input_pkt_queue; 2383 struct sk_buff_head input_pkt_queue;
2343 struct napi_struct backlog; 2384 struct napi_struct backlog;
2344 2385
2345#ifdef CONFIG_NET_FLOW_LIMIT
2346 struct sd_flow_limit __rcu *flow_limit;
2347#endif
2348}; 2386};
2349 2387
2350static inline void input_queue_head_incr(struct softnet_data *sd) 2388static inline void input_queue_head_incr(struct softnet_data *sd)
@@ -2748,23 +2786,6 @@ static inline int netif_set_real_num_rx_queues(struct net_device *dev,
2748} 2786}
2749#endif 2787#endif
2750 2788
2751static inline int netif_copy_real_num_queues(struct net_device *to_dev,
2752 const struct net_device *from_dev)
2753{
2754 int err;
2755
2756 err = netif_set_real_num_tx_queues(to_dev,
2757 from_dev->real_num_tx_queues);
2758 if (err)
2759 return err;
2760#ifdef CONFIG_SYSFS
2761 return netif_set_real_num_rx_queues(to_dev,
2762 from_dev->real_num_rx_queues);
2763#else
2764 return 0;
2765#endif
2766}
2767
2768#ifdef CONFIG_SYSFS 2789#ifdef CONFIG_SYSFS
2769static inline unsigned int get_netdev_rx_queue_index( 2790static inline unsigned int get_netdev_rx_queue_index(
2770 struct netdev_rx_queue *queue) 2791 struct netdev_rx_queue *queue)
@@ -2864,7 +2885,7 @@ void dev_set_group(struct net_device *, int);
2864int dev_set_mac_address(struct net_device *, struct sockaddr *); 2885int dev_set_mac_address(struct net_device *, struct sockaddr *);
2865int dev_change_carrier(struct net_device *, bool new_carrier); 2886int dev_change_carrier(struct net_device *, bool new_carrier);
2866int dev_get_phys_port_id(struct net_device *dev, 2887int dev_get_phys_port_id(struct net_device *dev,
2867 struct netdev_phys_port_id *ppid); 2888 struct netdev_phys_item_id *ppid);
2868struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev); 2889struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
2869struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2890struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2870 struct netdev_queue *txq, int *ret); 2891 struct netdev_queue *txq, int *ret);
@@ -3425,6 +3446,12 @@ void netdev_upper_dev_unlink(struct net_device *dev,
3425void netdev_adjacent_rename_links(struct net_device *dev, char *oldname); 3446void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
3426void *netdev_lower_dev_get_private(struct net_device *dev, 3447void *netdev_lower_dev_get_private(struct net_device *dev,
3427 struct net_device *lower_dev); 3448 struct net_device *lower_dev);
3449
3450/* RSS keys are 40 or 52 bytes long */
3451#define NETDEV_RSS_KEY_LEN 52
3452extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
3453void netdev_rss_key_fill(void *buffer, size_t len);
3454
3428int dev_get_nest_level(struct net_device *dev, 3455int dev_get_nest_level(struct net_device *dev,
3429 bool (*type_check)(struct net_device *dev)); 3456 bool (*type_check)(struct net_device *dev));
3430int skb_checksum_help(struct sk_buff *skb); 3457int skb_checksum_help(struct sk_buff *skb);
@@ -3569,7 +3596,7 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)
3569 BUILD_BUG_ON(SKB_GSO_SIT != (NETIF_F_GSO_SIT >> NETIF_F_GSO_SHIFT)); 3596 BUILD_BUG_ON(SKB_GSO_SIT != (NETIF_F_GSO_SIT >> NETIF_F_GSO_SHIFT));
3570 BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL != (NETIF_F_GSO_UDP_TUNNEL >> NETIF_F_GSO_SHIFT)); 3597 BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL != (NETIF_F_GSO_UDP_TUNNEL >> NETIF_F_GSO_SHIFT));
3571 BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL_CSUM != (NETIF_F_GSO_UDP_TUNNEL_CSUM >> NETIF_F_GSO_SHIFT)); 3598 BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL_CSUM != (NETIF_F_GSO_UDP_TUNNEL_CSUM >> NETIF_F_GSO_SHIFT));
3572 BUILD_BUG_ON(SKB_GSO_MPLS != (NETIF_F_GSO_MPLS >> NETIF_F_GSO_SHIFT)); 3599 BUILD_BUG_ON(SKB_GSO_TUNNEL_REMCSUM != (NETIF_F_GSO_TUNNEL_REMCSUM >> NETIF_F_GSO_SHIFT));
3573 3600
3574 return (features & feature) == feature; 3601 return (features & feature) == feature;
3575} 3602}
@@ -3614,6 +3641,21 @@ static inline bool netif_is_macvlan(struct net_device *dev)
3614 return dev->priv_flags & IFF_MACVLAN; 3641 return dev->priv_flags & IFF_MACVLAN;
3615} 3642}
3616 3643
3644static inline bool netif_is_macvlan_port(struct net_device *dev)
3645{
3646 return dev->priv_flags & IFF_MACVLAN_PORT;
3647}
3648
3649static inline bool netif_is_ipvlan(struct net_device *dev)
3650{
3651 return dev->priv_flags & IFF_IPVLAN_SLAVE;
3652}
3653
3654static inline bool netif_is_ipvlan_port(struct net_device *dev)
3655{
3656 return dev->priv_flags & IFF_IPVLAN_MASTER;
3657}
3658
3617static inline bool netif_is_bond_master(struct net_device *dev) 3659static inline bool netif_is_bond_master(struct net_device *dev)
3618{ 3660{
3619 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; 3661 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index 20163b9a0eae..167342c2ce6b 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.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 */ 15 */
20 16
21#ifndef NL802154_H 17#ifndef NL802154_H
diff --git a/include/linux/phy.h b/include/linux/phy.h
index d090cfcaa167..22af8f8f5802 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -433,6 +433,7 @@ struct phy_device {
433 * by this PHY 433 * by this PHY
434 * flags: A bitfield defining certain other features this PHY 434 * flags: A bitfield defining certain other features this PHY
435 * supports (like interrupts) 435 * supports (like interrupts)
436 * driver_data: static driver data
436 * 437 *
437 * The drivers must implement config_aneg and read_status. All 438 * The drivers must implement config_aneg and read_status. All
438 * other functions are optional. Note that none of these 439 * other functions are optional. Note that none of these
@@ -448,6 +449,7 @@ struct phy_driver {
448 unsigned int phy_id_mask; 449 unsigned int phy_id_mask;
449 u32 features; 450 u32 features;
450 u32 flags; 451 u32 flags;
452 const void *driver_data;
451 453
452 /* 454 /*
453 * Called to issue a PHY software reset 455 * Called to issue a PHY software reset
@@ -772,4 +774,28 @@ int __init mdio_bus_init(void);
772void mdio_bus_exit(void); 774void mdio_bus_exit(void);
773 775
774extern struct bus_type mdio_bus_type; 776extern struct bus_type mdio_bus_type;
777
778/**
779 * module_phy_driver() - Helper macro for registering PHY drivers
780 * @__phy_drivers: array of PHY drivers to register
781 *
782 * Helper macro for PHY drivers which do not do anything special in module
783 * init/exit. Each module may only use this macro once, and calling it
784 * replaces module_init() and module_exit().
785 */
786#define phy_module_driver(__phy_drivers, __count) \
787static int __init phy_module_init(void) \
788{ \
789 return phy_drivers_register(__phy_drivers, __count); \
790} \
791module_init(phy_module_init); \
792static void __exit phy_module_exit(void) \
793{ \
794 phy_drivers_unregister(__phy_drivers, __count); \
795} \
796module_exit(phy_module_exit)
797
798#define module_phy_driver(__phy_drivers) \
799 phy_module_driver(__phy_drivers, ARRAY_SIZE(__phy_drivers))
800
775#endif /* __PHY_H */ 801#endif /* __PHY_H */
diff --git a/include/linux/platform_data/bcmgenet.h b/include/linux/platform_data/bcmgenet.h
new file mode 100644
index 000000000000..26af54321958
--- /dev/null
+++ b/include/linux/platform_data/bcmgenet.h
@@ -0,0 +1,18 @@
1#ifndef __LINUX_PLATFORM_DATA_BCMGENET_H__
2#define __LINUX_PLATFORM_DATA_BCMGENET_H__
3
4#include <linux/types.h>
5#include <linux/if_ether.h>
6#include <linux/phy.h>
7
8struct bcmgenet_platform_data {
9 bool mdio_enabled;
10 phy_interface_t phy_interface;
11 int phy_address;
12 int phy_speed;
13 int phy_duplex;
14 u8 mac_address[ETH_ALEN];
15 int genet_version;
16};
17
18#endif
diff --git a/include/linux/platform_data/st21nfca.h b/include/linux/platform_data/st21nfca.h
index 1730312398ff..5087fff96d86 100644
--- a/include/linux/platform_data/st21nfca.h
+++ b/include/linux/platform_data/st21nfca.h
@@ -24,7 +24,6 @@
24#define ST21NFCA_HCI_DRIVER_NAME "st21nfca_hci" 24#define ST21NFCA_HCI_DRIVER_NAME "st21nfca_hci"
25 25
26struct st21nfca_nfc_platform_data { 26struct st21nfca_nfc_platform_data {
27 unsigned int gpio_irq;
28 unsigned int gpio_ena; 27 unsigned int gpio_ena;
29 unsigned int irq_polarity; 28 unsigned int irq_polarity;
30}; 29};
diff --git a/include/linux/platform_data/st21nfcb.h b/include/linux/platform_data/st21nfcb.h
index 2d11f1f5efab..c3b432f5b63e 100644
--- a/include/linux/platform_data/st21nfcb.h
+++ b/include/linux/platform_data/st21nfcb.h
@@ -24,7 +24,6 @@
24#define ST21NFCB_NCI_DRIVER_NAME "st21nfcb_nci" 24#define ST21NFCB_NCI_DRIVER_NAME "st21nfcb_nci"
25 25
26struct st21nfcb_nfc_platform_data { 26struct st21nfcb_nfc_platform_data {
27 unsigned int gpio_irq;
28 unsigned int gpio_reset; 27 unsigned int gpio_reset;
29 unsigned int irq_polarity; 28 unsigned int irq_polarity;
30}; 29};
diff --git a/include/linux/pxa168_eth.h b/include/linux/pxa168_eth.h
index 18d75e795606..e1ab6e86cdb3 100644
--- a/include/linux/pxa168_eth.h
+++ b/include/linux/pxa168_eth.h
@@ -4,6 +4,8 @@
4#ifndef __LINUX_PXA168_ETH_H 4#ifndef __LINUX_PXA168_ETH_H
5#define __LINUX_PXA168_ETH_H 5#define __LINUX_PXA168_ETH_H
6 6
7#include <linux/phy.h>
8
7struct pxa168_eth_platform_data { 9struct pxa168_eth_platform_data {
8 int port_number; 10 int port_number;
9 int phy_addr; 11 int phy_addr;
@@ -13,6 +15,7 @@ struct pxa168_eth_platform_data {
13 */ 15 */
14 int speed; /* 0, SPEED_10, SPEED_100 */ 16 int speed; /* 0, SPEED_10, SPEED_100 */
15 int duplex; /* DUPLEX_HALF or DUPLEX_FULL */ 17 int duplex; /* DUPLEX_HALF or DUPLEX_FULL */
18 phy_interface_t intf;
16 19
17 /* 20 /*
18 * Override default RX/TX queue sizes if nonzero. 21 * Override default RX/TX queue sizes if nonzero.
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 372ad5e0dcb8..aa79b3c24f66 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -542,6 +542,15 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,
542 pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\ 542 pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
543 typeof(*(pos)), member)) 543 typeof(*(pos)), member))
544 544
545/**
546 * hlist_for_each_entry_from_rcu - iterate over a hlist continuing from current point
547 * @pos: the type * to use as a loop cursor.
548 * @member: the name of the hlist_node within the struct.
549 */
550#define hlist_for_each_entry_from_rcu(pos, member) \
551 for (; pos; \
552 pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
553 typeof(*(pos)), member))
545 554
546#endif /* __KERNEL__ */ 555#endif /* __KERNEL__ */
547#endif 556#endif
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index fb298e9d6d3a..b93fd89b2e5e 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -65,7 +65,10 @@ struct rhashtable_params {
65 size_t new_size); 65 size_t new_size);
66 bool (*shrink_decision)(const struct rhashtable *ht, 66 bool (*shrink_decision)(const struct rhashtable *ht,
67 size_t new_size); 67 size_t new_size);
68 int (*mutex_is_held)(void); 68#ifdef CONFIG_PROVE_LOCKING
69 int (*mutex_is_held)(void *parent);
70 void *parent;
71#endif
69}; 72};
70 73
71/** 74/**
@@ -96,16 +99,16 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params);
96u32 rhashtable_hashfn(const struct rhashtable *ht, const void *key, u32 len); 99u32 rhashtable_hashfn(const struct rhashtable *ht, const void *key, u32 len);
97u32 rhashtable_obj_hashfn(const struct rhashtable *ht, void *ptr); 100u32 rhashtable_obj_hashfn(const struct rhashtable *ht, void *ptr);
98 101
99void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node, gfp_t); 102void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node);
100bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node, gfp_t); 103bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node);
101void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj, 104void rhashtable_remove_pprev(struct rhashtable *ht, struct rhash_head *obj,
102 struct rhash_head __rcu **pprev, gfp_t flags); 105 struct rhash_head __rcu **pprev);
103 106
104bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size); 107bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size);
105bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size); 108bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size);
106 109
107int rhashtable_expand(struct rhashtable *ht, gfp_t flags); 110int rhashtable_expand(struct rhashtable *ht);
108int rhashtable_shrink(struct rhashtable *ht, gfp_t flags); 111int rhashtable_shrink(struct rhashtable *ht);
109 112
110void *rhashtable_lookup(const struct rhashtable *ht, const void *key); 113void *rhashtable_lookup(const struct rhashtable *ht, const void *key);
111void *rhashtable_lookup_compare(const struct rhashtable *ht, u32 hash, 114void *rhashtable_lookup_compare(const struct rhashtable *ht, u32 hash,
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 6cacbce1a06c..5db76a32fcab 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -17,6 +17,11 @@ extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
17 u32 id, long expires, u32 error); 17 u32 id, long expires, u32 error);
18 18
19void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change, gfp_t flags); 19void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change, gfp_t flags);
20struct sk_buff *rtmsg_ifinfo_build_skb(int type, struct net_device *dev,
21 unsigned change, gfp_t flags);
22void rtmsg_ifinfo_send(struct sk_buff *skb, struct net_device *dev,
23 gfp_t flags);
24
20 25
21/* RTNL is used as a global lock for all changes to network configuration */ 26/* RTNL is used as a global lock for all changes to network configuration */
22extern void rtnl_lock(void); 27extern void rtnl_lock(void);
@@ -94,12 +99,15 @@ extern int ndo_dflt_fdb_add(struct ndmsg *ndm,
94 struct nlattr *tb[], 99 struct nlattr *tb[],
95 struct net_device *dev, 100 struct net_device *dev,
96 const unsigned char *addr, 101 const unsigned char *addr,
97 u16 flags); 102 u16 vid,
103 u16 flags);
98extern int ndo_dflt_fdb_del(struct ndmsg *ndm, 104extern int ndo_dflt_fdb_del(struct ndmsg *ndm,
99 struct nlattr *tb[], 105 struct nlattr *tb[],
100 struct net_device *dev, 106 struct net_device *dev,
101 const unsigned char *addr); 107 const unsigned char *addr,
108 u16 vid);
102 109
103extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, 110extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
104 struct net_device *dev, u16 mode); 111 struct net_device *dev, u16 mode,
112 u32 flags, u32 mask);
105#endif /* __LINUX_RTNETLINK_H */ 113#endif /* __LINUX_RTNETLINK_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 6c8b6f604e76..85ab7d72b54c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -20,6 +20,8 @@
20#include <linux/time.h> 20#include <linux/time.h>
21#include <linux/bug.h> 21#include <linux/bug.h>
22#include <linux/cache.h> 22#include <linux/cache.h>
23#include <linux/rbtree.h>
24#include <linux/socket.h>
23 25
24#include <linux/atomic.h> 26#include <linux/atomic.h>
25#include <asm/types.h> 27#include <asm/types.h>
@@ -148,6 +150,8 @@
148struct net_device; 150struct net_device;
149struct scatterlist; 151struct scatterlist;
150struct pipe_inode_info; 152struct pipe_inode_info;
153struct iov_iter;
154struct napi_struct;
151 155
152#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 156#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
153struct nf_conntrack { 157struct nf_conntrack {
@@ -341,7 +345,6 @@ enum {
341 SKB_FCLONE_UNAVAILABLE, /* skb has no fclone (from head_cache) */ 345 SKB_FCLONE_UNAVAILABLE, /* skb has no fclone (from head_cache) */
342 SKB_FCLONE_ORIG, /* orig skb (from fclone_cache) */ 346 SKB_FCLONE_ORIG, /* orig skb (from fclone_cache) */
343 SKB_FCLONE_CLONE, /* companion fclone skb (from fclone_cache) */ 347 SKB_FCLONE_CLONE, /* companion fclone skb (from fclone_cache) */
344 SKB_FCLONE_FREE, /* this companion fclone skb is available */
345}; 348};
346 349
347enum { 350enum {
@@ -370,8 +373,7 @@ enum {
370 373
371 SKB_GSO_UDP_TUNNEL_CSUM = 1 << 11, 374 SKB_GSO_UDP_TUNNEL_CSUM = 1 << 11,
372 375
373 SKB_GSO_MPLS = 1 << 12, 376 SKB_GSO_TUNNEL_REMCSUM = 1 << 12,
374
375}; 377};
376 378
377#if BITS_PER_LONG > 32 379#if BITS_PER_LONG > 32
@@ -440,6 +442,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
440 * @next: Next buffer in list 442 * @next: Next buffer in list
441 * @prev: Previous buffer in list 443 * @prev: Previous buffer in list
442 * @tstamp: Time we arrived/left 444 * @tstamp: Time we arrived/left
445 * @rbnode: RB tree node, alternative to next/prev for netem/tcp
443 * @sk: Socket we are owned by 446 * @sk: Socket we are owned by
444 * @dev: Device we arrived on/are leaving by 447 * @dev: Device we arrived on/are leaving by
445 * @cb: Control buffer. Free for use by every layer. Put private vars here 448 * @cb: Control buffer. Free for use by every layer. Put private vars here
@@ -504,15 +507,19 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
504 */ 507 */
505 508
506struct sk_buff { 509struct sk_buff {
507 /* These two members must be first. */
508 struct sk_buff *next;
509 struct sk_buff *prev;
510
511 union { 510 union {
512 ktime_t tstamp; 511 struct {
513 struct skb_mstamp skb_mstamp; 512 /* These two members must be first. */
513 struct sk_buff *next;
514 struct sk_buff *prev;
515
516 union {
517 ktime_t tstamp;
518 struct skb_mstamp skb_mstamp;
519 };
520 };
521 struct rb_node rbnode; /* used in netem & tcp stack */
514 }; 522 };
515
516 struct sock *sk; 523 struct sock *sk;
517 struct net_device *dev; 524 struct net_device *dev;
518 525
@@ -597,7 +604,8 @@ struct sk_buff {
597#endif 604#endif
598 __u8 ipvs_property:1; 605 __u8 ipvs_property:1;
599 __u8 inner_protocol_type:1; 606 __u8 inner_protocol_type:1;
600 /* 4 or 6 bit hole */ 607 __u8 remcsum_offload:1;
608 /* 3 or 5 bit hole */
601 609
602#ifdef CONFIG_NET_SCHED 610#ifdef CONFIG_NET_SCHED
603 __u16 tc_index; /* traffic control index */ 611 __u16 tc_index; /* traffic control index */
@@ -666,6 +674,7 @@ struct sk_buff {
666 674
667#define SKB_ALLOC_FCLONE 0x01 675#define SKB_ALLOC_FCLONE 0x01
668#define SKB_ALLOC_RX 0x02 676#define SKB_ALLOC_RX 0x02
677#define SKB_ALLOC_NAPI 0x04
669 678
670/* Returns true if the skb was allocated from PFMEMALLOC reserves */ 679/* Returns true if the skb was allocated from PFMEMALLOC reserves */
671static inline bool skb_pfmemalloc(const struct sk_buff *skb) 680static inline bool skb_pfmemalloc(const struct sk_buff *skb)
@@ -710,9 +719,6 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
710 skb->_skb_refdst = (unsigned long)dst; 719 skb->_skb_refdst = (unsigned long)dst;
711} 720}
712 721
713void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst,
714 bool force);
715
716/** 722/**
717 * skb_dst_set_noref - sets skb dst, hopefully, without taking reference 723 * skb_dst_set_noref - sets skb dst, hopefully, without taking reference
718 * @skb: buffer 724 * @skb: buffer
@@ -725,24 +731,8 @@ void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst,
725 */ 731 */
726static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst) 732static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst)
727{ 733{
728 __skb_dst_set_noref(skb, dst, false); 734 WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
729} 735 skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF;
730
731/**
732 * skb_dst_set_noref_force - sets skb dst, without taking reference
733 * @skb: buffer
734 * @dst: dst entry
735 *
736 * Sets skb dst, assuming a reference was not taken on dst.
737 * No reference is taken and no dst_release will be called. While for
738 * cached dsts deferred reclaim is a basic feature, for entries that are
739 * not cached it is caller's job to guarantee that last dst_release for
740 * provided dst happens when nobody uses it, eg. after a RCU grace period.
741 */
742static inline void skb_dst_set_noref_force(struct sk_buff *skb,
743 struct dst_entry *dst)
744{
745 __skb_dst_set_noref(skb, dst, true);
746} 736}
747 737
748/** 738/**
@@ -810,7 +800,7 @@ static inline bool skb_fclone_busy(const struct sock *sk,
810 fclones = container_of(skb, struct sk_buff_fclones, skb1); 800 fclones = container_of(skb, struct sk_buff_fclones, skb1);
811 801
812 return skb->fclone == SKB_FCLONE_ORIG && 802 return skb->fclone == SKB_FCLONE_ORIG &&
813 fclones->skb2.fclone == SKB_FCLONE_CLONE && 803 atomic_read(&fclones->fclone_ref) > 1 &&
814 fclones->skb2.sk == sk; 804 fclones->skb2.sk == sk;
815} 805}
816 806
@@ -2176,47 +2166,61 @@ static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
2176 return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC); 2166 return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC);
2177} 2167}
2178 2168
2169void *napi_alloc_frag(unsigned int fragsz);
2170struct sk_buff *__napi_alloc_skb(struct napi_struct *napi,
2171 unsigned int length, gfp_t gfp_mask);
2172static inline struct sk_buff *napi_alloc_skb(struct napi_struct *napi,
2173 unsigned int length)
2174{
2175 return __napi_alloc_skb(napi, length, GFP_ATOMIC);
2176}
2177
2179/** 2178/**
2180 * __skb_alloc_pages - allocate pages for ps-rx on a skb and preserve pfmemalloc data 2179 * __dev_alloc_pages - allocate page for network Rx
2181 * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX 2180 * @gfp_mask: allocation priority. Set __GFP_NOMEMALLOC if not for network Rx
2182 * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used 2181 * @order: size of the allocation
2183 * @order: size of the allocation
2184 * 2182 *
2185 * Allocate a new page. 2183 * Allocate a new page.
2186 * 2184 *
2187 * %NULL is returned if there is no free memory. 2185 * %NULL is returned if there is no free memory.
2188*/ 2186*/
2189static inline struct page *__skb_alloc_pages(gfp_t gfp_mask, 2187static inline struct page *__dev_alloc_pages(gfp_t gfp_mask,
2190 struct sk_buff *skb, 2188 unsigned int order)
2191 unsigned int order) 2189{
2192{ 2190 /* This piece of code contains several assumptions.
2193 struct page *page; 2191 * 1. This is for device Rx, therefor a cold page is preferred.
2194 2192 * 2. The expectation is the user wants a compound page.
2195 gfp_mask |= __GFP_COLD; 2193 * 3. If requesting a order 0 page it will not be compound
2196 2194 * due to the check to see if order has a value in prep_new_page
2197 if (!(gfp_mask & __GFP_NOMEMALLOC)) 2195 * 4. __GFP_MEMALLOC is ignored if __GFP_NOMEMALLOC is set due to
2198 gfp_mask |= __GFP_MEMALLOC; 2196 * code in gfp_to_alloc_flags that should be enforcing this.
2197 */
2198 gfp_mask |= __GFP_COLD | __GFP_COMP | __GFP_MEMALLOC;
2199 2199
2200 page = alloc_pages_node(NUMA_NO_NODE, gfp_mask, order); 2200 return alloc_pages_node(NUMA_NO_NODE, gfp_mask, order);
2201 if (skb && page && page->pfmemalloc) 2201}
2202 skb->pfmemalloc = true;
2203 2202
2204 return page; 2203static inline struct page *dev_alloc_pages(unsigned int order)
2204{
2205 return __dev_alloc_pages(GFP_ATOMIC, order);
2205} 2206}
2206 2207
2207/** 2208/**
2208 * __skb_alloc_page - allocate a page for ps-rx for a given skb and preserve pfmemalloc data 2209 * __dev_alloc_page - allocate a page for network Rx
2209 * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX 2210 * @gfp_mask: allocation priority. Set __GFP_NOMEMALLOC if not for network Rx
2210 * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used
2211 * 2211 *
2212 * Allocate a new page. 2212 * Allocate a new page.
2213 * 2213 *
2214 * %NULL is returned if there is no free memory. 2214 * %NULL is returned if there is no free memory.
2215 */ 2215 */
2216static inline struct page *__skb_alloc_page(gfp_t gfp_mask, 2216static inline struct page *__dev_alloc_page(gfp_t gfp_mask)
2217 struct sk_buff *skb) 2217{
2218 return __dev_alloc_pages(gfp_mask, 0);
2219}
2220
2221static inline struct page *dev_alloc_page(void)
2218{ 2222{
2219 return __skb_alloc_pages(gfp_mask, skb, 0); 2223 return __dev_alloc_page(GFP_ATOMIC);
2220} 2224}
2221 2225
2222/** 2226/**
@@ -2448,7 +2452,6 @@ static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom)
2448 * is untouched. Otherwise it is extended. Returns zero on 2452 * is untouched. Otherwise it is extended. Returns zero on
2449 * success. The skb is freed on error. 2453 * success. The skb is freed on error.
2450 */ 2454 */
2451
2452static inline int skb_padto(struct sk_buff *skb, unsigned int len) 2455static inline int skb_padto(struct sk_buff *skb, unsigned int len)
2453{ 2456{
2454 unsigned int size = skb->len; 2457 unsigned int size = skb->len;
@@ -2457,6 +2460,29 @@ static inline int skb_padto(struct sk_buff *skb, unsigned int len)
2457 return skb_pad(skb, len - size); 2460 return skb_pad(skb, len - size);
2458} 2461}
2459 2462
2463/**
2464 * skb_put_padto - increase size and pad an skbuff up to a minimal size
2465 * @skb: buffer to pad
2466 * @len: minimal length
2467 *
2468 * Pads up a buffer to ensure the trailing bytes exist and are
2469 * blanked. If the buffer already contains sufficient data it
2470 * is untouched. Otherwise it is extended. Returns zero on
2471 * success. The skb is freed on error.
2472 */
2473static inline int skb_put_padto(struct sk_buff *skb, unsigned int len)
2474{
2475 unsigned int size = skb->len;
2476
2477 if (unlikely(size < len)) {
2478 len -= size;
2479 if (skb_pad(skb, len))
2480 return -ENOMEM;
2481 __skb_put(skb, len);
2482 }
2483 return 0;
2484}
2485
2460static inline int skb_add_data(struct sk_buff *skb, 2486static inline int skb_add_data(struct sk_buff *skb,
2461 char __user *from, int copy) 2487 char __user *from, int copy)
2462{ 2488{
@@ -2629,18 +2655,18 @@ struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int noblock,
2629 int *err); 2655 int *err);
2630unsigned int datagram_poll(struct file *file, struct socket *sock, 2656unsigned int datagram_poll(struct file *file, struct socket *sock,
2631 struct poll_table_struct *wait); 2657 struct poll_table_struct *wait);
2632int skb_copy_datagram_iovec(const struct sk_buff *from, int offset, 2658int skb_copy_datagram_iter(const struct sk_buff *from, int offset,
2633 struct iovec *to, int size); 2659 struct iov_iter *to, int size);
2634int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, int hlen, 2660static inline int skb_copy_datagram_msg(const struct sk_buff *from, int offset,
2635 struct iovec *iov); 2661 struct msghdr *msg, int size)
2636int skb_copy_datagram_from_iovec(struct sk_buff *skb, int offset, 2662{
2637 const struct iovec *from, int from_offset, 2663 return skb_copy_datagram_iter(from, offset, &msg->msg_iter, size);
2638 int len); 2664}
2639int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *frm, 2665int skb_copy_and_csum_datagram_msg(struct sk_buff *skb, int hlen,
2640 int offset, size_t count); 2666 struct msghdr *msg);
2641int skb_copy_datagram_const_iovec(const struct sk_buff *from, int offset, 2667int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset,
2642 const struct iovec *to, int to_offset, 2668 struct iov_iter *from, int len);
2643 int size); 2669int zerocopy_sg_from_iter(struct sk_buff *skb, struct iov_iter *frm);
2644void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 2670void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
2645void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb); 2671void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb);
2646int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags); 2672int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags);
@@ -2661,6 +2687,20 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2661unsigned int skb_gso_transport_seglen(const struct sk_buff *skb); 2687unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
2662struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features); 2688struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
2663struct sk_buff *skb_vlan_untag(struct sk_buff *skb); 2689struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
2690int skb_ensure_writable(struct sk_buff *skb, int write_len);
2691int skb_vlan_pop(struct sk_buff *skb);
2692int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
2693
2694static inline int memcpy_from_msg(void *data, struct msghdr *msg, int len)
2695{
2696 /* XXX: stripping const */
2697 return memcpy_fromiovec(data, (struct iovec *)msg->msg_iter.iov, len);
2698}
2699
2700static inline int memcpy_to_msg(struct msghdr *msg, void *data, int len)
2701{
2702 return copy_to_iter(data, len, &msg->msg_iter) == len ? 0 : -EFAULT;
2703}
2664 2704
2665struct skb_checksum_ops { 2705struct skb_checksum_ops {
2666 __wsum (*update)(const void *mem, int len, __wsum wsum); 2706 __wsum (*update)(const void *mem, int len, __wsum wsum);
diff --git a/include/linux/socket.h b/include/linux/socket.h
index bb9b83640070..6e49a14365dc 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -47,16 +47,25 @@ struct linger {
47struct msghdr { 47struct msghdr {
48 void *msg_name; /* ptr to socket address structure */ 48 void *msg_name; /* ptr to socket address structure */
49 int msg_namelen; /* size of socket address structure */ 49 int msg_namelen; /* size of socket address structure */
50 struct iovec *msg_iov; /* scatter/gather array */ 50 struct iov_iter msg_iter; /* data */
51 __kernel_size_t msg_iovlen; /* # elements in msg_iov */
52 void *msg_control; /* ancillary data */ 51 void *msg_control; /* ancillary data */
53 __kernel_size_t msg_controllen; /* ancillary data buffer length */ 52 __kernel_size_t msg_controllen; /* ancillary data buffer length */
54 unsigned int msg_flags; /* flags on received message */ 53 unsigned int msg_flags; /* flags on received message */
55}; 54};
55
56struct user_msghdr {
57 void __user *msg_name; /* ptr to socket address structure */
58 int msg_namelen; /* size of socket address structure */
59 struct iovec __user *msg_iov; /* scatter/gather array */
60 __kernel_size_t msg_iovlen; /* # elements in msg_iov */
61 void __user *msg_control; /* ancillary data */
62 __kernel_size_t msg_controllen; /* ancillary data buffer length */
63 unsigned int msg_flags; /* flags on received message */
64};
56 65
57/* For recvmmsg/sendmmsg */ 66/* For recvmmsg/sendmmsg */
58struct mmsghdr { 67struct mmsghdr {
59 struct msghdr msg_hdr; 68 struct user_msghdr msg_hdr;
60 unsigned int msg_len; 69 unsigned int msg_len;
61}; 70};
62 71
@@ -94,6 +103,10 @@ struct cmsghdr {
94 (cmsg)->cmsg_len <= (unsigned long) \ 103 (cmsg)->cmsg_len <= (unsigned long) \
95 ((mhdr)->msg_controllen - \ 104 ((mhdr)->msg_controllen - \
96 ((char *)(cmsg) - (char *)(mhdr)->msg_control))) 105 ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
106#define for_each_cmsghdr(cmsg, msg) \
107 for (cmsg = CMSG_FIRSTHDR(msg); \
108 cmsg; \
109 cmsg = CMSG_NXTHDR(msg, cmsg))
97 110
98/* 111/*
99 * Get the next cmsg header 112 * Get the next cmsg header
@@ -312,15 +325,14 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
312extern unsigned long iov_pages(const struct iovec *iov, int offset, 325extern unsigned long iov_pages(const struct iovec *iov, int offset,
313 unsigned long nr_segs); 326 unsigned long nr_segs);
314 327
315extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode);
316extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); 328extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
317extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); 329extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
318 330
319struct timespec; 331struct timespec;
320 332
321/* The __sys_...msg variants allow MSG_CMSG_COMPAT */ 333/* The __sys_...msg variants allow MSG_CMSG_COMPAT */
322extern long __sys_recvmsg(int fd, struct msghdr __user *msg, unsigned flags); 334extern long __sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
323extern long __sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags); 335extern long __sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
324extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, 336extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
325 unsigned int flags, struct timespec *timeout); 337 unsigned int flags, struct timespec *timeout);
326extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, 338extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg,
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index bda9b81357cc..c9afdc7a7f84 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -25,7 +25,7 @@ struct linux_dirent64;
25struct list_head; 25struct list_head;
26struct mmap_arg_struct; 26struct mmap_arg_struct;
27struct msgbuf; 27struct msgbuf;
28struct msghdr; 28struct user_msghdr;
29struct mmsghdr; 29struct mmsghdr;
30struct msqid_ds; 30struct msqid_ds;
31struct new_utsname; 31struct new_utsname;
@@ -601,13 +601,13 @@ asmlinkage long sys_getpeername(int, struct sockaddr __user *, int __user *);
601asmlinkage long sys_send(int, void __user *, size_t, unsigned); 601asmlinkage long sys_send(int, void __user *, size_t, unsigned);
602asmlinkage long sys_sendto(int, void __user *, size_t, unsigned, 602asmlinkage long sys_sendto(int, void __user *, size_t, unsigned,
603 struct sockaddr __user *, int); 603 struct sockaddr __user *, int);
604asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags); 604asmlinkage long sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
605asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg, 605asmlinkage long sys_sendmmsg(int fd, struct mmsghdr __user *msg,
606 unsigned int vlen, unsigned flags); 606 unsigned int vlen, unsigned flags);
607asmlinkage long sys_recv(int, void __user *, size_t, unsigned); 607asmlinkage long sys_recv(int, void __user *, size_t, unsigned);
608asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned, 608asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned,
609 struct sockaddr __user *, int __user *); 609 struct sockaddr __user *, int __user *);
610asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned flags); 610asmlinkage long sys_recvmsg(int fd, struct user_msghdr __user *msg, unsigned flags);
611asmlinkage long sys_recvmmsg(int fd, struct mmsghdr __user *msg, 611asmlinkage long sys_recvmmsg(int fd, struct mmsghdr __user *msg,
612 unsigned int vlen, unsigned flags, 612 unsigned int vlen, unsigned flags,
613 struct timespec __user *timeout); 613 struct timespec __user *timeout);
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index c2dee7deefa8..67309ece0772 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -130,7 +130,7 @@ struct tcp_sock {
130 /* inet_connection_sock has to be the first member of tcp_sock */ 130 /* inet_connection_sock has to be the first member of tcp_sock */
131 struct inet_connection_sock inet_conn; 131 struct inet_connection_sock inet_conn;
132 u16 tcp_header_len; /* Bytes of tcp header to send */ 132 u16 tcp_header_len; /* Bytes of tcp header to send */
133 u16 xmit_size_goal_segs; /* Goal for segmenting output packets */ 133 u16 gso_segs; /* Max number of segs per GSO packet */
134 134
135/* 135/*
136 * Header prediction flags 136 * Header prediction flags
@@ -162,7 +162,7 @@ struct tcp_sock {
162 struct { 162 struct {
163 struct sk_buff_head prequeue; 163 struct sk_buff_head prequeue;
164 struct task_struct *task; 164 struct task_struct *task;
165 struct iovec *iov; 165 struct msghdr *msg;
166 int memory; 166 int memory;
167 int len; 167 int len;
168 } ucopy; 168 } ucopy;
@@ -204,10 +204,10 @@ struct tcp_sock {
204 204
205 u16 urg_data; /* Saved octet of OOB data and control flags */ 205 u16 urg_data; /* Saved octet of OOB data and control flags */
206 u8 ecn_flags; /* ECN status bits. */ 206 u8 ecn_flags; /* ECN status bits. */
207 u8 reordering; /* Packet reordering metric. */ 207 u8 keepalive_probes; /* num of allowed keep alive probes */
208 u32 reordering; /* Packet reordering metric. */
208 u32 snd_up; /* Urgent pointer */ 209 u32 snd_up; /* Urgent pointer */
209 210
210 u8 keepalive_probes; /* num of allowed keep alive probes */
211/* 211/*
212 * Options received (usually on last packet, some only on SYN packets). 212 * Options received (usually on last packet, some only on SYN packets).
213 */ 213 */
diff --git a/include/linux/uio.h b/include/linux/uio.h
index bd8569a14c4a..a41e252396c0 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -131,7 +131,6 @@ size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_
131size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i); 131size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i);
132 132
133int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); 133int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
134int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len);
135int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, 134int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
136 int offset, int len); 135 int offset, int len);
137int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, 136int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
diff --git a/include/linux/vmw_vmci_api.h b/include/linux/vmw_vmci_api.h
index 023430e265fe..5691f752ce8f 100644
--- a/include/linux/vmw_vmci_api.h
+++ b/include/linux/vmw_vmci_api.h
@@ -24,6 +24,7 @@
24#define VMCI_KERNEL_API_VERSION_2 2 24#define VMCI_KERNEL_API_VERSION_2 2
25#define VMCI_KERNEL_API_VERSION VMCI_KERNEL_API_VERSION_2 25#define VMCI_KERNEL_API_VERSION VMCI_KERNEL_API_VERSION_2
26 26
27struct msghdr;
27typedef void (vmci_device_shutdown_fn) (void *device_registration, 28typedef void (vmci_device_shutdown_fn) (void *device_registration,
28 void *user_data); 29 void *user_data);
29 30
@@ -75,8 +76,8 @@ ssize_t vmci_qpair_peek(struct vmci_qp *qpair, void *buf, size_t buf_size,
75ssize_t vmci_qpair_enquev(struct vmci_qp *qpair, 76ssize_t vmci_qpair_enquev(struct vmci_qp *qpair,
76 void *iov, size_t iov_size, int mode); 77 void *iov, size_t iov_size, int mode);
77ssize_t vmci_qpair_dequev(struct vmci_qp *qpair, 78ssize_t vmci_qpair_dequev(struct vmci_qp *qpair,
78 void *iov, size_t iov_size, int mode); 79 struct msghdr *msg, size_t iov_size, int mode);
79ssize_t vmci_qpair_peekv(struct vmci_qp *qpair, void *iov, size_t iov_size, 80ssize_t vmci_qpair_peekv(struct vmci_qp *qpair, struct msghdr *msg, size_t iov_size,
80 int mode); 81 int mode);
81 82
82#endif /* !__VMW_VMCI_API_H__ */ 83#endif /* !__VMW_VMCI_API_H__ */
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/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 {
154enum { 163enum {
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 {
629struct hci_cp_remote_oob_data_reply { 642struct 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 {
721struct hci_cp_remote_oob_ext_data_reply { 734struct 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 {
930struct hci_rp_read_local_oob_data { 943struct 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 {
1014struct hci_rp_read_local_oob_ext_data { 1027struct 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
1480struct hci_ev_hardware_error {
1481 __u8 code;
1482} __packed;
1483
1466#define HCI_EV_ROLE_CHANGE 0x12 1484#define HCI_EV_ROLE_CHANGE 0x12
1467struct hci_ev_role_change { 1485struct 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
1766struct 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
1738struct hci_ev_le_conn_update_complete { 1775struct 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 1800struct 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
1773struct 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
80struct hci_conn_hash { 84struct hci_conn_hash {
@@ -108,6 +112,7 @@ struct smp_csrk {
108 112
109struct smp_ltk { 113struct 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
121struct smp_irk { 126struct 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
129struct link_key { 135struct 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 {
137struct oob_data { 144struct 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
514static 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
501bool hci_discovery_active(struct hci_dev *hdev); 523bool 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
558static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) 582static 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
670static 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
646static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, 690static 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);
853void hci_unregister_dev(struct hci_dev *hdev); 897void hci_unregister_dev(struct hci_dev *hdev);
854int hci_suspend_dev(struct hci_dev *hdev); 898int hci_suspend_dev(struct hci_dev *hdev);
855int hci_resume_dev(struct hci_dev *hdev); 899int hci_resume_dev(struct hci_dev *hdev);
900int hci_reset_dev(struct hci_dev *hdev);
856int hci_dev_open(__u16 dev); 901int hci_dev_open(__u16 dev);
857int hci_dev_close(__u16 dev); 902int hci_dev_close(__u16 dev);
858int hci_dev_reset(__u16 dev); 903int hci_dev_reset(__u16 dev);
@@ -894,13 +939,11 @@ struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
894struct link_key *hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, 939struct 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);
897struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, __le64 rand,
898 u8 role);
899struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, 942struct 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);
902struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, 945struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
903 u8 addr_type, u8 role); 946 u8 addr_type, u8 role);
904int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type); 947int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type);
905void hci_smp_ltks_clear(struct hci_dev *hdev); 948void hci_smp_ltks_clear(struct hci_dev *hdev);
906int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 949int 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
916void hci_remote_oob_data_clear(struct hci_dev *hdev); 959void hci_remote_oob_data_clear(struct hci_dev *hdev);
917struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, 960struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev,
918 bdaddr_t *bdaddr); 961 bdaddr_t *bdaddr, u8 bdaddr_type);
919int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, 962int 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,
921int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr, 964 u8 *hash256, u8 *rand256);
922 u8 *hash192, u8 *randomizer192, 965int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
923 u8 *hash256, u8 *randomizer256); 966 u8 bdaddr_type);
924int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
925 967
926void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 968void 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);
1310void mgmt_discoverable_timeout(struct hci_dev *hdev); 1355void mgmt_discoverable_timeout(struct hci_dev *hdev);
1311void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1356void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1312 bool persistent); 1357 bool persistent);
1313void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1358void 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);
1316void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, 1360void 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);
1350void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1394void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1351void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192, 1395void 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);
1354void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1398void 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
613struct l2cap_conn { 613struct 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 */
721enum {
722 L2CAP_NESTING_SMP,
723 L2CAP_NESTING_NORMAL,
724 L2CAP_NESTING_PARENT,
725};
726
716enum { 727enum {
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
779static inline void l2cap_chan_lock(struct l2cap_chan *chan) 790static 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
784static inline void l2cap_chan_unlock(struct l2cap_chan *chan) 795static 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
893static 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
918extern bool disable_ertm; 904extern bool disable_ertm;
919 905
920int l2cap_init_sockets(void); 906int 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
188struct mgmt_ltk_info { 191struct 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
300struct mgmt_rp_read_local_oob_data { 303struct 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;
304struct mgmt_rp_read_local_oob_ext_data { 307struct 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
312struct mgmt_cp_add_remote_oob_data { 315struct 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)
318struct mgmt_cp_add_remote_oob_ext_data { 321struct 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
502struct 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
499struct mgmt_ev_cmd_complete { 511struct 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
40typedef struct mac_addr {
41 u8 mac_addr_value[ETH_ALEN];
42} __packed mac_addr_t;
43
44enum {
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) */
51typedef 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) */
62typedef 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) */
71typedef 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) */
80typedef enum {
81 AD_TX_DUMMY,
82 AD_TRANSMIT /* tx Machine */
83} tx_states_t;
84
85/* rx indication types */
86typedef enum {
87 AD_TYPE_LACPDU = 1, /* type lacpdu */
88 AD_TYPE_MARKER /* type marker */
89} pdu_type_t;
90
91/* rx marker indication types */
92typedef 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) */
98typedef 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) */
109typedef 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
139typedef 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) */
145typedef 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
160typedef struct bond_marker_header {
161 struct ethhdr hdr;
162 struct bond_marker marker;
163} __packed bond_marker_header_t;
164
165#pragma pack()
166
167struct slave;
168struct bonding;
169struct ad_info;
170struct port;
171
172#ifdef __ia64__
173#pragma pack(8)
174#endif
175
176/* aggregator structure(43.4.5 in the 802.3ad standard) */
177typedef 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
195struct 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) */
205typedef 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 */
240struct 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
253struct 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
259struct 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 ========== */
266void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution);
267void bond_3ad_bind_slave(struct slave *slave);
268void bond_3ad_unbind_slave(struct slave *slave);
269void bond_3ad_state_machine_handler(struct work_struct *);
270void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout);
271void bond_3ad_adapter_speed_changed(struct slave *slave);
272void bond_3ad_adapter_duplex_changed(struct slave *slave);
273void bond_3ad_handle_link_change(struct slave *slave, char link);
274int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info);
275int __bond_3ad_get_active_agg_info(struct bonding *bond,
276 struct ad_info *ad_info);
277int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev);
278int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
279 struct slave *slave);
280int bond_3ad_set_carrier(struct bonding *bond);
281void 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
27struct bonding;
28struct 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
71struct 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 */
110struct 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
131struct 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
142struct 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
169int bond_alb_initialize(struct bonding *bond, int rlb_enabled);
170void bond_alb_deinitialize(struct bonding *bond);
171int bond_alb_init_slave(struct bonding *bond, struct slave *slave);
172void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave);
173void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char link);
174void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave);
175int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev);
176int bond_tlb_xmit(struct sk_buff *skb, struct net_device *bond_dev);
177void bond_alb_monitor(struct work_struct *);
178int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr);
179void 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 */
23enum {
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 */
33enum {
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 */
40enum {
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 */
75struct bond_opt_value {
76 char *string;
77 u64 value;
78 u32 flags;
79};
80
81struct bonding;
82
83struct 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
101int __bond_opt_set(struct bonding *bond, unsigned int option,
102 struct bond_opt_value *val);
103int bond_opt_tryset_rtnl(struct bonding *bond, unsigned int option, char *buf);
104
105const struct bond_opt_value *bond_opt_parse(const struct bond_option *opt,
106 struct bond_opt_value *val);
107const struct bond_option *bond_opt_get(unsigned int option);
108const struct bond_option *bond_opt_get_by_name(const char *name);
109const 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 */
115static 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
128void 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
97extern atomic_t netpoll_block_tx;
98
99static inline void block_netpoll_tx(void)
100{
101 atomic_inc(&netpoll_block_tx);
102}
103
104static inline void unblock_netpoll_tx(void)
105{
106 atomic_dec(&netpoll_block_tx);
107}
108
109static 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
121struct 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
148struct bond_parm_tbl {
149 char *modename;
150 int mode;
151};
152
153struct 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
182struct 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 */
197struct 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
246struct 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 */
256static 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
262static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
263{
264 return slave->bond;
265}
266
267static 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
273static 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
279static 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
285static 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
292static 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
298static 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
304static inline bool bond_uses_primary(struct bonding *bond)
305{
306 return bond_mode_uses_primary(BOND_MODE(bond));
307}
308
309static inline bool bond_slave_is_up(struct slave *slave)
310{
311 return netif_running(slave->dev) && netif_carrier_ok(slave->dev);
312}
313
314static 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
322static 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
330static 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
348static 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
361static 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
374static inline int bond_slave_state(struct slave *slave)
375{
376 return slave->backup;
377}
378
379static inline bool bond_is_active_slave(struct slave *slave)
380{
381 return !bond_slave_state(slave);
382}
383
384static 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
415static 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
421static inline int slave_do_arp_validate_only(struct bonding *bond)
422{
423 return bond->params.arp_validate & BOND_ARP_FILTER;
424}
425
426static 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 */
434static 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
447static 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
457static 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
466static inline void bond_netpoll_send_skb(const struct slave *slave,
467 struct sk_buff *skb)
468{
469}
470#endif
471
472static 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
481static 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
488static inline bool bond_is_slave_inactive(struct slave *slave)
489{
490 return slave->inactive;
491}
492
493static 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
508struct 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
517int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave);
518void bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
519int bond_create(struct net *net, const char *name);
520int bond_create_sysfs(struct bond_net *net);
521void bond_destroy_sysfs(struct bond_net *net);
522void bond_prepare_sysfs_group(struct bonding *bond);
523int bond_sysfs_slave_add(struct slave *slave);
524void bond_sysfs_slave_del(struct slave *slave);
525int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev);
526int bond_release(struct net_device *bond_dev, struct net_device *slave_dev);
527u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb);
528void bond_select_active_slave(struct bonding *bond);
529void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
530void bond_create_debugfs(void);
531void bond_destroy_debugfs(void);
532void bond_debug_register(struct bonding *bond);
533void bond_debug_unregister(struct bonding *bond);
534void bond_debug_reregister(struct bonding *bond);
535const char *bond_mode_name(int mode);
536void bond_setup(struct net_device *bond_dev);
537unsigned int bond_get_num_tx_queues(void);
538int bond_netlink_init(void);
539void bond_netlink_fini(void);
540struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond);
541const char *bond_slave_link_status(s8 link);
542struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev,
543 struct net_device *end_dev,
544 int level);
545int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave);
546void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay);
547
548#ifdef CONFIG_PROC_FS
549void bond_create_proc_entry(struct bonding *bond);
550void bond_remove_proc_entry(struct bonding *bond);
551void bond_create_proc_dir(struct bond_net *bn);
552void bond_destroy_proc_dir(struct bond_net *bn);
553#else
554static inline void bond_create_proc_entry(struct bonding *bond)
555{
556}
557
558static inline void bond_remove_proc_entry(struct bonding *bond)
559{
560}
561
562static inline void bond_create_proc_dir(struct bond_net *bn)
563{
564}
565
566static inline void bond_destroy_proc_dir(struct bond_net *bn)
567{
568}
569#endif
570
571static 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 */
585static 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 */
599static 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 */
622static 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 */
636extern int bond_net_id;
637extern const struct bond_parm_tbl bond_lacp_tbl[];
638extern const struct bond_parm_tbl xmit_hashtype_tbl[];
639extern const struct bond_parm_tbl arp_validate_tbl[];
640extern const struct bond_parm_tbl arp_all_targets_tbl[];
641extern const struct bond_parm_tbl fail_over_mac_tbl[];
642extern const struct bond_parm_tbl pri_reselect_tbl[];
643extern struct bond_parm_tbl ad_select_tbl[];
644
645/* exported from bond_netlink.c */
646extern struct rtnl_link_ops bond_link_ops;
647
648static 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 */
326struct vif_params { 329struct 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 */
814struct 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 */
1367struct 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 */
1412struct cfg80211_scan_request { 1445struct 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
1471static 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 */
1469struct cfg80211_sched_scan_request { 1520struct 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 */
1915struct cfg80211_wowlan { 1970struct 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 */
2018struct 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 */
2033struct 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 */
1973struct cfg80211_wowlan_wakeup { 2059struct 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 */
2335struct cfg80211_ops { 2435struct 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 */
2631enum wiphy_flags { 2744enum 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 */
2759enum wiphy_wowlan_support_flags { 2873enum 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
2770struct wiphy_wowlan_tcp_support { 2885struct 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 */
2788struct wiphy_wowlan_support { 2908struct 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 */
3303struct 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 */
3180struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); 3318static 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 */
4511void 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 */
4525void 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 */
4679void 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 */
4689void 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 */
4703void 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,
4657void cfg80211_ch_switch_notify(struct net_device *dev, 4808void 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 */
4821void 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
27struct wpan_phy;
28
29struct 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
59struct 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
98struct 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
130struct wpan_phy *
131wpan_phy_new(const struct cfg802154_ops *ops, size_t priv_size);
132static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev)
133{
134 phy->dev.parent = dev;
135}
136
137int wpan_phy_register(struct wpan_phy *phy);
138void wpan_phy_unregister(struct wpan_phy *phy);
139void wpan_phy_free(struct wpan_phy *phy);
140/* Same semantics as for class_for_each_device */
141int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data);
142
143static inline void *wpan_phy_priv(struct wpan_phy *phy)
144{
145 BUG_ON(!phy);
146 return &phy->priv;
147}
148
149struct wpan_phy *wpan_phy_find(const char *str);
150
151static inline void wpan_phy_put(struct wpan_phy *phy)
152{
153 put_device(&phy->dev);
154}
155
156static 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
154static 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
43int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); 43ssize_t get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *,
44int verify_compat_iovec(struct msghdr *, struct iovec *, 44 struct sockaddr __user **, struct iovec **);
45 struct sockaddr_storage *, int);
46asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *, 45asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *,
47 unsigned int); 46 unsigned int);
48asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, 47asmlinkage 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
247void register_switch_driver(struct dsa_switch_driver *type); 280void 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
11size_t fou_encap_hlen(struct ip_tunnel_encap *e);
12static size_t gue_encap_hlen(struct ip_tunnel_encap *e);
13
14int fou_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
15 u8 *protocol, struct flowi4 *fl4);
16int 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
4struct guehdr { 32struct 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 */
72static inline size_t guehdr_flags_len(__be16 flags)
73{
74 return ((flags & GUE_FLAG_PRIV) ? GUE_LEN_PRIV : 0);
75}
76
77static 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 */
86static 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_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/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);
65void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst); 65void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst);
66int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, 66int 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);
68int ip6_tnl_xmit_ctl(struct ip6_tnl *t); 68int 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
207static inline struct fib_table *fib_get_table(struct net *net, u32 id) 207static 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
120struct 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
128extern const struct ip_tunnel_encap_ops __rcu *
129 iptun_encaps[MAX_IPTUN_ENCAP_OPS];
130
131int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *op,
132 unsigned int num);
133int 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
122int ip_tunnel_init(struct net_device *dev); 138int 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 */
46extern int sysctl_ipx_pprop_broadcasting;
47
45static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) 48static __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);
148void ipxrtr_del_routes(struct ipx_interface *intrfc); 151void ipxrtr_del_routes(struct ipx_interface *intrfc);
149int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, 152int 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);
151int ipxrtr_route_skb(struct sk_buff *skb); 154int ipxrtr_route_skb(struct sk_buff *skb);
152struct ipx_route *ipxrtr_lookup(__be32 net); 155struct ipx_route *ipxrtr_lookup(__be32 net);
153int ipxrtr_ioctl(unsigned int cmd, void __user *arg); 156int 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
59extern 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...) \
65do { if (irda_debug >= (n)) \
66 printk(KERN_DEBUG args); \
67} while (0)
68#define IRDA_ASSERT(expr, func) \ 58#define IRDA_ASSERT(expr, func) \
69do { if(!(expr)) { \ 59do { 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
73typedef struct { 73typedef 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
78typedef struct { 78typedef 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
83typedef struct { 83typedef 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 @@
35struct llc_conn_state_trans { 35struct 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
42struct llc_conn_state { 42struct 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 @@
19struct llc_sap_state_trans { 19struct 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
25struct llc_sap_state { 25struct 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 */
267enum ieee80211_bss_change { 268enum 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 */
883enum mac80211_rx_flags { 889enum 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 */
1011struct 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 */
1125struct ieee80211_channel_switch { 1167struct 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 */
1427struct ieee80211_sta { 1472struct 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 */
1842struct 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 */
2464enum 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 */
2842struct ieee80211_ops { 2966struct 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 */
3212struct 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 */
3230static inline
3058struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, 3231struct 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 */
3637void 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 */
3668struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, 3864struct 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 */
4382void 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 */
4700void 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);
4888void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer, 5112void 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 */
5135int 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 */
5151void 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 */
5178size_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
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,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 */
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 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
22static 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 */
35static 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
223enum {
224 NEIGH_ARP_TABLE = 0,
225 NEIGH_ND_TABLE = 1,
226 NEIGH_DN_TABLE = 2,
227 NEIGH_NR_TABLES,
228};
229
222static inline int neigh_parms_family(struct neigh_parms *p) 230static 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
242void neigh_table_init(struct neigh_table *tbl); 250void neigh_table_init(int index, struct neigh_table *tbl);
243int neigh_table_clear(struct neigh_table *tbl); 251int neigh_table_clear(int index, struct neigh_table *tbl);
244struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey, 252struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey,
245 struct net_device *dev); 253 struct net_device *dev);
246struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net, 254struct 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
4unsigned int
5nf_nat_redirect_ipv4(struct sk_buff *skb,
6 const struct nf_nat_ipv4_multi_range_compat *mr,
7 unsigned int hooknum);
8unsigned int
9nf_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
4int nft_bridge_iphdr_validate(struct sk_buff *skb);
5int 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
4struct nft_redir {
5 enum nft_registers sreg_proto_min:8;
6 enum nft_registers sreg_proto_max:8;
7 u16 flags;
8};
9
10extern const struct nla_policy nft_redir_policy[];
11
12int nft_redir_init(const struct nft_ctx *ctx,
13 const struct nft_expr *expr,
14 const struct nlattr * const tb[]);
15
16int nft_redir_dump(struct sk_buff *skb, const struct nft_expr *expr);
17
18int 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 */
1193static 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 {
314struct rf_tech_specific_params_nfca_poll { 329struct 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
322struct rf_tech_specific_params_nfcb_poll { 337struct 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
327struct rf_tech_specific_params_nfcf_poll { 342struct 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
333struct rf_tech_specific_params_nfcv_poll { 348struct 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
354struct 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
339struct nci_rf_discover_ntf { 359struct nci_rf_discover_ntf {
@@ -365,7 +385,12 @@ struct activation_params_nfcb_poll_iso_dep {
365 385
366struct activation_params_poll_nfc_dep { 386struct 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
391struct 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
371struct nci_rf_intf_activated_ntf { 396struct 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
24struct net_device; 24enum nl802154_commands {
25struct 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 */
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 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
124int 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
62enum 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
109enum 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,
82int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 82int ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
83 size_t len); 83 size_t len);
84int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 84int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
85void ping_rcv(struct sk_buff *skb); 85bool ping_rcv(struct sk_buff *skb);
86 86
87#ifdef CONFIG_PROC_FS 87#ifdef CONFIG_PROC_FS
88struct ping_seq_afinfo { 88struct 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 */
140enum ieee80211_regulatory_flags { 151enum 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
149struct ieee80211_freq_range { 161struct 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);
221struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *, 221struct 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);
223struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *, 223struct 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
532struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, 532struct 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 *);
535void sctp_datamsg_free(struct sctp_datamsg *); 535void sctp_datamsg_free(struct sctp_datamsg *);
536void sctp_datamsg_put(struct sctp_datamsg *); 536void sctp_datamsg_put(struct sctp_datamsg *);
537void sctp_chunk_fail(struct sctp_chunk *, int error); 537void sctp_chunk_fail(struct sctp_chunk *, int error);
@@ -647,8 +647,8 @@ struct sctp_chunk {
647 647
648void sctp_chunk_hold(struct sctp_chunk *); 648void sctp_chunk_hold(struct sctp_chunk *);
649void sctp_chunk_put(struct sctp_chunk *); 649void sctp_chunk_put(struct sctp_chunk *);
650int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len, 650int sctp_user_addto_chunk(struct sctp_chunk *chunk, int len,
651 struct iovec *data); 651 struct iov_iter *from);
652void sctp_chunk_free(struct sctp_chunk *); 652void sctp_chunk_free(struct sctp_chunk *);
653void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); 653void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data);
654struct sctp_chunk *sctp_chunkify(struct sk_buff *, 654struct 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,
1116sctp_scope_t sctp_scope(const union sctp_addr *); 1116sctp_scope_t sctp_scope(const union sctp_addr *);
1117int sctp_in_scope(struct net *net, const union sctp_addr *addr, const sctp_scope_t scope); 1117int sctp_in_scope(struct net *net, const union sctp_addr *addr, const sctp_scope_t scope);
1118int sctp_is_any(struct sock *sk, const union sctp_addr *addr); 1118int sctp_is_any(struct sock *sk, const union sctp_addr *addr);
1119int sctp_addr_is_valid(const union sctp_addr *addr);
1120int sctp_is_ep_boundall(struct sock *sk); 1119int 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
843static inline void sk_incoming_cpu_update(struct sock *sk)
844{
845 sk->sk_incoming_cpu = raw_smp_processor_id();
846}
847
836static inline void sock_rps_record_flow_hash(__u32 hash) 848static 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
1868static 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,
2269bool sk_capable(const struct sock *sk, int cap); 2258bool sk_capable(const struct sock *sk, int cap);
2270bool sk_net_capable(const struct sock *sk, int cap); 2259bool sk_net_capable(const struct sock *sk, int cap);
2271 2260
2272/*
2273 * Enable debug/info messages
2274 */
2275extern 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
2282extern __u32 sysctl_wmem_max; 2261extern __u32 sysctl_wmem_max;
2283extern __u32 sysctl_rmem_max; 2262extern __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
17int netdev_switch_parent_id_get(struct net_device *dev,
18 struct netdev_phys_item_id *psid);
19int netdev_switch_port_stp_update(struct net_device *dev, u8 state);
20
21#else
22
23static inline int netdev_switch_parent_id_get(struct net_device *dev,
24 struct netdev_phys_item_id *psid)
25{
26 return -EOPNOTSUPP;
27}
28
29static 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
18struct 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;
252extern int sysctl_tcp_max_orphans; 249extern int sysctl_tcp_max_orphans;
253extern int sysctl_tcp_fack; 250extern int sysctl_tcp_fack;
254extern int sysctl_tcp_reordering; 251extern int sysctl_tcp_reordering;
252extern int sysctl_tcp_max_reordering;
255extern int sysctl_tcp_dsack; 253extern int sysctl_tcp_dsack;
256extern long sysctl_tcp_mem[3]; 254extern long sysctl_tcp_mem[3];
257extern int sysctl_tcp_wmem[3]; 255extern 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);
498bool cookie_check_timestamp(struct tcp_options_received *opt, struct net *net, 494bool cookie_timestamp_decode(struct tcp_options_received *opt);
499 bool *ecn_ok); 495bool 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 */
502int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th, 499int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th,
503 u32 cookie); 500 u32 cookie);
504struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); 501struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
505#ifdef CONFIG_SYN_COOKIES 502
506u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph, 503u32 __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 */
1108static inline int tcp_space(const struct sock *sk) 1105static 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
1114static inline int tcp_full_space(const struct sock *sk) 1111static 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
1119static inline void tcp_openreq_init(struct request_sock *req, 1116static 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;
19static __inline__ int udplite_getfrag(void *from, char *to, int offset, 19static __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
36struct 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
77struct wpan_phy *wpan_phy_alloc(size_t priv_size);
78static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev)
79{
80 phy->dev.parent = dev;
81}
82int wpan_phy_register(struct wpan_phy *phy);
83void wpan_phy_unregister(struct wpan_phy *phy);
84void wpan_phy_free(struct wpan_phy *phy);
85/* Same semantics as for class_for_each_device */
86int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data);
87
88static inline void *wpan_phy_priv(struct wpan_phy *phy)
89{
90 BUG_ON(!phy);
91 return &phy->priv;
92}
93
94struct wpan_phy *wpan_phy_find(const char *str);
95
96static inline void wpan_phy_put(struct wpan_phy *phy)
97{
98 put_device(&phy->dev);
99}
100
101static inline const char *wpan_phy_name(struct wpan_phy *phy)
102{
103 return dev_name(&phy->dev);
104}
105#endif
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index ea0796bdcf88..5c15c2a5c123 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -82,4 +82,9 @@
82 82
83#define SO_BPF_EXTENSIONS 48 83#define SO_BPF_EXTENSIONS 48
84 84
85#define SO_INCOMING_CPU 49
86
87#define SO_ATTACH_BPF 50
88#define SO_DETACH_BPF SO_DETACH_FILTER
89
85#endif /* __ASM_GENERIC_SOCKET_H */ 90#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index c54fcb5993c3..d8e1716707ba 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -37,27 +37,27 @@ header-y += aio_abi.h
37header-y += apm_bios.h 37header-y += apm_bios.h
38header-y += arcfb.h 38header-y += arcfb.h
39header-y += atalk.h 39header-y += atalk.h
40header-y += atm.h
41header-y += atm_eni.h
42header-y += atm_he.h
43header-y += atm_idt77105.h
44header-y += atm_nicstar.h
45header-y += atm_tcp.h
46header-y += atm_zatm.h
47header-y += atmapi.h 40header-y += atmapi.h
48header-y += atmarp.h 41header-y += atmarp.h
49header-y += atmbr2684.h 42header-y += atmbr2684.h
50header-y += atmclip.h 43header-y += atmclip.h
51header-y += atmdev.h 44header-y += atmdev.h
45header-y += atm_eni.h
46header-y += atm.h
47header-y += atm_he.h
48header-y += atm_idt77105.h
52header-y += atmioc.h 49header-y += atmioc.h
53header-y += atmlec.h 50header-y += atmlec.h
54header-y += atmmpc.h 51header-y += atmmpc.h
52header-y += atm_nicstar.h
55header-y += atmppp.h 53header-y += atmppp.h
56header-y += atmsap.h 54header-y += atmsap.h
57header-y += atmsvc.h 55header-y += atmsvc.h
56header-y += atm_tcp.h
57header-y += atm_zatm.h
58header-y += audit.h 58header-y += audit.h
59header-y += auto_fs.h
60header-y += auto_fs4.h 59header-y += auto_fs4.h
60header-y += auto_fs.h
61header-y += auxvec.h 61header-y += auxvec.h
62header-y += ax25.h 62header-y += ax25.h
63header-y += b1lli.h 63header-y += b1lli.h
@@ -67,8 +67,8 @@ header-y += bfs_fs.h
67header-y += binfmts.h 67header-y += binfmts.h
68header-y += blkpg.h 68header-y += blkpg.h
69header-y += blktrace_api.h 69header-y += blktrace_api.h
70header-y += bpf.h
71header-y += bpf_common.h 70header-y += bpf_common.h
71header-y += bpf.h
72header-y += bpqether.h 72header-y += bpqether.h
73header-y += bsg.h 73header-y += bsg.h
74header-y += btrfs.h 74header-y += btrfs.h
@@ -93,21 +93,21 @@ header-y += cyclades.h
93header-y += cycx_cfm.h 93header-y += cycx_cfm.h
94header-y += dcbnl.h 94header-y += dcbnl.h
95header-y += dccp.h 95header-y += dccp.h
96header-y += dlm.h 96header-y += dlmconstants.h
97header-y += dlm_device.h 97header-y += dlm_device.h
98header-y += dlm.h
98header-y += dlm_netlink.h 99header-y += dlm_netlink.h
99header-y += dlm_plock.h 100header-y += dlm_plock.h
100header-y += dlmconstants.h
101header-y += dm-ioctl.h 101header-y += dm-ioctl.h
102header-y += dm-log-userspace.h 102header-y += dm-log-userspace.h
103header-y += dn.h 103header-y += dn.h
104header-y += dqblk_xfs.h 104header-y += dqblk_xfs.h
105header-y += edd.h 105header-y += edd.h
106header-y += efs_fs_sb.h 106header-y += efs_fs_sb.h
107header-y += elfcore.h
107header-y += elf-em.h 108header-y += elf-em.h
108header-y += elf-fdpic.h 109header-y += elf-fdpic.h
109header-y += elf.h 110header-y += elf.h
110header-y += elfcore.h
111header-y += errno.h 111header-y += errno.h
112header-y += errqueue.h 112header-y += errqueue.h
113header-y += ethtool.h 113header-y += ethtool.h
@@ -131,15 +131,15 @@ header-y += fsl_hypervisor.h
131header-y += fuse.h 131header-y += fuse.h
132header-y += futex.h 132header-y += futex.h
133header-y += gameport.h 133header-y += gameport.h
134header-y += gen_stats.h
135header-y += genetlink.h 134header-y += genetlink.h
135header-y += gen_stats.h
136header-y += gfs2_ondisk.h 136header-y += gfs2_ondisk.h
137header-y += gigaset_dev.h 137header-y += gigaset_dev.h
138header-y += hdlc.h
139header-y += hdlcdrv.h 138header-y += hdlcdrv.h
139header-y += hdlc.h
140header-y += hdreg.h 140header-y += hdreg.h
141header-y += hid.h
142header-y += hiddev.h 141header-y += hiddev.h
142header-y += hid.h
143header-y += hidraw.h 143header-y += hidraw.h
144header-y += hpet.h 144header-y += hpet.h
145header-y += hsr_netlink.h 145header-y += hsr_netlink.h
@@ -151,7 +151,6 @@ header-y += i2o-dev.h
151header-y += i8k.h 151header-y += i8k.h
152header-y += icmp.h 152header-y += icmp.h
153header-y += icmpv6.h 153header-y += icmpv6.h
154header-y += if.h
155header-y += if_addr.h 154header-y += if_addr.h
156header-y += if_addrlabel.h 155header-y += if_addrlabel.h
157header-y += if_alg.h 156header-y += if_alg.h
@@ -165,6 +164,7 @@ header-y += if_ether.h
165header-y += if_fc.h 164header-y += if_fc.h
166header-y += if_fddi.h 165header-y += if_fddi.h
167header-y += if_frad.h 166header-y += if_frad.h
167header-y += if.h
168header-y += if_hippi.h 168header-y += if_hippi.h
169header-y += if_infiniband.h 169header-y += if_infiniband.h
170header-y += if_link.h 170header-y += if_link.h
@@ -182,40 +182,40 @@ header-y += if_tunnel.h
182header-y += if_vlan.h 182header-y += if_vlan.h
183header-y += if_x25.h 183header-y += if_x25.h
184header-y += igmp.h 184header-y += igmp.h
185header-y += in.h
186header-y += in6.h 185header-y += in6.h
187header-y += in_route.h
188header-y += inet_diag.h 186header-y += inet_diag.h
187header-y += in.h
189header-y += inotify.h 188header-y += inotify.h
190header-y += input.h 189header-y += input.h
190header-y += in_route.h
191header-y += ioctl.h 191header-y += ioctl.h
192header-y += ip.h
193header-y += ip6_tunnel.h 192header-y += ip6_tunnel.h
194header-y += ip_vs.h
195header-y += ipc.h 193header-y += ipc.h
194header-y += ip.h
196header-y += ipmi.h 195header-y += ipmi.h
197header-y += ipmi_msgdefs.h 196header-y += ipmi_msgdefs.h
198header-y += ipsec.h 197header-y += ipsec.h
199header-y += ipv6.h 198header-y += ipv6.h
200header-y += ipv6_route.h 199header-y += ipv6_route.h
200header-y += ip_vs.h
201header-y += ipx.h 201header-y += ipx.h
202header-y += irda.h 202header-y += irda.h
203header-y += irqnr.h 203header-y += irqnr.h
204header-y += isdn.h
205header-y += isdn_divertif.h 204header-y += isdn_divertif.h
206header-y += isdn_ppp.h 205header-y += isdn.h
207header-y += isdnif.h 206header-y += isdnif.h
207header-y += isdn_ppp.h
208header-y += iso_fs.h 208header-y += iso_fs.h
209header-y += ivtv.h
210header-y += ivtvfb.h 209header-y += ivtvfb.h
210header-y += ivtv.h
211header-y += ixjuser.h 211header-y += ixjuser.h
212header-y += jffs2.h 212header-y += jffs2.h
213header-y += joystick.h 213header-y += joystick.h
214header-y += kd.h
215header-y += kdev_t.h 214header-y += kdev_t.h
216header-y += kernel-page-flags.h 215header-y += kd.h
217header-y += kernel.h
218header-y += kernelcapi.h 216header-y += kernelcapi.h
217header-y += kernel.h
218header-y += kernel-page-flags.h
219header-y += kexec.h 219header-y += kexec.h
220header-y += keyboard.h 220header-y += keyboard.h
221header-y += keyctl.h 221header-y += keyctl.h
@@ -231,6 +231,7 @@ ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h \
231header-y += kvm_para.h 231header-y += kvm_para.h
232endif 232endif
233 233
234header-y += hw_breakpoint.h
234header-y += l2tp.h 235header-y += l2tp.h
235header-y += libc-compat.h 236header-y += libc-compat.h
236header-y += limits.h 237header-y += limits.h
@@ -256,43 +257,43 @@ header-y += mman.h
256header-y += mmtimer.h 257header-y += mmtimer.h
257header-y += mpls.h 258header-y += mpls.h
258header-y += mqueue.h 259header-y += mqueue.h
259header-y += mroute.h
260header-y += mroute6.h 260header-y += mroute6.h
261header-y += mroute.h
261header-y += msdos_fs.h 262header-y += msdos_fs.h
262header-y += msg.h 263header-y += msg.h
263header-y += mtio.h 264header-y += mtio.h
264header-y += n_r3964.h
265header-y += nbd.h 265header-y += nbd.h
266header-y += ncp.h
267header-y += ncp_fs.h 266header-y += ncp_fs.h
267header-y += ncp.h
268header-y += ncp_mount.h 268header-y += ncp_mount.h
269header-y += ncp_no.h 269header-y += ncp_no.h
270header-y += neighbour.h 270header-y += neighbour.h
271header-y += net.h
272header-y += net_dropmon.h
273header-y += net_tstamp.h
274header-y += netconf.h 271header-y += netconf.h
275header-y += netdevice.h 272header-y += netdevice.h
276header-y += netlink_diag.h 273header-y += net_dropmon.h
277header-y += netfilter.h
278header-y += netfilter_arp.h 274header-y += netfilter_arp.h
279header-y += netfilter_bridge.h 275header-y += netfilter_bridge.h
280header-y += netfilter_decnet.h 276header-y += netfilter_decnet.h
277header-y += netfilter.h
281header-y += netfilter_ipv4.h 278header-y += netfilter_ipv4.h
282header-y += netfilter_ipv6.h 279header-y += netfilter_ipv6.h
280header-y += net.h
281header-y += netlink_diag.h
283header-y += netlink.h 282header-y += netlink.h
284header-y += netrom.h 283header-y += netrom.h
284header-y += net_tstamp.h
285header-y += nfc.h 285header-y += nfc.h
286header-y += nfs.h
287header-y += nfs2.h 286header-y += nfs2.h
288header-y += nfs3.h 287header-y += nfs3.h
289header-y += nfs4.h 288header-y += nfs4.h
290header-y += nfs4_mount.h 289header-y += nfs4_mount.h
290header-y += nfsacl.h
291header-y += nfs_fs.h 291header-y += nfs_fs.h
292header-y += nfs.h
292header-y += nfs_idmap.h 293header-y += nfs_idmap.h
293header-y += nfs_mount.h 294header-y += nfs_mount.h
294header-y += nfsacl.h
295header-y += nl80211.h 295header-y += nl80211.h
296header-y += n_r3964.h
296header-y += nubus.h 297header-y += nubus.h
297header-y += nvme.h 298header-y += nvme.h
298header-y += nvram.h 299header-y += nvram.h
@@ -312,16 +313,16 @@ header-y += pfkeyv2.h
312header-y += pg.h 313header-y += pg.h
313header-y += phantom.h 314header-y += phantom.h
314header-y += phonet.h 315header-y += phonet.h
316header-y += pktcdvd.h
315header-y += pkt_cls.h 317header-y += pkt_cls.h
316header-y += pkt_sched.h 318header-y += pkt_sched.h
317header-y += pktcdvd.h
318header-y += pmu.h 319header-y += pmu.h
319header-y += poll.h 320header-y += poll.h
320header-y += posix_types.h 321header-y += posix_types.h
321header-y += ppdev.h 322header-y += ppdev.h
322header-y += ppp-comp.h 323header-y += ppp-comp.h
323header-y += ppp-ioctl.h
324header-y += ppp_defs.h 324header-y += ppp_defs.h
325header-y += ppp-ioctl.h
325header-y += pps.h 326header-y += pps.h
326header-y += prctl.h 327header-y += prctl.h
327header-y += psci.h 328header-y += psci.h
@@ -353,13 +354,13 @@ header-y += seccomp.h
353header-y += securebits.h 354header-y += securebits.h
354header-y += selinux_netlink.h 355header-y += selinux_netlink.h
355header-y += sem.h 356header-y += sem.h
356header-y += serial.h
357header-y += serial_core.h 357header-y += serial_core.h
358header-y += serial.h
358header-y += serial_reg.h 359header-y += serial_reg.h
359header-y += serio.h 360header-y += serio.h
360header-y += shm.h 361header-y += shm.h
361header-y += signal.h
362header-y += signalfd.h 362header-y += signalfd.h
363header-y += signal.h
363header-y += smiapp.h 364header-y += smiapp.h
364header-y += snmp.h 365header-y += snmp.h
365header-y += sock_diag.h 366header-y += sock_diag.h
@@ -368,8 +369,8 @@ header-y += sockios.h
368header-y += som.h 369header-y += som.h
369header-y += sonet.h 370header-y += sonet.h
370header-y += sonypi.h 371header-y += sonypi.h
371header-y += sound.h
372header-y += soundcard.h 372header-y += soundcard.h
373header-y += sound.h
373header-y += stat.h 374header-y += stat.h
374header-y += stddef.h 375header-y += stddef.h
375header-y += string.h 376header-y += string.h
@@ -388,11 +389,12 @@ header-y += time.h
388header-y += times.h 389header-y += times.h
389header-y += timex.h 390header-y += timex.h
390header-y += tiocl.h 391header-y += tiocl.h
391header-y += tipc.h
392header-y += tipc_config.h 392header-y += tipc_config.h
393header-y += tipc_netlink.h
394header-y += tipc.h
393header-y += toshiba.h 395header-y += toshiba.h
394header-y += tty.h
395header-y += tty_flags.h 396header-y += tty_flags.h
397header-y += tty.h
396header-y += types.h 398header-y += types.h
397header-y += udf_fs_i.h 399header-y += udf_fs_i.h
398header-y += udp.h 400header-y += udp.h
@@ -424,12 +426,12 @@ header-y += virtio_blk.h
424header-y += virtio_config.h 426header-y += virtio_config.h
425header-y += virtio_console.h 427header-y += virtio_console.h
426header-y += virtio_ids.h 428header-y += virtio_ids.h
427header-y += virtio_types.h
428header-y += virtio_net.h 429header-y += virtio_net.h
429header-y += virtio_pci.h 430header-y += virtio_pci.h
430header-y += virtio_ring.h 431header-y += virtio_ring.h
431header-y += virtio_rng.h 432header-y += virtio_rng.h
432header-y += virtio_scsi.h 433header-y += virtio_scsi.h
434header-y += virtio_types.h
433header-y += vm_sockets.h 435header-y += vm_sockets.h
434header-y += vt.h 436header-y += vt.h
435header-y += wait.h 437header-y += wait.h
@@ -440,6 +442,5 @@ header-y += wireless.h
440header-y += x25.h 442header-y += x25.h
441header-y += xattr.h 443header-y += xattr.h
442header-y += xfrm.h 444header-y += xfrm.h
443header-y += hw_breakpoint.h
444header-y += zorro.h 445header-y += zorro.h
445header-y += zorro_ids.h 446header-y += zorro_ids.h
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index d18316f9e9c4..45da7ec7d274 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -82,7 +82,7 @@ enum bpf_cmd {
82 82
83 /* create or update key/value pair in a given map 83 /* create or update key/value pair in a given map
84 * err = bpf(BPF_MAP_UPDATE_ELEM, union bpf_attr *attr, u32 size) 84 * err = bpf(BPF_MAP_UPDATE_ELEM, union bpf_attr *attr, u32 size)
85 * Using attr->map_fd, attr->key, attr->value 85 * Using attr->map_fd, attr->key, attr->value, attr->flags
86 * returns zero or negative error 86 * returns zero or negative error
87 */ 87 */
88 BPF_MAP_UPDATE_ELEM, 88 BPF_MAP_UPDATE_ELEM,
@@ -111,12 +111,20 @@ enum bpf_cmd {
111 111
112enum bpf_map_type { 112enum bpf_map_type {
113 BPF_MAP_TYPE_UNSPEC, 113 BPF_MAP_TYPE_UNSPEC,
114 BPF_MAP_TYPE_HASH,
115 BPF_MAP_TYPE_ARRAY,
114}; 116};
115 117
116enum bpf_prog_type { 118enum bpf_prog_type {
117 BPF_PROG_TYPE_UNSPEC, 119 BPF_PROG_TYPE_UNSPEC,
120 BPF_PROG_TYPE_SOCKET_FILTER,
118}; 121};
119 122
123/* flags for BPF_MAP_UPDATE_ELEM command */
124#define BPF_ANY 0 /* create new element or update existing */
125#define BPF_NOEXIST 1 /* create new element if it didn't exist */
126#define BPF_EXIST 2 /* update existing element */
127
120union bpf_attr { 128union bpf_attr {
121 struct { /* anonymous struct used by BPF_MAP_CREATE command */ 129 struct { /* anonymous struct used by BPF_MAP_CREATE command */
122 __u32 map_type; /* one of enum bpf_map_type */ 130 __u32 map_type; /* one of enum bpf_map_type */
@@ -132,6 +140,7 @@ union bpf_attr {
132 __aligned_u64 value; 140 __aligned_u64 value;
133 __aligned_u64 next_key; 141 __aligned_u64 next_key;
134 }; 142 };
143 __u64 flags;
135 }; 144 };
136 145
137 struct { /* anonymous struct used by BPF_PROG_LOAD command */ 146 struct { /* anonymous struct used by BPF_PROG_LOAD command */
@@ -150,6 +159,9 @@ union bpf_attr {
150 */ 159 */
151enum bpf_func_id { 160enum bpf_func_id {
152 BPF_FUNC_unspec, 161 BPF_FUNC_unspec,
162 BPF_FUNC_map_lookup_elem, /* void *map_lookup_elem(&map, &key) */
163 BPF_FUNC_map_update_elem, /* int map_update_elem(&map, &key, &value, flags) */
164 BPF_FUNC_map_delete_elem, /* int map_delete_elem(&map, &key) */
153 __BPF_FUNC_MAX_ID, 165 __BPF_FUNC_MAX_ID,
154}; 166};
155 167
diff --git a/include/uapi/linux/can/error.h b/include/uapi/linux/can/error.h
index c247446ab25a..1c508be9687f 100644
--- a/include/uapi/linux/can/error.h
+++ b/include/uapi/linux/can/error.h
@@ -71,6 +71,7 @@
71#define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */ 71#define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */
72 /* (at least one error counter exceeds */ 72 /* (at least one error counter exceeds */
73 /* the protocol-defined level of 127) */ 73 /* the protocol-defined level of 127) */
74#define CAN_ERR_CRTL_ACTIVE 0x40 /* recovered to error active state */
74 75
75/* error in CAN protocol (type) / data[2] */ 76/* error in CAN protocol (type) / data[2] */
76#define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */ 77#define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 99b43056a6fe..5f66d9c2889d 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -534,6 +534,7 @@ struct ethtool_pauseparam {
534 * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE; 534 * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE;
535 * now deprecated 535 * now deprecated
536 * @ETH_SS_FEATURES: Device feature names 536 * @ETH_SS_FEATURES: Device feature names
537 * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names
537 */ 538 */
538enum ethtool_stringset { 539enum ethtool_stringset {
539 ETH_SS_TEST = 0, 540 ETH_SS_TEST = 0,
@@ -541,6 +542,7 @@ enum ethtool_stringset {
541 ETH_SS_PRIV_FLAGS, 542 ETH_SS_PRIV_FLAGS,
542 ETH_SS_NTUPLE_FILTERS, 543 ETH_SS_NTUPLE_FILTERS,
543 ETH_SS_FEATURES, 544 ETH_SS_FEATURES,
545 ETH_SS_RSS_HASH_FUNCS,
544}; 546};
545 547
546/** 548/**
@@ -884,6 +886,8 @@ struct ethtool_rxfh_indir {
884 * @key_size: On entry, the array size of the user buffer for the hash key, 886 * @key_size: On entry, the array size of the user buffer for the hash key,
885 * which may be zero. On return from %ETHTOOL_GRSSH, the size of the 887 * which may be zero. On return from %ETHTOOL_GRSSH, the size of the
886 * hardware hash key. 888 * hardware hash key.
889 * @hfunc: Defines the current RSS hash function used by HW (or to be set to).
890 * Valid values are one of the %ETH_RSS_HASH_*.
887 * @rsvd: Reserved for future extensions. 891 * @rsvd: Reserved for future extensions.
888 * @rss_config: RX ring/queue index for each hash value i.e., indirection table 892 * @rss_config: RX ring/queue index for each hash value i.e., indirection table
889 * of @indir_size __u32 elements, followed by hash key of @key_size 893 * of @indir_size __u32 elements, followed by hash key of @key_size
@@ -893,14 +897,16 @@ struct ethtool_rxfh_indir {
893 * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of 897 * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of
894 * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested 898 * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
895 * and a @indir_size of zero means the indir table should be reset to default 899 * and a @indir_size of zero means the indir table should be reset to default
896 * values. 900 * values. An hfunc of zero means that hash function setting is not requested.
897 */ 901 */
898struct ethtool_rxfh { 902struct ethtool_rxfh {
899 __u32 cmd; 903 __u32 cmd;
900 __u32 rss_context; 904 __u32 rss_context;
901 __u32 indir_size; 905 __u32 indir_size;
902 __u32 key_size; 906 __u32 key_size;
903 __u32 rsvd[2]; 907 __u8 hfunc;
908 __u8 rsvd8[3];
909 __u32 rsvd32;
904 __u32 rss_config[0]; 910 __u32 rss_config[0];
905}; 911};
906#define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff 912#define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff
@@ -1213,6 +1219,10 @@ enum ethtool_sfeatures_retval_bits {
1213#define SUPPORTED_40000baseCR4_Full (1 << 24) 1219#define SUPPORTED_40000baseCR4_Full (1 << 24)
1214#define SUPPORTED_40000baseSR4_Full (1 << 25) 1220#define SUPPORTED_40000baseSR4_Full (1 << 25)
1215#define SUPPORTED_40000baseLR4_Full (1 << 26) 1221#define SUPPORTED_40000baseLR4_Full (1 << 26)
1222#define SUPPORTED_56000baseKR4_Full (1 << 27)
1223#define SUPPORTED_56000baseCR4_Full (1 << 28)
1224#define SUPPORTED_56000baseSR4_Full (1 << 29)
1225#define SUPPORTED_56000baseLR4_Full (1 << 30)
1216 1226
1217#define ADVERTISED_10baseT_Half (1 << 0) 1227#define ADVERTISED_10baseT_Half (1 << 0)
1218#define ADVERTISED_10baseT_Full (1 << 1) 1228#define ADVERTISED_10baseT_Full (1 << 1)
@@ -1241,6 +1251,10 @@ enum ethtool_sfeatures_retval_bits {
1241#define ADVERTISED_40000baseCR4_Full (1 << 24) 1251#define ADVERTISED_40000baseCR4_Full (1 << 24)
1242#define ADVERTISED_40000baseSR4_Full (1 << 25) 1252#define ADVERTISED_40000baseSR4_Full (1 << 25)
1243#define ADVERTISED_40000baseLR4_Full (1 << 26) 1253#define ADVERTISED_40000baseLR4_Full (1 << 26)
1254#define ADVERTISED_56000baseKR4_Full (1 << 27)
1255#define ADVERTISED_56000baseCR4_Full (1 << 28)
1256#define ADVERTISED_56000baseSR4_Full (1 << 29)
1257#define ADVERTISED_56000baseLR4_Full (1 << 30)
1244 1258
1245/* The following are all involved in forcing a particular link 1259/* The following are all involved in forcing a particular link
1246 * mode for the device for setting things. When getting the 1260 * mode for the device for setting things. When getting the
@@ -1248,12 +1262,16 @@ enum ethtool_sfeatures_retval_bits {
1248 * it was forced up into this mode or autonegotiated. 1262 * it was forced up into this mode or autonegotiated.
1249 */ 1263 */
1250 1264
1251/* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */ 1265/* The forced speed, 10Mb, 100Mb, gigabit, [2.5|10|20|40|56]GbE. */
1252#define SPEED_10 10 1266#define SPEED_10 10
1253#define SPEED_100 100 1267#define SPEED_100 100
1254#define SPEED_1000 1000 1268#define SPEED_1000 1000
1255#define SPEED_2500 2500 1269#define SPEED_2500 2500
1256#define SPEED_10000 10000 1270#define SPEED_10000 10000
1271#define SPEED_20000 20000
1272#define SPEED_40000 40000
1273#define SPEED_56000 56000
1274
1257#define SPEED_UNKNOWN -1 1275#define SPEED_UNKNOWN -1
1258 1276
1259/* Duplex, half or full. */ 1277/* Duplex, half or full. */
@@ -1343,6 +1361,10 @@ enum ethtool_sfeatures_retval_bits {
1343#define ETH_MODULE_SFF_8079_LEN 256 1361#define ETH_MODULE_SFF_8079_LEN 256
1344#define ETH_MODULE_SFF_8472 0x2 1362#define ETH_MODULE_SFF_8472 0x2
1345#define ETH_MODULE_SFF_8472_LEN 512 1363#define ETH_MODULE_SFF_8472_LEN 512
1364#define ETH_MODULE_SFF_8636 0x3
1365#define ETH_MODULE_SFF_8636_LEN 256
1366#define ETH_MODULE_SFF_8436 0x4
1367#define ETH_MODULE_SFF_8436_LEN 256
1346 1368
1347/* Reset flags */ 1369/* Reset flags */
1348/* The reset() operation must clear the flags for the components which 1370/* The reset() operation must clear the flags for the components which
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index da17e456908d..b03ee8f62d3c 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -105,6 +105,7 @@ struct __fdb_entry {
105 105
106#define BRIDGE_MODE_VEB 0 /* Default loopback mode */ 106#define BRIDGE_MODE_VEB 0 /* Default loopback mode */
107#define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */ 107#define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */
108#define BRIDGE_MODE_UNDEF 0xFFFF /* mode undefined */
108 109
109/* Bridge management nested attributes 110/* Bridge management nested attributes
110 * [IFLA_AF_SPEC] = { 111 * [IFLA_AF_SPEC] = {
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 0bdb77e16875..f7d0d2d7173a 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -145,6 +145,7 @@ enum {
145 IFLA_CARRIER, 145 IFLA_CARRIER,
146 IFLA_PHYS_PORT_ID, 146 IFLA_PHYS_PORT_ID,
147 IFLA_CARRIER_CHANGES, 147 IFLA_CARRIER_CHANGES,
148 IFLA_PHYS_SWITCH_ID,
148 __IFLA_MAX 149 __IFLA_MAX
149}; 150};
150 151
@@ -243,6 +244,8 @@ enum {
243 IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */ 244 IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */
244 IFLA_BRPORT_LEARNING, /* mac learning */ 245 IFLA_BRPORT_LEARNING, /* mac learning */
245 IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */ 246 IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */
247 IFLA_BRPORT_PROXYARP, /* proxy ARP */
248 IFLA_BRPORT_LEARNING_SYNC, /* mac learning sync from device */
246 __IFLA_BRPORT_MAX 249 __IFLA_BRPORT_MAX
247}; 250};
248#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) 251#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
@@ -329,6 +332,21 @@ enum macvlan_macaddr_mode {
329 332
330#define MACVLAN_FLAG_NOPROMISC 1 333#define MACVLAN_FLAG_NOPROMISC 1
331 334
335/* IPVLAN section */
336enum {
337 IFLA_IPVLAN_UNSPEC,
338 IFLA_IPVLAN_MODE,
339 __IFLA_IPVLAN_MAX
340};
341
342#define IFLA_IPVLAN_MAX (__IFLA_IPVLAN_MAX - 1)
343
344enum ipvlan_mode {
345 IPVLAN_MODE_L2 = 0,
346 IPVLAN_MODE_L3,
347 IPVLAN_MODE_MAX
348};
349
332/* VXLAN section */ 350/* VXLAN section */
333enum { 351enum {
334 IFLA_VXLAN_UNSPEC, 352 IFLA_VXLAN_UNSPEC,
diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index 280d9e092283..bd3cc11a431f 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -69,6 +69,7 @@ enum tunnel_encap_types {
69 69
70#define TUNNEL_ENCAP_FLAG_CSUM (1<<0) 70#define TUNNEL_ENCAP_FLAG_CSUM (1<<0)
71#define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1) 71#define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1)
72#define TUNNEL_ENCAP_FLAG_REMCSUM (1<<2)
72 73
73/* SIT-mode i_flags */ 74/* SIT-mode i_flags */
74#define SIT_ISATAP 0x0001 75#define SIT_ISATAP 0x0001
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
index efa2666f4b8a..e863d088b9a5 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -164,6 +164,7 @@ enum {
164 DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL, 164 DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
165 DEVCONF_SUPPRESS_FRAG_NDISC, 165 DEVCONF_SUPPRESS_FRAG_NDISC,
166 DEVCONF_ACCEPT_RA_FROM_LOCAL, 166 DEVCONF_ACCEPT_RA_FROM_LOCAL,
167 DEVCONF_USE_OPTIMISTIC,
167 DEVCONF_MAX 168 DEVCONF_MAX
168}; 169};
169 170
diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h
index 4a1d7e96dfe3..f3d77f9f1e0b 100644
--- a/include/uapi/linux/neighbour.h
+++ b/include/uapi/linux/neighbour.h
@@ -35,11 +35,11 @@ enum {
35 */ 35 */
36 36
37#define NTF_USE 0x01 37#define NTF_USE 0x01
38#define NTF_PROXY 0x08 /* == ATF_PUBL */
39#define NTF_ROUTER 0x80
40
41#define NTF_SELF 0x02 38#define NTF_SELF 0x02
42#define NTF_MASTER 0x04 39#define NTF_MASTER 0x04
40#define NTF_PROXY 0x08 /* == ATF_PUBL */
41#define NTF_EXT_LEARNED 0x10
42#define NTF_ROUTER 0x80
43 43
44/* 44/*
45 * Neighbor Cache Entry States. 45 * Neighbor Cache Entry States.
diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h
index ff354021bb69..edbc888ceb51 100644
--- a/include/uapi/linux/net_tstamp.h
+++ b/include/uapi/linux/net_tstamp.h
@@ -23,8 +23,9 @@ enum {
23 SOF_TIMESTAMPING_OPT_ID = (1<<7), 23 SOF_TIMESTAMPING_OPT_ID = (1<<7),
24 SOF_TIMESTAMPING_TX_SCHED = (1<<8), 24 SOF_TIMESTAMPING_TX_SCHED = (1<<8),
25 SOF_TIMESTAMPING_TX_ACK = (1<<9), 25 SOF_TIMESTAMPING_TX_ACK = (1<<9),
26 SOF_TIMESTAMPING_OPT_CMSG = (1<<10),
26 27
27 SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_TX_ACK, 28 SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_CMSG,
28 SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) | 29 SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) |
29 SOF_TIMESTAMPING_LAST 30 SOF_TIMESTAMPING_LAST
30}; 31};
diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h
index ca03119111a2..5ab4e60894cf 100644
--- a/include/uapi/linux/netfilter/ipset/ip_set.h
+++ b/include/uapi/linux/netfilter/ipset/ip_set.h
@@ -256,11 +256,17 @@ enum {
256 IPSET_COUNTER_GT, 256 IPSET_COUNTER_GT,
257}; 257};
258 258
259struct ip_set_counter_match { 259/* Backward compatibility for set match v3 */
260struct ip_set_counter_match0 {
260 __u8 op; 261 __u8 op;
261 __u64 value; 262 __u64 value;
262}; 263};
263 264
265struct ip_set_counter_match {
266 __aligned_u64 value;
267 __u8 op;
268};
269
264/* Interface to iptables/ip6tables */ 270/* Interface to iptables/ip6tables */
265 271
266#define SO_IP_SET 83 272#define SO_IP_SET 83
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index f31fe7b660a5..832bc46db78b 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -579,6 +579,7 @@ enum nft_exthdr_attributes {
579 * @NFT_META_CPU: cpu id through smp_processor_id() 579 * @NFT_META_CPU: cpu id through smp_processor_id()
580 * @NFT_META_IIFGROUP: packet input interface group 580 * @NFT_META_IIFGROUP: packet input interface group
581 * @NFT_META_OIFGROUP: packet output interface group 581 * @NFT_META_OIFGROUP: packet output interface group
582 * @NFT_META_CGROUP: socket control group (skb->sk->sk_classid)
582 */ 583 */
583enum nft_meta_keys { 584enum nft_meta_keys {
584 NFT_META_LEN, 585 NFT_META_LEN,
@@ -604,6 +605,7 @@ enum nft_meta_keys {
604 NFT_META_CPU, 605 NFT_META_CPU,
605 NFT_META_IIFGROUP, 606 NFT_META_IIFGROUP,
606 NFT_META_OIFGROUP, 607 NFT_META_OIFGROUP,
608 NFT_META_CGROUP,
607}; 609};
608 610
609/** 611/**
@@ -838,6 +840,22 @@ enum nft_masq_attributes {
838#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1) 840#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
839 841
840/** 842/**
843 * enum nft_redir_attributes - nf_tables redirect expression netlink attributes
844 *
845 * @NFTA_REDIR_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
846 * @NFTA_REDIR_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
847 * @NFTA_REDIR_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
848 */
849enum nft_redir_attributes {
850 NFTA_REDIR_UNSPEC,
851 NFTA_REDIR_REG_PROTO_MIN,
852 NFTA_REDIR_REG_PROTO_MAX,
853 NFTA_REDIR_FLAGS,
854 __NFTA_REDIR_MAX
855};
856#define NFTA_REDIR_MAX (__NFTA_REDIR_MAX - 1)
857
858/**
841 * enum nft_gen_attributes - nf_tables ruleset generation attributes 859 * enum nft_gen_attributes - nf_tables ruleset generation attributes
842 * 860 *
843 * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32) 861 * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32)
diff --git a/include/uapi/linux/netfilter/xt_set.h b/include/uapi/linux/netfilter/xt_set.h
index d6a1df1f2947..d4e02348384c 100644
--- a/include/uapi/linux/netfilter/xt_set.h
+++ b/include/uapi/linux/netfilter/xt_set.h
@@ -66,8 +66,8 @@ struct xt_set_info_target_v2 {
66 66
67struct xt_set_info_match_v3 { 67struct xt_set_info_match_v3 {
68 struct xt_set_info match_set; 68 struct xt_set_info match_set;
69 struct ip_set_counter_match packets; 69 struct ip_set_counter_match0 packets;
70 struct ip_set_counter_match bytes; 70 struct ip_set_counter_match0 bytes;
71 __u32 flags; 71 __u32 flags;
72}; 72};
73 73
@@ -81,4 +81,13 @@ struct xt_set_info_target_v3 {
81 __u32 timeout; 81 __u32 timeout;
82}; 82};
83 83
84/* Revision 4 match */
85
86struct xt_set_info_match_v4 {
87 struct xt_set_info match_set;
88 struct ip_set_counter_match packets;
89 struct ip_set_counter_match bytes;
90 __u32 flags;
91};
92
84#endif /*_XT_SET_H*/ 93#endif /*_XT_SET_H*/
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 9b19b4461928..8119255feae4 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -116,6 +116,7 @@ enum nfc_commands {
116 NFC_EVENT_SE_TRANSACTION, 116 NFC_EVENT_SE_TRANSACTION,
117 NFC_CMD_GET_SE, 117 NFC_CMD_GET_SE,
118 NFC_CMD_SE_IO, 118 NFC_CMD_SE_IO,
119 NFC_CMD_ACTIVATE_TARGET,
119/* private: internal use only */ 120/* private: internal use only */
120 __NFC_CMD_AFTER_LAST 121 __NFC_CMD_AFTER_LAST
121}; 122};
@@ -196,15 +197,19 @@ enum nfc_sdp_attr {
196}; 197};
197#define NFC_SDP_ATTR_MAX (__NFC_SDP_ATTR_AFTER_LAST - 1) 198#define NFC_SDP_ATTR_MAX (__NFC_SDP_ATTR_AFTER_LAST - 1)
198 199
199#define NFC_DEVICE_NAME_MAXSIZE 8 200#define NFC_DEVICE_NAME_MAXSIZE 8
200#define NFC_NFCID1_MAXSIZE 10 201#define NFC_NFCID1_MAXSIZE 10
201#define NFC_NFCID2_MAXSIZE 8 202#define NFC_NFCID2_MAXSIZE 8
202#define NFC_NFCID3_MAXSIZE 10 203#define NFC_NFCID3_MAXSIZE 10
203#define NFC_SENSB_RES_MAXSIZE 12 204#define NFC_SENSB_RES_MAXSIZE 12
204#define NFC_SENSF_RES_MAXSIZE 18 205#define NFC_SENSF_RES_MAXSIZE 18
205#define NFC_GB_MAXSIZE 48 206#define NFC_ATR_REQ_MAXSIZE 64
206#define NFC_FIRMWARE_NAME_MAXSIZE 32 207#define NFC_ATR_RES_MAXSIZE 64
207#define NFC_ISO15693_UID_MAXSIZE 8 208#define NFC_ATR_REQ_GB_MAXSIZE 48
209#define NFC_ATR_RES_GB_MAXSIZE 47
210#define NFC_GB_MAXSIZE 48
211#define NFC_FIRMWARE_NAME_MAXSIZE 32
212#define NFC_ISO15693_UID_MAXSIZE 8
208 213
209/* NFC protocols */ 214/* NFC protocols */
210#define NFC_PROTO_JEWEL 1 215#define NFC_PROTO_JEWEL 1
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 4b28dc07bcb1..b37bd5a1cb82 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -227,7 +227,11 @@
227 * the interface identified by %NL80211_ATTR_IFINDEX. 227 * the interface identified by %NL80211_ATTR_IFINDEX.
228 * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC 228 * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC
229 * or, if no MAC address given, all stations, on the interface identified 229 * or, if no MAC address given, all stations, on the interface identified
230 * by %NL80211_ATTR_IFINDEX. 230 * by %NL80211_ATTR_IFINDEX. %NL80211_ATTR_MGMT_SUBTYPE and
231 * %NL80211_ATTR_REASON_CODE can optionally be used to specify which type
232 * of disconnection indication should be sent to the station
233 * (Deauthentication or Disassociation frame and reason code for that
234 * frame).
231 * 235 *
232 * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to 236 * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to
233 * destination %NL80211_ATTR_MAC on the interface identified by 237 * destination %NL80211_ATTR_MAC on the interface identified by
@@ -639,7 +643,18 @@
639 * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels 643 * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels
640 * independently of the userspace SME, send this event indicating 644 * independently of the userspace SME, send this event indicating
641 * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the 645 * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the
642 * attributes determining channel width. 646 * attributes determining channel width. This indication may also be
647 * sent when a remotely-initiated switch (e.g., when a STA receives a CSA
648 * from the remote AP) is completed;
649 *
650 * @NL80211_CMD_CH_SWITCH_STARTED_NOTIFY: Notify that a channel switch
651 * has been started on an interface, regardless of the initiator
652 * (ie. whether it was requested from a remote device or
653 * initiated on our own). It indicates that
654 * %NL80211_ATTR_IFINDEX will be on %NL80211_ATTR_WIPHY_FREQ
655 * after %NL80211_ATTR_CH_SWITCH_COUNT TBTT's. The userspace may
656 * decide to react to this indication by requesting other
657 * interfaces to change channel as well.
643 * 658 *
644 * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by 659 * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by
645 * its %NL80211_ATTR_WDEV identifier. It must have been created with 660 * its %NL80211_ATTR_WDEV identifier. It must have been created with
@@ -738,6 +753,27 @@
738 * before removing a station entry entirely, or before disassociating 753 * before removing a station entry entirely, or before disassociating
739 * or similar, cleanup will happen in the driver/device in this case. 754 * or similar, cleanup will happen in the driver/device in this case.
740 * 755 *
756 * @NL80211_CMD_GET_MPP: Get mesh path attributes for mesh proxy path to
757 * destination %NL80211_ATTR_MAC on the interface identified by
758 * %NL80211_ATTR_IFINDEX.
759 *
760 * @NL80211_CMD_JOIN_OCB: Join the OCB network. The center frequency and
761 * bandwidth of a channel must be given.
762 * @NL80211_CMD_LEAVE_OCB: Leave the OCB network -- no special arguments, the
763 * network is determined by the network interface.
764 *
765 * @NL80211_CMD_TDLS_CHANNEL_SWITCH: Start channel-switching with a TDLS peer,
766 * identified by the %NL80211_ATTR_MAC parameter. A target channel is
767 * provided via %NL80211_ATTR_WIPHY_FREQ and other attributes determining
768 * channel width/type. The target operating class is given via
769 * %NL80211_ATTR_OPER_CLASS.
770 * The driver is responsible for continually initiating channel-switching
771 * operations and returning to the base channel for communication with the
772 * AP.
773 * @NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH: Stop channel-switching with a TDLS
774 * peer given by %NL80211_ATTR_MAC. Both peers must be on the base channel
775 * when this command completes.
776 *
741 * @NL80211_CMD_MAX: highest used command number 777 * @NL80211_CMD_MAX: highest used command number
742 * @__NL80211_CMD_AFTER_LAST: internal use 778 * @__NL80211_CMD_AFTER_LAST: internal use
743 */ 779 */
@@ -912,6 +948,16 @@ enum nl80211_commands {
912 NL80211_CMD_ADD_TX_TS, 948 NL80211_CMD_ADD_TX_TS,
913 NL80211_CMD_DEL_TX_TS, 949 NL80211_CMD_DEL_TX_TS,
914 950
951 NL80211_CMD_GET_MPP,
952
953 NL80211_CMD_JOIN_OCB,
954 NL80211_CMD_LEAVE_OCB,
955
956 NL80211_CMD_CH_SWITCH_STARTED_NOTIFY,
957
958 NL80211_CMD_TDLS_CHANNEL_SWITCH,
959 NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH,
960
915 /* add new commands above here */ 961 /* add new commands above here */
916 962
917 /* used to define NL80211_CMD_MAX below */ 963 /* used to define NL80211_CMD_MAX below */
@@ -1606,9 +1652,9 @@ enum nl80211_commands {
1606 * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32. 1652 * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
1607 * As specified in the &enum nl80211_tdls_peer_capability. 1653 * As specified in the &enum nl80211_tdls_peer_capability.
1608 * 1654 *
1609 * @NL80211_ATTR_IFACE_SOCKET_OWNER: flag attribute, if set during interface 1655 * @NL80211_ATTR_SOCKET_OWNER: Flag attribute, if set during interface
1610 * creation then the new interface will be owned by the netlink socket 1656 * creation then the new interface will be owned by the netlink socket
1611 * that created it and will be destroyed when the socket is closed 1657 * that created it and will be destroyed when the socket is closed.
1612 * 1658 *
1613 * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is 1659 * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
1614 * the TDLS link initiator. 1660 * the TDLS link initiator.
@@ -1638,6 +1684,11 @@ enum nl80211_commands {
1638 * @NL80211_ATTR_SMPS_MODE: SMPS mode to use (ap mode). see 1684 * @NL80211_ATTR_SMPS_MODE: SMPS mode to use (ap mode). see
1639 * &enum nl80211_smps_mode. 1685 * &enum nl80211_smps_mode.
1640 * 1686 *
1687 * @NL80211_ATTR_OPER_CLASS: operating class
1688 *
1689 * @NL80211_ATTR_MAC_MASK: MAC address mask
1690 *
1691 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
1641 * @NL80211_ATTR_MAX: highest attribute number currently defined 1692 * @NL80211_ATTR_MAX: highest attribute number currently defined
1642 * @__NL80211_ATTR_AFTER_LAST: internal use 1693 * @__NL80211_ATTR_AFTER_LAST: internal use
1643 */ 1694 */
@@ -1973,7 +2024,7 @@ enum nl80211_attrs {
1973 2024
1974 NL80211_ATTR_TDLS_PEER_CAPABILITY, 2025 NL80211_ATTR_TDLS_PEER_CAPABILITY,
1975 2026
1976 NL80211_ATTR_IFACE_SOCKET_OWNER, 2027 NL80211_ATTR_SOCKET_OWNER,
1977 2028
1978 NL80211_ATTR_CSA_C_OFFSETS_TX, 2029 NL80211_ATTR_CSA_C_OFFSETS_TX,
1979 NL80211_ATTR_MAX_CSA_COUNTERS, 2030 NL80211_ATTR_MAX_CSA_COUNTERS,
@@ -1990,15 +2041,21 @@ enum nl80211_attrs {
1990 2041
1991 NL80211_ATTR_SMPS_MODE, 2042 NL80211_ATTR_SMPS_MODE,
1992 2043
2044 NL80211_ATTR_OPER_CLASS,
2045
2046 NL80211_ATTR_MAC_MASK,
2047
1993 /* add attributes here, update the policy in nl80211.c */ 2048 /* add attributes here, update the policy in nl80211.c */
1994 2049
1995 __NL80211_ATTR_AFTER_LAST, 2050 __NL80211_ATTR_AFTER_LAST,
2051 NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
1996 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 2052 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
1997}; 2053};
1998 2054
1999/* source-level API compatibility */ 2055/* source-level API compatibility */
2000#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION 2056#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
2001#define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG 2057#define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
2058#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
2002 2059
2003/* 2060/*
2004 * Allow user space programs to use #ifdef on new attributes by defining them 2061 * Allow user space programs to use #ifdef on new attributes by defining them
@@ -2064,6 +2121,8 @@ enum nl80211_attrs {
2064 * and therefore can't be created in the normal ways, use the 2121 * and therefore can't be created in the normal ways, use the
2065 * %NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE 2122 * %NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE
2066 * commands to create and destroy one 2123 * commands to create and destroy one
2124 * @NL80211_IF_TYPE_OCB: Outside Context of a BSS
2125 * This mode corresponds to the MIB variable dot11OCBActivated=true
2067 * @NL80211_IFTYPE_MAX: highest interface type number currently defined 2126 * @NL80211_IFTYPE_MAX: highest interface type number currently defined
2068 * @NUM_NL80211_IFTYPES: number of defined interface types 2127 * @NUM_NL80211_IFTYPES: number of defined interface types
2069 * 2128 *
@@ -2083,6 +2142,7 @@ enum nl80211_iftype {
2083 NL80211_IFTYPE_P2P_CLIENT, 2142 NL80211_IFTYPE_P2P_CLIENT,
2084 NL80211_IFTYPE_P2P_GO, 2143 NL80211_IFTYPE_P2P_GO,
2085 NL80211_IFTYPE_P2P_DEVICE, 2144 NL80211_IFTYPE_P2P_DEVICE,
2145 NL80211_IFTYPE_OCB,
2086 2146
2087 /* keep last */ 2147 /* keep last */
2088 NUM_NL80211_IFTYPES, 2148 NUM_NL80211_IFTYPES,
@@ -2631,6 +2691,11 @@ enum nl80211_sched_scan_match_attr {
2631 * @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated 2691 * @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated
2632 * base on contiguous rules and wider channels will be allowed to cross 2692 * base on contiguous rules and wider channels will be allowed to cross
2633 * multiple contiguous/overlapping frequency ranges. 2693 * multiple contiguous/overlapping frequency ranges.
2694 * @NL80211_RRF_GO_CONCURRENT: See &NL80211_FREQUENCY_ATTR_GO_CONCURRENT
2695 * @NL80211_RRF_NO_HT40MINUS: channels can't be used in HT40- operation
2696 * @NL80211_RRF_NO_HT40PLUS: channels can't be used in HT40+ operation
2697 * @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed
2698 * @NL80211_RRF_NO_160MHZ: 160MHz operation not allowed
2634 */ 2699 */
2635enum nl80211_reg_rule_flags { 2700enum nl80211_reg_rule_flags {
2636 NL80211_RRF_NO_OFDM = 1<<0, 2701 NL80211_RRF_NO_OFDM = 1<<0,
@@ -2643,11 +2708,18 @@ enum nl80211_reg_rule_flags {
2643 NL80211_RRF_NO_IR = 1<<7, 2708 NL80211_RRF_NO_IR = 1<<7,
2644 __NL80211_RRF_NO_IBSS = 1<<8, 2709 __NL80211_RRF_NO_IBSS = 1<<8,
2645 NL80211_RRF_AUTO_BW = 1<<11, 2710 NL80211_RRF_AUTO_BW = 1<<11,
2711 NL80211_RRF_GO_CONCURRENT = 1<<12,
2712 NL80211_RRF_NO_HT40MINUS = 1<<13,
2713 NL80211_RRF_NO_HT40PLUS = 1<<14,
2714 NL80211_RRF_NO_80MHZ = 1<<15,
2715 NL80211_RRF_NO_160MHZ = 1<<16,
2646}; 2716};
2647 2717
2648#define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR 2718#define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR
2649#define NL80211_RRF_NO_IBSS NL80211_RRF_NO_IR 2719#define NL80211_RRF_NO_IBSS NL80211_RRF_NO_IR
2650#define NL80211_RRF_NO_IR NL80211_RRF_NO_IR 2720#define NL80211_RRF_NO_IR NL80211_RRF_NO_IR
2721#define NL80211_RRF_NO_HT40 (NL80211_RRF_NO_HT40MINUS |\
2722 NL80211_RRF_NO_HT40PLUS)
2651 2723
2652/* For backport compatibility with older userspace */ 2724/* For backport compatibility with older userspace */
2653#define NL80211_RRF_NO_IR_ALL (NL80211_RRF_NO_IR | __NL80211_RRF_NO_IBSS) 2725#define NL80211_RRF_NO_IR_ALL (NL80211_RRF_NO_IR | __NL80211_RRF_NO_IBSS)
@@ -3379,6 +3451,8 @@ enum nl80211_ps_state {
3379 * interval in which %NL80211_ATTR_CQM_TXE_PKTS and 3451 * interval in which %NL80211_ATTR_CQM_TXE_PKTS and
3380 * %NL80211_ATTR_CQM_TXE_RATE must be satisfied before generating an 3452 * %NL80211_ATTR_CQM_TXE_RATE must be satisfied before generating an
3381 * %NL80211_CMD_NOTIFY_CQM. Set to 0 to turn off TX error reporting. 3453 * %NL80211_CMD_NOTIFY_CQM. Set to 0 to turn off TX error reporting.
3454 * @NL80211_ATTR_CQM_BEACON_LOSS_EVENT: flag attribute that's set in a beacon
3455 * loss event
3382 * @__NL80211_ATTR_CQM_AFTER_LAST: internal 3456 * @__NL80211_ATTR_CQM_AFTER_LAST: internal
3383 * @NL80211_ATTR_CQM_MAX: highest key attribute 3457 * @NL80211_ATTR_CQM_MAX: highest key attribute
3384 */ 3458 */
@@ -3391,6 +3465,7 @@ enum nl80211_attr_cqm {
3391 NL80211_ATTR_CQM_TXE_RATE, 3465 NL80211_ATTR_CQM_TXE_RATE,
3392 NL80211_ATTR_CQM_TXE_PKTS, 3466 NL80211_ATTR_CQM_TXE_PKTS,
3393 NL80211_ATTR_CQM_TXE_INTVL, 3467 NL80211_ATTR_CQM_TXE_INTVL,
3468 NL80211_ATTR_CQM_BEACON_LOSS_EVENT,
3394 3469
3395 /* keep last */ 3470 /* keep last */
3396 __NL80211_ATTR_CQM_AFTER_LAST, 3471 __NL80211_ATTR_CQM_AFTER_LAST,
@@ -3403,9 +3478,7 @@ enum nl80211_attr_cqm {
3403 * configured threshold 3478 * configured threshold
3404 * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the 3479 * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the
3405 * configured threshold 3480 * configured threshold
3406 * @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: The device experienced beacon loss. 3481 * @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: (reserved, never sent)
3407 * (Note that deauth/disassoc will still follow if the AP is not
3408 * available. This event might get used as roaming event, etc.)
3409 */ 3482 */
3410enum nl80211_cqm_rssi_threshold_event { 3483enum nl80211_cqm_rssi_threshold_event {
3411 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, 3484 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
@@ -3545,6 +3618,25 @@ struct nl80211_pattern_support {
3545 * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS: For wakeup reporting only, 3618 * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS: For wakeup reporting only,
3546 * the TCP connection ran out of tokens to use for data to send to the 3619 * the TCP connection ran out of tokens to use for data to send to the
3547 * service 3620 * service
3621 * @NL80211_WOWLAN_TRIG_NET_DETECT: wake up when a configured network
3622 * is detected. This is a nested attribute that contains the
3623 * same attributes used with @NL80211_CMD_START_SCHED_SCAN. It
3624 * specifies how the scan is performed (e.g. the interval and the
3625 * channels to scan) as well as the scan results that will
3626 * trigger a wake (i.e. the matchsets).
3627 * @NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS: nested attribute
3628 * containing an array with information about what triggered the
3629 * wake up. If no elements are present in the array, it means
3630 * that the information is not available. If more than one
3631 * element is present, it means that more than one match
3632 * occurred.
3633 * Each element in the array is a nested attribute that contains
3634 * one optional %NL80211_ATTR_SSID attribute and one optional
3635 * %NL80211_ATTR_SCAN_FREQUENCIES attribute. At least one of
3636 * these attributes must be present. If
3637 * %NL80211_ATTR_SCAN_FREQUENCIES contains more than one
3638 * frequency, it means that the match occurred in more than one
3639 * channel.
3548 * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers 3640 * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers
3549 * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number 3641 * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number
3550 * 3642 *
@@ -3570,6 +3662,8 @@ enum nl80211_wowlan_triggers {
3570 NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH, 3662 NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH,
3571 NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST, 3663 NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST,
3572 NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS, 3664 NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS,
3665 NL80211_WOWLAN_TRIG_NET_DETECT,
3666 NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS,
3573 3667
3574 /* keep last */ 3668 /* keep last */
3575 NUM_NL80211_WOWLAN_TRIG, 3669 NUM_NL80211_WOWLAN_TRIG,
@@ -4042,6 +4136,27 @@ enum nl80211_ap_sme_features {
4042 * multiplexing powersave, ie. can turn off all but one chain 4136 * multiplexing powersave, ie. can turn off all but one chain
4043 * and then wake the rest up as required after, for example, 4137 * and then wake the rest up as required after, for example,
4044 * rts/cts handshake. 4138 * rts/cts handshake.
4139 * @NL80211_FEATURE_SUPPORTS_WMM_ADMISSION: the device supports setting up WMM
4140 * TSPEC sessions (TID aka TSID 0-7) with the %NL80211_CMD_ADD_TX_TS
4141 * command. Standard IEEE 802.11 TSPEC setup is not yet supported, it
4142 * needs to be able to handle Block-Ack agreements and other things.
4143 * @NL80211_FEATURE_MAC_ON_CREATE: Device supports configuring
4144 * the vif's MAC address upon creation.
4145 * See 'macaddr' field in the vif_params (cfg80211.h).
4146 * @NL80211_FEATURE_TDLS_CHANNEL_SWITCH: Driver supports channel switching when
4147 * operating as a TDLS peer.
4148 * @NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR: This device/driver supports using a
4149 * random MAC address during scan (if the device is unassociated); the
4150 * %NL80211_SCAN_FLAG_RANDOM_ADDR flag may be set for scans and the MAC
4151 * address mask/value will be used.
4152 * @NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR: This device/driver supports
4153 * using a random MAC address for every scan iteration during scheduled
4154 * scan (while not associated), the %NL80211_SCAN_FLAG_RANDOM_ADDR may
4155 * be set for scheduled scan and the MAC address mask/value will be used.
4156 * @NL80211_FEATURE_ND_RANDOM_MAC_ADDR: This device/driver supports using a
4157 * random MAC address for every scan iteration during "net detect", i.e.
4158 * scan in unassociated WoWLAN, the %NL80211_SCAN_FLAG_RANDOM_ADDR may
4159 * be set for scheduled scan and the MAC address mask/value will be used.
4045 */ 4160 */
4046enum nl80211_feature_flags { 4161enum nl80211_feature_flags {
4047 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 4162 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -4070,6 +4185,12 @@ enum nl80211_feature_flags {
4070 NL80211_FEATURE_ACKTO_ESTIMATION = 1 << 23, 4185 NL80211_FEATURE_ACKTO_ESTIMATION = 1 << 23,
4071 NL80211_FEATURE_STATIC_SMPS = 1 << 24, 4186 NL80211_FEATURE_STATIC_SMPS = 1 << 24,
4072 NL80211_FEATURE_DYNAMIC_SMPS = 1 << 25, 4187 NL80211_FEATURE_DYNAMIC_SMPS = 1 << 25,
4188 NL80211_FEATURE_SUPPORTS_WMM_ADMISSION = 1 << 26,
4189 NL80211_FEATURE_MAC_ON_CREATE = 1 << 27,
4190 NL80211_FEATURE_TDLS_CHANNEL_SWITCH = 1 << 28,
4191 NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = 1 << 29,
4192 NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = 1 << 30,
4193 NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1 << 31,
4073}; 4194};
4074 4195
4075/** 4196/**
@@ -4118,11 +4239,21 @@ enum nl80211_connect_failed_reason {
4118 * dangerous because will destroy stations performance as a lot of frames 4239 * dangerous because will destroy stations performance as a lot of frames
4119 * will be lost while scanning off-channel, therefore it must be used only 4240 * will be lost while scanning off-channel, therefore it must be used only
4120 * when really needed 4241 * when really needed
4242 * @NL80211_SCAN_FLAG_RANDOM_ADDR: use a random MAC address for this scan (or
4243 * for scheduled scan: a different one for every scan iteration). When the
4244 * flag is set, depending on device capabilities the @NL80211_ATTR_MAC and
4245 * @NL80211_ATTR_MAC_MASK attributes may also be given in which case only
4246 * the masked bits will be preserved from the MAC address and the remainder
4247 * randomised. If the attributes are not given full randomisation (46 bits,
4248 * locally administered 1, multicast 0) is assumed.
4249 * This flag must not be requested when the feature isn't supported, check
4250 * the nl80211 feature flags for the device.
4121 */ 4251 */
4122enum nl80211_scan_flags { 4252enum nl80211_scan_flags {
4123 NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0, 4253 NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0,
4124 NL80211_SCAN_FLAG_FLUSH = 1<<1, 4254 NL80211_SCAN_FLAG_FLUSH = 1<<1,
4125 NL80211_SCAN_FLAG_AP = 1<<2, 4255 NL80211_SCAN_FLAG_AP = 1<<2,
4256 NL80211_SCAN_FLAG_RANDOM_ADDR = 1<<3,
4126}; 4257};
4127 4258
4128/** 4259/**
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 435eabc5ffaa..3a6dcaa359b7 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -157,6 +157,11 @@ enum ovs_packet_cmd {
157 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an 157 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an
158 * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content 158 * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content
159 * specified there. 159 * specified there.
160 * @OVS_PACKET_ATTR_EGRESS_TUN_KEY: Present for an %OVS_PACKET_CMD_ACTION
161 * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an
162 * %OVS_USERSPACE_ATTR_EGRESS_TUN_PORT attribute, which is sent only if the
163 * output port is actually a tunnel port. Contains the output tunnel key
164 * extracted from the packet as nested %OVS_TUNNEL_KEY_ATTR_* attributes.
160 * 165 *
161 * These attributes follow the &struct ovs_header within the Generic Netlink 166 * These attributes follow the &struct ovs_header within the Generic Netlink
162 * payload for %OVS_PACKET_* commands. 167 * payload for %OVS_PACKET_* commands.
@@ -167,6 +172,8 @@ enum ovs_packet_attr {
167 OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ 172 OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */
168 OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ 173 OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
169 OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */ 174 OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */
175 OVS_PACKET_ATTR_EGRESS_TUN_KEY, /* Nested OVS_TUNNEL_KEY_ATTR_*
176 attributes. */
170 __OVS_PACKET_ATTR_MAX 177 __OVS_PACKET_ATTR_MAX
171}; 178};
172 179
@@ -293,6 +300,9 @@ enum ovs_key_attr {
293 OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash 300 OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash
294 is not computed by the datapath. */ 301 is not computed by the datapath. */
295 OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */ 302 OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */
303 OVS_KEY_ATTR_MPLS, /* array of struct ovs_key_mpls.
304 * The implementation may restrict
305 * the accepted length of the array. */
296 306
297#ifdef __KERNEL__ 307#ifdef __KERNEL__
298 OVS_KEY_ATTR_TUNNEL_INFO, /* struct ovs_tunnel_info */ 308 OVS_KEY_ATTR_TUNNEL_INFO, /* struct ovs_tunnel_info */
@@ -312,6 +322,8 @@ enum ovs_tunnel_key_attr {
312 OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ 322 OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */
313 OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */ 323 OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */
314 OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */ 324 OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */
325 OVS_TUNNEL_KEY_ATTR_TP_SRC, /* be16 src Transport Port. */
326 OVS_TUNNEL_KEY_ATTR_TP_DST, /* be16 dst Transport Port. */
315 __OVS_TUNNEL_KEY_ATTR_MAX 327 __OVS_TUNNEL_KEY_ATTR_MAX
316}; 328};
317 329
@@ -340,6 +352,10 @@ struct ovs_key_ethernet {
340 __u8 eth_dst[ETH_ALEN]; 352 __u8 eth_dst[ETH_ALEN];
341}; 353};
342 354
355struct ovs_key_mpls {
356 __be32 mpls_lse;
357};
358
343struct ovs_key_ipv4 { 359struct ovs_key_ipv4 {
344 __be32 ipv4_src; 360 __be32 ipv4_src;
345 __be32 ipv4_dst; 361 __be32 ipv4_dst;
@@ -393,9 +409,9 @@ struct ovs_key_arp {
393}; 409};
394 410
395struct ovs_key_nd { 411struct ovs_key_nd {
396 __u32 nd_target[4]; 412 __be32 nd_target[4];
397 __u8 nd_sll[ETH_ALEN]; 413 __u8 nd_sll[ETH_ALEN];
398 __u8 nd_tll[ETH_ALEN]; 414 __u8 nd_tll[ETH_ALEN];
399}; 415};
400 416
401/** 417/**
@@ -441,6 +457,8 @@ enum ovs_flow_attr {
441 OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */ 457 OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */
442 OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */ 458 OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */
443 OVS_FLOW_ATTR_MASK, /* Sequence of OVS_KEY_ATTR_* attributes. */ 459 OVS_FLOW_ATTR_MASK, /* Sequence of OVS_KEY_ATTR_* attributes. */
460 OVS_FLOW_ATTR_PROBE, /* Flow operation is a feature probe, error
461 * logging should be suppressed. */
444 __OVS_FLOW_ATTR_MAX 462 __OVS_FLOW_ATTR_MAX
445}; 463};
446 464
@@ -473,17 +491,34 @@ enum ovs_sample_attr {
473 * message should be sent. Required. 491 * message should be sent. Required.
474 * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is 492 * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is
475 * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA. 493 * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA.
494 * @OVS_USERSPACE_ATTR_EGRESS_TUN_PORT: If present, u32 output port to get
495 * tunnel info.
476 */ 496 */
477enum ovs_userspace_attr { 497enum ovs_userspace_attr {
478 OVS_USERSPACE_ATTR_UNSPEC, 498 OVS_USERSPACE_ATTR_UNSPEC,
479 OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */ 499 OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */
480 OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */ 500 OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */
501 OVS_USERSPACE_ATTR_EGRESS_TUN_PORT, /* Optional, u32 output port
502 * to get tunnel info. */
481 __OVS_USERSPACE_ATTR_MAX 503 __OVS_USERSPACE_ATTR_MAX
482}; 504};
483 505
484#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) 506#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
485 507
486/** 508/**
509 * struct ovs_action_push_mpls - %OVS_ACTION_ATTR_PUSH_MPLS action argument.
510 * @mpls_lse: MPLS label stack entry to push.
511 * @mpls_ethertype: Ethertype to set in the encapsulating ethernet frame.
512 *
513 * The only values @mpls_ethertype should ever be given are %ETH_P_MPLS_UC and
514 * %ETH_P_MPLS_MC, indicating MPLS unicast or multicast. Other are rejected.
515 */
516struct ovs_action_push_mpls {
517 __be32 mpls_lse;
518 __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */
519};
520
521/**
487 * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. 522 * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument.
488 * @vlan_tpid: Tag protocol identifier (TPID) to push. 523 * @vlan_tpid: Tag protocol identifier (TPID) to push.
489 * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set 524 * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set
@@ -534,6 +569,15 @@ struct ovs_action_hash {
534 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet. 569 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet.
535 * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in 570 * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in
536 * the nested %OVS_SAMPLE_ATTR_* attributes. 571 * the nested %OVS_SAMPLE_ATTR_* attributes.
572 * @OVS_ACTION_ATTR_PUSH_MPLS: Push a new MPLS label stack entry onto the
573 * top of the packets MPLS label stack. Set the ethertype of the
574 * encapsulating frame to either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC to
575 * indicate the new packet contents.
576 * @OVS_ACTION_ATTR_POP_MPLS: Pop an MPLS label stack entry off of the
577 * packet's MPLS label stack. Set the encapsulating frame's ethertype to
578 * indicate the new packet contents. This could potentially still be
579 * %ETH_P_MPLS if the resulting MPLS label stack is not empty. If there
580 * is no MPLS label stack, as determined by ethertype, no action is taken.
537 * 581 *
538 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all 582 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all
539 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment 583 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment
@@ -550,6 +594,9 @@ enum ovs_action_attr {
550 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */ 594 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
551 OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */ 595 OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */
552 OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */ 596 OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */
597 OVS_ACTION_ATTR_PUSH_MPLS, /* struct ovs_action_push_mpls. */
598 OVS_ACTION_ATTR_POP_MPLS, /* __be16 ethertype. */
599
553 __OVS_ACTION_ATTR_MAX 600 __OVS_ACTION_ATTR_MAX
554}; 601};
555 602
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index eb0f1a554d7b..9c9b8b4480cd 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -235,6 +235,7 @@ enum {
235#define RTPROT_NTK 15 /* Netsukuku */ 235#define RTPROT_NTK 15 /* Netsukuku */
236#define RTPROT_DHCP 16 /* DHCP client */ 236#define RTPROT_DHCP 16 /* DHCP client */
237#define RTPROT_MROUTED 17 /* Multicast daemon */ 237#define RTPROT_MROUTED 17 /* Multicast daemon */
238#define RTPROT_BABEL 42 /* Babel daemon */
238 239
239/* rtm_scope 240/* rtm_scope
240 241
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h
index df40137f33dd..b22224100011 100644
--- a/include/uapi/linux/snmp.h
+++ b/include/uapi/linux/snmp.h
@@ -156,6 +156,7 @@ enum
156 UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */ 156 UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */
157 UDP_MIB_SNDBUFERRORS, /* SndbufErrors */ 157 UDP_MIB_SNDBUFERRORS, /* SndbufErrors */
158 UDP_MIB_CSUMERRORS, /* InCsumErrors */ 158 UDP_MIB_CSUMERRORS, /* InCsumErrors */
159 UDP_MIB_IGNOREDMULTI, /* IgnoredMulti */
159 __UDP_MIB_MAX 160 __UDP_MIB_MAX
160}; 161};
161 162
@@ -265,6 +266,10 @@ enum
265 LINUX_MIB_TCPWANTZEROWINDOWADV, /* TCPWantZeroWindowAdv */ 266 LINUX_MIB_TCPWANTZEROWINDOWADV, /* TCPWantZeroWindowAdv */
266 LINUX_MIB_TCPSYNRETRANS, /* TCPSynRetrans */ 267 LINUX_MIB_TCPSYNRETRANS, /* TCPSynRetrans */
267 LINUX_MIB_TCPORIGDATASENT, /* TCPOrigDataSent */ 268 LINUX_MIB_TCPORIGDATASENT, /* TCPOrigDataSent */
269 LINUX_MIB_TCPHYSTARTTRAINDETECT, /* TCPHystartTrainDetect */
270 LINUX_MIB_TCPHYSTARTTRAINCWND, /* TCPHystartTrainCwnd */
271 LINUX_MIB_TCPHYSTARTDELAYDETECT, /* TCPHystartDelayDetect */
272 LINUX_MIB_TCPHYSTARTDELAYCWND, /* TCPHystartDelayCwnd */
268 __LINUX_MIB_MAX 273 __LINUX_MIB_MAX
269}; 274};
270 275
diff --git a/include/uapi/linux/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild
index 56f121605c99..b057da2b87a4 100644
--- a/include/uapi/linux/tc_act/Kbuild
+++ b/include/uapi/linux/tc_act/Kbuild
@@ -7,3 +7,4 @@ header-y += tc_mirred.h
7header-y += tc_nat.h 7header-y += tc_nat.h
8header-y += tc_pedit.h 8header-y += tc_pedit.h
9header-y += tc_skbedit.h 9header-y += tc_skbedit.h
10header-y += tc_vlan.h
diff --git a/include/uapi/linux/tc_act/tc_vlan.h b/include/uapi/linux/tc_act/tc_vlan.h
new file mode 100644
index 000000000000..f7b8d448b960
--- /dev/null
+++ b/include/uapi/linux/tc_act/tc_vlan.h
@@ -0,0 +1,35 @@
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 __LINUX_TC_VLAN_H
11#define __LINUX_TC_VLAN_H
12
13#include <linux/pkt_cls.h>
14
15#define TCA_ACT_VLAN 12
16
17#define TCA_VLAN_ACT_POP 1
18#define TCA_VLAN_ACT_PUSH 2
19
20struct tc_vlan {
21 tc_gen;
22 int v_action;
23};
24
25enum {
26 TCA_VLAN_UNSPEC,
27 TCA_VLAN_TM,
28 TCA_VLAN_PARMS,
29 TCA_VLAN_PUSH_VLAN_ID,
30 TCA_VLAN_PUSH_VLAN_PROTOCOL,
31 __TCA_VLAN_MAX,
32};
33#define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1)
34
35#endif
diff --git a/include/uapi/linux/tipc_netlink.h b/include/uapi/linux/tipc_netlink.h
new file mode 100644
index 000000000000..8d723824ad69
--- /dev/null
+++ b/include/uapi/linux/tipc_netlink.h
@@ -0,0 +1,244 @@
1/*
2 * Copyright (c) 2014, Ericsson AB
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the names of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * Alternatively, this software may be distributed under the terms of the
18 * GNU General Public License ("GPL") version 2 as published by the Free
19 * Software Foundation.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef _LINUX_TIPC_NETLINK_H_
35#define _LINUX_TIPC_NETLINK_H_
36
37#define TIPC_GENL_V2_NAME "TIPCv2"
38#define TIPC_GENL_V2_VERSION 0x1
39
40/* Netlink commands */
41enum {
42 TIPC_NL_UNSPEC,
43 TIPC_NL_LEGACY,
44 TIPC_NL_BEARER_DISABLE,
45 TIPC_NL_BEARER_ENABLE,
46 TIPC_NL_BEARER_GET,
47 TIPC_NL_BEARER_SET,
48 TIPC_NL_SOCK_GET,
49 TIPC_NL_PUBL_GET,
50 TIPC_NL_LINK_GET,
51 TIPC_NL_LINK_SET,
52 TIPC_NL_LINK_RESET_STATS,
53 TIPC_NL_MEDIA_GET,
54 TIPC_NL_MEDIA_SET,
55 TIPC_NL_NODE_GET,
56 TIPC_NL_NET_GET,
57 TIPC_NL_NET_SET,
58 TIPC_NL_NAME_TABLE_GET,
59
60 __TIPC_NL_CMD_MAX,
61 TIPC_NL_CMD_MAX = __TIPC_NL_CMD_MAX - 1
62};
63
64/* Top level netlink attributes */
65enum {
66 TIPC_NLA_UNSPEC,
67 TIPC_NLA_BEARER, /* nest */
68 TIPC_NLA_SOCK, /* nest */
69 TIPC_NLA_PUBL, /* nest */
70 TIPC_NLA_LINK, /* nest */
71 TIPC_NLA_MEDIA, /* nest */
72 TIPC_NLA_NODE, /* nest */
73 TIPC_NLA_NET, /* nest */
74 TIPC_NLA_NAME_TABLE, /* nest */
75
76 __TIPC_NLA_MAX,
77 TIPC_NLA_MAX = __TIPC_NLA_MAX - 1
78};
79
80/* Bearer info */
81enum {
82 TIPC_NLA_BEARER_UNSPEC,
83 TIPC_NLA_BEARER_NAME, /* string */
84 TIPC_NLA_BEARER_PROP, /* nest */
85 TIPC_NLA_BEARER_DOMAIN, /* u32 */
86
87 __TIPC_NLA_BEARER_MAX,
88 TIPC_NLA_BEARER_MAX = __TIPC_NLA_BEARER_MAX - 1
89};
90
91/* Socket info */
92enum {
93 TIPC_NLA_SOCK_UNSPEC,
94 TIPC_NLA_SOCK_ADDR, /* u32 */
95 TIPC_NLA_SOCK_REF, /* u32 */
96 TIPC_NLA_SOCK_CON, /* nest */
97 TIPC_NLA_SOCK_HAS_PUBL, /* flag */
98
99 __TIPC_NLA_SOCK_MAX,
100 TIPC_NLA_SOCK_MAX = __TIPC_NLA_SOCK_MAX - 1
101};
102
103/* Link info */
104enum {
105 TIPC_NLA_LINK_UNSPEC,
106 TIPC_NLA_LINK_NAME, /* string */
107 TIPC_NLA_LINK_DEST, /* u32 */
108 TIPC_NLA_LINK_MTU, /* u32 */
109 TIPC_NLA_LINK_BROADCAST, /* flag */
110 TIPC_NLA_LINK_UP, /* flag */
111 TIPC_NLA_LINK_ACTIVE, /* flag */
112 TIPC_NLA_LINK_PROP, /* nest */
113 TIPC_NLA_LINK_STATS, /* nest */
114 TIPC_NLA_LINK_RX, /* u32 */
115 TIPC_NLA_LINK_TX, /* u32 */
116
117 __TIPC_NLA_LINK_MAX,
118 TIPC_NLA_LINK_MAX = __TIPC_NLA_LINK_MAX - 1
119};
120
121/* Media info */
122enum {
123 TIPC_NLA_MEDIA_UNSPEC,
124 TIPC_NLA_MEDIA_NAME, /* string */
125 TIPC_NLA_MEDIA_PROP, /* nest */
126
127 __TIPC_NLA_MEDIA_MAX,
128 TIPC_NLA_MEDIA_MAX = __TIPC_NLA_MEDIA_MAX - 1
129};
130
131/* Node info */
132enum {
133 TIPC_NLA_NODE_UNSPEC,
134 TIPC_NLA_NODE_ADDR, /* u32 */
135 TIPC_NLA_NODE_UP, /* flag */
136
137 __TIPC_NLA_NODE_MAX,
138 TIPC_NLA_NODE_MAX = __TIPC_NLA_NODE_MAX - 1
139};
140
141/* Net info */
142enum {
143 TIPC_NLA_NET_UNSPEC,
144 TIPC_NLA_NET_ID, /* u32 */
145 TIPC_NLA_NET_ADDR, /* u32 */
146
147 __TIPC_NLA_NET_MAX,
148 TIPC_NLA_NET_MAX = __TIPC_NLA_NET_MAX - 1
149};
150
151/* Name table info */
152enum {
153 TIPC_NLA_NAME_TABLE_UNSPEC,
154 TIPC_NLA_NAME_TABLE_PUBL, /* nest */
155
156 __TIPC_NLA_NAME_TABLE_MAX,
157 TIPC_NLA_NAME_TABLE_MAX = __TIPC_NLA_NAME_TABLE_MAX - 1
158};
159
160/* Publication info */
161enum {
162 TIPC_NLA_PUBL_UNSPEC,
163
164 TIPC_NLA_PUBL_TYPE, /* u32 */
165 TIPC_NLA_PUBL_LOWER, /* u32 */
166 TIPC_NLA_PUBL_UPPER, /* u32 */
167 TIPC_NLA_PUBL_SCOPE, /* u32 */
168 TIPC_NLA_PUBL_NODE, /* u32 */
169 TIPC_NLA_PUBL_REF, /* u32 */
170 TIPC_NLA_PUBL_KEY, /* u32 */
171
172 __TIPC_NLA_PUBL_MAX,
173 TIPC_NLA_PUBL_MAX = __TIPC_NLA_PUBL_MAX - 1
174};
175
176/* Nest, connection info */
177enum {
178 TIPC_NLA_CON_UNSPEC,
179
180 TIPC_NLA_CON_FLAG, /* flag */
181 TIPC_NLA_CON_NODE, /* u32 */
182 TIPC_NLA_CON_SOCK, /* u32 */
183 TIPC_NLA_CON_TYPE, /* u32 */
184 TIPC_NLA_CON_INST, /* u32 */
185
186 __TIPC_NLA_CON_MAX,
187 TIPC_NLA_CON_MAX = __TIPC_NLA_CON_MAX - 1
188};
189
190/* Nest, link propreties. Valid for link, media and bearer */
191enum {
192 TIPC_NLA_PROP_UNSPEC,
193
194 TIPC_NLA_PROP_PRIO, /* u32 */
195 TIPC_NLA_PROP_TOL, /* u32 */
196 TIPC_NLA_PROP_WIN, /* u32 */
197
198 __TIPC_NLA_PROP_MAX,
199 TIPC_NLA_PROP_MAX = __TIPC_NLA_PROP_MAX - 1
200};
201
202/* Nest, statistics info */
203enum {
204 TIPC_NLA_STATS_UNSPEC,
205
206 TIPC_NLA_STATS_RX_INFO, /* u32 */
207 TIPC_NLA_STATS_RX_FRAGMENTS, /* u32 */
208 TIPC_NLA_STATS_RX_FRAGMENTED, /* u32 */
209 TIPC_NLA_STATS_RX_BUNDLES, /* u32 */
210 TIPC_NLA_STATS_RX_BUNDLED, /* u32 */
211 TIPC_NLA_STATS_TX_INFO, /* u32 */
212 TIPC_NLA_STATS_TX_FRAGMENTS, /* u32 */
213 TIPC_NLA_STATS_TX_FRAGMENTED, /* u32 */
214 TIPC_NLA_STATS_TX_BUNDLES, /* u32 */
215 TIPC_NLA_STATS_TX_BUNDLED, /* u32 */
216 TIPC_NLA_STATS_MSG_PROF_TOT, /* u32 */
217 TIPC_NLA_STATS_MSG_LEN_CNT, /* u32 */
218 TIPC_NLA_STATS_MSG_LEN_TOT, /* u32 */
219 TIPC_NLA_STATS_MSG_LEN_P0, /* u32 */
220 TIPC_NLA_STATS_MSG_LEN_P1, /* u32 */
221 TIPC_NLA_STATS_MSG_LEN_P2, /* u32 */
222 TIPC_NLA_STATS_MSG_LEN_P3, /* u32 */
223 TIPC_NLA_STATS_MSG_LEN_P4, /* u32 */
224 TIPC_NLA_STATS_MSG_LEN_P5, /* u32 */
225 TIPC_NLA_STATS_MSG_LEN_P6, /* u32 */
226 TIPC_NLA_STATS_RX_STATES, /* u32 */
227 TIPC_NLA_STATS_RX_PROBES, /* u32 */
228 TIPC_NLA_STATS_RX_NACKS, /* u32 */
229 TIPC_NLA_STATS_RX_DEFERRED, /* u32 */
230 TIPC_NLA_STATS_TX_STATES, /* u32 */
231 TIPC_NLA_STATS_TX_PROBES, /* u32 */
232 TIPC_NLA_STATS_TX_NACKS, /* u32 */
233 TIPC_NLA_STATS_TX_ACKS, /* u32 */
234 TIPC_NLA_STATS_RETRANSMITTED, /* u32 */
235 TIPC_NLA_STATS_DUPLICATES, /* u32 */
236 TIPC_NLA_STATS_LINK_CONGS, /* u32 */
237 TIPC_NLA_STATS_MAX_QUEUE, /* u32 */
238 TIPC_NLA_STATS_AVG_QUEUE, /* u32 */
239
240 __TIPC_NLA_STATS_MAX,
241 TIPC_NLA_STATS_MAX = __TIPC_NLA_STATS_MAX - 1
242};
243
244#endif