aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-15 12:00:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-15 12:00:47 -0400
commit6c373ca89399c5a3f7ef210ad8f63dc3437da345 (patch)
tree74d1ec65087df1da1021b43ac51acc1ee8601809 /include/linux
parentbb0fd7ab0986105765d11baa82e619c618a235aa (diff)
parent9f9151412dd7aae0e3f51a89ae4a1f8755fdb4d0 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: 1) Add BQL support to via-rhine, from Tino Reichardt. 2) Integrate SWITCHDEV layer support into the DSA layer, so DSA drivers can support hw switch offloading. From Floria Fainelli. 3) Allow 'ip address' commands to initiate multicast group join/leave, from Madhu Challa. 4) Many ipv4 FIB lookup optimizations from Alexander Duyck. 5) Support EBPF in cls_bpf classifier and act_bpf action, from Daniel Borkmann. 6) Remove the ugly compat support in ARP for ugly layers like ax25, rose, etc. And use this to clean up the neigh layer, then use it to implement MPLS support. All from Eric Biederman. 7) Support L3 forwarding offloading in switches, from Scott Feldman. 8) Collapse the LOCAL and MAIN ipv4 FIB tables when possible, to speed up route lookups even further. From Alexander Duyck. 9) Many improvements and bug fixes to the rhashtable implementation, from Herbert Xu and Thomas Graf. In particular, in the case where an rhashtable user bulk adds a large number of items into an empty table, we expand the table much more sanely. 10) Don't make the tcp_metrics hash table per-namespace, from Eric Biederman. 11) Extend EBPF to access SKB fields, from Alexei Starovoitov. 12) Split out new connection request sockets so that they can be established in the main hash table. Much less false sharing since hash lookups go direct to the request sockets instead of having to go first to the listener then to the request socks hashed underneath. From Eric Dumazet. 13) Add async I/O support for crytpo AF_ALG sockets, from Tadeusz Struk. 14) Support stable privacy address generation for RFC7217 in IPV6. From Hannes Frederic Sowa. 15) Hash network namespace into IP frag IDs, also from Hannes Frederic Sowa. 16) Convert PTP get/set methods to use 64-bit time, from Richard Cochran. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1816 commits) fm10k: Bump driver version to 0.15.2 fm10k: corrected VF multicast update fm10k: mbx_update_max_size does not drop all oversized messages fm10k: reset head instead of calling update_max_size fm10k: renamed mbx_tx_dropped to mbx_tx_oversized fm10k: update xcast mode before synchronizing multicast addresses fm10k: start service timer on probe fm10k: fix function header comment fm10k: comment next_vf_mbx flow fm10k: don't handle mailbox events in iov_event path and always process mailbox fm10k: use separate workqueue for fm10k driver fm10k: Set PF queues to unlimited bandwidth during virtualization fm10k: expose tx_timeout_count as an ethtool stat fm10k: only increment tx_timeout_count in Tx hang path fm10k: remove extraneous "Reset interface" message fm10k: separate PF only stats so that VF does not display them fm10k: use hw->mac.max_queues for stats fm10k: only show actual queues, not the maximum in hardware fm10k: allow creation of VLAN on default vid fm10k: fix unused warnings ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bcma/bcma.h21
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h11
-rw-r--r--include/linux/bcma/bcma_driver_gmac_cmn.h6
-rw-r--r--include/linux/bcma/bcma_driver_mips.h15
-rw-r--r--include/linux/bcma/bcma_driver_pci.h12
-rw-r--r--include/linux/bcma/bcma_driver_pcie2.h4
-rw-r--r--include/linux/bpf.h47
-rw-r--r--include/linux/brcmphy.h2
-rw-r--r--include/linux/can/dev.h2
-rw-r--r--include/linux/can/led.h6
-rw-r--r--include/linux/can/skb.h7
-rw-r--r--include/linux/dccp.h4
-rw-r--r--include/linux/etherdevice.h1
-rw-r--r--include/linux/filter.h7
-rw-r--r--include/linux/ieee802154.h14
-rw-r--r--include/linux/if_bridge.h1
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_pppox.h2
-rw-r--r--include/linux/if_vlan.h67
-rw-r--r--include/linux/inet_diag.h43
-rw-r--r--include/linux/ipv6.h4
-rw-r--r--include/linux/jhash.h17
-rw-r--r--include/linux/mlx4/cmd.h26
-rw-r--r--include/linux/mlx4/device.h40
-rw-r--r--include/linux/mlx4/qp.h18
-rw-r--r--include/linux/mlx5/cmd.h2
-rw-r--r--include/linux/mlx5/cq.h7
-rw-r--r--include/linux/mlx5/device.h2
-rw-r--r--include/linux/mlx5/doorbell.h2
-rw-r--r--include/linux/mlx5/driver.h16
-rw-r--r--include/linux/mlx5/mlx5_ifc.h2
-rw-r--r--include/linux/mlx5/qp.h2
-rw-r--r--include/linux/mlx5/srq.h2
-rw-r--r--include/linux/mmc/sdio_ids.h2
-rw-r--r--include/linux/net.h12
-rw-r--r--include/linux/netdevice.h140
-rw-r--r--include/linux/netfilter.h103
-rw-r--r--include/linux/netfilter/ipset/ip_set.h5
-rw-r--r--include/linux/netfilter_arp/arp_tables.h3
-rw-r--r--include/linux/netfilter_bridge.h100
-rw-r--r--include/linux/netfilter_bridge/ebtables.h3
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h3
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h3
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/of_mdio.h7
-rw-r--r--include/linux/of_net.h8
-rw-r--r--include/linux/phy_fixed.h9
-rw-r--r--include/linux/platform_data/nxp-nci.h27
-rw-r--r--include/linux/ptp_clock_kernel.h12
-rw-r--r--include/linux/rhashtable.h527
-rw-r--r--include/linux/rtnetlink.h15
-rw-r--r--include/linux/security.h8
-rw-r--r--include/linux/skbuff.h13
-rw-r--r--include/linux/sock_diag.h4
-rw-r--r--include/linux/socket.h8
-rw-r--r--include/linux/spi/at86rf230.h1
-rw-r--r--include/linux/spi/cc2520.h1
-rw-r--r--include/linux/tcp.h5
-rw-r--r--include/linux/udp.h2
59 files changed, 1046 insertions, 390 deletions
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 994739da827f..e34f906647d3 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -434,6 +434,27 @@ static inline struct bcma_device *bcma_find_core(struct bcma_bus *bus,
434 return bcma_find_core_unit(bus, coreid, 0); 434 return bcma_find_core_unit(bus, coreid, 0);
435} 435}
436 436
437#ifdef CONFIG_BCMA_HOST_PCI
438extern void bcma_host_pci_up(struct bcma_bus *bus);
439extern void bcma_host_pci_down(struct bcma_bus *bus);
440extern int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
441 struct bcma_device *core, bool enable);
442#else
443static inline void bcma_host_pci_up(struct bcma_bus *bus)
444{
445}
446static inline void bcma_host_pci_down(struct bcma_bus *bus)
447{
448}
449static inline int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
450 struct bcma_device *core, bool enable)
451{
452 if (bus->hosttype == BCMA_HOSTTYPE_PCI)
453 return -ENOTSUPP;
454 return 0;
455}
456#endif
457
437extern bool bcma_core_is_enabled(struct bcma_device *core); 458extern bool bcma_core_is_enabled(struct bcma_device *core);
438extern void bcma_core_disable(struct bcma_device *core, u32 flags); 459extern void bcma_core_disable(struct bcma_device *core, u32 flags);
439extern int bcma_core_enable(struct bcma_device *core, u32 flags); 460extern int bcma_core_enable(struct bcma_device *core, u32 flags);
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index db6fa217f98b..6cceedf65ca2 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -663,14 +663,6 @@ struct bcma_drv_cc_b {
663#define bcma_cc_maskset32(cc, offset, mask, set) \ 663#define bcma_cc_maskset32(cc, offset, mask, set) \
664 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) 664 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
665 665
666extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
667extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
668
669extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
670extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
671
672void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
673
674extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); 666extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
675 667
676extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc); 668extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc);
@@ -690,9 +682,6 @@ u32 bcma_chipco_gpio_pullup(struct bcma_drv_cc *cc, u32 mask, u32 value);
690u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value); 682u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value);
691 683
692/* PMU support */ 684/* PMU support */
693extern void bcma_pmu_init(struct bcma_drv_cc *cc);
694extern void bcma_pmu_early_init(struct bcma_drv_cc *cc);
695
696extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, 685extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset,
697 u32 value); 686 u32 value);
698extern void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, 687extern void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset,
diff --git a/include/linux/bcma/bcma_driver_gmac_cmn.h b/include/linux/bcma/bcma_driver_gmac_cmn.h
index 4dd1f33e36a2..4354d4ea6713 100644
--- a/include/linux/bcma/bcma_driver_gmac_cmn.h
+++ b/include/linux/bcma/bcma_driver_gmac_cmn.h
@@ -91,10 +91,4 @@ struct bcma_drv_gmac_cmn {
91#define gmac_cmn_write16(gc, offset, val) bcma_write16((gc)->core, offset, val) 91#define gmac_cmn_write16(gc, offset, val) bcma_write16((gc)->core, offset, val)
92#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val) 92#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val)
93 93
94#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
95extern void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
96#else
97static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { }
98#endif
99
100#endif /* LINUX_BCMA_DRIVER_GMAC_CMN_H_ */ 94#endif /* LINUX_BCMA_DRIVER_GMAC_CMN_H_ */
diff --git a/include/linux/bcma/bcma_driver_mips.h b/include/linux/bcma/bcma_driver_mips.h
index 0b3b32aeeb8a..8eea7f9e33b4 100644
--- a/include/linux/bcma/bcma_driver_mips.h
+++ b/include/linux/bcma/bcma_driver_mips.h
@@ -39,21 +39,6 @@ struct bcma_drv_mips {
39 u8 early_setup_done:1; 39 u8 early_setup_done:1;
40}; 40};
41 41
42#ifdef CONFIG_BCMA_DRIVER_MIPS
43extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
45
46extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
47#else
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) { }
50
51static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
52{
53 return 0;
54}
55#endif
56
57extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore); 42extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
58 43
59#endif /* LINUX_BCMA_DRIVER_MIPS_H_ */ 44#endif /* LINUX_BCMA_DRIVER_MIPS_H_ */
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 3f809ae372c4..5ba6918ca20b 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -238,13 +238,13 @@ struct bcma_drv_pci {
238#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) 238#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
239#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 239#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
240 240
241extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc); 241#ifdef CONFIG_BCMA_DRIVER_PCI
242extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
243extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
244 struct bcma_device *core, bool enable);
245extern void bcma_core_pci_up(struct bcma_bus *bus);
246extern void bcma_core_pci_down(struct bcma_bus *bus);
247extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up); 242extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
243#else
244static inline void bcma_core_pci_power_save(struct bcma_bus *bus, bool up)
245{
246}
247#endif
248 248
249extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); 249extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
250extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); 250extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
diff --git a/include/linux/bcma/bcma_driver_pcie2.h b/include/linux/bcma/bcma_driver_pcie2.h
index 5988b05781c3..31e6d17ab798 100644
--- a/include/linux/bcma/bcma_driver_pcie2.h
+++ b/include/linux/bcma/bcma_driver_pcie2.h
@@ -143,6 +143,8 @@
143 143
144struct bcma_drv_pcie2 { 144struct bcma_drv_pcie2 {
145 struct bcma_device *core; 145 struct bcma_device *core;
146
147 u16 reqsize;
146}; 148};
147 149
148#define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset) 150#define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset)
@@ -153,6 +155,4 @@ struct bcma_drv_pcie2 {
153#define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set) 155#define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set)
154#define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask) 156#define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask)
155 157
156void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
157
158#endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */ 158#endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index c2e21113ecc0..d5cda067115a 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -32,23 +32,19 @@ struct bpf_map {
32 u32 key_size; 32 u32 key_size;
33 u32 value_size; 33 u32 value_size;
34 u32 max_entries; 34 u32 max_entries;
35 struct bpf_map_ops *ops; 35 const struct bpf_map_ops *ops;
36 struct work_struct work; 36 struct work_struct work;
37}; 37};
38 38
39struct bpf_map_type_list { 39struct bpf_map_type_list {
40 struct list_head list_node; 40 struct list_head list_node;
41 struct bpf_map_ops *ops; 41 const struct bpf_map_ops *ops;
42 enum bpf_map_type type; 42 enum bpf_map_type type;
43}; 43};
44 44
45void bpf_register_map_type(struct bpf_map_type_list *tl);
46void bpf_map_put(struct bpf_map *map);
47struct bpf_map *bpf_map_get(struct fd f);
48
49/* function argument constraints */ 45/* function argument constraints */
50enum bpf_arg_type { 46enum bpf_arg_type {
51 ARG_ANYTHING = 0, /* any argument is ok */ 47 ARG_DONTCARE = 0, /* unused argument in helper function */
52 48
53 /* the following constraints used to prototype 49 /* the following constraints used to prototype
54 * bpf_map_lookup/update/delete_elem() functions 50 * bpf_map_lookup/update/delete_elem() functions
@@ -62,6 +58,9 @@ enum bpf_arg_type {
62 */ 58 */
63 ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */ 59 ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */
64 ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */ 60 ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */
61
62 ARG_PTR_TO_CTX, /* pointer to context */
63 ARG_ANYTHING, /* any (initialized) argument is ok */
65}; 64};
66 65
67/* type of values returned from helper functions */ 66/* type of values returned from helper functions */
@@ -105,11 +104,14 @@ struct bpf_verifier_ops {
105 * with 'type' (read or write) is allowed 104 * with 'type' (read or write) is allowed
106 */ 105 */
107 bool (*is_valid_access)(int off, int size, enum bpf_access_type type); 106 bool (*is_valid_access)(int off, int size, enum bpf_access_type type);
107
108 u32 (*convert_ctx_access)(int dst_reg, int src_reg, int ctx_off,
109 struct bpf_insn *insn);
108}; 110};
109 111
110struct bpf_prog_type_list { 112struct bpf_prog_type_list {
111 struct list_head list_node; 113 struct list_head list_node;
112 struct bpf_verifier_ops *ops; 114 const struct bpf_verifier_ops *ops;
113 enum bpf_prog_type type; 115 enum bpf_prog_type type;
114}; 116};
115 117
@@ -117,20 +119,25 @@ struct bpf_prog;
117 119
118struct bpf_prog_aux { 120struct bpf_prog_aux {
119 atomic_t refcnt; 121 atomic_t refcnt;
120 bool is_gpl_compatible;
121 enum bpf_prog_type prog_type;
122 struct bpf_verifier_ops *ops;
123 struct bpf_map **used_maps;
124 u32 used_map_cnt; 122 u32 used_map_cnt;
123 const struct bpf_verifier_ops *ops;
124 struct bpf_map **used_maps;
125 struct bpf_prog *prog; 125 struct bpf_prog *prog;
126 struct work_struct work; 126 struct work_struct work;
127}; 127};
128 128
129#ifdef CONFIG_BPF_SYSCALL 129#ifdef CONFIG_BPF_SYSCALL
130void bpf_register_prog_type(struct bpf_prog_type_list *tl); 130void bpf_register_prog_type(struct bpf_prog_type_list *tl);
131void bpf_register_map_type(struct bpf_map_type_list *tl);
131 132
132void bpf_prog_put(struct bpf_prog *prog);
133struct bpf_prog *bpf_prog_get(u32 ufd); 133struct bpf_prog *bpf_prog_get(u32 ufd);
134void bpf_prog_put(struct bpf_prog *prog);
135
136struct bpf_map *bpf_map_get(struct fd f);
137void bpf_map_put(struct bpf_map *map);
138
139/* verify correctness of eBPF program */
140int bpf_check(struct bpf_prog **fp, union bpf_attr *attr);
134#else 141#else
135static inline void bpf_register_prog_type(struct bpf_prog_type_list *tl) 142static inline void bpf_register_prog_type(struct bpf_prog_type_list *tl)
136{ 143{
@@ -144,14 +151,14 @@ static inline struct bpf_prog *bpf_prog_get(u32 ufd)
144static inline void bpf_prog_put(struct bpf_prog *prog) 151static inline void bpf_prog_put(struct bpf_prog *prog)
145{ 152{
146} 153}
147#endif 154#endif /* CONFIG_BPF_SYSCALL */
148
149/* verify correctness of eBPF program */
150int bpf_check(struct bpf_prog *fp, union bpf_attr *attr);
151 155
152/* verifier prototypes for helper functions called from eBPF programs */ 156/* verifier prototypes for helper functions called from eBPF programs */
153extern struct bpf_func_proto bpf_map_lookup_elem_proto; 157extern const struct bpf_func_proto bpf_map_lookup_elem_proto;
154extern struct bpf_func_proto bpf_map_update_elem_proto; 158extern const struct bpf_func_proto bpf_map_update_elem_proto;
155extern struct bpf_func_proto bpf_map_delete_elem_proto; 159extern const struct bpf_func_proto bpf_map_delete_elem_proto;
160
161extern const struct bpf_func_proto bpf_get_prandom_u32_proto;
162extern const struct bpf_func_proto bpf_get_smp_processor_id_proto;
156 163
157#endif /* _LINUX_BPF_H */ 164#endif /* _LINUX_BPF_H */
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 7ccd928cc1f2..ae2982c0f7a6 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -11,6 +11,7 @@
11#define PHY_ID_BCM5421 0x002060e0 11#define PHY_ID_BCM5421 0x002060e0
12#define PHY_ID_BCM5464 0x002060b0 12#define PHY_ID_BCM5464 0x002060b0
13#define PHY_ID_BCM5461 0x002060c0 13#define PHY_ID_BCM5461 0x002060c0
14#define PHY_ID_BCM54616S 0x03625d10
14#define PHY_ID_BCM57780 0x03625d90 15#define PHY_ID_BCM57780 0x03625d90
15 16
16#define PHY_ID_BCM7250 0xae025280 17#define PHY_ID_BCM7250 0xae025280
@@ -19,6 +20,7 @@
19#define PHY_ID_BCM7425 0x03625e60 20#define PHY_ID_BCM7425 0x03625e60
20#define PHY_ID_BCM7429 0x600d8730 21#define PHY_ID_BCM7429 0x600d8730
21#define PHY_ID_BCM7439 0x600d8480 22#define PHY_ID_BCM7439 0x600d8480
23#define PHY_ID_BCM7439_2 0xae025080
22#define PHY_ID_BCM7445 0x600d8510 24#define PHY_ID_BCM7445 0x600d8510
23 25
24#define PHY_BCM_OUI_MASK 0xfffffc00 26#define PHY_BCM_OUI_MASK 0xfffffc00
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index c05ff0f9f9a5..c3a9c8fc60fa 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -61,6 +61,8 @@ struct can_priv {
61 char tx_led_trig_name[CAN_LED_NAME_SZ]; 61 char tx_led_trig_name[CAN_LED_NAME_SZ];
62 struct led_trigger *rx_led_trig; 62 struct led_trigger *rx_led_trig;
63 char rx_led_trig_name[CAN_LED_NAME_SZ]; 63 char rx_led_trig_name[CAN_LED_NAME_SZ];
64 struct led_trigger *rxtx_led_trig;
65 char rxtx_led_trig_name[CAN_LED_NAME_SZ];
64#endif 66#endif
65}; 67};
66 68
diff --git a/include/linux/can/led.h b/include/linux/can/led.h
index e0475c5cbb92..146de4506d21 100644
--- a/include/linux/can/led.h
+++ b/include/linux/can/led.h
@@ -21,8 +21,10 @@ enum can_led_event {
21 21
22#ifdef CONFIG_CAN_LEDS 22#ifdef CONFIG_CAN_LEDS
23 23
24/* keep space for interface name + "-tx"/"-rx" suffix and null terminator */ 24/* keep space for interface name + "-tx"/"-rx"/"-rxtx"
25#define CAN_LED_NAME_SZ (IFNAMSIZ + 4) 25 * suffix and null terminator
26 */
27#define CAN_LED_NAME_SZ (IFNAMSIZ + 6)
26 28
27void can_led_event(struct net_device *netdev, enum can_led_event event); 29void can_led_event(struct net_device *netdev, enum can_led_event event);
28void devm_can_led_init(struct net_device *netdev); 30void devm_can_led_init(struct net_device *netdev);
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
index cc00d15c6107..b6a52a4b457a 100644
--- a/include/linux/can/skb.h
+++ b/include/linux/can/skb.h
@@ -44,16 +44,11 @@ static inline void can_skb_reserve(struct sk_buff *skb)
44 skb_reserve(skb, sizeof(struct can_skb_priv)); 44 skb_reserve(skb, sizeof(struct can_skb_priv));
45} 45}
46 46
47static inline void can_skb_destructor(struct sk_buff *skb)
48{
49 sock_put(skb->sk);
50}
51
52static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk) 47static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk)
53{ 48{
54 if (sk) { 49 if (sk) {
55 sock_hold(sk); 50 sock_hold(sk);
56 skb->destructor = can_skb_destructor; 51 skb->destructor = sock_efree;
57 skb->sk = sk; 52 skb->sk = sk;
58 } 53 }
59} 54}
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 439ff698000a..221025423e6c 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -43,6 +43,7 @@ enum dccp_state {
43 DCCP_CLOSING = TCP_CLOSING, 43 DCCP_CLOSING = TCP_CLOSING,
44 DCCP_TIME_WAIT = TCP_TIME_WAIT, 44 DCCP_TIME_WAIT = TCP_TIME_WAIT,
45 DCCP_CLOSED = TCP_CLOSE, 45 DCCP_CLOSED = TCP_CLOSE,
46 DCCP_NEW_SYN_RECV = TCP_NEW_SYN_RECV,
46 DCCP_PARTOPEN = TCP_MAX_STATES, 47 DCCP_PARTOPEN = TCP_MAX_STATES,
47 DCCP_PASSIVE_CLOSEREQ, /* clients receiving CloseReq */ 48 DCCP_PASSIVE_CLOSEREQ, /* clients receiving CloseReq */
48 DCCP_MAX_STATES 49 DCCP_MAX_STATES
@@ -57,6 +58,7 @@ enum {
57 DCCPF_CLOSING = TCPF_CLOSING, 58 DCCPF_CLOSING = TCPF_CLOSING,
58 DCCPF_TIME_WAIT = TCPF_TIME_WAIT, 59 DCCPF_TIME_WAIT = TCPF_TIME_WAIT,
59 DCCPF_CLOSED = TCPF_CLOSE, 60 DCCPF_CLOSED = TCPF_CLOSE,
61 DCCPF_NEW_SYN_RECV = TCPF_NEW_SYN_RECV,
60 DCCPF_PARTOPEN = (1 << DCCP_PARTOPEN), 62 DCCPF_PARTOPEN = (1 << DCCP_PARTOPEN),
61}; 63};
62 64
@@ -317,6 +319,6 @@ static inline const char *dccp_role(const struct sock *sk)
317 return NULL; 319 return NULL;
318} 320}
319 321
320extern void dccp_syn_ack_timeout(struct sock *sk, struct request_sock *req); 322extern void dccp_syn_ack_timeout(const struct request_sock *req);
321 323
322#endif /* _LINUX_DCCP_H */ 324#endif /* _LINUX_DCCP_H */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 1d869d185a0d..606563ef8a72 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -35,7 +35,6 @@ extern const struct header_ops eth_header_ops;
35 35
36int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 36int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
37 const void *daddr, const void *saddr, unsigned len); 37 const void *daddr, const void *saddr, unsigned len);
38int eth_rebuild_header(struct sk_buff *skb);
39int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 38int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
40int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, 39int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh,
41 __be16 type); 40 __be16 type);
diff --git a/include/linux/filter.h b/include/linux/filter.h
index caac2087a4d5..fa11b3a367be 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -145,8 +145,6 @@ struct bpf_prog_aux;
145 .off = 0, \ 145 .off = 0, \
146 .imm = ((__u64) (IMM)) >> 32 }) 146 .imm = ((__u64) (IMM)) >> 32 })
147 147
148#define BPF_PSEUDO_MAP_FD 1
149
150/* pseudo BPF_LD_IMM64 insn used to refer to process-local map_fd */ 148/* pseudo BPF_LD_IMM64 insn used to refer to process-local map_fd */
151#define BPF_LD_MAP_FD(DST, MAP_FD) \ 149#define BPF_LD_MAP_FD(DST, MAP_FD) \
152 BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD) 150 BPF_LD_IMM64_RAW(DST, BPF_PSEUDO_MAP_FD, MAP_FD)
@@ -310,9 +308,11 @@ struct bpf_binary_header {
310struct bpf_prog { 308struct bpf_prog {
311 u16 pages; /* Number of allocated pages */ 309 u16 pages; /* Number of allocated pages */
312 bool jited; /* Is our filter JIT'ed? */ 310 bool jited; /* Is our filter JIT'ed? */
311 bool gpl_compatible; /* Is our filter GPL compatible? */
313 u32 len; /* Number of filter blocks */ 312 u32 len; /* Number of filter blocks */
314 struct sock_fprog_kern *orig_prog; /* Original BPF program */ 313 enum bpf_prog_type type; /* Type of BPF program */
315 struct bpf_prog_aux *aux; /* Auxiliary fields */ 314 struct bpf_prog_aux *aux; /* Auxiliary fields */
315 struct sock_fprog_kern *orig_prog; /* Original BPF program */
316 unsigned int (*bpf_func)(const struct sk_buff *skb, 316 unsigned int (*bpf_func)(const struct sk_buff *skb,
317 const struct bpf_insn *filter); 317 const struct bpf_insn *filter);
318 /* Instructions for interpreter */ 318 /* Instructions for interpreter */
@@ -454,6 +454,7 @@ static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
454 BPF_ANCILLARY(VLAN_TAG_PRESENT); 454 BPF_ANCILLARY(VLAN_TAG_PRESENT);
455 BPF_ANCILLARY(PAY_OFFSET); 455 BPF_ANCILLARY(PAY_OFFSET);
456 BPF_ANCILLARY(RANDOM); 456 BPF_ANCILLARY(RANDOM);
457 BPF_ANCILLARY(VLAN_TPID);
457 } 458 }
458 /* Fallthrough. */ 459 /* Fallthrough. */
459 default: 460 default:
diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h
index 6e82d888287c..8872ca103d06 100644
--- a/include/linux/ieee802154.h
+++ b/include/linux/ieee802154.h
@@ -28,7 +28,9 @@
28#include <asm/byteorder.h> 28#include <asm/byteorder.h>
29 29
30#define IEEE802154_MTU 127 30#define IEEE802154_MTU 127
31#define IEEE802154_MIN_PSDU_LEN 5 31#define IEEE802154_ACK_PSDU_LEN 5
32#define IEEE802154_MIN_PSDU_LEN 9
33#define IEEE802154_FCS_LEN 2
32 34
33#define IEEE802154_PAN_ID_BROADCAST 0xffff 35#define IEEE802154_PAN_ID_BROADCAST 0xffff
34#define IEEE802154_ADDR_SHORT_BROADCAST 0xffff 36#define IEEE802154_ADDR_SHORT_BROADCAST 0xffff
@@ -38,6 +40,7 @@
38 40
39#define IEEE802154_LIFS_PERIOD 40 41#define IEEE802154_LIFS_PERIOD 40
40#define IEEE802154_SIFS_PERIOD 12 42#define IEEE802154_SIFS_PERIOD 12
43#define IEEE802154_MAX_SIFS_FRAME_SIZE 18
41 44
42#define IEEE802154_MAX_CHANNEL 26 45#define IEEE802154_MAX_CHANNEL 26
43#define IEEE802154_MAX_PAGE 31 46#define IEEE802154_MAX_PAGE 31
@@ -204,11 +207,18 @@ enum {
204 207
205/** 208/**
206 * ieee802154_is_valid_psdu_len - check if psdu len is valid 209 * ieee802154_is_valid_psdu_len - check if psdu len is valid
210 * available lengths:
211 * 0-4 Reserved
212 * 5 MPDU (Acknowledgment)
213 * 6-8 Reserved
214 * 9-127 MPDU
215 *
207 * @len: psdu len with (MHR + payload + MFR) 216 * @len: psdu len with (MHR + payload + MFR)
208 */ 217 */
209static inline bool ieee802154_is_valid_psdu_len(const u8 len) 218static inline bool ieee802154_is_valid_psdu_len(const u8 len)
210{ 219{
211 return (len >= IEEE802154_MIN_PSDU_LEN && len <= IEEE802154_MTU); 220 return (len == IEEE802154_ACK_PSDU_LEN ||
221 (len >= IEEE802154_MIN_PSDU_LEN && len <= IEEE802154_MTU));
212} 222}
213 223
214/** 224/**
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index a57bca2ea97e..dad8b00beed2 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -44,6 +44,7 @@ struct br_ip_list {
44#define BR_PROMISC BIT(7) 44#define BR_PROMISC BIT(7)
45#define BR_PROXYARP BIT(8) 45#define BR_PROXYARP BIT(8)
46#define BR_LEARNING_SYNC BIT(9) 46#define BR_LEARNING_SYNC BIT(9)
47#define BR_PROXYARP_WIFI BIT(10)
47 48
48extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 49extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
49 50
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 119130e9298b..da4929927f69 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -14,5 +14,6 @@ struct ifla_vf_info {
14 __u32 linkstate; 14 __u32 linkstate;
15 __u32 min_tx_rate; 15 __u32 min_tx_rate;
16 __u32 max_tx_rate; 16 __u32 max_tx_rate;
17 __u32 rss_query_en;
17}; 18};
18#endif /* _LINUX_IF_LINK_H */ 19#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index aff7ad8a4ea3..66a7d7600f43 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -19,6 +19,7 @@
19#include <linux/netdevice.h> 19#include <linux/netdevice.h>
20#include <linux/ppp_channel.h> 20#include <linux/ppp_channel.h>
21#include <linux/skbuff.h> 21#include <linux/skbuff.h>
22#include <linux/workqueue.h>
22#include <uapi/linux/if_pppox.h> 23#include <uapi/linux/if_pppox.h>
23 24
24static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb) 25static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
@@ -32,6 +33,7 @@ struct pppoe_opt {
32 struct pppoe_addr pa; /* what this socket is bound to*/ 33 struct pppoe_addr pa; /* what this socket is bound to*/
33 struct sockaddr_pppox relay; /* what socket data will be 34 struct sockaddr_pppox relay; /* what socket data will be
34 relayed to (PPPoE relaying) */ 35 relayed to (PPPoE relaying) */
36 struct work_struct padt_work;/* Work item for handling PADT */
35}; 37};
36 38
37struct pptp_opt { 39struct pptp_opt {
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index b11b28a30b9e..920e4457ce6e 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -561,4 +561,71 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
561 skb->protocol = htons(ETH_P_802_2); 561 skb->protocol = htons(ETH_P_802_2);
562} 562}
563 563
564/**
565 * skb_vlan_tagged - check if skb is vlan tagged.
566 * @skb: skbuff to query
567 *
568 * Returns true if the skb is tagged, regardless of whether it is hardware
569 * accelerated or not.
570 */
571static inline bool skb_vlan_tagged(const struct sk_buff *skb)
572{
573 if (!skb_vlan_tag_present(skb) &&
574 likely(skb->protocol != htons(ETH_P_8021Q) &&
575 skb->protocol != htons(ETH_P_8021AD)))
576 return false;
577
578 return true;
579}
580
581/**
582 * skb_vlan_tagged_multi - check if skb is vlan tagged with multiple headers.
583 * @skb: skbuff to query
584 *
585 * Returns true if the skb is tagged with multiple vlan headers, regardless
586 * of whether it is hardware accelerated or not.
587 */
588static inline bool skb_vlan_tagged_multi(const struct sk_buff *skb)
589{
590 __be16 protocol = skb->protocol;
591
592 if (!skb_vlan_tag_present(skb)) {
593 struct vlan_ethhdr *veh;
594
595 if (likely(protocol != htons(ETH_P_8021Q) &&
596 protocol != htons(ETH_P_8021AD)))
597 return false;
598
599 veh = (struct vlan_ethhdr *)skb->data;
600 protocol = veh->h_vlan_encapsulated_proto;
601 }
602
603 if (protocol != htons(ETH_P_8021Q) && protocol != htons(ETH_P_8021AD))
604 return false;
605
606 return true;
607}
608
609/**
610 * vlan_features_check - drop unsafe features for skb with multiple tags.
611 * @skb: skbuff to query
612 * @features: features to be checked
613 *
614 * Returns features without unsafe ones if the skb has multiple tags.
615 */
616static inline netdev_features_t vlan_features_check(const struct sk_buff *skb,
617 netdev_features_t features)
618{
619 if (skb_vlan_tagged_multi(skb))
620 features = netdev_intersect_features(features,
621 NETIF_F_SG |
622 NETIF_F_HIGHDMA |
623 NETIF_F_FRAGLIST |
624 NETIF_F_GEN_CSUM |
625 NETIF_F_HW_VLAN_CTAG_TX |
626 NETIF_F_HW_VLAN_STAG_TX);
627
628 return features;
629}
630
564#endif /* !(_LINUX_IF_VLAN_H_) */ 631#endif /* !(_LINUX_IF_VLAN_H_) */
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index 46da02410a09..ac48b10c9395 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -11,33 +11,34 @@ struct sk_buff;
11struct netlink_callback; 11struct netlink_callback;
12 12
13struct inet_diag_handler { 13struct inet_diag_handler {
14 void (*dump)(struct sk_buff *skb, 14 void (*dump)(struct sk_buff *skb,
15 struct netlink_callback *cb, 15 struct netlink_callback *cb,
16 struct inet_diag_req_v2 *r, 16 const struct inet_diag_req_v2 *r,
17 struct nlattr *bc); 17 struct nlattr *bc);
18 18
19 int (*dump_one)(struct sk_buff *in_skb, 19 int (*dump_one)(struct sk_buff *in_skb,
20 const struct nlmsghdr *nlh, 20 const struct nlmsghdr *nlh,
21 struct inet_diag_req_v2 *req); 21 const struct inet_diag_req_v2 *req);
22 22
23 void (*idiag_get_info)(struct sock *sk, 23 void (*idiag_get_info)(struct sock *sk,
24 struct inet_diag_msg *r, 24 struct inet_diag_msg *r,
25 void *info); 25 void *info);
26 __u16 idiag_type; 26 __u16 idiag_type;
27}; 27};
28 28
29struct inet_connection_sock; 29struct inet_connection_sock;
30int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, 30int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
31 struct sk_buff *skb, struct inet_diag_req_v2 *req, 31 struct sk_buff *skb, const struct inet_diag_req_v2 *req,
32 struct user_namespace *user_ns, 32 struct user_namespace *user_ns,
33 u32 pid, u32 seq, u16 nlmsg_flags, 33 u32 pid, u32 seq, u16 nlmsg_flags,
34 const struct nlmsghdr *unlh); 34 const struct nlmsghdr *unlh);
35void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, 35void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
36 struct netlink_callback *cb, struct inet_diag_req_v2 *r, 36 struct netlink_callback *cb,
37 struct nlattr *bc); 37 const struct inet_diag_req_v2 *r,
38 struct nlattr *bc);
38int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, 39int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
39 struct sk_buff *in_skb, const struct nlmsghdr *nlh, 40 struct sk_buff *in_skb, const struct nlmsghdr *nlh,
40 struct inet_diag_req_v2 *req); 41 const struct inet_diag_req_v2 *req);
41 42
42int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); 43int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
43 44
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 4d5169f5d7d1..82806c60aa42 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -53,6 +53,10 @@ struct ipv6_devconf {
53 __s32 ndisc_notify; 53 __s32 ndisc_notify;
54 __s32 suppress_frag_ndisc; 54 __s32 suppress_frag_ndisc;
55 __s32 accept_ra_mtu; 55 __s32 accept_ra_mtu;
56 struct ipv6_stable_secret {
57 bool initialized;
58 struct in6_addr secret;
59 } stable_secret;
56 void *sysctl; 60 void *sysctl;
57}; 61};
58 62
diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index 47cb09edec1a..348c6f47e4cc 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -145,11 +145,11 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
145} 145}
146 146
147 147
148/* jhash_3words - hash exactly 3, 2 or 1 word(s) */ 148/* __jhash_nwords - hash exactly 3, 2 or 1 word(s) */
149static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) 149static inline u32 __jhash_nwords(u32 a, u32 b, u32 c, u32 initval)
150{ 150{
151 a += JHASH_INITVAL; 151 a += initval;
152 b += JHASH_INITVAL; 152 b += initval;
153 c += initval; 153 c += initval;
154 154
155 __jhash_final(a, b, c); 155 __jhash_final(a, b, c);
@@ -157,14 +157,19 @@ static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval)
157 return c; 157 return c;
158} 158}
159 159
160static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval)
161{
162 return __jhash_nwords(a, b, c, initval + JHASH_INITVAL + (3 << 2));
163}
164
160static inline u32 jhash_2words(u32 a, u32 b, u32 initval) 165static inline u32 jhash_2words(u32 a, u32 b, u32 initval)
161{ 166{
162 return jhash_3words(a, b, 0, initval); 167 return __jhash_nwords(a, b, 0, initval + JHASH_INITVAL + (2 << 2));
163} 168}
164 169
165static inline u32 jhash_1word(u32 a, u32 initval) 170static inline u32 jhash_1word(u32 a, u32 initval)
166{ 171{
167 return jhash_3words(a, 0, 0, initval); 172 return __jhash_nwords(a, 0, 0, initval + JHASH_INITVAL + (1 << 2));
168} 173}
169 174
170#endif /* _LINUX_JHASH_H */ 175#endif /* _LINUX_JHASH_H */
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 7b6d4e9ff603..f62e7cf227c6 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -68,6 +68,8 @@ enum {
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, 70 MLX4_CMD_ACCESS_REG = 0x3b,
71 MLX4_CMD_ALLOCATE_VPP = 0x80,
72 MLX4_CMD_SET_VPORT_QOS = 0x81,
71 73
72 /*master notify fw on finish for slave's flr*/ 74 /*master notify fw on finish for slave's flr*/
73 MLX4_CMD_INFORM_FLR_DONE = 0x5b, 75 MLX4_CMD_INFORM_FLR_DONE = 0x5b,
@@ -163,6 +165,9 @@ enum {
163 MLX4_QP_FLOW_STEERING_ATTACH = 0x65, 165 MLX4_QP_FLOW_STEERING_ATTACH = 0x65,
164 MLX4_QP_FLOW_STEERING_DETACH = 0x66, 166 MLX4_QP_FLOW_STEERING_DETACH = 0x66,
165 MLX4_FLOW_STEERING_IB_UC_QP_RANGE = 0x64, 167 MLX4_FLOW_STEERING_IB_UC_QP_RANGE = 0x64,
168
169 /* Update and read QCN parameters */
170 MLX4_CMD_CONGESTION_CTRL_OPCODE = 0x68,
166}; 171};
167 172
168enum { 173enum {
@@ -183,7 +188,14 @@ enum {
183}; 188};
184 189
185enum { 190enum {
186 /* set port opcode modifiers */ 191 /* Set port opcode modifiers */
192 MLX4_SET_PORT_IB_OPCODE = 0x0,
193 MLX4_SET_PORT_ETH_OPCODE = 0x1,
194 MLX4_SET_PORT_BEACON_OPCODE = 0x4,
195};
196
197enum {
198 /* Set port Ethernet input modifiers */
187 MLX4_SET_PORT_GENERAL = 0x0, 199 MLX4_SET_PORT_GENERAL = 0x0,
188 MLX4_SET_PORT_RQP_CALC = 0x1, 200 MLX4_SET_PORT_RQP_CALC = 0x1,
189 MLX4_SET_PORT_MAC_TABLE = 0x2, 201 MLX4_SET_PORT_MAC_TABLE = 0x2,
@@ -233,6 +245,16 @@ struct mlx4_config_dev_params {
233 u8 rx_csum_flags_port_2; 245 u8 rx_csum_flags_port_2;
234}; 246};
235 247
248enum mlx4_en_congestion_control_algorithm {
249 MLX4_CTRL_ALGO_802_1_QAU_REACTION_POINT = 0,
250};
251
252enum mlx4_en_congestion_control_opmod {
253 MLX4_CONGESTION_CONTROL_GET_PARAMS,
254 MLX4_CONGESTION_CONTROL_GET_STATISTICS,
255 MLX4_CONGESTION_CONTROL_SET_PARAMS = 4,
256};
257
236struct mlx4_dev; 258struct mlx4_dev;
237 259
238struct mlx4_cmd_mailbox { 260struct mlx4_cmd_mailbox {
@@ -281,6 +303,8 @@ void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbo
281u32 mlx4_comm_get_version(void); 303u32 mlx4_comm_get_version(void);
282int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac); 304int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac);
283int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos); 305int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
306int mlx4_set_vf_rate(struct mlx4_dev *dev, int port, int vf, int min_tx_rate,
307 int max_tx_rate);
284int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); 308int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
285int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); 309int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
286int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state); 310int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state);
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index e4ebff7e9d02..f9ce34bec45b 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -49,8 +49,6 @@
49#define MSIX_LEGACY_SZ 4 49#define MSIX_LEGACY_SZ 4
50#define MIN_MSIX_P_PORT 5 50#define MIN_MSIX_P_PORT 5
51 51
52#define MLX4_NUM_UP 8
53#define MLX4_NUM_TC 8
54#define MLX4_MAX_100M_UNITS_VAL 255 /* 52#define MLX4_MAX_100M_UNITS_VAL 255 /*
55 * work around: can't set values 53 * work around: can't set values
56 * greater then this value when 54 * greater then this value when
@@ -174,6 +172,7 @@ enum {
174 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, 172 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41,
175 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, 173 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42,
176 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, 174 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48,
175 MLX4_DEV_CAP_FLAG_RSS_IP_FRAG = 1LL << 52,
177 MLX4_DEV_CAP_FLAG_SET_ETH_SCHED = 1LL << 53, 176 MLX4_DEV_CAP_FLAG_SET_ETH_SCHED = 1LL << 53,
178 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, 177 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55,
179 MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, 178 MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59,
@@ -203,7 +202,14 @@ enum {
203 MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18, 202 MLX4_DEV_CAP_FLAG2_80_VFS = 1LL << 18,
204 MLX4_DEV_CAP_FLAG2_FS_A0 = 1LL << 19, 203 MLX4_DEV_CAP_FLAG2_FS_A0 = 1LL << 19,
205 MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 20, 204 MLX4_DEV_CAP_FLAG2_RECOVERABLE_ERROR_EVENT = 1LL << 20,
206 MLX4_DEV_CAP_FLAG2_PORT_REMAP = 1LL << 21 205 MLX4_DEV_CAP_FLAG2_PORT_REMAP = 1LL << 21,
206 MLX4_DEV_CAP_FLAG2_QCN = 1LL << 22,
207 MLX4_DEV_CAP_FLAG2_QP_RATE_LIMIT = 1LL << 23,
208 MLX4_DEV_CAP_FLAG2_FLOWSTATS_EN = 1LL << 24,
209 MLX4_DEV_CAP_FLAG2_QOS_VPP = 1LL << 25,
210 MLX4_DEV_CAP_FLAG2_ETS_CFG = 1LL << 26,
211 MLX4_DEV_CAP_FLAG2_PORT_BEACON = 1LL << 27,
212 MLX4_DEV_CAP_FLAG2_IGNORE_FCS = 1LL << 28,
207}; 213};
208 214
209enum { 215enum {
@@ -449,6 +455,21 @@ enum mlx4_module_id {
449 MLX4_MODULE_ID_QSFP28 = 0x11, 455 MLX4_MODULE_ID_QSFP28 = 0x11,
450}; 456};
451 457
458enum { /* rl */
459 MLX4_QP_RATE_LIMIT_NONE = 0,
460 MLX4_QP_RATE_LIMIT_KBS = 1,
461 MLX4_QP_RATE_LIMIT_MBS = 2,
462 MLX4_QP_RATE_LIMIT_GBS = 3
463};
464
465struct mlx4_rate_limit_caps {
466 u16 num_rates; /* Number of different rates */
467 u8 min_unit;
468 u16 min_val;
469 u8 max_unit;
470 u16 max_val;
471};
472
452static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) 473static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
453{ 474{
454 return (major << 32) | (minor << 16) | subminor; 475 return (major << 32) | (minor << 16) | subminor;
@@ -564,6 +585,7 @@ struct mlx4_caps {
564 u32 dmfs_high_rate_qpn_base; 585 u32 dmfs_high_rate_qpn_base;
565 u32 dmfs_high_rate_qpn_range; 586 u32 dmfs_high_rate_qpn_range;
566 u32 vf_caps; 587 u32 vf_caps;
588 struct mlx4_rate_limit_caps rl_caps;
567}; 589};
568 590
569struct mlx4_buf_list { 591struct mlx4_buf_list {
@@ -982,6 +1004,11 @@ static inline int mlx4_is_slave(struct mlx4_dev *dev)
982 return dev->flags & MLX4_FLAG_SLAVE; 1004 return dev->flags & MLX4_FLAG_SLAVE;
983} 1005}
984 1006
1007static inline int mlx4_is_eth(struct mlx4_dev *dev, int port)
1008{
1009 return dev->caps.port_type[port] == MLX4_PORT_TYPE_IB ? 0 : 1;
1010}
1011
985int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 1012int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
986 struct mlx4_buf *buf, gfp_t gfp); 1013 struct mlx4_buf *buf, gfp_t gfp);
987void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); 1014void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf);
@@ -1282,14 +1309,13 @@ int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac);
1282void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); 1309void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac);
1283int mlx4_get_base_qpn(struct mlx4_dev *dev, u8 port); 1310int mlx4_get_base_qpn(struct mlx4_dev *dev, u8 port);
1284int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); 1311int __mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac);
1285void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap);
1286int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, 1312int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu,
1287 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); 1313 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx);
1288int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, 1314int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
1289 u8 promisc); 1315 u8 promisc);
1290int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc); 1316int mlx4_SET_PORT_BEACON(struct mlx4_dev *dev, u8 port, u16 time);
1291int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw, 1317int mlx4_SET_PORT_fcs_check(struct mlx4_dev *dev, u8 port,
1292 u8 *pg, u16 *ratelimit); 1318 u8 ignore_fcs_value);
1293int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering, int enable); 1319int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering, int enable);
1294int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx); 1320int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx);
1295int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 1321int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 551f85456c11..6fed539e5456 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -207,14 +207,17 @@ struct mlx4_qp_context {
207 __be32 msn; 207 __be32 msn;
208 __be16 rq_wqe_counter; 208 __be16 rq_wqe_counter;
209 __be16 sq_wqe_counter; 209 __be16 sq_wqe_counter;
210 u32 reserved3[2]; 210 u32 reserved3;
211 __be16 rate_limit_params;
212 u8 reserved4;
213 u8 qos_vport;
211 __be32 param3; 214 __be32 param3;
212 __be32 nummmcpeers_basemkey; 215 __be32 nummmcpeers_basemkey;
213 u8 log_page_size; 216 u8 log_page_size;
214 u8 reserved4[2]; 217 u8 reserved5[2];
215 u8 mtt_base_addr_h; 218 u8 mtt_base_addr_h;
216 __be32 mtt_base_addr_l; 219 __be32 mtt_base_addr_l;
217 u32 reserved5[10]; 220 u32 reserved6[10];
218}; 221};
219 222
220struct mlx4_update_qp_context { 223struct mlx4_update_qp_context {
@@ -229,6 +232,8 @@ struct mlx4_update_qp_context {
229enum { 232enum {
230 MLX4_UPD_QP_MASK_PM_STATE = 32, 233 MLX4_UPD_QP_MASK_PM_STATE = 32,
231 MLX4_UPD_QP_MASK_VSD = 33, 234 MLX4_UPD_QP_MASK_VSD = 33,
235 MLX4_UPD_QP_MASK_QOS_VPP = 34,
236 MLX4_UPD_QP_MASK_RATE_LIMIT = 35,
232}; 237};
233 238
234enum { 239enum {
@@ -428,7 +433,9 @@ struct mlx4_wqe_inline_seg {
428enum mlx4_update_qp_attr { 433enum mlx4_update_qp_attr {
429 MLX4_UPDATE_QP_SMAC = 1 << 0, 434 MLX4_UPDATE_QP_SMAC = 1 << 0,
430 MLX4_UPDATE_QP_VSD = 1 << 1, 435 MLX4_UPDATE_QP_VSD = 1 << 1,
431 MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 2) - 1 436 MLX4_UPDATE_QP_RATE_LIMIT = 1 << 2,
437 MLX4_UPDATE_QP_QOS_VPORT = 1 << 3,
438 MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 4) - 1
432}; 439};
433 440
434enum mlx4_update_qp_params_flags { 441enum mlx4_update_qp_params_flags {
@@ -437,7 +444,10 @@ enum mlx4_update_qp_params_flags {
437 444
438struct mlx4_update_qp_params { 445struct mlx4_update_qp_params {
439 u8 smac_index; 446 u8 smac_index;
447 u8 qos_vport;
440 u32 flags; 448 u32 flags;
449 u16 rate_unit;
450 u16 rate_val;
441}; 451};
442 452
443int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, 453int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn,
diff --git a/include/linux/mlx5/cmd.h b/include/linux/mlx5/cmd.h
index 2826a4b6071e..68cd08f02c2f 100644
--- a/include/linux/mlx5/cmd.h
+++ b/include/linux/mlx5/cmd.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
index f6b17ac601bd..2695ced222df 100644
--- a/include/linux/mlx5/cq.h
+++ b/include/linux/mlx5/cq.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
@@ -137,14 +137,15 @@ enum {
137 137
138static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd, 138static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd,
139 void __iomem *uar_page, 139 void __iomem *uar_page,
140 spinlock_t *doorbell_lock) 140 spinlock_t *doorbell_lock,
141 u32 cons_index)
141{ 142{
142 __be32 doorbell[2]; 143 __be32 doorbell[2];
143 u32 sn; 144 u32 sn;
144 u32 ci; 145 u32 ci;
145 146
146 sn = cq->arm_sn & 3; 147 sn = cq->arm_sn & 3;
147 ci = cq->cons_index & 0xffffff; 148 ci = cons_index & 0xffffff;
148 149
149 *cq->arm_db = cpu_to_be32(sn << 28 | cmd | ci); 150 *cq->arm_db = cpu_to_be32(sn << 28 | cmd | ci);
150 151
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 4e5bd813bb9a..abf65c790421 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/doorbell.h b/include/linux/mlx5/doorbell.h
index 163a818411e7..afc78a3f4462 100644
--- a/include/linux/mlx5/doorbell.h
+++ b/include/linux/mlx5/doorbell.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 166d9315fe4b..9a90e7523dc2 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
@@ -232,6 +232,9 @@ struct mlx5_cmd_stats {
232}; 232};
233 233
234struct mlx5_cmd { 234struct mlx5_cmd {
235 void *cmd_alloc_buf;
236 dma_addr_t alloc_dma;
237 int alloc_size;
235 void *cmd_buf; 238 void *cmd_buf;
236 dma_addr_t dma; 239 dma_addr_t dma;
237 u16 cmdif_rev; 240 u16 cmdif_rev;
@@ -407,7 +410,7 @@ struct mlx5_core_srq {
407struct mlx5_eq_table { 410struct mlx5_eq_table {
408 void __iomem *update_ci; 411 void __iomem *update_ci;
409 void __iomem *update_arm_ci; 412 void __iomem *update_arm_ci;
410 struct list_head *comp_eq_head; 413 struct list_head comp_eqs_list;
411 struct mlx5_eq pages_eq; 414 struct mlx5_eq pages_eq;
412 struct mlx5_eq async_eq; 415 struct mlx5_eq async_eq;
413 struct mlx5_eq cmd_eq; 416 struct mlx5_eq cmd_eq;
@@ -722,6 +725,7 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
722int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq); 725int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
723int mlx5_start_eqs(struct mlx5_core_dev *dev); 726int mlx5_start_eqs(struct mlx5_core_dev *dev);
724int mlx5_stop_eqs(struct mlx5_core_dev *dev); 727int mlx5_stop_eqs(struct mlx5_core_dev *dev);
728int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vector, int *eqn, int *irqn);
725int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); 729int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
726int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn); 730int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
727 731
@@ -777,14 +781,22 @@ enum {
777 MAX_MR_CACHE_ENTRIES = 16, 781 MAX_MR_CACHE_ENTRIES = 16,
778}; 782};
779 783
784enum {
785 MLX5_INTERFACE_PROTOCOL_IB = 0,
786 MLX5_INTERFACE_PROTOCOL_ETH = 1,
787};
788
780struct mlx5_interface { 789struct mlx5_interface {
781 void * (*add)(struct mlx5_core_dev *dev); 790 void * (*add)(struct mlx5_core_dev *dev);
782 void (*remove)(struct mlx5_core_dev *dev, void *context); 791 void (*remove)(struct mlx5_core_dev *dev, void *context);
783 void (*event)(struct mlx5_core_dev *dev, void *context, 792 void (*event)(struct mlx5_core_dev *dev, void *context,
784 enum mlx5_dev_event event, unsigned long param); 793 enum mlx5_dev_event event, unsigned long param);
794 void * (*get_dev)(void *context);
795 int protocol;
785 struct list_head list; 796 struct list_head list;
786}; 797};
787 798
799void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev, int protocol);
788int mlx5_register_interface(struct mlx5_interface *intf); 800int mlx5_register_interface(struct mlx5_interface *intf);
789void mlx5_unregister_interface(struct mlx5_interface *intf); 801void mlx5_unregister_interface(struct mlx5_interface *intf);
790 802
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 5f48b8f592c5..cb3ad17edd1f 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2014, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index 61f7a342d1bf..310b5f7fd6ae 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mlx5/srq.h b/include/linux/mlx5/srq.h
index e1a363a33663..f43ed054a3e0 100644
--- a/include/linux/mlx5/srq.h
+++ b/include/linux/mlx5/srq.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved. 2 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
3 * 3 *
4 * This software is available to you under a choice of one of two 4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU 5 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index 996807963716..83430f2ea757 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -33,6 +33,8 @@
33#define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d 33#define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
34#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335 34#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
35#define SDIO_DEVICE_ID_BROADCOM_43362 0xa962 35#define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
36#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
37#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
36#define SDIO_DEVICE_ID_BROADCOM_4354 0x4354 38#define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
37 39
38#define SDIO_VENDOR_ID_INTEL 0x0089 40#define SDIO_VENDOR_ID_INTEL 0x0089
diff --git a/include/linux/net.h b/include/linux/net.h
index 17d83393afcc..738ea48be889 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -120,7 +120,6 @@ struct socket {
120 120
121struct vm_area_struct; 121struct vm_area_struct;
122struct page; 122struct page;
123struct kiocb;
124struct sockaddr; 123struct sockaddr;
125struct msghdr; 124struct msghdr;
126struct module; 125struct module;
@@ -162,8 +161,8 @@ struct proto_ops {
162 int (*compat_getsockopt)(struct socket *sock, int level, 161 int (*compat_getsockopt)(struct socket *sock, int level,
163 int optname, char __user *optval, int __user *optlen); 162 int optname, char __user *optval, int __user *optlen);
164#endif 163#endif
165 int (*sendmsg) (struct kiocb *iocb, struct socket *sock, 164 int (*sendmsg) (struct socket *sock, struct msghdr *m,
166 struct msghdr *m, size_t total_len); 165 size_t total_len);
167 /* Notes for implementing recvmsg: 166 /* Notes for implementing recvmsg:
168 * =============================== 167 * ===============================
169 * msg->msg_namelen should get updated by the recvmsg handlers 168 * msg->msg_namelen should get updated by the recvmsg handlers
@@ -172,9 +171,8 @@ struct proto_ops {
172 * handlers can assume that msg.msg_name is either NULL or has 171 * handlers can assume that msg.msg_name is either NULL or has
173 * a minimum size of sizeof(struct sockaddr_storage). 172 * a minimum size of sizeof(struct sockaddr_storage).
174 */ 173 */
175 int (*recvmsg) (struct kiocb *iocb, struct socket *sock, 174 int (*recvmsg) (struct socket *sock, struct msghdr *m,
176 struct msghdr *m, size_t total_len, 175 size_t total_len, int flags);
177 int flags);
178 int (*mmap) (struct file *file, struct socket *sock, 176 int (*mmap) (struct file *file, struct socket *sock,
179 struct vm_area_struct * vma); 177 struct vm_area_struct * vma);
180 ssize_t (*sendpage) (struct socket *sock, struct page *page, 178 ssize_t (*sendpage) (struct socket *sock, struct page *page,
@@ -213,7 +211,7 @@ int sock_create(int family, int type, int proto, struct socket **res);
213int sock_create_kern(int family, int type, int proto, struct socket **res); 211int sock_create_kern(int family, int type, int proto, struct socket **res);
214int sock_create_lite(int family, int type, int proto, struct socket **res); 212int sock_create_lite(int family, int type, int proto, struct socket **res);
215void sock_release(struct socket *sock); 213void sock_release(struct socket *sock);
216int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len); 214int sock_sendmsg(struct socket *sock, struct msghdr *msg);
217int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, 215int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
218 int flags); 216 int flags);
219struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname); 217struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 278738873703..b5679aed660b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -261,7 +261,6 @@ struct header_ops {
261 unsigned short type, const void *daddr, 261 unsigned short type, const void *daddr,
262 const void *saddr, unsigned int len); 262 const void *saddr, unsigned int len);
263 int (*parse)(const struct sk_buff *skb, unsigned char *haddr); 263 int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
264 int (*rebuild)(struct sk_buff *skb);
265 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); 264 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
266 void (*cache_update)(struct hh_cache *hh, 265 void (*cache_update)(struct hh_cache *hh,
267 const struct net_device *dev, 266 const struct net_device *dev,
@@ -588,6 +587,7 @@ struct netdev_queue {
588#ifdef CONFIG_BQL 587#ifdef CONFIG_BQL
589 struct dql dql; 588 struct dql dql;
590#endif 589#endif
590 unsigned long tx_maxrate;
591} ____cacheline_aligned_in_smp; 591} ____cacheline_aligned_in_smp;
592 592
593static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) 593static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
@@ -795,7 +795,10 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
795 * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, 795 * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
796 * struct net_device *dev); 796 * struct net_device *dev);
797 * Called when a packet needs to be transmitted. 797 * Called when a packet needs to be transmitted.
798 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY. 798 * Returns NETDEV_TX_OK. Can return NETDEV_TX_BUSY, but you should stop
799 * the queue before that can happen; it's for obsolete devices and weird
800 * corner cases, but the stack really does a non-trivial amount
801 * of useless work if you return NETDEV_TX_BUSY.
799 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX) 802 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)
800 * Required can not be NULL. 803 * Required can not be NULL.
801 * 804 *
@@ -875,6 +878,11 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
875 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state); 878 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state);
876 * int (*ndo_set_vf_port)(struct net_device *dev, int vf, 879 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
877 * struct nlattr *port[]); 880 * struct nlattr *port[]);
881 *
882 * Enable or disable the VF ability to query its RSS Redirection Table and
883 * Hash Key. This is needed since on some devices VF share this information
884 * with PF and querying it may adduce a theoretical security risk.
885 * int (*ndo_set_vf_rss_query_en)(struct net_device *dev, int vf, bool setting);
878 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); 886 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
879 * int (*ndo_setup_tc)(struct net_device *dev, u8 tc) 887 * int (*ndo_setup_tc)(struct net_device *dev, u8 tc)
880 * Called to setup 'tc' number of traffic classes in the net device. This 888 * Called to setup 'tc' number of traffic classes in the net device. This
@@ -1026,15 +1034,12 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
1026 * be otherwise expressed by feature flags. The check is called with 1034 * be otherwise expressed by feature flags. The check is called with
1027 * the set of features that the stack has calculated and it returns 1035 * the set of features that the stack has calculated and it returns
1028 * those the driver believes to be appropriate. 1036 * those the driver believes to be appropriate.
1029 * 1037 * int (*ndo_set_tx_maxrate)(struct net_device *dev,
1030 * int (*ndo_switch_parent_id_get)(struct net_device *dev, 1038 * int queue_index, u32 maxrate);
1031 * struct netdev_phys_item_id *psid); 1039 * Called when a user wants to set a max-rate limitation of specific
1032 * Called to get an ID of the switch chip this port is part of. 1040 * TX queue.
1033 * If driver implements this, it indicates that it represents a port 1041 * int (*ndo_get_iflink)(const struct net_device *dev);
1034 * of a switch chip. 1042 * Called to get the iflink value of this device.
1035 * int (*ndo_switch_port_stp_update)(struct net_device *dev, u8 state);
1036 * Called to notify switch device port of bridge port STP
1037 * state change.
1038 */ 1043 */
1039struct net_device_ops { 1044struct net_device_ops {
1040 int (*ndo_init)(struct net_device *dev); 1045 int (*ndo_init)(struct net_device *dev);
@@ -1099,6 +1104,9 @@ struct net_device_ops {
1099 struct nlattr *port[]); 1104 struct nlattr *port[]);
1100 int (*ndo_get_vf_port)(struct net_device *dev, 1105 int (*ndo_get_vf_port)(struct net_device *dev,
1101 int vf, struct sk_buff *skb); 1106 int vf, struct sk_buff *skb);
1107 int (*ndo_set_vf_rss_query_en)(
1108 struct net_device *dev,
1109 int vf, bool setting);
1102 int (*ndo_setup_tc)(struct net_device *dev, u8 tc); 1110 int (*ndo_setup_tc)(struct net_device *dev, u8 tc);
1103#if IS_ENABLED(CONFIG_FCOE) 1111#if IS_ENABLED(CONFIG_FCOE)
1104 int (*ndo_fcoe_enable)(struct net_device *dev); 1112 int (*ndo_fcoe_enable)(struct net_device *dev);
@@ -1172,6 +1180,8 @@ struct net_device_ops {
1172 bool new_carrier); 1180 bool new_carrier);
1173 int (*ndo_get_phys_port_id)(struct net_device *dev, 1181 int (*ndo_get_phys_port_id)(struct net_device *dev,
1174 struct netdev_phys_item_id *ppid); 1182 struct netdev_phys_item_id *ppid);
1183 int (*ndo_get_phys_port_name)(struct net_device *dev,
1184 char *name, size_t len);
1175 void (*ndo_add_vxlan_port)(struct net_device *dev, 1185 void (*ndo_add_vxlan_port)(struct net_device *dev,
1176 sa_family_t sa_family, 1186 sa_family_t sa_family,
1177 __be16 port); 1187 __be16 port);
@@ -1191,12 +1201,10 @@ struct net_device_ops {
1191 netdev_features_t (*ndo_features_check) (struct sk_buff *skb, 1201 netdev_features_t (*ndo_features_check) (struct sk_buff *skb,
1192 struct net_device *dev, 1202 struct net_device *dev,
1193 netdev_features_t features); 1203 netdev_features_t features);
1194#ifdef CONFIG_NET_SWITCHDEV 1204 int (*ndo_set_tx_maxrate)(struct net_device *dev,
1195 int (*ndo_switch_parent_id_get)(struct net_device *dev, 1205 int queue_index,
1196 struct netdev_phys_item_id *psid); 1206 u32 maxrate);
1197 int (*ndo_switch_port_stp_update)(struct net_device *dev, 1207 int (*ndo_get_iflink)(const struct net_device *dev);
1198 u8 state);
1199#endif
1200}; 1208};
1201 1209
1202/** 1210/**
@@ -1305,6 +1313,8 @@ enum netdev_priv_flags {
1305 * @base_addr: Device I/O address 1313 * @base_addr: Device I/O address
1306 * @irq: Device IRQ number 1314 * @irq: Device IRQ number
1307 * 1315 *
1316 * @carrier_changes: Stats to monitor carrier on<->off transitions
1317 *
1308 * @state: Generic network queuing layer state, see netdev_state_t 1318 * @state: Generic network queuing layer state, see netdev_state_t
1309 * @dev_list: The global list of network devices 1319 * @dev_list: The global list of network devices
1310 * @napi_list: List entry, that is used for polling napi devices 1320 * @napi_list: List entry, that is used for polling napi devices
@@ -1328,7 +1338,7 @@ enum netdev_priv_flags {
1328 * @mpls_features: Mask of features inheritable by MPLS 1338 * @mpls_features: Mask of features inheritable by MPLS
1329 * 1339 *
1330 * @ifindex: interface index 1340 * @ifindex: interface index
1331 * @iflink: unique device identifier 1341 * @group: The group, that the device belongs to
1332 * 1342 *
1333 * @stats: Statistics struct, which was left as a legacy, use 1343 * @stats: Statistics struct, which was left as a legacy, use
1334 * rtnl_link_stats64 instead 1344 * rtnl_link_stats64 instead
@@ -1338,8 +1348,6 @@ enum netdev_priv_flags {
1338 * @tx_dropped: Dropped packets by core network, 1348 * @tx_dropped: Dropped packets by core network,
1339 * do not use this in drivers 1349 * do not use this in drivers
1340 * 1350 *
1341 * @carrier_changes: Stats to monitor carrier on<->off transitions
1342 *
1343 * @wireless_handlers: List of functions to handle Wireless Extensions, 1351 * @wireless_handlers: List of functions to handle Wireless Extensions,
1344 * instead of ioctl, 1352 * instead of ioctl,
1345 * see <net/iw_handler.h> for details. 1353 * see <net/iw_handler.h> for details.
@@ -1348,8 +1356,7 @@ enum netdev_priv_flags {
1348 * @netdev_ops: Includes several pointers to callbacks, 1356 * @netdev_ops: Includes several pointers to callbacks,
1349 * if one wants to override the ndo_*() functions 1357 * if one wants to override the ndo_*() functions
1350 * @ethtool_ops: Management operations 1358 * @ethtool_ops: Management operations
1351 * @fwd_ops: Management operations 1359 * @header_ops: Includes callbacks for creating,parsing,caching,etc
1352 * @header_ops: Includes callbacks for creating,parsing,rebuilding,etc
1353 * of Layer 2 headers. 1360 * of Layer 2 headers.
1354 * 1361 *
1355 * @flags: Interface flags (a la BSD) 1362 * @flags: Interface flags (a la BSD)
@@ -1383,14 +1390,14 @@ enum netdev_priv_flags {
1383 * @dev_port: Used to differentiate devices that share 1390 * @dev_port: Used to differentiate devices that share
1384 * the same function 1391 * the same function
1385 * @addr_list_lock: XXX: need comments on this one 1392 * @addr_list_lock: XXX: need comments on this one
1386 * @uc: unicast mac addresses
1387 * @mc: multicast mac addresses
1388 * @dev_addrs: list of device hw addresses
1389 * @queues_kset: Group of all Kobjects in the Tx and RX queues
1390 * @uc_promisc: Counter, that indicates, that promiscuous mode 1393 * @uc_promisc: Counter, that indicates, that promiscuous mode
1391 * has been enabled due to the need to listen to 1394 * has been enabled due to the need to listen to
1392 * additional unicast addresses in a device that 1395 * additional unicast addresses in a device that
1393 * does not implement ndo_set_rx_mode() 1396 * does not implement ndo_set_rx_mode()
1397 * @uc: unicast mac addresses
1398 * @mc: multicast mac addresses
1399 * @dev_addrs: list of device hw addresses
1400 * @queues_kset: Group of all Kobjects in the Tx and RX queues
1394 * @promiscuity: Number of times, the NIC is told to work in 1401 * @promiscuity: Number of times, the NIC is told to work in
1395 * Promiscuous mode, if it becomes 0 the NIC will 1402 * Promiscuous mode, if it becomes 0 the NIC will
1396 * exit from working in Promiscuous mode 1403 * exit from working in Promiscuous mode
@@ -1420,6 +1427,12 @@ enum netdev_priv_flags {
1420 * @ingress_queue: XXX: need comments on this one 1427 * @ingress_queue: XXX: need comments on this one
1421 * @broadcast: hw bcast address 1428 * @broadcast: hw bcast address
1422 * 1429 *
1430 * @rx_cpu_rmap: CPU reverse-mapping for RX completion interrupts,
1431 * indexed by RX queue number. Assigned by driver.
1432 * This must only be set if the ndo_rx_flow_steer
1433 * operation is defined
1434 * @index_hlist: Device index hash chain
1435 *
1423 * @_tx: Array of TX queues 1436 * @_tx: Array of TX queues
1424 * @num_tx_queues: Number of TX queues allocated at alloc_netdev_mq() time 1437 * @num_tx_queues: Number of TX queues allocated at alloc_netdev_mq() time
1425 * @real_num_tx_queues: Number of TX queues currently active in device 1438 * @real_num_tx_queues: Number of TX queues currently active in device
@@ -1429,11 +1442,6 @@ enum netdev_priv_flags {
1429 * 1442 *
1430 * @xps_maps: XXX: need comments on this one 1443 * @xps_maps: XXX: need comments on this one
1431 * 1444 *
1432 * @rx_cpu_rmap: CPU reverse-mapping for RX completion interrupts,
1433 * indexed by RX queue number. Assigned by driver.
1434 * This must only be set if the ndo_rx_flow_steer
1435 * operation is defined
1436 *
1437 * @trans_start: Time (in jiffies) of last Tx 1445 * @trans_start: Time (in jiffies) of last Tx
1438 * @watchdog_timeo: Represents the timeout that is used by 1446 * @watchdog_timeo: Represents the timeout that is used by
1439 * the watchdog ( see dev_watchdog() ) 1447 * the watchdog ( see dev_watchdog() )
@@ -1441,7 +1449,6 @@ enum netdev_priv_flags {
1441 * 1449 *
1442 * @pcpu_refcnt: Number of references to this device 1450 * @pcpu_refcnt: Number of references to this device
1443 * @todo_list: Delayed register/unregister 1451 * @todo_list: Delayed register/unregister
1444 * @index_hlist: Device index hash chain
1445 * @link_watch_list: XXX: need comments on this one 1452 * @link_watch_list: XXX: need comments on this one
1446 * 1453 *
1447 * @reg_state: Register/unregister state machine 1454 * @reg_state: Register/unregister state machine
@@ -1489,7 +1496,6 @@ enum netdev_priv_flags {
1489 * 1496 *
1490 * @qdisc_tx_busylock: XXX: need comments on this one 1497 * @qdisc_tx_busylock: XXX: need comments on this one
1491 * 1498 *
1492 * @group: The group, that the device belongs to
1493 * @pm_qos_req: Power Management QoS object 1499 * @pm_qos_req: Power Management QoS object
1494 * 1500 *
1495 * FIXME: cleanup struct net_device such that network protocol info 1501 * FIXME: cleanup struct net_device such that network protocol info
@@ -1509,6 +1515,8 @@ struct net_device {
1509 unsigned long base_addr; 1515 unsigned long base_addr;
1510 int irq; 1516 int irq;
1511 1517
1518 atomic_t carrier_changes;
1519
1512 /* 1520 /*
1513 * Some hardware also needs these fields (state,dev_list, 1521 * Some hardware also needs these fields (state,dev_list,
1514 * napi_list,unreg_list,close_list) but they are not 1522 * napi_list,unreg_list,close_list) but they are not
@@ -1542,22 +1550,22 @@ struct net_device {
1542 netdev_features_t mpls_features; 1550 netdev_features_t mpls_features;
1543 1551
1544 int ifindex; 1552 int ifindex;
1545 int iflink; 1553 int group;
1546 1554
1547 struct net_device_stats stats; 1555 struct net_device_stats stats;
1548 1556
1549 atomic_long_t rx_dropped; 1557 atomic_long_t rx_dropped;
1550 atomic_long_t tx_dropped; 1558 atomic_long_t tx_dropped;
1551 1559
1552 atomic_t carrier_changes;
1553
1554#ifdef CONFIG_WIRELESS_EXT 1560#ifdef CONFIG_WIRELESS_EXT
1555 const struct iw_handler_def * wireless_handlers; 1561 const struct iw_handler_def * wireless_handlers;
1556 struct iw_public_data * wireless_data; 1562 struct iw_public_data * wireless_data;
1557#endif 1563#endif
1558 const struct net_device_ops *netdev_ops; 1564 const struct net_device_ops *netdev_ops;
1559 const struct ethtool_ops *ethtool_ops; 1565 const struct ethtool_ops *ethtool_ops;
1560 const struct forwarding_accel_ops *fwd_ops; 1566#ifdef CONFIG_NET_SWITCHDEV
1567 const struct swdev_ops *swdev_ops;
1568#endif
1561 1569
1562 const struct header_ops *header_ops; 1570 const struct header_ops *header_ops;
1563 1571
@@ -1588,6 +1596,8 @@ struct net_device {
1588 unsigned short dev_id; 1596 unsigned short dev_id;
1589 unsigned short dev_port; 1597 unsigned short dev_port;
1590 spinlock_t addr_list_lock; 1598 spinlock_t addr_list_lock;
1599 unsigned char name_assign_type;
1600 bool uc_promisc;
1591 struct netdev_hw_addr_list uc; 1601 struct netdev_hw_addr_list uc;
1592 struct netdev_hw_addr_list mc; 1602 struct netdev_hw_addr_list mc;
1593 struct netdev_hw_addr_list dev_addrs; 1603 struct netdev_hw_addr_list dev_addrs;
@@ -1595,10 +1605,6 @@ struct net_device {
1595#ifdef CONFIG_SYSFS 1605#ifdef CONFIG_SYSFS
1596 struct kset *queues_kset; 1606 struct kset *queues_kset;
1597#endif 1607#endif
1598
1599 unsigned char name_assign_type;
1600
1601 bool uc_promisc;
1602 unsigned int promiscuity; 1608 unsigned int promiscuity;
1603 unsigned int allmulti; 1609 unsigned int allmulti;
1604 1610
@@ -1645,7 +1651,10 @@ struct net_device {
1645 1651
1646 struct netdev_queue __rcu *ingress_queue; 1652 struct netdev_queue __rcu *ingress_queue;
1647 unsigned char broadcast[MAX_ADDR_LEN]; 1653 unsigned char broadcast[MAX_ADDR_LEN];
1648 1654#ifdef CONFIG_RFS_ACCEL
1655 struct cpu_rmap *rx_cpu_rmap;
1656#endif
1657 struct hlist_node index_hlist;
1649 1658
1650/* 1659/*
1651 * Cache lines mostly used on transmit path 1660 * Cache lines mostly used on transmit path
@@ -1656,13 +1665,11 @@ struct net_device {
1656 struct Qdisc *qdisc; 1665 struct Qdisc *qdisc;
1657 unsigned long tx_queue_len; 1666 unsigned long tx_queue_len;
1658 spinlock_t tx_global_lock; 1667 spinlock_t tx_global_lock;
1668 int watchdog_timeo;
1659 1669
1660#ifdef CONFIG_XPS 1670#ifdef CONFIG_XPS
1661 struct xps_dev_maps __rcu *xps_maps; 1671 struct xps_dev_maps __rcu *xps_maps;
1662#endif 1672#endif
1663#ifdef CONFIG_RFS_ACCEL
1664 struct cpu_rmap *rx_cpu_rmap;
1665#endif
1666 1673
1667 /* These may be needed for future network-power-down code. */ 1674 /* These may be needed for future network-power-down code. */
1668 1675
@@ -1672,13 +1679,11 @@ struct net_device {
1672 */ 1679 */
1673 unsigned long trans_start; 1680 unsigned long trans_start;
1674 1681
1675 int watchdog_timeo;
1676 struct timer_list watchdog_timer; 1682 struct timer_list watchdog_timer;
1677 1683
1678 int __percpu *pcpu_refcnt; 1684 int __percpu *pcpu_refcnt;
1679 struct list_head todo_list; 1685 struct list_head todo_list;
1680 1686
1681 struct hlist_node index_hlist;
1682 struct list_head link_watch_list; 1687 struct list_head link_watch_list;
1683 1688
1684 enum { NETREG_UNINITIALIZED=0, 1689 enum { NETREG_UNINITIALIZED=0,
@@ -1702,9 +1707,7 @@ struct net_device {
1702 struct netpoll_info __rcu *npinfo; 1707 struct netpoll_info __rcu *npinfo;
1703#endif 1708#endif
1704 1709
1705#ifdef CONFIG_NET_NS 1710 possible_net_t nd_net;
1706 struct net *nd_net;
1707#endif
1708 1711
1709 /* mid-layer private */ 1712 /* mid-layer private */
1710 union { 1713 union {
@@ -1745,8 +1748,6 @@ struct net_device {
1745#endif 1748#endif
1746 struct phy_device *phydev; 1749 struct phy_device *phydev;
1747 struct lock_class_key *qdisc_tx_busylock; 1750 struct lock_class_key *qdisc_tx_busylock;
1748 int group;
1749 struct pm_qos_request pm_qos_req;
1750}; 1751};
1751#define to_net_dev(d) container_of(d, struct net_device, dev) 1752#define to_net_dev(d) container_of(d, struct net_device, dev)
1752 1753
@@ -1844,10 +1845,7 @@ struct net *dev_net(const struct net_device *dev)
1844static inline 1845static inline
1845void dev_net_set(struct net_device *dev, struct net *net) 1846void dev_net_set(struct net_device *dev, struct net *net)
1846{ 1847{
1847#ifdef CONFIG_NET_NS 1848 write_pnet(&dev->nd_net, net);
1848 release_net(dev->nd_net);
1849 dev->nd_net = hold_net(net);
1850#endif
1851} 1849}
1852 1850
1853static inline bool netdev_uses_dsa(struct net_device *dev) 1851static inline bool netdev_uses_dsa(struct net_device *dev)
@@ -2159,6 +2157,7 @@ void __dev_remove_pack(struct packet_type *pt);
2159void dev_add_offload(struct packet_offload *po); 2157void dev_add_offload(struct packet_offload *po);
2160void dev_remove_offload(struct packet_offload *po); 2158void dev_remove_offload(struct packet_offload *po);
2161 2159
2160int dev_get_iflink(const struct net_device *dev);
2162struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags, 2161struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags,
2163 unsigned short mask); 2162 unsigned short mask);
2164struct net_device *dev_get_by_name(struct net *net, const char *name); 2163struct net_device *dev_get_by_name(struct net *net, const char *name);
@@ -2167,9 +2166,14 @@ struct net_device *__dev_get_by_name(struct net *net, const char *name);
2167int dev_alloc_name(struct net_device *dev, const char *name); 2166int dev_alloc_name(struct net_device *dev, const char *name);
2168int dev_open(struct net_device *dev); 2167int dev_open(struct net_device *dev);
2169int dev_close(struct net_device *dev); 2168int dev_close(struct net_device *dev);
2169int dev_close_many(struct list_head *head, bool unlink);
2170void dev_disable_lro(struct net_device *dev); 2170void dev_disable_lro(struct net_device *dev);
2171int dev_loopback_xmit(struct sk_buff *newskb); 2171int dev_loopback_xmit(struct sock *sk, struct sk_buff *newskb);
2172int dev_queue_xmit(struct sk_buff *skb); 2172int dev_queue_xmit_sk(struct sock *sk, struct sk_buff *skb);
2173static inline int dev_queue_xmit(struct sk_buff *skb)
2174{
2175 return dev_queue_xmit_sk(skb->sk, skb);
2176}
2173int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv); 2177int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv);
2174int register_netdevice(struct net_device *dev); 2178int register_netdevice(struct net_device *dev);
2175void unregister_netdevice_queue(struct net_device *dev, struct list_head *head); 2179void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
@@ -2409,15 +2413,6 @@ static inline int dev_parse_header(const struct sk_buff *skb,
2409 return dev->header_ops->parse(skb, haddr); 2413 return dev->header_ops->parse(skb, haddr);
2410} 2414}
2411 2415
2412static inline int dev_rebuild_header(struct sk_buff *skb)
2413{
2414 const struct net_device *dev = skb->dev;
2415
2416 if (!dev->header_ops || !dev->header_ops->rebuild)
2417 return 0;
2418 return dev->header_ops->rebuild(skb);
2419}
2420
2421typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); 2416typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
2422int register_gifconf(unsigned int family, gifconf_func_t *gifconf); 2417int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
2423static inline int unregister_gifconf(unsigned int family) 2418static inline int unregister_gifconf(unsigned int family)
@@ -2939,7 +2934,11 @@ static inline void dev_consume_skb_any(struct sk_buff *skb)
2939 2934
2940int netif_rx(struct sk_buff *skb); 2935int netif_rx(struct sk_buff *skb);
2941int netif_rx_ni(struct sk_buff *skb); 2936int netif_rx_ni(struct sk_buff *skb);
2942int netif_receive_skb(struct sk_buff *skb); 2937int netif_receive_skb_sk(struct sock *sk, struct sk_buff *skb);
2938static inline int netif_receive_skb(struct sk_buff *skb)
2939{
2940 return netif_receive_skb_sk(skb->sk, skb);
2941}
2943gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb); 2942gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
2944void napi_gro_flush(struct napi_struct *napi, bool flush_old); 2943void napi_gro_flush(struct napi_struct *napi, bool flush_old);
2945struct sk_buff *napi_get_frags(struct napi_struct *napi); 2944struct sk_buff *napi_get_frags(struct napi_struct *napi);
@@ -2975,6 +2974,8 @@ int dev_set_mac_address(struct net_device *, struct sockaddr *);
2975int dev_change_carrier(struct net_device *, bool new_carrier); 2974int dev_change_carrier(struct net_device *, bool new_carrier);
2976int dev_get_phys_port_id(struct net_device *dev, 2975int dev_get_phys_port_id(struct net_device *dev,
2977 struct netdev_phys_item_id *ppid); 2976 struct netdev_phys_item_id *ppid);
2977int dev_get_phys_port_name(struct net_device *dev,
2978 char *name, size_t len);
2978struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev); 2979struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
2979struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2980struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2980 struct netdev_queue *txq, int *ret); 2981 struct netdev_queue *txq, int *ret);
@@ -3679,6 +3680,9 @@ void netdev_change_features(struct net_device *dev);
3679void netif_stacked_transfer_operstate(const struct net_device *rootdev, 3680void netif_stacked_transfer_operstate(const struct net_device *rootdev,
3680 struct net_device *dev); 3681 struct net_device *dev);
3681 3682
3683netdev_features_t passthru_features_check(struct sk_buff *skb,
3684 struct net_device *dev,
3685 netdev_features_t features);
3682netdev_features_t netif_skb_features(struct sk_buff *skb); 3686netdev_features_t netif_skb_features(struct sk_buff *skb);
3683 3687
3684static inline bool net_gso_ok(netdev_features_t features, int gso_type) 3688static inline bool net_gso_ok(netdev_features_t features, int gso_type)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 2517ece98820..63560d0a8dfe 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -44,11 +44,39 @@ int netfilter_init(void);
44struct sk_buff; 44struct sk_buff;
45 45
46struct nf_hook_ops; 46struct nf_hook_ops;
47
48struct sock;
49
50struct nf_hook_state {
51 unsigned int hook;
52 int thresh;
53 u_int8_t pf;
54 struct net_device *in;
55 struct net_device *out;
56 struct sock *sk;
57 int (*okfn)(struct sock *, struct sk_buff *);
58};
59
60static inline void nf_hook_state_init(struct nf_hook_state *p,
61 unsigned int hook,
62 int thresh, u_int8_t pf,
63 struct net_device *indev,
64 struct net_device *outdev,
65 struct sock *sk,
66 int (*okfn)(struct sock *, struct sk_buff *))
67{
68 p->hook = hook;
69 p->thresh = thresh;
70 p->pf = pf;
71 p->in = indev;
72 p->out = outdev;
73 p->sk = sk;
74 p->okfn = okfn;
75}
76
47typedef unsigned int nf_hookfn(const struct nf_hook_ops *ops, 77typedef unsigned int nf_hookfn(const struct nf_hook_ops *ops,
48 struct sk_buff *skb, 78 struct sk_buff *skb,
49 const struct net_device *in, 79 const struct nf_hook_state *state);
50 const struct net_device *out,
51 int (*okfn)(struct sk_buff *));
52 80
53struct nf_hook_ops { 81struct nf_hook_ops {
54 struct list_head list; 82 struct list_head list;
@@ -118,9 +146,7 @@ static inline bool nf_hooks_active(u_int8_t pf, unsigned int hook)
118} 146}
119#endif 147#endif
120 148
121int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 149int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state);
122 struct net_device *indev, struct net_device *outdev,
123 int (*okfn)(struct sk_buff *), int thresh);
124 150
125/** 151/**
126 * nf_hook_thresh - call a netfilter hook 152 * nf_hook_thresh - call a netfilter hook
@@ -130,21 +156,29 @@ int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
130 * value indicates the packet has been consumed by the hook. 156 * value indicates the packet has been consumed by the hook.
131 */ 157 */
132static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, 158static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
159 struct sock *sk,
133 struct sk_buff *skb, 160 struct sk_buff *skb,
134 struct net_device *indev, 161 struct net_device *indev,
135 struct net_device *outdev, 162 struct net_device *outdev,
136 int (*okfn)(struct sk_buff *), int thresh) 163 int (*okfn)(struct sock *, struct sk_buff *),
164 int thresh)
137{ 165{
138 if (nf_hooks_active(pf, hook)) 166 if (nf_hooks_active(pf, hook)) {
139 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh); 167 struct nf_hook_state state;
168
169 nf_hook_state_init(&state, hook, thresh, pf,
170 indev, outdev, sk, okfn);
171 return nf_hook_slow(skb, &state);
172 }
140 return 1; 173 return 1;
141} 174}
142 175
143static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 176static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sock *sk,
144 struct net_device *indev, struct net_device *outdev, 177 struct sk_buff *skb, struct net_device *indev,
145 int (*okfn)(struct sk_buff *)) 178 struct net_device *outdev,
179 int (*okfn)(struct sock *, struct sk_buff *))
146{ 180{
147 return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN); 181 return nf_hook_thresh(pf, hook, sk, skb, indev, outdev, okfn, INT_MIN);
148} 182}
149 183
150/* Activate hook; either okfn or kfree_skb called, unless a hook 184/* Activate hook; either okfn or kfree_skb called, unless a hook
@@ -165,35 +199,36 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
165*/ 199*/
166 200
167static inline int 201static inline int
168NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb, 202NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sock *sk,
169 struct net_device *in, struct net_device *out, 203 struct sk_buff *skb, struct net_device *in,
170 int (*okfn)(struct sk_buff *), int thresh) 204 struct net_device *out,
205 int (*okfn)(struct sock *, struct sk_buff *), int thresh)
171{ 206{
172 int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh); 207 int ret = nf_hook_thresh(pf, hook, sk, skb, in, out, okfn, thresh);
173 if (ret == 1) 208 if (ret == 1)
174 ret = okfn(skb); 209 ret = okfn(sk, skb);
175 return ret; 210 return ret;
176} 211}
177 212
178static inline int 213static inline int
179NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb, 214NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sock *sk,
180 struct net_device *in, struct net_device *out, 215 struct sk_buff *skb, struct net_device *in, struct net_device *out,
181 int (*okfn)(struct sk_buff *), bool cond) 216 int (*okfn)(struct sock *, struct sk_buff *), bool cond)
182{ 217{
183 int ret; 218 int ret;
184 219
185 if (!cond || 220 if (!cond ||
186 ((ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN)) == 1)) 221 ((ret = nf_hook_thresh(pf, hook, sk, skb, in, out, okfn, INT_MIN)) == 1))
187 ret = okfn(skb); 222 ret = okfn(sk, skb);
188 return ret; 223 return ret;
189} 224}
190 225
191static inline int 226static inline int
192NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb, 227NF_HOOK(uint8_t pf, unsigned int hook, struct sock *sk, struct sk_buff *skb,
193 struct net_device *in, struct net_device *out, 228 struct net_device *in, struct net_device *out,
194 int (*okfn)(struct sk_buff *)) 229 int (*okfn)(struct sock *, struct sk_buff *))
195{ 230{
196 return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, INT_MIN); 231 return NF_HOOK_THRESH(pf, hook, sk, skb, in, out, okfn, INT_MIN);
197} 232}
198 233
199/* Call setsockopt() */ 234/* Call setsockopt() */
@@ -293,19 +328,21 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
293} 328}
294 329
295#else /* !CONFIG_NETFILTER */ 330#else /* !CONFIG_NETFILTER */
296#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 331#define NF_HOOK(pf, hook, sk, skb, indev, outdev, okfn) (okfn)(sk, skb)
297#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) 332#define NF_HOOK_COND(pf, hook, sk, skb, indev, outdev, okfn, cond) (okfn)(sk, skb)
298static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook, 333static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
334 struct sock *sk,
299 struct sk_buff *skb, 335 struct sk_buff *skb,
300 struct net_device *indev, 336 struct net_device *indev,
301 struct net_device *outdev, 337 struct net_device *outdev,
302 int (*okfn)(struct sk_buff *), int thresh) 338 int (*okfn)(struct sock *sk, struct sk_buff *), int thresh)
303{ 339{
304 return okfn(skb); 340 return okfn(sk, skb);
305} 341}
306static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb, 342static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sock *sk,
307 struct net_device *indev, struct net_device *outdev, 343 struct sk_buff *skb, struct net_device *indev,
308 int (*okfn)(struct sk_buff *)) 344 struct net_device *outdev,
345 int (*okfn)(struct sock *, struct sk_buff *))
309{ 346{
310 return 1; 347 return 1;
311} 348}
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index f1606fa6132d..34b172301558 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -483,7 +483,7 @@ static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr)
483 483
484 if (!__nested) 484 if (!__nested)
485 return -EMSGSIZE; 485 return -EMSGSIZE;
486 ret = nla_put_net32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); 486 ret = nla_put_in_addr(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr);
487 if (!ret) 487 if (!ret)
488 ipset_nest_end(skb, __nested); 488 ipset_nest_end(skb, __nested);
489 return ret; 489 return ret;
@@ -497,8 +497,7 @@ static inline int nla_put_ipaddr6(struct sk_buff *skb, int type,
497 497
498 if (!__nested) 498 if (!__nested)
499 return -EMSGSIZE; 499 return -EMSGSIZE;
500 ret = nla_put(skb, IPSET_ATTR_IPADDR_IPV6, 500 ret = nla_put_in6_addr(skb, IPSET_ATTR_IPADDR_IPV6, ipaddrptr);
501 sizeof(struct in6_addr), ipaddrptr);
502 if (!ret) 501 if (!ret)
503 ipset_nest_end(skb, __nested); 502 ipset_nest_end(skb, __nested);
504 return ret; 503 return ret;
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index cfb7191e6efa..c22a7fb8d0df 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -54,8 +54,7 @@ extern struct xt_table *arpt_register_table(struct net *net,
54extern void arpt_unregister_table(struct xt_table *table); 54extern void arpt_unregister_table(struct xt_table *table);
55extern unsigned int arpt_do_table(struct sk_buff *skb, 55extern unsigned int arpt_do_table(struct sk_buff *skb,
56 unsigned int hook, 56 unsigned int hook,
57 const struct net_device *in, 57 const struct nf_hook_state *state,
58 const struct net_device *out,
59 struct xt_table *table); 58 struct xt_table *table);
60 59
61#ifdef CONFIG_COMPAT 60#ifdef CONFIG_COMPAT
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index c755e4971fa3..ab8f76dba668 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -2,7 +2,7 @@
2#define __LINUX_BRIDGE_NETFILTER_H 2#define __LINUX_BRIDGE_NETFILTER_H
3 3
4#include <uapi/linux/netfilter_bridge.h> 4#include <uapi/linux/netfilter_bridge.h>
5 5#include <linux/skbuff.h>
6 6
7enum nf_br_hook_priorities { 7enum nf_br_hook_priorities {
8 NF_BR_PRI_FIRST = INT_MIN, 8 NF_BR_PRI_FIRST = INT_MIN,
@@ -17,110 +17,48 @@ enum nf_br_hook_priorities {
17 17
18#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 18#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
19 19
20#define BRNF_PKT_TYPE 0x01
21#define BRNF_BRIDGED_DNAT 0x02 20#define BRNF_BRIDGED_DNAT 0x02
22#define BRNF_BRIDGED 0x04
23#define BRNF_NF_BRIDGE_PREROUTING 0x08 21#define BRNF_NF_BRIDGE_PREROUTING 0x08
24#define BRNF_8021Q 0x10
25#define BRNF_PPPoE 0x20
26 22
27static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb) 23static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
28{ 24{
29 switch (skb->protocol) { 25 if (skb->nf_bridge->orig_proto == BRNF_PROTO_PPPOE)
30 case __cpu_to_be16(ETH_P_8021Q):
31 return VLAN_HLEN;
32 case __cpu_to_be16(ETH_P_PPP_SES):
33 return PPPOE_SES_HLEN; 26 return PPPOE_SES_HLEN;
34 default: 27 return 0;
35 return 0;
36 }
37} 28}
38 29
39static inline void nf_bridge_update_protocol(struct sk_buff *skb) 30int br_handle_frame_finish(struct sock *sk, struct sk_buff *skb);
40{
41 if (skb->nf_bridge->mask & BRNF_8021Q)
42 skb->protocol = htons(ETH_P_8021Q);
43 else if (skb->nf_bridge->mask & BRNF_PPPoE)
44 skb->protocol = htons(ETH_P_PPP_SES);
45}
46 31
47/* Fill in the header for fragmented IP packets handled by 32static inline void br_drop_fake_rtable(struct sk_buff *skb)
48 * the IPv4 connection tracking code.
49 *
50 * Only used in br_forward.c
51 */
52static inline int nf_bridge_copy_header(struct sk_buff *skb)
53{ 33{
54 int err; 34 struct dst_entry *dst = skb_dst(skb);
55 unsigned int header_size;
56
57 nf_bridge_update_protocol(skb);
58 header_size = ETH_HLEN + nf_bridge_encap_header_len(skb);
59 err = skb_cow_head(skb, header_size);
60 if (err)
61 return err;
62 35
63 skb_copy_to_linear_data_offset(skb, -header_size, 36 if (dst && (dst->flags & DST_FAKE_RTABLE))
64 skb->nf_bridge->data, header_size); 37 skb_dst_drop(skb);
65 __skb_push(skb, nf_bridge_encap_header_len(skb));
66 return 0;
67} 38}
68 39
69static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb) 40static inline int nf_bridge_get_physinif(const struct sk_buff *skb)
70{ 41{
71 if (skb->nf_bridge && 42 return skb->nf_bridge ? skb->nf_bridge->physindev->ifindex : 0;
72 skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
73 return nf_bridge_copy_header(skb);
74 return 0;
75} 43}
76 44
77static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb) 45static inline int nf_bridge_get_physoutif(const struct sk_buff *skb)
78{ 46{
79 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE)) 47 return skb->nf_bridge ? skb->nf_bridge->physoutdev->ifindex : 0;
80 return PPPOE_SES_HLEN;
81 return 0;
82} 48}
83 49
84int br_handle_frame_finish(struct sk_buff *skb); 50static inline struct net_device *
85/* Only used in br_device.c */ 51nf_bridge_get_physindev(const struct sk_buff *skb)
86static inline int br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
87{ 52{
88 struct nf_bridge_info *nf_bridge = skb->nf_bridge; 53 return skb->nf_bridge ? skb->nf_bridge->physindev : NULL;
89
90 skb_pull(skb, ETH_HLEN);
91 nf_bridge->mask ^= BRNF_BRIDGED_DNAT;
92 skb_copy_to_linear_data_offset(skb, -(ETH_HLEN-ETH_ALEN),
93 skb->nf_bridge->data, ETH_HLEN-ETH_ALEN);
94 skb->dev = nf_bridge->physindev;
95 return br_handle_frame_finish(skb);
96} 54}
97 55
98/* This is called by the IP fragmenting code and it ensures there is 56static inline struct net_device *
99 * enough room for the encapsulating header (if there is one). */ 57nf_bridge_get_physoutdev(const struct sk_buff *skb)
100static inline unsigned int nf_bridge_pad(const struct sk_buff *skb)
101{ 58{
102 if (skb->nf_bridge) 59 return skb->nf_bridge ? skb->nf_bridge->physoutdev : NULL;
103 return nf_bridge_encap_header_len(skb);
104 return 0;
105} 60}
106
107struct bridge_skb_cb {
108 union {
109 __be32 ipv4;
110 } daddr;
111};
112
113static inline void br_drop_fake_rtable(struct sk_buff *skb)
114{
115 struct dst_entry *dst = skb_dst(skb);
116
117 if (dst && (dst->flags & DST_FAKE_RTABLE))
118 skb_dst_drop(skb);
119}
120
121#else 61#else
122#define nf_bridge_maybe_copy_header(skb) (0)
123#define nf_bridge_pad(skb) (0)
124#define br_drop_fake_rtable(skb) do { } while (0) 62#define br_drop_fake_rtable(skb) do { } while (0)
125#endif /* CONFIG_BRIDGE_NETFILTER */ 63#endif /* CONFIG_BRIDGE_NETFILTER */
126 64
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 34e7a2b7f867..f1bd3962e6b6 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -12,9 +12,10 @@
12#ifndef __LINUX_BRIDGE_EFF_H 12#ifndef __LINUX_BRIDGE_EFF_H
13#define __LINUX_BRIDGE_EFF_H 13#define __LINUX_BRIDGE_EFF_H
14 14
15#include <linux/if.h>
16#include <linux/if_ether.h>
15#include <uapi/linux/netfilter_bridge/ebtables.h> 17#include <uapi/linux/netfilter_bridge/ebtables.h>
16 18
17
18/* return values for match() functions */ 19/* return values for match() functions */
19#define EBT_MATCH 0 20#define EBT_MATCH 0
20#define EBT_NOMATCH 1 21#define EBT_NOMATCH 1
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 901e84db847d..4073510da485 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -65,8 +65,7 @@ struct ipt_error {
65extern void *ipt_alloc_initial_table(const struct xt_table *); 65extern void *ipt_alloc_initial_table(const struct xt_table *);
66extern unsigned int ipt_do_table(struct sk_buff *skb, 66extern unsigned int ipt_do_table(struct sk_buff *skb,
67 unsigned int hook, 67 unsigned int hook,
68 const struct net_device *in, 68 const struct nf_hook_state *state,
69 const struct net_device *out,
70 struct xt_table *table); 69 struct xt_table *table);
71 70
72#ifdef CONFIG_COMPAT 71#ifdef CONFIG_COMPAT
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 610208b18c05..b40d2b635778 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -31,8 +31,7 @@ extern struct xt_table *ip6t_register_table(struct net *net,
31extern void ip6t_unregister_table(struct net *net, struct xt_table *table); 31extern void ip6t_unregister_table(struct net *net, struct xt_table *table);
32extern unsigned int ip6t_do_table(struct sk_buff *skb, 32extern unsigned int ip6t_do_table(struct sk_buff *skb,
33 unsigned int hook, 33 unsigned int hook,
34 const struct net_device *in, 34 const struct nf_hook_state *state,
35 const struct net_device *out,
36 struct xt_table *table); 35 struct xt_table *table);
37 36
38/* Check for an extension */ 37/* Check for an extension */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 02fc86d2348e..6835c1279df7 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -134,7 +134,7 @@ struct netlink_callback {
134 134
135struct netlink_notify { 135struct netlink_notify {
136 struct net *net; 136 struct net *net;
137 int portid; 137 u32 portid;
138 int protocol; 138 int protocol;
139}; 139};
140 140
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index d449018d0726..8f2237eb3485 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -24,6 +24,7 @@ struct phy_device *of_phy_attach(struct net_device *dev,
24 phy_interface_t iface); 24 phy_interface_t iface);
25 25
26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); 26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
27extern int of_mdio_parse_addr(struct device *dev, const struct device_node *np);
27 28
28#else /* CONFIG_OF */ 29#else /* CONFIG_OF */
29static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) 30static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
@@ -60,6 +61,12 @@ static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
60{ 61{
61 return NULL; 62 return NULL;
62} 63}
64
65static inline int of_mdio_parse_addr(struct device *dev,
66 const struct device_node *np)
67{
68 return -ENOSYS;
69}
63#endif /* CONFIG_OF */ 70#endif /* CONFIG_OF */
64 71
65#if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY) 72#if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY)
diff --git a/include/linux/of_net.h b/include/linux/of_net.h
index 34597c8c1a4c..9cd72aab76fe 100644
--- a/include/linux/of_net.h
+++ b/include/linux/of_net.h
@@ -9,8 +9,11 @@
9 9
10#ifdef CONFIG_OF_NET 10#ifdef CONFIG_OF_NET
11#include <linux/of.h> 11#include <linux/of.h>
12
13struct net_device;
12extern int of_get_phy_mode(struct device_node *np); 14extern int of_get_phy_mode(struct device_node *np);
13extern const void *of_get_mac_address(struct device_node *np); 15extern const void *of_get_mac_address(struct device_node *np);
16extern struct net_device *of_find_net_device_by_node(struct device_node *np);
14#else 17#else
15static inline int of_get_phy_mode(struct device_node *np) 18static inline int of_get_phy_mode(struct device_node *np)
16{ 19{
@@ -21,6 +24,11 @@ static inline const void *of_get_mac_address(struct device_node *np)
21{ 24{
22 return NULL; 25 return NULL;
23} 26}
27
28static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
29{
30 return NULL;
31}
24#endif 32#endif
25 33
26#endif /* __LINUX_OF_NET_H */ 34#endif /* __LINUX_OF_NET_H */
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index 7e75bfe37cc7..fe5732d53eda 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -21,6 +21,9 @@ extern void fixed_phy_del(int phy_addr);
21extern int fixed_phy_set_link_update(struct phy_device *phydev, 21extern int fixed_phy_set_link_update(struct phy_device *phydev,
22 int (*link_update)(struct net_device *, 22 int (*link_update)(struct net_device *,
23 struct fixed_phy_status *)); 23 struct fixed_phy_status *));
24extern int fixed_phy_update_state(struct phy_device *phydev,
25 const struct fixed_phy_status *status,
26 const struct fixed_phy_status *changed);
24#else 27#else
25static inline int fixed_phy_add(unsigned int irq, int phy_id, 28static inline int fixed_phy_add(unsigned int irq, int phy_id,
26 struct fixed_phy_status *status) 29 struct fixed_phy_status *status)
@@ -43,6 +46,12 @@ static inline int fixed_phy_set_link_update(struct phy_device *phydev,
43{ 46{
44 return -ENODEV; 47 return -ENODEV;
45} 48}
49static inline int fixed_phy_update_state(struct phy_device *phydev,
50 const struct fixed_phy_status *status,
51 const struct fixed_phy_status *changed)
52{
53 return -ENODEV;
54}
46#endif /* CONFIG_FIXED_PHY */ 55#endif /* CONFIG_FIXED_PHY */
47 56
48#endif /* __PHY_FIXED_H */ 57#endif /* __PHY_FIXED_H */
diff --git a/include/linux/platform_data/nxp-nci.h b/include/linux/platform_data/nxp-nci.h
new file mode 100644
index 000000000000..d6ed28679bb2
--- /dev/null
+++ b/include/linux/platform_data/nxp-nci.h
@@ -0,0 +1,27 @@
1/*
2 * Generic platform data for the NXP NCI NFC chips.
3 *
4 * Copyright (C) 2014 NXP Semiconductors All rights reserved.
5 *
6 * Authors: Clément Perrochaud <clement.perrochaud@nxp.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef _NXP_NCI_H_
19#define _NXP_NCI_H_
20
21struct nxp_nci_nfc_platform_data {
22 unsigned int gpio_en;
23 unsigned int gpio_fw;
24 unsigned int irq;
25};
26
27#endif /* _NXP_NCI_H_ */
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index 0d8ff3fb84ba..b8b73066d137 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -64,11 +64,11 @@ struct ptp_clock_request {
64 * @adjtime: Shifts the time of the hardware clock. 64 * @adjtime: Shifts the time of the hardware clock.
65 * parameter delta: Desired change in nanoseconds. 65 * parameter delta: Desired change in nanoseconds.
66 * 66 *
67 * @gettime: Reads the current time from the hardware clock. 67 * @gettime64: Reads the current time from the hardware clock.
68 * parameter ts: Holds the result. 68 * parameter ts: Holds the result.
69 * 69 *
70 * @settime: Set the current time on the hardware clock. 70 * @settime64: Set the current time on the hardware clock.
71 * parameter ts: Time value to set. 71 * parameter ts: Time value to set.
72 * 72 *
73 * @enable: Request driver to enable or disable an ancillary feature. 73 * @enable: Request driver to enable or disable an ancillary feature.
74 * parameter request: Desired resource to enable or disable. 74 * parameter request: Desired resource to enable or disable.
@@ -104,8 +104,8 @@ struct ptp_clock_info {
104 struct ptp_pin_desc *pin_config; 104 struct ptp_pin_desc *pin_config;
105 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta); 105 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta);
106 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); 106 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta);
107 int (*gettime)(struct ptp_clock_info *ptp, struct timespec *ts); 107 int (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts);
108 int (*settime)(struct ptp_clock_info *ptp, const struct timespec *ts); 108 int (*settime64)(struct ptp_clock_info *p, const struct timespec64 *ts);
109 int (*enable)(struct ptp_clock_info *ptp, 109 int (*enable)(struct ptp_clock_info *ptp,
110 struct ptp_clock_request *request, int on); 110 struct ptp_clock_request *request, int on);
111 int (*verify)(struct ptp_clock_info *ptp, unsigned int pin, 111 int (*verify)(struct ptp_clock_info *ptp, unsigned int pin,
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index d438eeb08bff..e23d242d1230 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -1,14 +1,13 @@
1/* 1/*
2 * Resizable, Scalable, Concurrent Hash Table 2 * Resizable, Scalable, Concurrent Hash Table
3 * 3 *
4 * Copyright (c) 2014 Thomas Graf <tgraf@suug.ch> 4 * Copyright (c) 2015 Herbert Xu <herbert@gondor.apana.org.au>
5 * Copyright (c) 2014-2015 Thomas Graf <tgraf@suug.ch>
5 * Copyright (c) 2008-2014 Patrick McHardy <kaber@trash.net> 6 * Copyright (c) 2008-2014 Patrick McHardy <kaber@trash.net>
6 * 7 *
7 * Based on the following paper by Josh Triplett, Paul E. McKenney
8 * and Jonathan Walpole:
9 * https://www.usenix.org/legacy/event/atc11/tech/final_files/Triplett.pdf
10 *
11 * Code partially derived from nft_hash 8 * Code partially derived from nft_hash
9 * Rewritten with rehash code from br_multicast plus single list
10 * pointer as suggested by Josh Triplett
12 * 11 *
13 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
@@ -19,9 +18,12 @@
19#define _LINUX_RHASHTABLE_H 18#define _LINUX_RHASHTABLE_H
20 19
21#include <linux/compiler.h> 20#include <linux/compiler.h>
21#include <linux/errno.h>
22#include <linux/jhash.h>
22#include <linux/list_nulls.h> 23#include <linux/list_nulls.h>
23#include <linux/workqueue.h> 24#include <linux/workqueue.h>
24#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/rcupdate.h>
25 27
26/* 28/*
27 * The end of the chain is marked with a special nulls marks which has 29 * The end of the chain is marked with a special nulls marks which has
@@ -42,6 +44,9 @@
42#define RHT_HASH_BITS 27 44#define RHT_HASH_BITS 27
43#define RHT_BASE_SHIFT RHT_HASH_BITS 45#define RHT_BASE_SHIFT RHT_HASH_BITS
44 46
47/* Base bits plus 1 bit for nulls marker */
48#define RHT_HASH_RESERVED_SPACE (RHT_BASE_BITS + 1)
49
45struct rhash_head { 50struct rhash_head {
46 struct rhash_head __rcu *next; 51 struct rhash_head __rcu *next;
47}; 52};
@@ -49,20 +54,43 @@ struct rhash_head {
49/** 54/**
50 * struct bucket_table - Table of hash buckets 55 * struct bucket_table - Table of hash buckets
51 * @size: Number of hash buckets 56 * @size: Number of hash buckets
57 * @rehash: Current bucket being rehashed
58 * @hash_rnd: Random seed to fold into hash
52 * @locks_mask: Mask to apply before accessing locks[] 59 * @locks_mask: Mask to apply before accessing locks[]
53 * @locks: Array of spinlocks protecting individual buckets 60 * @locks: Array of spinlocks protecting individual buckets
61 * @walkers: List of active walkers
62 * @rcu: RCU structure for freeing the table
63 * @future_tbl: Table under construction during rehashing
54 * @buckets: size * hash buckets 64 * @buckets: size * hash buckets
55 */ 65 */
56struct bucket_table { 66struct bucket_table {
57 size_t size; 67 unsigned int size;
68 unsigned int rehash;
69 u32 hash_rnd;
58 unsigned int locks_mask; 70 unsigned int locks_mask;
59 spinlock_t *locks; 71 spinlock_t *locks;
72 struct list_head walkers;
73 struct rcu_head rcu;
74
75 struct bucket_table __rcu *future_tbl;
60 76
61 struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp; 77 struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp;
62}; 78};
63 79
80/**
81 * struct rhashtable_compare_arg - Key for the function rhashtable_compare
82 * @ht: Hash table
83 * @key: Key to compare against
84 */
85struct rhashtable_compare_arg {
86 struct rhashtable *ht;
87 const void *key;
88};
89
64typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed); 90typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed);
65typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 seed); 91typedef u32 (*rht_obj_hashfn_t)(const void *data, u32 len, u32 seed);
92typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *arg,
93 const void *obj);
66 94
67struct rhashtable; 95struct rhashtable;
68 96
@@ -72,60 +100,62 @@ struct rhashtable;
72 * @key_len: Length of key 100 * @key_len: Length of key
73 * @key_offset: Offset of key in struct to be hashed 101 * @key_offset: Offset of key in struct to be hashed
74 * @head_offset: Offset of rhash_head in struct to be hashed 102 * @head_offset: Offset of rhash_head in struct to be hashed
75 * @hash_rnd: Seed to use while hashing 103 * @max_size: Maximum size while expanding
76 * @max_shift: Maximum number of shifts while expanding 104 * @min_size: Minimum size while shrinking
77 * @min_shift: Minimum number of shifts while shrinking
78 * @nulls_base: Base value to generate nulls marker 105 * @nulls_base: Base value to generate nulls marker
106 * @insecure_elasticity: Set to true to disable chain length checks
107 * @automatic_shrinking: Enable automatic shrinking of tables
79 * @locks_mul: Number of bucket locks to allocate per cpu (default: 128) 108 * @locks_mul: Number of bucket locks to allocate per cpu (default: 128)
80 * @hashfn: Function to hash key 109 * @hashfn: Hash function (default: jhash2 if !(key_len % 4), or jhash)
81 * @obj_hashfn: Function to hash object 110 * @obj_hashfn: Function to hash object
111 * @obj_cmpfn: Function to compare key with object
82 */ 112 */
83struct rhashtable_params { 113struct rhashtable_params {
84 size_t nelem_hint; 114 size_t nelem_hint;
85 size_t key_len; 115 size_t key_len;
86 size_t key_offset; 116 size_t key_offset;
87 size_t head_offset; 117 size_t head_offset;
88 u32 hash_rnd; 118 unsigned int max_size;
89 size_t max_shift; 119 unsigned int min_size;
90 size_t min_shift;
91 u32 nulls_base; 120 u32 nulls_base;
121 bool insecure_elasticity;
122 bool automatic_shrinking;
92 size_t locks_mul; 123 size_t locks_mul;
93 rht_hashfn_t hashfn; 124 rht_hashfn_t hashfn;
94 rht_obj_hashfn_t obj_hashfn; 125 rht_obj_hashfn_t obj_hashfn;
126 rht_obj_cmpfn_t obj_cmpfn;
95}; 127};
96 128
97/** 129/**
98 * struct rhashtable - Hash table handle 130 * struct rhashtable - Hash table handle
99 * @tbl: Bucket table 131 * @tbl: Bucket table
100 * @future_tbl: Table under construction during expansion/shrinking
101 * @nelems: Number of elements in table 132 * @nelems: Number of elements in table
102 * @shift: Current size (1 << shift) 133 * @key_len: Key length for hashfn
134 * @elasticity: Maximum chain length before rehash
103 * @p: Configuration parameters 135 * @p: Configuration parameters
104 * @run_work: Deferred worker to expand/shrink asynchronously 136 * @run_work: Deferred worker to expand/shrink asynchronously
105 * @mutex: Mutex to protect current/future table swapping 137 * @mutex: Mutex to protect current/future table swapping
106 * @walkers: List of active walkers 138 * @lock: Spin lock to protect walker list
107 * @being_destroyed: True if table is set up for destruction
108 */ 139 */
109struct rhashtable { 140struct rhashtable {
110 struct bucket_table __rcu *tbl; 141 struct bucket_table __rcu *tbl;
111 struct bucket_table __rcu *future_tbl;
112 atomic_t nelems; 142 atomic_t nelems;
113 atomic_t shift; 143 unsigned int key_len;
144 unsigned int elasticity;
114 struct rhashtable_params p; 145 struct rhashtable_params p;
115 struct work_struct run_work; 146 struct work_struct run_work;
116 struct mutex mutex; 147 struct mutex mutex;
117 struct list_head walkers; 148 spinlock_t lock;
118 bool being_destroyed;
119}; 149};
120 150
121/** 151/**
122 * struct rhashtable_walker - Hash table walker 152 * struct rhashtable_walker - Hash table walker
123 * @list: List entry on list of walkers 153 * @list: List entry on list of walkers
124 * @resize: Resize event occured 154 * @tbl: The table that we were walking over
125 */ 155 */
126struct rhashtable_walker { 156struct rhashtable_walker {
127 struct list_head list; 157 struct list_head list;
128 bool resize; 158 struct bucket_table *tbl;
129}; 159};
130 160
131/** 161/**
@@ -162,6 +192,118 @@ static inline unsigned long rht_get_nulls_value(const struct rhash_head *ptr)
162 return ((unsigned long) ptr) >> 1; 192 return ((unsigned long) ptr) >> 1;
163} 193}
164 194
195static inline void *rht_obj(const struct rhashtable *ht,
196 const struct rhash_head *he)
197{
198 return (char *)he - ht->p.head_offset;
199}
200
201static inline unsigned int rht_bucket_index(const struct bucket_table *tbl,
202 unsigned int hash)
203{
204 return (hash >> RHT_HASH_RESERVED_SPACE) & (tbl->size - 1);
205}
206
207static inline unsigned int rht_key_hashfn(
208 struct rhashtable *ht, const struct bucket_table *tbl,
209 const void *key, const struct rhashtable_params params)
210{
211 unsigned int hash;
212
213 /* params must be equal to ht->p if it isn't constant. */
214 if (!__builtin_constant_p(params.key_len))
215 hash = ht->p.hashfn(key, ht->key_len, tbl->hash_rnd);
216 else if (params.key_len) {
217 unsigned int key_len = params.key_len;
218
219 if (params.hashfn)
220 hash = params.hashfn(key, key_len, tbl->hash_rnd);
221 else if (key_len & (sizeof(u32) - 1))
222 hash = jhash(key, key_len, tbl->hash_rnd);
223 else
224 hash = jhash2(key, key_len / sizeof(u32),
225 tbl->hash_rnd);
226 } else {
227 unsigned int key_len = ht->p.key_len;
228
229 if (params.hashfn)
230 hash = params.hashfn(key, key_len, tbl->hash_rnd);
231 else
232 hash = jhash(key, key_len, tbl->hash_rnd);
233 }
234
235 return rht_bucket_index(tbl, hash);
236}
237
238static inline unsigned int rht_head_hashfn(
239 struct rhashtable *ht, const struct bucket_table *tbl,
240 const struct rhash_head *he, const struct rhashtable_params params)
241{
242 const char *ptr = rht_obj(ht, he);
243
244 return likely(params.obj_hashfn) ?
245 rht_bucket_index(tbl, params.obj_hashfn(ptr, params.key_len ?:
246 ht->p.key_len,
247 tbl->hash_rnd)) :
248 rht_key_hashfn(ht, tbl, ptr + params.key_offset, params);
249}
250
251/**
252 * rht_grow_above_75 - returns true if nelems > 0.75 * table-size
253 * @ht: hash table
254 * @tbl: current table
255 */
256static inline bool rht_grow_above_75(const struct rhashtable *ht,
257 const struct bucket_table *tbl)
258{
259 /* Expand table when exceeding 75% load */
260 return atomic_read(&ht->nelems) > (tbl->size / 4 * 3) &&
261 (!ht->p.max_size || tbl->size < ht->p.max_size);
262}
263
264/**
265 * rht_shrink_below_30 - returns true if nelems < 0.3 * table-size
266 * @ht: hash table
267 * @tbl: current table
268 */
269static inline bool rht_shrink_below_30(const struct rhashtable *ht,
270 const struct bucket_table *tbl)
271{
272 /* Shrink table beneath 30% load */
273 return atomic_read(&ht->nelems) < (tbl->size * 3 / 10) &&
274 tbl->size > ht->p.min_size;
275}
276
277/**
278 * rht_grow_above_100 - returns true if nelems > table-size
279 * @ht: hash table
280 * @tbl: current table
281 */
282static inline bool rht_grow_above_100(const struct rhashtable *ht,
283 const struct bucket_table *tbl)
284{
285 return atomic_read(&ht->nelems) > tbl->size;
286}
287
288/* The bucket lock is selected based on the hash and protects mutations
289 * on a group of hash buckets.
290 *
291 * A maximum of tbl->size/2 bucket locks is allocated. This ensures that
292 * a single lock always covers both buckets which may both contains
293 * entries which link to the same bucket of the old table during resizing.
294 * This allows to simplify the locking as locking the bucket in both
295 * tables during resize always guarantee protection.
296 *
297 * IMPORTANT: When holding the bucket lock of both the old and new table
298 * during expansions and shrinking, the old bucket lock must always be
299 * acquired first.
300 */
301static inline spinlock_t *rht_bucket_lock(const struct bucket_table *tbl,
302 unsigned int hash)
303{
304 return &tbl->locks[hash & tbl->locks_mask];
305}
306
165#ifdef CONFIG_PROVE_LOCKING 307#ifdef CONFIG_PROVE_LOCKING
166int lockdep_rht_mutex_is_held(struct rhashtable *ht); 308int lockdep_rht_mutex_is_held(struct rhashtable *ht);
167int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash); 309int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash);
@@ -178,23 +320,13 @@ static inline int lockdep_rht_bucket_is_held(const struct bucket_table *tbl,
178} 320}
179#endif /* CONFIG_PROVE_LOCKING */ 321#endif /* CONFIG_PROVE_LOCKING */
180 322
181int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params); 323int rhashtable_init(struct rhashtable *ht,
182 324 const struct rhashtable_params *params);
183void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node);
184bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node);
185
186int rhashtable_expand(struct rhashtable *ht);
187int rhashtable_shrink(struct rhashtable *ht);
188 325
189void *rhashtable_lookup(struct rhashtable *ht, const void *key); 326int rhashtable_insert_slow(struct rhashtable *ht, const void *key,
190void *rhashtable_lookup_compare(struct rhashtable *ht, const void *key, 327 struct rhash_head *obj,
191 bool (*compare)(void *, void *), void *arg); 328 struct bucket_table *old_tbl);
192 329int rhashtable_insert_rehash(struct rhashtable *ht);
193bool rhashtable_lookup_insert(struct rhashtable *ht, struct rhash_head *obj);
194bool rhashtable_lookup_compare_insert(struct rhashtable *ht,
195 struct rhash_head *obj,
196 bool (*compare)(void *, void *),
197 void *arg);
198 330
199int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter); 331int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter);
200void rhashtable_walk_exit(struct rhashtable_iter *iter); 332void rhashtable_walk_exit(struct rhashtable_iter *iter);
@@ -202,6 +334,9 @@ int rhashtable_walk_start(struct rhashtable_iter *iter) __acquires(RCU);
202void *rhashtable_walk_next(struct rhashtable_iter *iter); 334void *rhashtable_walk_next(struct rhashtable_iter *iter);
203void rhashtable_walk_stop(struct rhashtable_iter *iter) __releases(RCU); 335void rhashtable_walk_stop(struct rhashtable_iter *iter) __releases(RCU);
204 336
337void rhashtable_free_and_destroy(struct rhashtable *ht,
338 void (*free_fn)(void *ptr, void *arg),
339 void *arg);
205void rhashtable_destroy(struct rhashtable *ht); 340void rhashtable_destroy(struct rhashtable *ht);
206 341
207#define rht_dereference(p, ht) \ 342#define rht_dereference(p, ht) \
@@ -352,4 +487,316 @@ void rhashtable_destroy(struct rhashtable *ht);
352 rht_for_each_entry_rcu_continue(tpos, pos, (tbl)->buckets[hash],\ 487 rht_for_each_entry_rcu_continue(tpos, pos, (tbl)->buckets[hash],\
353 tbl, hash, member) 488 tbl, hash, member)
354 489
490static inline int rhashtable_compare(struct rhashtable_compare_arg *arg,
491 const void *obj)
492{
493 struct rhashtable *ht = arg->ht;
494 const char *ptr = obj;
495
496 return memcmp(ptr + ht->p.key_offset, arg->key, ht->p.key_len);
497}
498
499/**
500 * rhashtable_lookup_fast - search hash table, inlined version
501 * @ht: hash table
502 * @key: the pointer to the key
503 * @params: hash table parameters
504 *
505 * Computes the hash value for the key and traverses the bucket chain looking
506 * for a entry with an identical key. The first matching entry is returned.
507 *
508 * Returns the first entry on which the compare function returned true.
509 */
510static inline void *rhashtable_lookup_fast(
511 struct rhashtable *ht, const void *key,
512 const struct rhashtable_params params)
513{
514 struct rhashtable_compare_arg arg = {
515 .ht = ht,
516 .key = key,
517 };
518 const struct bucket_table *tbl;
519 struct rhash_head *he;
520 unsigned int hash;
521
522 rcu_read_lock();
523
524 tbl = rht_dereference_rcu(ht->tbl, ht);
525restart:
526 hash = rht_key_hashfn(ht, tbl, key, params);
527 rht_for_each_rcu(he, tbl, hash) {
528 if (params.obj_cmpfn ?
529 params.obj_cmpfn(&arg, rht_obj(ht, he)) :
530 rhashtable_compare(&arg, rht_obj(ht, he)))
531 continue;
532 rcu_read_unlock();
533 return rht_obj(ht, he);
534 }
535
536 /* Ensure we see any new tables. */
537 smp_rmb();
538
539 tbl = rht_dereference_rcu(tbl->future_tbl, ht);
540 if (unlikely(tbl))
541 goto restart;
542 rcu_read_unlock();
543
544 return NULL;
545}
546
547/* Internal function, please use rhashtable_insert_fast() instead */
548static inline int __rhashtable_insert_fast(
549 struct rhashtable *ht, const void *key, struct rhash_head *obj,
550 const struct rhashtable_params params)
551{
552 struct rhashtable_compare_arg arg = {
553 .ht = ht,
554 .key = key,
555 };
556 struct bucket_table *tbl, *new_tbl;
557 struct rhash_head *head;
558 spinlock_t *lock;
559 unsigned int elasticity;
560 unsigned int hash;
561 int err;
562
563restart:
564 rcu_read_lock();
565
566 tbl = rht_dereference_rcu(ht->tbl, ht);
567
568 /* All insertions must grab the oldest table containing
569 * the hashed bucket that is yet to be rehashed.
570 */
571 for (;;) {
572 hash = rht_head_hashfn(ht, tbl, obj, params);
573 lock = rht_bucket_lock(tbl, hash);
574 spin_lock_bh(lock);
575
576 if (tbl->rehash <= hash)
577 break;
578
579 spin_unlock_bh(lock);
580 tbl = rht_dereference_rcu(tbl->future_tbl, ht);
581 }
582
583 new_tbl = rht_dereference_rcu(tbl->future_tbl, ht);
584 if (unlikely(new_tbl)) {
585 err = rhashtable_insert_slow(ht, key, obj, new_tbl);
586 if (err == -EAGAIN)
587 goto slow_path;
588 goto out;
589 }
590
591 if (unlikely(rht_grow_above_100(ht, tbl))) {
592slow_path:
593 spin_unlock_bh(lock);
594 err = rhashtable_insert_rehash(ht);
595 rcu_read_unlock();
596 if (err)
597 return err;
598
599 goto restart;
600 }
601
602 err = -EEXIST;
603 elasticity = ht->elasticity;
604 rht_for_each(head, tbl, hash) {
605 if (key &&
606 unlikely(!(params.obj_cmpfn ?
607 params.obj_cmpfn(&arg, rht_obj(ht, head)) :
608 rhashtable_compare(&arg, rht_obj(ht, head)))))
609 goto out;
610 if (!--elasticity)
611 goto slow_path;
612 }
613
614 err = 0;
615
616 head = rht_dereference_bucket(tbl->buckets[hash], tbl, hash);
617
618 RCU_INIT_POINTER(obj->next, head);
619
620 rcu_assign_pointer(tbl->buckets[hash], obj);
621
622 atomic_inc(&ht->nelems);
623 if (rht_grow_above_75(ht, tbl))
624 schedule_work(&ht->run_work);
625
626out:
627 spin_unlock_bh(lock);
628 rcu_read_unlock();
629
630 return err;
631}
632
633/**
634 * rhashtable_insert_fast - insert object into hash table
635 * @ht: hash table
636 * @obj: pointer to hash head inside object
637 * @params: hash table parameters
638 *
639 * Will take a per bucket spinlock to protect against mutual mutations
640 * on the same bucket. Multiple insertions may occur in parallel unless
641 * they map to the same bucket lock.
642 *
643 * It is safe to call this function from atomic context.
644 *
645 * Will trigger an automatic deferred table resizing if the size grows
646 * beyond the watermark indicated by grow_decision() which can be passed
647 * to rhashtable_init().
648 */
649static inline int rhashtable_insert_fast(
650 struct rhashtable *ht, struct rhash_head *obj,
651 const struct rhashtable_params params)
652{
653 return __rhashtable_insert_fast(ht, NULL, obj, params);
654}
655
656/**
657 * rhashtable_lookup_insert_fast - lookup and insert object into hash table
658 * @ht: hash table
659 * @obj: pointer to hash head inside object
660 * @params: hash table parameters
661 *
662 * Locks down the bucket chain in both the old and new table if a resize
663 * is in progress to ensure that writers can't remove from the old table
664 * and can't insert to the new table during the atomic operation of search
665 * and insertion. Searches for duplicates in both the old and new table if
666 * a resize is in progress.
667 *
668 * This lookup function may only be used for fixed key hash table (key_len
669 * parameter set). It will BUG() if used inappropriately.
670 *
671 * It is safe to call this function from atomic context.
672 *
673 * Will trigger an automatic deferred table resizing if the size grows
674 * beyond the watermark indicated by grow_decision() which can be passed
675 * to rhashtable_init().
676 */
677static inline int rhashtable_lookup_insert_fast(
678 struct rhashtable *ht, struct rhash_head *obj,
679 const struct rhashtable_params params)
680{
681 const char *key = rht_obj(ht, obj);
682
683 BUG_ON(ht->p.obj_hashfn);
684
685 return __rhashtable_insert_fast(ht, key + ht->p.key_offset, obj,
686 params);
687}
688
689/**
690 * rhashtable_lookup_insert_key - search and insert object to hash table
691 * with explicit key
692 * @ht: hash table
693 * @key: key
694 * @obj: pointer to hash head inside object
695 * @params: hash table parameters
696 *
697 * Locks down the bucket chain in both the old and new table if a resize
698 * is in progress to ensure that writers can't remove from the old table
699 * and can't insert to the new table during the atomic operation of search
700 * and insertion. Searches for duplicates in both the old and new table if
701 * a resize is in progress.
702 *
703 * Lookups may occur in parallel with hashtable mutations and resizing.
704 *
705 * Will trigger an automatic deferred table resizing if the size grows
706 * beyond the watermark indicated by grow_decision() which can be passed
707 * to rhashtable_init().
708 *
709 * Returns zero on success.
710 */
711static inline int rhashtable_lookup_insert_key(
712 struct rhashtable *ht, const void *key, struct rhash_head *obj,
713 const struct rhashtable_params params)
714{
715 BUG_ON(!ht->p.obj_hashfn || !key);
716
717 return __rhashtable_insert_fast(ht, key, obj, params);
718}
719
720/* Internal function, please use rhashtable_remove_fast() instead */
721static inline int __rhashtable_remove_fast(
722 struct rhashtable *ht, struct bucket_table *tbl,
723 struct rhash_head *obj, const struct rhashtable_params params)
724{
725 struct rhash_head __rcu **pprev;
726 struct rhash_head *he;
727 spinlock_t * lock;
728 unsigned int hash;
729 int err = -ENOENT;
730
731 hash = rht_head_hashfn(ht, tbl, obj, params);
732 lock = rht_bucket_lock(tbl, hash);
733
734 spin_lock_bh(lock);
735
736 pprev = &tbl->buckets[hash];
737 rht_for_each(he, tbl, hash) {
738 if (he != obj) {
739 pprev = &he->next;
740 continue;
741 }
742
743 rcu_assign_pointer(*pprev, obj->next);
744 err = 0;
745 break;
746 }
747
748 spin_unlock_bh(lock);
749
750 return err;
751}
752
753/**
754 * rhashtable_remove_fast - remove object from hash table
755 * @ht: hash table
756 * @obj: pointer to hash head inside object
757 * @params: hash table parameters
758 *
759 * Since the hash chain is single linked, the removal operation needs to
760 * walk the bucket chain upon removal. The removal operation is thus
761 * considerable slow if the hash table is not correctly sized.
762 *
763 * Will automatically shrink the table via rhashtable_expand() if the
764 * shrink_decision function specified at rhashtable_init() returns true.
765 *
766 * Returns zero on success, -ENOENT if the entry could not be found.
767 */
768static inline int rhashtable_remove_fast(
769 struct rhashtable *ht, struct rhash_head *obj,
770 const struct rhashtable_params params)
771{
772 struct bucket_table *tbl;
773 int err;
774
775 rcu_read_lock();
776
777 tbl = rht_dereference_rcu(ht->tbl, ht);
778
779 /* Because we have already taken (and released) the bucket
780 * lock in old_tbl, if we find that future_tbl is not yet
781 * visible then that guarantees the entry to still be in
782 * the old tbl if it exists.
783 */
784 while ((err = __rhashtable_remove_fast(ht, tbl, obj, params)) &&
785 (tbl = rht_dereference_rcu(tbl->future_tbl, ht)))
786 ;
787
788 if (err)
789 goto out;
790
791 atomic_dec(&ht->nelems);
792 if (unlikely(ht->p.automatic_shrinking &&
793 rht_shrink_below_30(ht, tbl)))
794 schedule_work(&ht->run_work);
795
796out:
797 rcu_read_unlock();
798
799 return err;
800}
801
355#endif /* _LINUX_RHASHTABLE_H */ 802#endif /* _LINUX_RHASHTABLE_H */
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 5db76a32fcab..2da5d1081ad9 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -77,7 +77,20 @@ static inline struct netdev_queue *dev_ingress_queue(struct net_device *dev)
77 return rtnl_dereference(dev->ingress_queue); 77 return rtnl_dereference(dev->ingress_queue);
78} 78}
79 79
80extern struct netdev_queue *dev_ingress_queue_create(struct net_device *dev); 80struct netdev_queue *dev_ingress_queue_create(struct net_device *dev);
81
82#ifdef CONFIG_NET_CLS_ACT
83void net_inc_ingress_queue(void);
84void net_dec_ingress_queue(void);
85#else
86static inline void net_inc_ingress_queue(void)
87{
88}
89
90static inline void net_dec_ingress_queue(void)
91{
92}
93#endif
81 94
82extern void rtnetlink_init(void); 95extern void rtnetlink_init(void);
83extern void __rtnl_unlock(void); 96extern void __rtnl_unlock(void);
diff --git a/include/linux/security.h b/include/linux/security.h
index 4e14e3d6309f..18264ea9e314 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1716,7 +1716,6 @@ struct security_operations {
1716 int (*tun_dev_attach_queue) (void *security); 1716 int (*tun_dev_attach_queue) (void *security);
1717 int (*tun_dev_attach) (struct sock *sk, void *security); 1717 int (*tun_dev_attach) (struct sock *sk, void *security);
1718 int (*tun_dev_open) (void *security); 1718 int (*tun_dev_open) (void *security);
1719 void (*skb_owned_by) (struct sk_buff *skb, struct sock *sk);
1720#endif /* CONFIG_SECURITY_NETWORK */ 1719#endif /* CONFIG_SECURITY_NETWORK */
1721 1720
1722#ifdef CONFIG_SECURITY_NETWORK_XFRM 1721#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -2734,8 +2733,6 @@ int security_tun_dev_attach_queue(void *security);
2734int security_tun_dev_attach(struct sock *sk, void *security); 2733int security_tun_dev_attach(struct sock *sk, void *security);
2735int security_tun_dev_open(void *security); 2734int security_tun_dev_open(void *security);
2736 2735
2737void security_skb_owned_by(struct sk_buff *skb, struct sock *sk);
2738
2739#else /* CONFIG_SECURITY_NETWORK */ 2736#else /* CONFIG_SECURITY_NETWORK */
2740static inline int security_unix_stream_connect(struct sock *sock, 2737static inline int security_unix_stream_connect(struct sock *sock,
2741 struct sock *other, 2738 struct sock *other,
@@ -2927,11 +2924,6 @@ static inline int security_tun_dev_open(void *security)
2927{ 2924{
2928 return 0; 2925 return 0;
2929} 2926}
2930
2931static inline void security_skb_owned_by(struct sk_buff *skb, struct sock *sk)
2932{
2933}
2934
2935#endif /* CONFIG_SECURITY_NETWORK */ 2927#endif /* CONFIG_SECURITY_NETWORK */
2936 2928
2937#ifdef CONFIG_SECURITY_NETWORK_XFRM 2929#ifdef CONFIG_SECURITY_NETWORK_XFRM
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index f54d6659713a..0991259643d6 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -166,10 +166,16 @@ struct nf_conntrack {
166#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) 166#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
167struct nf_bridge_info { 167struct nf_bridge_info {
168 atomic_t use; 168 atomic_t use;
169 enum {
170 BRNF_PROTO_UNCHANGED,
171 BRNF_PROTO_8021Q,
172 BRNF_PROTO_PPPOE
173 } orig_proto;
174 bool pkt_otherhost;
169 unsigned int mask; 175 unsigned int mask;
170 struct net_device *physindev; 176 struct net_device *physindev;
171 struct net_device *physoutdev; 177 struct net_device *physoutdev;
172 unsigned long data[32 / sizeof(unsigned long)]; 178 char neigh_header[8];
173}; 179};
174#endif 180#endif
175 181
@@ -492,7 +498,6 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
492 * @napi_id: id of the NAPI struct this skb came from 498 * @napi_id: id of the NAPI struct this skb came from
493 * @secmark: security marking 499 * @secmark: security marking
494 * @mark: Generic packet mark 500 * @mark: Generic packet mark
495 * @dropcount: total number of sk_receive_queue overflows
496 * @vlan_proto: vlan encapsulation protocol 501 * @vlan_proto: vlan encapsulation protocol
497 * @vlan_tci: vlan tag control information 502 * @vlan_tci: vlan tag control information
498 * @inner_protocol: Protocol (encapsulation) 503 * @inner_protocol: Protocol (encapsulation)
@@ -641,7 +646,6 @@ struct sk_buff {
641#endif 646#endif
642 union { 647 union {
643 __u32 mark; 648 __u32 mark;
644 __u32 dropcount;
645 __u32 reserved_tailroom; 649 __u32 reserved_tailroom;
646 }; 650 };
647 651
@@ -870,8 +874,7 @@ unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
870void skb_abort_seq_read(struct skb_seq_state *st); 874void skb_abort_seq_read(struct skb_seq_state *st);
871 875
872unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, 876unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
873 unsigned int to, struct ts_config *config, 877 unsigned int to, struct ts_config *config);
874 struct ts_state *state);
875 878
876/* 879/*
877 * Packet hash types specify the type of hash in skb_set_hash. 880 * Packet hash types specify the type of hash in skb_set_hash.
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
index 46cca4c06848..083ac388098e 100644
--- a/include/linux/sock_diag.h
+++ b/include/linux/sock_diag.h
@@ -19,8 +19,8 @@ void sock_diag_unregister(const struct sock_diag_handler *h);
19void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 19void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
20void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 20void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
21 21
22int sock_diag_check_cookie(void *sk, __u32 *cookie); 22int sock_diag_check_cookie(struct sock *sk, const __u32 *cookie);
23void sock_diag_save_cookie(void *sk, __u32 *cookie); 23void sock_diag_save_cookie(struct sock *sk, __u32 *cookie);
24 24
25int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr); 25int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr);
26int sock_diag_put_filterinfo(bool may_report_filterinfo, struct sock *sk, 26int sock_diag_put_filterinfo(bool may_report_filterinfo, struct sock *sk,
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 5c19cba34dce..5bf59c8493b7 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -51,6 +51,7 @@ struct msghdr {
51 void *msg_control; /* ancillary data */ 51 void *msg_control; /* ancillary data */
52 __kernel_size_t msg_controllen; /* ancillary data buffer length */ 52 __kernel_size_t msg_controllen; /* ancillary data buffer length */
53 unsigned int msg_flags; /* flags on received message */ 53 unsigned int msg_flags; /* flags on received message */
54 struct kiocb *msg_iocb; /* ptr to iocb for async requests */
54}; 55};
55 56
56struct user_msghdr { 57struct user_msghdr {
@@ -138,6 +139,11 @@ static inline struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr
138 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg); 139 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
139} 140}
140 141
142static inline size_t msg_data_left(struct msghdr *msg)
143{
144 return iov_iter_count(&msg->msg_iter);
145}
146
141/* "Socket"-level control message types: */ 147/* "Socket"-level control message types: */
142 148
143#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */ 149#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */
@@ -181,6 +187,7 @@ struct ucred {
181#define AF_WANPIPE 25 /* Wanpipe API Sockets */ 187#define AF_WANPIPE 25 /* Wanpipe API Sockets */
182#define AF_LLC 26 /* Linux LLC */ 188#define AF_LLC 26 /* Linux LLC */
183#define AF_IB 27 /* Native InfiniBand address */ 189#define AF_IB 27 /* Native InfiniBand address */
190#define AF_MPLS 28 /* MPLS */
184#define AF_CAN 29 /* Controller Area Network */ 191#define AF_CAN 29 /* Controller Area Network */
185#define AF_TIPC 30 /* TIPC sockets */ 192#define AF_TIPC 30 /* TIPC sockets */
186#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 193#define AF_BLUETOOTH 31 /* Bluetooth sockets */
@@ -226,6 +233,7 @@ struct ucred {
226#define PF_WANPIPE AF_WANPIPE 233#define PF_WANPIPE AF_WANPIPE
227#define PF_LLC AF_LLC 234#define PF_LLC AF_LLC
228#define PF_IB AF_IB 235#define PF_IB AF_IB
236#define PF_MPLS AF_MPLS
229#define PF_CAN AF_CAN 237#define PF_CAN AF_CAN
230#define PF_TIPC AF_TIPC 238#define PF_TIPC AF_TIPC
231#define PF_BLUETOOTH AF_BLUETOOTH 239#define PF_BLUETOOTH AF_BLUETOOTH
diff --git a/include/linux/spi/at86rf230.h b/include/linux/spi/at86rf230.h
index cd519a11c2c6..b63fe6f5fdc8 100644
--- a/include/linux/spi/at86rf230.h
+++ b/include/linux/spi/at86rf230.h
@@ -22,6 +22,7 @@ struct at86rf230_platform_data {
22 int rstn; 22 int rstn;
23 int slp_tr; 23 int slp_tr;
24 int dig2; 24 int dig2;
25 u8 xtal_trim;
25}; 26};
26 27
27#endif 28#endif
diff --git a/include/linux/spi/cc2520.h b/include/linux/spi/cc2520.h
index 85b8ee67e937..e741e8baad92 100644
--- a/include/linux/spi/cc2520.h
+++ b/include/linux/spi/cc2520.h
@@ -21,6 +21,7 @@ struct cc2520_platform_data {
21 int sfd; 21 int sfd;
22 int reset; 22 int reset;
23 int vreg; 23 int vreg;
24 bool amplified;
24}; 25};
25 26
26#endif 27#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 1a7adb411647..0caa3a2d4106 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -58,6 +58,7 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
58struct tcp_fastopen_cookie { 58struct tcp_fastopen_cookie {
59 s8 len; 59 s8 len;
60 u8 val[TCP_FASTOPEN_COOKIE_MAX]; 60 u8 val[TCP_FASTOPEN_COOKIE_MAX];
61 bool exp; /* In RFC6994 experimental option format */
61}; 62};
62 63
63/* This defines a selective acknowledgement block. */ 64/* This defines a selective acknowledgement block. */
@@ -111,7 +112,7 @@ struct tcp_request_sock_ops;
111struct tcp_request_sock { 112struct tcp_request_sock {
112 struct inet_request_sock req; 113 struct inet_request_sock req;
113 const struct tcp_request_sock_ops *af_specific; 114 const struct tcp_request_sock_ops *af_specific;
114 struct sock *listener; /* needed for TFO */ 115 bool tfo_listener;
115 u32 rcv_isn; 116 u32 rcv_isn;
116 u32 snt_isn; 117 u32 snt_isn;
117 u32 snt_synack; /* synack sent time */ 118 u32 snt_synack; /* synack sent time */
@@ -188,6 +189,7 @@ struct tcp_sock {
188 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ 189 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */
189 syn_data:1, /* SYN includes data */ 190 syn_data:1, /* SYN includes data */
190 syn_fastopen:1, /* SYN includes Fast Open option */ 191 syn_fastopen:1, /* SYN includes Fast Open option */
192 syn_fastopen_exp:1,/* SYN includes Fast Open exp. option */
191 syn_data_acked:1,/* data in SYN is acked by SYN-ACK */ 193 syn_data_acked:1,/* data in SYN is acked by SYN-ACK */
192 is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */ 194 is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */
193 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ 195 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
@@ -236,7 +238,6 @@ struct tcp_sock {
236 u32 lost_out; /* Lost packets */ 238 u32 lost_out; /* Lost packets */
237 u32 sacked_out; /* SACK'd packets */ 239 u32 sacked_out; /* SACK'd packets */
238 u32 fackets_out; /* FACK'd packets */ 240 u32 fackets_out; /* FACK'd packets */
239 u32 tso_deferred;
240 241
241 /* from STCP, retrans queue hinting */ 242 /* from STCP, retrans queue hinting */
242 struct sk_buff* lost_skb_hint; 243 struct sk_buff* lost_skb_hint;
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 247cfdcc4b08..87c094961bd5 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -34,7 +34,7 @@ static inline struct udphdr *inner_udp_hdr(const struct sk_buff *skb)
34 34
35#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256) 35#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256)
36 36
37static inline int udp_hashfn(struct net *net, unsigned num, unsigned mask) 37static inline u32 udp_hashfn(const struct net *net, u32 num, u32 mask)
38{ 38{
39 return (num + net_hash_mix(net)) & mask; 39 return (num + net_hash_mix(net)) & mask;
40} 40}