aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-11 17:27:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-11 17:27:06 -0500
commit70e71ca0af244f48a5dcf56dc435243792e3a495 (patch)
treef7d9c4c4d9a857a00043e9bf6aa2d6f533a34778 /include/linux
parentbae41e45b7400496b9bf0c70c6004419d9987819 (diff)
parent00c83b01d58068dfeb2e1351cca6fccf2a83fa8f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: 1) New offloading infrastructure and example 'rocker' driver for offloading of switching and routing to hardware. This work was done by a large group of dedicated individuals, not limited to: Scott Feldman, Jiri Pirko, Thomas Graf, John Fastabend, Jamal Hadi Salim, Andy Gospodarek, Florian Fainelli, Roopa Prabhu 2) Start making the networking operate on IOV iterators instead of modifying iov objects in-situ during transfers. Thanks to Al Viro and Herbert Xu. 3) A set of new netlink interfaces for the TIPC stack, from Richard Alpe. 4) Remove unnecessary looping during ipv6 routing lookups, from Martin KaFai Lau. 5) Add PAUSE frame generation support to gianfar driver, from Matei Pavaluca. 6) Allow for larger reordering levels in TCP, which are easily achievable in the real world right now, from Eric Dumazet. 7) Add a variable of napi_schedule that doesn't need to disable cpu interrupts, from Eric Dumazet. 8) Use a doubly linked list to optimize neigh_parms_release(), from Nicolas Dichtel. 9) Various enhancements to the kernel BPF verifier, and allow eBPF programs to actually be attached to sockets. From Alexei Starovoitov. 10) Support TSO/LSO in sunvnet driver, from David L Stevens. 11) Allow controlling ECN usage via routing metrics, from Florian Westphal. 12) Remote checksum offload, from Tom Herbert. 13) Add split-header receive, BQL, and xmit_more support to amd-xgbe driver, from Thomas Lendacky. 14) Add MPLS support to openvswitch, from Simon Horman. 15) Support wildcard tunnel endpoints in ipv6 tunnels, from Steffen Klassert. 16) Do gro flushes on a per-device basis using a timer, from Eric Dumazet. This tries to resolve the conflicting goals between the desired handling of bulk vs. RPC-like traffic. 17) Allow userspace to ask for the CPU upon what a packet was received/steered, via SO_INCOMING_CPU. From Eric Dumazet. 18) Limit GSO packets to half the current congestion window, from Eric Dumazet. 19) Add a generic helper so that all drivers set their RSS keys in a consistent way, from Eric Dumazet. 20) Add xmit_more support to enic driver, from Govindarajulu Varadarajan. 21) Add VLAN packet scheduler action, from Jiri Pirko. 22) Support configurable RSS hash functions via ethtool, from Eyal Perry. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1820 commits) Fix race condition between vxlan_sock_add and vxlan_sock_release net/macb: fix compilation warning for print_hex_dump() called with skb->mac_header net/mlx4: Add support for A0 steering net/mlx4: Refactor QUERY_PORT net/mlx4_core: Add explicit error message when rule doesn't meet configuration net/mlx4: Add A0 hybrid steering net/mlx4: Add mlx4_bitmap zone allocator net/mlx4: Add a check if there are too many reserved QPs net/mlx4: Change QP allocation scheme net/mlx4_core: Use tasklet for user-space CQ completion events net/mlx4_core: Mask out host side virtualization features for guests net/mlx4_en: Set csum level for encapsulated packets be2net: Export tunnel offloads only when a VxLAN tunnel is created gianfar: Fix dma check map error when DMA_API_DEBUG is enabled cxgb4/csiostor: Don't use MASTER_MUST for fw_hello call net: fec: only enable mdio interrupt before phy device link up net: fec: clear all interrupt events to support i.MX6SX net: fec: reset fep link status in suspend function net: sock: fix access via invalid file descriptor net: introduce helper macro for_each_cmsghdr ...
Diffstat (limited to 'include/linux')
-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.h242
-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
39 files changed, 948 insertions, 275 deletions
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/linux/ieee802154.h b/include/linux/ieee802154.h
new file mode 100644
index 000000000000..6e82d888287c
--- /dev/null
+++ b/include/linux/ieee802154.h
@@ -0,0 +1,242 @@
1/*
2 * IEEE802.15.4-2003 specification
3 *
4 * Copyright (C) 2007, 2008 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * Written by:
16 * Pavel Smolenskiy <pavel.smolenskiy@gmail.com>
17 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
18 * Maxim Osipov <maxim.osipov@siemens.com>
19 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
20 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
21 */
22
23#ifndef LINUX_IEEE802154_H
24#define LINUX_IEEE802154_H
25
26#include <linux/types.h>
27#include <linux/random.h>
28#include <asm/byteorder.h>
29
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
44
45#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
46#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
47#define IEEE802154_FC_TYPE_ACK 0x2 /* Frame is acknowledgment */
48#define IEEE802154_FC_TYPE_MAC_CMD 0x3 /* Frame is MAC command */
49
50#define IEEE802154_FC_TYPE_SHIFT 0
51#define IEEE802154_FC_TYPE_MASK ((1 << 3) - 1)
52#define IEEE802154_FC_TYPE(x) ((x & IEEE802154_FC_TYPE_MASK) >> IEEE802154_FC_TYPE_SHIFT)
53#define IEEE802154_FC_SET_TYPE(v, x) do { \
54 v = (((v) & ~IEEE802154_FC_TYPE_MASK) | \
55 (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \
56 } while (0)
57
58#define IEEE802154_FC_SECEN_SHIFT 3
59#define IEEE802154_FC_SECEN (1 << IEEE802154_FC_SECEN_SHIFT)
60#define IEEE802154_FC_FRPEND_SHIFT 4
61#define IEEE802154_FC_FRPEND (1 << IEEE802154_FC_FRPEND_SHIFT)
62#define IEEE802154_FC_ACK_REQ_SHIFT 5
63#define IEEE802154_FC_ACK_REQ (1 << IEEE802154_FC_ACK_REQ_SHIFT)
64#define IEEE802154_FC_INTRA_PAN_SHIFT 6
65#define IEEE802154_FC_INTRA_PAN (1 << IEEE802154_FC_INTRA_PAN_SHIFT)
66
67#define IEEE802154_FC_SAMODE_SHIFT 14
68#define IEEE802154_FC_SAMODE_MASK (3 << IEEE802154_FC_SAMODE_SHIFT)
69#define IEEE802154_FC_DAMODE_SHIFT 10
70#define IEEE802154_FC_DAMODE_MASK (3 << IEEE802154_FC_DAMODE_SHIFT)
71
72#define IEEE802154_FC_VERSION_SHIFT 12
73#define IEEE802154_FC_VERSION_MASK (3 << IEEE802154_FC_VERSION_SHIFT)
74#define IEEE802154_FC_VERSION(x) ((x & IEEE802154_FC_VERSION_MASK) >> IEEE802154_FC_VERSION_SHIFT)
75
76#define IEEE802154_FC_SAMODE(x) \
77 (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT)
78
79#define IEEE802154_FC_DAMODE(x) \
80 (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT)
81
82#define IEEE802154_SCF_SECLEVEL_MASK 7
83#define IEEE802154_SCF_SECLEVEL_SHIFT 0
84#define IEEE802154_SCF_SECLEVEL(x) (x & IEEE802154_SCF_SECLEVEL_MASK)
85#define IEEE802154_SCF_KEY_ID_MODE_SHIFT 3
86#define IEEE802154_SCF_KEY_ID_MODE_MASK (3 << IEEE802154_SCF_KEY_ID_MODE_SHIFT)
87#define IEEE802154_SCF_KEY_ID_MODE(x) \
88 ((x & IEEE802154_SCF_KEY_ID_MODE_MASK) >> IEEE802154_SCF_KEY_ID_MODE_SHIFT)
89
90#define IEEE802154_SCF_KEY_IMPLICIT 0
91#define IEEE802154_SCF_KEY_INDEX 1
92#define IEEE802154_SCF_KEY_SHORT_INDEX 2
93#define IEEE802154_SCF_KEY_HW_INDEX 3
94
95#define IEEE802154_SCF_SECLEVEL_NONE 0
96#define IEEE802154_SCF_SECLEVEL_MIC32 1
97#define IEEE802154_SCF_SECLEVEL_MIC64 2
98#define IEEE802154_SCF_SECLEVEL_MIC128 3
99#define IEEE802154_SCF_SECLEVEL_ENC 4
100#define IEEE802154_SCF_SECLEVEL_ENC_MIC32 5
101#define IEEE802154_SCF_SECLEVEL_ENC_MIC64 6
102#define IEEE802154_SCF_SECLEVEL_ENC_MIC128 7
103
104/* MAC footer size */
105#define IEEE802154_MFR_SIZE 2 /* 2 octets */
106
107/* MAC's Command Frames Identifiers */
108#define IEEE802154_CMD_ASSOCIATION_REQ 0x01
109#define IEEE802154_CMD_ASSOCIATION_RESP 0x02
110#define IEEE802154_CMD_DISASSOCIATION_NOTIFY 0x03
111#define IEEE802154_CMD_DATA_REQ 0x04
112#define IEEE802154_CMD_PANID_CONFLICT_NOTIFY 0x05
113#define IEEE802154_CMD_ORPHAN_NOTIFY 0x06
114#define IEEE802154_CMD_BEACON_REQ 0x07
115#define IEEE802154_CMD_COORD_REALIGN_NOTIFY 0x08
116#define IEEE802154_CMD_GTS_REQ 0x09
117
118/*
119 * The return values of MAC operations
120 */
121enum {
122 /*
123 * The requested operation was completed successfully.
124 * For a transmission request, this value indicates
125 * a successful transmission.
126 */
127 IEEE802154_SUCCESS = 0x0,
128
129 /* The beacon was lost following a synchronization request. */
130 IEEE802154_BEACON_LOSS = 0xe0,
131 /*
132 * A transmission could not take place due to activity on the
133 * channel, i.e., the CSMA-CA mechanism has failed.
134 */
135 IEEE802154_CHNL_ACCESS_FAIL = 0xe1,
136 /* The GTS request has been denied by the PAN coordinator. */
137 IEEE802154_DENINED = 0xe2,
138 /* The attempt to disable the transceiver has failed. */
139 IEEE802154_DISABLE_TRX_FAIL = 0xe3,
140 /*
141 * The received frame induces a failed security check according to
142 * the security suite.
143 */
144 IEEE802154_FAILED_SECURITY_CHECK = 0xe4,
145 /*
146 * The frame resulting from secure processing has a length that is
147 * greater than aMACMaxFrameSize.
148 */
149 IEEE802154_FRAME_TOO_LONG = 0xe5,
150 /*
151 * The requested GTS transmission failed because the specified GTS
152 * either did not have a transmit GTS direction or was not defined.
153 */
154 IEEE802154_INVALID_GTS = 0xe6,
155 /*
156 * A request to purge an MSDU from the transaction queue was made using
157 * an MSDU handle that was not found in the transaction table.
158 */
159 IEEE802154_INVALID_HANDLE = 0xe7,
160 /* A parameter in the primitive is out of the valid range.*/
161 IEEE802154_INVALID_PARAMETER = 0xe8,
162 /* No acknowledgment was received after aMaxFrameRetries. */
163 IEEE802154_NO_ACK = 0xe9,
164 /* A scan operation failed to find any network beacons.*/
165 IEEE802154_NO_BEACON = 0xea,
166 /* No response data were available following a request. */
167 IEEE802154_NO_DATA = 0xeb,
168 /* The operation failed because a short address was not allocated. */
169 IEEE802154_NO_SHORT_ADDRESS = 0xec,
170 /*
171 * A receiver enable request was unsuccessful because it could not be
172 * completed within the CAP.
173 */
174 IEEE802154_OUT_OF_CAP = 0xed,
175 /*
176 * A PAN identifier conflict has been detected and communicated to the
177 * PAN coordinator.
178 */
179 IEEE802154_PANID_CONFLICT = 0xee,
180 /* A coordinator realignment command has been received. */
181 IEEE802154_REALIGMENT = 0xef,
182 /* The transaction has expired and its information discarded. */
183 IEEE802154_TRANSACTION_EXPIRED = 0xf0,
184 /* There is no capacity to store the transaction. */
185 IEEE802154_TRANSACTION_OVERFLOW = 0xf1,
186 /*
187 * The transceiver was in the transmitter enabled state when the
188 * receiver was requested to be enabled.
189 */
190 IEEE802154_TX_ACTIVE = 0xf2,
191 /* The appropriate key is not available in the ACL. */
192 IEEE802154_UNAVAILABLE_KEY = 0xf3,
193 /*
194 * A SET/GET request was issued with the identifier of a PIB attribute
195 * that is not supported.
196 */
197 IEEE802154_UNSUPPORTED_ATTR = 0xf4,
198 /*
199 * A request to perform a scan operation failed because the MLME was
200 * in the process of performing a previously initiated scan operation.
201 */
202 IEEE802154_SCAN_IN_PROGRESS = 0xfc,
203};
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}
228
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);
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}
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__ */