aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-03-19 13:05:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-19 13:05:34 -0400
commit1200b6809dfd9d73bc4c7db76d288c35fa4b2ebe (patch)
tree552e03de245cdbd0780ca1215914edc4a26540f7 /include
parent6b5f04b6cf8ebab9a65d9c0026c650bb2538fd0f (diff)
parentfe30937b65354c7fec244caebbdaae68e28ca797 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: "Highlights: 1) Support more Realtek wireless chips, from Jes Sorenson. 2) New BPF types for per-cpu hash and arrap maps, from Alexei Starovoitov. 3) Make several TCP sysctls per-namespace, from Nikolay Borisov. 4) Allow the use of SO_REUSEPORT in order to do per-thread processing of incoming TCP/UDP connections. The muxing can be done using a BPF program which hashes the incoming packet. From Craig Gallek. 5) Add a multiplexer for TCP streams, to provide a messaged based interface. BPF programs can be used to determine the message boundaries. From Tom Herbert. 6) Add 802.1AE MACSEC support, from Sabrina Dubroca. 7) Avoid factorial complexity when taking down an inetdev interface with lots of configured addresses. We were doing things like traversing the entire address less for each address removed, and flushing the entire netfilter conntrack table for every address as well. 8) Add and use SKB bulk free infrastructure, from Jesper Brouer. 9) Allow offloading u32 classifiers to hardware, and implement for ixgbe, from John Fastabend. 10) Allow configuring IRQ coalescing parameters on a per-queue basis, from Kan Liang. 11) Extend ethtool so that larger link mode masks can be supported. From David Decotigny. 12) Introduce devlink, which can be used to configure port link types (ethernet vs Infiniband, etc.), port splitting, and switch device level attributes as a whole. From Jiri Pirko. 13) Hardware offload support for flower classifiers, from Amir Vadai. 14) Add "Local Checksum Offload". Basically, for a tunneled packet the checksum of the outer header is 'constant' (because with the checksum field filled into the inner protocol header, the payload of the outer frame checksums to 'zero'), and we can take advantage of that in various ways. From Edward Cree" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1548 commits) bonding: fix bond_get_stats() net: bcmgenet: fix dma api length mismatch net/mlx4_core: Fix backward compatibility on VFs phy: mdio-thunder: Fix some Kconfig typos lan78xx: add ndo_get_stats64 lan78xx: handle statistics counter rollover RDS: TCP: Remove unused constant RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket net: smc911x: convert pxa dma to dmaengine team: remove duplicate set of flag IFF_MULTICAST bonding: remove duplicate set of flag IFF_MULTICAST net: fix a comment typo ethernet: micrel: fix some error codes ip_tunnels, bpf: define IP_TUNNEL_OPTS_MAX and use it bpf, dst: add and use dst_tclassid helper bpf: make skb->tc_classid also readable net: mvneta: bm: clarify dependencies cls_bpf: reset class and reuse major in da ldmvsw: Checkpatch sunvnet.c and sunvnet_common.c ldmvsw: Add ldmvsw.c driver code ...
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/checksum.h8
-rw-r--r--include/dt-bindings/clock/rk3036-cru.h2
-rw-r--r--include/linux/bcma/bcma.h3
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h42
-rw-r--r--include/linux/bitmap.h10
-rw-r--r--include/linux/bpf.h32
-rw-r--r--include/linux/ethtool.h102
-rw-r--r--include/linux/ieee80211.h26
-rw-r--r--include/linux/if_bridge.h4
-rw-r--r--include/linux/if_team.h1
-rw-r--r--include/linux/igmp.h5
-rw-r--r--include/linux/inet_lro.h142
-rw-r--r--include/linux/ipv6.h3
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/mbus.h3
-rw-r--r--include/linux/mlx4/driver.h3
-rw-r--r--include/linux/mlx5/device.h17
-rw-r--r--include/linux/mlx5/driver.h40
-rw-r--r--include/linux/mlx5/mlx5_ifc.h109
-rw-r--r--include/linux/mlx5/port.h87
-rw-r--r--include/linux/net.h1
-rw-r--r--include/linux/netdev_features.h3
-rw-r--r--include/linux/netdevice.h101
-rw-r--r--include/linux/netfilter.h29
-rw-r--r--include/linux/netfilter/nfnetlink.h2
-rw-r--r--include/linux/netfilter/x_tables.h6
-rw-r--r--include/linux/netfilter_arp/arp_tables.h9
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h9
-rw-r--r--include/linux/netlink.h10
-rw-r--r--include/linux/perf_event.h13
-rw-r--r--include/linux/phy.h3
-rw-r--r--include/linux/phy_fixed.h5
-rw-r--r--include/linux/platform_data/brcmfmac-sdio.h135
-rw-r--r--include/linux/platform_data/brcmfmac.h185
-rw-r--r--include/linux/platform_data/microread.h35
-rw-r--r--include/linux/qed/common_hsi.h36
-rw-r--r--include/linux/qed/eth_common.h171
-rw-r--r--include/linux/qed/qed_chain.h4
-rw-r--r--include/linux/qed/qed_eth_if.h14
-rw-r--r--include/linux/qed/qed_if.h14
-rw-r--r--include/linux/rculist.h21
-rw-r--r--include/linux/rfkill-gpio.h37
-rw-r--r--include/linux/rfkill.h18
-rw-r--r--include/linux/skbuff.h69
-rw-r--r--include/linux/socket.h7
-rw-r--r--include/linux/stmmac.h17
-rw-r--r--include/linux/tcp.h14
-rw-r--r--include/net/6lowpan.h32
-rw-r--r--include/net/act_api.h84
-rw-r--r--include/net/addrconf.h2
-rw-r--r--include/net/bluetooth/hci.h1
-rw-r--r--include/net/bluetooth/hci_core.h3
-rw-r--r--include/net/bond_3ad.h1
-rw-r--r--include/net/bonding.h1
-rw-r--r--include/net/cfg80211.h8
-rw-r--r--include/net/checksum.h17
-rw-r--r--include/net/codel.h4
-rw-r--r--include/net/devlink.h140
-rw-r--r--include/net/dsa.h15
-rw-r--r--include/net/dst.h12
-rw-r--r--include/net/dst_cache.h97
-rw-r--r--include/net/dst_metadata.h6
-rw-r--r--include/net/flow_dissector.h13
-rw-r--r--include/net/genetlink.h4
-rw-r--r--include/net/hwbm.h28
-rw-r--r--include/net/inet6_hashtables.h13
-rw-r--r--include/net/inet_frag.h1
-rw-r--r--include/net/inet_hashtables.h25
-rw-r--r--include/net/ip.h8
-rw-r--r--include/net/ip6_checksum.h3
-rw-r--r--include/net/ip6_tunnel.h14
-rw-r--r--include/net/ip_tunnels.h55
-rw-r--r--include/net/ip_vs.h17
-rw-r--r--include/net/ipv6.h8
-rw-r--r--include/net/kcm.h226
-rw-r--r--include/net/l3mdev.h4
-rw-r--r--include/net/lwtunnel.h4
-rw-r--r--include/net/mac80211.h198
-rw-r--r--include/net/mac802154.h15
-rw-r--r--include/net/netfilter/nft_masq.h4
-rw-r--r--include/net/netns/ipv4.h19
-rw-r--r--include/net/netns/ipv6.h3
-rw-r--r--include/net/phonet/phonet.h2
-rw-r--r--include/net/ping.h2
-rw-r--r--include/net/pkt_cls.h65
-rw-r--r--include/net/raw.h2
-rw-r--r--include/net/route.h5
-rw-r--r--include/net/sch_generic.h26
-rw-r--r--include/net/sctp/sm.h2
-rw-r--r--include/net/sctp/structs.h11
-rw-r--r--include/net/sock.h6
-rw-r--r--include/net/tc_act/tc_gact.h16
-rw-r--r--include/net/tc_act/tc_ife.h61
-rw-r--r--include/net/tc_act/tc_skbedit.h16
-rw-r--r--include/net/tcp.h53
-rw-r--r--include/net/udp.h3
-rw-r--r--include/net/udp_tunnel.h6
-rw-r--r--include/net/vxlan.h187
-rw-r--r--include/rdma/ib_addr.h14
-rw-r--r--include/rxrpc/packet.h15
-rw-r--r--include/trace/events/sunvnet.h139
-rw-r--r--include/uapi/asm-generic/socket.h2
-rw-r--r--include/uapi/linux/Kbuild1
-rw-r--r--include/uapi/linux/bpf.h52
-rw-r--r--include/uapi/linux/devlink.h72
-rw-r--r--include/uapi/linux/ethtool.h437
-rw-r--r--include/uapi/linux/genetlink.h1
-rw-r--r--include/uapi/linux/if.h2
-rw-r--r--include/uapi/linux/if_bridge.h37
-rw-r--r--include/uapi/linux/if_ether.h1
-rw-r--r--include/uapi/linux/if_link.h43
-rw-r--r--include/uapi/linux/if_macsec.h161
-rw-r--r--include/uapi/linux/ip.h2
-rw-r--r--include/uapi/linux/ipv6.h3
-rw-r--r--include/uapi/linux/kcm.h40
-rw-r--r--include/uapi/linux/kernel.h1
-rw-r--r--include/uapi/linux/mroute6.h9
-rw-r--r--include/uapi/linux/netconf.h1
-rw-r--r--include/uapi/linux/netfilter/nf_conntrack_common.h12
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h6
-rw-r--r--include/uapi/linux/netlink.h4
-rw-r--r--include/uapi/linux/netlink_diag.h2
-rw-r--r--include/uapi/linux/nl80211.h14
-rw-r--r--include/uapi/linux/openvswitch.h49
-rw-r--r--include/uapi/linux/pkt_cls.h3
-rw-r--r--include/uapi/linux/rfkill.h2
-rw-r--r--include/uapi/linux/tc_act/tc_ife.h38
-rw-r--r--include/uapi/linux/tcp.h5
-rw-r--r--include/xen/interface/io/netif.h861
130 files changed, 4241 insertions, 954 deletions
diff --git a/include/asm-generic/checksum.h b/include/asm-generic/checksum.h
index 59811df58c5b..3150cbd8eb21 100644
--- a/include/asm-generic/checksum.h
+++ b/include/asm-generic/checksum.h
@@ -65,14 +65,14 @@ static inline __sum16 csum_fold(__wsum csum)
65 * returns a 16-bit checksum, already complemented 65 * returns a 16-bit checksum, already complemented
66 */ 66 */
67extern __wsum 67extern __wsum
68csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 68csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
69 unsigned short proto, __wsum sum); 69 __u8 proto, __wsum sum);
70#endif 70#endif
71 71
72#ifndef csum_tcpudp_magic 72#ifndef csum_tcpudp_magic
73static inline __sum16 73static inline __sum16
74csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 74csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
75 unsigned short proto, __wsum sum) 75 __u8 proto, __wsum sum)
76{ 76{
77 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 77 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
78} 78}
diff --git a/include/dt-bindings/clock/rk3036-cru.h b/include/dt-bindings/clock/rk3036-cru.h
index ebc7a7b43f52..de44109a3a04 100644
--- a/include/dt-bindings/clock/rk3036-cru.h
+++ b/include/dt-bindings/clock/rk3036-cru.h
@@ -54,6 +54,7 @@
54#define SCLK_PVTM_VIDEO 125 54#define SCLK_PVTM_VIDEO 125
55#define SCLK_MAC 151 55#define SCLK_MAC 151
56#define SCLK_MACREF 152 56#define SCLK_MACREF 152
57#define SCLK_MACPLL 153
57#define SCLK_SFC 160 58#define SCLK_SFC 160
58 59
59/* aclk gates */ 60/* aclk gates */
@@ -92,6 +93,7 @@
92#define HCLK_SDMMC 456 93#define HCLK_SDMMC 456
93#define HCLK_SDIO 457 94#define HCLK_SDIO 457
94#define HCLK_EMMC 459 95#define HCLK_EMMC 459
96#define HCLK_MAC 460
95#define HCLK_I2S 462 97#define HCLK_I2S 462
96#define HCLK_LCDC 465 98#define HCLK_LCDC 465
97#define HCLK_ROM 467 99#define HCLK_ROM 467
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 3feb1b2d75d8..0367c63f5960 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -151,6 +151,8 @@ struct bcma_host_ops {
151#define BCMA_CORE_PCIE2 0x83C /* PCI Express Gen2 */ 151#define BCMA_CORE_PCIE2 0x83C /* PCI Express Gen2 */
152#define BCMA_CORE_USB30_DEV 0x83D 152#define BCMA_CORE_USB30_DEV 0x83D
153#define BCMA_CORE_ARM_CR4 0x83E 153#define BCMA_CORE_ARM_CR4 0x83E
154#define BCMA_CORE_GCI 0x840
155#define BCMA_CORE_CMEM 0x846 /* CNDS DDR2/3 memory controller */
154#define BCMA_CORE_ARM_CA7 0x847 156#define BCMA_CORE_ARM_CA7 0x847
155#define BCMA_CORE_SYS_MEM 0x849 157#define BCMA_CORE_SYS_MEM 0x849
156#define BCMA_CORE_DEFAULT 0xFFF 158#define BCMA_CORE_DEFAULT 0xFFF
@@ -199,6 +201,7 @@ struct bcma_host_ops {
199#define BCMA_PKG_ID_BCM4707 1 201#define BCMA_PKG_ID_BCM4707 1
200#define BCMA_PKG_ID_BCM4708 2 202#define BCMA_PKG_ID_BCM4708 2
201#define BCMA_PKG_ID_BCM4709 0 203#define BCMA_PKG_ID_BCM4709 0
204#define BCMA_CHIP_ID_BCM47094 53030
202#define BCMA_CHIP_ID_BCM53018 53018 205#define BCMA_CHIP_ID_BCM53018 53018
203 206
204/* Board types (on PCI usually equals to the subsystem dev id) */ 207/* Board types (on PCI usually equals to the subsystem dev id) */
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index db51a6ffb7d6..846513c73606 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -217,6 +217,11 @@
217#define BCMA_CC_CLKDIV_JTAG_SHIFT 8 217#define BCMA_CC_CLKDIV_JTAG_SHIFT 8
218#define BCMA_CC_CLKDIV_UART 0x000000FF 218#define BCMA_CC_CLKDIV_UART 0x000000FF
219#define BCMA_CC_CAP_EXT 0x00AC /* Capabilities */ 219#define BCMA_CC_CAP_EXT 0x00AC /* Capabilities */
220#define BCMA_CC_CAP_EXT_SECI_PRESENT 0x00000001
221#define BCMA_CC_CAP_EXT_GSIO_PRESENT 0x00000002
222#define BCMA_CC_CAP_EXT_GCI_PRESENT 0x00000004
223#define BCMA_CC_CAP_EXT_SECI_PUART_PRESENT 0x00000008 /* UART present */
224#define BCMA_CC_CAP_EXT_AOB_PRESENT 0x00000040
220#define BCMA_CC_PLLONDELAY 0x00B0 /* Rev >= 4 only */ 225#define BCMA_CC_PLLONDELAY 0x00B0 /* Rev >= 4 only */
221#define BCMA_CC_FREFSELDELAY 0x00B4 /* Rev >= 4 only */ 226#define BCMA_CC_FREFSELDELAY 0x00B4 /* Rev >= 4 only */
222#define BCMA_CC_SLOWCLKCTL 0x00B8 /* 6 <= Rev <= 9 only */ 227#define BCMA_CC_SLOWCLKCTL 0x00B8 /* 6 <= Rev <= 9 only */
@@ -351,12 +356,12 @@
351#define BCMA_CC_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */ 356#define BCMA_CC_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */
352#define BCMA_CC_PMU_RES_REQT 0x0644 /* PMU res req timer */ 357#define BCMA_CC_PMU_RES_REQT 0x0644 /* PMU res req timer */
353#define BCMA_CC_PMU_RES_REQM 0x0648 /* PMU res req mask */ 358#define BCMA_CC_PMU_RES_REQM 0x0648 /* PMU res req mask */
354#define BCMA_CC_CHIPCTL_ADDR 0x0650 359#define BCMA_CC_PMU_CHIPCTL_ADDR 0x0650
355#define BCMA_CC_CHIPCTL_DATA 0x0654 360#define BCMA_CC_PMU_CHIPCTL_DATA 0x0654
356#define BCMA_CC_REGCTL_ADDR 0x0658 361#define BCMA_CC_PMU_REGCTL_ADDR 0x0658
357#define BCMA_CC_REGCTL_DATA 0x065C 362#define BCMA_CC_PMU_REGCTL_DATA 0x065C
358#define BCMA_CC_PLLCTL_ADDR 0x0660 363#define BCMA_CC_PMU_PLLCTL_ADDR 0x0660
359#define BCMA_CC_PLLCTL_DATA 0x0664 364#define BCMA_CC_PMU_PLLCTL_DATA 0x0664
360#define BCMA_CC_PMU_STRAPOPT 0x0668 /* (corerev >= 28) */ 365#define BCMA_CC_PMU_STRAPOPT 0x0668 /* (corerev >= 28) */
361#define BCMA_CC_PMU_XTAL_FREQ 0x066C /* (pmurev >= 10) */ 366#define BCMA_CC_PMU_XTAL_FREQ 0x066C /* (pmurev >= 10) */
362#define BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK 0x00001FFF 367#define BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK 0x00001FFF
@@ -566,17 +571,16 @@
566 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) 571 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)
567 */ 572 */
568struct bcma_chipcommon_pmu { 573struct bcma_chipcommon_pmu {
574 struct bcma_device *core; /* Can be separated core or just ChipCommon one */
569 u8 rev; /* PMU revision */ 575 u8 rev; /* PMU revision */
570 u32 crystalfreq; /* The active crystal frequency (in kHz) */ 576 u32 crystalfreq; /* The active crystal frequency (in kHz) */
571}; 577};
572 578
573#ifdef CONFIG_BCMA_DRIVER_MIPS 579#ifdef CONFIG_BCMA_PFLASH
574struct bcma_pflash { 580struct bcma_pflash {
575 bool present; 581 bool present;
576 u8 buswidth;
577 u32 window;
578 u32 window_size;
579}; 582};
583#endif
580 584
581#ifdef CONFIG_BCMA_SFLASH 585#ifdef CONFIG_BCMA_SFLASH
582struct mtd_info; 586struct mtd_info;
@@ -600,6 +604,7 @@ struct bcma_nflash {
600}; 604};
601#endif 605#endif
602 606
607#ifdef CONFIG_BCMA_DRIVER_MIPS
603struct bcma_serial_port { 608struct bcma_serial_port {
604 void *regs; 609 void *regs;
605 unsigned long clockspeed; 610 unsigned long clockspeed;
@@ -619,8 +624,9 @@ struct bcma_drv_cc {
619 /* Fast Powerup Delay constant */ 624 /* Fast Powerup Delay constant */
620 u16 fast_pwrup_delay; 625 u16 fast_pwrup_delay;
621 struct bcma_chipcommon_pmu pmu; 626 struct bcma_chipcommon_pmu pmu;
622#ifdef CONFIG_BCMA_DRIVER_MIPS 627#ifdef CONFIG_BCMA_PFLASH
623 struct bcma_pflash pflash; 628 struct bcma_pflash pflash;
629#endif
624#ifdef CONFIG_BCMA_SFLASH 630#ifdef CONFIG_BCMA_SFLASH
625 struct bcma_sflash sflash; 631 struct bcma_sflash sflash;
626#endif 632#endif
@@ -628,6 +634,7 @@ struct bcma_drv_cc {
628 struct bcma_nflash nflash; 634 struct bcma_nflash nflash;
629#endif 635#endif
630 636
637#ifdef CONFIG_BCMA_DRIVER_MIPS
631 int nr_serial_ports; 638 int nr_serial_ports;
632 struct bcma_serial_port serial_ports[4]; 639 struct bcma_serial_port serial_ports[4];
633#endif /* CONFIG_BCMA_DRIVER_MIPS */ 640#endif /* CONFIG_BCMA_DRIVER_MIPS */
@@ -660,6 +667,19 @@ struct bcma_drv_cc_b {
660#define bcma_cc_maskset32(cc, offset, mask, set) \ 667#define bcma_cc_maskset32(cc, offset, mask, set) \
661 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) 668 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
662 669
670/* PMU registers access */
671#define bcma_pmu_read32(cc, offset) \
672 bcma_read32((cc)->pmu.core, offset)
673#define bcma_pmu_write32(cc, offset, val) \
674 bcma_write32((cc)->pmu.core, offset, val)
675
676#define bcma_pmu_mask32(cc, offset, mask) \
677 bcma_pmu_write32(cc, offset, bcma_pmu_read32(cc, offset) & (mask))
678#define bcma_pmu_set32(cc, offset, set) \
679 bcma_pmu_write32(cc, offset, bcma_pmu_read32(cc, offset) | (set))
680#define bcma_pmu_maskset32(cc, offset, mask, set) \
681 bcma_pmu_write32(cc, offset, (bcma_pmu_read32(cc, offset) & (mask)) | (set))
682
663extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); 683extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
664 684
665extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc); 685extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc);
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 9653fdb76a42..e9b0b9ab07e5 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -59,6 +59,8 @@
59 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region 59 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region
60 * bitmap_release_region(bitmap, pos, order) Free specified bit region 60 * bitmap_release_region(bitmap, pos, order) Free specified bit region
61 * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region 61 * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region
62 * bitmap_from_u32array(dst, nbits, buf, nwords) *dst = *buf (nwords 32b words)
63 * bitmap_to_u32array(buf, nwords, src, nbits) *buf = *dst (nwords 32b words)
62 */ 64 */
63 65
64/* 66/*
@@ -163,6 +165,14 @@ extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
163extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order); 165extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order);
164extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order); 166extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order);
165extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order); 167extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order);
168extern unsigned int bitmap_from_u32array(unsigned long *bitmap,
169 unsigned int nbits,
170 const u32 *buf,
171 unsigned int nwords);
172extern unsigned int bitmap_to_u32array(u32 *buf,
173 unsigned int nwords,
174 const unsigned long *bitmap,
175 unsigned int nbits);
166#ifdef __BIG_ENDIAN 176#ifdef __BIG_ENDIAN
167extern void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits); 177extern void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits);
168#else 178#else
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 83d1926c61e4..21ee41b92e8a 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -10,6 +10,7 @@
10#include <uapi/linux/bpf.h> 10#include <uapi/linux/bpf.h>
11#include <linux/workqueue.h> 11#include <linux/workqueue.h>
12#include <linux/file.h> 12#include <linux/file.h>
13#include <linux/percpu.h>
13 14
14struct bpf_map; 15struct bpf_map;
15 16
@@ -36,6 +37,7 @@ struct bpf_map {
36 u32 key_size; 37 u32 key_size;
37 u32 value_size; 38 u32 value_size;
38 u32 max_entries; 39 u32 max_entries;
40 u32 map_flags;
39 u32 pages; 41 u32 pages;
40 struct user_struct *user; 42 struct user_struct *user;
41 const struct bpf_map_ops *ops; 43 const struct bpf_map_ops *ops;
@@ -65,6 +67,7 @@ enum bpf_arg_type {
65 */ 67 */
66 ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */ 68 ARG_PTR_TO_STACK, /* any pointer to eBPF program stack */
67 ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */ 69 ARG_CONST_STACK_SIZE, /* number of bytes accessed from stack */
70 ARG_CONST_STACK_SIZE_OR_ZERO, /* number of bytes accessed from stack or 0 */
68 71
69 ARG_PTR_TO_CTX, /* pointer to context */ 72 ARG_PTR_TO_CTX, /* pointer to context */
70 ARG_ANYTHING, /* any (initialized) argument is ok */ 73 ARG_ANYTHING, /* any (initialized) argument is ok */
@@ -151,6 +154,7 @@ struct bpf_array {
151 union { 154 union {
152 char value[0] __aligned(8); 155 char value[0] __aligned(8);
153 void *ptrs[0] __aligned(8); 156 void *ptrs[0] __aligned(8);
157 void __percpu *pptrs[0] __aligned(8);
154 }; 158 };
155}; 159};
156#define MAX_TAIL_CALL_CNT 32 160#define MAX_TAIL_CALL_CNT 32
@@ -161,6 +165,8 @@ bool bpf_prog_array_compatible(struct bpf_array *array, const struct bpf_prog *f
161const struct bpf_func_proto *bpf_get_trace_printk_proto(void); 165const struct bpf_func_proto *bpf_get_trace_printk_proto(void);
162 166
163#ifdef CONFIG_BPF_SYSCALL 167#ifdef CONFIG_BPF_SYSCALL
168DECLARE_PER_CPU(int, bpf_prog_active);
169
164void bpf_register_prog_type(struct bpf_prog_type_list *tl); 170void bpf_register_prog_type(struct bpf_prog_type_list *tl);
165void bpf_register_map_type(struct bpf_map_type_list *tl); 171void bpf_register_map_type(struct bpf_map_type_list *tl);
166 172
@@ -173,6 +179,7 @@ struct bpf_map *__bpf_map_get(struct fd f);
173void bpf_map_inc(struct bpf_map *map, bool uref); 179void bpf_map_inc(struct bpf_map *map, bool uref);
174void bpf_map_put_with_uref(struct bpf_map *map); 180void bpf_map_put_with_uref(struct bpf_map *map);
175void bpf_map_put(struct bpf_map *map); 181void bpf_map_put(struct bpf_map *map);
182int bpf_map_precharge_memlock(u32 pages);
176 183
177extern int sysctl_unprivileged_bpf_disabled; 184extern int sysctl_unprivileged_bpf_disabled;
178 185
@@ -182,6 +189,30 @@ int bpf_prog_new_fd(struct bpf_prog *prog);
182int bpf_obj_pin_user(u32 ufd, const char __user *pathname); 189int bpf_obj_pin_user(u32 ufd, const char __user *pathname);
183int bpf_obj_get_user(const char __user *pathname); 190int bpf_obj_get_user(const char __user *pathname);
184 191
192int bpf_percpu_hash_copy(struct bpf_map *map, void *key, void *value);
193int bpf_percpu_array_copy(struct bpf_map *map, void *key, void *value);
194int bpf_percpu_hash_update(struct bpf_map *map, void *key, void *value,
195 u64 flags);
196int bpf_percpu_array_update(struct bpf_map *map, void *key, void *value,
197 u64 flags);
198int bpf_stackmap_copy(struct bpf_map *map, void *key, void *value);
199
200/* memcpy that is used with 8-byte aligned pointers, power-of-8 size and
201 * forced to use 'long' read/writes to try to atomically copy long counters.
202 * Best-effort only. No barriers here, since it _will_ race with concurrent
203 * updates from BPF programs. Called from bpf syscall and mostly used with
204 * size 8 or 16 bytes, so ask compiler to inline it.
205 */
206static inline void bpf_long_memcpy(void *dst, const void *src, u32 size)
207{
208 const long *lsrc = src;
209 long *ldst = dst;
210
211 size /= sizeof(long);
212 while (size--)
213 *ldst++ = *lsrc++;
214}
215
185/* verify correctness of eBPF program */ 216/* verify correctness of eBPF program */
186int bpf_check(struct bpf_prog **fp, union bpf_attr *attr); 217int bpf_check(struct bpf_prog **fp, union bpf_attr *attr);
187#else 218#else
@@ -213,6 +244,7 @@ extern const struct bpf_func_proto bpf_get_current_uid_gid_proto;
213extern const struct bpf_func_proto bpf_get_current_comm_proto; 244extern const struct bpf_func_proto bpf_get_current_comm_proto;
214extern const struct bpf_func_proto bpf_skb_vlan_push_proto; 245extern const struct bpf_func_proto bpf_skb_vlan_push_proto;
215extern const struct bpf_func_proto bpf_skb_vlan_pop_proto; 246extern const struct bpf_func_proto bpf_skb_vlan_pop_proto;
247extern const struct bpf_func_proto bpf_get_stackid_proto;
216 248
217/* Shared helpers among cBPF and eBPF. */ 249/* Shared helpers among cBPF and eBPF. */
218void bpf_user_rnd_init_once(void); 250void bpf_user_rnd_init_once(void);
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 653dc9c4ebac..e2b7bf27c03e 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -12,6 +12,7 @@
12#ifndef _LINUX_ETHTOOL_H 12#ifndef _LINUX_ETHTOOL_H
13#define _LINUX_ETHTOOL_H 13#define _LINUX_ETHTOOL_H
14 14
15#include <linux/bitmap.h>
15#include <linux/compat.h> 16#include <linux/compat.h>
16#include <uapi/linux/ethtool.h> 17#include <uapi/linux/ethtool.h>
17 18
@@ -40,9 +41,6 @@ struct compat_ethtool_rxnfc {
40 41
41#include <linux/rculist.h> 42#include <linux/rculist.h>
42 43
43extern int __ethtool_get_settings(struct net_device *dev,
44 struct ethtool_cmd *cmd);
45
46/** 44/**
47 * enum ethtool_phys_id_state - indicator state for physical identification 45 * enum ethtool_phys_id_state - indicator state for physical identification
48 * @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated 46 * @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated
@@ -97,13 +95,70 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
97 return index % n_rx_rings; 95 return index % n_rx_rings;
98} 96}
99 97
98/* number of link mode bits/ulongs handled internally by kernel */
99#define __ETHTOOL_LINK_MODE_MASK_NBITS \
100 (__ETHTOOL_LINK_MODE_LAST + 1)
101
102/* declare a link mode bitmap */
103#define __ETHTOOL_DECLARE_LINK_MODE_MASK(name) \
104 DECLARE_BITMAP(name, __ETHTOOL_LINK_MODE_MASK_NBITS)
105
106/* drivers must ignore base.cmd and base.link_mode_masks_nwords
107 * fields, but they are allowed to overwrite them (will be ignored).
108 */
109struct ethtool_link_ksettings {
110 struct ethtool_link_settings base;
111 struct {
112 __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
113 __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
114 __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);
115 } link_modes;
116};
117
118/**
119 * ethtool_link_ksettings_zero_link_mode - clear link_ksettings link mode mask
120 * @ptr : pointer to struct ethtool_link_ksettings
121 * @name : one of supported/advertising/lp_advertising
122 */
123#define ethtool_link_ksettings_zero_link_mode(ptr, name) \
124 bitmap_zero((ptr)->link_modes.name, __ETHTOOL_LINK_MODE_MASK_NBITS)
125
126/**
127 * ethtool_link_ksettings_add_link_mode - set bit in link_ksettings
128 * link mode mask
129 * @ptr : pointer to struct ethtool_link_ksettings
130 * @name : one of supported/advertising/lp_advertising
131 * @mode : one of the ETHTOOL_LINK_MODE_*_BIT
132 * (not atomic, no bound checking)
133 */
134#define ethtool_link_ksettings_add_link_mode(ptr, name, mode) \
135 __set_bit(ETHTOOL_LINK_MODE_ ## mode ## _BIT, (ptr)->link_modes.name)
136
137/**
138 * ethtool_link_ksettings_test_link_mode - test bit in ksettings link mode mask
139 * @ptr : pointer to struct ethtool_link_ksettings
140 * @name : one of supported/advertising/lp_advertising
141 * @mode : one of the ETHTOOL_LINK_MODE_*_BIT
142 * (not atomic, no bound checking)
143 *
144 * Returns true/false.
145 */
146#define ethtool_link_ksettings_test_link_mode(ptr, name, mode) \
147 test_bit(ETHTOOL_LINK_MODE_ ## mode ## _BIT, (ptr)->link_modes.name)
148
149extern int
150__ethtool_get_link_ksettings(struct net_device *dev,
151 struct ethtool_link_ksettings *link_ksettings);
152
100/** 153/**
101 * struct ethtool_ops - optional netdev operations 154 * struct ethtool_ops - optional netdev operations
102 * @get_settings: Get various device settings including Ethernet link 155 * @get_settings: DEPRECATED, use %get_link_ksettings/%set_link_ksettings
156 * API. Get various device settings including Ethernet link
103 * settings. The @cmd parameter is expected to have been cleared 157 * settings. The @cmd parameter is expected to have been cleared
104 * before get_settings is called. Returns a negative error code or 158 * before get_settings is called. Returns a negative error code
105 * zero. 159 * or zero.
106 * @set_settings: Set various device settings including Ethernet link 160 * @set_settings: DEPRECATED, use %get_link_ksettings/%set_link_ksettings
161 * API. Set various device settings including Ethernet link
107 * settings. Returns a negative error code or zero. 162 * settings. Returns a negative error code or zero.
108 * @get_drvinfo: Report driver/device information. Should only set the 163 * @get_drvinfo: Report driver/device information. Should only set the
109 * @driver, @version, @fw_version and @bus_info fields. If not 164 * @driver, @version, @fw_version and @bus_info fields. If not
@@ -201,6 +256,29 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
201 * @get_module_eeprom: Get the eeprom information from the plug-in module 256 * @get_module_eeprom: Get the eeprom information from the plug-in module
202 * @get_eee: Get Energy-Efficient (EEE) supported and status. 257 * @get_eee: Get Energy-Efficient (EEE) supported and status.
203 * @set_eee: Set EEE status (enable/disable) as well as LPI timers. 258 * @set_eee: Set EEE status (enable/disable) as well as LPI timers.
259 * @get_per_queue_coalesce: Get interrupt coalescing parameters per queue.
260 * It must check that the given queue number is valid. If neither a RX nor
261 * a TX queue has this number, return -EINVAL. If only a RX queue or a TX
262 * queue has this number, set the inapplicable fields to ~0 and return 0.
263 * Returns a negative error code or zero.
264 * @set_per_queue_coalesce: Set interrupt coalescing parameters per queue.
265 * It must check that the given queue number is valid. If neither a RX nor
266 * a TX queue has this number, return -EINVAL. If only a RX queue or a TX
267 * queue has this number, ignore the inapplicable fields.
268 * Returns a negative error code or zero.
269 * @get_link_ksettings: When defined, takes precedence over the
270 * %get_settings method. Get various device settings
271 * including Ethernet link settings. The %cmd and
272 * %link_mode_masks_nwords fields should be ignored (use
273 * %__ETHTOOL_LINK_MODE_MASK_NBITS instead of the latter), any
274 * change to them will be overwritten by kernel. Returns a
275 * negative error code or zero.
276 * @set_link_ksettings: When defined, takes precedence over the
277 * %set_settings method. Set various device settings including
278 * Ethernet link settings. The %cmd and %link_mode_masks_nwords
279 * fields should be ignored (use %__ETHTOOL_LINK_MODE_MASK_NBITS
280 * instead of the latter), any change to them will be overwritten
281 * by kernel. Returns a negative error code or zero.
204 * 282 *
205 * All operations are optional (i.e. the function pointer may be set 283 * All operations are optional (i.e. the function pointer may be set
206 * to %NULL) and callers must take this into account. Callers must 284 * to %NULL) and callers must take this into account. Callers must
@@ -279,7 +357,13 @@ struct ethtool_ops {
279 const struct ethtool_tunable *, void *); 357 const struct ethtool_tunable *, void *);
280 int (*set_tunable)(struct net_device *, 358 int (*set_tunable)(struct net_device *,
281 const struct ethtool_tunable *, const void *); 359 const struct ethtool_tunable *, const void *);
282 360 int (*get_per_queue_coalesce)(struct net_device *, u32,
283 361 struct ethtool_coalesce *);
362 int (*set_per_queue_coalesce)(struct net_device *, u32,
363 struct ethtool_coalesce *);
364 int (*get_link_ksettings)(struct net_device *,
365 struct ethtool_link_ksettings *);
366 int (*set_link_ksettings)(struct net_device *,
367 const struct ethtool_link_ksettings *);
284}; 368};
285#endif /* _LINUX_ETHTOOL_H */ 369#endif /* _LINUX_ETHTOOL_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 452c0b0d2f32..3b1f6cef9513 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -163,6 +163,14 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
163/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */ 163/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
164#define IEEE80211_MAX_FRAME_LEN 2352 164#define IEEE80211_MAX_FRAME_LEN 2352
165 165
166/* Maximal size of an A-MSDU */
167#define IEEE80211_MAX_MPDU_LEN_HT_3839 3839
168#define IEEE80211_MAX_MPDU_LEN_HT_7935 7935
169
170#define IEEE80211_MAX_MPDU_LEN_VHT_3895 3895
171#define IEEE80211_MAX_MPDU_LEN_VHT_7991 7991
172#define IEEE80211_MAX_MPDU_LEN_VHT_11454 11454
173
166#define IEEE80211_MAX_SSID_LEN 32 174#define IEEE80211_MAX_SSID_LEN 32
167 175
168#define IEEE80211_MAX_MESH_ID_LEN 32 176#define IEEE80211_MAX_MESH_ID_LEN 32
@@ -843,6 +851,8 @@ enum ieee80211_vht_opmode_bits {
843}; 851};
844 852
845#define WLAN_SA_QUERY_TR_ID_LEN 2 853#define WLAN_SA_QUERY_TR_ID_LEN 2
854#define WLAN_MEMBERSHIP_LEN 8
855#define WLAN_USER_POSITION_LEN 16
846 856
847/** 857/**
848 * struct ieee80211_tpc_report_ie 858 * struct ieee80211_tpc_report_ie
@@ -991,6 +1001,11 @@ struct ieee80211_mgmt {
991 } __packed vht_opmode_notif; 1001 } __packed vht_opmode_notif;
992 struct { 1002 struct {
993 u8 action_code; 1003 u8 action_code;
1004 u8 membership[WLAN_MEMBERSHIP_LEN];
1005 u8 position[WLAN_USER_POSITION_LEN];
1006 } __packed vht_group_notif;
1007 struct {
1008 u8 action_code;
994 u8 dialog_token; 1009 u8 dialog_token;
995 u8 tpc_elem_id; 1010 u8 tpc_elem_id;
996 u8 tpc_elem_length; 1011 u8 tpc_elem_length;
@@ -1498,6 +1513,7 @@ struct ieee80211_vht_operation {
1498#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 1513#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000
1499#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 1514#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001
1500#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 1515#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002
1516#define IEEE80211_VHT_CAP_MAX_MPDU_MASK 0x00000003
1501#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004 1517#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004
1502#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008 1518#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008
1503#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK 0x0000000C 1519#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK 0x0000000C
@@ -2079,6 +2095,16 @@ enum ieee80211_tdls_actioncode {
2079#define WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED BIT(5) 2095#define WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED BIT(5)
2080#define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6) 2096#define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6)
2081 2097
2098/* Defines the maximal number of MSDUs in an A-MSDU. */
2099#define WLAN_EXT_CAPA8_MAX_MSDU_IN_AMSDU_LSB BIT(7)
2100#define WLAN_EXT_CAPA9_MAX_MSDU_IN_AMSDU_MSB BIT(0)
2101
2102/*
2103 * Fine Timing Measurement Initiator - bit 71 of @WLAN_EID_EXT_CAPABILITY
2104 * information element
2105 */
2106#define WLAN_EXT_CAPA9_FTM_INITIATOR BIT(7)
2107
2082/* TDLS specific payload type in the LLC/SNAP header */ 2108/* TDLS specific payload type in the LLC/SNAP header */
2083#define WLAN_TDLS_SNAP_RFTYPE 0x2 2109#define WLAN_TDLS_SNAP_RFTYPE 0x2
2084 2110
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index a338a688ee4a..dcb89e3515db 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -46,10 +46,6 @@ struct br_ip_list {
46#define BR_LEARNING_SYNC BIT(9) 46#define BR_LEARNING_SYNC BIT(9)
47#define BR_PROXYARP_WIFI BIT(10) 47#define BR_PROXYARP_WIFI BIT(10)
48 48
49/* values as per ieee8021QBridgeFdbAgingTime */
50#define BR_MIN_AGEING_TIME (10 * HZ)
51#define BR_MAX_AGEING_TIME (1000000 * HZ)
52
53#define BR_DEFAULT_AGEING_TIME (300 * HZ) 49#define BR_DEFAULT_AGEING_TIME (300 * HZ)
54 50
55extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 51extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index b84e49c3a738..174f43f43aff 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -24,6 +24,7 @@ struct team_pcpu_stats {
24 struct u64_stats_sync syncp; 24 struct u64_stats_sync syncp;
25 u32 rx_dropped; 25 u32 rx_dropped;
26 u32 tx_dropped; 26 u32 tx_dropped;
27 u32 rx_nohandler;
27}; 28};
28 29
29struct team; 30struct team;
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 9c9de11549a7..12f6fba6d21a 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -37,11 +37,6 @@ static inline struct igmpv3_query *
37 return (struct igmpv3_query *)skb_transport_header(skb); 37 return (struct igmpv3_query *)skb_transport_header(skb);
38} 38}
39 39
40extern int sysctl_igmp_llm_reports;
41extern int sysctl_igmp_max_memberships;
42extern int sysctl_igmp_max_msf;
43extern int sysctl_igmp_qrv;
44
45struct ip_sf_socklist { 40struct ip_sf_socklist {
46 unsigned int sl_max; 41 unsigned int sl_max;
47 unsigned int sl_count; 42 unsigned int sl_count;
diff --git a/include/linux/inet_lro.h b/include/linux/inet_lro.h
deleted file mode 100644
index 9a715cfa1fe3..000000000000
--- a/include/linux/inet_lro.h
+++ /dev/null
@@ -1,142 +0,0 @@
1/*
2 * linux/include/linux/inet_lro.h
3 *
4 * Large Receive Offload (ipv4 / tcp)
5 *
6 * (C) Copyright IBM Corp. 2007
7 *
8 * Authors:
9 * Jan-Bernd Themann <themann@de.ibm.com>
10 * Christoph Raisch <raisch@de.ibm.com>
11 *
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
16 * any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28#ifndef __INET_LRO_H_
29#define __INET_LRO_H_
30
31#include <net/ip.h>
32#include <net/tcp.h>
33
34/*
35 * LRO statistics
36 */
37
38struct net_lro_stats {
39 unsigned long aggregated;
40 unsigned long flushed;
41 unsigned long no_desc;
42};
43
44/*
45 * LRO descriptor for a tcp session
46 */
47struct net_lro_desc {
48 struct sk_buff *parent;
49 struct sk_buff *last_skb;
50 struct skb_frag_struct *next_frag;
51 struct iphdr *iph;
52 struct tcphdr *tcph;
53 __wsum data_csum;
54 __be32 tcp_rcv_tsecr;
55 __be32 tcp_rcv_tsval;
56 __be32 tcp_ack;
57 u32 tcp_next_seq;
58 u32 skb_tot_frags_len;
59 u16 ip_tot_len;
60 u16 tcp_saw_tstamp; /* timestamps enabled */
61 __be16 tcp_window;
62 int pkt_aggr_cnt; /* counts aggregated packets */
63 int vlan_packet;
64 int mss;
65 int active;
66};
67
68/*
69 * Large Receive Offload (LRO) Manager
70 *
71 * Fields must be set by driver
72 */
73
74struct net_lro_mgr {
75 struct net_device *dev;
76 struct net_lro_stats stats;
77
78 /* LRO features */
79 unsigned long features;
80#define LRO_F_NAPI 1 /* Pass packets to stack via NAPI */
81#define LRO_F_EXTRACT_VLAN_ID 2 /* Set flag if VLAN IDs are extracted
82 from received packets and eth protocol
83 is still ETH_P_8021Q */
84
85 /*
86 * Set for generated SKBs that are not added to
87 * the frag list in fragmented mode
88 */
89 u32 ip_summed;
90 u32 ip_summed_aggr; /* Set in aggregated SKBs: CHECKSUM_UNNECESSARY
91 * or CHECKSUM_NONE */
92
93 int max_desc; /* Max number of LRO descriptors */
94 int max_aggr; /* Max number of LRO packets to be aggregated */
95
96 int frag_align_pad; /* Padding required to properly align layer 3
97 * headers in generated skb when using frags */
98
99 struct net_lro_desc *lro_arr; /* Array of LRO descriptors */
100
101 /*
102 * Optimized driver functions
103 *
104 * get_skb_header: returns tcp and ip header for packet in SKB
105 */
106 int (*get_skb_header)(struct sk_buff *skb, void **ip_hdr,
107 void **tcpudp_hdr, u64 *hdr_flags, void *priv);
108
109 /* hdr_flags: */
110#define LRO_IPV4 1 /* ip_hdr is IPv4 header */
111#define LRO_TCP 2 /* tcpudp_hdr is TCP header */
112
113 /*
114 * get_frag_header: returns mac, tcp and ip header for packet in SKB
115 *
116 * @hdr_flags: Indicate what kind of LRO has to be done
117 * (IPv4/IPv6/TCP/UDP)
118 */
119 int (*get_frag_header)(struct skb_frag_struct *frag, void **mac_hdr,
120 void **ip_hdr, void **tcpudp_hdr, u64 *hdr_flags,
121 void *priv);
122};
123
124/*
125 * Processes a SKB
126 *
127 * @lro_mgr: LRO manager to use
128 * @skb: SKB to aggregate
129 * @priv: Private data that may be used by driver functions
130 * (for example get_tcp_ip_hdr)
131 */
132
133void lro_receive_skb(struct net_lro_mgr *lro_mgr,
134 struct sk_buff *skb,
135 void *priv);
136/*
137 * Forward all aggregated SKBs held by lro_mgr to network stack
138 */
139
140void lro_flush_all(struct net_lro_mgr *lro_mgr);
141
142#endif
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 402753bccafa..7edc14fb66b6 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -50,16 +50,19 @@ struct ipv6_devconf {
50 __s32 mc_forwarding; 50 __s32 mc_forwarding;
51#endif 51#endif
52 __s32 disable_ipv6; 52 __s32 disable_ipv6;
53 __s32 drop_unicast_in_l2_multicast;
53 __s32 accept_dad; 54 __s32 accept_dad;
54 __s32 force_tllao; 55 __s32 force_tllao;
55 __s32 ndisc_notify; 56 __s32 ndisc_notify;
56 __s32 suppress_frag_ndisc; 57 __s32 suppress_frag_ndisc;
57 __s32 accept_ra_mtu; 58 __s32 accept_ra_mtu;
59 __s32 drop_unsolicited_na;
58 struct ipv6_stable_secret { 60 struct ipv6_stable_secret {
59 bool initialized; 61 bool initialized;
60 struct in6_addr secret; 62 struct in6_addr secret;
61 } stable_secret; 63 } stable_secret;
62 __s32 use_oif_addrs_only; 64 __s32 use_oif_addrs_only;
65 __s32 keep_addr_on_down;
63 void *sysctl; 66 void *sysctl;
64}; 67};
65 68
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index f4fa2b29c38c..b82646ee70eb 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -64,7 +64,7 @@
64#define round_down(x, y) ((x) & ~__round_mask(x, y)) 64#define round_down(x, y) ((x) & ~__round_mask(x, y))
65 65
66#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 66#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
67#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 67#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
68#define DIV_ROUND_UP_ULL(ll,d) \ 68#define DIV_ROUND_UP_ULL(ll,d) \
69 ({ unsigned long long _tmp = (ll)+(d)-1; do_div(_tmp, d); _tmp; }) 69 ({ unsigned long long _tmp = (ll)+(d)-1; do_div(_tmp, d); _tmp; })
70 70
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index 1f7bc630d225..ea34a867caa0 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -69,6 +69,9 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(vo
69int mvebu_mbus_save_cpu_target(u32 *store_addr); 69int mvebu_mbus_save_cpu_target(u32 *store_addr);
70void mvebu_mbus_get_pcie_mem_aperture(struct resource *res); 70void mvebu_mbus_get_pcie_mem_aperture(struct resource *res);
71void mvebu_mbus_get_pcie_io_aperture(struct resource *res); 71void mvebu_mbus_get_pcie_io_aperture(struct resource *res);
72int mvebu_mbus_get_dram_win_info(phys_addr_t phyaddr, u8 *target, u8 *attr);
73int mvebu_mbus_get_io_win_info(phys_addr_t phyaddr, u32 *size, u8 *target,
74 u8 *attr);
72int mvebu_mbus_add_window_remap_by_id(unsigned int target, 75int mvebu_mbus_add_window_remap_by_id(unsigned int target,
73 unsigned int attribute, 76 unsigned int attribute,
74 phys_addr_t base, size_t size, 77 phys_addr_t base, size_t size,
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index 2e8af001c5da..bd0e7075ea6d 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -33,6 +33,7 @@
33#ifndef MLX4_DRIVER_H 33#ifndef MLX4_DRIVER_H
34#define MLX4_DRIVER_H 34#define MLX4_DRIVER_H
35 35
36#include <net/devlink.h>
36#include <linux/mlx4/device.h> 37#include <linux/mlx4/device.h>
37 38
38struct mlx4_dev; 39struct mlx4_dev;
@@ -89,6 +90,8 @@ int mlx4_port_map_set(struct mlx4_dev *dev, struct mlx4_port_map *v2p);
89 90
90void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port); 91void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port);
91 92
93struct devlink_port *mlx4_get_devlink_port(struct mlx4_dev *dev, int port);
94
92static inline u64 mlx4_mac_to_u64(u8 *addr) 95static inline u64 mlx4_mac_to_u64(u8 *addr)
93{ 96{
94 u64 mac = 0; 97 u64 mac = 0;
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 9566b3b3b2c5..02ac3000ee3c 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -374,6 +374,12 @@ enum {
374}; 374};
375 375
376enum { 376enum {
377 MLX5_BW_NO_LIMIT = 0,
378 MLX5_100_MBPS_UNIT = 3,
379 MLX5_GBPS_UNIT = 4,
380};
381
382enum {
377 MLX5_MAX_PAGE_SHIFT = 31 383 MLX5_MAX_PAGE_SHIFT = 31
378}; 384};
379 385
@@ -1200,6 +1206,17 @@ enum {
1200 MLX5_RQC_RQ_TYPE_MEMORY_RQ_RPM = 0x1, 1206 MLX5_RQC_RQ_TYPE_MEMORY_RQ_RPM = 0x1,
1201}; 1207};
1202 1208
1209enum mlx5_wol_mode {
1210 MLX5_WOL_DISABLE = 0,
1211 MLX5_WOL_SECURED_MAGIC = 1 << 1,
1212 MLX5_WOL_MAGIC = 1 << 2,
1213 MLX5_WOL_ARP = 1 << 3,
1214 MLX5_WOL_BROADCAST = 1 << 4,
1215 MLX5_WOL_MULTICAST = 1 << 5,
1216 MLX5_WOL_UNICAST = 1 << 6,
1217 MLX5_WOL_PHY_ACTIVITY = 1 << 7,
1218};
1219
1203/* MLX5 DEV CAPs */ 1220/* MLX5 DEV CAPs */
1204 1221
1205/* TODO: EAT.ME */ 1222/* TODO: EAT.ME */
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 9108904a6a56..3a954465b2bf 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -54,7 +54,7 @@ enum {
54 /* one minute for the sake of bringup. Generally, commands must always 54 /* one minute for the sake of bringup. Generally, commands must always
55 * complete and we may need to increase this timeout value 55 * complete and we may need to increase this timeout value
56 */ 56 */
57 MLX5_CMD_TIMEOUT_MSEC = 7200 * 1000, 57 MLX5_CMD_TIMEOUT_MSEC = 60 * 1000,
58 MLX5_CMD_WQ_MAX_NAME = 32, 58 MLX5_CMD_WQ_MAX_NAME = 32,
59}; 59};
60 60
@@ -99,6 +99,8 @@ enum {
99}; 99};
100 100
101enum { 101enum {
102 MLX5_REG_QETCR = 0x4005,
103 MLX5_REG_QTCT = 0x400a,
102 MLX5_REG_PCAP = 0x5001, 104 MLX5_REG_PCAP = 0x5001,
103 MLX5_REG_PMTU = 0x5003, 105 MLX5_REG_PMTU = 0x5003,
104 MLX5_REG_PTYS = 0x5004, 106 MLX5_REG_PTYS = 0x5004,
@@ -458,8 +460,6 @@ struct mlx5_priv {
458 struct mlx5_uuar_info uuari; 460 struct mlx5_uuar_info uuari;
459 MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); 461 MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock);
460 462
461 struct io_mapping *bf_mapping;
462
463 /* pages stuff */ 463 /* pages stuff */
464 struct workqueue_struct *pg_wq; 464 struct workqueue_struct *pg_wq;
465 struct rb_root page_root; 465 struct rb_root page_root;
@@ -717,7 +717,8 @@ int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn);
717int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn); 717int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn);
718int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari); 718int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
719int mlx5_free_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari); 719int mlx5_free_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
720int mlx5_alloc_map_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar); 720int mlx5_alloc_map_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar,
721 bool map_wc);
721void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar); 722void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar);
722void mlx5_health_cleanup(struct mlx5_core_dev *dev); 723void mlx5_health_cleanup(struct mlx5_core_dev *dev);
723int mlx5_health_init(struct mlx5_core_dev *dev); 724int mlx5_health_init(struct mlx5_core_dev *dev);
@@ -796,37 +797,6 @@ int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in,
796 int size_in, void *data_out, int size_out, 797 int size_in, void *data_out, int size_out,
797 u16 reg_num, int arg, int write); 798 u16 reg_num, int arg, int write);
798 799
799int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps);
800int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys,
801 int ptys_size, int proto_mask, u8 local_port);
802int mlx5_query_port_proto_cap(struct mlx5_core_dev *dev,
803 u32 *proto_cap, int proto_mask);
804int mlx5_query_port_proto_admin(struct mlx5_core_dev *dev,
805 u32 *proto_admin, int proto_mask);
806int mlx5_query_port_link_width_oper(struct mlx5_core_dev *dev,
807 u8 *link_width_oper, u8 local_port);
808int mlx5_query_port_proto_oper(struct mlx5_core_dev *dev,
809 u8 *proto_oper, int proto_mask,
810 u8 local_port);
811int mlx5_set_port_proto(struct mlx5_core_dev *dev, u32 proto_admin,
812 int proto_mask);
813int mlx5_set_port_admin_status(struct mlx5_core_dev *dev,
814 enum mlx5_port_status status);
815int mlx5_query_port_admin_status(struct mlx5_core_dev *dev,
816 enum mlx5_port_status *status);
817
818int mlx5_set_port_mtu(struct mlx5_core_dev *dev, int mtu, u8 port);
819void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, int *max_mtu, u8 port);
820void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, int *oper_mtu,
821 u8 port);
822
823int mlx5_query_port_vl_hw_cap(struct mlx5_core_dev *dev,
824 u8 *vl_hw_cap, u8 local_port);
825
826int mlx5_set_port_pause(struct mlx5_core_dev *dev, u32 rx_pause, u32 tx_pause);
827int mlx5_query_port_pause(struct mlx5_core_dev *dev,
828 u32 *rx_pause, u32 *tx_pause);
829
830int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq); 800int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
831void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq); 801void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
832int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq, 802int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 9b8a02b7880f..e52730e01ed6 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -166,6 +166,8 @@ enum {
166 MLX5_CMD_OP_SET_L2_TABLE_ENTRY = 0x829, 166 MLX5_CMD_OP_SET_L2_TABLE_ENTRY = 0x829,
167 MLX5_CMD_OP_QUERY_L2_TABLE_ENTRY = 0x82a, 167 MLX5_CMD_OP_QUERY_L2_TABLE_ENTRY = 0x82a,
168 MLX5_CMD_OP_DELETE_L2_TABLE_ENTRY = 0x82b, 168 MLX5_CMD_OP_DELETE_L2_TABLE_ENTRY = 0x82b,
169 MLX5_CMD_OP_SET_WOL_ROL = 0x830,
170 MLX5_CMD_OP_QUERY_WOL_ROL = 0x831,
169 MLX5_CMD_OP_CREATE_TIR = 0x900, 171 MLX5_CMD_OP_CREATE_TIR = 0x900,
170 MLX5_CMD_OP_MODIFY_TIR = 0x901, 172 MLX5_CMD_OP_MODIFY_TIR = 0x901,
171 MLX5_CMD_OP_DESTROY_TIR = 0x902, 173 MLX5_CMD_OP_DESTROY_TIR = 0x902,
@@ -730,7 +732,19 @@ struct mlx5_ifc_cmd_hca_cap_bits {
730 732
731 u8 reserved_at_1bf[0x3]; 733 u8 reserved_at_1bf[0x3];
732 u8 log_max_msg[0x5]; 734 u8 log_max_msg[0x5];
733 u8 reserved_at_1c7[0x18]; 735 u8 reserved_at_1c7[0x4];
736 u8 max_tc[0x4];
737 u8 reserved_at_1cf[0x6];
738 u8 rol_s[0x1];
739 u8 rol_g[0x1];
740 u8 reserved_at_1d7[0x1];
741 u8 wol_s[0x1];
742 u8 wol_g[0x1];
743 u8 wol_a[0x1];
744 u8 wol_b[0x1];
745 u8 wol_m[0x1];
746 u8 wol_u[0x1];
747 u8 wol_p[0x1];
734 748
735 u8 stat_rate_support[0x10]; 749 u8 stat_rate_support[0x10];
736 u8 reserved_at_1ef[0xc]; 750 u8 reserved_at_1ef[0xc];
@@ -6911,6 +6925,54 @@ struct mlx5_ifc_mtt_bits {
6911 u8 rd_en[0x1]; 6925 u8 rd_en[0x1];
6912}; 6926};
6913 6927
6928struct mlx5_ifc_query_wol_rol_out_bits {
6929 u8 status[0x8];
6930 u8 reserved_at_8[0x18];
6931
6932 u8 syndrome[0x20];
6933
6934 u8 reserved_at_40[0x10];
6935 u8 rol_mode[0x8];
6936 u8 wol_mode[0x8];
6937
6938 u8 reserved_at_60[0x20];
6939};
6940
6941struct mlx5_ifc_query_wol_rol_in_bits {
6942 u8 opcode[0x10];
6943 u8 reserved_at_10[0x10];
6944
6945 u8 reserved_at_20[0x10];
6946 u8 op_mod[0x10];
6947
6948 u8 reserved_at_40[0x40];
6949};
6950
6951struct mlx5_ifc_set_wol_rol_out_bits {
6952 u8 status[0x8];
6953 u8 reserved_at_8[0x18];
6954
6955 u8 syndrome[0x20];
6956
6957 u8 reserved_at_40[0x40];
6958};
6959
6960struct mlx5_ifc_set_wol_rol_in_bits {
6961 u8 opcode[0x10];
6962 u8 reserved_at_10[0x10];
6963
6964 u8 reserved_at_20[0x10];
6965 u8 op_mod[0x10];
6966
6967 u8 rol_mode_valid[0x1];
6968 u8 wol_mode_valid[0x1];
6969 u8 reserved_at_42[0xe];
6970 u8 rol_mode[0x8];
6971 u8 wol_mode[0x8];
6972
6973 u8 reserved_at_60[0x20];
6974};
6975
6914enum { 6976enum {
6915 MLX5_INITIAL_SEG_NIC_INTERFACE_FULL_DRIVER = 0x0, 6977 MLX5_INITIAL_SEG_NIC_INTERFACE_FULL_DRIVER = 0x0,
6916 MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED = 0x1, 6978 MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED = 0x1,
@@ -7102,4 +7164,49 @@ struct mlx5_ifc_modify_flow_table_in_bits {
7102 u8 reserved_at_100[0x100]; 7164 u8 reserved_at_100[0x100];
7103}; 7165};
7104 7166
7167struct mlx5_ifc_ets_tcn_config_reg_bits {
7168 u8 g[0x1];
7169 u8 b[0x1];
7170 u8 r[0x1];
7171 u8 reserved_at_3[0x9];
7172 u8 group[0x4];
7173 u8 reserved_at_10[0x9];
7174 u8 bw_allocation[0x7];
7175
7176 u8 reserved_at_20[0xc];
7177 u8 max_bw_units[0x4];
7178 u8 reserved_at_30[0x8];
7179 u8 max_bw_value[0x8];
7180};
7181
7182struct mlx5_ifc_ets_global_config_reg_bits {
7183 u8 reserved_at_0[0x2];
7184 u8 r[0x1];
7185 u8 reserved_at_3[0x1d];
7186
7187 u8 reserved_at_20[0xc];
7188 u8 max_bw_units[0x4];
7189 u8 reserved_at_30[0x8];
7190 u8 max_bw_value[0x8];
7191};
7192
7193struct mlx5_ifc_qetc_reg_bits {
7194 u8 reserved_at_0[0x8];
7195 u8 port_number[0x8];
7196 u8 reserved_at_10[0x30];
7197
7198 struct mlx5_ifc_ets_tcn_config_reg_bits tc_configuration[0x8];
7199 struct mlx5_ifc_ets_global_config_reg_bits global_configuration;
7200};
7201
7202struct mlx5_ifc_qtct_reg_bits {
7203 u8 reserved_at_0[0x8];
7204 u8 port_number[0x8];
7205 u8 reserved_at_10[0xd];
7206 u8 prio[0x3];
7207
7208 u8 reserved_at_20[0x1d];
7209 u8 tclass[0x3];
7210};
7211
7105#endif /* MLX5_IFC_H */ 7212#endif /* MLX5_IFC_H */
diff --git a/include/linux/mlx5/port.h b/include/linux/mlx5/port.h
new file mode 100644
index 000000000000..a1d145abd4eb
--- /dev/null
+++ b/include/linux/mlx5/port.h
@@ -0,0 +1,87 @@
1/*
2 * Copyright (c) 2016, Mellanox Technologies. All rights reserved.
3 *
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
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef __MLX5_PORT_H__
34#define __MLX5_PORT_H__
35
36#include <linux/mlx5/driver.h>
37
38int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps);
39int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys,
40 int ptys_size, int proto_mask, u8 local_port);
41int mlx5_query_port_proto_cap(struct mlx5_core_dev *dev,
42 u32 *proto_cap, int proto_mask);
43int mlx5_query_port_proto_admin(struct mlx5_core_dev *dev,
44 u32 *proto_admin, int proto_mask);
45int mlx5_query_port_link_width_oper(struct mlx5_core_dev *dev,
46 u8 *link_width_oper, u8 local_port);
47int mlx5_query_port_proto_oper(struct mlx5_core_dev *dev,
48 u8 *proto_oper, int proto_mask,
49 u8 local_port);
50int mlx5_set_port_proto(struct mlx5_core_dev *dev, u32 proto_admin,
51 int proto_mask);
52int mlx5_set_port_admin_status(struct mlx5_core_dev *dev,
53 enum mlx5_port_status status);
54int mlx5_query_port_admin_status(struct mlx5_core_dev *dev,
55 enum mlx5_port_status *status);
56
57int mlx5_set_port_mtu(struct mlx5_core_dev *dev, int mtu, u8 port);
58void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, int *max_mtu, u8 port);
59void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, int *oper_mtu,
60 u8 port);
61
62int mlx5_query_port_vl_hw_cap(struct mlx5_core_dev *dev,
63 u8 *vl_hw_cap, u8 local_port);
64
65int mlx5_set_port_pause(struct mlx5_core_dev *dev, u32 rx_pause, u32 tx_pause);
66int mlx5_query_port_pause(struct mlx5_core_dev *dev,
67 u32 *rx_pause, u32 *tx_pause);
68
69int mlx5_set_port_pfc(struct mlx5_core_dev *dev, u8 pfc_en_tx, u8 pfc_en_rx);
70int mlx5_query_port_pfc(struct mlx5_core_dev *dev, u8 *pfc_en_tx,
71 u8 *pfc_en_rx);
72
73int mlx5_max_tc(struct mlx5_core_dev *mdev);
74
75int mlx5_set_port_prio_tc(struct mlx5_core_dev *mdev, u8 *prio_tc);
76int mlx5_set_port_tc_group(struct mlx5_core_dev *mdev, u8 *tc_group);
77int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *tc_bw);
78int mlx5_modify_port_ets_rate_limit(struct mlx5_core_dev *mdev,
79 u8 *max_bw_value,
80 u8 *max_bw_unit);
81int mlx5_query_port_ets_rate_limit(struct mlx5_core_dev *mdev,
82 u8 *max_bw_value,
83 u8 *max_bw_unit);
84int mlx5_set_port_wol(struct mlx5_core_dev *mdev, u8 wol_mode);
85int mlx5_query_port_wol(struct mlx5_core_dev *mdev, u8 *wol_mode);
86
87#endif /* __MLX5_PORT_H__ */
diff --git a/include/linux/net.h b/include/linux/net.h
index 0b4ac7da583a..49175e4ced11 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -215,6 +215,7 @@ int __sock_create(struct net *net, int family, int type, int proto,
215int sock_create(int family, int type, int proto, struct socket **res); 215int sock_create(int family, int type, int proto, struct socket **res);
216int sock_create_kern(struct net *net, int family, int type, int proto, struct socket **res); 216int sock_create_kern(struct net *net, int family, int type, int proto, struct socket **res);
217int sock_create_lite(int family, int type, int proto, struct socket **res); 217int sock_create_lite(int family, int type, int proto, struct socket **res);
218struct socket *sock_alloc(void);
218void sock_release(struct socket *sock); 219void sock_release(struct socket *sock);
219int sock_sendmsg(struct socket *sock, struct msghdr *msg); 220int sock_sendmsg(struct socket *sock, struct msghdr *msg);
220int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, 221int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index d9654f0eecb3..a734bf43d190 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -67,6 +67,8 @@ enum {
67 NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in Hardware */ 67 NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in Hardware */
68 NETIF_F_BUSY_POLL_BIT, /* Busy poll */ 68 NETIF_F_BUSY_POLL_BIT, /* Busy poll */
69 69
70 NETIF_F_HW_TC_BIT, /* Offload TC infrastructure */
71
70 /* 72 /*
71 * Add your fresh new feature above and remember to update 73 * Add your fresh new feature above and remember to update
72 * netdev_features_strings[] in net/core/ethtool.c and maybe 74 * netdev_features_strings[] in net/core/ethtool.c and maybe
@@ -124,6 +126,7 @@ enum {
124#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 126#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
125#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD) 127#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD)
126#define NETIF_F_BUSY_POLL __NETIF_F(BUSY_POLL) 128#define NETIF_F_BUSY_POLL __NETIF_F(BUSY_POLL)
129#define NETIF_F_HW_TC __NETIF_F(HW_TC)
127 130
128#define for_each_netdev_feature(mask_addr, bit) \ 131#define for_each_netdev_feature(mask_addr, bit) \
129 for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT) 132 for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5440b7b705eb..be693b34662f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -51,6 +51,7 @@
51#include <linux/neighbour.h> 51#include <linux/neighbour.h>
52#include <uapi/linux/netdevice.h> 52#include <uapi/linux/netdevice.h>
53#include <uapi/linux/if_bonding.h> 53#include <uapi/linux/if_bonding.h>
54#include <uapi/linux/pkt_cls.h>
54 55
55struct netpoll_info; 56struct netpoll_info;
56struct device; 57struct device;
@@ -267,6 +268,7 @@ struct header_ops {
267 void (*cache_update)(struct hh_cache *hh, 268 void (*cache_update)(struct hh_cache *hh,
268 const struct net_device *dev, 269 const struct net_device *dev,
269 const unsigned char *haddr); 270 const unsigned char *haddr);
271 bool (*validate)(const char *ll_header, unsigned int len);
270}; 272};
271 273
272/* These flag bits are private to the generic network queueing 274/* These flag bits are private to the generic network queueing
@@ -778,6 +780,27 @@ static inline bool netdev_phys_item_id_same(struct netdev_phys_item_id *a,
778typedef u16 (*select_queue_fallback_t)(struct net_device *dev, 780typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
779 struct sk_buff *skb); 781 struct sk_buff *skb);
780 782
783/* These structures hold the attributes of qdisc and classifiers
784 * that are being passed to the netdevice through the setup_tc op.
785 */
786enum {
787 TC_SETUP_MQPRIO,
788 TC_SETUP_CLSU32,
789 TC_SETUP_CLSFLOWER,
790};
791
792struct tc_cls_u32_offload;
793
794struct tc_to_netdev {
795 unsigned int type;
796 union {
797 u8 tc;
798 struct tc_cls_u32_offload *cls_u32;
799 struct tc_cls_flower_offload *cls_flower;
800 };
801};
802
803
781/* 804/*
782 * This structure defines the management hooks for network devices. 805 * This structure defines the management hooks for network devices.
783 * The following hooks can be defined; unless noted otherwise, they are 806 * The following hooks can be defined; unless noted otherwise, they are
@@ -1073,6 +1096,12 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
1073 * This function is used to get egress tunnel information for given skb. 1096 * This function is used to get egress tunnel information for given skb.
1074 * This is useful for retrieving outer tunnel header parameters while 1097 * This is useful for retrieving outer tunnel header parameters while
1075 * sampling packet. 1098 * sampling packet.
1099 * void (*ndo_set_rx_headroom)(struct net_device *dev, int needed_headroom);
1100 * This function is used to specify the headroom that the skb must
1101 * consider when allocation skb during packet reception. Setting
1102 * appropriate rx headroom value allows avoiding skb head copy on
1103 * forward. Setting a negative value reset the rx headroom to the
1104 * default value.
1076 * 1105 *
1077 */ 1106 */
1078struct net_device_ops { 1107struct net_device_ops {
@@ -1150,7 +1179,10 @@ struct net_device_ops {
1150 int (*ndo_set_vf_rss_query_en)( 1179 int (*ndo_set_vf_rss_query_en)(
1151 struct net_device *dev, 1180 struct net_device *dev,
1152 int vf, bool setting); 1181 int vf, bool setting);
1153 int (*ndo_setup_tc)(struct net_device *dev, u8 tc); 1182 int (*ndo_setup_tc)(struct net_device *dev,
1183 u32 handle,
1184 __be16 protocol,
1185 struct tc_to_netdev *tc);
1154#if IS_ENABLED(CONFIG_FCOE) 1186#if IS_ENABLED(CONFIG_FCOE)
1155 int (*ndo_fcoe_enable)(struct net_device *dev); 1187 int (*ndo_fcoe_enable)(struct net_device *dev);
1156 int (*ndo_fcoe_disable)(struct net_device *dev); 1188 int (*ndo_fcoe_disable)(struct net_device *dev);
@@ -1255,6 +1287,8 @@ struct net_device_ops {
1255 bool proto_down); 1287 bool proto_down);
1256 int (*ndo_fill_metadata_dst)(struct net_device *dev, 1288 int (*ndo_fill_metadata_dst)(struct net_device *dev,
1257 struct sk_buff *skb); 1289 struct sk_buff *skb);
1290 void (*ndo_set_rx_headroom)(struct net_device *dev,
1291 int needed_headroom);
1258}; 1292};
1259 1293
1260/** 1294/**
@@ -1291,6 +1325,10 @@ struct net_device_ops {
1291 * @IFF_OPENVSWITCH: device is a Open vSwitch master 1325 * @IFF_OPENVSWITCH: device is a Open vSwitch master
1292 * @IFF_L3MDEV_SLAVE: device is enslaved to an L3 master device 1326 * @IFF_L3MDEV_SLAVE: device is enslaved to an L3 master device
1293 * @IFF_TEAM: device is a team device 1327 * @IFF_TEAM: device is a team device
1328 * @IFF_RXFH_CONFIGURED: device has had Rx Flow indirection table configured
1329 * @IFF_PHONY_HEADROOM: the headroom value is controlled by an external
1330 * entity (i.e. the master device for bridged veth)
1331 * @IFF_MACSEC: device is a MACsec device
1294 */ 1332 */
1295enum netdev_priv_flags { 1333enum netdev_priv_flags {
1296 IFF_802_1Q_VLAN = 1<<0, 1334 IFF_802_1Q_VLAN = 1<<0,
@@ -1318,6 +1356,9 @@ enum netdev_priv_flags {
1318 IFF_OPENVSWITCH = 1<<22, 1356 IFF_OPENVSWITCH = 1<<22,
1319 IFF_L3MDEV_SLAVE = 1<<23, 1357 IFF_L3MDEV_SLAVE = 1<<23,
1320 IFF_TEAM = 1<<24, 1358 IFF_TEAM = 1<<24,
1359 IFF_RXFH_CONFIGURED = 1<<25,
1360 IFF_PHONY_HEADROOM = 1<<26,
1361 IFF_MACSEC = 1<<27,
1321}; 1362};
1322 1363
1323#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN 1364#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1345,6 +1386,8 @@ enum netdev_priv_flags {
1345#define IFF_OPENVSWITCH IFF_OPENVSWITCH 1386#define IFF_OPENVSWITCH IFF_OPENVSWITCH
1346#define IFF_L3MDEV_SLAVE IFF_L3MDEV_SLAVE 1387#define IFF_L3MDEV_SLAVE IFF_L3MDEV_SLAVE
1347#define IFF_TEAM IFF_TEAM 1388#define IFF_TEAM IFF_TEAM
1389#define IFF_RXFH_CONFIGURED IFF_RXFH_CONFIGURED
1390#define IFF_MACSEC IFF_MACSEC
1348 1391
1349/** 1392/**
1350 * struct net_device - The DEVICE structure. 1393 * struct net_device - The DEVICE structure.
@@ -1397,6 +1440,8 @@ enum netdev_priv_flags {
1397 * do not use this in drivers 1440 * do not use this in drivers
1398 * @tx_dropped: Dropped packets by core network, 1441 * @tx_dropped: Dropped packets by core network,
1399 * do not use this in drivers 1442 * do not use this in drivers
1443 * @rx_nohandler: nohandler dropped packets by core network on
1444 * inactive devices, do not use this in drivers
1400 * 1445 *
1401 * @wireless_handlers: List of functions to handle Wireless Extensions, 1446 * @wireless_handlers: List of functions to handle Wireless Extensions,
1402 * instead of ioctl, 1447 * instead of ioctl,
@@ -1420,8 +1465,7 @@ enum netdev_priv_flags {
1420 * @dma: DMA channel 1465 * @dma: DMA channel
1421 * @mtu: Interface MTU value 1466 * @mtu: Interface MTU value
1422 * @type: Interface hardware type 1467 * @type: Interface hardware type
1423 * @hard_header_len: Hardware header length, which means that this is the 1468 * @hard_header_len: Maximum hardware header length.
1424 * minimum size of a packet.
1425 * 1469 *
1426 * @needed_headroom: Extra headroom the hardware may need, but not in all 1470 * @needed_headroom: Extra headroom the hardware may need, but not in all
1427 * cases can this be guaranteed 1471 * cases can this be guaranteed
@@ -1611,6 +1655,7 @@ struct net_device {
1611 1655
1612 atomic_long_t rx_dropped; 1656 atomic_long_t rx_dropped;
1613 atomic_long_t tx_dropped; 1657 atomic_long_t tx_dropped;
1658 atomic_long_t rx_nohandler;
1614 1659
1615#ifdef CONFIG_WIRELESS_EXT 1660#ifdef CONFIG_WIRELESS_EXT
1616 const struct iw_handler_def * wireless_handlers; 1661 const struct iw_handler_def * wireless_handlers;
@@ -1908,6 +1953,26 @@ struct netdev_queue *netdev_pick_tx(struct net_device *dev,
1908 struct sk_buff *skb, 1953 struct sk_buff *skb,
1909 void *accel_priv); 1954 void *accel_priv);
1910 1955
1956/* returns the headroom that the master device needs to take in account
1957 * when forwarding to this dev
1958 */
1959static inline unsigned netdev_get_fwd_headroom(struct net_device *dev)
1960{
1961 return dev->priv_flags & IFF_PHONY_HEADROOM ? 0 : dev->needed_headroom;
1962}
1963
1964static inline void netdev_set_rx_headroom(struct net_device *dev, int new_hr)
1965{
1966 if (dev->netdev_ops->ndo_set_rx_headroom)
1967 dev->netdev_ops->ndo_set_rx_headroom(dev, new_hr);
1968}
1969
1970/* set the device rx headroom to the dev's default */
1971static inline void netdev_reset_rx_headroom(struct net_device *dev)
1972{
1973 netdev_set_rx_headroom(dev, -1);
1974}
1975
1911/* 1976/*
1912 * Net namespace inlines 1977 * Net namespace inlines
1913 */ 1978 */
@@ -2627,6 +2692,24 @@ static inline int dev_parse_header(const struct sk_buff *skb,
2627 return dev->header_ops->parse(skb, haddr); 2692 return dev->header_ops->parse(skb, haddr);
2628} 2693}
2629 2694
2695/* ll_header must have at least hard_header_len allocated */
2696static inline bool dev_validate_header(const struct net_device *dev,
2697 char *ll_header, int len)
2698{
2699 if (likely(len >= dev->hard_header_len))
2700 return true;
2701
2702 if (capable(CAP_SYS_RAWIO)) {
2703 memset(ll_header + len, 0, dev->hard_header_len - len);
2704 return true;
2705 }
2706
2707 if (dev->header_ops && dev->header_ops->validate)
2708 return dev->header_ops->validate(ll_header, len);
2709
2710 return false;
2711}
2712
2630typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); 2713typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
2631int register_gifconf(unsigned int family, gifconf_func_t *gifconf); 2714int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
2632static inline int unregister_gifconf(unsigned int family) 2715static inline int unregister_gifconf(unsigned int family)
@@ -3741,7 +3824,7 @@ void netdev_lower_state_changed(struct net_device *lower_dev,
3741 3824
3742/* RSS keys are 40 or 52 bytes long */ 3825/* RSS keys are 40 or 52 bytes long */
3743#define NETDEV_RSS_KEY_LEN 52 3826#define NETDEV_RSS_KEY_LEN 52
3744extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN]; 3827extern u8 netdev_rss_key[NETDEV_RSS_KEY_LEN] __read_mostly;
3745void netdev_rss_key_fill(void *buffer, size_t len); 3828void netdev_rss_key_fill(void *buffer, size_t len);
3746 3829
3747int dev_get_nest_level(struct net_device *dev, 3830int dev_get_nest_level(struct net_device *dev,
@@ -3965,6 +4048,11 @@ static inline void skb_gso_error_unwind(struct sk_buff *skb, __be16 protocol,
3965 skb->mac_len = mac_len; 4048 skb->mac_len = mac_len;
3966} 4049}
3967 4050
4051static inline bool netif_is_macsec(const struct net_device *dev)
4052{
4053 return dev->priv_flags & IFF_MACSEC;
4054}
4055
3968static inline bool netif_is_macvlan(const struct net_device *dev) 4056static inline bool netif_is_macvlan(const struct net_device *dev)
3969{ 4057{
3970 return dev->priv_flags & IFF_MACVLAN; 4058 return dev->priv_flags & IFF_MACVLAN;
@@ -4045,6 +4133,11 @@ static inline bool netif_is_lag_port(const struct net_device *dev)
4045 return netif_is_bond_slave(dev) || netif_is_team_port(dev); 4133 return netif_is_bond_slave(dev) || netif_is_team_port(dev);
4046} 4134}
4047 4135
4136static inline bool netif_is_rxfh_configured(const struct net_device *dev)
4137{
4138 return dev->priv_flags & IFF_RXFH_CONFIGURED;
4139}
4140
4048/* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */ 4141/* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */
4049static inline void netif_keep_dst(struct net_device *dev) 4142static inline void netif_keep_dst(struct net_device *dev)
4050{ 4143{
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 0ad556726181..9230f9aee896 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -141,22 +141,6 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
141 141
142#ifdef HAVE_JUMP_LABEL 142#ifdef HAVE_JUMP_LABEL
143extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 143extern struct static_key nf_hooks_needed[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
144
145static inline bool nf_hook_list_active(struct list_head *hook_list,
146 u_int8_t pf, unsigned int hook)
147{
148 if (__builtin_constant_p(pf) &&
149 __builtin_constant_p(hook))
150 return static_key_false(&nf_hooks_needed[pf][hook]);
151
152 return !list_empty(hook_list);
153}
154#else
155static inline bool nf_hook_list_active(struct list_head *hook_list,
156 u_int8_t pf, unsigned int hook)
157{
158 return !list_empty(hook_list);
159}
160#endif 144#endif
161 145
162int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state); 146int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state);
@@ -177,9 +161,18 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
177 int (*okfn)(struct net *, struct sock *, struct sk_buff *), 161 int (*okfn)(struct net *, struct sock *, struct sk_buff *),
178 int thresh) 162 int thresh)
179{ 163{
180 struct list_head *hook_list = &net->nf.hooks[pf][hook]; 164 struct list_head *hook_list;
165
166#ifdef HAVE_JUMP_LABEL
167 if (__builtin_constant_p(pf) &&
168 __builtin_constant_p(hook) &&
169 !static_key_false(&nf_hooks_needed[pf][hook]))
170 return 1;
171#endif
172
173 hook_list = &net->nf.hooks[pf][hook];
181 174
182 if (nf_hook_list_active(hook_list, pf, hook)) { 175 if (!list_empty(hook_list)) {
183 struct nf_hook_state state; 176 struct nf_hook_state state;
184 177
185 nf_hook_state_init(&state, hook_list, hook, thresh, 178 nf_hook_state_init(&state, hook_list, hook, thresh,
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index ba0d9789eb6e..1d82dd5e9a08 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -34,8 +34,6 @@ int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
34int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); 34int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
35 35
36int nfnetlink_has_listeners(struct net *net, unsigned int group); 36int nfnetlink_has_listeners(struct net *net, unsigned int group);
37struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size,
38 u32 dst_portid, gfp_t gfp_mask);
39int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, 37int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid,
40 unsigned int group, int echo, gfp_t flags); 38 unsigned int group, int echo, gfp_t flags);
41int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error); 39int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error);
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index c5577410c25d..80a305b85323 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -200,6 +200,9 @@ struct xt_table {
200 u_int8_t af; /* address/protocol family */ 200 u_int8_t af; /* address/protocol family */
201 int priority; /* hook order */ 201 int priority; /* hook order */
202 202
203 /* called when table is needed in the given netns */
204 int (*table_init)(struct net *net);
205
203 /* A unique name... */ 206 /* A unique name... */
204 const char name[XT_TABLE_MAXNAMELEN]; 207 const char name[XT_TABLE_MAXNAMELEN];
205}; 208};
@@ -408,8 +411,7 @@ xt_get_per_cpu_counter(struct xt_counters *cnt, unsigned int cpu)
408 return cnt; 411 return cnt;
409} 412}
410 413
411struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *); 414struct nf_hook_ops *xt_hook_ops_alloc(const struct xt_table *, nf_hookfn *);
412void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *);
413 415
414#ifdef CONFIG_COMPAT 416#ifdef CONFIG_COMPAT
415#include <net/compat.h> 417#include <net/compat.h>
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 6f074db2f23d..029b95e8924e 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -48,10 +48,11 @@ struct arpt_error {
48} 48}
49 49
50extern void *arpt_alloc_initial_table(const struct xt_table *); 50extern void *arpt_alloc_initial_table(const struct xt_table *);
51extern struct xt_table *arpt_register_table(struct net *net, 51int arpt_register_table(struct net *net, const struct xt_table *table,
52 const struct xt_table *table, 52 const struct arpt_replace *repl,
53 const struct arpt_replace *repl); 53 const struct nf_hook_ops *ops, struct xt_table **res);
54extern void arpt_unregister_table(struct xt_table *table); 54void arpt_unregister_table(struct net *net, struct xt_table *table,
55 const struct nf_hook_ops *ops);
55extern unsigned int arpt_do_table(struct sk_buff *skb, 56extern unsigned int arpt_do_table(struct sk_buff *skb,
56 const struct nf_hook_state *state, 57 const struct nf_hook_state *state,
57 struct xt_table *table); 58 struct xt_table *table);
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index aa598f942c01..7bfc5893ec31 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -24,10 +24,11 @@
24 24
25extern void ipt_init(void) __init; 25extern void ipt_init(void) __init;
26 26
27extern struct xt_table *ipt_register_table(struct net *net, 27int ipt_register_table(struct net *net, const struct xt_table *table,
28 const struct xt_table *table, 28 const struct ipt_replace *repl,
29 const struct ipt_replace *repl); 29 const struct nf_hook_ops *ops, struct xt_table **res);
30extern void ipt_unregister_table(struct net *net, struct xt_table *table); 30void ipt_unregister_table(struct net *net, struct xt_table *table,
31 const struct nf_hook_ops *ops);
31 32
32/* Standard entry. */ 33/* Standard entry. */
33struct ipt_standard { 34struct ipt_standard {
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 0f76e5c674f9..b21c392d6012 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -25,10 +25,11 @@
25extern void ip6t_init(void) __init; 25extern void ip6t_init(void) __init;
26 26
27extern void *ip6t_alloc_initial_table(const struct xt_table *); 27extern void *ip6t_alloc_initial_table(const struct xt_table *);
28extern struct xt_table *ip6t_register_table(struct net *net, 28int ip6t_register_table(struct net *net, const struct xt_table *table,
29 const struct xt_table *table, 29 const struct ip6t_replace *repl,
30 const struct ip6t_replace *repl); 30 const struct nf_hook_ops *ops, struct xt_table **res);
31extern void ip6t_unregister_table(struct net *net, struct xt_table *table); 31void ip6t_unregister_table(struct net *net, struct xt_table *table,
32 const struct nf_hook_ops *ops);
32extern unsigned int ip6t_do_table(struct sk_buff *skb, 33extern unsigned int ip6t_do_table(struct sk_buff *skb,
33 const struct nf_hook_state *state, 34 const struct nf_hook_state *state,
34 struct xt_table *table); 35 struct xt_table *table);
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 0b41959aab9f..da14ab61f363 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -69,16 +69,6 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group)
69extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 69extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
70extern int netlink_has_listeners(struct sock *sk, unsigned int group); 70extern int netlink_has_listeners(struct sock *sk, unsigned int group);
71 71
72extern struct sk_buff *__netlink_alloc_skb(struct sock *ssk, unsigned int size,
73 unsigned int ldiff, u32 dst_portid,
74 gfp_t gfp_mask);
75static inline struct sk_buff *
76netlink_alloc_skb(struct sock *ssk, unsigned int size, u32 dst_portid,
77 gfp_t gfp_mask)
78{
79 return __netlink_alloc_skb(ssk, size, 0, dst_portid, gfp_mask);
80}
81
82extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock); 72extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock);
83extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid, 73extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid,
84 __u32 group, gfp_t allocation); 74 __u32 group, gfp_t allocation);
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 79ec7bbf0155..78fda2a69ab8 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -966,11 +966,20 @@ DECLARE_PER_CPU(struct perf_callchain_entry, perf_callchain_entry);
966 966
967extern void perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs); 967extern void perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs);
968extern void perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs); 968extern void perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs);
969extern struct perf_callchain_entry *
970get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user,
971 bool crosstask, bool add_mark);
972extern int get_callchain_buffers(void);
973extern void put_callchain_buffers(void);
969 974
970static inline void perf_callchain_store(struct perf_callchain_entry *entry, u64 ip) 975static inline int perf_callchain_store(struct perf_callchain_entry *entry, u64 ip)
971{ 976{
972 if (entry->nr < PERF_MAX_STACK_DEPTH) 977 if (entry->nr < PERF_MAX_STACK_DEPTH) {
973 entry->ip[entry->nr++] = ip; 978 entry->ip[entry->nr++] = ip;
979 return 0;
980 } else {
981 return -1; /* no more room, stop walking the stack */
982 }
974} 983}
975 984
976extern int sysctl_perf_event_paranoid; 985extern int sysctl_perf_event_paranoid;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index d6f3641e7933..2abd7918f64f 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -327,8 +327,6 @@ struct phy_c45_device_ids {
327/* phy_device: An instance of a PHY 327/* phy_device: An instance of a PHY
328 * 328 *
329 * drv: Pointer to the driver for this PHY instance 329 * drv: Pointer to the driver for this PHY instance
330 * bus: Pointer to the bus this PHY is on
331 * dev: driver model device structure for this PHY
332 * phy_id: UID for this device found during discovery 330 * phy_id: UID for this device found during discovery
333 * c45_ids: 802.3-c45 Device Identifers if is_c45. 331 * c45_ids: 802.3-c45 Device Identifers if is_c45.
334 * is_c45: Set to true if this phy uses clause 45 addressing. 332 * is_c45: Set to true if this phy uses clause 45 addressing.
@@ -338,7 +336,6 @@ struct phy_c45_device_ids {
338 * suspended: Set to true if this phy has been suspended successfully. 336 * suspended: Set to true if this phy has been suspended successfully.
339 * state: state of the PHY for management purposes 337 * state: state of the PHY for management purposes
340 * dev_flags: Device-specific flags used by the PHY driver. 338 * dev_flags: Device-specific flags used by the PHY driver.
341 * addr: Bus address of PHY
342 * link_timeout: The number of timer firings to wait before the 339 * link_timeout: The number of timer firings to wait before the
343 * giving up on the current attempt at acquiring a link 340 * giving up on the current attempt at acquiring a link
344 * irq: IRQ number of the PHY's interrupt (-1 if none) 341 * irq: IRQ number of the PHY's interrupt (-1 if none)
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index 2400d2ea4f34..1d41ec44e39d 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -19,7 +19,7 @@ extern struct phy_device *fixed_phy_register(unsigned int irq,
19 struct fixed_phy_status *status, 19 struct fixed_phy_status *status,
20 int link_gpio, 20 int link_gpio,
21 struct device_node *np); 21 struct device_node *np);
22extern void fixed_phy_del(int phy_addr); 22extern void fixed_phy_unregister(struct phy_device *phydev);
23extern int fixed_phy_set_link_update(struct phy_device *phydev, 23extern int fixed_phy_set_link_update(struct phy_device *phydev,
24 int (*link_update)(struct net_device *, 24 int (*link_update)(struct net_device *,
25 struct fixed_phy_status *)); 25 struct fixed_phy_status *));
@@ -40,9 +40,8 @@ static inline struct phy_device *fixed_phy_register(unsigned int irq,
40{ 40{
41 return ERR_PTR(-ENODEV); 41 return ERR_PTR(-ENODEV);
42} 42}
43static inline int fixed_phy_del(int phy_addr) 43static inline void fixed_phy_unregister(struct phy_device *phydev)
44{ 44{
45 return -ENODEV;
46} 45}
47static inline int fixed_phy_set_link_update(struct phy_device *phydev, 46static inline int fixed_phy_set_link_update(struct phy_device *phydev,
48 int (*link_update)(struct net_device *, 47 int (*link_update)(struct net_device *,
diff --git a/include/linux/platform_data/brcmfmac-sdio.h b/include/linux/platform_data/brcmfmac-sdio.h
deleted file mode 100644
index e75dcbf2b230..000000000000
--- a/include/linux/platform_data/brcmfmac-sdio.h
+++ /dev/null
@@ -1,135 +0,0 @@
1/*
2 * Copyright (c) 2013 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _LINUX_BRCMFMAC_PLATFORM_H
18#define _LINUX_BRCMFMAC_PLATFORM_H
19
20/*
21 * Platform specific driver functions and data. Through the platform specific
22 * device data functions can be provided to help the brcmfmac driver to
23 * operate with the device in combination with the used platform.
24 *
25 * Use the platform data in the following (similar) way:
26 *
27 *
28#include <brcmfmac_platform.h>
29
30
31static void brcmfmac_power_on(void)
32{
33}
34
35static void brcmfmac_power_off(void)
36{
37}
38
39static void brcmfmac_reset(void)
40{
41}
42
43static struct brcmfmac_sdio_platform_data brcmfmac_sdio_pdata = {
44 .power_on = brcmfmac_power_on,
45 .power_off = brcmfmac_power_off,
46 .reset = brcmfmac_reset
47};
48
49static struct platform_device brcmfmac_device = {
50 .name = BRCMFMAC_SDIO_PDATA_NAME,
51 .id = PLATFORM_DEVID_NONE,
52 .dev.platform_data = &brcmfmac_sdio_pdata
53};
54
55void __init brcmfmac_init_pdata(void)
56{
57 brcmfmac_sdio_pdata.oob_irq_supported = true;
58 brcmfmac_sdio_pdata.oob_irq_nr = gpio_to_irq(GPIO_BRCMF_SDIO_OOB);
59 brcmfmac_sdio_pdata.oob_irq_flags = IORESOURCE_IRQ |
60 IORESOURCE_IRQ_HIGHLEVEL;
61 platform_device_register(&brcmfmac_device);
62}
63 *
64 *
65 * Note: the brcmfmac can be loaded as module or be statically built-in into
66 * the kernel. If built-in then do note that it uses module_init (and
67 * module_exit) routines which equal device_initcall. So if you intend to
68 * create a module with the platform specific data for the brcmfmac and have
69 * it built-in to the kernel then use a higher initcall then device_initcall
70 * (see init.h). If this is not done then brcmfmac will load without problems
71 * but will not pickup the platform data.
72 *
73 * When the driver does not "detect" platform driver data then it will continue
74 * without reporting anything and just assume there is no data needed. Which is
75 * probably true for most platforms.
76 *
77 * Explanation of the platform_data fields:
78 *
79 * drive_strength: is the preferred drive_strength to be used for the SDIO
80 * pins. If 0 then a default value will be used. This is the target drive
81 * strength, the exact drive strength which will be used depends on the
82 * capabilities of the device.
83 *
84 * oob_irq_supported: does the board have support for OOB interrupts. SDIO
85 * in-band interrupts are relatively slow and for having less overhead on
86 * interrupt processing an out of band interrupt can be used. If the HW
87 * supports this then enable this by setting this field to true and configure
88 * the oob related fields.
89 *
90 * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are
91 * used for registering the irq using request_irq function.
92 *
93 * broken_sg_support: flag for broken sg list support of SDIO host controller.
94 * Set this to true if the SDIO host controller has higher align requirement
95 * than 32 bytes for each scatterlist item.
96 *
97 * sd_head_align: alignment requirement for start of data buffer
98 *
99 * sd_sgentry_align: length alignment requirement for each sg entry
100 *
101 * power_on: This function is called by the brcmfmac when the module gets
102 * loaded. This can be particularly useful for low power devices. The platform
103 * spcific routine may for example decide to power up the complete device.
104 * If there is no use-case for this function then provide NULL.
105 *
106 * power_off: This function is called by the brcmfmac when the module gets
107 * unloaded. At this point the device can be powered down or otherwise be reset.
108 * So if an actual power_off is not supported but reset is then reset the device
109 * when this function gets called. This can be particularly useful for low power
110 * devices. If there is no use-case for this function (either power-down or
111 * reset) then provide NULL.
112 *
113 * reset: This function can get called if the device communication broke down.
114 * This functionality is particularly useful in case of SDIO type devices. It is
115 * possible to reset a dongle via sdio data interface, but it requires that
116 * this is fully functional. This function is chip/module specific and this
117 * function should return only after the complete reset has completed.
118 */
119
120#define BRCMFMAC_SDIO_PDATA_NAME "brcmfmac_sdio"
121
122struct brcmfmac_sdio_platform_data {
123 unsigned int drive_strength;
124 bool oob_irq_supported;
125 unsigned int oob_irq_nr;
126 unsigned long oob_irq_flags;
127 bool broken_sg_support;
128 unsigned short sd_head_align;
129 unsigned short sd_sgentry_align;
130 void (*power_on)(void);
131 void (*power_off)(void);
132 void (*reset)(void);
133};
134
135#endif /* _LINUX_BRCMFMAC_PLATFORM_H */
diff --git a/include/linux/platform_data/brcmfmac.h b/include/linux/platform_data/brcmfmac.h
new file mode 100644
index 000000000000..1d30bf278231
--- /dev/null
+++ b/include/linux/platform_data/brcmfmac.h
@@ -0,0 +1,185 @@
1/*
2 * Copyright (c) 201 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _LINUX_BRCMFMAC_PLATFORM_H
18#define _LINUX_BRCMFMAC_PLATFORM_H
19
20
21#define BRCMFMAC_PDATA_NAME "brcmfmac"
22
23#define BRCMFMAC_COUNTRY_BUF_SZ 4
24
25
26/*
27 * Platform specific driver functions and data. Through the platform specific
28 * device data functions and data can be provided to help the brcmfmac driver to
29 * operate with the device in combination with the used platform.
30 */
31
32
33/**
34 * Note: the brcmfmac can be loaded as module or be statically built-in into
35 * the kernel. If built-in then do note that it uses module_init (and
36 * module_exit) routines which equal device_initcall. So if you intend to
37 * create a module with the platform specific data for the brcmfmac and have
38 * it built-in to the kernel then use a higher initcall then device_initcall
39 * (see init.h). If this is not done then brcmfmac will load without problems
40 * but will not pickup the platform data.
41 *
42 * When the driver does not "detect" platform driver data then it will continue
43 * without reporting anything and just assume there is no data needed. Which is
44 * probably true for most platforms.
45 */
46
47/**
48 * enum brcmf_bus_type - Bus type identifier. Currently SDIO, USB and PCIE are
49 * supported.
50 */
51enum brcmf_bus_type {
52 BRCMF_BUSTYPE_SDIO,
53 BRCMF_BUSTYPE_USB,
54 BRCMF_BUSTYPE_PCIE
55};
56
57
58/**
59 * struct brcmfmac_sdio_pd - SDIO Device specific platform data.
60 *
61 * @txglomsz: SDIO txglom size. Use 0 if default of driver is to be
62 * used.
63 * @drive_strength: is the preferred drive_strength to be used for the SDIO
64 * pins. If 0 then a default value will be used. This is
65 * the target drive strength, the exact drive strength
66 * which will be used depends on the capabilities of the
67 * device.
68 * @oob_irq_supported: does the board have support for OOB interrupts. SDIO
69 * in-band interrupts are relatively slow and for having
70 * less overhead on interrupt processing an out of band
71 * interrupt can be used. If the HW supports this then
72 * enable this by setting this field to true and configure
73 * the oob related fields.
74 * @oob_irq_nr,
75 * @oob_irq_flags: the OOB interrupt information. The values are used for
76 * registering the irq using request_irq function.
77 * @broken_sg_support: flag for broken sg list support of SDIO host controller.
78 * Set this to true if the SDIO host controller has higher
79 * align requirement than 32 bytes for each scatterlist
80 * item.
81 * @sd_head_align: alignment requirement for start of data buffer.
82 * @sd_sgentry_align: length alignment requirement for each sg entry.
83 * @reset: This function can get called if the device communication
84 * broke down. This functionality is particularly useful in
85 * case of SDIO type devices. It is possible to reset a
86 * dongle via sdio data interface, but it requires that
87 * this is fully functional. This function is chip/module
88 * specific and this function should return only after the
89 * complete reset has completed.
90 */
91struct brcmfmac_sdio_pd {
92 int txglomsz;
93 unsigned int drive_strength;
94 bool oob_irq_supported;
95 unsigned int oob_irq_nr;
96 unsigned long oob_irq_flags;
97 bool broken_sg_support;
98 unsigned short sd_head_align;
99 unsigned short sd_sgentry_align;
100 void (*reset)(void);
101};
102
103/**
104 * struct brcmfmac_pd_cc_entry - Struct for translating user space country code
105 * (iso3166) to firmware country code and
106 * revision.
107 *
108 * @iso3166: iso3166 alpha 2 country code string.
109 * @cc: firmware country code string.
110 * @rev: firmware country code revision.
111 */
112struct brcmfmac_pd_cc_entry {
113 char iso3166[BRCMFMAC_COUNTRY_BUF_SZ];
114 char cc[BRCMFMAC_COUNTRY_BUF_SZ];
115 s32 rev;
116};
117
118/**
119 * struct brcmfmac_pd_cc - Struct for translating country codes as set by user
120 * space to a country code and rev which can be used by
121 * firmware.
122 *
123 * @table_size: number of entries in table (> 0)
124 * @table: array of 1 or more elements with translation information.
125 */
126struct brcmfmac_pd_cc {
127 int table_size;
128 struct brcmfmac_pd_cc_entry table[0];
129};
130
131/**
132 * struct brcmfmac_pd_device - Device specific platform data. (id/rev/bus_type)
133 * is the unique identifier of the device.
134 *
135 * @id: ID of the device for which this data is. In case of SDIO
136 * or PCIE this is the chipid as identified by chip.c In
137 * case of USB this is the chipid as identified by the
138 * device query.
139 * @rev: chip revision, see id.
140 * @bus_type: The type of bus. Some chipid/rev exist for different bus
141 * types. Each bus type has its own set of settings.
142 * @feature_disable: Bitmask of features to disable (override), See feature.c
143 * in brcmfmac for details.
144 * @country_codes: If available, pointer to struct for translating country
145 * codes.
146 * @bus: Bus specific (union) device settings. Currently only
147 * SDIO.
148 */
149struct brcmfmac_pd_device {
150 unsigned int id;
151 unsigned int rev;
152 enum brcmf_bus_type bus_type;
153 unsigned int feature_disable;
154 struct brcmfmac_pd_cc *country_codes;
155 union {
156 struct brcmfmac_sdio_pd sdio;
157 } bus;
158};
159
160/**
161 * struct brcmfmac_platform_data - BRCMFMAC specific platform data.
162 *
163 * @power_on: This function is called by the brcmfmac driver when the module
164 * gets loaded. This can be particularly useful for low power
165 * devices. The platform spcific routine may for example decide to
166 * power up the complete device. If there is no use-case for this
167 * function then provide NULL.
168 * @power_off: This function is called by the brcmfmac when the module gets
169 * unloaded. At this point the devices can be powered down or
170 * otherwise be reset. So if an actual power_off is not supported
171 * but reset is supported by the devices then reset the devices
172 * when this function gets called. This can be particularly useful
173 * for low power devices. If there is no use-case for this
174 * function then provide NULL.
175 */
176struct brcmfmac_platform_data {
177 void (*power_on)(void);
178 void (*power_off)(void);
179 char *fw_alternative_path;
180 int device_count;
181 struct brcmfmac_pd_device devices[0];
182};
183
184
185#endif /* _LINUX_BRCMFMAC_PLATFORM_H */
diff --git a/include/linux/platform_data/microread.h b/include/linux/platform_data/microread.h
deleted file mode 100644
index ca13992089b8..000000000000
--- a/include/linux/platform_data/microread.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Driver include for the Inside Secure microread NFC Chip.
3 *
4 * Copyright (C) 2011 Tieto Poland
5 * Copyright (C) 2012 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _MICROREAD_H
22#define _MICROREAD_H
23
24#include <linux/i2c.h>
25
26#define MICROREAD_DRIVER_NAME "microread"
27
28/* board config platform data for microread */
29struct microread_nfc_platform_data {
30 unsigned int rst_gpio;
31 unsigned int irq_gpio;
32 unsigned int ioh_gpio;
33};
34
35#endif /* _MICROREAD_H */
diff --git a/include/linux/qed/common_hsi.h b/include/linux/qed/common_hsi.h
index 1d1ba2c5ee7a..53ecb37ae563 100644
--- a/include/linux/qed/common_hsi.h
+++ b/include/linux/qed/common_hsi.h
@@ -11,9 +11,11 @@
11 11
12#define CORE_SPQE_PAGE_SIZE_BYTES 4096 12#define CORE_SPQE_PAGE_SIZE_BYTES 4096
13 13
14#define X_FINAL_CLEANUP_AGG_INT 1
15
14#define FW_MAJOR_VERSION 8 16#define FW_MAJOR_VERSION 8
15#define FW_MINOR_VERSION 4 17#define FW_MINOR_VERSION 7
16#define FW_REVISION_VERSION 2 18#define FW_REVISION_VERSION 3
17#define FW_ENGINEERING_VERSION 0 19#define FW_ENGINEERING_VERSION 0
18 20
19/***********************/ 21/***********************/
@@ -152,6 +154,9 @@
152/* number of queues in a PF queue group */ 154/* number of queues in a PF queue group */
153#define QM_PF_QUEUE_GROUP_SIZE 8 155#define QM_PF_QUEUE_GROUP_SIZE 8
154 156
157/* the size of a single queue element in bytes */
158#define QM_PQ_ELEMENT_SIZE 4
159
155/* base number of Tx PQs in the CM PQ representation. 160/* base number of Tx PQs in the CM PQ representation.
156 * should be used when storing PQ IDs in CM PQ registers and context 161 * should be used when storing PQ IDs in CM PQ registers and context
157 */ 162 */
@@ -285,6 +290,16 @@
285#define PXP_NUM_ILT_RECORDS_K2 11000 290#define PXP_NUM_ILT_RECORDS_K2 11000
286#define MAX_NUM_ILT_RECORDS MAX(PXP_NUM_ILT_RECORDS_BB, PXP_NUM_ILT_RECORDS_K2) 291#define MAX_NUM_ILT_RECORDS MAX(PXP_NUM_ILT_RECORDS_BB, PXP_NUM_ILT_RECORDS_K2)
287 292
293#define SDM_COMP_TYPE_NONE 0
294#define SDM_COMP_TYPE_WAKE_THREAD 1
295#define SDM_COMP_TYPE_AGG_INT 2
296#define SDM_COMP_TYPE_CM 3
297#define SDM_COMP_TYPE_LOADER 4
298#define SDM_COMP_TYPE_PXP 5
299#define SDM_COMP_TYPE_INDICATE_ERROR 6
300#define SDM_COMP_TYPE_RELEASE_THREAD 7
301#define SDM_COMP_TYPE_RAM 8
302
288/******************/ 303/******************/
289/* PBF CONSTANTS */ 304/* PBF CONSTANTS */
290/******************/ 305/******************/
@@ -335,7 +350,7 @@ struct event_ring_entry {
335 350
336/* Multi function mode */ 351/* Multi function mode */
337enum mf_mode { 352enum mf_mode {
338 SF, 353 ERROR_MODE /* Unsupported mode */,
339 MF_OVLAN, 354 MF_OVLAN,
340 MF_NPAR, 355 MF_NPAR,
341 MAX_MF_MODE 356 MAX_MF_MODE
@@ -606,4 +621,19 @@ struct status_block {
606#define STATUS_BLOCK_ZERO_PAD3_SHIFT 24 621#define STATUS_BLOCK_ZERO_PAD3_SHIFT 24
607}; 622};
608 623
624struct tunnel_parsing_flags {
625 u8 flags;
626#define TUNNEL_PARSING_FLAGS_TYPE_MASK 0x3
627#define TUNNEL_PARSING_FLAGS_TYPE_SHIFT 0
628#define TUNNEL_PARSING_FLAGS_TENNANT_ID_EXIST_MASK 0x1
629#define TUNNEL_PARSING_FLAGS_TENNANT_ID_EXIST_SHIFT 2
630#define TUNNEL_PARSING_FLAGS_NEXT_PROTOCOL_MASK 0x3
631#define TUNNEL_PARSING_FLAGS_NEXT_PROTOCOL_SHIFT 3
632#define TUNNEL_PARSING_FLAGS_FIRSTHDRIPMATCH_MASK 0x1
633#define TUNNEL_PARSING_FLAGS_FIRSTHDRIPMATCH_SHIFT 5
634#define TUNNEL_PARSING_FLAGS_IPV4_FRAGMENT_MASK 0x1
635#define TUNNEL_PARSING_FLAGS_IPV4_FRAGMENT_SHIFT 6
636#define TUNNEL_PARSING_FLAGS_IPV4_OPTIONS_MASK 0x1
637#define TUNNEL_PARSING_FLAGS_IPV4_OPTIONS_SHIFT 7
638};
609#endif /* __COMMON_HSI__ */ 639#endif /* __COMMON_HSI__ */
diff --git a/include/linux/qed/eth_common.h b/include/linux/qed/eth_common.h
index 320b3373ac1d..092cb0c1afcb 100644
--- a/include/linux/qed/eth_common.h
+++ b/include/linux/qed/eth_common.h
@@ -17,10 +17,8 @@
17#define ETH_MAX_RAMROD_PER_CON 8 17#define ETH_MAX_RAMROD_PER_CON 8
18#define ETH_TX_BD_PAGE_SIZE_BYTES 4096 18#define ETH_TX_BD_PAGE_SIZE_BYTES 4096
19#define ETH_RX_BD_PAGE_SIZE_BYTES 4096 19#define ETH_RX_BD_PAGE_SIZE_BYTES 4096
20#define ETH_RX_SGE_PAGE_SIZE_BYTES 4096
21#define ETH_RX_CQE_PAGE_SIZE_BYTES 4096 20#define ETH_RX_CQE_PAGE_SIZE_BYTES 4096
22#define ETH_RX_NUM_NEXT_PAGE_BDS 2 21#define ETH_RX_NUM_NEXT_PAGE_BDS 2
23#define ETH_RX_NUM_NEXT_PAGE_SGES 2
24 22
25#define ETH_TX_MIN_BDS_PER_NON_LSO_PKT 1 23#define ETH_TX_MIN_BDS_PER_NON_LSO_PKT 1
26#define ETH_TX_MAX_BDS_PER_NON_LSO_PACKET 18 24#define ETH_TX_MAX_BDS_PER_NON_LSO_PACKET 18
@@ -34,7 +32,8 @@
34 32
35#define ETH_NUM_STATISTIC_COUNTERS MAX_NUM_VPORTS 33#define ETH_NUM_STATISTIC_COUNTERS MAX_NUM_VPORTS
36 34
37#define ETH_REG_CQE_PBL_SIZE 3 35/* Maximum number of buffers, used for RX packet placement */
36#define ETH_RX_MAX_BUFF_PER_PKT 5
38 37
39/* num of MAC/VLAN filters */ 38/* num of MAC/VLAN filters */
40#define ETH_NUM_MAC_FILTERS 512 39#define ETH_NUM_MAC_FILTERS 512
@@ -54,9 +53,9 @@
54 53
55/* TPA constants */ 54/* TPA constants */
56#define ETH_TPA_MAX_AGGS_NUM 64 55#define ETH_TPA_MAX_AGGS_NUM 64
57#define ETH_TPA_CQE_START_SGL_SIZE 3 56#define ETH_TPA_CQE_START_LEN_LIST_SIZE ETH_RX_MAX_BUFF_PER_PKT
58#define ETH_TPA_CQE_CONT_SGL_SIZE 6 57#define ETH_TPA_CQE_CONT_LEN_LIST_SIZE 6
59#define ETH_TPA_CQE_END_SGL_SIZE 4 58#define ETH_TPA_CQE_END_LEN_LIST_SIZE 4
60 59
61/* Queue Zone sizes */ 60/* Queue Zone sizes */
62#define TSTORM_QZONE_SIZE 0 61#define TSTORM_QZONE_SIZE 0
@@ -74,18 +73,18 @@ struct coalescing_timeset {
74 73
75struct eth_tx_1st_bd_flags { 74struct eth_tx_1st_bd_flags {
76 u8 bitfields; 75 u8 bitfields;
76#define ETH_TX_1ST_BD_FLAGS_START_BD_MASK 0x1
77#define ETH_TX_1ST_BD_FLAGS_START_BD_SHIFT 0
77#define ETH_TX_1ST_BD_FLAGS_FORCE_VLAN_MODE_MASK 0x1 78#define ETH_TX_1ST_BD_FLAGS_FORCE_VLAN_MODE_MASK 0x1
78#define ETH_TX_1ST_BD_FLAGS_FORCE_VLAN_MODE_SHIFT 0 79#define ETH_TX_1ST_BD_FLAGS_FORCE_VLAN_MODE_SHIFT 1
79#define ETH_TX_1ST_BD_FLAGS_IP_CSUM_MASK 0x1 80#define ETH_TX_1ST_BD_FLAGS_IP_CSUM_MASK 0x1
80#define ETH_TX_1ST_BD_FLAGS_IP_CSUM_SHIFT 1 81#define ETH_TX_1ST_BD_FLAGS_IP_CSUM_SHIFT 2
81#define ETH_TX_1ST_BD_FLAGS_L4_CSUM_MASK 0x1 82#define ETH_TX_1ST_BD_FLAGS_L4_CSUM_MASK 0x1
82#define ETH_TX_1ST_BD_FLAGS_L4_CSUM_SHIFT 2 83#define ETH_TX_1ST_BD_FLAGS_L4_CSUM_SHIFT 3
83#define ETH_TX_1ST_BD_FLAGS_VLAN_INSERTION_MASK 0x1 84#define ETH_TX_1ST_BD_FLAGS_VLAN_INSERTION_MASK 0x1
84#define ETH_TX_1ST_BD_FLAGS_VLAN_INSERTION_SHIFT 3 85#define ETH_TX_1ST_BD_FLAGS_VLAN_INSERTION_SHIFT 4
85#define ETH_TX_1ST_BD_FLAGS_LSO_MASK 0x1 86#define ETH_TX_1ST_BD_FLAGS_LSO_MASK 0x1
86#define ETH_TX_1ST_BD_FLAGS_LSO_SHIFT 4 87#define ETH_TX_1ST_BD_FLAGS_LSO_SHIFT 5
87#define ETH_TX_1ST_BD_FLAGS_START_BD_MASK 0x1
88#define ETH_TX_1ST_BD_FLAGS_START_BD_SHIFT 5
89#define ETH_TX_1ST_BD_FLAGS_TUNN_IP_CSUM_MASK 0x1 88#define ETH_TX_1ST_BD_FLAGS_TUNN_IP_CSUM_MASK 0x1
90#define ETH_TX_1ST_BD_FLAGS_TUNN_IP_CSUM_SHIFT 6 89#define ETH_TX_1ST_BD_FLAGS_TUNN_IP_CSUM_SHIFT 6
91#define ETH_TX_1ST_BD_FLAGS_TUNN_L4_CSUM_MASK 0x1 90#define ETH_TX_1ST_BD_FLAGS_TUNN_L4_CSUM_MASK 0x1
@@ -97,38 +96,44 @@ struct eth_tx_data_1st_bd {
97 __le16 vlan; 96 __le16 vlan;
98 u8 nbds; 97 u8 nbds;
99 struct eth_tx_1st_bd_flags bd_flags; 98 struct eth_tx_1st_bd_flags bd_flags;
100 __le16 fw_use_only; 99 __le16 bitfields;
100#define ETH_TX_DATA_1ST_BD_TUNN_CFG_OVERRIDE_MASK 0x1
101#define ETH_TX_DATA_1ST_BD_TUNN_CFG_OVERRIDE_SHIFT 0
102#define ETH_TX_DATA_1ST_BD_RESERVED0_MASK 0x1
103#define ETH_TX_DATA_1ST_BD_RESERVED0_SHIFT 1
104#define ETH_TX_DATA_1ST_BD_FW_USE_ONLY_MASK 0x3FFF
105#define ETH_TX_DATA_1ST_BD_FW_USE_ONLY_SHIFT 2
101}; 106};
102 107
103/* The parsing information data for the second tx bd of a given packet. */ 108/* The parsing information data for the second tx bd of a given packet. */
104struct eth_tx_data_2nd_bd { 109struct eth_tx_data_2nd_bd {
105 __le16 tunn_ip_size; 110 __le16 tunn_ip_size;
106 __le16 bitfields; 111 __le16 bitfields1;
107#define ETH_TX_DATA_2ND_BD_L4_HDR_START_OFFSET_W_MASK 0x1FFF
108#define ETH_TX_DATA_2ND_BD_L4_HDR_START_OFFSET_W_SHIFT 0
109#define ETH_TX_DATA_2ND_BD_RESERVED0_MASK 0x7
110#define ETH_TX_DATA_2ND_BD_RESERVED0_SHIFT 13
111 __le16 bitfields2;
112#define ETH_TX_DATA_2ND_BD_TUNN_INNER_L2_HDR_SIZE_W_MASK 0xF 112#define ETH_TX_DATA_2ND_BD_TUNN_INNER_L2_HDR_SIZE_W_MASK 0xF
113#define ETH_TX_DATA_2ND_BD_TUNN_INNER_L2_HDR_SIZE_W_SHIFT 0 113#define ETH_TX_DATA_2ND_BD_TUNN_INNER_L2_HDR_SIZE_W_SHIFT 0
114#define ETH_TX_DATA_2ND_BD_TUNN_INNER_ETH_TYPE_MASK 0x3 114#define ETH_TX_DATA_2ND_BD_TUNN_INNER_ETH_TYPE_MASK 0x3
115#define ETH_TX_DATA_2ND_BD_TUNN_INNER_ETH_TYPE_SHIFT 4 115#define ETH_TX_DATA_2ND_BD_TUNN_INNER_ETH_TYPE_SHIFT 4
116#define ETH_TX_DATA_2ND_BD_DEST_PORT_MODE_MASK 0x3 116#define ETH_TX_DATA_2ND_BD_DEST_PORT_MODE_MASK 0x3
117#define ETH_TX_DATA_2ND_BD_DEST_PORT_MODE_SHIFT 6 117#define ETH_TX_DATA_2ND_BD_DEST_PORT_MODE_SHIFT 6
118#define ETH_TX_DATA_2ND_BD_START_BD_MASK 0x1
119#define ETH_TX_DATA_2ND_BD_START_BD_SHIFT 8
118#define ETH_TX_DATA_2ND_BD_TUNN_TYPE_MASK 0x3 120#define ETH_TX_DATA_2ND_BD_TUNN_TYPE_MASK 0x3
119#define ETH_TX_DATA_2ND_BD_TUNN_TYPE_SHIFT 8 121#define ETH_TX_DATA_2ND_BD_TUNN_TYPE_SHIFT 9
120#define ETH_TX_DATA_2ND_BD_TUNN_INNER_IPV6_MASK 0x1 122#define ETH_TX_DATA_2ND_BD_TUNN_INNER_IPV6_MASK 0x1
121#define ETH_TX_DATA_2ND_BD_TUNN_INNER_IPV6_SHIFT 10 123#define ETH_TX_DATA_2ND_BD_TUNN_INNER_IPV6_SHIFT 11
122#define ETH_TX_DATA_2ND_BD_IPV6_EXT_MASK 0x1 124#define ETH_TX_DATA_2ND_BD_IPV6_EXT_MASK 0x1
123#define ETH_TX_DATA_2ND_BD_IPV6_EXT_SHIFT 11 125#define ETH_TX_DATA_2ND_BD_IPV6_EXT_SHIFT 12
124#define ETH_TX_DATA_2ND_BD_TUNN_IPV6_EXT_MASK 0x1 126#define ETH_TX_DATA_2ND_BD_TUNN_IPV6_EXT_MASK 0x1
125#define ETH_TX_DATA_2ND_BD_TUNN_IPV6_EXT_SHIFT 12 127#define ETH_TX_DATA_2ND_BD_TUNN_IPV6_EXT_SHIFT 13
126#define ETH_TX_DATA_2ND_BD_L4_UDP_MASK 0x1 128#define ETH_TX_DATA_2ND_BD_L4_UDP_MASK 0x1
127#define ETH_TX_DATA_2ND_BD_L4_UDP_SHIFT 13 129#define ETH_TX_DATA_2ND_BD_L4_UDP_SHIFT 14
128#define ETH_TX_DATA_2ND_BD_L4_PSEUDO_CSUM_MODE_MASK 0x1 130#define ETH_TX_DATA_2ND_BD_L4_PSEUDO_CSUM_MODE_MASK 0x1
129#define ETH_TX_DATA_2ND_BD_L4_PSEUDO_CSUM_MODE_SHIFT 14 131#define ETH_TX_DATA_2ND_BD_L4_PSEUDO_CSUM_MODE_SHIFT 15
130#define ETH_TX_DATA_2ND_BD_RESERVED1_MASK 0x1 132 __le16 bitfields2;
131#define ETH_TX_DATA_2ND_BD_RESERVED1_SHIFT 15 133#define ETH_TX_DATA_2ND_BD_L4_HDR_START_OFFSET_W_MASK 0x1FFF
134#define ETH_TX_DATA_2ND_BD_L4_HDR_START_OFFSET_W_SHIFT 0
135#define ETH_TX_DATA_2ND_BD_RESERVED0_MASK 0x7
136#define ETH_TX_DATA_2ND_BD_RESERVED0_SHIFT 13
132}; 137};
133 138
134/* Regular ETH Rx FP CQE. */ 139/* Regular ETH Rx FP CQE. */
@@ -145,11 +150,68 @@ struct eth_fast_path_rx_reg_cqe {
145 struct parsing_and_err_flags pars_flags; 150 struct parsing_and_err_flags pars_flags;
146 __le16 vlan_tag; 151 __le16 vlan_tag;
147 __le32 rss_hash; 152 __le32 rss_hash;
148 __le16 len_on_bd; 153 __le16 len_on_first_bd;
149 u8 placement_offset; 154 u8 placement_offset;
150 u8 reserved; 155 struct tunnel_parsing_flags tunnel_pars_flags;
151 __le16 pbl[ETH_REG_CQE_PBL_SIZE]; 156 u8 bd_num;
152 u8 reserved1[10]; 157 u8 reserved[7];
158 u32 fw_debug;
159 u8 reserved1[3];
160 u8 flags;
161#define ETH_FAST_PATH_RX_REG_CQE_VALID_MASK 0x1
162#define ETH_FAST_PATH_RX_REG_CQE_VALID_SHIFT 0
163#define ETH_FAST_PATH_RX_REG_CQE_VALID_TOGGLE_MASK 0x1
164#define ETH_FAST_PATH_RX_REG_CQE_VALID_TOGGLE_SHIFT 1
165#define ETH_FAST_PATH_RX_REG_CQE_RESERVED2_MASK 0x3F
166#define ETH_FAST_PATH_RX_REG_CQE_RESERVED2_SHIFT 2
167};
168
169/* TPA-continue ETH Rx FP CQE. */
170struct eth_fast_path_rx_tpa_cont_cqe {
171 u8 type;
172 u8 tpa_agg_index;
173 __le16 len_list[ETH_TPA_CQE_CONT_LEN_LIST_SIZE];
174 u8 reserved[5];
175 u8 reserved1;
176 __le16 reserved2[ETH_TPA_CQE_CONT_LEN_LIST_SIZE];
177};
178
179/* TPA-end ETH Rx FP CQE. */
180struct eth_fast_path_rx_tpa_end_cqe {
181 u8 type;
182 u8 tpa_agg_index;
183 __le16 total_packet_len;
184 u8 num_of_bds;
185 u8 end_reason;
186 __le16 num_of_coalesced_segs;
187 __le32 ts_delta;
188 __le16 len_list[ETH_TPA_CQE_END_LEN_LIST_SIZE];
189 u8 reserved1[3];
190 u8 reserved2;
191 __le16 reserved3[ETH_TPA_CQE_END_LEN_LIST_SIZE];
192};
193
194/* TPA-start ETH Rx FP CQE. */
195struct eth_fast_path_rx_tpa_start_cqe {
196 u8 type;
197 u8 bitfields;
198#define ETH_FAST_PATH_RX_TPA_START_CQE_RSS_HASH_TYPE_MASK 0x7
199#define ETH_FAST_PATH_RX_TPA_START_CQE_RSS_HASH_TYPE_SHIFT 0
200#define ETH_FAST_PATH_RX_TPA_START_CQE_TC_MASK 0xF
201#define ETH_FAST_PATH_RX_TPA_START_CQE_TC_SHIFT 3
202#define ETH_FAST_PATH_RX_TPA_START_CQE_RESERVED0_MASK 0x1
203#define ETH_FAST_PATH_RX_TPA_START_CQE_RESERVED0_SHIFT 7
204 __le16 seg_len;
205 struct parsing_and_err_flags pars_flags;
206 __le16 vlan_tag;
207 __le32 rss_hash;
208 __le16 len_on_first_bd;
209 u8 placement_offset;
210 struct tunnel_parsing_flags tunnel_pars_flags;
211 u8 tpa_agg_index;
212 u8 header_len;
213 __le16 ext_bd_len_list[ETH_TPA_CQE_START_LEN_LIST_SIZE];
214 u32 fw_debug;
153}; 215};
154 216
155/* The L4 pseudo checksum mode for Ethernet */ 217/* The L4 pseudo checksum mode for Ethernet */
@@ -168,13 +230,26 @@ struct eth_slow_path_rx_cqe {
168 u8 type; 230 u8 type;
169 u8 ramrod_cmd_id; 231 u8 ramrod_cmd_id;
170 u8 error_flag; 232 u8 error_flag;
171 u8 reserved[27]; 233 u8 reserved[25];
172 __le16 echo; 234 __le16 echo;
235 u8 reserved1;
236 u8 flags;
237/* for PMD mode - valid indication */
238#define ETH_SLOW_PATH_RX_CQE_VALID_MASK 0x1
239#define ETH_SLOW_PATH_RX_CQE_VALID_SHIFT 0
240/* for PMD mode - valid toggle indication */
241#define ETH_SLOW_PATH_RX_CQE_VALID_TOGGLE_MASK 0x1
242#define ETH_SLOW_PATH_RX_CQE_VALID_TOGGLE_SHIFT 1
243#define ETH_SLOW_PATH_RX_CQE_RESERVED2_MASK 0x3F
244#define ETH_SLOW_PATH_RX_CQE_RESERVED2_SHIFT 2
173}; 245};
174 246
175/* union for all ETH Rx CQE types */ 247/* union for all ETH Rx CQE types */
176union eth_rx_cqe { 248union eth_rx_cqe {
177 struct eth_fast_path_rx_reg_cqe fast_path_regular; 249 struct eth_fast_path_rx_reg_cqe fast_path_regular;
250 struct eth_fast_path_rx_tpa_start_cqe fast_path_tpa_start;
251 struct eth_fast_path_rx_tpa_cont_cqe fast_path_tpa_cont;
252 struct eth_fast_path_rx_tpa_end_cqe fast_path_tpa_end;
178 struct eth_slow_path_rx_cqe slow_path; 253 struct eth_slow_path_rx_cqe slow_path;
179}; 254};
180 255
@@ -183,15 +258,18 @@ enum eth_rx_cqe_type {
183 ETH_RX_CQE_TYPE_UNUSED, 258 ETH_RX_CQE_TYPE_UNUSED,
184 ETH_RX_CQE_TYPE_REGULAR, 259 ETH_RX_CQE_TYPE_REGULAR,
185 ETH_RX_CQE_TYPE_SLOW_PATH, 260 ETH_RX_CQE_TYPE_SLOW_PATH,
261 ETH_RX_CQE_TYPE_TPA_START,
262 ETH_RX_CQE_TYPE_TPA_CONT,
263 ETH_RX_CQE_TYPE_TPA_END,
186 MAX_ETH_RX_CQE_TYPE 264 MAX_ETH_RX_CQE_TYPE
187}; 265};
188 266
189/* ETH Rx producers data */ 267/* ETH Rx producers data */
190struct eth_rx_prod_data { 268struct eth_rx_prod_data {
191 __le16 bd_prod; 269 __le16 bd_prod;
192 __le16 sge_prod;
193 __le16 cqe_prod; 270 __le16 cqe_prod;
194 __le16 reserved; 271 __le16 reserved;
272 __le16 reserved1;
195}; 273};
196 274
197/* The first tx bd of a given packet */ 275/* The first tx bd of a given packet */
@@ -211,12 +289,17 @@ struct eth_tx_2nd_bd {
211/* The parsing information data for the third tx bd of a given packet. */ 289/* The parsing information data for the third tx bd of a given packet. */
212struct eth_tx_data_3rd_bd { 290struct eth_tx_data_3rd_bd {
213 __le16 lso_mss; 291 __le16 lso_mss;
214 u8 bitfields; 292 __le16 bitfields;
215#define ETH_TX_DATA_3RD_BD_TCP_HDR_LEN_DW_MASK 0xF 293#define ETH_TX_DATA_3RD_BD_TCP_HDR_LEN_DW_MASK 0xF
216#define ETH_TX_DATA_3RD_BD_TCP_HDR_LEN_DW_SHIFT 0 294#define ETH_TX_DATA_3RD_BD_TCP_HDR_LEN_DW_SHIFT 0
217#define ETH_TX_DATA_3RD_BD_HDR_NBD_MASK 0xF 295#define ETH_TX_DATA_3RD_BD_HDR_NBD_MASK 0xF
218#define ETH_TX_DATA_3RD_BD_HDR_NBD_SHIFT 4 296#define ETH_TX_DATA_3RD_BD_HDR_NBD_SHIFT 4
219 u8 resereved0[3]; 297#define ETH_TX_DATA_3RD_BD_START_BD_MASK 0x1
298#define ETH_TX_DATA_3RD_BD_START_BD_SHIFT 8
299#define ETH_TX_DATA_3RD_BD_RESERVED0_MASK 0x7F
300#define ETH_TX_DATA_3RD_BD_RESERVED0_SHIFT 9
301 u8 tunn_l4_hdr_start_offset_w;
302 u8 tunn_hdr_size_w;
220}; 303};
221 304
222/* The third tx bd of a given packet */ 305/* The third tx bd of a given packet */
@@ -226,12 +309,24 @@ struct eth_tx_3rd_bd {
226 struct eth_tx_data_3rd_bd data; 309 struct eth_tx_data_3rd_bd data;
227}; 310};
228 311
312/* Complementary information for the regular tx bd of a given packet. */
313struct eth_tx_data_bd {
314 __le16 reserved0;
315 __le16 bitfields;
316#define ETH_TX_DATA_BD_RESERVED1_MASK 0xFF
317#define ETH_TX_DATA_BD_RESERVED1_SHIFT 0
318#define ETH_TX_DATA_BD_START_BD_MASK 0x1
319#define ETH_TX_DATA_BD_START_BD_SHIFT 8
320#define ETH_TX_DATA_BD_RESERVED2_MASK 0x7F
321#define ETH_TX_DATA_BD_RESERVED2_SHIFT 9
322 __le16 reserved3;
323};
324
229/* The common non-special TX BD ring element */ 325/* The common non-special TX BD ring element */
230struct eth_tx_bd { 326struct eth_tx_bd {
231 struct regpair addr; 327 struct regpair addr;
232 __le16 nbytes; 328 __le16 nbytes;
233 __le16 reserved0; 329 struct eth_tx_data_bd data;
234 __le32 reserved1;
235}; 330};
236 331
237union eth_tx_bd_types { 332union eth_tx_bd_types {
diff --git a/include/linux/qed/qed_chain.h b/include/linux/qed/qed_chain.h
index 41b9049b57e2..5f8fcaaa6504 100644
--- a/include/linux/qed/qed_chain.h
+++ b/include/linux/qed/qed_chain.h
@@ -19,6 +19,10 @@
19/* dma_addr_t manip */ 19/* dma_addr_t manip */
20#define DMA_LO_LE(x) cpu_to_le32(lower_32_bits(x)) 20#define DMA_LO_LE(x) cpu_to_le32(lower_32_bits(x))
21#define DMA_HI_LE(x) cpu_to_le32(upper_32_bits(x)) 21#define DMA_HI_LE(x) cpu_to_le32(upper_32_bits(x))
22#define DMA_REGPAIR_LE(x, val) do { \
23 (x).hi = DMA_HI_LE((val)); \
24 (x).lo = DMA_LO_LE((val)); \
25 } while (0)
22 26
23#define HILO_GEN(hi, lo, type) ((((type)(hi)) << 32) + (lo)) 27#define HILO_GEN(hi, lo, type) ((((type)(hi)) << 32) + (lo))
24#define HILO_DMA(hi, lo) HILO_GEN(hi, lo, dma_addr_t) 28#define HILO_DMA(hi, lo) HILO_GEN(hi, lo, dma_addr_t)
diff --git a/include/linux/qed/qed_eth_if.h b/include/linux/qed/qed_eth_if.h
index 81ab178e31c1..e1d69834a11f 100644
--- a/include/linux/qed/qed_eth_if.h
+++ b/include/linux/qed/qed_eth_if.h
@@ -33,10 +33,20 @@ struct qed_update_vport_params {
33 u8 vport_id; 33 u8 vport_id;
34 u8 update_vport_active_flg; 34 u8 update_vport_active_flg;
35 u8 vport_active_flg; 35 u8 vport_active_flg;
36 u8 update_accept_any_vlan_flg;
37 u8 accept_any_vlan;
36 u8 update_rss_flg; 38 u8 update_rss_flg;
37 struct qed_update_vport_rss_params rss_params; 39 struct qed_update_vport_rss_params rss_params;
38}; 40};
39 41
42struct qed_start_vport_params {
43 bool remove_inner_vlan;
44 bool gro_enable;
45 bool drop_ttl0;
46 u8 vport_id;
47 u16 mtu;
48};
49
40struct qed_stop_rxq_params { 50struct qed_stop_rxq_params {
41 u8 rss_id; 51 u8 rss_id;
42 u8 rx_queue_id; 52 u8 rx_queue_id;
@@ -116,9 +126,7 @@ struct qed_eth_ops {
116 void *cookie); 126 void *cookie);
117 127
118 int (*vport_start)(struct qed_dev *cdev, 128 int (*vport_start)(struct qed_dev *cdev,
119 u8 vport_id, u16 mtu, 129 struct qed_start_vport_params *params);
120 u8 drop_ttl0_flg,
121 u8 inner_vlan_removal_en_flg);
122 130
123 int (*vport_stop)(struct qed_dev *cdev, 131 int (*vport_stop)(struct qed_dev *cdev,
124 u8 vport_id); 132 u8 vport_id);
diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h
index d4a32e878180..1f7599c77cd4 100644
--- a/include/linux/qed/qed_if.h
+++ b/include/linux/qed/qed_if.h
@@ -80,7 +80,7 @@ struct qed_dev_info {
80 u8 num_hwfns; 80 u8 num_hwfns;
81 81
82 u8 hw_mac[ETH_ALEN]; 82 u8 hw_mac[ETH_ALEN];
83 bool is_mf; 83 bool is_mf_default;
84 84
85 /* FW version */ 85 /* FW version */
86 u16 fw_major; 86 u16 fw_major;
@@ -360,6 +360,12 @@ enum DP_MODULE {
360 /* to be added...up to 0x8000000 */ 360 /* to be added...up to 0x8000000 */
361}; 361};
362 362
363enum qed_mf_mode {
364 QED_MF_DEFAULT,
365 QED_MF_OVLAN,
366 QED_MF_NPAR,
367};
368
363struct qed_eth_stats { 369struct qed_eth_stats {
364 u64 no_buff_discards; 370 u64 no_buff_discards;
365 u64 packet_too_big_discard; 371 u64 packet_too_big_discard;
@@ -440,6 +446,12 @@ struct qed_eth_stats {
440#define RX_PI 0 446#define RX_PI 0
441#define TX_PI(tc) (RX_PI + 1 + tc) 447#define TX_PI(tc) (RX_PI + 1 + tc)
442 448
449struct qed_sb_cnt_info {
450 int sb_cnt;
451 int sb_iov_cnt;
452 int sb_free_blk;
453};
454
443static inline u16 qed_sb_update_sb_idx(struct qed_sb_info *sb_info) 455static inline u16 qed_sb_update_sb_idx(struct qed_sb_info *sb_info)
444{ 456{
445 u32 prod = 0; 457 u32 prod = 0;
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 14ec1652daf4..17d4f849c65e 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -319,6 +319,27 @@ static inline void list_splice_tail_init_rcu(struct list_head *list,
319}) 319})
320 320
321/** 321/**
322 * list_next_or_null_rcu - get the first element from a list
323 * @head: the head for the list.
324 * @ptr: the list head to take the next element from.
325 * @type: the type of the struct this is embedded in.
326 * @member: the name of the list_head within the struct.
327 *
328 * Note that if the ptr is at the end of the list, NULL is returned.
329 *
330 * This primitive may safely run concurrently with the _rcu list-mutation
331 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
332 */
333#define list_next_or_null_rcu(head, ptr, type, member) \
334({ \
335 struct list_head *__head = (head); \
336 struct list_head *__ptr = (ptr); \
337 struct list_head *__next = READ_ONCE(__ptr->next); \
338 likely(__next != __head) ? list_entry_rcu(__next, type, \
339 member) : NULL; \
340})
341
342/**
322 * list_for_each_entry_rcu - iterate over rcu list of given type 343 * list_for_each_entry_rcu - iterate over rcu list of given type
323 * @pos: the type * to use as a loop cursor. 344 * @pos: the type * to use as a loop cursor.
324 * @head: the head for your list. 345 * @head: the head for your list.
diff --git a/include/linux/rfkill-gpio.h b/include/linux/rfkill-gpio.h
deleted file mode 100644
index 20bcb55498cd..000000000000
--- a/include/linux/rfkill-gpio.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * Copyright (c) 2011, NVIDIA Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19
20#ifndef __RFKILL_GPIO_H
21#define __RFKILL_GPIO_H
22
23#include <linux/types.h>
24#include <linux/rfkill.h>
25
26/**
27 * struct rfkill_gpio_platform_data - platform data for rfkill gpio device.
28 * for unused gpio's, the expected value is -1.
29 * @name: name for the gpio rf kill instance
30 */
31
32struct rfkill_gpio_platform_data {
33 char *name;
34 enum rfkill_type type;
35};
36
37#endif /* __RFKILL_GPIO_H */
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index d9010789b4e8..e6a0031d1b1f 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -104,7 +104,8 @@ int __must_check rfkill_register(struct rfkill *rfkill);
104 * 104 *
105 * Pause polling -- say transmitter is off for other reasons. 105 * Pause polling -- say transmitter is off for other reasons.
106 * NOTE: not necessary for suspend/resume -- in that case the 106 * NOTE: not necessary for suspend/resume -- in that case the
107 * core stops polling anyway 107 * core stops polling anyway (but will also correctly handle
108 * the case of polling having been paused before suspend.)
108 */ 109 */
109void rfkill_pause_polling(struct rfkill *rfkill); 110void rfkill_pause_polling(struct rfkill *rfkill);
110 111
@@ -212,6 +213,15 @@ void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw);
212 * @rfkill: rfkill struct to query 213 * @rfkill: rfkill struct to query
213 */ 214 */
214bool rfkill_blocked(struct rfkill *rfkill); 215bool rfkill_blocked(struct rfkill *rfkill);
216
217/**
218 * rfkill_find_type - Helpper for finding rfkill type by name
219 * @name: the name of the type
220 *
221 * Returns enum rfkill_type that conrresponds the name.
222 */
223enum rfkill_type rfkill_find_type(const char *name);
224
215#else /* !RFKILL */ 225#else /* !RFKILL */
216static inline struct rfkill * __must_check 226static inline struct rfkill * __must_check
217rfkill_alloc(const char *name, 227rfkill_alloc(const char *name,
@@ -268,6 +278,12 @@ static inline bool rfkill_blocked(struct rfkill *rfkill)
268{ 278{
269 return false; 279 return false;
270} 280}
281
282static inline enum rfkill_type rfkill_find_type(const char *name)
283{
284 return RFKILL_TYPE_ALL;
285}
286
271#endif /* RFKILL || RFKILL_MODULE */ 287#endif /* RFKILL || RFKILL_MODULE */
272 288
273 289
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index d3fcd4591ce4..15d0df943466 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1161,10 +1161,6 @@ static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from)
1161 to->l4_hash = from->l4_hash; 1161 to->l4_hash = from->l4_hash;
1162}; 1162};
1163 1163
1164static inline void skb_sender_cpu_clear(struct sk_buff *skb)
1165{
1166}
1167
1168#ifdef NET_SKBUFF_DATA_USES_OFFSET 1164#ifdef NET_SKBUFF_DATA_USES_OFFSET
1169static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) 1165static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
1170{ 1166{
@@ -2186,6 +2182,11 @@ static inline int skb_checksum_start_offset(const struct sk_buff *skb)
2186 return skb->csum_start - skb_headroom(skb); 2182 return skb->csum_start - skb_headroom(skb);
2187} 2183}
2188 2184
2185static inline unsigned char *skb_checksum_start(const struct sk_buff *skb)
2186{
2187 return skb->head + skb->csum_start;
2188}
2189
2189static inline int skb_transport_offset(const struct sk_buff *skb) 2190static inline int skb_transport_offset(const struct sk_buff *skb)
2190{ 2191{
2191 return skb_transport_header(skb) - skb->data; 2192 return skb_transport_header(skb) - skb->data;
@@ -2424,6 +2425,10 @@ static inline struct sk_buff *napi_alloc_skb(struct napi_struct *napi,
2424{ 2425{
2425 return __napi_alloc_skb(napi, length, GFP_ATOMIC); 2426 return __napi_alloc_skb(napi, length, GFP_ATOMIC);
2426} 2427}
2428void napi_consume_skb(struct sk_buff *skb, int budget);
2429
2430void __kfree_skb_flush(void);
2431void __kfree_skb_defer(struct sk_buff *skb);
2427 2432
2428/** 2433/**
2429 * __dev_alloc_pages - allocate page for network Rx 2434 * __dev_alloc_pages - allocate page for network Rx
@@ -2646,6 +2651,13 @@ static inline int skb_clone_writable(const struct sk_buff *skb, unsigned int len
2646 skb_headroom(skb) + len <= skb->hdr_len; 2651 skb_headroom(skb) + len <= skb->hdr_len;
2647} 2652}
2648 2653
2654static inline int skb_try_make_writable(struct sk_buff *skb,
2655 unsigned int write_len)
2656{
2657 return skb_cloned(skb) && !skb_clone_writable(skb, write_len) &&
2658 pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
2659}
2660
2649static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom, 2661static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom,
2650 int cloned) 2662 int cloned)
2651{ 2663{
@@ -3574,6 +3586,7 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
3574struct skb_gso_cb { 3586struct skb_gso_cb {
3575 int mac_offset; 3587 int mac_offset;
3576 int encap_level; 3588 int encap_level;
3589 __wsum csum;
3577 __u16 csum_start; 3590 __u16 csum_start;
3578}; 3591};
3579#define SKB_SGO_CB_OFFSET 32 3592#define SKB_SGO_CB_OFFSET 32
@@ -3600,6 +3613,16 @@ static inline int gso_pskb_expand_head(struct sk_buff *skb, int extra)
3600 return 0; 3613 return 0;
3601} 3614}
3602 3615
3616static inline void gso_reset_checksum(struct sk_buff *skb, __wsum res)
3617{
3618 /* Do not update partial checksums if remote checksum is enabled. */
3619 if (skb->remcsum_offload)
3620 return;
3621
3622 SKB_GSO_CB(skb)->csum = res;
3623 SKB_GSO_CB(skb)->csum_start = skb_checksum_start(skb) - skb->head;
3624}
3625
3603/* Compute the checksum for a gso segment. First compute the checksum value 3626/* Compute the checksum for a gso segment. First compute the checksum value
3604 * from the start of transport header to SKB_GSO_CB(skb)->csum_start, and 3627 * from the start of transport header to SKB_GSO_CB(skb)->csum_start, and
3605 * then add in skb->csum (checksum from csum_start to end of packet). 3628 * then add in skb->csum (checksum from csum_start to end of packet).
@@ -3610,15 +3633,14 @@ static inline int gso_pskb_expand_head(struct sk_buff *skb, int extra)
3610 */ 3633 */
3611static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res) 3634static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res)
3612{ 3635{
3613 int plen = SKB_GSO_CB(skb)->csum_start - skb_headroom(skb) - 3636 unsigned char *csum_start = skb_transport_header(skb);
3614 skb_transport_offset(skb); 3637 int plen = (skb->head + SKB_GSO_CB(skb)->csum_start) - csum_start;
3615 __wsum partial; 3638 __wsum partial = SKB_GSO_CB(skb)->csum;
3616 3639
3617 partial = csum_partial(skb_transport_header(skb), plen, skb->csum); 3640 SKB_GSO_CB(skb)->csum = res;
3618 skb->csum = res; 3641 SKB_GSO_CB(skb)->csum_start = csum_start - skb->head;
3619 SKB_GSO_CB(skb)->csum_start -= plen;
3620 3642
3621 return csum_fold(partial); 3643 return csum_fold(csum_partial(csum_start, plen, partial));
3622} 3644}
3623 3645
3624static inline bool skb_is_gso(const struct sk_buff *skb) 3646static inline bool skb_is_gso(const struct sk_buff *skb)
@@ -3708,5 +3730,30 @@ static inline unsigned int skb_gso_network_seglen(const struct sk_buff *skb)
3708 return hdr_len + skb_gso_transport_seglen(skb); 3730 return hdr_len + skb_gso_transport_seglen(skb);
3709} 3731}
3710 3732
3733/* Local Checksum Offload.
3734 * Compute outer checksum based on the assumption that the
3735 * inner checksum will be offloaded later.
3736 * See Documentation/networking/checksum-offloads.txt for
3737 * explanation of how this works.
3738 * Fill in outer checksum adjustment (e.g. with sum of outer
3739 * pseudo-header) before calling.
3740 * Also ensure that inner checksum is in linear data area.
3741 */
3742static inline __wsum lco_csum(struct sk_buff *skb)
3743{
3744 unsigned char *csum_start = skb_checksum_start(skb);
3745 unsigned char *l4_hdr = skb_transport_header(skb);
3746 __wsum partial;
3747
3748 /* Start with complement of inner checksum adjustment */
3749 partial = ~csum_unfold(*(__force __sum16 *)(csum_start +
3750 skb->csum_offset));
3751
3752 /* Add in checksum of our headers (incl. outer checksum
3753 * adjustment filled in by caller) and return result.
3754 */
3755 return csum_partial(l4_hdr, csum_start - l4_hdr, partial);
3756}
3757
3711#endif /* __KERNEL__ */ 3758#endif /* __KERNEL__ */
3712#endif /* _LINUX_SKBUFF_H */ 3759#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 5bf59c8493b7..73bf6c6a833b 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -200,7 +200,9 @@ struct ucred {
200#define AF_ALG 38 /* Algorithm sockets */ 200#define AF_ALG 38 /* Algorithm sockets */
201#define AF_NFC 39 /* NFC sockets */ 201#define AF_NFC 39 /* NFC sockets */
202#define AF_VSOCK 40 /* vSockets */ 202#define AF_VSOCK 40 /* vSockets */
203#define AF_MAX 41 /* For now.. */ 203#define AF_KCM 41 /* Kernel Connection Multiplexor*/
204
205#define AF_MAX 42 /* For now.. */
204 206
205/* Protocol families, same as address families. */ 207/* Protocol families, same as address families. */
206#define PF_UNSPEC AF_UNSPEC 208#define PF_UNSPEC AF_UNSPEC
@@ -246,6 +248,7 @@ struct ucred {
246#define PF_ALG AF_ALG 248#define PF_ALG AF_ALG
247#define PF_NFC AF_NFC 249#define PF_NFC AF_NFC
248#define PF_VSOCK AF_VSOCK 250#define PF_VSOCK AF_VSOCK
251#define PF_KCM AF_KCM
249#define PF_MAX AF_MAX 252#define PF_MAX AF_MAX
250 253
251/* Maximum queue length specifiable by listen. */ 254/* Maximum queue length specifiable by listen. */
@@ -274,6 +277,7 @@ struct ucred {
274#define MSG_MORE 0x8000 /* Sender will send more */ 277#define MSG_MORE 0x8000 /* Sender will send more */
275#define MSG_WAITFORONE 0x10000 /* recvmmsg(): block until 1+ packets avail */ 278#define MSG_WAITFORONE 0x10000 /* recvmmsg(): block until 1+ packets avail */
276#define MSG_SENDPAGE_NOTLAST 0x20000 /* sendpage() internal : not the last page */ 279#define MSG_SENDPAGE_NOTLAST 0x20000 /* sendpage() internal : not the last page */
280#define MSG_BATCH 0x40000 /* sendmmsg(): more messages coming */
277#define MSG_EOF MSG_FIN 281#define MSG_EOF MSG_FIN
278 282
279#define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */ 283#define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */
@@ -322,6 +326,7 @@ struct ucred {
322#define SOL_CAIF 278 326#define SOL_CAIF 278
323#define SOL_ALG 279 327#define SOL_ALG 279
324#define SOL_NFC 280 328#define SOL_NFC 280
329#define SOL_KCM 281
325 330
326/* IPX options */ 331/* IPX options */
327#define IPX_TYPE 1 332#define IPX_TYPE 1
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 881a79d52467..4bcf5a61aada 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -90,7 +90,21 @@ struct stmmac_dma_cfg {
90 int pbl; 90 int pbl;
91 int fixed_burst; 91 int fixed_burst;
92 int mixed_burst; 92 int mixed_burst;
93 int burst_len; 93 bool aal;
94};
95
96#define AXI_BLEN 7
97struct stmmac_axi {
98 bool axi_lpi_en;
99 bool axi_xit_frm;
100 u32 axi_wr_osr_lmt;
101 u32 axi_rd_osr_lmt;
102 bool axi_kbbe;
103 bool axi_axi_all;
104 u32 axi_blen[AXI_BLEN];
105 bool axi_fb;
106 bool axi_mb;
107 bool axi_rb;
94}; 108};
95 109
96struct plat_stmmacenet_data { 110struct plat_stmmacenet_data {
@@ -123,5 +137,6 @@ struct plat_stmmacenet_data {
123 int (*init)(struct platform_device *pdev, void *priv); 137 int (*init)(struct platform_device *pdev, void *priv);
124 void (*exit)(struct platform_device *pdev, void *priv); 138 void (*exit)(struct platform_device *pdev, void *priv);
125 void *bsp_priv; 139 void *bsp_priv;
140 struct stmmac_axi *axi;
126}; 141};
127#endif 142#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index b386361ba3e8..7be9b1242354 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -29,9 +29,14 @@ static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
29 return (struct tcphdr *)skb_transport_header(skb); 29 return (struct tcphdr *)skb_transport_header(skb);
30} 30}
31 31
32static inline unsigned int __tcp_hdrlen(const struct tcphdr *th)
33{
34 return th->doff * 4;
35}
36
32static inline unsigned int tcp_hdrlen(const struct sk_buff *skb) 37static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
33{ 38{
34 return tcp_hdr(skb)->doff * 4; 39 return __tcp_hdrlen(tcp_hdr(skb));
35} 40}
36 41
37static inline struct tcphdr *inner_tcp_hdr(const struct sk_buff *skb) 42static inline struct tcphdr *inner_tcp_hdr(const struct sk_buff *skb)
@@ -153,6 +158,9 @@ struct tcp_sock {
153 u32 segs_in; /* RFC4898 tcpEStatsPerfSegsIn 158 u32 segs_in; /* RFC4898 tcpEStatsPerfSegsIn
154 * total number of segments in. 159 * total number of segments in.
155 */ 160 */
161 u32 data_segs_in; /* RFC4898 tcpEStatsPerfDataSegsIn
162 * total number of data segments in.
163 */
156 u32 rcv_nxt; /* What we want to receive next */ 164 u32 rcv_nxt; /* What we want to receive next */
157 u32 copied_seq; /* Head of yet unread data */ 165 u32 copied_seq; /* Head of yet unread data */
158 u32 rcv_wup; /* rcv_nxt on last window update sent */ 166 u32 rcv_wup; /* rcv_nxt on last window update sent */
@@ -160,6 +168,9 @@ struct tcp_sock {
160 u32 segs_out; /* RFC4898 tcpEStatsPerfSegsOut 168 u32 segs_out; /* RFC4898 tcpEStatsPerfSegsOut
161 * The total number of segments sent. 169 * The total number of segments sent.
162 */ 170 */
171 u32 data_segs_out; /* RFC4898 tcpEStatsPerfDataSegsOut
172 * total number of data segments sent.
173 */
163 u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked 174 u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked
164 * sum(delta(snd_una)), or how many bytes 175 * sum(delta(snd_una)), or how many bytes
165 * were acked. 176 * were acked.
@@ -256,6 +267,7 @@ struct tcp_sock {
256 u32 prr_delivered; /* Number of newly delivered packets to 267 u32 prr_delivered; /* Number of newly delivered packets to
257 * receiver in Recovery. */ 268 * receiver in Recovery. */
258 u32 prr_out; /* Total number of pkts sent during Recovery. */ 269 u32 prr_out; /* Total number of pkts sent during Recovery. */
270 u32 delivered; /* Total data packets delivered incl. rexmits */
259 271
260 u32 rcv_wnd; /* Current receiver window */ 272 u32 rcv_wnd; /* Current receiver window */
261 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 273 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
index 2f6a3f2233ed..da3a77d25fcb 100644
--- a/include/net/6lowpan.h
+++ b/include/net/6lowpan.h
@@ -75,6 +75,8 @@
75#define LOWPAN_IPHC_MAX_HC_BUF_LEN (sizeof(struct ipv6hdr) + \ 75#define LOWPAN_IPHC_MAX_HC_BUF_LEN (sizeof(struct ipv6hdr) + \
76 LOWPAN_IPHC_MAX_HEADER_LEN + \ 76 LOWPAN_IPHC_MAX_HEADER_LEN + \
77 LOWPAN_NHC_MAX_HDR_LEN) 77 LOWPAN_NHC_MAX_HDR_LEN)
78/* SCI/DCI is 4 bit width, so we have maximum 16 entries */
79#define LOWPAN_IPHC_CTX_TABLE_SIZE (1 << 4)
78 80
79#define LOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */ 81#define LOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */
80#define LOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */ 82#define LOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */
@@ -98,9 +100,39 @@ enum lowpan_lltypes {
98 LOWPAN_LLTYPE_IEEE802154, 100 LOWPAN_LLTYPE_IEEE802154,
99}; 101};
100 102
103enum lowpan_iphc_ctx_flags {
104 LOWPAN_IPHC_CTX_FLAG_ACTIVE,
105 LOWPAN_IPHC_CTX_FLAG_COMPRESSION,
106};
107
108struct lowpan_iphc_ctx {
109 u8 id;
110 struct in6_addr pfx;
111 u8 plen;
112 unsigned long flags;
113};
114
115struct lowpan_iphc_ctx_table {
116 spinlock_t lock;
117 const struct lowpan_iphc_ctx_ops *ops;
118 struct lowpan_iphc_ctx table[LOWPAN_IPHC_CTX_TABLE_SIZE];
119};
120
121static inline bool lowpan_iphc_ctx_is_active(const struct lowpan_iphc_ctx *ctx)
122{
123 return test_bit(LOWPAN_IPHC_CTX_FLAG_ACTIVE, &ctx->flags);
124}
125
126static inline bool
127lowpan_iphc_ctx_is_compression(const struct lowpan_iphc_ctx *ctx)
128{
129 return test_bit(LOWPAN_IPHC_CTX_FLAG_COMPRESSION, &ctx->flags);
130}
131
101struct lowpan_priv { 132struct lowpan_priv {
102 enum lowpan_lltypes lltype; 133 enum lowpan_lltypes lltype;
103 struct dentry *iface_debugfs; 134 struct dentry *iface_debugfs;
135 struct lowpan_iphc_ctx_table ctx;
104 136
105 /* must be last */ 137 /* must be last */
106 u8 priv[0] __aligned(sizeof(void *)); 138 u8 priv[0] __aligned(sizeof(void *));
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 9d446f136607..2a19fe111c78 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -7,6 +7,8 @@
7 7
8#include <net/sch_generic.h> 8#include <net/sch_generic.h>
9#include <net/pkt_sched.h> 9#include <net/pkt_sched.h>
10#include <net/net_namespace.h>
11#include <net/netns/generic.h>
10 12
11struct tcf_common { 13struct tcf_common {
12 struct hlist_node tcfc_head; 14 struct hlist_node tcfc_head;
@@ -65,11 +67,6 @@ static inline int tcf_hashinfo_init(struct tcf_hashinfo *hf, unsigned int mask)
65 return 0; 67 return 0;
66} 68}
67 69
68static inline void tcf_hashinfo_destroy(struct tcf_hashinfo *hf)
69{
70 kfree(hf->htab);
71}
72
73/* Update lastuse only if needed, to avoid dirtying a cache line. 70/* Update lastuse only if needed, to avoid dirtying a cache line.
74 * We use a temp variable to avoid fetching jiffies twice. 71 * We use a temp variable to avoid fetching jiffies twice.
75 */ 72 */
@@ -81,42 +78,76 @@ static inline void tcf_lastuse_update(struct tcf_t *tm)
81 tm->lastuse = now; 78 tm->lastuse = now;
82} 79}
83 80
84#ifdef CONFIG_NET_CLS_ACT
85
86#define ACT_P_CREATED 1
87#define ACT_P_DELETED 1
88
89struct tc_action { 81struct tc_action {
90 void *priv; 82 void *priv;
91 const struct tc_action_ops *ops; 83 const struct tc_action_ops *ops;
92 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ 84 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */
93 __u32 order; 85 __u32 order;
94 struct list_head list; 86 struct list_head list;
87 struct tcf_hashinfo *hinfo;
95}; 88};
96 89
90#ifdef CONFIG_NET_CLS_ACT
91
92#define ACT_P_CREATED 1
93#define ACT_P_DELETED 1
94
97struct tc_action_ops { 95struct tc_action_ops {
98 struct list_head head; 96 struct list_head head;
99 struct tcf_hashinfo *hinfo;
100 char kind[IFNAMSIZ]; 97 char kind[IFNAMSIZ];
101 __u32 type; /* TBD to match kind */ 98 __u32 type; /* TBD to match kind */
102 struct module *owner; 99 struct module *owner;
103 int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *); 100 int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *);
104 int (*dump)(struct sk_buff *, struct tc_action *, int, int); 101 int (*dump)(struct sk_buff *, struct tc_action *, int, int);
105 void (*cleanup)(struct tc_action *, int bind); 102 void (*cleanup)(struct tc_action *, int bind);
106 int (*lookup)(struct tc_action *, u32); 103 int (*lookup)(struct net *, struct tc_action *, u32);
107 int (*init)(struct net *net, struct nlattr *nla, 104 int (*init)(struct net *net, struct nlattr *nla,
108 struct nlattr *est, struct tc_action *act, int ovr, 105 struct nlattr *est, struct tc_action *act, int ovr,
109 int bind); 106 int bind);
110 int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); 107 int (*walk)(struct net *, struct sk_buff *,
108 struct netlink_callback *, int, struct tc_action *);
109};
110
111struct tc_action_net {
112 struct tcf_hashinfo *hinfo;
113 const struct tc_action_ops *ops;
111}; 114};
112 115
113int tcf_hash_search(struct tc_action *a, u32 index); 116static inline
114u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo); 117int tc_action_net_init(struct tc_action_net *tn, const struct tc_action_ops *ops,
115int tcf_hash_check(u32 index, struct tc_action *a, int bind); 118 unsigned int mask)
116int tcf_hash_create(u32 index, struct nlattr *est, struct tc_action *a, 119{
117 int size, int bind, bool cpustats); 120 int err = 0;
121
122 tn->hinfo = kmalloc(sizeof(*tn->hinfo), GFP_KERNEL);
123 if (!tn->hinfo)
124 return -ENOMEM;
125 tn->ops = ops;
126 err = tcf_hashinfo_init(tn->hinfo, mask);
127 if (err)
128 kfree(tn->hinfo);
129 return err;
130}
131
132void tcf_hashinfo_destroy(const struct tc_action_ops *ops,
133 struct tcf_hashinfo *hinfo);
134
135static inline void tc_action_net_exit(struct tc_action_net *tn)
136{
137 tcf_hashinfo_destroy(tn->ops, tn->hinfo);
138}
139
140int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,
141 struct netlink_callback *cb, int type,
142 struct tc_action *a);
143int tcf_hash_search(struct tc_action_net *tn, struct tc_action *a, u32 index);
144u32 tcf_hash_new_index(struct tc_action_net *tn);
145int tcf_hash_check(struct tc_action_net *tn, u32 index, struct tc_action *a,
146 int bind);
147int tcf_hash_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
148 struct tc_action *a, int size, int bind, bool cpustats);
118void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est); 149void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est);
119void tcf_hash_insert(struct tc_action *a); 150void tcf_hash_insert(struct tc_action_net *tn, struct tc_action *a);
120 151
121int __tcf_hash_release(struct tc_action *a, bool bind, bool strict); 152int __tcf_hash_release(struct tc_action *a, bool bind, bool strict);
122 153
@@ -125,8 +156,8 @@ static inline int tcf_hash_release(struct tc_action *a, bool bind)
125 return __tcf_hash_release(a, bind, false); 156 return __tcf_hash_release(a, bind, false);
126} 157}
127 158
128int tcf_register_action(struct tc_action_ops *a, unsigned int mask); 159int tcf_register_action(struct tc_action_ops *a, struct pernet_operations *ops);
129int tcf_unregister_action(struct tc_action_ops *a); 160int tcf_unregister_action(struct tc_action_ops *a, struct pernet_operations *ops);
130int tcf_action_destroy(struct list_head *actions, int bind); 161int tcf_action_destroy(struct list_head *actions, int bind);
131int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions, 162int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions,
132 struct tcf_result *res); 163 struct tcf_result *res);
@@ -140,5 +171,16 @@ int tcf_action_dump(struct sk_buff *skb, struct list_head *, int, int);
140int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); 171int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
141int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); 172int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);
142int tcf_action_copy_stats(struct sk_buff *, struct tc_action *, int); 173int tcf_action_copy_stats(struct sk_buff *, struct tc_action *, int);
174
175#define tc_no_actions(_exts) \
176 (list_empty(&(_exts)->actions))
177
178#define tc_for_each_action(_a, _exts) \
179 list_for_each_entry(a, &(_exts)->actions, list)
180#else /* CONFIG_NET_CLS_ACT */
181
182#define tc_no_actions(_exts) true
183#define tc_for_each_action(_a, _exts) while (0)
184
143#endif /* CONFIG_NET_CLS_ACT */ 185#endif /* CONFIG_NET_CLS_ACT */
144#endif 186#endif
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 47f52d3cd8df..730d856683e5 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -87,6 +87,8 @@ int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr,
87 u32 banned_flags); 87 u32 banned_flags);
88int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr, 88int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr,
89 u32 banned_flags); 89 u32 banned_flags);
90int ipv4_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2,
91 bool match_wildcard);
90int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2, 92int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2,
91 bool match_wildcard); 93 bool match_wildcard);
92void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr); 94void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr);
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 339ea57be423..5d38d980b89d 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -233,6 +233,7 @@ enum {
233 HCI_SC_ENABLED, 233 HCI_SC_ENABLED,
234 HCI_SC_ONLY, 234 HCI_SC_ONLY,
235 HCI_PRIVACY, 235 HCI_PRIVACY,
236 HCI_LIMITED_PRIVACY,
236 HCI_RPA_EXPIRED, 237 HCI_RPA_EXPIRED,
237 HCI_RPA_RESOLVING, 238 HCI_RPA_RESOLVING,
238 HCI_HS_ENABLED, 239 HCI_HS_ENABLED,
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index d4f82edb5cff..dc71473462ac 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -25,6 +25,7 @@
25#ifndef __HCI_CORE_H 25#ifndef __HCI_CORE_H
26#define __HCI_CORE_H 26#define __HCI_CORE_H
27 27
28#include <linux/leds.h>
28#include <net/bluetooth/hci.h> 29#include <net/bluetooth/hci.h>
29#include <net/bluetooth/hci_sock.h> 30#include <net/bluetooth/hci_sock.h>
30 31
@@ -396,6 +397,8 @@ struct hci_dev {
396 struct delayed_work rpa_expired; 397 struct delayed_work rpa_expired;
397 bdaddr_t rpa; 398 bdaddr_t rpa;
398 399
400 struct led_trigger *power_led;
401
399 int (*open)(struct hci_dev *hdev); 402 int (*open)(struct hci_dev *hdev);
400 int (*close)(struct hci_dev *hdev); 403 int (*close)(struct hci_dev *hdev);
401 int (*flush)(struct hci_dev *hdev); 404 int (*flush)(struct hci_dev *hdev);
diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h
index f1fbc3b11962..f358ad5e4214 100644
--- a/include/net/bond_3ad.h
+++ b/include/net/bond_3ad.h
@@ -306,5 +306,6 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
306 struct slave *slave); 306 struct slave *slave);
307int bond_3ad_set_carrier(struct bonding *bond); 307int bond_3ad_set_carrier(struct bonding *bond);
308void bond_3ad_update_lacp_rate(struct bonding *bond); 308void bond_3ad_update_lacp_rate(struct bonding *bond);
309void bond_3ad_update_ad_actor_settings(struct bonding *bond);
309#endif /* _NET_BOND_3AD_H */ 310#endif /* _NET_BOND_3AD_H */
310 311
diff --git a/include/net/bonding.h b/include/net/bonding.h
index ee6c52053aa3..791800ddd6d9 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -215,6 +215,7 @@ struct bonding {
215 * ALB mode (6) - to sync the use and modifications of its hash table 215 * ALB mode (6) - to sync the use and modifications of its hash table
216 */ 216 */
217 spinlock_t mode_lock; 217 spinlock_t mode_lock;
218 spinlock_t stats_lock;
218 u8 send_peer_notif; 219 u8 send_peer_notif;
219 u8 igmp_retrans; 220 u8 igmp_retrans;
220#ifdef CONFIG_PROC_FS 221#ifdef CONFIG_PROC_FS
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9bcaaf7cd15a..9e1b24c29f0c 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -712,6 +712,8 @@ struct cfg80211_acl_data {
712 * @p2p_opp_ps: P2P opportunistic PS 712 * @p2p_opp_ps: P2P opportunistic PS
713 * @acl: ACL configuration used by the drivers which has support for 713 * @acl: ACL configuration used by the drivers which has support for
714 * MAC address based access control 714 * MAC address based access control
715 * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
716 * networks.
715 */ 717 */
716struct cfg80211_ap_settings { 718struct cfg80211_ap_settings {
717 struct cfg80211_chan_def chandef; 719 struct cfg80211_chan_def chandef;
@@ -730,6 +732,7 @@ struct cfg80211_ap_settings {
730 u8 p2p_ctwindow; 732 u8 p2p_ctwindow;
731 bool p2p_opp_ps; 733 bool p2p_opp_ps;
732 const struct cfg80211_acl_data *acl; 734 const struct cfg80211_acl_data *acl;
735 bool pbss;
733}; 736};
734 737
735/** 738/**
@@ -1888,6 +1891,8 @@ struct cfg80211_ibss_params {
1888 * @ht_capa_mask: The bits of ht_capa which are to be used. 1891 * @ht_capa_mask: The bits of ht_capa which are to be used.
1889 * @vht_capa: VHT Capability overrides 1892 * @vht_capa: VHT Capability overrides
1890 * @vht_capa_mask: The bits of vht_capa which are to be used. 1893 * @vht_capa_mask: The bits of vht_capa which are to be used.
1894 * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
1895 * networks.
1891 */ 1896 */
1892struct cfg80211_connect_params { 1897struct cfg80211_connect_params {
1893 struct ieee80211_channel *channel; 1898 struct ieee80211_channel *channel;
@@ -1910,6 +1915,7 @@ struct cfg80211_connect_params {
1910 struct ieee80211_ht_cap ht_capa_mask; 1915 struct ieee80211_ht_cap ht_capa_mask;
1911 struct ieee80211_vht_cap vht_capa; 1916 struct ieee80211_vht_cap vht_capa;
1912 struct ieee80211_vht_cap vht_capa_mask; 1917 struct ieee80211_vht_cap vht_capa_mask;
1918 bool pbss;
1913}; 1919};
1914 1920
1915/** 1921/**
@@ -3489,6 +3495,7 @@ struct cfg80211_cached_keys;
3489 * registered for unexpected class 3 frames (AP mode) 3495 * registered for unexpected class 3 frames (AP mode)
3490 * @conn: (private) cfg80211 software SME connection state machine data 3496 * @conn: (private) cfg80211 software SME connection state machine data
3491 * @connect_keys: (private) keys to set after connection is established 3497 * @connect_keys: (private) keys to set after connection is established
3498 * @conn_bss_type: connecting/connected BSS type
3492 * @ibss_fixed: (private) IBSS is using fixed BSSID 3499 * @ibss_fixed: (private) IBSS is using fixed BSSID
3493 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 3500 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
3494 * @event_list: (private) list for internal event processing 3501 * @event_list: (private) list for internal event processing
@@ -3519,6 +3526,7 @@ struct wireless_dev {
3519 u8 ssid_len, mesh_id_len, mesh_id_up_len; 3526 u8 ssid_len, mesh_id_len, mesh_id_up_len;
3520 struct cfg80211_conn *conn; 3527 struct cfg80211_conn *conn;
3521 struct cfg80211_cached_keys *connect_keys; 3528 struct cfg80211_cached_keys *connect_keys;
3529 enum ieee80211_bss_type conn_bss_type;
3522 3530
3523 struct list_head event_list; 3531 struct list_head event_list;
3524 spinlock_t event_lock; 3532 spinlock_t event_lock;
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 10a16b5bd1c7..5c30891e84e5 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -88,8 +88,11 @@ static inline __wsum
88csum_block_add(__wsum csum, __wsum csum2, int offset) 88csum_block_add(__wsum csum, __wsum csum2, int offset)
89{ 89{
90 u32 sum = (__force u32)csum2; 90 u32 sum = (__force u32)csum2;
91 if (offset&1) 91
92 sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF); 92 /* rotate sum to align it with a 16b boundary */
93 if (offset & 1)
94 sum = ror32(sum, 8);
95
93 return csum_add(csum, (__force __wsum)sum); 96 return csum_add(csum, (__force __wsum)sum);
94} 97}
95 98
@@ -102,10 +105,7 @@ csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len)
102static inline __wsum 105static inline __wsum
103csum_block_sub(__wsum csum, __wsum csum2, int offset) 106csum_block_sub(__wsum csum, __wsum csum2, int offset)
104{ 107{
105 u32 sum = (__force u32)csum2; 108 return csum_block_add(csum, ~csum2, offset);
106 if (offset&1)
107 sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF);
108 return csum_sub(csum, (__force __wsum)sum);
109} 109}
110 110
111static inline __wsum csum_unfold(__sum16 n) 111static inline __wsum csum_unfold(__sum16 n)
@@ -120,6 +120,11 @@ static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum)
120 120
121#define CSUM_MANGLED_0 ((__force __sum16)0xffff) 121#define CSUM_MANGLED_0 ((__force __sum16)0xffff)
122 122
123static inline void csum_replace_by_diff(__sum16 *sum, __wsum diff)
124{
125 *sum = csum_fold(csum_add(diff, ~csum_unfold(*sum)));
126}
127
123static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) 128static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
124{ 129{
125 __wsum tmp = csum_sub(~csum_unfold(*sum), (__force __wsum)from); 130 __wsum tmp = csum_sub(~csum_unfold(*sum), (__force __wsum)from);
diff --git a/include/net/codel.h b/include/net/codel.h
index 267e70210061..d168aca115cc 100644
--- a/include/net/codel.h
+++ b/include/net/codel.h
@@ -162,12 +162,14 @@ struct codel_vars {
162 * struct codel_stats - contains codel shared variables and stats 162 * struct codel_stats - contains codel shared variables and stats
163 * @maxpacket: largest packet we've seen so far 163 * @maxpacket: largest packet we've seen so far
164 * @drop_count: temp count of dropped packets in dequeue() 164 * @drop_count: temp count of dropped packets in dequeue()
165 * @drop_len: bytes of dropped packets in dequeue()
165 * ecn_mark: number of packets we ECN marked instead of dropping 166 * ecn_mark: number of packets we ECN marked instead of dropping
166 * ce_mark: number of packets CE marked because sojourn time was above ce_threshold 167 * ce_mark: number of packets CE marked because sojourn time was above ce_threshold
167 */ 168 */
168struct codel_stats { 169struct codel_stats {
169 u32 maxpacket; 170 u32 maxpacket;
170 u32 drop_count; 171 u32 drop_count;
172 u32 drop_len;
171 u32 ecn_mark; 173 u32 ecn_mark;
172 u32 ce_mark; 174 u32 ce_mark;
173}; 175};
@@ -308,6 +310,7 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
308 vars->rec_inv_sqrt); 310 vars->rec_inv_sqrt);
309 goto end; 311 goto end;
310 } 312 }
313 stats->drop_len += qdisc_pkt_len(skb);
311 qdisc_drop(skb, sch); 314 qdisc_drop(skb, sch);
312 stats->drop_count++; 315 stats->drop_count++;
313 skb = dequeue_func(vars, sch); 316 skb = dequeue_func(vars, sch);
@@ -330,6 +333,7 @@ static struct sk_buff *codel_dequeue(struct Qdisc *sch,
330 if (params->ecn && INET_ECN_set_ce(skb)) { 333 if (params->ecn && INET_ECN_set_ce(skb)) {
331 stats->ecn_mark++; 334 stats->ecn_mark++;
332 } else { 335 } else {
336 stats->drop_len += qdisc_pkt_len(skb);
333 qdisc_drop(skb, sch); 337 qdisc_drop(skb, sch);
334 stats->drop_count++; 338 stats->drop_count++;
335 339
diff --git a/include/net/devlink.h b/include/net/devlink.h
new file mode 100644
index 000000000000..c37d257891d6
--- /dev/null
+++ b/include/net/devlink.h
@@ -0,0 +1,140 @@
1/*
2 * include/net/devlink.h - Network physical device Netlink interface
3 * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
4 * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11#ifndef _NET_DEVLINK_H_
12#define _NET_DEVLINK_H_
13
14#include <linux/device.h>
15#include <linux/slab.h>
16#include <linux/gfp.h>
17#include <linux/list.h>
18#include <linux/netdevice.h>
19#include <net/net_namespace.h>
20#include <uapi/linux/devlink.h>
21
22struct devlink_ops;
23
24struct devlink {
25 struct list_head list;
26 struct list_head port_list;
27 const struct devlink_ops *ops;
28 struct device *dev;
29 possible_net_t _net;
30 char priv[0] __aligned(NETDEV_ALIGN);
31};
32
33struct devlink_port {
34 struct list_head list;
35 struct devlink *devlink;
36 unsigned index;
37 bool registered;
38 enum devlink_port_type type;
39 enum devlink_port_type desired_type;
40 void *type_dev;
41 bool split;
42 u32 split_group;
43};
44
45struct devlink_ops {
46 size_t priv_size;
47 int (*port_type_set)(struct devlink_port *devlink_port,
48 enum devlink_port_type port_type);
49 int (*port_split)(struct devlink *devlink, unsigned int port_index,
50 unsigned int count);
51 int (*port_unsplit)(struct devlink *devlink, unsigned int port_index);
52};
53
54static inline void *devlink_priv(struct devlink *devlink)
55{
56 BUG_ON(!devlink);
57 return &devlink->priv;
58}
59
60static inline struct devlink *priv_to_devlink(void *priv)
61{
62 BUG_ON(!priv);
63 return container_of(priv, struct devlink, priv);
64}
65
66struct ib_device;
67
68#if IS_ENABLED(CONFIG_NET_DEVLINK)
69
70struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size);
71int devlink_register(struct devlink *devlink, struct device *dev);
72void devlink_unregister(struct devlink *devlink);
73void devlink_free(struct devlink *devlink);
74int devlink_port_register(struct devlink *devlink,
75 struct devlink_port *devlink_port,
76 unsigned int port_index);
77void devlink_port_unregister(struct devlink_port *devlink_port);
78void devlink_port_type_eth_set(struct devlink_port *devlink_port,
79 struct net_device *netdev);
80void devlink_port_type_ib_set(struct devlink_port *devlink_port,
81 struct ib_device *ibdev);
82void devlink_port_type_clear(struct devlink_port *devlink_port);
83void devlink_port_split_set(struct devlink_port *devlink_port,
84 u32 split_group);
85
86#else
87
88static inline struct devlink *devlink_alloc(const struct devlink_ops *ops,
89 size_t priv_size)
90{
91 return kzalloc(sizeof(struct devlink) + priv_size, GFP_KERNEL);
92}
93
94static inline int devlink_register(struct devlink *devlink, struct device *dev)
95{
96 return 0;
97}
98
99static inline void devlink_unregister(struct devlink *devlink)
100{
101}
102
103static inline void devlink_free(struct devlink *devlink)
104{
105 kfree(devlink);
106}
107
108static inline int devlink_port_register(struct devlink *devlink,
109 struct devlink_port *devlink_port,
110 unsigned int port_index)
111{
112 return 0;
113}
114
115static inline void devlink_port_unregister(struct devlink_port *devlink_port)
116{
117}
118
119static inline void devlink_port_type_eth_set(struct devlink_port *devlink_port,
120 struct net_device *netdev)
121{
122}
123
124static inline void devlink_port_type_ib_set(struct devlink_port *devlink_port,
125 struct ib_device *ibdev)
126{
127}
128
129static inline void devlink_port_type_clear(struct devlink_port *devlink_port)
130{
131}
132
133static inline void devlink_port_split_set(struct devlink_port *devlink_port,
134 u32 split_group)
135{
136}
137
138#endif
139
140#endif /* _NET_DEVLINK_H_ */
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 26a0e86e611e..6463bb2863ac 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -296,16 +296,17 @@ struct dsa_switch_driver {
296 /* 296 /*
297 * Bridge integration 297 * Bridge integration
298 */ 298 */
299 int (*port_join_bridge)(struct dsa_switch *ds, int port, 299 int (*port_bridge_join)(struct dsa_switch *ds, int port,
300 u32 br_port_mask); 300 struct net_device *bridge);
301 int (*port_leave_bridge)(struct dsa_switch *ds, int port, 301 void (*port_bridge_leave)(struct dsa_switch *ds, int port);
302 u32 br_port_mask);
303 int (*port_stp_update)(struct dsa_switch *ds, int port, 302 int (*port_stp_update)(struct dsa_switch *ds, int port,
304 u8 state); 303 u8 state);
305 304
306 /* 305 /*
307 * VLAN support 306 * VLAN support
308 */ 307 */
308 int (*port_vlan_filtering)(struct dsa_switch *ds, int port,
309 bool vlan_filtering);
309 int (*port_vlan_prepare)(struct dsa_switch *ds, int port, 310 int (*port_vlan_prepare)(struct dsa_switch *ds, int port,
310 const struct switchdev_obj_port_vlan *vlan, 311 const struct switchdev_obj_port_vlan *vlan,
311 struct switchdev_trans *trans); 312 struct switchdev_trans *trans);
@@ -314,9 +315,9 @@ struct dsa_switch_driver {
314 struct switchdev_trans *trans); 315 struct switchdev_trans *trans);
315 int (*port_vlan_del)(struct dsa_switch *ds, int port, 316 int (*port_vlan_del)(struct dsa_switch *ds, int port,
316 const struct switchdev_obj_port_vlan *vlan); 317 const struct switchdev_obj_port_vlan *vlan);
317 int (*port_pvid_get)(struct dsa_switch *ds, int port, u16 *pvid); 318 int (*port_vlan_dump)(struct dsa_switch *ds, int port,
318 int (*vlan_getnext)(struct dsa_switch *ds, u16 *vid, 319 struct switchdev_obj_port_vlan *vlan,
319 unsigned long *ports, unsigned long *untagged); 320 int (*cb)(struct switchdev_obj *obj));
320 321
321 /* 322 /*
322 * Forwarding database 323 * Forwarding database
diff --git a/include/net/dst.h b/include/net/dst.h
index c7329dcd90cc..5c98443c1c9e 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -398,6 +398,18 @@ static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev,
398 __skb_tunnel_rx(skb, dev, net); 398 __skb_tunnel_rx(skb, dev, net);
399} 399}
400 400
401static inline u32 dst_tclassid(const struct sk_buff *skb)
402{
403#ifdef CONFIG_IP_ROUTE_CLASSID
404 const struct dst_entry *dst;
405
406 dst = skb_dst(skb);
407 if (dst)
408 return dst->tclassid;
409#endif
410 return 0;
411}
412
401int dst_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb); 413int dst_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb);
402static inline int dst_discard(struct sk_buff *skb) 414static inline int dst_discard(struct sk_buff *skb)
403{ 415{
diff --git a/include/net/dst_cache.h b/include/net/dst_cache.h
new file mode 100644
index 000000000000..151accae708b
--- /dev/null
+++ b/include/net/dst_cache.h
@@ -0,0 +1,97 @@
1#ifndef _NET_DST_CACHE_H
2#define _NET_DST_CACHE_H
3
4#include <linux/jiffies.h>
5#include <net/dst.h>
6#if IS_ENABLED(CONFIG_IPV6)
7#include <net/ip6_fib.h>
8#endif
9
10struct dst_cache {
11 struct dst_cache_pcpu __percpu *cache;
12 unsigned long reset_ts;
13};
14
15/**
16 * dst_cache_get - perform cache lookup
17 * @dst_cache: the cache
18 *
19 * The caller should use dst_cache_get_ip4() if it need to retrieve the
20 * source address to be used when xmitting to the cached dst.
21 * local BH must be disabled.
22 */
23struct dst_entry *dst_cache_get(struct dst_cache *dst_cache);
24
25/**
26 * dst_cache_get_ip4 - perform cache lookup and fetch ipv4 source address
27 * @dst_cache: the cache
28 * @saddr: return value for the retrieved source address
29 *
30 * local BH must be disabled.
31 */
32struct rtable *dst_cache_get_ip4(struct dst_cache *dst_cache, __be32 *saddr);
33
34/**
35 * dst_cache_set_ip4 - store the ipv4 dst into the cache
36 * @dst_cache: the cache
37 * @dst: the entry to be cached
38 * @saddr: the source address to be stored inside the cache
39 *
40 * local BH must be disabled.
41 */
42void dst_cache_set_ip4(struct dst_cache *dst_cache, struct dst_entry *dst,
43 __be32 saddr);
44
45#if IS_ENABLED(CONFIG_IPV6)
46
47/**
48 * dst_cache_set_ip6 - store the ipv6 dst into the cache
49 * @dst_cache: the cache
50 * @dst: the entry to be cached
51 * @saddr: the source address to be stored inside the cache
52 *
53 * local BH must be disabled.
54 */
55void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst,
56 const struct in6_addr *addr);
57
58/**
59 * dst_cache_get_ip6 - perform cache lookup and fetch ipv6 source address
60 * @dst_cache: the cache
61 * @saddr: return value for the retrieved source address
62 *
63 * local BH must be disabled.
64 */
65struct dst_entry *dst_cache_get_ip6(struct dst_cache *dst_cache,
66 struct in6_addr *saddr);
67#endif
68
69/**
70 * dst_cache_reset - invalidate the cache contents
71 * @dst_cache: the cache
72 *
73 * This do not free the cached dst to avoid races and contentions.
74 * the dst will be freed on later cache lookup.
75 */
76static inline void dst_cache_reset(struct dst_cache *dst_cache)
77{
78 dst_cache->reset_ts = jiffies;
79}
80
81/**
82 * dst_cache_init - initialize the cache, allocating the required storage
83 * @dst_cache: the cache
84 * @gfp: allocation flags
85 */
86int dst_cache_init(struct dst_cache *dst_cache, gfp_t gfp);
87
88/**
89 * dst_cache_destroy - empty the cache and free the allocated storage
90 * @dst_cache: the cache
91 *
92 * No synchronization is enforced: it must be called only when the cache
93 * is unsed.
94 */
95void dst_cache_destroy(struct dst_cache *dst_cache);
96
97#endif
diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h
index 30a56ab2ccfb..5db9f5910428 100644
--- a/include/net/dst_metadata.h
+++ b/include/net/dst_metadata.h
@@ -62,6 +62,7 @@ static inline int skb_metadata_dst_cmp(const struct sk_buff *skb_a,
62 sizeof(a->u.tun_info) + a->u.tun_info.options_len); 62 sizeof(a->u.tun_info) + a->u.tun_info.options_len);
63} 63}
64 64
65void metadata_dst_free(struct metadata_dst *);
65struct metadata_dst *metadata_dst_alloc(u8 optslen, gfp_t flags); 66struct metadata_dst *metadata_dst_alloc(u8 optslen, gfp_t flags);
66struct metadata_dst __percpu *metadata_dst_alloc_percpu(u8 optslen, gfp_t flags); 67struct metadata_dst __percpu *metadata_dst_alloc_percpu(u8 optslen, gfp_t flags);
67 68
@@ -125,7 +126,7 @@ static inline struct metadata_dst *ip_tun_rx_dst(struct sk_buff *skb,
125 126
126 ip_tunnel_key_init(&tun_dst->u.tun_info.key, 127 ip_tunnel_key_init(&tun_dst->u.tun_info.key,
127 iph->saddr, iph->daddr, iph->tos, iph->ttl, 128 iph->saddr, iph->daddr, iph->tos, iph->ttl,
128 0, 0, tunnel_id, flags); 129 0, 0, 0, tunnel_id, flags);
129 return tun_dst; 130 return tun_dst;
130} 131}
131 132
@@ -151,8 +152,11 @@ static inline struct metadata_dst *ipv6_tun_rx_dst(struct sk_buff *skb,
151 152
152 info->key.u.ipv6.src = ip6h->saddr; 153 info->key.u.ipv6.src = ip6h->saddr;
153 info->key.u.ipv6.dst = ip6h->daddr; 154 info->key.u.ipv6.dst = ip6h->daddr;
155
154 info->key.tos = ipv6_get_dsfield(ip6h); 156 info->key.tos = ipv6_get_dsfield(ip6h);
155 info->key.ttl = ip6h->hop_limit; 157 info->key.ttl = ip6h->hop_limit;
158 info->key.label = ip6_flowlabel(ip6h);
159
156 return tun_dst; 160 return tun_dst;
157} 161}
158 162
diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index 8c8548cf5888..d3d60dccd19f 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -184,4 +184,17 @@ static inline bool flow_keys_have_l4(struct flow_keys *keys)
184 184
185u32 flow_hash_from_keys(struct flow_keys *keys); 185u32 flow_hash_from_keys(struct flow_keys *keys);
186 186
187static inline bool dissector_uses_key(const struct flow_dissector *flow_dissector,
188 enum flow_dissector_key_id key_id)
189{
190 return flow_dissector->used_keys & (1 << key_id);
191}
192
193static inline void *skb_flow_dissector_target(struct flow_dissector *flow_dissector,
194 enum flow_dissector_key_id key_id,
195 void *target_container)
196{
197 return ((char *)target_container) + flow_dissector->offset[key_id];
198}
199
187#endif 200#endif
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 43c0e771f417..8d4608ce8716 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -83,7 +83,6 @@ struct genl_family {
83 * @attrs: netlink attributes 83 * @attrs: netlink attributes
84 * @_net: network namespace 84 * @_net: network namespace
85 * @user_ptr: user pointers 85 * @user_ptr: user pointers
86 * @dst_sk: destination socket
87 */ 86 */
88struct genl_info { 87struct genl_info {
89 u32 snd_seq; 88 u32 snd_seq;
@@ -94,7 +93,6 @@ struct genl_info {
94 struct nlattr ** attrs; 93 struct nlattr ** attrs;
95 possible_net_t _net; 94 possible_net_t _net;
96 void * user_ptr[2]; 95 void * user_ptr[2];
97 struct sock * dst_sk;
98}; 96};
99 97
100static inline struct net *genl_info_net(struct genl_info *info) 98static inline struct net *genl_info_net(struct genl_info *info)
@@ -188,8 +186,6 @@ int genl_unregister_family(struct genl_family *family);
188void genl_notify(struct genl_family *family, struct sk_buff *skb, 186void genl_notify(struct genl_family *family, struct sk_buff *skb,
189 struct genl_info *info, u32 group, gfp_t flags); 187 struct genl_info *info, u32 group, gfp_t flags);
190 188
191struct sk_buff *genlmsg_new_unicast(size_t payload, struct genl_info *info,
192 gfp_t flags);
193void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, 189void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
194 struct genl_family *family, int flags, u8 cmd); 190 struct genl_family *family, int flags, u8 cmd);
195 191
diff --git a/include/net/hwbm.h b/include/net/hwbm.h
new file mode 100644
index 000000000000..47d08662501b
--- /dev/null
+++ b/include/net/hwbm.h
@@ -0,0 +1,28 @@
1#ifndef _HWBM_H
2#define _HWBM_H
3
4struct hwbm_pool {
5 /* Capacity of the pool */
6 int size;
7 /* Size of the buffers managed */
8 int frag_size;
9 /* Number of buffers currently used by this pool */
10 int buf_num;
11 /* constructor called during alocation */
12 int (*construct)(struct hwbm_pool *bm_pool, void *buf);
13 /* protect acces to the buffer counter*/
14 spinlock_t lock;
15 /* private data */
16 void *priv;
17};
18#ifdef CONFIG_HWBM
19void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf);
20int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp);
21int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp);
22#else
23void hwbm_buf_free(struct hwbm_pool *bm_pool, void *buf) {}
24int hwbm_pool_refill(struct hwbm_pool *bm_pool, gfp_t gfp) { return 0; }
25int hwbm_pool_add(struct hwbm_pool *bm_pool, unsigned int buf_num, gfp_t gfp)
26{ return 0; }
27#endif /* CONFIG_HWBM */
28#endif /* _HWBM_H */
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 7ff588ca6817..28332bdac333 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -53,6 +53,7 @@ struct sock *__inet6_lookup_established(struct net *net,
53 53
54struct sock *inet6_lookup_listener(struct net *net, 54struct sock *inet6_lookup_listener(struct net *net,
55 struct inet_hashinfo *hashinfo, 55 struct inet_hashinfo *hashinfo,
56 struct sk_buff *skb, int doff,
56 const struct in6_addr *saddr, 57 const struct in6_addr *saddr,
57 const __be16 sport, 58 const __be16 sport,
58 const struct in6_addr *daddr, 59 const struct in6_addr *daddr,
@@ -60,6 +61,7 @@ struct sock *inet6_lookup_listener(struct net *net,
60 61
61static inline struct sock *__inet6_lookup(struct net *net, 62static inline struct sock *__inet6_lookup(struct net *net,
62 struct inet_hashinfo *hashinfo, 63 struct inet_hashinfo *hashinfo,
64 struct sk_buff *skb, int doff,
63 const struct in6_addr *saddr, 65 const struct in6_addr *saddr,
64 const __be16 sport, 66 const __be16 sport,
65 const struct in6_addr *daddr, 67 const struct in6_addr *daddr,
@@ -71,12 +73,12 @@ static inline struct sock *__inet6_lookup(struct net *net,
71 if (sk) 73 if (sk)
72 return sk; 74 return sk;
73 75
74 return inet6_lookup_listener(net, hashinfo, saddr, sport, 76 return inet6_lookup_listener(net, hashinfo, skb, doff, saddr, sport,
75 daddr, hnum, dif); 77 daddr, hnum, dif);
76} 78}
77 79
78static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, 80static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
79 struct sk_buff *skb, 81 struct sk_buff *skb, int doff,
80 const __be16 sport, 82 const __be16 sport,
81 const __be16 dport, 83 const __be16 dport,
82 int iif) 84 int iif)
@@ -86,16 +88,19 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
86 if (sk) 88 if (sk)
87 return sk; 89 return sk;
88 90
89 return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo, 91 return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo, skb,
90 &ipv6_hdr(skb)->saddr, sport, 92 doff, &ipv6_hdr(skb)->saddr, sport,
91 &ipv6_hdr(skb)->daddr, ntohs(dport), 93 &ipv6_hdr(skb)->daddr, ntohs(dport),
92 iif); 94 iif);
93} 95}
94 96
95struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, 97struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
98 struct sk_buff *skb, int doff,
96 const struct in6_addr *saddr, const __be16 sport, 99 const struct in6_addr *saddr, const __be16 sport,
97 const struct in6_addr *daddr, const __be16 dport, 100 const struct in6_addr *daddr, const __be16 dport,
98 const int dif); 101 const int dif);
102
103int inet6_hash(struct sock *sk);
99#endif /* IS_ENABLED(CONFIG_IPV6) */ 104#endif /* IS_ENABLED(CONFIG_IPV6) */
100 105
101#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \ 106#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif) \
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 12aac0fd6ee7..909972aa3acd 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -13,6 +13,7 @@ struct netns_frags {
13 int timeout; 13 int timeout;
14 int high_thresh; 14 int high_thresh;
15 int low_thresh; 15 int low_thresh;
16 int max_dist;
16}; 17};
17 18
18/** 19/**
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index de2e3ade6102..50f635c2c536 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -207,12 +207,16 @@ void inet_hashinfo_init(struct inet_hashinfo *h);
207 207
208bool inet_ehash_insert(struct sock *sk, struct sock *osk); 208bool inet_ehash_insert(struct sock *sk, struct sock *osk);
209bool inet_ehash_nolisten(struct sock *sk, struct sock *osk); 209bool inet_ehash_nolisten(struct sock *sk, struct sock *osk);
210void __inet_hash(struct sock *sk, struct sock *osk); 210int __inet_hash(struct sock *sk, struct sock *osk,
211void inet_hash(struct sock *sk); 211 int (*saddr_same)(const struct sock *sk1,
212 const struct sock *sk2,
213 bool match_wildcard));
214int inet_hash(struct sock *sk);
212void inet_unhash(struct sock *sk); 215void inet_unhash(struct sock *sk);
213 216
214struct sock *__inet_lookup_listener(struct net *net, 217struct sock *__inet_lookup_listener(struct net *net,
215 struct inet_hashinfo *hashinfo, 218 struct inet_hashinfo *hashinfo,
219 struct sk_buff *skb, int doff,
216 const __be32 saddr, const __be16 sport, 220 const __be32 saddr, const __be16 sport,
217 const __be32 daddr, 221 const __be32 daddr,
218 const unsigned short hnum, 222 const unsigned short hnum,
@@ -220,10 +224,11 @@ struct sock *__inet_lookup_listener(struct net *net,
220 224
221static inline struct sock *inet_lookup_listener(struct net *net, 225static inline struct sock *inet_lookup_listener(struct net *net,
222 struct inet_hashinfo *hashinfo, 226 struct inet_hashinfo *hashinfo,
227 struct sk_buff *skb, int doff,
223 __be32 saddr, __be16 sport, 228 __be32 saddr, __be16 sport,
224 __be32 daddr, __be16 dport, int dif) 229 __be32 daddr, __be16 dport, int dif)
225{ 230{
226 return __inet_lookup_listener(net, hashinfo, saddr, sport, 231 return __inet_lookup_listener(net, hashinfo, skb, doff, saddr, sport,
227 daddr, ntohs(dport), dif); 232 daddr, ntohs(dport), dif);
228} 233}
229 234
@@ -299,6 +304,7 @@ static inline struct sock *
299 304
300static inline struct sock *__inet_lookup(struct net *net, 305static inline struct sock *__inet_lookup(struct net *net,
301 struct inet_hashinfo *hashinfo, 306 struct inet_hashinfo *hashinfo,
307 struct sk_buff *skb, int doff,
302 const __be32 saddr, const __be16 sport, 308 const __be32 saddr, const __be16 sport,
303 const __be32 daddr, const __be16 dport, 309 const __be32 daddr, const __be16 dport,
304 const int dif) 310 const int dif)
@@ -307,12 +313,13 @@ static inline struct sock *__inet_lookup(struct net *net,
307 struct sock *sk = __inet_lookup_established(net, hashinfo, 313 struct sock *sk = __inet_lookup_established(net, hashinfo,
308 saddr, sport, daddr, hnum, dif); 314 saddr, sport, daddr, hnum, dif);
309 315
310 return sk ? : __inet_lookup_listener(net, hashinfo, saddr, sport, 316 return sk ? : __inet_lookup_listener(net, hashinfo, skb, doff, saddr,
311 daddr, hnum, dif); 317 sport, daddr, hnum, dif);
312} 318}
313 319
314static inline struct sock *inet_lookup(struct net *net, 320static inline struct sock *inet_lookup(struct net *net,
315 struct inet_hashinfo *hashinfo, 321 struct inet_hashinfo *hashinfo,
322 struct sk_buff *skb, int doff,
316 const __be32 saddr, const __be16 sport, 323 const __be32 saddr, const __be16 sport,
317 const __be32 daddr, const __be16 dport, 324 const __be32 daddr, const __be16 dport,
318 const int dif) 325 const int dif)
@@ -320,7 +327,8 @@ static inline struct sock *inet_lookup(struct net *net,
320 struct sock *sk; 327 struct sock *sk;
321 328
322 local_bh_disable(); 329 local_bh_disable();
323 sk = __inet_lookup(net, hashinfo, saddr, sport, daddr, dport, dif); 330 sk = __inet_lookup(net, hashinfo, skb, doff, saddr, sport, daddr,
331 dport, dif);
324 local_bh_enable(); 332 local_bh_enable();
325 333
326 return sk; 334 return sk;
@@ -328,6 +336,7 @@ static inline struct sock *inet_lookup(struct net *net,
328 336
329static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo, 337static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
330 struct sk_buff *skb, 338 struct sk_buff *skb,
339 int doff,
331 const __be16 sport, 340 const __be16 sport,
332 const __be16 dport) 341 const __be16 dport)
333{ 342{
@@ -337,8 +346,8 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
337 if (sk) 346 if (sk)
338 return sk; 347 return sk;
339 else 348 else
340 return __inet_lookup(dev_net(skb_dst(skb)->dev), hashinfo, 349 return __inet_lookup(dev_net(skb_dst(skb)->dev), hashinfo, skb,
341 iph->saddr, sport, 350 doff, iph->saddr, sport,
342 iph->daddr, dport, inet_iif(skb)); 351 iph->daddr, dport, inet_iif(skb));
343} 352}
344 353
diff --git a/include/net/ip.h b/include/net/ip.h
index 1a98f1ca1638..fad74d323bd6 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -240,17 +240,13 @@ static inline int inet_is_local_reserved_port(struct net *net, int port)
240} 240}
241#endif 241#endif
242 242
243__be32 inet_current_timestamp(void);
244
243/* From inetpeer.c */ 245/* From inetpeer.c */
244extern int inet_peer_threshold; 246extern int inet_peer_threshold;
245extern int inet_peer_minttl; 247extern int inet_peer_minttl;
246extern int inet_peer_maxttl; 248extern int inet_peer_maxttl;
247 249
248/* From ip_input.c */
249extern int sysctl_ip_early_demux;
250
251/* From ip_output.c */
252extern int sysctl_ip_dynaddr;
253
254void ipfrag_init(void); 250void ipfrag_init(void);
255 251
256void ip_static_sysctl_init(void); 252void ip_static_sysctl_init(void);
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 1a49b73f7f6e..cca840584c88 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -37,8 +37,7 @@
37#ifndef _HAVE_ARCH_IPV6_CSUM 37#ifndef _HAVE_ARCH_IPV6_CSUM
38__sum16 csum_ipv6_magic(const struct in6_addr *saddr, 38__sum16 csum_ipv6_magic(const struct in6_addr *saddr,
39 const struct in6_addr *daddr, 39 const struct in6_addr *daddr,
40 __u32 len, unsigned short proto, 40 __u32 len, __u8 proto, __wsum csum);
41 __wsum csum);
42#endif 41#endif
43 42
44static inline __wsum ip6_compute_pseudo(struct sk_buff *skb, int proto) 43static inline __wsum ip6_compute_pseudo(struct sk_buff *skb, int proto)
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index 0d0ce0b2d870..499a707765ea 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -6,6 +6,7 @@
6#include <linux/if_tunnel.h> 6#include <linux/if_tunnel.h>
7#include <linux/ip6_tunnel.h> 7#include <linux/ip6_tunnel.h>
8#include <net/ip_tunnels.h> 8#include <net/ip_tunnels.h>
9#include <net/dst_cache.h>
9 10
10#define IP6TUNNEL_ERR_TIMEO (30*HZ) 11#define IP6TUNNEL_ERR_TIMEO (30*HZ)
11 12
@@ -33,12 +34,6 @@ struct __ip6_tnl_parm {
33 __be32 o_key; 34 __be32 o_key;
34}; 35};
35 36
36struct ip6_tnl_dst {
37 seqlock_t lock;
38 struct dst_entry __rcu *dst;
39 u32 cookie;
40};
41
42/* IPv6 tunnel */ 37/* IPv6 tunnel */
43struct ip6_tnl { 38struct ip6_tnl {
44 struct ip6_tnl __rcu *next; /* next tunnel in list */ 39 struct ip6_tnl __rcu *next; /* next tunnel in list */
@@ -46,7 +41,7 @@ struct ip6_tnl {
46 struct net *net; /* netns for packet i/o */ 41 struct net *net; /* netns for packet i/o */
47 struct __ip6_tnl_parm parms; /* tunnel configuration parameters */ 42 struct __ip6_tnl_parm parms; /* tunnel configuration parameters */
48 struct flowi fl; /* flowi template for xmit */ 43 struct flowi fl; /* flowi template for xmit */
49 struct ip6_tnl_dst __percpu *dst_cache; /* cached dst */ 44 struct dst_cache dst_cache; /* cached dst */
50 45
51 int err_count; 46 int err_count;
52 unsigned long err_time; 47 unsigned long err_time;
@@ -66,11 +61,6 @@ struct ipv6_tlv_tnl_enc_lim {
66 __u8 encap_limit; /* tunnel encapsulation limit */ 61 __u8 encap_limit; /* tunnel encapsulation limit */
67} __packed; 62} __packed;
68 63
69struct dst_entry *ip6_tnl_dst_get(struct ip6_tnl *t);
70int ip6_tnl_dst_init(struct ip6_tnl *t);
71void ip6_tnl_dst_destroy(struct ip6_tnl *t);
72void ip6_tnl_dst_reset(struct ip6_tnl *t);
73void ip6_tnl_dst_set(struct ip6_tnl *t, struct dst_entry *dst);
74int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, 64int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
75 const struct in6_addr *raddr); 65 const struct in6_addr *raddr);
76int ip6_tnl_xmit_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, 66int ip6_tnl_xmit_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index dda9abf6b89c..c35dda9ec991 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -7,12 +7,15 @@
7#include <linux/socket.h> 7#include <linux/socket.h>
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/u64_stats_sync.h> 9#include <linux/u64_stats_sync.h>
10#include <linux/bitops.h>
11
10#include <net/dsfield.h> 12#include <net/dsfield.h>
11#include <net/gro_cells.h> 13#include <net/gro_cells.h>
12#include <net/inet_ecn.h> 14#include <net/inet_ecn.h>
13#include <net/netns/generic.h> 15#include <net/netns/generic.h>
14#include <net/rtnetlink.h> 16#include <net/rtnetlink.h>
15#include <net/lwtunnel.h> 17#include <net/lwtunnel.h>
18#include <net/dst_cache.h>
16 19
17#if IS_ENABLED(CONFIG_IPV6) 20#if IS_ENABLED(CONFIG_IPV6)
18#include <net/ipv6.h> 21#include <net/ipv6.h>
@@ -47,6 +50,7 @@ struct ip_tunnel_key {
47 __be16 tun_flags; 50 __be16 tun_flags;
48 u8 tos; /* TOS for IPv4, TC for IPv6 */ 51 u8 tos; /* TOS for IPv4, TC for IPv6 */
49 u8 ttl; /* TTL for IPv4, HL for IPv6 */ 52 u8 ttl; /* TTL for IPv4, HL for IPv6 */
53 __be32 label; /* Flow Label for IPv6 */
50 __be16 tp_src; 54 __be16 tp_src;
51 __be16 tp_dst; 55 __be16 tp_dst;
52}; 56};
@@ -55,8 +59,16 @@ struct ip_tunnel_key {
55#define IP_TUNNEL_INFO_TX 0x01 /* represents tx tunnel parameters */ 59#define IP_TUNNEL_INFO_TX 0x01 /* represents tx tunnel parameters */
56#define IP_TUNNEL_INFO_IPV6 0x02 /* key contains IPv6 addresses */ 60#define IP_TUNNEL_INFO_IPV6 0x02 /* key contains IPv6 addresses */
57 61
62/* Maximum tunnel options length. */
63#define IP_TUNNEL_OPTS_MAX \
64 GENMASK((FIELD_SIZEOF(struct ip_tunnel_info, \
65 options_len) * BITS_PER_BYTE) - 1, 0)
66
58struct ip_tunnel_info { 67struct ip_tunnel_info {
59 struct ip_tunnel_key key; 68 struct ip_tunnel_key key;
69#ifdef CONFIG_DST_CACHE
70 struct dst_cache dst_cache;
71#endif
60 u8 options_len; 72 u8 options_len;
61 u8 mode; 73 u8 mode;
62}; 74};
@@ -85,11 +97,6 @@ struct ip_tunnel_prl_entry {
85 struct rcu_head rcu_head; 97 struct rcu_head rcu_head;
86}; 98};
87 99
88struct ip_tunnel_dst {
89 struct dst_entry __rcu *dst;
90 __be32 saddr;
91};
92
93struct metadata_dst; 100struct metadata_dst;
94 101
95struct ip_tunnel { 102struct ip_tunnel {
@@ -108,7 +115,7 @@ struct ip_tunnel {
108 int tun_hlen; /* Precalculated header length */ 115 int tun_hlen; /* Precalculated header length */
109 int mlink; 116 int mlink;
110 117
111 struct ip_tunnel_dst __percpu *dst_cache; 118 struct dst_cache dst_cache;
112 119
113 struct ip_tunnel_parm parms; 120 struct ip_tunnel_parm parms;
114 121
@@ -141,6 +148,7 @@ struct ip_tunnel {
141#define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400) 148#define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400)
142#define TUNNEL_GENEVE_OPT __cpu_to_be16(0x0800) 149#define TUNNEL_GENEVE_OPT __cpu_to_be16(0x0800)
143#define TUNNEL_VXLAN_OPT __cpu_to_be16(0x1000) 150#define TUNNEL_VXLAN_OPT __cpu_to_be16(0x1000)
151#define TUNNEL_NOCACHE __cpu_to_be16(0x2000)
144 152
145#define TUNNEL_OPTIONS_PRESENT (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT) 153#define TUNNEL_OPTIONS_PRESENT (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT)
146 154
@@ -181,7 +189,7 @@ int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *op,
181 189
182static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, 190static inline void ip_tunnel_key_init(struct ip_tunnel_key *key,
183 __be32 saddr, __be32 daddr, 191 __be32 saddr, __be32 daddr,
184 u8 tos, u8 ttl, 192 u8 tos, u8 ttl, __be32 label,
185 __be16 tp_src, __be16 tp_dst, 193 __be16 tp_src, __be16 tp_dst,
186 __be64 tun_id, __be16 tun_flags) 194 __be64 tun_id, __be16 tun_flags)
187{ 195{
@@ -192,6 +200,7 @@ static inline void ip_tunnel_key_init(struct ip_tunnel_key *key,
192 0, IP_TUNNEL_KEY_IPV4_PAD_LEN); 200 0, IP_TUNNEL_KEY_IPV4_PAD_LEN);
193 key->tos = tos; 201 key->tos = tos;
194 key->ttl = ttl; 202 key->ttl = ttl;
203 key->label = label;
195 key->tun_flags = tun_flags; 204 key->tun_flags = tun_flags;
196 205
197 /* For the tunnel types on the top of IPsec, the tp_src and tp_dst of 206 /* For the tunnel types on the top of IPsec, the tp_src and tp_dst of
@@ -207,6 +216,20 @@ static inline void ip_tunnel_key_init(struct ip_tunnel_key *key,
207 0, sizeof(*key) - IP_TUNNEL_KEY_SIZE); 216 0, sizeof(*key) - IP_TUNNEL_KEY_SIZE);
208} 217}
209 218
219static inline bool
220ip_tunnel_dst_cache_usable(const struct sk_buff *skb,
221 const struct ip_tunnel_info *info)
222{
223 if (skb->mark)
224 return false;
225 if (!info)
226 return true;
227 if (info->key.tun_flags & TUNNEL_NOCACHE)
228 return false;
229
230 return true;
231}
232
210static inline unsigned short ip_tunnel_info_af(const struct ip_tunnel_info 233static inline unsigned short ip_tunnel_info_af(const struct ip_tunnel_info
211 *tun_info) 234 *tun_info)
212{ 235{
@@ -248,7 +271,6 @@ int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[],
248int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[], 271int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
249 struct ip_tunnel_parm *p); 272 struct ip_tunnel_parm *p);
250void ip_tunnel_setup(struct net_device *dev, int net_id); 273void ip_tunnel_setup(struct net_device *dev, int net_id);
251void ip_tunnel_dst_reset_all(struct ip_tunnel *t);
252int ip_tunnel_encap_setup(struct ip_tunnel *t, 274int ip_tunnel_encap_setup(struct ip_tunnel *t,
253 struct ip_tunnel_encap *ipencap); 275 struct ip_tunnel_encap *ipencap);
254 276
@@ -273,15 +295,15 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
273 return INET_ECN_encapsulate(tos, inner); 295 return INET_ECN_encapsulate(tos, inner);
274} 296}
275 297
276int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); 298int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto,
299 bool xnet);
277void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, 300void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
278 __be32 src, __be32 dst, u8 proto, 301 __be32 src, __be32 dst, u8 proto,
279 u8 tos, u8 ttl, __be16 df, bool xnet); 302 u8 tos, u8 ttl, __be16 df, bool xnet);
280struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md, 303struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md,
281 gfp_t flags); 304 gfp_t flags);
282 305
283struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum, 306struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, int gso_type_mask);
284 int gso_type_mask);
285 307
286static inline void iptunnel_xmit_stats(struct net_device *dev, int pkt_len) 308static inline void iptunnel_xmit_stats(struct net_device *dev, int pkt_len)
287{ 309{
@@ -356,6 +378,17 @@ static inline void ip_tunnel_unneed_metadata(void)
356{ 378{
357} 379}
358 380
381static inline void ip_tunnel_info_opts_get(void *to,
382 const struct ip_tunnel_info *info)
383{
384}
385
386static inline void ip_tunnel_info_opts_set(struct ip_tunnel_info *info,
387 const void *from, int len)
388{
389 info->options_len = 0;
390}
391
359#endif /* CONFIG_INET */ 392#endif /* CONFIG_INET */
360 393
361#endif /* __NET_IP_TUNNELS_H */ 394#endif /* __NET_IP_TUNNELS_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 0816c872b689..a6cc576fd467 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1588,6 +1588,23 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp)
1588} 1588}
1589#endif /* CONFIG_IP_VS_NFCT */ 1589#endif /* CONFIG_IP_VS_NFCT */
1590 1590
1591/* Really using conntrack? */
1592static inline bool ip_vs_conn_uses_conntrack(struct ip_vs_conn *cp,
1593 struct sk_buff *skb)
1594{
1595#ifdef CONFIG_IP_VS_NFCT
1596 enum ip_conntrack_info ctinfo;
1597 struct nf_conn *ct;
1598
1599 if (!(cp->flags & IP_VS_CONN_F_NFCT))
1600 return false;
1601 ct = nf_ct_get(skb, &ctinfo);
1602 if (ct && !nf_ct_is_untracked(ct))
1603 return true;
1604#endif
1605 return false;
1606}
1607
1591static inline int 1608static inline int
1592ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) 1609ip_vs_dest_conn_overhead(struct ip_vs_dest *dest)
1593{ 1610{
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 6570f379aba2..f3c9857c645d 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -259,8 +259,12 @@ static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np)
259 259
260 rcu_read_lock(); 260 rcu_read_lock();
261 opt = rcu_dereference(np->opt); 261 opt = rcu_dereference(np->opt);
262 if (opt && !atomic_inc_not_zero(&opt->refcnt)) 262 if (opt) {
263 opt = NULL; 263 if (!atomic_inc_not_zero(&opt->refcnt))
264 opt = NULL;
265 else
266 opt = rcu_pointer_handoff(opt);
267 }
264 rcu_read_unlock(); 268 rcu_read_unlock();
265 return opt; 269 return opt;
266} 270}
diff --git a/include/net/kcm.h b/include/net/kcm.h
new file mode 100644
index 000000000000..2840b5825dcc
--- /dev/null
+++ b/include/net/kcm.h
@@ -0,0 +1,226 @@
1/*
2 * Kernel Connection Multiplexor
3 *
4 * Copyright (c) 2016 Tom Herbert <tom@herbertland.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 */
10
11#ifndef __NET_KCM_H_
12#define __NET_KCM_H_
13
14#include <linux/skbuff.h>
15#include <net/sock.h>
16#include <uapi/linux/kcm.h>
17
18extern unsigned int kcm_net_id;
19
20#define KCM_STATS_ADD(stat, count) ((stat) += (count))
21#define KCM_STATS_INCR(stat) ((stat)++)
22
23struct kcm_psock_stats {
24 unsigned long long rx_msgs;
25 unsigned long long rx_bytes;
26 unsigned long long tx_msgs;
27 unsigned long long tx_bytes;
28 unsigned int rx_aborts;
29 unsigned int rx_mem_fail;
30 unsigned int rx_need_more_hdr;
31 unsigned int rx_msg_too_big;
32 unsigned int rx_msg_timeouts;
33 unsigned int rx_bad_hdr_len;
34 unsigned long long reserved;
35 unsigned long long unreserved;
36 unsigned int tx_aborts;
37};
38
39struct kcm_mux_stats {
40 unsigned long long rx_msgs;
41 unsigned long long rx_bytes;
42 unsigned long long tx_msgs;
43 unsigned long long tx_bytes;
44 unsigned int rx_ready_drops;
45 unsigned int tx_retries;
46 unsigned int psock_attach;
47 unsigned int psock_unattach_rsvd;
48 unsigned int psock_unattach;
49};
50
51struct kcm_stats {
52 unsigned long long rx_msgs;
53 unsigned long long rx_bytes;
54 unsigned long long tx_msgs;
55 unsigned long long tx_bytes;
56};
57
58struct kcm_tx_msg {
59 unsigned int sent;
60 unsigned int fragidx;
61 unsigned int frag_offset;
62 unsigned int msg_flags;
63 struct sk_buff *frag_skb;
64 struct sk_buff *last_skb;
65};
66
67struct kcm_rx_msg {
68 int full_len;
69 int accum_len;
70 int offset;
71 int early_eaten;
72};
73
74/* Socket structure for KCM client sockets */
75struct kcm_sock {
76 struct sock sk;
77 struct kcm_mux *mux;
78 struct list_head kcm_sock_list;
79 int index;
80 u32 done : 1;
81 struct work_struct done_work;
82
83 struct kcm_stats stats;
84
85 /* Transmit */
86 struct kcm_psock *tx_psock;
87 struct work_struct tx_work;
88 struct list_head wait_psock_list;
89 struct sk_buff *seq_skb;
90
91 /* Don't use bit fields here, these are set under different locks */
92 bool tx_wait;
93 bool tx_wait_more;
94
95 /* Receive */
96 struct kcm_psock *rx_psock;
97 struct list_head wait_rx_list; /* KCMs waiting for receiving */
98 bool rx_wait;
99 u32 rx_disabled : 1;
100};
101
102struct bpf_prog;
103
104/* Structure for an attached lower socket */
105struct kcm_psock {
106 struct sock *sk;
107 struct kcm_mux *mux;
108 int index;
109
110 u32 tx_stopped : 1;
111 u32 rx_stopped : 1;
112 u32 done : 1;
113 u32 unattaching : 1;
114
115 void (*save_state_change)(struct sock *sk);
116 void (*save_data_ready)(struct sock *sk);
117 void (*save_write_space)(struct sock *sk);
118
119 struct list_head psock_list;
120
121 struct kcm_psock_stats stats;
122
123 /* Receive */
124 struct sk_buff *rx_skb_head;
125 struct sk_buff **rx_skb_nextp;
126 struct sk_buff *ready_rx_msg;
127 struct list_head psock_ready_list;
128 struct work_struct rx_work;
129 struct delayed_work rx_delayed_work;
130 struct bpf_prog *bpf_prog;
131 struct kcm_sock *rx_kcm;
132 unsigned long long saved_rx_bytes;
133 unsigned long long saved_rx_msgs;
134 struct timer_list rx_msg_timer;
135 unsigned int rx_need_bytes;
136
137 /* Transmit */
138 struct kcm_sock *tx_kcm;
139 struct list_head psock_avail_list;
140 unsigned long long saved_tx_bytes;
141 unsigned long long saved_tx_msgs;
142};
143
144/* Per net MUX list */
145struct kcm_net {
146 struct mutex mutex;
147 struct kcm_psock_stats aggregate_psock_stats;
148 struct kcm_mux_stats aggregate_mux_stats;
149 struct list_head mux_list;
150 int count;
151};
152
153/* Structure for a MUX */
154struct kcm_mux {
155 struct list_head kcm_mux_list;
156 struct rcu_head rcu;
157 struct kcm_net *knet;
158
159 struct list_head kcm_socks; /* All KCM sockets on MUX */
160 int kcm_socks_cnt; /* Total KCM socket count for MUX */
161 struct list_head psocks; /* List of all psocks on MUX */
162 int psocks_cnt; /* Total attached sockets */
163
164 struct kcm_mux_stats stats;
165 struct kcm_psock_stats aggregate_psock_stats;
166
167 /* Receive */
168 spinlock_t rx_lock ____cacheline_aligned_in_smp;
169 struct list_head kcm_rx_waiters; /* KCMs waiting for receiving */
170 struct list_head psocks_ready; /* List of psocks with a msg ready */
171 struct sk_buff_head rx_hold_queue;
172
173 /* Transmit */
174 spinlock_t lock ____cacheline_aligned_in_smp; /* TX and mux locking */
175 struct list_head psocks_avail; /* List of available psocks */
176 struct list_head kcm_tx_waiters; /* KCMs waiting for a TX psock */
177};
178
179#ifdef CONFIG_PROC_FS
180int kcm_proc_init(void);
181void kcm_proc_exit(void);
182#else
183static inline int kcm_proc_init(void) { return 0; }
184static inline void kcm_proc_exit(void) { }
185#endif
186
187static inline void aggregate_psock_stats(struct kcm_psock_stats *stats,
188 struct kcm_psock_stats *agg_stats)
189{
190 /* Save psock statistics in the mux when psock is being unattached. */
191
192#define SAVE_PSOCK_STATS(_stat) (agg_stats->_stat += stats->_stat)
193 SAVE_PSOCK_STATS(rx_msgs);
194 SAVE_PSOCK_STATS(rx_bytes);
195 SAVE_PSOCK_STATS(rx_aborts);
196 SAVE_PSOCK_STATS(rx_mem_fail);
197 SAVE_PSOCK_STATS(rx_need_more_hdr);
198 SAVE_PSOCK_STATS(rx_msg_too_big);
199 SAVE_PSOCK_STATS(rx_msg_timeouts);
200 SAVE_PSOCK_STATS(rx_bad_hdr_len);
201 SAVE_PSOCK_STATS(tx_msgs);
202 SAVE_PSOCK_STATS(tx_bytes);
203 SAVE_PSOCK_STATS(reserved);
204 SAVE_PSOCK_STATS(unreserved);
205 SAVE_PSOCK_STATS(tx_aborts);
206#undef SAVE_PSOCK_STATS
207}
208
209static inline void aggregate_mux_stats(struct kcm_mux_stats *stats,
210 struct kcm_mux_stats *agg_stats)
211{
212 /* Save psock statistics in the mux when psock is being unattached. */
213
214#define SAVE_MUX_STATS(_stat) (agg_stats->_stat += stats->_stat)
215 SAVE_MUX_STATS(rx_msgs);
216 SAVE_MUX_STATS(rx_bytes);
217 SAVE_MUX_STATS(tx_msgs);
218 SAVE_MUX_STATS(tx_bytes);
219 SAVE_MUX_STATS(rx_ready_drops);
220 SAVE_MUX_STATS(psock_attach);
221 SAVE_MUX_STATS(psock_unattach_rsvd);
222 SAVE_MUX_STATS(psock_unattach);
223#undef SAVE_MUX_STATS
224}
225
226#endif /* __NET_KCM_H_ */
diff --git a/include/net/l3mdev.h b/include/net/l3mdev.h
index 5567d46b3cff..c43a9c73de5e 100644
--- a/include/net/l3mdev.h
+++ b/include/net/l3mdev.h
@@ -39,7 +39,7 @@ struct l3mdev_ops {
39 39
40#ifdef CONFIG_NET_L3_MASTER_DEV 40#ifdef CONFIG_NET_L3_MASTER_DEV
41 41
42int l3mdev_master_ifindex_rcu(struct net_device *dev); 42int l3mdev_master_ifindex_rcu(const struct net_device *dev);
43static inline int l3mdev_master_ifindex(struct net_device *dev) 43static inline int l3mdev_master_ifindex(struct net_device *dev)
44{ 44{
45 int ifindex; 45 int ifindex;
@@ -179,7 +179,7 @@ struct dst_entry *l3mdev_rt6_dst_by_oif(struct net *net,
179 179
180#else 180#else
181 181
182static inline int l3mdev_master_ifindex_rcu(struct net_device *dev) 182static inline int l3mdev_master_ifindex_rcu(const struct net_device *dev)
183{ 183{
184 return 0; 184 return 0;
185} 185}
diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h
index 66350ce3e955..e9f116e29c22 100644
--- a/include/net/lwtunnel.h
+++ b/include/net/lwtunnel.h
@@ -170,6 +170,8 @@ static inline int lwtunnel_input(struct sk_buff *skb)
170 return -EOPNOTSUPP; 170 return -EOPNOTSUPP;
171} 171}
172 172
173#endif 173#endif /* CONFIG_LWTUNNEL */
174
175#define MODULE_ALIAS_RTNL_LWT(encap_type) MODULE_ALIAS("rtnl-lwt-" __stringify(encap_type))
174 176
175#endif /* __NET_LWTUNNEL_H */ 177#endif /* __NET_LWTUNNEL_H */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 7c30faff245f..0c09da34b67a 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -5,7 +5,7 @@
5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
6 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2013-2014 Intel Mobile Communications GmbH 7 * Copyright 2013-2014 Intel Mobile Communications GmbH
8 * Copyright (C) 2015 Intel Deutschland GmbH 8 * Copyright (C) 2015 - 2016 Intel Deutschland GmbH
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
@@ -298,6 +298,7 @@ struct ieee80211_vif_chanctx_switch {
298 * note that this is only called when it changes after the channel 298 * note that this is only called when it changes after the channel
299 * context had been assigned. 299 * context had been assigned.
300 * @BSS_CHANGED_OCB: OCB join status changed 300 * @BSS_CHANGED_OCB: OCB join status changed
301 * @BSS_CHANGED_MU_GROUPS: VHT MU-MIMO group id or user position changed
301 */ 302 */
302enum ieee80211_bss_change { 303enum ieee80211_bss_change {
303 BSS_CHANGED_ASSOC = 1<<0, 304 BSS_CHANGED_ASSOC = 1<<0,
@@ -323,6 +324,7 @@ enum ieee80211_bss_change {
323 BSS_CHANGED_BEACON_INFO = 1<<20, 324 BSS_CHANGED_BEACON_INFO = 1<<20,
324 BSS_CHANGED_BANDWIDTH = 1<<21, 325 BSS_CHANGED_BANDWIDTH = 1<<21,
325 BSS_CHANGED_OCB = 1<<22, 326 BSS_CHANGED_OCB = 1<<22,
327 BSS_CHANGED_MU_GROUPS = 1<<23,
326 328
327 /* when adding here, make sure to change ieee80211_reconfig */ 329 /* when adding here, make sure to change ieee80211_reconfig */
328}; 330};
@@ -436,6 +438,19 @@ struct ieee80211_event {
436}; 438};
437 439
438/** 440/**
441 * struct ieee80211_mu_group_data - STA's VHT MU-MIMO group data
442 *
443 * This structure describes the group id data of VHT MU-MIMO
444 *
445 * @membership: 64 bits array - a bit is set if station is member of the group
446 * @position: 2 bits per group id indicating the position in the group
447 */
448struct ieee80211_mu_group_data {
449 u8 membership[WLAN_MEMBERSHIP_LEN];
450 u8 position[WLAN_USER_POSITION_LEN];
451};
452
453/**
439 * struct ieee80211_bss_conf - holds the BSS's changing parameters 454 * struct ieee80211_bss_conf - holds the BSS's changing parameters
440 * 455 *
441 * This structure keeps information about a BSS (and an association 456 * This structure keeps information about a BSS (and an association
@@ -477,6 +492,7 @@ struct ieee80211_event {
477 * @enable_beacon: whether beaconing should be enabled or not 492 * @enable_beacon: whether beaconing should be enabled or not
478 * @chandef: Channel definition for this BSS -- the hardware might be 493 * @chandef: Channel definition for this BSS -- the hardware might be
479 * configured a higher bandwidth than this BSS uses, for example. 494 * configured a higher bandwidth than this BSS uses, for example.
495 * @mu_group: VHT MU-MIMO group membership data
480 * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation. 496 * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation.
481 * This field is only valid when the channel is a wide HT/VHT channel. 497 * This field is only valid when the channel is a wide HT/VHT channel.
482 * Note that with TDLS this can be the case (channel is HT, protection must 498 * Note that with TDLS this can be the case (channel is HT, protection must
@@ -535,6 +551,7 @@ struct ieee80211_bss_conf {
535 s32 cqm_rssi_thold; 551 s32 cqm_rssi_thold;
536 u32 cqm_rssi_hyst; 552 u32 cqm_rssi_hyst;
537 struct cfg80211_chan_def chandef; 553 struct cfg80211_chan_def chandef;
554 struct ieee80211_mu_group_data mu_group;
538 __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; 555 __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
539 int arp_addr_cnt; 556 int arp_addr_cnt;
540 bool qos; 557 bool qos;
@@ -691,12 +708,14 @@ enum mac80211_tx_info_flags {
691 * protocol frame (e.g. EAP) 708 * protocol frame (e.g. EAP)
692 * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll 709 * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
693 * frame (PS-Poll or uAPSD). 710 * frame (PS-Poll or uAPSD).
711 * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
694 * 712 *
695 * These flags are used in tx_info->control.flags. 713 * These flags are used in tx_info->control.flags.
696 */ 714 */
697enum mac80211_tx_control_flags { 715enum mac80211_tx_control_flags {
698 IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0), 716 IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
699 IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1), 717 IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
718 IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
700}; 719};
701 720
702/* 721/*
@@ -993,6 +1012,8 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
993 * @RX_FLAG_MACTIME_END: The timestamp passed in the RX status (@mactime 1012 * @RX_FLAG_MACTIME_END: The timestamp passed in the RX status (@mactime
994 * field) is valid and contains the time the last symbol of the MPDU 1013 * field) is valid and contains the time the last symbol of the MPDU
995 * (including FCS) was received. 1014 * (including FCS) was received.
1015 * @RX_FLAG_MACTIME_PLCP_START: The timestamp passed in the RX status (@mactime
1016 * field) is valid and contains the time the SYNC preamble was received.
996 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame 1017 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame
997 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 1018 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
998 * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index 1019 * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index
@@ -1014,6 +1035,14 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
1014 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC 1035 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
1015 * is stored in the @ampdu_delimiter_crc field) 1036 * is stored in the @ampdu_delimiter_crc field)
1016 * @RX_FLAG_LDPC: LDPC was used 1037 * @RX_FLAG_LDPC: LDPC was used
1038 * @RX_FLAG_ONLY_MONITOR: Report frame only to monitor interfaces without
1039 * processing it in any regular way.
1040 * This is useful if drivers offload some frames but still want to report
1041 * them for sniffing purposes.
1042 * @RX_FLAG_SKIP_MONITOR: Process and report frame to all interfaces except
1043 * monitor interfaces.
1044 * This is useful if drivers offload some frames but still want to report
1045 * them for sniffing purposes.
1017 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3 1046 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
1018 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used 1047 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used
1019 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used 1048 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used
@@ -1033,6 +1062,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
1033enum mac80211_rx_flags { 1062enum mac80211_rx_flags {
1034 RX_FLAG_MMIC_ERROR = BIT(0), 1063 RX_FLAG_MMIC_ERROR = BIT(0),
1035 RX_FLAG_DECRYPTED = BIT(1), 1064 RX_FLAG_DECRYPTED = BIT(1),
1065 RX_FLAG_MACTIME_PLCP_START = BIT(2),
1036 RX_FLAG_MMIC_STRIPPED = BIT(3), 1066 RX_FLAG_MMIC_STRIPPED = BIT(3),
1037 RX_FLAG_IV_STRIPPED = BIT(4), 1067 RX_FLAG_IV_STRIPPED = BIT(4),
1038 RX_FLAG_FAILED_FCS_CRC = BIT(5), 1068 RX_FLAG_FAILED_FCS_CRC = BIT(5),
@@ -1046,7 +1076,7 @@ enum mac80211_rx_flags {
1046 RX_FLAG_HT_GF = BIT(13), 1076 RX_FLAG_HT_GF = BIT(13),
1047 RX_FLAG_AMPDU_DETAILS = BIT(14), 1077 RX_FLAG_AMPDU_DETAILS = BIT(14),
1048 RX_FLAG_PN_VALIDATED = BIT(15), 1078 RX_FLAG_PN_VALIDATED = BIT(15),
1049 /* bit 16 free */ 1079 RX_FLAG_DUP_VALIDATED = BIT(16),
1050 RX_FLAG_AMPDU_LAST_KNOWN = BIT(17), 1080 RX_FLAG_AMPDU_LAST_KNOWN = BIT(17),
1051 RX_FLAG_AMPDU_IS_LAST = BIT(18), 1081 RX_FLAG_AMPDU_IS_LAST = BIT(18),
1052 RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19), 1082 RX_FLAG_AMPDU_DELIM_CRC_ERROR = BIT(19),
@@ -1054,6 +1084,8 @@ enum mac80211_rx_flags {
1054 RX_FLAG_MACTIME_END = BIT(21), 1084 RX_FLAG_MACTIME_END = BIT(21),
1055 RX_FLAG_VHT = BIT(22), 1085 RX_FLAG_VHT = BIT(22),
1056 RX_FLAG_LDPC = BIT(23), 1086 RX_FLAG_LDPC = BIT(23),
1087 RX_FLAG_ONLY_MONITOR = BIT(24),
1088 RX_FLAG_SKIP_MONITOR = BIT(25),
1057 RX_FLAG_STBC_MASK = BIT(26) | BIT(27), 1089 RX_FLAG_STBC_MASK = BIT(26) | BIT(27),
1058 RX_FLAG_10MHZ = BIT(28), 1090 RX_FLAG_10MHZ = BIT(28),
1059 RX_FLAG_5MHZ = BIT(29), 1091 RX_FLAG_5MHZ = BIT(29),
@@ -1072,6 +1104,7 @@ enum mac80211_rx_flags {
1072 * @RX_VHT_FLAG_160MHZ: 160 MHz was used 1104 * @RX_VHT_FLAG_160MHZ: 160 MHz was used
1073 * @RX_VHT_FLAG_BF: packet was beamformed 1105 * @RX_VHT_FLAG_BF: packet was beamformed
1074 */ 1106 */
1107
1075enum mac80211_rx_vht_flags { 1108enum mac80211_rx_vht_flags {
1076 RX_VHT_FLAG_80MHZ = BIT(0), 1109 RX_VHT_FLAG_80MHZ = BIT(0),
1077 RX_VHT_FLAG_160MHZ = BIT(1), 1110 RX_VHT_FLAG_160MHZ = BIT(1),
@@ -1091,6 +1124,8 @@ enum mac80211_rx_vht_flags {
1091 * it but can store it and pass it back to the driver for synchronisation 1124 * it but can store it and pass it back to the driver for synchronisation
1092 * @band: the active band when this frame was received 1125 * @band: the active band when this frame was received
1093 * @freq: frequency the radio was tuned to when receiving this frame, in MHz 1126 * @freq: frequency the radio was tuned to when receiving this frame, in MHz
1127 * This field must be set for management frames, but isn't strictly needed
1128 * for data (other) frames - for those it only affects radiotap reporting.
1094 * @signal: signal strength when receiving this frame, either in dBm, in dB or 1129 * @signal: signal strength when receiving this frame, either in dBm, in dB or
1095 * unspecified depending on the hardware capabilities flags 1130 * unspecified depending on the hardware capabilities flags
1096 * @IEEE80211_HW_SIGNAL_* 1131 * @IEEE80211_HW_SIGNAL_*
@@ -1347,6 +1382,7 @@ enum ieee80211_vif_flags {
1347 * @csa_active: marks whether a channel switch is going on. Internally it is 1382 * @csa_active: marks whether a channel switch is going on. Internally it is
1348 * write-protected by sdata_lock and local->mtx so holding either is fine 1383 * write-protected by sdata_lock and local->mtx so holding either is fine
1349 * for read access. 1384 * for read access.
1385 * @mu_mimo_owner: indicates interface owns MU-MIMO capability
1350 * @driver_flags: flags/capabilities the driver has for this interface, 1386 * @driver_flags: flags/capabilities the driver has for this interface,
1351 * these need to be set (or cleared) when the interface is added 1387 * these need to be set (or cleared) when the interface is added
1352 * or, if supported by the driver, the interface type is changed 1388 * or, if supported by the driver, the interface type is changed
@@ -1373,6 +1409,7 @@ struct ieee80211_vif {
1373 u8 addr[ETH_ALEN]; 1409 u8 addr[ETH_ALEN];
1374 bool p2p; 1410 bool p2p;
1375 bool csa_active; 1411 bool csa_active;
1412 bool mu_mimo_owner;
1376 1413
1377 u8 cab_queue; 1414 u8 cab_queue;
1378 u8 hw_queue[IEEE80211_NUM_ACS]; 1415 u8 hw_queue[IEEE80211_NUM_ACS];
@@ -1486,9 +1523,8 @@ enum ieee80211_key_flags {
1486 * wants to be given when a frame is transmitted and needs to be 1523 * wants to be given when a frame is transmitted and needs to be
1487 * encrypted in hardware. 1524 * encrypted in hardware.
1488 * @cipher: The key's cipher suite selector. 1525 * @cipher: The key's cipher suite selector.
1489 * @tx_pn: PN used for TX on non-TKIP keys, may be used by the driver 1526 * @tx_pn: PN used for TX keys, may be used by the driver as well if it
1490 * as well if it needs to do software PN assignment by itself 1527 * needs to do software PN assignment by itself (e.g. due to TSO)
1491 * (e.g. due to TSO)
1492 * @flags: key flags, see &enum ieee80211_key_flags. 1528 * @flags: key flags, see &enum ieee80211_key_flags.
1493 * @keyidx: the key index (0-3) 1529 * @keyidx: the key index (0-3)
1494 * @keylen: key material length 1530 * @keylen: key material length
@@ -1514,6 +1550,9 @@ struct ieee80211_key_conf {
1514 1550
1515#define IEEE80211_MAX_PN_LEN 16 1551#define IEEE80211_MAX_PN_LEN 16
1516 1552
1553#define TKIP_PN_TO_IV16(pn) ((u16)(pn & 0xffff))
1554#define TKIP_PN_TO_IV32(pn) ((u32)((pn >> 16) & 0xffffffff))
1555
1517/** 1556/**
1518 * struct ieee80211_key_seq - key sequence counter 1557 * struct ieee80211_key_seq - key sequence counter
1519 * 1558 *
@@ -1684,6 +1723,18 @@ struct ieee80211_sta_rates {
1684 * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only 1723 * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
1685 * valid if the STA is a TDLS peer in the first place. 1724 * valid if the STA is a TDLS peer in the first place.
1686 * @mfp: indicates whether the STA uses management frame protection or not. 1725 * @mfp: indicates whether the STA uses management frame protection or not.
1726 * @max_amsdu_subframes: indicates the maximal number of MSDUs in a single
1727 * A-MSDU. Taken from the Extended Capabilities element. 0 means
1728 * unlimited.
1729 * @max_amsdu_len: indicates the maximal length of an A-MSDU in bytes. This
1730 * field is always valid for packets with a VHT preamble. For packets
1731 * with a HT preamble, additional limits apply:
1732 * + If the skb is transmitted as part of a BA agreement, the
1733 * A-MSDU maximal size is min(max_amsdu_len, 4065) bytes.
1734 * + If the skb is not part of a BA aggreement, the A-MSDU maximal
1735 * size is min(max_amsdu_len, 7935) bytes.
1736 * Both additional HT limits must be enforced by the low level driver.
1737 * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2).
1687 * @txq: per-TID data TX queues (if driver uses the TXQ abstraction) 1738 * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
1688 */ 1739 */
1689struct ieee80211_sta { 1740struct ieee80211_sta {
@@ -1702,6 +1753,8 @@ struct ieee80211_sta {
1702 bool tdls; 1753 bool tdls;
1703 bool tdls_initiator; 1754 bool tdls_initiator;
1704 bool mfp; 1755 bool mfp;
1756 u8 max_amsdu_subframes;
1757 u16 max_amsdu_len;
1705 1758
1706 struct ieee80211_txq *txq[IEEE80211_NUM_TIDS]; 1759 struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
1707 1760
@@ -1910,6 +1963,11 @@ struct ieee80211_txq {
1910 * by just its MAC address; this prevents, for example, the same station 1963 * by just its MAC address; this prevents, for example, the same station
1911 * from connecting to two virtual AP interfaces at the same time. 1964 * from connecting to two virtual AP interfaces at the same time.
1912 * 1965 *
1966 * @IEEE80211_HW_SUPPORTS_REORDERING_BUFFER: Hardware (or driver) manages the
1967 * reordering buffer internally, guaranteeing mac80211 receives frames in
1968 * order and does not need to manage its own reorder buffer or BA session
1969 * timeout.
1970 *
1913 * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays 1971 * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
1914 */ 1972 */
1915enum ieee80211_hw_flags { 1973enum ieee80211_hw_flags {
@@ -1946,6 +2004,7 @@ enum ieee80211_hw_flags {
1946 IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU, 2004 IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,
1947 IEEE80211_HW_BEACON_TX_STATUS, 2005 IEEE80211_HW_BEACON_TX_STATUS,
1948 IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR, 2006 IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
2007 IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
1949 2008
1950 /* keep last, obviously */ 2009 /* keep last, obviously */
1951 NUM_IEEE80211_HW_FLAGS 2010 NUM_IEEE80211_HW_FLAGS
@@ -2167,7 +2226,7 @@ static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev
2167 * @hw: the &struct ieee80211_hw to set the MAC address for 2226 * @hw: the &struct ieee80211_hw to set the MAC address for
2168 * @addr: the address to set 2227 * @addr: the address to set
2169 */ 2228 */
2170static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) 2229static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, const u8 *addr)
2171{ 2230{
2172 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); 2231 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
2173} 2232}
@@ -2684,6 +2743,33 @@ enum ieee80211_ampdu_mlme_action {
2684}; 2743};
2685 2744
2686/** 2745/**
2746 * struct ieee80211_ampdu_params - AMPDU action parameters
2747 *
2748 * @action: the ampdu action, value from %ieee80211_ampdu_mlme_action.
2749 * @sta: peer of this AMPDU session
2750 * @tid: tid of the BA session
2751 * @ssn: start sequence number of the session. TX/RX_STOP can pass 0. When
2752 * action is set to %IEEE80211_AMPDU_RX_START the driver passes back the
2753 * actual ssn value used to start the session and writes the value here.
2754 * @buf_size: reorder buffer size (number of subframes). Valid only when the
2755 * action is set to %IEEE80211_AMPDU_RX_START or
2756 * %IEEE80211_AMPDU_TX_OPERATIONAL
2757 * @amsdu: indicates the peer's ability to receive A-MSDU within A-MPDU.
2758 * valid when the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL
2759 * @timeout: BA session timeout. Valid only when the action is set to
2760 * %IEEE80211_AMPDU_RX_START
2761 */
2762struct ieee80211_ampdu_params {
2763 enum ieee80211_ampdu_mlme_action action;
2764 struct ieee80211_sta *sta;
2765 u16 tid;
2766 u16 ssn;
2767 u8 buf_size;
2768 bool amsdu;
2769 u16 timeout;
2770};
2771
2772/**
2687 * enum ieee80211_frame_release_type - frame release reason 2773 * enum ieee80211_frame_release_type - frame release reason
2688 * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll 2774 * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll
2689 * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to 2775 * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to
@@ -3027,13 +3113,9 @@ enum ieee80211_reconfig_type {
3027 * @ampdu_action: Perform a certain A-MPDU action 3113 * @ampdu_action: Perform a certain A-MPDU action
3028 * The RA/TID combination determines the destination and TID we want 3114 * The RA/TID combination determines the destination and TID we want
3029 * the ampdu action to be performed for. The action is defined through 3115 * the ampdu action to be performed for. The action is defined through
3030 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) 3116 * ieee80211_ampdu_mlme_action.
3031 * is the first frame we expect to perform the action on. Notice 3117 * When the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL the driver
3032 * that TX/RX_STOP can pass NULL for this parameter. 3118 * may neither send aggregates containing more subframes than @buf_size
3033 * The @buf_size parameter is only valid when the action is set to
3034 * %IEEE80211_AMPDU_TX_OPERATIONAL and indicates the peer's reorder
3035 * buffer size (number of subframes) for this session -- the driver
3036 * may neither send aggregates containing more subframes than this
3037 * nor send aggregates in a way that lost frames would exceed the 3119 * nor send aggregates in a way that lost frames would exceed the
3038 * buffer size. If just limiting the aggregate size, this would be 3120 * buffer size. If just limiting the aggregate size, this would be
3039 * possible with a buf_size of 8: 3121 * possible with a buf_size of 8:
@@ -3044,9 +3126,6 @@ enum ieee80211_reconfig_type {
3044 * buffer size of 8. Correct ways to retransmit #1 would be: 3126 * buffer size of 8. Correct ways to retransmit #1 would be:
3045 * - TX: 1 or 18 or 81 3127 * - TX: 1 or 18 or 81
3046 * Even "189" would be wrong since 1 could be lost again. 3128 * Even "189" would be wrong since 1 could be lost again.
3047 * The @amsdu parameter is valid when the action is set to
3048 * %IEEE80211_AMPDU_TX_OPERATIONAL and indicates the peer's ability
3049 * to receive A-MSDU within A-MPDU.
3050 * 3129 *
3051 * Returns a negative error code on failure. 3130 * Returns a negative error code on failure.
3052 * The callback can sleep. 3131 * The callback can sleep.
@@ -3388,9 +3467,7 @@ struct ieee80211_ops {
3388 int (*tx_last_beacon)(struct ieee80211_hw *hw); 3467 int (*tx_last_beacon)(struct ieee80211_hw *hw);
3389 int (*ampdu_action)(struct ieee80211_hw *hw, 3468 int (*ampdu_action)(struct ieee80211_hw *hw,
3390 struct ieee80211_vif *vif, 3469 struct ieee80211_vif *vif,
3391 enum ieee80211_ampdu_mlme_action action, 3470 struct ieee80211_ampdu_params *params);
3392 struct ieee80211_sta *sta, u16 tid, u16 *ssn,
3393 u8 buf_size, bool amsdu);
3394 int (*get_survey)(struct ieee80211_hw *hw, int idx, 3471 int (*get_survey)(struct ieee80211_hw *hw, int idx,
3395 struct survey_info *survey); 3472 struct survey_info *survey);
3396 void (*rfkill_poll)(struct ieee80211_hw *hw); 3473 void (*rfkill_poll)(struct ieee80211_hw *hw);
@@ -4374,21 +4451,19 @@ void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
4374 struct sk_buff *skb, u8 *p2k); 4451 struct sk_buff *skb, u8 *p2k);
4375 4452
4376/** 4453/**
4377 * ieee80211_get_key_tx_seq - get key TX sequence counter 4454 * ieee80211_tkip_add_iv - write TKIP IV and Ext. IV to pos
4378 * 4455 *
4456 * @pos: start of crypto header
4379 * @keyconf: the parameter passed with the set key 4457 * @keyconf: the parameter passed with the set key
4380 * @seq: buffer to receive the sequence data 4458 * @pn: PN to add
4381 * 4459 *
4382 * This function allows a driver to retrieve the current TX IV/PN 4460 * Returns: pointer to the octet following IVs (i.e. beginning of
4383 * for the given key. It must not be called if IV generation is 4461 * the packet payload)
4384 * offloaded to the device.
4385 * 4462 *
4386 * Note that this function may only be called when no TX processing 4463 * This function writes the tkip IV value to pos (which should
4387 * can be done concurrently, for example when queues are stopped 4464 * point to the crypto header)
4388 * and the stop has been synchronized.
4389 */ 4465 */
4390void ieee80211_get_key_tx_seq(struct ieee80211_key_conf *keyconf, 4466u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key_conf *keyconf, u64 pn);
4391 struct ieee80211_key_seq *seq);
4392 4467
4393/** 4468/**
4394 * ieee80211_get_key_rx_seq - get key RX sequence counter 4469 * ieee80211_get_key_rx_seq - get key RX sequence counter
@@ -4410,23 +4485,6 @@ void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf,
4410 int tid, struct ieee80211_key_seq *seq); 4485 int tid, struct ieee80211_key_seq *seq);
4411 4486
4412/** 4487/**
4413 * ieee80211_set_key_tx_seq - set key TX sequence counter
4414 *
4415 * @keyconf: the parameter passed with the set key
4416 * @seq: new sequence data
4417 *
4418 * This function allows a driver to set the current TX IV/PNs for the
4419 * given key. This is useful when resuming from WoWLAN sleep and the
4420 * device may have transmitted frames using the PTK, e.g. replies to
4421 * ARP requests.
4422 *
4423 * Note that this function may only be called when no TX processing
4424 * can be done concurrently.
4425 */
4426void ieee80211_set_key_tx_seq(struct ieee80211_key_conf *keyconf,
4427 struct ieee80211_key_seq *seq);
4428
4429/**
4430 * ieee80211_set_key_rx_seq - set key RX sequence counter 4488 * ieee80211_set_key_rx_seq - set key RX sequence counter
4431 * 4489 *
4432 * @keyconf: the parameter passed with the set key 4490 * @keyconf: the parameter passed with the set key
@@ -5121,6 +5179,24 @@ void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,
5121 const u8 *addr); 5179 const u8 *addr);
5122 5180
5123/** 5181/**
5182 * ieee80211_mark_rx_ba_filtered_frames - move RX BA window and mark filtered
5183 * @pubsta: station struct
5184 * @tid: the session's TID
5185 * @ssn: starting sequence number of the bitmap, all frames before this are
5186 * assumed to be out of the window after the call
5187 * @filtered: bitmap of filtered frames, BIT(0) is the @ssn entry etc.
5188 * @received_mpdus: number of received mpdus in firmware
5189 *
5190 * This function moves the BA window and releases all frames before @ssn, and
5191 * marks frames marked in the bitmap as having been filtered. Afterwards, it
5192 * checks if any frames in the window starting from @ssn can now be released
5193 * (in case they were only waiting for frames that were filtered.)
5194 */
5195void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid,
5196 u16 ssn, u64 filtered,
5197 u16 received_mpdus);
5198
5199/**
5124 * ieee80211_send_bar - send a BlockAckReq frame 5200 * ieee80211_send_bar - send a BlockAckReq frame
5125 * 5201 *
5126 * can be used to flush pending frames from the peer's aggregation reorder 5202 * can be used to flush pending frames from the peer's aggregation reorder
@@ -5371,6 +5447,21 @@ ieee80211_vif_type_p2p(struct ieee80211_vif *vif)
5371 return ieee80211_iftype_p2p(vif->type, vif->p2p); 5447 return ieee80211_iftype_p2p(vif->type, vif->p2p);
5372} 5448}
5373 5449
5450/**
5451 * ieee80211_update_mu_groups - set the VHT MU-MIMO groud data
5452 *
5453 * @vif: the specified virtual interface
5454 * @membership: 64 bits array - a bit is set if station is member of the group
5455 * @position: 2 bits per group id indicating the position in the group
5456 *
5457 * Note: This function assumes that the given vif is valid and the position and
5458 * membership data is of the correct size and are in the same byte order as the
5459 * matching GroupId management frame.
5460 * Calls to this function need to be serialized with RX path.
5461 */
5462void ieee80211_update_mu_groups(struct ieee80211_vif *vif,
5463 const u8 *membership, const u8 *position);
5464
5374void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif, 5465void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif,
5375 int rssi_min_thold, 5466 int rssi_min_thold,
5376 int rssi_max_thold); 5467 int rssi_max_thold);
@@ -5523,4 +5614,19 @@ void ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid);
5523 */ 5614 */
5524struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, 5615struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
5525 struct ieee80211_txq *txq); 5616 struct ieee80211_txq *txq);
5617
5618/**
5619 * ieee80211_txq_get_depth - get pending frame/byte count of given txq
5620 *
5621 * The values are not guaranteed to be coherent with regard to each other, i.e.
5622 * txq state can change half-way of this function and the caller may end up
5623 * with "new" frame_cnt and "old" byte_cnt or vice-versa.
5624 *
5625 * @txq: pointer obtained from station or virtual interface
5626 * @frame_cnt: pointer to store frame count
5627 * @byte_cnt: pointer to store byte count
5628 */
5629void ieee80211_txq_get_depth(struct ieee80211_txq *txq,
5630 unsigned long *frame_cnt,
5631 unsigned long *byte_cnt);
5526#endif /* MAC80211_H */ 5632#endif /* MAC80211_H */
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index da574bbdc333..6cd7a70706a9 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -16,10 +16,10 @@
16#ifndef NET_MAC802154_H 16#ifndef NET_MAC802154_H
17#define NET_MAC802154_H 17#define NET_MAC802154_H
18 18
19#include <asm/unaligned.h>
19#include <net/af_ieee802154.h> 20#include <net/af_ieee802154.h>
20#include <linux/ieee802154.h> 21#include <linux/ieee802154.h>
21#include <linux/skbuff.h> 22#include <linux/skbuff.h>
22#include <linux/unaligned/memmove.h>
23 23
24#include <net/cfg802154.h> 24#include <net/cfg802154.h>
25 25
@@ -247,13 +247,14 @@ struct ieee802154_ops {
247 */ 247 */
248static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb) 248static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
249{ 249{
250 /* return some invalid fc on failure */ 250 /* check if we can fc at skb_mac_header of sk buffer */
251 if (unlikely(skb->len < 2)) { 251 if (unlikely(!skb_mac_header_was_set(skb) ||
252 (skb_tail_pointer(skb) - skb_mac_header(skb)) < 2)) {
252 WARN_ON(1); 253 WARN_ON(1);
253 return cpu_to_le16(0); 254 return cpu_to_le16(0);
254 } 255 }
255 256
256 return (__force __le16)__get_unaligned_memmove16(skb_mac_header(skb)); 257 return get_unaligned_le16(skb_mac_header(skb));
257} 258}
258 259
259/** 260/**
@@ -263,7 +264,7 @@ static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
263 */ 264 */
264static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src) 265static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src)
265{ 266{
266 __put_unaligned_memmove64(swab64p(be64_src), le64_dst); 267 put_unaligned_le64(get_unaligned_be64(be64_src), le64_dst);
267} 268}
268 269
269/** 270/**
@@ -273,7 +274,7 @@ static inline void ieee802154_be64_to_le64(void *le64_dst, const void *be64_src)
273 */ 274 */
274static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src) 275static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src)
275{ 276{
276 __put_unaligned_memmove64(swab64p(le64_src), be64_dst); 277 put_unaligned_be64(get_unaligned_le64(le64_src), be64_dst);
277} 278}
278 279
279/** 280/**
@@ -283,7 +284,7 @@ static inline void ieee802154_le64_to_be64(void *be64_dst, const void *le64_src)
283 */ 284 */
284static inline void ieee802154_le16_to_be16(void *be16_dst, const void *le16_src) 285static inline void ieee802154_le16_to_be16(void *be16_dst, const void *le16_src)
285{ 286{
286 __put_unaligned_memmove16(swab16p(le16_src), be16_dst); 287 put_unaligned_be16(get_unaligned_le16(le16_src), be16_dst);
287} 288}
288 289
289/** 290/**
diff --git a/include/net/netfilter/nft_masq.h b/include/net/netfilter/nft_masq.h
index e2a518b60e19..a3f3c11b2526 100644
--- a/include/net/netfilter/nft_masq.h
+++ b/include/net/netfilter/nft_masq.h
@@ -2,7 +2,9 @@
2#define _NFT_MASQ_H_ 2#define _NFT_MASQ_H_
3 3
4struct nft_masq { 4struct nft_masq {
5 u32 flags; 5 u32 flags;
6 enum nft_registers sreg_proto_min:8;
7 enum nft_registers sreg_proto_max:8;
6}; 8};
7 9
8extern const struct nla_policy nft_masq_policy[]; 10extern const struct nla_policy nft_masq_policy[];
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 2b7907a35568..a69cde3ce460 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -80,9 +80,13 @@ struct netns_ipv4 {
80 int sysctl_tcp_ecn; 80 int sysctl_tcp_ecn;
81 int sysctl_tcp_ecn_fallback; 81 int sysctl_tcp_ecn_fallback;
82 82
83 int sysctl_ip_default_ttl;
83 int sysctl_ip_no_pmtu_disc; 84 int sysctl_ip_no_pmtu_disc;
84 int sysctl_ip_fwd_use_pmtu; 85 int sysctl_ip_fwd_use_pmtu;
85 int sysctl_ip_nonlocal_bind; 86 int sysctl_ip_nonlocal_bind;
87 /* Shall we try to damage output packets if routing dev changes? */
88 int sysctl_ip_dynaddr;
89 int sysctl_ip_early_demux;
86 90
87 int sysctl_fwmark_reflect; 91 int sysctl_fwmark_reflect;
88 int sysctl_tcp_fwmark_accept; 92 int sysctl_tcp_fwmark_accept;
@@ -98,6 +102,21 @@ struct netns_ipv4 {
98 int sysctl_tcp_keepalive_probes; 102 int sysctl_tcp_keepalive_probes;
99 int sysctl_tcp_keepalive_intvl; 103 int sysctl_tcp_keepalive_intvl;
100 104
105 int sysctl_tcp_syn_retries;
106 int sysctl_tcp_synack_retries;
107 int sysctl_tcp_syncookies;
108 int sysctl_tcp_reordering;
109 int sysctl_tcp_retries1;
110 int sysctl_tcp_retries2;
111 int sysctl_tcp_orphan_retries;
112 int sysctl_tcp_fin_timeout;
113 unsigned int sysctl_tcp_notsent_lowat;
114
115 int sysctl_igmp_max_memberships;
116 int sysctl_igmp_max_msf;
117 int sysctl_igmp_llm_reports;
118 int sysctl_igmp_qrv;
119
101 struct ping_group_range ping_group_range; 120 struct ping_group_range ping_group_range;
102 121
103 atomic_t dev_addr_genid; 122 atomic_t dev_addr_genid;
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index c0368db6df54..10d0848f5b8a 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -58,7 +58,10 @@ struct netns_ipv6 {
58 struct timer_list ip6_fib_timer; 58 struct timer_list ip6_fib_timer;
59 struct hlist_head *fib_table_hash; 59 struct hlist_head *fib_table_hash;
60 struct fib6_table *fib6_main_tbl; 60 struct fib6_table *fib6_main_tbl;
61 struct list_head fib6_walkers;
61 struct dst_ops ip6_dst_ops; 62 struct dst_ops ip6_dst_ops;
63 rwlock_t fib6_walker_lock;
64 spinlock_t fib6_gc_lock;
62 unsigned int ip6_rt_gc_expire; 65 unsigned int ip6_rt_gc_expire;
63 unsigned long ip6_rt_last_gc; 66 unsigned long ip6_rt_last_gc;
64#ifdef CONFIG_IPV6_MULTIPLE_TABLES 67#ifdef CONFIG_IPV6_MULTIPLE_TABLES
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
index 68e509750caa..039cc29cb4a8 100644
--- a/include/net/phonet/phonet.h
+++ b/include/net/phonet/phonet.h
@@ -51,7 +51,7 @@ void pn_sock_init(void);
51struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa); 51struct sock *pn_find_sock_by_sa(struct net *net, const struct sockaddr_pn *sa);
52void pn_deliver_sock_broadcast(struct net *net, struct sk_buff *skb); 52void pn_deliver_sock_broadcast(struct net *net, struct sk_buff *skb);
53void phonet_get_local_port_range(int *min, int *max); 53void phonet_get_local_port_range(int *min, int *max);
54void pn_sock_hash(struct sock *sk); 54int pn_sock_hash(struct sock *sk);
55void pn_sock_unhash(struct sock *sk); 55void pn_sock_unhash(struct sock *sk);
56int pn_sock_get_port(struct sock *sk, unsigned short sport); 56int pn_sock_get_port(struct sock *sk, unsigned short sport);
57 57
diff --git a/include/net/ping.h b/include/net/ping.h
index ac80cb45e630..5fd7cc244833 100644
--- a/include/net/ping.h
+++ b/include/net/ping.h
@@ -65,7 +65,7 @@ struct pingfakehdr {
65}; 65};
66 66
67int ping_get_port(struct sock *sk, unsigned short ident); 67int ping_get_port(struct sock *sk, unsigned short ident);
68void ping_hash(struct sock *sk); 68int ping_hash(struct sock *sk);
69void ping_unhash(struct sock *sk); 69void ping_unhash(struct sock *sk);
70 70
71int ping_init_sock(struct sock *sk); 71int ping_init_sock(struct sock *sk);
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index bc49967e1a68..caa5e18636df 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -358,4 +358,69 @@ tcf_match_indev(struct sk_buff *skb, int ifindex)
358} 358}
359#endif /* CONFIG_NET_CLS_IND */ 359#endif /* CONFIG_NET_CLS_IND */
360 360
361struct tc_cls_u32_knode {
362 struct tcf_exts *exts;
363 struct tc_u32_sel *sel;
364 u32 handle;
365 u32 val;
366 u32 mask;
367 u32 link_handle;
368 u8 fshift;
369};
370
371struct tc_cls_u32_hnode {
372 u32 handle;
373 u32 prio;
374 unsigned int divisor;
375};
376
377enum tc_clsu32_command {
378 TC_CLSU32_NEW_KNODE,
379 TC_CLSU32_REPLACE_KNODE,
380 TC_CLSU32_DELETE_KNODE,
381 TC_CLSU32_NEW_HNODE,
382 TC_CLSU32_REPLACE_HNODE,
383 TC_CLSU32_DELETE_HNODE,
384};
385
386struct tc_cls_u32_offload {
387 /* knode values */
388 enum tc_clsu32_command command;
389 union {
390 struct tc_cls_u32_knode knode;
391 struct tc_cls_u32_hnode hnode;
392 };
393};
394
395/* tca flags definitions */
396#define TCA_CLS_FLAGS_SKIP_HW 1
397
398static inline bool tc_should_offload(struct net_device *dev, u32 flags)
399{
400 if (!(dev->features & NETIF_F_HW_TC))
401 return false;
402
403 if (flags & TCA_CLS_FLAGS_SKIP_HW)
404 return false;
405
406 if (!dev->netdev_ops->ndo_setup_tc)
407 return false;
408
409 return true;
410}
411
412enum tc_fl_command {
413 TC_CLSFLOWER_REPLACE,
414 TC_CLSFLOWER_DESTROY,
415};
416
417struct tc_cls_flower_offload {
418 enum tc_fl_command command;
419 unsigned long cookie;
420 struct flow_dissector *dissector;
421 struct fl_flow_key *mask;
422 struct fl_flow_key *key;
423 struct tcf_exts *exts;
424};
425
361#endif 426#endif
diff --git a/include/net/raw.h b/include/net/raw.h
index 6a40c6562dd2..3e789008394d 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -57,7 +57,7 @@ int raw_seq_open(struct inode *ino, struct file *file,
57 57
58#endif 58#endif
59 59
60void raw_hash_sk(struct sock *sk); 60int raw_hash_sk(struct sock *sk);
61void raw_unhash_sk(struct sock *sk); 61void raw_unhash_sk(struct sock *sk);
62 62
63struct raw_sock { 63struct raw_sock {
diff --git a/include/net/route.h b/include/net/route.h
index a3b9ef74a389..9b0a523bb428 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -329,14 +329,13 @@ static inline int inet_iif(const struct sk_buff *skb)
329 return skb->skb_iif; 329 return skb->skb_iif;
330} 330}
331 331
332extern int sysctl_ip_default_ttl;
333
334static inline int ip4_dst_hoplimit(const struct dst_entry *dst) 332static inline int ip4_dst_hoplimit(const struct dst_entry *dst)
335{ 333{
336 int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT); 334 int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT);
335 struct net *net = dev_net(dst->dev);
337 336
338 if (hoplimit == 0) 337 if (hoplimit == 0)
339 hoplimit = sysctl_ip_default_ttl; 338 hoplimit = net->ipv4.sysctl_ip_default_ttl;
340 return hoplimit; 339 return hoplimit;
341} 340}
342 341
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 636a362a0e03..46e55f0202a6 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -345,6 +345,12 @@ extern struct Qdisc_ops pfifo_fast_ops;
345extern struct Qdisc_ops mq_qdisc_ops; 345extern struct Qdisc_ops mq_qdisc_ops;
346extern struct Qdisc_ops noqueue_qdisc_ops; 346extern struct Qdisc_ops noqueue_qdisc_ops;
347extern const struct Qdisc_ops *default_qdisc_ops; 347extern const struct Qdisc_ops *default_qdisc_ops;
348static inline const struct Qdisc_ops *
349get_default_qdisc_ops(const struct net_device *dev, int ntx)
350{
351 return ntx < dev->real_num_tx_queues ?
352 default_qdisc_ops : &pfifo_fast_ops;
353}
348 354
349struct Qdisc_class_common { 355struct Qdisc_class_common {
350 u32 classid; 356 u32 classid;
@@ -396,7 +402,8 @@ struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue,
396 struct Qdisc *qdisc); 402 struct Qdisc *qdisc);
397void qdisc_reset(struct Qdisc *qdisc); 403void qdisc_reset(struct Qdisc *qdisc);
398void qdisc_destroy(struct Qdisc *qdisc); 404void qdisc_destroy(struct Qdisc *qdisc);
399void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n); 405void qdisc_tree_reduce_backlog(struct Qdisc *qdisc, unsigned int n,
406 unsigned int len);
400struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, 407struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
401 const struct Qdisc_ops *ops); 408 const struct Qdisc_ops *ops);
402struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, 409struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
@@ -707,6 +714,23 @@ static inline void qdisc_reset_queue(struct Qdisc *sch)
707 sch->qstats.backlog = 0; 714 sch->qstats.backlog = 0;
708} 715}
709 716
717static inline struct Qdisc *qdisc_replace(struct Qdisc *sch, struct Qdisc *new,
718 struct Qdisc **pold)
719{
720 struct Qdisc *old;
721
722 sch_tree_lock(sch);
723 old = *pold;
724 *pold = new;
725 if (old != NULL) {
726 qdisc_tree_reduce_backlog(old, old->q.qlen, old->qstats.backlog);
727 qdisc_reset(old);
728 }
729 sch_tree_unlock(sch);
730
731 return old;
732}
733
710static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch, 734static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch,
711 struct sk_buff_head *list) 735 struct sk_buff_head *list)
712{ 736{
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 487ef34bbd63..efc01743b9d6 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -201,7 +201,7 @@ struct sctp_chunk *sctp_make_cwr(const struct sctp_association *,
201struct sctp_chunk * sctp_make_datafrag_empty(struct sctp_association *, 201struct sctp_chunk * sctp_make_datafrag_empty(struct sctp_association *,
202 const struct sctp_sndrcvinfo *sinfo, 202 const struct sctp_sndrcvinfo *sinfo,
203 int len, const __u8 flags, 203 int len, const __u8 flags,
204 __u16 ssn); 204 __u16 ssn, gfp_t gfp);
205struct sctp_chunk *sctp_make_ecne(const struct sctp_association *, 205struct sctp_chunk *sctp_make_ecne(const struct sctp_association *,
206 const __u32); 206 const __u32);
207struct sctp_chunk *sctp_make_sack(const struct sctp_association *); 207struct sctp_chunk *sctp_make_sack(const struct sctp_association *);
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 5a57409da37b..e2ac0620d4be 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -535,7 +535,6 @@ struct sctp_datamsg {
535struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, 535struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
536 struct sctp_sndrcvinfo *, 536 struct sctp_sndrcvinfo *,
537 struct iov_iter *); 537 struct iov_iter *);
538void sctp_datamsg_free(struct sctp_datamsg *);
539void sctp_datamsg_put(struct sctp_datamsg *); 538void sctp_datamsg_put(struct sctp_datamsg *);
540void sctp_chunk_fail(struct sctp_chunk *, int error); 539void sctp_chunk_fail(struct sctp_chunk *, int error);
541int sctp_chunk_abandoned(struct sctp_chunk *); 540int sctp_chunk_abandoned(struct sctp_chunk *);
@@ -656,7 +655,7 @@ void sctp_chunk_free(struct sctp_chunk *);
656void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); 655void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data);
657struct sctp_chunk *sctp_chunkify(struct sk_buff *, 656struct sctp_chunk *sctp_chunkify(struct sk_buff *,
658 const struct sctp_association *, 657 const struct sctp_association *,
659 struct sock *); 658 struct sock *, gfp_t gfp);
660void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *, 659void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *,
661 union sctp_addr *); 660 union sctp_addr *);
662const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); 661const union sctp_addr *sctp_source(const struct sctp_chunk *chunk);
@@ -718,10 +717,10 @@ struct sctp_packet *sctp_packet_init(struct sctp_packet *,
718 __u16 sport, __u16 dport); 717 __u16 sport, __u16 dport);
719struct sctp_packet *sctp_packet_config(struct sctp_packet *, __u32 vtag, int); 718struct sctp_packet *sctp_packet_config(struct sctp_packet *, __u32 vtag, int);
720sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *, 719sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *,
721 struct sctp_chunk *, int); 720 struct sctp_chunk *, int, gfp_t);
722sctp_xmit_t sctp_packet_append_chunk(struct sctp_packet *, 721sctp_xmit_t sctp_packet_append_chunk(struct sctp_packet *,
723 struct sctp_chunk *); 722 struct sctp_chunk *);
724int sctp_packet_transmit(struct sctp_packet *); 723int sctp_packet_transmit(struct sctp_packet *, gfp_t);
725void sctp_packet_free(struct sctp_packet *); 724void sctp_packet_free(struct sctp_packet *);
726 725
727static inline int sctp_packet_empty(struct sctp_packet *packet) 726static inline int sctp_packet_empty(struct sctp_packet *packet)
@@ -1054,7 +1053,7 @@ struct sctp_outq {
1054void sctp_outq_init(struct sctp_association *, struct sctp_outq *); 1053void sctp_outq_init(struct sctp_association *, struct sctp_outq *);
1055void sctp_outq_teardown(struct sctp_outq *); 1054void sctp_outq_teardown(struct sctp_outq *);
1056void sctp_outq_free(struct sctp_outq*); 1055void sctp_outq_free(struct sctp_outq*);
1057int sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk); 1056int sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk, gfp_t);
1058int sctp_outq_sack(struct sctp_outq *, struct sctp_chunk *); 1057int sctp_outq_sack(struct sctp_outq *, struct sctp_chunk *);
1059int sctp_outq_is_empty(const struct sctp_outq *); 1058int sctp_outq_is_empty(const struct sctp_outq *);
1060void sctp_outq_restart(struct sctp_outq *); 1059void sctp_outq_restart(struct sctp_outq *);
@@ -1062,7 +1061,7 @@ void sctp_outq_restart(struct sctp_outq *);
1062void sctp_retransmit(struct sctp_outq *, struct sctp_transport *, 1061void sctp_retransmit(struct sctp_outq *, struct sctp_transport *,
1063 sctp_retransmit_reason_t); 1062 sctp_retransmit_reason_t);
1064void sctp_retransmit_mark(struct sctp_outq *, struct sctp_transport *, __u8); 1063void sctp_retransmit_mark(struct sctp_outq *, struct sctp_transport *, __u8);
1065int sctp_outq_uncork(struct sctp_outq *); 1064int sctp_outq_uncork(struct sctp_outq *, gfp_t gfp);
1066/* Uncork and flush an outqueue. */ 1065/* Uncork and flush an outqueue. */
1067static inline void sctp_outq_cork(struct sctp_outq *q) 1066static inline void sctp_outq_cork(struct sctp_outq *q)
1068{ 1067{
diff --git a/include/net/sock.h b/include/net/sock.h
index f5ea148853e2..255d3e03727b 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -984,7 +984,7 @@ struct proto {
984 void (*release_cb)(struct sock *sk); 984 void (*release_cb)(struct sock *sk);
985 985
986 /* Keeping track of sk's, looking them up, and port selection methods. */ 986 /* Keeping track of sk's, looking them up, and port selection methods. */
987 void (*hash)(struct sock *sk); 987 int (*hash)(struct sock *sk);
988 void (*unhash)(struct sock *sk); 988 void (*unhash)(struct sock *sk);
989 void (*rehash)(struct sock *sk); 989 void (*rehash)(struct sock *sk);
990 int (*get_port)(struct sock *sk, unsigned short snum); 990 int (*get_port)(struct sock *sk, unsigned short snum);
@@ -1194,10 +1194,10 @@ static inline void sock_prot_inuse_add(struct net *net, struct proto *prot,
1194/* With per-bucket locks this operation is not-atomic, so that 1194/* With per-bucket locks this operation is not-atomic, so that
1195 * this version is not worse. 1195 * this version is not worse.
1196 */ 1196 */
1197static inline void __sk_prot_rehash(struct sock *sk) 1197static inline int __sk_prot_rehash(struct sock *sk)
1198{ 1198{
1199 sk->sk_prot->unhash(sk); 1199 sk->sk_prot->unhash(sk);
1200 sk->sk_prot->hash(sk); 1200 return sk->sk_prot->hash(sk);
1201} 1201}
1202 1202
1203void sk_prot_clear_portaddr_nulls(struct sock *sk, int size); 1203void sk_prot_clear_portaddr_nulls(struct sock *sk, int size);
diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h
index 592a6bc02b0b..93c520b83d10 100644
--- a/include/net/tc_act/tc_gact.h
+++ b/include/net/tc_act/tc_gact.h
@@ -2,6 +2,7 @@
2#define __NET_TC_GACT_H 2#define __NET_TC_GACT_H
3 3
4#include <net/act_api.h> 4#include <net/act_api.h>
5#include <linux/tc_act/tc_gact.h>
5 6
6struct tcf_gact { 7struct tcf_gact {
7 struct tcf_common common; 8 struct tcf_common common;
@@ -15,4 +16,19 @@ struct tcf_gact {
15#define to_gact(a) \ 16#define to_gact(a) \
16 container_of(a->priv, struct tcf_gact, common) 17 container_of(a->priv, struct tcf_gact, common)
17 18
19static inline bool is_tcf_gact_shot(const struct tc_action *a)
20{
21#ifdef CONFIG_NET_CLS_ACT
22 struct tcf_gact *gact;
23
24 if (a->ops && a->ops->type != TCA_ACT_GACT)
25 return false;
26
27 gact = a->priv;
28 if (gact->tcf_action == TC_ACT_SHOT)
29 return true;
30
31#endif
32 return false;
33}
18#endif /* __NET_TC_GACT_H */ 34#endif /* __NET_TC_GACT_H */
diff --git a/include/net/tc_act/tc_ife.h b/include/net/tc_act/tc_ife.h
new file mode 100644
index 000000000000..dc9a09aefb33
--- /dev/null
+++ b/include/net/tc_act/tc_ife.h
@@ -0,0 +1,61 @@
1#ifndef __NET_TC_IFE_H
2#define __NET_TC_IFE_H
3
4#include <net/act_api.h>
5#include <linux/etherdevice.h>
6#include <linux/rtnetlink.h>
7#include <linux/module.h>
8
9#define IFE_METAHDRLEN 2
10struct tcf_ife_info {
11 struct tcf_common common;
12 u8 eth_dst[ETH_ALEN];
13 u8 eth_src[ETH_ALEN];
14 u16 eth_type;
15 u16 flags;
16 /* list of metaids allowed */
17 struct list_head metalist;
18};
19#define to_ife(a) \
20 container_of(a->priv, struct tcf_ife_info, common)
21
22struct tcf_meta_info {
23 const struct tcf_meta_ops *ops;
24 void *metaval;
25 u16 metaid;
26 struct list_head metalist;
27};
28
29struct tcf_meta_ops {
30 u16 metaid; /*Maintainer provided ID */
31 u16 metatype; /*netlink attribute type (look at net/netlink.h) */
32 const char *name;
33 const char *synopsis;
34 struct list_head list;
35 int (*check_presence)(struct sk_buff *, struct tcf_meta_info *);
36 int (*encode)(struct sk_buff *, void *, struct tcf_meta_info *);
37 int (*decode)(struct sk_buff *, void *, u16 len);
38 int (*get)(struct sk_buff *skb, struct tcf_meta_info *mi);
39 int (*alloc)(struct tcf_meta_info *, void *);
40 void (*release)(struct tcf_meta_info *);
41 int (*validate)(void *val, int len);
42 struct module *owner;
43};
44
45#define MODULE_ALIAS_IFE_META(metan) MODULE_ALIAS("ifemeta" __stringify_1(metan))
46
47int ife_get_meta_u32(struct sk_buff *skb, struct tcf_meta_info *mi);
48int ife_get_meta_u16(struct sk_buff *skb, struct tcf_meta_info *mi);
49int ife_tlv_meta_encode(void *skbdata, u16 attrtype, u16 dlen,
50 const void *dval);
51int ife_alloc_meta_u32(struct tcf_meta_info *mi, void *metaval);
52int ife_alloc_meta_u16(struct tcf_meta_info *mi, void *metaval);
53int ife_check_meta_u32(u32 metaval, struct tcf_meta_info *mi);
54int ife_encode_meta_u32(u32 metaval, void *skbdata, struct tcf_meta_info *mi);
55int ife_validate_meta_u32(void *val, int len);
56int ife_validate_meta_u16(void *val, int len);
57void ife_release_meta_gen(struct tcf_meta_info *mi);
58int register_ife_op(struct tcf_meta_ops *mops);
59int unregister_ife_op(struct tcf_meta_ops *mops);
60
61#endif /* __NET_TC_IFE_H */
diff --git a/include/net/tc_act/tc_skbedit.h b/include/net/tc_act/tc_skbedit.h
index 0df9a0db4a8e..b496d5ad7d42 100644
--- a/include/net/tc_act/tc_skbedit.h
+++ b/include/net/tc_act/tc_skbedit.h
@@ -20,6 +20,7 @@
20#define __NET_TC_SKBEDIT_H 20#define __NET_TC_SKBEDIT_H
21 21
22#include <net/act_api.h> 22#include <net/act_api.h>
23#include <linux/tc_act/tc_skbedit.h>
23 24
24struct tcf_skbedit { 25struct tcf_skbedit {
25 struct tcf_common common; 26 struct tcf_common common;
@@ -32,4 +33,19 @@ struct tcf_skbedit {
32#define to_skbedit(a) \ 33#define to_skbedit(a) \
33 container_of(a->priv, struct tcf_skbedit, common) 34 container_of(a->priv, struct tcf_skbedit, common)
34 35
36/* Return true iff action is mark */
37static inline bool is_tcf_skbedit_mark(const struct tc_action *a)
38{
39#ifdef CONFIG_NET_CLS_ACT
40 if (a->ops && a->ops->type == TCA_ACT_SKBEDIT)
41 return to_skbedit(a)->flags == SKBEDIT_F_MARK;
42#endif
43 return false;
44}
45
46static inline u32 tcf_skbedit_mark(const struct tc_action *a)
47{
48 return to_skbedit(a)->mark;
49}
50
35#endif /* __NET_TC_SKBEDIT_H */ 51#endif /* __NET_TC_SKBEDIT_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index b04bc989ad6c..b91370f61be6 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -238,13 +238,6 @@ extern struct inet_timewait_death_row tcp_death_row;
238extern int sysctl_tcp_timestamps; 238extern int sysctl_tcp_timestamps;
239extern int sysctl_tcp_window_scaling; 239extern int sysctl_tcp_window_scaling;
240extern int sysctl_tcp_sack; 240extern int sysctl_tcp_sack;
241extern int sysctl_tcp_fin_timeout;
242extern int sysctl_tcp_syn_retries;
243extern int sysctl_tcp_synack_retries;
244extern int sysctl_tcp_retries1;
245extern int sysctl_tcp_retries2;
246extern int sysctl_tcp_orphan_retries;
247extern int sysctl_tcp_syncookies;
248extern int sysctl_tcp_fastopen; 241extern int sysctl_tcp_fastopen;
249extern int sysctl_tcp_retrans_collapse; 242extern int sysctl_tcp_retrans_collapse;
250extern int sysctl_tcp_stdurg; 243extern int sysctl_tcp_stdurg;
@@ -273,7 +266,6 @@ extern int sysctl_tcp_thin_dupack;
273extern int sysctl_tcp_early_retrans; 266extern int sysctl_tcp_early_retrans;
274extern int sysctl_tcp_limit_output_bytes; 267extern int sysctl_tcp_limit_output_bytes;
275extern int sysctl_tcp_challenge_ack_limit; 268extern int sysctl_tcp_challenge_ack_limit;
276extern unsigned int sysctl_tcp_notsent_lowat;
277extern int sysctl_tcp_min_tso_segs; 269extern int sysctl_tcp_min_tso_segs;
278extern int sysctl_tcp_min_rtt_wlen; 270extern int sysctl_tcp_min_rtt_wlen;
279extern int sysctl_tcp_autocorking; 271extern int sysctl_tcp_autocorking;
@@ -567,6 +559,7 @@ void tcp_rearm_rto(struct sock *sk);
567void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req); 559void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req);
568void tcp_reset(struct sock *sk); 560void tcp_reset(struct sock *sk);
569void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb); 561void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp, struct sk_buff *skb);
562void tcp_fin(struct sock *sk);
570 563
571/* tcp_timer.c */ 564/* tcp_timer.c */
572void tcp_init_xmit_timers(struct sock *); 565void tcp_init_xmit_timers(struct sock *);
@@ -962,9 +955,11 @@ static inline void tcp_enable_fack(struct tcp_sock *tp)
962 */ 955 */
963static inline void tcp_enable_early_retrans(struct tcp_sock *tp) 956static inline void tcp_enable_early_retrans(struct tcp_sock *tp)
964{ 957{
958 struct net *net = sock_net((struct sock *)tp);
959
965 tp->do_early_retrans = sysctl_tcp_early_retrans && 960 tp->do_early_retrans = sysctl_tcp_early_retrans &&
966 sysctl_tcp_early_retrans < 4 && !sysctl_tcp_thin_dupack && 961 sysctl_tcp_early_retrans < 4 && !sysctl_tcp_thin_dupack &&
967 sysctl_tcp_reordering == 3; 962 net->ipv4.sysctl_tcp_reordering == 3;
968} 963}
969 964
970static inline void tcp_disable_early_retrans(struct tcp_sock *tp) 965static inline void tcp_disable_early_retrans(struct tcp_sock *tp)
@@ -1251,7 +1246,7 @@ static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp)
1251 1246
1252static inline int tcp_fin_time(const struct sock *sk) 1247static inline int tcp_fin_time(const struct sock *sk)
1253{ 1248{
1254 int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout; 1249 int fin_timeout = tcp_sk(sk)->linger2 ? : sock_net(sk)->ipv4.sysctl_tcp_fin_timeout;
1255 const int rto = inet_csk(sk)->icsk_rto; 1250 const int rto = inet_csk(sk)->icsk_rto;
1256 1251
1257 if (fin_timeout < (rto << 2) - (rto >> 1)) 1252 if (fin_timeout < (rto << 2) - (rto >> 1))
@@ -1433,6 +1428,7 @@ void tcp_free_fastopen_req(struct tcp_sock *tp);
1433 1428
1434extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; 1429extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
1435int tcp_fastopen_reset_cipher(void *key, unsigned int len); 1430int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1431void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb);
1436struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb, 1432struct sock *tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
1437 struct request_sock *req, 1433 struct request_sock *req,
1438 struct tcp_fastopen_cookie *foc, 1434 struct tcp_fastopen_cookie *foc,
@@ -1681,7 +1677,8 @@ void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr);
1681 1677
1682static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) 1678static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
1683{ 1679{
1684 return tp->notsent_lowat ?: sysctl_tcp_notsent_lowat; 1680 struct net *net = sock_net((struct sock *)tp);
1681 return tp->notsent_lowat ?: net->ipv4.sysctl_tcp_notsent_lowat;
1685} 1682}
1686 1683
1687static inline bool tcp_stream_memory_free(const struct sock *sk) 1684static inline bool tcp_stream_memory_free(const struct sock *sk)
@@ -1815,4 +1812,38 @@ static inline void skb_set_tcp_pure_ack(struct sk_buff *skb)
1815 skb->truesize = 2; 1812 skb->truesize = 2;
1816} 1813}
1817 1814
1815static inline int tcp_inq(struct sock *sk)
1816{
1817 struct tcp_sock *tp = tcp_sk(sk);
1818 int answ;
1819
1820 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) {
1821 answ = 0;
1822 } else if (sock_flag(sk, SOCK_URGINLINE) ||
1823 !tp->urg_data ||
1824 before(tp->urg_seq, tp->copied_seq) ||
1825 !before(tp->urg_seq, tp->rcv_nxt)) {
1826
1827 answ = tp->rcv_nxt - tp->copied_seq;
1828
1829 /* Subtract 1, if FIN was received */
1830 if (answ && sock_flag(sk, SOCK_DONE))
1831 answ--;
1832 } else {
1833 answ = tp->urg_seq - tp->copied_seq;
1834 }
1835
1836 return answ;
1837}
1838
1839static inline void tcp_segs_in(struct tcp_sock *tp, const struct sk_buff *skb)
1840{
1841 u16 segs_in;
1842
1843 segs_in = max_t(u16, 1, skb_shinfo(skb)->gso_segs);
1844 tp->segs_in += segs_in;
1845 if (skb->len > tcp_hdrlen(skb))
1846 tp->data_segs_in += segs_in;
1847}
1848
1818#endif /* _TCP_H */ 1849#endif /* _TCP_H */
diff --git a/include/net/udp.h b/include/net/udp.h
index 2842541e28e7..92927f729ac8 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -177,9 +177,10 @@ static inline struct udphdr *udp_gro_udphdr(struct sk_buff *skb)
177} 177}
178 178
179/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ 179/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */
180static inline void udp_lib_hash(struct sock *sk) 180static inline int udp_lib_hash(struct sock *sk)
181{ 181{
182 BUG(); 182 BUG();
183 return 0;
183} 184}
184 185
185void udp_lib_unhash(struct sock *sk); 186void udp_lib_unhash(struct sock *sk);
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h
index cca2ad3082c3..b83114077cee 100644
--- a/include/net/udp_tunnel.h
+++ b/include/net/udp_tunnel.h
@@ -88,8 +88,8 @@ int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk,
88 struct sk_buff *skb, 88 struct sk_buff *skb,
89 struct net_device *dev, struct in6_addr *saddr, 89 struct net_device *dev, struct in6_addr *saddr,
90 struct in6_addr *daddr, 90 struct in6_addr *daddr,
91 __u8 prio, __u8 ttl, __be16 src_port, 91 __u8 prio, __u8 ttl, __be32 label,
92 __be16 dst_port, bool nocheck); 92 __be16 src_port, __be16 dst_port, bool nocheck);
93#endif 93#endif
94 94
95void udp_tunnel_sock_release(struct socket *sock); 95void udp_tunnel_sock_release(struct socket *sock);
@@ -103,7 +103,7 @@ static inline struct sk_buff *udp_tunnel_handle_offloads(struct sk_buff *skb,
103{ 103{
104 int type = udp_csum ? SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL; 104 int type = udp_csum ? SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
105 105
106 return iptunnel_handle_offloads(skb, udp_csum, type); 106 return iptunnel_handle_offloads(skb, type);
107} 107}
108 108
109static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff) 109static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff)
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 0fb86442544b..a763c96ecde4 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -9,17 +9,71 @@
9#include <linux/udp.h> 9#include <linux/udp.h>
10#include <net/dst_metadata.h> 10#include <net/dst_metadata.h>
11 11
12/* VXLAN protocol (RFC 7348) header:
13 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
14 * |R|R|R|R|I|R|R|R| Reserved |
15 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
16 * | VXLAN Network Identifier (VNI) | Reserved |
17 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
18 *
19 * I = VXLAN Network Identifier (VNI) present.
20 */
21struct vxlanhdr {
22 __be32 vx_flags;
23 __be32 vx_vni;
24};
25
26/* VXLAN header flags. */
27#define VXLAN_HF_VNI cpu_to_be32(BIT(27))
28
29#define VXLAN_N_VID (1u << 24)
30#define VXLAN_VID_MASK (VXLAN_N_VID - 1)
31#define VXLAN_VNI_MASK cpu_to_be32(VXLAN_VID_MASK << 8)
32#define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
33
12#define VNI_HASH_BITS 10 34#define VNI_HASH_BITS 10
13#define VNI_HASH_SIZE (1<<VNI_HASH_BITS) 35#define VNI_HASH_SIZE (1<<VNI_HASH_BITS)
36#define FDB_HASH_BITS 8
37#define FDB_HASH_SIZE (1<<FDB_HASH_BITS)
38
39/* Remote checksum offload for VXLAN (VXLAN_F_REMCSUM_[RT]X):
40 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41 * |R|R|R|R|I|R|R|R|R|R|C| Reserved |
42 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 * | VXLAN Network Identifier (VNI) |O| Csum start |
44 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
45 *
46 * C = Remote checksum offload bit. When set indicates that the
47 * remote checksum offload data is present.
48 *
49 * O = Offset bit. Indicates the checksum offset relative to
50 * checksum start.
51 *
52 * Csum start = Checksum start divided by two.
53 *
54 * http://tools.ietf.org/html/draft-herbert-vxlan-rco
55 */
56
57/* VXLAN-RCO header flags. */
58#define VXLAN_HF_RCO cpu_to_be32(BIT(21))
59
60/* Remote checksum offload header option */
61#define VXLAN_RCO_MASK cpu_to_be32(0x7f) /* Last byte of vni field */
62#define VXLAN_RCO_UDP cpu_to_be32(0x80) /* Indicate UDP RCO (TCP when not set *) */
63#define VXLAN_RCO_SHIFT 1 /* Left shift of start */
64#define VXLAN_RCO_SHIFT_MASK ((1 << VXLAN_RCO_SHIFT) - 1)
65#define VXLAN_MAX_REMCSUM_START (0x7f << VXLAN_RCO_SHIFT)
14 66
15/* 67/*
16 * VXLAN Group Based Policy Extension: 68 * VXLAN Group Based Policy Extension (VXLAN_F_GBP):
17 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 69 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
18 * |1|-|-|-|1|-|-|-|R|D|R|R|A|R|R|R| Group Policy ID | 70 * |G|R|R|R|I|R|R|R|R|D|R|R|A|R|R|R| Group Policy ID |
19 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 71 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20 * | VXLAN Network Identifier (VNI) | Reserved | 72 * | VXLAN Network Identifier (VNI) | Reserved |
21 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 73 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
22 * 74 *
75 * G = Group Policy ID present.
76 *
23 * D = Don't Learn bit. When set, this bit indicates that the egress 77 * D = Don't Learn bit. When set, this bit indicates that the egress
24 * VTEP MUST NOT learn the source address of the encapsulated frame. 78 * VTEP MUST NOT learn the source address of the encapsulated frame.
25 * 79 *
@@ -27,18 +81,18 @@
27 * this packet. Policies MUST NOT be applied by devices when the 81 * this packet. Policies MUST NOT be applied by devices when the
28 * A bit is set. 82 * A bit is set.
29 * 83 *
30 * [0] https://tools.ietf.org/html/draft-smith-vxlan-group-policy 84 * https://tools.ietf.org/html/draft-smith-vxlan-group-policy
31 */ 85 */
32struct vxlanhdr_gbp { 86struct vxlanhdr_gbp {
33 __u8 vx_flags; 87 u8 vx_flags;
34#ifdef __LITTLE_ENDIAN_BITFIELD 88#ifdef __LITTLE_ENDIAN_BITFIELD
35 __u8 reserved_flags1:3, 89 u8 reserved_flags1:3,
36 policy_applied:1, 90 policy_applied:1,
37 reserved_flags2:2, 91 reserved_flags2:2,
38 dont_learn:1, 92 dont_learn:1,
39 reserved_flags3:1; 93 reserved_flags3:1;
40#elif defined(__BIG_ENDIAN_BITFIELD) 94#elif defined(__BIG_ENDIAN_BITFIELD)
41 __u8 reserved_flags1:1, 95 u8 reserved_flags1:1,
42 dont_learn:1, 96 dont_learn:1,
43 reserved_flags2:2, 97 reserved_flags2:2,
44 policy_applied:1, 98 policy_applied:1,
@@ -50,7 +104,10 @@ struct vxlanhdr_gbp {
50 __be32 vx_vni; 104 __be32 vx_vni;
51}; 105};
52 106
53#define VXLAN_GBP_USED_BITS (VXLAN_HF_GBP | 0xFFFFFF) 107/* VXLAN-GBP header flags. */
108#define VXLAN_HF_GBP cpu_to_be32(BIT(31))
109
110#define VXLAN_GBP_USED_BITS (VXLAN_HF_GBP | cpu_to_be32(0xFFFFFF))
54 111
55/* skb->mark mapping 112/* skb->mark mapping
56 * 113 *
@@ -62,44 +119,6 @@ struct vxlanhdr_gbp {
62#define VXLAN_GBP_POLICY_APPLIED (BIT(3) << 16) 119#define VXLAN_GBP_POLICY_APPLIED (BIT(3) << 16)
63#define VXLAN_GBP_ID_MASK (0xFFFF) 120#define VXLAN_GBP_ID_MASK (0xFFFF)
64 121
65/* VXLAN protocol header:
66 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
67 * |G|R|R|R|I|R|R|C| Reserved |
68 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
69 * | VXLAN Network Identifier (VNI) | Reserved |
70 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
71 *
72 * G = 1 Group Policy (VXLAN-GBP)
73 * I = 1 VXLAN Network Identifier (VNI) present
74 * C = 1 Remote checksum offload (RCO)
75 */
76struct vxlanhdr {
77 __be32 vx_flags;
78 __be32 vx_vni;
79};
80
81/* VXLAN header flags. */
82#define VXLAN_HF_RCO BIT(21)
83#define VXLAN_HF_VNI BIT(27)
84#define VXLAN_HF_GBP BIT(31)
85
86/* Remote checksum offload header option */
87#define VXLAN_RCO_MASK 0x7f /* Last byte of vni field */
88#define VXLAN_RCO_UDP 0x80 /* Indicate UDP RCO (TCP when not set *) */
89#define VXLAN_RCO_SHIFT 1 /* Left shift of start */
90#define VXLAN_RCO_SHIFT_MASK ((1 << VXLAN_RCO_SHIFT) - 1)
91#define VXLAN_MAX_REMCSUM_START (VXLAN_RCO_MASK << VXLAN_RCO_SHIFT)
92
93#define VXLAN_N_VID (1u << 24)
94#define VXLAN_VID_MASK (VXLAN_N_VID - 1)
95#define VXLAN_VNI_MASK (VXLAN_VID_MASK << 8)
96#define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
97
98#define VNI_HASH_BITS 10
99#define VNI_HASH_SIZE (1<<VNI_HASH_BITS)
100#define FDB_HASH_BITS 8
101#define FDB_HASH_SIZE (1<<FDB_HASH_BITS)
102
103struct vxlan_metadata { 122struct vxlan_metadata {
104 u32 gbp; 123 u32 gbp;
105}; 124};
@@ -125,23 +144,25 @@ union vxlan_addr {
125struct vxlan_rdst { 144struct vxlan_rdst {
126 union vxlan_addr remote_ip; 145 union vxlan_addr remote_ip;
127 __be16 remote_port; 146 __be16 remote_port;
128 u32 remote_vni; 147 __be32 remote_vni;
129 u32 remote_ifindex; 148 u32 remote_ifindex;
130 struct list_head list; 149 struct list_head list;
131 struct rcu_head rcu; 150 struct rcu_head rcu;
151 struct dst_cache dst_cache;
132}; 152};
133 153
134struct vxlan_config { 154struct vxlan_config {
135 union vxlan_addr remote_ip; 155 union vxlan_addr remote_ip;
136 union vxlan_addr saddr; 156 union vxlan_addr saddr;
137 u32 vni; 157 __be32 vni;
138 int remote_ifindex; 158 int remote_ifindex;
139 int mtu; 159 int mtu;
140 __be16 dst_port; 160 __be16 dst_port;
141 __u16 port_min; 161 u16 port_min;
142 __u16 port_max; 162 u16 port_max;
143 __u8 tos; 163 u8 tos;
144 __u8 ttl; 164 u8 ttl;
165 __be32 label;
145 u32 flags; 166 u32 flags;
146 unsigned long age_interval; 167 unsigned long age_interval;
147 unsigned int addrmax; 168 unsigned int addrmax;
@@ -177,7 +198,7 @@ struct vxlan_dev {
177#define VXLAN_F_L2MISS 0x08 198#define VXLAN_F_L2MISS 0x08
178#define VXLAN_F_L3MISS 0x10 199#define VXLAN_F_L3MISS 0x10
179#define VXLAN_F_IPV6 0x20 200#define VXLAN_F_IPV6 0x20
180#define VXLAN_F_UDP_CSUM 0x40 201#define VXLAN_F_UDP_ZERO_CSUM_TX 0x40
181#define VXLAN_F_UDP_ZERO_CSUM6_TX 0x80 202#define VXLAN_F_UDP_ZERO_CSUM6_TX 0x80
182#define VXLAN_F_UDP_ZERO_CSUM6_RX 0x100 203#define VXLAN_F_UDP_ZERO_CSUM6_RX 0x100
183#define VXLAN_F_REMCSUM_TX 0x200 204#define VXLAN_F_REMCSUM_TX 0x200
@@ -242,6 +263,68 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb,
242/* IPv6 header + UDP + VXLAN + Ethernet header */ 263/* IPv6 header + UDP + VXLAN + Ethernet header */
243#define VXLAN6_HEADROOM (40 + 8 + 8 + 14) 264#define VXLAN6_HEADROOM (40 + 8 + 8 + 14)
244 265
266static inline struct vxlanhdr *vxlan_hdr(struct sk_buff *skb)
267{
268 return (struct vxlanhdr *)(udp_hdr(skb) + 1);
269}
270
271static inline __be32 vxlan_vni(__be32 vni_field)
272{
273#if defined(__BIG_ENDIAN)
274 return vni_field >> 8;
275#else
276 return (vni_field & VXLAN_VNI_MASK) << 8;
277#endif
278}
279
280static inline __be32 vxlan_vni_field(__be32 vni)
281{
282#if defined(__BIG_ENDIAN)
283 return vni << 8;
284#else
285 return vni >> 8;
286#endif
287}
288
289static inline __be32 vxlan_tun_id_to_vni(__be64 tun_id)
290{
291#if defined(__BIG_ENDIAN)
292 return tun_id;
293#else
294 return tun_id >> 32;
295#endif
296}
297
298static inline __be64 vxlan_vni_to_tun_id(__be32 vni)
299{
300#if defined(__BIG_ENDIAN)
301 return (__be64)vni;
302#else
303 return (__be64)vni << 32;
304#endif
305}
306
307static inline size_t vxlan_rco_start(__be32 vni_field)
308{
309 return be32_to_cpu(vni_field & VXLAN_RCO_MASK) << VXLAN_RCO_SHIFT;
310}
311
312static inline size_t vxlan_rco_offset(__be32 vni_field)
313{
314 return (vni_field & VXLAN_RCO_UDP) ?
315 offsetof(struct udphdr, check) :
316 offsetof(struct tcphdr, check);
317}
318
319static inline __be32 vxlan_compute_rco(unsigned int start, unsigned int offset)
320{
321 __be32 vni_field = cpu_to_be32(start >> VXLAN_RCO_SHIFT);
322
323 if (offset == offsetof(struct udphdr, check))
324 vni_field |= VXLAN_RCO_UDP;
325 return vni_field;
326}
327
245#if IS_ENABLED(CONFIG_VXLAN) 328#if IS_ENABLED(CONFIG_VXLAN)
246void vxlan_get_rx_port(struct net_device *netdev); 329void vxlan_get_rx_port(struct net_device *netdev);
247#else 330#else
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index c34c9002460c..931a47ba4571 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -262,24 +262,22 @@ static inline enum ib_mtu iboe_get_mtu(int mtu)
262 262
263static inline int iboe_get_rate(struct net_device *dev) 263static inline int iboe_get_rate(struct net_device *dev)
264{ 264{
265 struct ethtool_cmd cmd; 265 struct ethtool_link_ksettings cmd;
266 u32 speed;
267 int err; 266 int err;
268 267
269 rtnl_lock(); 268 rtnl_lock();
270 err = __ethtool_get_settings(dev, &cmd); 269 err = __ethtool_get_link_ksettings(dev, &cmd);
271 rtnl_unlock(); 270 rtnl_unlock();
272 if (err) 271 if (err)
273 return IB_RATE_PORT_CURRENT; 272 return IB_RATE_PORT_CURRENT;
274 273
275 speed = ethtool_cmd_speed(&cmd); 274 if (cmd.base.speed >= 40000)
276 if (speed >= 40000)
277 return IB_RATE_40_GBPS; 275 return IB_RATE_40_GBPS;
278 else if (speed >= 30000) 276 else if (cmd.base.speed >= 30000)
279 return IB_RATE_30_GBPS; 277 return IB_RATE_30_GBPS;
280 else if (speed >= 20000) 278 else if (cmd.base.speed >= 20000)
281 return IB_RATE_20_GBPS; 279 return IB_RATE_20_GBPS;
282 else if (speed >= 10000) 280 else if (cmd.base.speed >= 10000)
283 return IB_RATE_10_GBPS; 281 return IB_RATE_10_GBPS;
284 else 282 else
285 return IB_RATE_PORT_CURRENT; 283 return IB_RATE_PORT_CURRENT;
diff --git a/include/rxrpc/packet.h b/include/rxrpc/packet.h
index 4dce116bfd80..9ebab3a8cf0a 100644
--- a/include/rxrpc/packet.h
+++ b/include/rxrpc/packet.h
@@ -22,7 +22,7 @@ typedef __be32 rxrpc_serial_net_t; /* on-the-wire Rx message serial number */
22 * on-the-wire Rx packet header 22 * on-the-wire Rx packet header
23 * - all multibyte fields should be in network byte order 23 * - all multibyte fields should be in network byte order
24 */ 24 */
25struct rxrpc_header { 25struct rxrpc_wire_header {
26 __be32 epoch; /* client boot timestamp */ 26 __be32 epoch; /* client boot timestamp */
27 27
28 __be32 cid; /* connection and channel ID */ 28 __be32 cid; /* connection and channel ID */
@@ -68,10 +68,19 @@ struct rxrpc_header {
68 68
69} __packed; 69} __packed;
70 70
71#define __rxrpc_header_off(X) offsetof(struct rxrpc_header,X)
72
73extern const char *rxrpc_pkts[]; 71extern const char *rxrpc_pkts[];
74 72
73#define RXRPC_SUPPORTED_PACKET_TYPES ( \
74 (1 << RXRPC_PACKET_TYPE_DATA) | \
75 (1 << RXRPC_PACKET_TYPE_ACK) | \
76 (1 << RXRPC_PACKET_TYPE_BUSY) | \
77 (1 << RXRPC_PACKET_TYPE_ABORT) | \
78 (1 << RXRPC_PACKET_TYPE_ACKALL) | \
79 (1 << RXRPC_PACKET_TYPE_CHALLENGE) | \
80 (1 << RXRPC_PACKET_TYPE_RESPONSE) | \
81 /*(1 << RXRPC_PACKET_TYPE_DEBUG) | */ \
82 (1 << RXRPC_PACKET_TYPE_VERSION))
83
75/*****************************************************************************/ 84/*****************************************************************************/
76/* 85/*
77 * jumbo packet secondary header 86 * jumbo packet secondary header
diff --git a/include/trace/events/sunvnet.h b/include/trace/events/sunvnet.h
new file mode 100644
index 000000000000..eb080b267e55
--- /dev/null
+++ b/include/trace/events/sunvnet.h
@@ -0,0 +1,139 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM sunvnet
3
4#if !defined(_TRACE_SUNVNET_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SUNVNET_H
6
7#include <linux/tracepoint.h>
8
9TRACE_EVENT(vnet_rx_one,
10
11 TP_PROTO(int lsid, int rsid, int index, int needs_ack),
12
13 TP_ARGS(lsid, rsid, index, needs_ack),
14
15 TP_STRUCT__entry(
16 __field(int, lsid)
17 __field(int, rsid)
18 __field(int, index)
19 __field(int, needs_ack)
20 ),
21
22 TP_fast_assign(
23 __entry->lsid = lsid;
24 __entry->rsid = rsid;
25 __entry->index = index;
26 __entry->needs_ack = needs_ack;
27 ),
28
29 TP_printk("(%x:%x) walk_rx_one index %d; needs_ack %d",
30 __entry->lsid, __entry->rsid,
31 __entry->index, __entry->needs_ack)
32);
33
34DECLARE_EVENT_CLASS(vnet_tx_stopped_ack_template,
35
36 TP_PROTO(int lsid, int rsid, int ack_end, int npkts),
37
38 TP_ARGS(lsid, rsid, ack_end, npkts),
39
40 TP_STRUCT__entry(
41 __field(int, lsid)
42 __field(int, rsid)
43 __field(int, ack_end)
44 __field(int, npkts)
45 ),
46
47 TP_fast_assign(
48 __entry->lsid = lsid;
49 __entry->rsid = rsid;
50 __entry->ack_end = ack_end;
51 __entry->npkts = npkts;
52 ),
53
54 TP_printk("(%x:%x) stopped ack for %d; npkts %d",
55 __entry->lsid, __entry->rsid,
56 __entry->ack_end, __entry->npkts)
57);
58DEFINE_EVENT(vnet_tx_stopped_ack_template, vnet_tx_send_stopped_ack,
59 TP_PROTO(int lsid, int rsid, int ack_end, int npkts),
60 TP_ARGS(lsid, rsid, ack_end, npkts));
61DEFINE_EVENT(vnet_tx_stopped_ack_template, vnet_tx_defer_stopped_ack,
62 TP_PROTO(int lsid, int rsid, int ack_end, int npkts),
63 TP_ARGS(lsid, rsid, ack_end, npkts));
64DEFINE_EVENT(vnet_tx_stopped_ack_template, vnet_tx_pending_stopped_ack,
65 TP_PROTO(int lsid, int rsid, int ack_end, int npkts),
66 TP_ARGS(lsid, rsid, ack_end, npkts));
67
68TRACE_EVENT(vnet_rx_stopped_ack,
69
70 TP_PROTO(int lsid, int rsid, int end),
71
72 TP_ARGS(lsid, rsid, end),
73
74 TP_STRUCT__entry(
75 __field(int, lsid)
76 __field(int, rsid)
77 __field(int, end)
78 ),
79
80 TP_fast_assign(
81 __entry->lsid = lsid;
82 __entry->rsid = rsid;
83 __entry->end = end;
84 ),
85
86 TP_printk("(%x:%x) stopped ack for index %d",
87 __entry->lsid, __entry->rsid, __entry->end)
88);
89
90TRACE_EVENT(vnet_tx_trigger,
91
92 TP_PROTO(int lsid, int rsid, int start, int err),
93
94 TP_ARGS(lsid, rsid, start, err),
95
96 TP_STRUCT__entry(
97 __field(int, lsid)
98 __field(int, rsid)
99 __field(int, start)
100 __field(int, err)
101 ),
102
103 TP_fast_assign(
104 __entry->lsid = lsid;
105 __entry->rsid = rsid;
106 __entry->start = start;
107 __entry->err = err;
108 ),
109
110 TP_printk("(%x:%x) Tx trigger for %d sent with err %d %s",
111 __entry->lsid, __entry->rsid, __entry->start,
112 __entry->err, __entry->err > 0 ? "(ok)" : " ")
113);
114
115TRACE_EVENT(vnet_skip_tx_trigger,
116
117 TP_PROTO(int lsid, int rsid, int last),
118
119 TP_ARGS(lsid, rsid, last),
120
121 TP_STRUCT__entry(
122 __field(int, lsid)
123 __field(int, rsid)
124 __field(int, last)
125 ),
126
127 TP_fast_assign(
128 __entry->lsid = lsid;
129 __entry->rsid = rsid;
130 __entry->last = last;
131 ),
132
133 TP_printk("(%x:%x) Skip Tx trigger. Last trigger sent was %d",
134 __entry->lsid, __entry->rsid, __entry->last)
135);
136#endif /* _TRACE_SOCK_H */
137
138/* This part must be outside protection */
139#include <trace/define_trace.h>
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index fb8a41668382..67d632f1743d 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -90,4 +90,6 @@
90#define SO_ATTACH_REUSEPORT_CBPF 51 90#define SO_ATTACH_REUSEPORT_CBPF 51
91#define SO_ATTACH_REUSEPORT_EBPF 52 91#define SO_ATTACH_REUSEPORT_EBPF 52
92 92
93#define SO_CNX_ADVICE 53
94
93#endif /* __ASM_GENERIC_SOCKET_H */ 95#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 5c9ae6a9b7f5..0495884defc1 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -174,6 +174,7 @@ header-y += if_hippi.h
174header-y += if_infiniband.h 174header-y += if_infiniband.h
175header-y += if_link.h 175header-y += if_link.h
176header-y += if_ltalk.h 176header-y += if_ltalk.h
177header-y += if_macsec.h
177header-y += if_packet.h 178header-y += if_packet.h
178header-y += if_phonet.h 179header-y += if_phonet.h
179header-y += if_plip.h 180header-y += if_plip.h
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 5df4881dea7b..924f537183fd 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -81,6 +81,9 @@ enum bpf_map_type {
81 BPF_MAP_TYPE_ARRAY, 81 BPF_MAP_TYPE_ARRAY,
82 BPF_MAP_TYPE_PROG_ARRAY, 82 BPF_MAP_TYPE_PROG_ARRAY,
83 BPF_MAP_TYPE_PERF_EVENT_ARRAY, 83 BPF_MAP_TYPE_PERF_EVENT_ARRAY,
84 BPF_MAP_TYPE_PERCPU_HASH,
85 BPF_MAP_TYPE_PERCPU_ARRAY,
86 BPF_MAP_TYPE_STACK_TRACE,
84}; 87};
85 88
86enum bpf_prog_type { 89enum bpf_prog_type {
@@ -98,12 +101,15 @@ enum bpf_prog_type {
98#define BPF_NOEXIST 1 /* create new element if it didn't exist */ 101#define BPF_NOEXIST 1 /* create new element if it didn't exist */
99#define BPF_EXIST 2 /* update existing element */ 102#define BPF_EXIST 2 /* update existing element */
100 103
104#define BPF_F_NO_PREALLOC (1U << 0)
105
101union bpf_attr { 106union bpf_attr {
102 struct { /* anonymous struct used by BPF_MAP_CREATE command */ 107 struct { /* anonymous struct used by BPF_MAP_CREATE command */
103 __u32 map_type; /* one of enum bpf_map_type */ 108 __u32 map_type; /* one of enum bpf_map_type */
104 __u32 key_size; /* size of key in bytes */ 109 __u32 key_size; /* size of key in bytes */
105 __u32 value_size; /* size of value in bytes */ 110 __u32 value_size; /* size of value in bytes */
106 __u32 max_entries; /* max number of entries in a map */ 111 __u32 max_entries; /* max number of entries in a map */
112 __u32 map_flags; /* prealloc or not */
107 }; 113 };
108 114
109 struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ 115 struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
@@ -270,6 +276,42 @@ enum bpf_func_id {
270 */ 276 */
271 BPF_FUNC_perf_event_output, 277 BPF_FUNC_perf_event_output,
272 BPF_FUNC_skb_load_bytes, 278 BPF_FUNC_skb_load_bytes,
279
280 /**
281 * bpf_get_stackid(ctx, map, flags) - walk user or kernel stack and return id
282 * @ctx: struct pt_regs*
283 * @map: pointer to stack_trace map
284 * @flags: bits 0-7 - numer of stack frames to skip
285 * bit 8 - collect user stack instead of kernel
286 * bit 9 - compare stacks by hash only
287 * bit 10 - if two different stacks hash into the same stackid
288 * discard old
289 * other bits - reserved
290 * Return: >= 0 stackid on success or negative error
291 */
292 BPF_FUNC_get_stackid,
293
294 /**
295 * bpf_csum_diff(from, from_size, to, to_size, seed) - calculate csum diff
296 * @from: raw from buffer
297 * @from_size: length of from buffer
298 * @to: raw to buffer
299 * @to_size: length of to buffer
300 * @seed: optional seed
301 * Return: csum result
302 */
303 BPF_FUNC_csum_diff,
304
305 /**
306 * bpf_skb_[gs]et_tunnel_opt(skb, opt, size)
307 * retrieve or populate tunnel options metadata
308 * @skb: pointer to skb
309 * @opt: pointer to raw tunnel option data
310 * @size: size of @opt
311 * Return: 0 on success for set, option size for get
312 */
313 BPF_FUNC_skb_get_tunnel_opt,
314 BPF_FUNC_skb_set_tunnel_opt,
273 __BPF_FUNC_MAX_ID, 315 __BPF_FUNC_MAX_ID,
274}; 316};
275 317
@@ -277,6 +319,7 @@ enum bpf_func_id {
277 319
278/* BPF_FUNC_skb_store_bytes flags. */ 320/* BPF_FUNC_skb_store_bytes flags. */
279#define BPF_F_RECOMPUTE_CSUM (1ULL << 0) 321#define BPF_F_RECOMPUTE_CSUM (1ULL << 0)
322#define BPF_F_INVALIDATE_HASH (1ULL << 1)
280 323
281/* BPF_FUNC_l3_csum_replace and BPF_FUNC_l4_csum_replace flags. 324/* BPF_FUNC_l3_csum_replace and BPF_FUNC_l4_csum_replace flags.
282 * First 4 bits are for passing the header field size. 325 * First 4 bits are for passing the header field size.
@@ -285,6 +328,7 @@ enum bpf_func_id {
285 328
286/* BPF_FUNC_l4_csum_replace flags. */ 329/* BPF_FUNC_l4_csum_replace flags. */
287#define BPF_F_PSEUDO_HDR (1ULL << 4) 330#define BPF_F_PSEUDO_HDR (1ULL << 4)
331#define BPF_F_MARK_MANGLED_0 (1ULL << 5)
288 332
289/* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */ 333/* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */
290#define BPF_F_INGRESS (1ULL << 0) 334#define BPF_F_INGRESS (1ULL << 0)
@@ -292,8 +336,15 @@ enum bpf_func_id {
292/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */ 336/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */
293#define BPF_F_TUNINFO_IPV6 (1ULL << 0) 337#define BPF_F_TUNINFO_IPV6 (1ULL << 0)
294 338
339/* BPF_FUNC_get_stackid flags. */
340#define BPF_F_SKIP_FIELD_MASK 0xffULL
341#define BPF_F_USER_STACK (1ULL << 8)
342#define BPF_F_FAST_STACK_CMP (1ULL << 9)
343#define BPF_F_REUSE_STACKID (1ULL << 10)
344
295/* BPF_FUNC_skb_set_tunnel_key flags. */ 345/* BPF_FUNC_skb_set_tunnel_key flags. */
296#define BPF_F_ZERO_CSUM_TX (1ULL << 1) 346#define BPF_F_ZERO_CSUM_TX (1ULL << 1)
347#define BPF_F_DONT_FRAGMENT (1ULL << 2)
297 348
298/* user accessible mirror of in-kernel sk_buff. 349/* user accessible mirror of in-kernel sk_buff.
299 * new fields can only be added to the end of this structure 350 * new fields can only be added to the end of this structure
@@ -324,6 +375,7 @@ struct bpf_tunnel_key {
324 }; 375 };
325 __u8 tunnel_tos; 376 __u8 tunnel_tos;
326 __u8 tunnel_ttl; 377 __u8 tunnel_ttl;
378 __u32 tunnel_label;
327}; 379};
328 380
329#endif /* _UAPI__LINUX_BPF_H__ */ 381#endif /* _UAPI__LINUX_BPF_H__ */
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
new file mode 100644
index 000000000000..c9fee5781eb1
--- /dev/null
+++ b/include/uapi/linux/devlink.h
@@ -0,0 +1,72 @@
1/*
2 * include/uapi/linux/devlink.h - Network physical device Netlink interface
3 * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
4 * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef _UAPI_LINUX_DEVLINK_H_
13#define _UAPI_LINUX_DEVLINK_H_
14
15#define DEVLINK_GENL_NAME "devlink"
16#define DEVLINK_GENL_VERSION 0x1
17#define DEVLINK_GENL_MCGRP_CONFIG_NAME "config"
18
19enum devlink_command {
20 /* don't change the order or add anything between, this is ABI! */
21 DEVLINK_CMD_UNSPEC,
22
23 DEVLINK_CMD_GET, /* can dump */
24 DEVLINK_CMD_SET,
25 DEVLINK_CMD_NEW,
26 DEVLINK_CMD_DEL,
27
28 DEVLINK_CMD_PORT_GET, /* can dump */
29 DEVLINK_CMD_PORT_SET,
30 DEVLINK_CMD_PORT_NEW,
31 DEVLINK_CMD_PORT_DEL,
32
33 DEVLINK_CMD_PORT_SPLIT,
34 DEVLINK_CMD_PORT_UNSPLIT,
35
36 /* add new commands above here */
37
38 __DEVLINK_CMD_MAX,
39 DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
40};
41
42enum devlink_port_type {
43 DEVLINK_PORT_TYPE_NOTSET,
44 DEVLINK_PORT_TYPE_AUTO,
45 DEVLINK_PORT_TYPE_ETH,
46 DEVLINK_PORT_TYPE_IB,
47};
48
49enum devlink_attr {
50 /* don't change the order or add anything between, this is ABI! */
51 DEVLINK_ATTR_UNSPEC,
52
53 /* bus name + dev name together are a handle for devlink entity */
54 DEVLINK_ATTR_BUS_NAME, /* string */
55 DEVLINK_ATTR_DEV_NAME, /* string */
56
57 DEVLINK_ATTR_PORT_INDEX, /* u32 */
58 DEVLINK_ATTR_PORT_TYPE, /* u16 */
59 DEVLINK_ATTR_PORT_DESIRED_TYPE, /* u16 */
60 DEVLINK_ATTR_PORT_NETDEV_IFINDEX, /* u32 */
61 DEVLINK_ATTR_PORT_NETDEV_NAME, /* string */
62 DEVLINK_ATTR_PORT_IBDEV_NAME, /* string */
63 DEVLINK_ATTR_PORT_SPLIT_COUNT, /* u32 */
64 DEVLINK_ATTR_PORT_SPLIT_GROUP, /* u32 */
65
66 /* add new attributes above here, update the policy in devlink.c */
67
68 __DEVLINK_ATTR_MAX,
69 DEVLINK_ATTR_MAX = __DEVLINK_ATTR_MAX - 1
70};
71
72#endif /* _UAPI_LINUX_DEVLINK_H_ */
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 57fa39005e79..2835b07416b7 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -13,15 +13,21 @@
13#ifndef _UAPI_LINUX_ETHTOOL_H 13#ifndef _UAPI_LINUX_ETHTOOL_H
14#define _UAPI_LINUX_ETHTOOL_H 14#define _UAPI_LINUX_ETHTOOL_H
15 15
16#include <linux/kernel.h>
16#include <linux/types.h> 17#include <linux/types.h>
17#include <linux/if_ether.h> 18#include <linux/if_ether.h>
18 19
20#ifndef __KERNEL__
21#include <limits.h> /* for INT_MAX */
22#endif
23
19/* All structures exposed to userland should be defined such that they 24/* All structures exposed to userland should be defined such that they
20 * have the same layout for 32-bit and 64-bit userland. 25 * have the same layout for 32-bit and 64-bit userland.
21 */ 26 */
22 27
23/** 28/**
24 * struct ethtool_cmd - link control and status 29 * struct ethtool_cmd - DEPRECATED, link control and status
30 * This structure is DEPRECATED, please use struct ethtool_link_settings.
25 * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET 31 * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET
26 * @supported: Bitmask of %SUPPORTED_* flags for the link modes, 32 * @supported: Bitmask of %SUPPORTED_* flags for the link modes,
27 * physical connectors and other link features for which the 33 * physical connectors and other link features for which the
@@ -31,7 +37,7 @@
31 * physical connectors and other link features that are 37 * physical connectors and other link features that are
32 * advertised through autonegotiation or enabled for 38 * advertised through autonegotiation or enabled for
33 * auto-detection. 39 * auto-detection.
34 * @speed: Low bits of the speed 40 * @speed: Low bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN
35 * @duplex: Duplex mode; one of %DUPLEX_* 41 * @duplex: Duplex mode; one of %DUPLEX_*
36 * @port: Physical connector type; one of %PORT_* 42 * @port: Physical connector type; one of %PORT_*
37 * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not 43 * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
@@ -47,7 +53,7 @@
47 * obsoleted by &struct ethtool_coalesce. Read-only; deprecated. 53 * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
48 * @maxrxpkt: Historically used to report RX IRQ coalescing; now 54 * @maxrxpkt: Historically used to report RX IRQ coalescing; now
49 * obsoleted by &struct ethtool_coalesce. Read-only; deprecated. 55 * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
50 * @speed_hi: High bits of the speed 56 * @speed_hi: High bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN
51 * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of 57 * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
52 * %ETH_TP_MDI_*. If the status is unknown or not applicable, the 58 * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
53 * value will be %ETH_TP_MDI_INVALID. Read-only. 59 * value will be %ETH_TP_MDI_INVALID. Read-only.
@@ -748,6 +754,56 @@ struct ethtool_usrip4_spec {
748 __u8 proto; 754 __u8 proto;
749}; 755};
750 756
757/**
758 * struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc.
759 * @ip6src: Source host
760 * @ip6dst: Destination host
761 * @psrc: Source port
762 * @pdst: Destination port
763 * @tclass: Traffic Class
764 *
765 * This can be used to specify a TCP/IPv6, UDP/IPv6 or SCTP/IPv6 flow.
766 */
767struct ethtool_tcpip6_spec {
768 __be32 ip6src[4];
769 __be32 ip6dst[4];
770 __be16 psrc;
771 __be16 pdst;
772 __u8 tclass;
773};
774
775/**
776 * struct ethtool_ah_espip6_spec - flow specification for IPsec/IPv6
777 * @ip6src: Source host
778 * @ip6dst: Destination host
779 * @spi: Security parameters index
780 * @tclass: Traffic Class
781 *
782 * This can be used to specify an IPsec transport or tunnel over IPv6.
783 */
784struct ethtool_ah_espip6_spec {
785 __be32 ip6src[4];
786 __be32 ip6dst[4];
787 __be32 spi;
788 __u8 tclass;
789};
790
791/**
792 * struct ethtool_usrip6_spec - general flow specification for IPv6
793 * @ip6src: Source host
794 * @ip6dst: Destination host
795 * @l4_4_bytes: First 4 bytes of transport (layer 4) header
796 * @tclass: Traffic Class
797 * @l4_proto: Transport protocol number (nexthdr after any Extension Headers)
798 */
799struct ethtool_usrip6_spec {
800 __be32 ip6src[4];
801 __be32 ip6dst[4];
802 __be32 l4_4_bytes;
803 __u8 tclass;
804 __u8 l4_proto;
805};
806
751union ethtool_flow_union { 807union ethtool_flow_union {
752 struct ethtool_tcpip4_spec tcp_ip4_spec; 808 struct ethtool_tcpip4_spec tcp_ip4_spec;
753 struct ethtool_tcpip4_spec udp_ip4_spec; 809 struct ethtool_tcpip4_spec udp_ip4_spec;
@@ -755,6 +811,12 @@ union ethtool_flow_union {
755 struct ethtool_ah_espip4_spec ah_ip4_spec; 811 struct ethtool_ah_espip4_spec ah_ip4_spec;
756 struct ethtool_ah_espip4_spec esp_ip4_spec; 812 struct ethtool_ah_espip4_spec esp_ip4_spec;
757 struct ethtool_usrip4_spec usr_ip4_spec; 813 struct ethtool_usrip4_spec usr_ip4_spec;
814 struct ethtool_tcpip6_spec tcp_ip6_spec;
815 struct ethtool_tcpip6_spec udp_ip6_spec;
816 struct ethtool_tcpip6_spec sctp_ip6_spec;
817 struct ethtool_ah_espip6_spec ah_ip6_spec;
818 struct ethtool_ah_espip6_spec esp_ip6_spec;
819 struct ethtool_usrip6_spec usr_ip6_spec;
758 struct ethhdr ether_spec; 820 struct ethhdr ether_spec;
759 __u8 hdata[52]; 821 __u8 hdata[52];
760}; 822};
@@ -1146,10 +1208,29 @@ enum ethtool_sfeatures_retval_bits {
1146#define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT) 1208#define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT)
1147#define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT) 1209#define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT)
1148 1210
1211#define MAX_NUM_QUEUE 4096
1212
1213/**
1214 * struct ethtool_per_queue_op - apply sub command to the queues in mask.
1215 * @cmd: ETHTOOL_PERQUEUE
1216 * @sub_command: the sub command which apply to each queues
1217 * @queue_mask: Bitmap of the queues which sub command apply to
1218 * @data: A complete command structure following for each of the queues addressed
1219 */
1220struct ethtool_per_queue_op {
1221 __u32 cmd;
1222 __u32 sub_command;
1223 __u32 queue_mask[__KERNEL_DIV_ROUND_UP(MAX_NUM_QUEUE, 32)];
1224 char data[];
1225};
1149 1226
1150/* CMDs currently supported */ 1227/* CMDs currently supported */
1151#define ETHTOOL_GSET 0x00000001 /* Get settings. */ 1228#define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings.
1152#define ETHTOOL_SSET 0x00000002 /* Set settings. */ 1229 * Please use ETHTOOL_GLINKSETTINGS
1230 */
1231#define ETHTOOL_SSET 0x00000002 /* DEPRECATED, Set settings.
1232 * Please use ETHTOOL_SLINKSETTINGS
1233 */
1153#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ 1234#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
1154#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ 1235#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
1155#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ 1236#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
@@ -1229,73 +1310,141 @@ enum ethtool_sfeatures_retval_bits {
1229#define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */ 1310#define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */
1230#define ETHTOOL_GPHYSTATS 0x0000004a /* get PHY-specific statistics */ 1311#define ETHTOOL_GPHYSTATS 0x0000004a /* get PHY-specific statistics */
1231 1312
1313#define ETHTOOL_PERQUEUE 0x0000004b /* Set per queue options */
1314
1315#define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */
1316#define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */
1317
1318
1232/* compatibility with older code */ 1319/* compatibility with older code */
1233#define SPARC_ETH_GSET ETHTOOL_GSET 1320#define SPARC_ETH_GSET ETHTOOL_GSET
1234#define SPARC_ETH_SSET ETHTOOL_SSET 1321#define SPARC_ETH_SSET ETHTOOL_SSET
1235 1322
1236#define SUPPORTED_10baseT_Half (1 << 0) 1323/* Link mode bit indices */
1237#define SUPPORTED_10baseT_Full (1 << 1) 1324enum ethtool_link_mode_bit_indices {
1238#define SUPPORTED_100baseT_Half (1 << 2) 1325 ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0,
1239#define SUPPORTED_100baseT_Full (1 << 3) 1326 ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1,
1240#define SUPPORTED_1000baseT_Half (1 << 4) 1327 ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2,
1241#define SUPPORTED_1000baseT_Full (1 << 5) 1328 ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3,
1242#define SUPPORTED_Autoneg (1 << 6) 1329 ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4,
1243#define SUPPORTED_TP (1 << 7) 1330 ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5,
1244#define SUPPORTED_AUI (1 << 8) 1331 ETHTOOL_LINK_MODE_Autoneg_BIT = 6,
1245#define SUPPORTED_MII (1 << 9) 1332 ETHTOOL_LINK_MODE_TP_BIT = 7,
1246#define SUPPORTED_FIBRE (1 << 10) 1333 ETHTOOL_LINK_MODE_AUI_BIT = 8,
1247#define SUPPORTED_BNC (1 << 11) 1334 ETHTOOL_LINK_MODE_MII_BIT = 9,
1248#define SUPPORTED_10000baseT_Full (1 << 12) 1335 ETHTOOL_LINK_MODE_FIBRE_BIT = 10,
1249#define SUPPORTED_Pause (1 << 13) 1336 ETHTOOL_LINK_MODE_BNC_BIT = 11,
1250#define SUPPORTED_Asym_Pause (1 << 14) 1337 ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12,
1251#define SUPPORTED_2500baseX_Full (1 << 15) 1338 ETHTOOL_LINK_MODE_Pause_BIT = 13,
1252#define SUPPORTED_Backplane (1 << 16) 1339 ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14,
1253#define SUPPORTED_1000baseKX_Full (1 << 17) 1340 ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15,
1254#define SUPPORTED_10000baseKX4_Full (1 << 18) 1341 ETHTOOL_LINK_MODE_Backplane_BIT = 16,
1255#define SUPPORTED_10000baseKR_Full (1 << 19) 1342 ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17,
1256#define SUPPORTED_10000baseR_FEC (1 << 20) 1343 ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18,
1257#define SUPPORTED_20000baseMLD2_Full (1 << 21) 1344 ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19,
1258#define SUPPORTED_20000baseKR2_Full (1 << 22) 1345 ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20,
1259#define SUPPORTED_40000baseKR4_Full (1 << 23) 1346 ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21,
1260#define SUPPORTED_40000baseCR4_Full (1 << 24) 1347 ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22,
1261#define SUPPORTED_40000baseSR4_Full (1 << 25) 1348 ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23,
1262#define SUPPORTED_40000baseLR4_Full (1 << 26) 1349 ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24,
1263#define SUPPORTED_56000baseKR4_Full (1 << 27) 1350 ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25,
1264#define SUPPORTED_56000baseCR4_Full (1 << 28) 1351 ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26,
1265#define SUPPORTED_56000baseSR4_Full (1 << 29) 1352 ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27,
1266#define SUPPORTED_56000baseLR4_Full (1 << 30) 1353 ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28,
1267 1354 ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29,
1268#define ADVERTISED_10baseT_Half (1 << 0) 1355 ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30,
1269#define ADVERTISED_10baseT_Full (1 << 1) 1356
1270#define ADVERTISED_100baseT_Half (1 << 2) 1357 /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit
1271#define ADVERTISED_100baseT_Full (1 << 3) 1358 * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_*
1272#define ADVERTISED_1000baseT_Half (1 << 4) 1359 * macro for bits > 31. The only way to use indices > 31 is to
1273#define ADVERTISED_1000baseT_Full (1 << 5) 1360 * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API.
1274#define ADVERTISED_Autoneg (1 << 6) 1361 */
1275#define ADVERTISED_TP (1 << 7) 1362
1276#define ADVERTISED_AUI (1 << 8) 1363 __ETHTOOL_LINK_MODE_LAST
1277#define ADVERTISED_MII (1 << 9) 1364 = ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT,
1278#define ADVERTISED_FIBRE (1 << 10) 1365};
1279#define ADVERTISED_BNC (1 << 11) 1366
1280#define ADVERTISED_10000baseT_Full (1 << 12) 1367#define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \
1281#define ADVERTISED_Pause (1 << 13) 1368 (1UL << (ETHTOOL_LINK_MODE_ ## base_name ## _BIT))
1282#define ADVERTISED_Asym_Pause (1 << 14) 1369
1283#define ADVERTISED_2500baseX_Full (1 << 15) 1370/* DEPRECATED macros. Please migrate to
1284#define ADVERTISED_Backplane (1 << 16) 1371 * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
1285#define ADVERTISED_1000baseKX_Full (1 << 17) 1372 * define any new SUPPORTED_* macro for bits > 31.
1286#define ADVERTISED_10000baseKX4_Full (1 << 18) 1373 */
1287#define ADVERTISED_10000baseKR_Full (1 << 19) 1374#define SUPPORTED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
1288#define ADVERTISED_10000baseR_FEC (1 << 20) 1375#define SUPPORTED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
1289#define ADVERTISED_20000baseMLD2_Full (1 << 21) 1376#define SUPPORTED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
1290#define ADVERTISED_20000baseKR2_Full (1 << 22) 1377#define SUPPORTED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
1291#define ADVERTISED_40000baseKR4_Full (1 << 23) 1378#define SUPPORTED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
1292#define ADVERTISED_40000baseCR4_Full (1 << 24) 1379#define SUPPORTED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
1293#define ADVERTISED_40000baseSR4_Full (1 << 25) 1380#define SUPPORTED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
1294#define ADVERTISED_40000baseLR4_Full (1 << 26) 1381#define SUPPORTED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
1295#define ADVERTISED_56000baseKR4_Full (1 << 27) 1382#define SUPPORTED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
1296#define ADVERTISED_56000baseCR4_Full (1 << 28) 1383#define SUPPORTED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
1297#define ADVERTISED_56000baseSR4_Full (1 << 29) 1384#define SUPPORTED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
1298#define ADVERTISED_56000baseLR4_Full (1 << 30) 1385#define SUPPORTED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
1386#define SUPPORTED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
1387#define SUPPORTED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
1388#define SUPPORTED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
1389#define SUPPORTED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
1390#define SUPPORTED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
1391#define SUPPORTED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
1392#define SUPPORTED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
1393#define SUPPORTED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
1394#define SUPPORTED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
1395#define SUPPORTED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
1396#define SUPPORTED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
1397#define SUPPORTED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
1398#define SUPPORTED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
1399#define SUPPORTED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
1400#define SUPPORTED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
1401#define SUPPORTED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
1402#define SUPPORTED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
1403#define SUPPORTED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
1404#define SUPPORTED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
1405/* Please do not define any new SUPPORTED_* macro for bits > 31, see
1406 * notice above.
1407 */
1408
1409/*
1410 * DEPRECATED macros. Please migrate to
1411 * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
1412 * define any new ADERTISE_* macro for bits > 31.
1413 */
1414#define ADVERTISED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
1415#define ADVERTISED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
1416#define ADVERTISED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
1417#define ADVERTISED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
1418#define ADVERTISED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
1419#define ADVERTISED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
1420#define ADVERTISED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
1421#define ADVERTISED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
1422#define ADVERTISED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
1423#define ADVERTISED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
1424#define ADVERTISED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
1425#define ADVERTISED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
1426#define ADVERTISED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
1427#define ADVERTISED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
1428#define ADVERTISED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
1429#define ADVERTISED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
1430#define ADVERTISED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
1431#define ADVERTISED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
1432#define ADVERTISED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
1433#define ADVERTISED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
1434#define ADVERTISED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
1435#define ADVERTISED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
1436#define ADVERTISED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
1437#define ADVERTISED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
1438#define ADVERTISED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
1439#define ADVERTISED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
1440#define ADVERTISED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
1441#define ADVERTISED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
1442#define ADVERTISED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
1443#define ADVERTISED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
1444#define ADVERTISED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
1445/* Please do not define any new ADVERTISED_* macro for bits > 31, see
1446 * notice above.
1447 */
1299 1448
1300/* The following are all involved in forcing a particular link 1449/* The following are all involved in forcing a particular link
1301 * mode for the device for setting things. When getting the 1450 * mode for the device for setting things. When getting the
@@ -1303,7 +1452,7 @@ enum ethtool_sfeatures_retval_bits {
1303 * it was forced up into this mode or autonegotiated. 1452 * it was forced up into this mode or autonegotiated.
1304 */ 1453 */
1305 1454
1306/* The forced speed, 10Mb, 100Mb, gigabit, [2.5|5|10|20|25|40|50|56|100]GbE. */ 1455/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */
1307#define SPEED_10 10 1456#define SPEED_10 10
1308#define SPEED_100 100 1457#define SPEED_100 100
1309#define SPEED_1000 1000 1458#define SPEED_1000 1000
@@ -1319,11 +1468,28 @@ enum ethtool_sfeatures_retval_bits {
1319 1468
1320#define SPEED_UNKNOWN -1 1469#define SPEED_UNKNOWN -1
1321 1470
1471static inline int ethtool_validate_speed(__u32 speed)
1472{
1473 return speed <= INT_MAX || speed == SPEED_UNKNOWN;
1474}
1475
1322/* Duplex, half or full. */ 1476/* Duplex, half or full. */
1323#define DUPLEX_HALF 0x00 1477#define DUPLEX_HALF 0x00
1324#define DUPLEX_FULL 0x01 1478#define DUPLEX_FULL 0x01
1325#define DUPLEX_UNKNOWN 0xff 1479#define DUPLEX_UNKNOWN 0xff
1326 1480
1481static inline int ethtool_validate_duplex(__u8 duplex)
1482{
1483 switch (duplex) {
1484 case DUPLEX_HALF:
1485 case DUPLEX_FULL:
1486 case DUPLEX_UNKNOWN:
1487 return 1;
1488 }
1489
1490 return 0;
1491}
1492
1327/* Which connector port. */ 1493/* Which connector port. */
1328#define PORT_TP 0x00 1494#define PORT_TP 0x00
1329#define PORT_AUI 0x01 1495#define PORT_AUI 0x01
@@ -1367,15 +1533,17 @@ enum ethtool_sfeatures_retval_bits {
1367#define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */ 1533#define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
1368#define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */ 1534#define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */
1369#define AH_ESP_V4_FLOW 0x04 /* hash only */ 1535#define AH_ESP_V4_FLOW 0x04 /* hash only */
1370#define TCP_V6_FLOW 0x05 /* hash only */ 1536#define TCP_V6_FLOW 0x05 /* hash or spec (tcp_ip6_spec; nfc only) */
1371#define UDP_V6_FLOW 0x06 /* hash only */ 1537#define UDP_V6_FLOW 0x06 /* hash or spec (udp_ip6_spec; nfc only) */
1372#define SCTP_V6_FLOW 0x07 /* hash only */ 1538#define SCTP_V6_FLOW 0x07 /* hash or spec (sctp_ip6_spec; nfc only) */
1373#define AH_ESP_V6_FLOW 0x08 /* hash only */ 1539#define AH_ESP_V6_FLOW 0x08 /* hash only */
1374#define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */ 1540#define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */
1375#define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */ 1541#define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */
1376#define AH_V6_FLOW 0x0b /* hash only */ 1542#define AH_V6_FLOW 0x0b /* hash or spec (ah_ip6_spec; nfc only) */
1377#define ESP_V6_FLOW 0x0c /* hash only */ 1543#define ESP_V6_FLOW 0x0c /* hash or spec (esp_ip6_spec; nfc only) */
1378#define IP_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */ 1544#define IPV4_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */
1545#define IP_USER_FLOW IPV4_USER_FLOW
1546#define IPV6_USER_FLOW 0x0e /* spec only (usr_ip6_spec; nfc only) */
1379#define IPV4_FLOW 0x10 /* hash only */ 1547#define IPV4_FLOW 0x10 /* hash only */
1380#define IPV6_FLOW 0x11 /* hash only */ 1548#define IPV6_FLOW 0x11 /* hash only */
1381#define ETHER_FLOW 0x12 /* spec only (ether_spec) */ 1549#define ETHER_FLOW 0x12 /* spec only (ether_spec) */
@@ -1441,4 +1609,123 @@ enum ethtool_reset_flags {
1441}; 1609};
1442#define ETH_RESET_SHARED_SHIFT 16 1610#define ETH_RESET_SHARED_SHIFT 16
1443 1611
1612
1613/**
1614 * struct ethtool_link_settings - link control and status
1615 *
1616 * IMPORTANT, Backward compatibility notice: When implementing new
1617 * user-space tools, please first try %ETHTOOL_GLINKSETTINGS, and
1618 * if it succeeds use %ETHTOOL_SLINKSETTINGS to change link
1619 * settings; do not use %ETHTOOL_SSET if %ETHTOOL_GLINKSETTINGS
1620 * succeeded: stick to %ETHTOOL_GLINKSETTINGS/%SLINKSETTINGS in
1621 * that case. Conversely, if %ETHTOOL_GLINKSETTINGS fails, use
1622 * %ETHTOOL_GSET to query and %ETHTOOL_SSET to change link
1623 * settings; do not use %ETHTOOL_SLINKSETTINGS if
1624 * %ETHTOOL_GLINKSETTINGS failed: stick to
1625 * %ETHTOOL_GSET/%ETHTOOL_SSET in that case.
1626 *
1627 * @cmd: Command number = %ETHTOOL_GLINKSETTINGS or %ETHTOOL_SLINKSETTINGS
1628 * @speed: Link speed (Mbps)
1629 * @duplex: Duplex mode; one of %DUPLEX_*
1630 * @port: Physical connector type; one of %PORT_*
1631 * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
1632 * applicable. For clause 45 PHYs this is the PRTAD.
1633 * @autoneg: Enable/disable autonegotiation and auto-detection;
1634 * either %AUTONEG_DISABLE or %AUTONEG_ENABLE
1635 * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
1636 * protocols supported by the interface; 0 if unknown.
1637 * Read-only.
1638 * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
1639 * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
1640 * value will be %ETH_TP_MDI_INVALID. Read-only.
1641 * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
1642 * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads
1643 * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
1644 * When written successfully, the link should be renegotiated if
1645 * necessary.
1646 * @link_mode_masks_nwords: Number of 32-bit words for each of the
1647 * supported, advertising, lp_advertising link mode bitmaps. For
1648 * %ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user
1649 * (>= 0); on return, if handshake in progress, negative if
1650 * request size unsupported by kernel: absolute value indicates
1651 * kernel recommended size and cmd field is 0, as well as all the
1652 * other fields; otherwise (handshake completed), strictly
1653 * positive to indicate size used by kernel and cmd field is
1654 * %ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For
1655 * %ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive
1656 * value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise
1657 * refused. For drivers: ignore this field (use kernel's
1658 * __ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will
1659 * be overwritten by kernel.
1660 * @supported: Bitmap with each bit meaning given by
1661 * %ethtool_link_mode_bit_indices for the link modes, physical
1662 * connectors and other link features for which the interface
1663 * supports autonegotiation or auto-detection. Read-only.
1664 * @advertising: Bitmap with each bit meaning given by
1665 * %ethtool_link_mode_bit_indices for the link modes, physical
1666 * connectors and other link features that are advertised through
1667 * autonegotiation or enabled for auto-detection.
1668 * @lp_advertising: Bitmap with each bit meaning given by
1669 * %ethtool_link_mode_bit_indices for the link modes, and other
1670 * link features that the link partner advertised through
1671 * autonegotiation; 0 if unknown or not applicable. Read-only.
1672 *
1673 * If autonegotiation is disabled, the speed and @duplex represent the
1674 * fixed link mode and are writable if the driver supports multiple
1675 * link modes. If it is enabled then they are read-only; if the link
1676 * is up they represent the negotiated link mode; if the link is down,
1677 * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
1678 * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
1679 *
1680 * Some hardware interfaces may have multiple PHYs and/or physical
1681 * connectors fitted or do not allow the driver to detect which are
1682 * fitted. For these interfaces @port and/or @phy_address may be
1683 * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
1684 * Otherwise, attempts to write different values may be ignored or
1685 * rejected.
1686 *
1687 * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt
1688 * are not available in %ethtool_link_settings. Until all drivers are
1689 * converted to ignore them or to the new %ethtool_link_settings API,
1690 * for both queries and changes, users should always try
1691 * %ETHTOOL_GLINKSETTINGS first, and if it fails with -ENOTSUPP stick
1692 * only to %ETHTOOL_GSET and %ETHTOOL_SSET consistently. If it
1693 * succeeds, then users should stick to %ETHTOOL_GLINKSETTINGS and
1694 * %ETHTOOL_SLINKSETTINGS (which would support drivers implementing
1695 * either %ethtool_cmd or %ethtool_link_settings).
1696 *
1697 * Users should assume that all fields not marked read-only are
1698 * writable and subject to validation by the driver. They should use
1699 * %ETHTOOL_GLINKSETTINGS to get the current values before making specific
1700 * changes and then applying them with %ETHTOOL_SLINKSETTINGS.
1701 *
1702 * Drivers that implement %get_link_ksettings and/or
1703 * %set_link_ksettings should ignore the @cmd
1704 * and @link_mode_masks_nwords fields (any change to them overwritten
1705 * by kernel), and rely only on kernel's internal
1706 * %__ETHTOOL_LINK_MODE_MASK_NBITS and
1707 * %ethtool_link_mode_mask_t. Drivers that implement
1708 * %set_link_ksettings() should validate all fields other than @cmd
1709 * and @link_mode_masks_nwords that are not described as read-only or
1710 * deprecated, and must ignore all fields described as read-only.
1711 */
1712struct ethtool_link_settings {
1713 __u32 cmd;
1714 __u32 speed;
1715 __u8 duplex;
1716 __u8 port;
1717 __u8 phy_address;
1718 __u8 autoneg;
1719 __u8 mdio_support;
1720 __u8 eth_tp_mdix;
1721 __u8 eth_tp_mdix_ctrl;
1722 __s8 link_mode_masks_nwords;
1723 __u32 reserved[8];
1724 __u32 link_mode_masks[0];
1725 /* layout of link_mode_masks fields:
1726 * __u32 map_supported[link_mode_masks_nwords];
1727 * __u32 map_advertising[link_mode_masks_nwords];
1728 * __u32 map_lp_advertising[link_mode_masks_nwords];
1729 */
1730};
1444#endif /* _UAPI_LINUX_ETHTOOL_H */ 1731#endif /* _UAPI_LINUX_ETHTOOL_H */
diff --git a/include/uapi/linux/genetlink.h b/include/uapi/linux/genetlink.h
index c3363ba1ae05..5512c90af7e3 100644
--- a/include/uapi/linux/genetlink.h
+++ b/include/uapi/linux/genetlink.h
@@ -21,6 +21,7 @@ struct genlmsghdr {
21#define GENL_CMD_CAP_DO 0x02 21#define GENL_CMD_CAP_DO 0x02
22#define GENL_CMD_CAP_DUMP 0x04 22#define GENL_CMD_CAP_DUMP 0x04
23#define GENL_CMD_CAP_HASPOL 0x08 23#define GENL_CMD_CAP_HASPOL 0x08
24#define GENL_UNS_ADMIN_PERM 0x10
24 25
25/* 26/*
26 * List of reserved static generic netlink identifiers: 27 * List of reserved static generic netlink identifiers:
diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index 9cf2394f0bcf..f80277569f24 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -37,7 +37,7 @@
37 * are shared for all types of net_devices. The sysfs entries are available 37 * are shared for all types of net_devices. The sysfs entries are available
38 * via /sys/class/net/<dev>/flags. Flags which can be toggled through sysfs 38 * via /sys/class/net/<dev>/flags. Flags which can be toggled through sysfs
39 * are annotated below, note that only a few flags can be toggled and some 39 * are annotated below, note that only a few flags can be toggled and some
40 * other flags are always always preserved from the original net_device flags 40 * other flags are always preserved from the original net_device flags
41 * even if you try to set them via sysfs. Flags which are always preserved 41 * even if you try to set them via sysfs. Flags which are always preserved
42 * are kept under the flag grouping @IFF_VOLATILE. Flags which are volatile 42 * are kept under the flag grouping @IFF_VOLATILE. Flags which are volatile
43 * are annotated below as such. 43 * are annotated below as such.
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
index 18db14477bdd..0536eefff9bf 100644
--- a/include/uapi/linux/if_bridge.h
+++ b/include/uapi/linux/if_bridge.h
@@ -137,11 +137,17 @@ struct bridge_vlan_info {
137/* Bridge multicast database attributes 137/* Bridge multicast database attributes
138 * [MDBA_MDB] = { 138 * [MDBA_MDB] = {
139 * [MDBA_MDB_ENTRY] = { 139 * [MDBA_MDB_ENTRY] = {
140 * [MDBA_MDB_ENTRY_INFO] 140 * [MDBA_MDB_ENTRY_INFO] {
141 * struct br_mdb_entry
142 * [MDBA_MDB_EATTR attributes]
143 * }
141 * } 144 * }
142 * } 145 * }
143 * [MDBA_ROUTER] = { 146 * [MDBA_ROUTER] = {
144 * [MDBA_ROUTER_PORT] 147 * [MDBA_ROUTER_PORT] = {
148 * u32 ifindex
149 * [MDBA_ROUTER_PATTR attributes]
150 * }
145 * } 151 * }
146 */ 152 */
147enum { 153enum {
@@ -166,6 +172,22 @@ enum {
166}; 172};
167#define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1) 173#define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1)
168 174
175/* per mdb entry additional attributes */
176enum {
177 MDBA_MDB_EATTR_UNSPEC,
178 MDBA_MDB_EATTR_TIMER,
179 __MDBA_MDB_EATTR_MAX
180};
181#define MDBA_MDB_EATTR_MAX (__MDBA_MDB_EATTR_MAX - 1)
182
183/* multicast router types */
184enum {
185 MDB_RTR_TYPE_DISABLED,
186 MDB_RTR_TYPE_TEMP_QUERY,
187 MDB_RTR_TYPE_PERM,
188 MDB_RTR_TYPE_TEMP
189};
190
169enum { 191enum {
170 MDBA_ROUTER_UNSPEC, 192 MDBA_ROUTER_UNSPEC,
171 MDBA_ROUTER_PORT, 193 MDBA_ROUTER_PORT,
@@ -173,6 +195,15 @@ enum {
173}; 195};
174#define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1) 196#define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1)
175 197
198/* router port attributes */
199enum {
200 MDBA_ROUTER_PATTR_UNSPEC,
201 MDBA_ROUTER_PATTR_TIMER,
202 MDBA_ROUTER_PATTR_TYPE,
203 __MDBA_ROUTER_PATTR_MAX
204};
205#define MDBA_ROUTER_PATTR_MAX (__MDBA_ROUTER_PATTR_MAX - 1)
206
176struct br_port_msg { 207struct br_port_msg {
177 __u8 family; 208 __u8 family;
178 __u32 ifindex; 209 __u32 ifindex;
@@ -183,6 +214,8 @@ struct br_mdb_entry {
183#define MDB_TEMPORARY 0 214#define MDB_TEMPORARY 0
184#define MDB_PERMANENT 1 215#define MDB_PERMANENT 1
185 __u8 state; 216 __u8 state;
217#define MDB_FLAGS_OFFLOAD (1 << 0)
218 __u8 flags;
186 __u16 vid; 219 __u16 vid;
187 struct { 220 struct {
188 union { 221 union {
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index ea9221b0331a..4a93051c578c 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -83,6 +83,7 @@
83#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */ 83#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */
84#define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */ 84#define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */
85#define ETH_P_TIPC 0x88CA /* TIPC */ 85#define ETH_P_TIPC 0x88CA /* TIPC */
86#define ETH_P_MACSEC 0x88E5 /* 802.1ae MACsec */
86#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */ 87#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
87#define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */ 88#define ETH_P_MVRP 0x88F5 /* 802.1Q MVRP */
88#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ 89#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index a30b78090594..8e3f88fa5b59 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -35,6 +35,8 @@ struct rtnl_link_stats {
35 /* for cslip etc */ 35 /* for cslip etc */
36 __u32 rx_compressed; 36 __u32 rx_compressed;
37 __u32 tx_compressed; 37 __u32 tx_compressed;
38
39 __u32 rx_nohandler; /* dropped, no handler found */
38}; 40};
39 41
40/* The main device statistics structure */ 42/* The main device statistics structure */
@@ -68,6 +70,8 @@ struct rtnl_link_stats64 {
68 /* for cslip etc */ 70 /* for cslip etc */
69 __u64 rx_compressed; 71 __u64 rx_compressed;
70 __u64 tx_compressed; 72 __u64 tx_compressed;
73
74 __u64 rx_nohandler; /* dropped, no handler found */
71}; 75};
72 76
73/* The struct should be in sync with struct ifmap */ 77/* The struct should be in sync with struct ifmap */
@@ -401,6 +405,43 @@ enum {
401 405
402#define IFLA_VRF_MAX (__IFLA_VRF_MAX - 1) 406#define IFLA_VRF_MAX (__IFLA_VRF_MAX - 1)
403 407
408enum {
409 IFLA_VRF_PORT_UNSPEC,
410 IFLA_VRF_PORT_TABLE,
411 __IFLA_VRF_PORT_MAX
412};
413
414#define IFLA_VRF_PORT_MAX (__IFLA_VRF_PORT_MAX - 1)
415
416/* MACSEC section */
417enum {
418 IFLA_MACSEC_UNSPEC,
419 IFLA_MACSEC_SCI,
420 IFLA_MACSEC_PORT,
421 IFLA_MACSEC_ICV_LEN,
422 IFLA_MACSEC_CIPHER_SUITE,
423 IFLA_MACSEC_WINDOW,
424 IFLA_MACSEC_ENCODING_SA,
425 IFLA_MACSEC_ENCRYPT,
426 IFLA_MACSEC_PROTECT,
427 IFLA_MACSEC_INC_SCI,
428 IFLA_MACSEC_ES,
429 IFLA_MACSEC_SCB,
430 IFLA_MACSEC_REPLAY_PROTECT,
431 IFLA_MACSEC_VALIDATION,
432 __IFLA_MACSEC_MAX,
433};
434
435#define IFLA_MACSEC_MAX (__IFLA_MACSEC_MAX - 1)
436
437enum macsec_validation_type {
438 MACSEC_VALIDATE_DISABLED = 0,
439 MACSEC_VALIDATE_CHECK = 1,
440 MACSEC_VALIDATE_STRICT = 2,
441 __MACSEC_VALIDATE_END,
442 MACSEC_VALIDATE_MAX = __MACSEC_VALIDATE_END - 1,
443};
444
404/* IPVLAN section */ 445/* IPVLAN section */
405enum { 446enum {
406 IFLA_IPVLAN_UNSPEC, 447 IFLA_IPVLAN_UNSPEC,
@@ -444,6 +485,7 @@ enum {
444 IFLA_VXLAN_GBP, 485 IFLA_VXLAN_GBP,
445 IFLA_VXLAN_REMCSUM_NOPARTIAL, 486 IFLA_VXLAN_REMCSUM_NOPARTIAL,
446 IFLA_VXLAN_COLLECT_METADATA, 487 IFLA_VXLAN_COLLECT_METADATA,
488 IFLA_VXLAN_LABEL,
447 __IFLA_VXLAN_MAX 489 __IFLA_VXLAN_MAX
448}; 490};
449#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) 491#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
@@ -466,6 +508,7 @@ enum {
466 IFLA_GENEVE_UDP_CSUM, 508 IFLA_GENEVE_UDP_CSUM,
467 IFLA_GENEVE_UDP_ZERO_CSUM6_TX, 509 IFLA_GENEVE_UDP_ZERO_CSUM6_TX,
468 IFLA_GENEVE_UDP_ZERO_CSUM6_RX, 510 IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
511 IFLA_GENEVE_LABEL,
469 __IFLA_GENEVE_MAX 512 __IFLA_GENEVE_MAX
470}; 513};
471#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1) 514#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1)
diff --git a/include/uapi/linux/if_macsec.h b/include/uapi/linux/if_macsec.h
new file mode 100644
index 000000000000..26b0d1e3e3e7
--- /dev/null
+++ b/include/uapi/linux/if_macsec.h
@@ -0,0 +1,161 @@
1/*
2 * include/uapi/linux/if_macsec.h - MACsec device
3 *
4 * Copyright (c) 2015 Sabrina Dubroca <sd@queasysnail.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef _UAPI_MACSEC_H
13#define _UAPI_MACSEC_H
14
15#include <linux/types.h>
16
17#define MACSEC_GENL_NAME "macsec"
18#define MACSEC_GENL_VERSION 1
19
20#define MACSEC_MAX_KEY_LEN 128
21
22#define DEFAULT_CIPHER_ID 0x0080020001000001ULL
23#define DEFAULT_CIPHER_ALT 0x0080C20001000001ULL
24
25#define MACSEC_MIN_ICV_LEN 8
26#define MACSEC_MAX_ICV_LEN 32
27
28enum macsec_attrs {
29 MACSEC_ATTR_UNSPEC,
30 MACSEC_ATTR_IFINDEX, /* u32, ifindex of the MACsec netdevice */
31 MACSEC_ATTR_RXSC_CONFIG, /* config, nested macsec_rxsc_attrs */
32 MACSEC_ATTR_SA_CONFIG, /* config, nested macsec_sa_attrs */
33 MACSEC_ATTR_SECY, /* dump, nested macsec_secy_attrs */
34 MACSEC_ATTR_TXSA_LIST, /* dump, nested, macsec_sa_attrs for each TXSA */
35 MACSEC_ATTR_RXSC_LIST, /* dump, nested, macsec_rxsc_attrs for each RXSC */
36 MACSEC_ATTR_TXSC_STATS, /* dump, nested, macsec_txsc_stats_attr */
37 MACSEC_ATTR_SECY_STATS, /* dump, nested, macsec_secy_stats_attr */
38 __MACSEC_ATTR_END,
39 NUM_MACSEC_ATTR = __MACSEC_ATTR_END,
40 MACSEC_ATTR_MAX = __MACSEC_ATTR_END - 1,
41};
42
43enum macsec_secy_attrs {
44 MACSEC_SECY_ATTR_UNSPEC,
45 MACSEC_SECY_ATTR_SCI,
46 MACSEC_SECY_ATTR_ENCODING_SA,
47 MACSEC_SECY_ATTR_WINDOW,
48 MACSEC_SECY_ATTR_CIPHER_SUITE,
49 MACSEC_SECY_ATTR_ICV_LEN,
50 MACSEC_SECY_ATTR_PROTECT,
51 MACSEC_SECY_ATTR_REPLAY,
52 MACSEC_SECY_ATTR_OPER,
53 MACSEC_SECY_ATTR_VALIDATE,
54 MACSEC_SECY_ATTR_ENCRYPT,
55 MACSEC_SECY_ATTR_INC_SCI,
56 MACSEC_SECY_ATTR_ES,
57 MACSEC_SECY_ATTR_SCB,
58 __MACSEC_SECY_ATTR_END,
59 NUM_MACSEC_SECY_ATTR = __MACSEC_SECY_ATTR_END,
60 MACSEC_SECY_ATTR_MAX = __MACSEC_SECY_ATTR_END - 1,
61};
62
63enum macsec_rxsc_attrs {
64 MACSEC_RXSC_ATTR_UNSPEC,
65 MACSEC_RXSC_ATTR_SCI, /* config/dump, u64 */
66 MACSEC_RXSC_ATTR_ACTIVE, /* config/dump, u8 0..1 */
67 MACSEC_RXSC_ATTR_SA_LIST, /* dump, nested */
68 MACSEC_RXSC_ATTR_STATS, /* dump, nested, macsec_rxsc_stats_attr */
69 __MACSEC_RXSC_ATTR_END,
70 NUM_MACSEC_RXSC_ATTR = __MACSEC_RXSC_ATTR_END,
71 MACSEC_RXSC_ATTR_MAX = __MACSEC_RXSC_ATTR_END - 1,
72};
73
74enum macsec_sa_attrs {
75 MACSEC_SA_ATTR_UNSPEC,
76 MACSEC_SA_ATTR_AN, /* config/dump, u8 0..3 */
77 MACSEC_SA_ATTR_ACTIVE, /* config/dump, u8 0..1 */
78 MACSEC_SA_ATTR_PN, /* config/dump, u32 */
79 MACSEC_SA_ATTR_KEY, /* config, data */
80 MACSEC_SA_ATTR_KEYID, /* config/dump, u64 */
81 MACSEC_SA_ATTR_STATS, /* dump, nested, macsec_sa_stats_attr */
82 __MACSEC_SA_ATTR_END,
83 NUM_MACSEC_SA_ATTR = __MACSEC_SA_ATTR_END,
84 MACSEC_SA_ATTR_MAX = __MACSEC_SA_ATTR_END - 1,
85};
86
87enum macsec_nl_commands {
88 MACSEC_CMD_GET_TXSC,
89 MACSEC_CMD_ADD_RXSC,
90 MACSEC_CMD_DEL_RXSC,
91 MACSEC_CMD_UPD_RXSC,
92 MACSEC_CMD_ADD_TXSA,
93 MACSEC_CMD_DEL_TXSA,
94 MACSEC_CMD_UPD_TXSA,
95 MACSEC_CMD_ADD_RXSA,
96 MACSEC_CMD_DEL_RXSA,
97 MACSEC_CMD_UPD_RXSA,
98};
99
100/* u64 per-RXSC stats */
101enum macsec_rxsc_stats_attr {
102 MACSEC_RXSC_STATS_ATTR_UNSPEC,
103 MACSEC_RXSC_STATS_ATTR_IN_OCTETS_VALIDATED,
104 MACSEC_RXSC_STATS_ATTR_IN_OCTETS_DECRYPTED,
105 MACSEC_RXSC_STATS_ATTR_IN_PKTS_UNCHECKED,
106 MACSEC_RXSC_STATS_ATTR_IN_PKTS_DELAYED,
107 MACSEC_RXSC_STATS_ATTR_IN_PKTS_OK,
108 MACSEC_RXSC_STATS_ATTR_IN_PKTS_INVALID,
109 MACSEC_RXSC_STATS_ATTR_IN_PKTS_LATE,
110 MACSEC_RXSC_STATS_ATTR_IN_PKTS_NOT_VALID,
111 MACSEC_RXSC_STATS_ATTR_IN_PKTS_NOT_USING_SA,
112 MACSEC_RXSC_STATS_ATTR_IN_PKTS_UNUSED_SA,
113 __MACSEC_RXSC_STATS_ATTR_END,
114 NUM_MACSEC_RXSC_STATS_ATTR = __MACSEC_RXSC_STATS_ATTR_END,
115 MACSEC_RXSC_STATS_ATTR_MAX = __MACSEC_RXSC_STATS_ATTR_END - 1,
116};
117
118/* u32 per-{RX,TX}SA stats */
119enum macsec_sa_stats_attr {
120 MACSEC_SA_STATS_ATTR_UNSPEC,
121 MACSEC_SA_STATS_ATTR_IN_PKTS_OK,
122 MACSEC_SA_STATS_ATTR_IN_PKTS_INVALID,
123 MACSEC_SA_STATS_ATTR_IN_PKTS_NOT_VALID,
124 MACSEC_SA_STATS_ATTR_IN_PKTS_NOT_USING_SA,
125 MACSEC_SA_STATS_ATTR_IN_PKTS_UNUSED_SA,
126 MACSEC_SA_STATS_ATTR_OUT_PKTS_PROTECTED,
127 MACSEC_SA_STATS_ATTR_OUT_PKTS_ENCRYPTED,
128 __MACSEC_SA_STATS_ATTR_END,
129 NUM_MACSEC_SA_STATS_ATTR = __MACSEC_SA_STATS_ATTR_END,
130 MACSEC_SA_STATS_ATTR_MAX = __MACSEC_SA_STATS_ATTR_END - 1,
131};
132
133/* u64 per-TXSC stats */
134enum macsec_txsc_stats_attr {
135 MACSEC_TXSC_STATS_ATTR_UNSPEC,
136 MACSEC_TXSC_STATS_ATTR_OUT_PKTS_PROTECTED,
137 MACSEC_TXSC_STATS_ATTR_OUT_PKTS_ENCRYPTED,
138 MACSEC_TXSC_STATS_ATTR_OUT_OCTETS_PROTECTED,
139 MACSEC_TXSC_STATS_ATTR_OUT_OCTETS_ENCRYPTED,
140 __MACSEC_TXSC_STATS_ATTR_END,
141 NUM_MACSEC_TXSC_STATS_ATTR = __MACSEC_TXSC_STATS_ATTR_END,
142 MACSEC_TXSC_STATS_ATTR_MAX = __MACSEC_TXSC_STATS_ATTR_END - 1,
143};
144
145/* u64 per-SecY stats */
146enum macsec_secy_stats_attr {
147 MACSEC_SECY_STATS_ATTR_UNSPEC,
148 MACSEC_SECY_STATS_ATTR_OUT_PKTS_UNTAGGED,
149 MACSEC_SECY_STATS_ATTR_IN_PKTS_UNTAGGED,
150 MACSEC_SECY_STATS_ATTR_OUT_PKTS_TOO_LONG,
151 MACSEC_SECY_STATS_ATTR_IN_PKTS_NO_TAG,
152 MACSEC_SECY_STATS_ATTR_IN_PKTS_BAD_TAG,
153 MACSEC_SECY_STATS_ATTR_IN_PKTS_UNKNOWN_SCI,
154 MACSEC_SECY_STATS_ATTR_IN_PKTS_NO_SCI,
155 MACSEC_SECY_STATS_ATTR_IN_PKTS_OVERRUN,
156 __MACSEC_SECY_STATS_ATTR_END,
157 NUM_MACSEC_SECY_STATS_ATTR = __MACSEC_SECY_STATS_ATTR_END,
158 MACSEC_SECY_STATS_ATTR_MAX = __MACSEC_SECY_STATS_ATTR_END - 1,
159};
160
161#endif /* _UAPI_MACSEC_H */
diff --git a/include/uapi/linux/ip.h b/include/uapi/linux/ip.h
index 08f894d2ddbd..f291569768dd 100644
--- a/include/uapi/linux/ip.h
+++ b/include/uapi/linux/ip.h
@@ -165,6 +165,8 @@ enum
165 IPV4_DEVCONF_IGMPV2_UNSOLICITED_REPORT_INTERVAL, 165 IPV4_DEVCONF_IGMPV2_UNSOLICITED_REPORT_INTERVAL,
166 IPV4_DEVCONF_IGMPV3_UNSOLICITED_REPORT_INTERVAL, 166 IPV4_DEVCONF_IGMPV3_UNSOLICITED_REPORT_INTERVAL,
167 IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN, 167 IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN,
168 IPV4_DEVCONF_DROP_UNICAST_IN_L2_MULTICAST,
169 IPV4_DEVCONF_DROP_GRATUITOUS_ARP,
168 __IPV4_DEVCONF_MAX 170 __IPV4_DEVCONF_MAX
169}; 171};
170 172
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
index 38b4fef20219..395876060f50 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -174,6 +174,9 @@ enum {
174 DEVCONF_USE_OIF_ADDRS_ONLY, 174 DEVCONF_USE_OIF_ADDRS_ONLY,
175 DEVCONF_ACCEPT_RA_MIN_HOP_LIMIT, 175 DEVCONF_ACCEPT_RA_MIN_HOP_LIMIT,
176 DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN, 176 DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN,
177 DEVCONF_DROP_UNICAST_IN_L2_MULTICAST,
178 DEVCONF_DROP_UNSOLICITED_NA,
179 DEVCONF_KEEP_ADDR_ON_DOWN,
177 DEVCONF_MAX 180 DEVCONF_MAX
178}; 181};
179 182
diff --git a/include/uapi/linux/kcm.h b/include/uapi/linux/kcm.h
new file mode 100644
index 000000000000..a5a530940b99
--- /dev/null
+++ b/include/uapi/linux/kcm.h
@@ -0,0 +1,40 @@
1/*
2 * Kernel Connection Multiplexor
3 *
4 * Copyright (c) 2016 Tom Herbert <tom@herbertland.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * User API to clone KCM sockets and attach transport socket to a KCM
11 * multiplexor.
12 */
13
14#ifndef KCM_KERNEL_H
15#define KCM_KERNEL_H
16
17struct kcm_attach {
18 int fd;
19 int bpf_fd;
20};
21
22struct kcm_unattach {
23 int fd;
24};
25
26struct kcm_clone {
27 int fd;
28};
29
30#define SIOCKCMATTACH (SIOCPROTOPRIVATE + 0)
31#define SIOCKCMUNATTACH (SIOCPROTOPRIVATE + 1)
32#define SIOCKCMCLONE (SIOCPROTOPRIVATE + 2)
33
34#define KCMPROTO_CONNECTED 0
35
36/* Socket options */
37#define KCM_RECV_DISABLE 1
38
39#endif
40
diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h
index 321e399457f5..466073f0ce46 100644
--- a/include/uapi/linux/kernel.h
+++ b/include/uapi/linux/kernel.h
@@ -9,5 +9,6 @@
9#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) 9#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
10#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) 10#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
11 11
12#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
12 13
13#endif /* _UAPI_LINUX_KERNEL_H */ 14#endif /* _UAPI_LINUX_KERNEL_H */
diff --git a/include/uapi/linux/mroute6.h b/include/uapi/linux/mroute6.h
index ce91215cf7e6..5062fb5751e1 100644
--- a/include/uapi/linux/mroute6.h
+++ b/include/uapi/linux/mroute6.h
@@ -1,6 +1,7 @@
1#ifndef _UAPI__LINUX_MROUTE6_H 1#ifndef _UAPI__LINUX_MROUTE6_H
2#define _UAPI__LINUX_MROUTE6_H 2#define _UAPI__LINUX_MROUTE6_H
3 3
4#include <linux/kernel.h>
4#include <linux/types.h> 5#include <linux/types.h>
5#include <linux/sockios.h> 6#include <linux/sockios.h>
6 7
@@ -46,14 +47,8 @@ typedef unsigned short mifi_t;
46typedef __u32 if_mask; 47typedef __u32 if_mask;
47#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */ 48#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */
48 49
49#if !defined(__KERNEL__)
50#if !defined(DIV_ROUND_UP)
51#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y))
52#endif
53#endif
54
55typedef struct if_set { 50typedef struct if_set {
56 if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)]; 51 if_mask ifs_bits[__KERNEL_DIV_ROUND_UP(IF_SETSIZE, NIFBITS)];
57} if_set; 52} if_set;
58 53
59#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS))) 54#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
diff --git a/include/uapi/linux/netconf.h b/include/uapi/linux/netconf.h
index 23cbd34e4ac7..45dfad509c4d 100644
--- a/include/uapi/linux/netconf.h
+++ b/include/uapi/linux/netconf.h
@@ -19,6 +19,7 @@ enum {
19 __NETCONFA_MAX 19 __NETCONFA_MAX
20}; 20};
21#define NETCONFA_MAX (__NETCONFA_MAX - 1) 21#define NETCONFA_MAX (__NETCONFA_MAX - 1)
22#define NETCONFA_ALL -1
22 23
23#define NETCONFA_IFINDEX_ALL -1 24#define NETCONFA_IFINDEX_ALL -1
24#define NETCONFA_IFINDEX_DEFAULT -2 25#define NETCONFA_IFINDEX_DEFAULT -2
diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/uapi/linux/netfilter/nf_conntrack_common.h
index 319f47128db8..6d074d14ee27 100644
--- a/include/uapi/linux/netfilter/nf_conntrack_common.h
+++ b/include/uapi/linux/netfilter/nf_conntrack_common.h
@@ -20,9 +20,15 @@ enum ip_conntrack_info {
20 20
21 IP_CT_ESTABLISHED_REPLY = IP_CT_ESTABLISHED + IP_CT_IS_REPLY, 21 IP_CT_ESTABLISHED_REPLY = IP_CT_ESTABLISHED + IP_CT_IS_REPLY,
22 IP_CT_RELATED_REPLY = IP_CT_RELATED + IP_CT_IS_REPLY, 22 IP_CT_RELATED_REPLY = IP_CT_RELATED + IP_CT_IS_REPLY,
23 IP_CT_NEW_REPLY = IP_CT_NEW + IP_CT_IS_REPLY, 23 /* No NEW in reply direction. */
24 /* Number of distinct IP_CT types (no NEW in reply dirn). */ 24
25 IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1 25 /* Number of distinct IP_CT types. */
26 IP_CT_NUMBER,
27
28 /* only for userspace compatibility */
29#ifndef __KERNEL__
30 IP_CT_NEW_REPLY = IP_CT_NUMBER,
31#endif
26}; 32};
27 33
28#define NF_CT_STATE_INVALID_BIT (1 << 0) 34#define NF_CT_STATE_INVALID_BIT (1 << 0)
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index be41ffc128b8..eeffde196f80 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -681,6 +681,7 @@ enum nft_exthdr_attributes {
681 * @NFT_META_IIFGROUP: packet input interface group 681 * @NFT_META_IIFGROUP: packet input interface group
682 * @NFT_META_OIFGROUP: packet output interface group 682 * @NFT_META_OIFGROUP: packet output interface group
683 * @NFT_META_CGROUP: socket control group (skb->sk->sk_classid) 683 * @NFT_META_CGROUP: socket control group (skb->sk->sk_classid)
684 * @NFT_META_PRANDOM: a 32bit pseudo-random number
684 */ 685 */
685enum nft_meta_keys { 686enum nft_meta_keys {
686 NFT_META_LEN, 687 NFT_META_LEN,
@@ -707,6 +708,7 @@ enum nft_meta_keys {
707 NFT_META_IIFGROUP, 708 NFT_META_IIFGROUP,
708 NFT_META_OIFGROUP, 709 NFT_META_OIFGROUP,
709 NFT_META_CGROUP, 710 NFT_META_CGROUP,
711 NFT_META_PRANDOM,
710}; 712};
711 713
712/** 714/**
@@ -949,10 +951,14 @@ enum nft_nat_attributes {
949 * enum nft_masq_attributes - nf_tables masquerade expression attributes 951 * enum nft_masq_attributes - nf_tables masquerade expression attributes
950 * 952 *
951 * @NFTA_MASQ_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32) 953 * @NFTA_MASQ_FLAGS: NAT flags (see NF_NAT_RANGE_* in linux/netfilter/nf_nat.h) (NLA_U32)
954 * @NFTA_MASQ_REG_PROTO_MIN: source register of proto range start (NLA_U32: nft_registers)
955 * @NFTA_MASQ_REG_PROTO_MAX: source register of proto range end (NLA_U32: nft_registers)
952 */ 956 */
953enum nft_masq_attributes { 957enum nft_masq_attributes {
954 NFTA_MASQ_UNSPEC, 958 NFTA_MASQ_UNSPEC,
955 NFTA_MASQ_FLAGS, 959 NFTA_MASQ_FLAGS,
960 NFTA_MASQ_REG_PROTO_MIN,
961 NFTA_MASQ_REG_PROTO_MAX,
956 __NFTA_MASQ_MAX 962 __NFTA_MASQ_MAX
957}; 963};
958#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1) 964#define NFTA_MASQ_MAX (__NFTA_MASQ_MAX - 1)
diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h
index f095155d8749..0dba4e4ed2be 100644
--- a/include/uapi/linux/netlink.h
+++ b/include/uapi/linux/netlink.h
@@ -107,8 +107,10 @@ struct nlmsgerr {
107#define NETLINK_PKTINFO 3 107#define NETLINK_PKTINFO 3
108#define NETLINK_BROADCAST_ERROR 4 108#define NETLINK_BROADCAST_ERROR 4
109#define NETLINK_NO_ENOBUFS 5 109#define NETLINK_NO_ENOBUFS 5
110#ifndef __KERNEL__
110#define NETLINK_RX_RING 6 111#define NETLINK_RX_RING 6
111#define NETLINK_TX_RING 7 112#define NETLINK_TX_RING 7
113#endif
112#define NETLINK_LISTEN_ALL_NSID 8 114#define NETLINK_LISTEN_ALL_NSID 8
113#define NETLINK_LIST_MEMBERSHIPS 9 115#define NETLINK_LIST_MEMBERSHIPS 9
114#define NETLINK_CAP_ACK 10 116#define NETLINK_CAP_ACK 10
@@ -134,6 +136,7 @@ struct nl_mmap_hdr {
134 __u32 nm_gid; 136 __u32 nm_gid;
135}; 137};
136 138
139#ifndef __KERNEL__
137enum nl_mmap_status { 140enum nl_mmap_status {
138 NL_MMAP_STATUS_UNUSED, 141 NL_MMAP_STATUS_UNUSED,
139 NL_MMAP_STATUS_RESERVED, 142 NL_MMAP_STATUS_RESERVED,
@@ -145,6 +148,7 @@ enum nl_mmap_status {
145#define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO 148#define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO
146#define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT) 149#define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT)
147#define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr)) 150#define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr))
151#endif
148 152
149#define NET_MAJOR 36 /* Major 36 is reserved for networking */ 153#define NET_MAJOR 36 /* Major 36 is reserved for networking */
150 154
diff --git a/include/uapi/linux/netlink_diag.h b/include/uapi/linux/netlink_diag.h
index f2159d30d1f5..d79399394b46 100644
--- a/include/uapi/linux/netlink_diag.h
+++ b/include/uapi/linux/netlink_diag.h
@@ -48,6 +48,8 @@ enum {
48 48
49#define NDIAG_SHOW_MEMINFO 0x00000001 /* show memory info of a socket */ 49#define NDIAG_SHOW_MEMINFO 0x00000001 /* show memory info of a socket */
50#define NDIAG_SHOW_GROUPS 0x00000002 /* show groups of a netlink socket */ 50#define NDIAG_SHOW_GROUPS 0x00000002 /* show groups of a netlink socket */
51#ifndef __KERNEL__
51#define NDIAG_SHOW_RING_CFG 0x00000004 /* show ring configuration */ 52#define NDIAG_SHOW_RING_CFG 0x00000004 /* show ring configuration */
53#endif
52 54
53#endif 55#endif
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 5b7b5ebe7ca8..5a30a7563633 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1727,6 +1727,8 @@ enum nl80211_commands {
1727 * underlying device supports these minimal RRM features: 1727 * underlying device supports these minimal RRM features:
1728 * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES, 1728 * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES,
1729 * %NL80211_FEATURE_QUIET, 1729 * %NL80211_FEATURE_QUIET,
1730 * Or, if global RRM is supported, see:
1731 * %NL80211_EXT_FEATURE_RRM
1730 * If this flag is used, driver must add the Power Capabilities IE to the 1732 * If this flag is used, driver must add the Power Capabilities IE to the
1731 * association request. In addition, it must also set the RRM capability 1733 * association request. In addition, it must also set the RRM capability
1732 * flag in the association request's Capability Info field. 1734 * flag in the association request's Capability Info field.
@@ -1789,6 +1791,10 @@ enum nl80211_commands {
1789 * thus it must not specify the number of iterations, only the interval 1791 * thus it must not specify the number of iterations, only the interval
1790 * between scans. The scan plans are executed sequentially. 1792 * between scans. The scan plans are executed sequentially.
1791 * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan. 1793 * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
1794 * @NL80211_ATTR_PBSS: flag attribute. If set it means operate
1795 * in a PBSS. Specified in %NL80211_CMD_CONNECT to request
1796 * connecting to a PCP, and in %NL80211_CMD_START_AP to start
1797 * a PCP instead of AP. Relevant for DMG networks only.
1792 * 1798 *
1793 * @NUM_NL80211_ATTR: total number of nl80211_attrs available 1799 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
1794 * @NL80211_ATTR_MAX: highest attribute number currently defined 1800 * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2164,6 +2170,8 @@ enum nl80211_attrs {
2164 NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS, 2170 NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
2165 NL80211_ATTR_SCHED_SCAN_PLANS, 2171 NL80211_ATTR_SCHED_SCAN_PLANS,
2166 2172
2173 NL80211_ATTR_PBSS,
2174
2167 /* add attributes here, update the policy in nl80211.c */ 2175 /* add attributes here, update the policy in nl80211.c */
2168 2176
2169 __NL80211_ATTR_AFTER_LAST, 2177 __NL80211_ATTR_AFTER_LAST,
@@ -4396,12 +4404,18 @@ enum nl80211_feature_flags {
4396/** 4404/**
4397 * enum nl80211_ext_feature_index - bit index of extended features. 4405 * enum nl80211_ext_feature_index - bit index of extended features.
4398 * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates. 4406 * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
4407 * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can
4408 * can request to use RRM (see %NL80211_ATTR_USE_RRM) with
4409 * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set
4410 * the ASSOC_REQ_USE_RRM flag in the association request even if
4411 * NL80211_FEATURE_QUIET is not advertized.
4399 * 4412 *
4400 * @NUM_NL80211_EXT_FEATURES: number of extended features. 4413 * @NUM_NL80211_EXT_FEATURES: number of extended features.
4401 * @MAX_NL80211_EXT_FEATURES: highest extended feature index. 4414 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
4402 */ 4415 */
4403enum nl80211_ext_feature_index { 4416enum nl80211_ext_feature_index {
4404 NL80211_EXT_FEATURE_VHT_IBSS, 4417 NL80211_EXT_FEATURE_VHT_IBSS,
4418 NL80211_EXT_FEATURE_RRM,
4405 4419
4406 /* add new features before the definition below */ 4420 /* add new features before the definition below */
4407 NUM_NL80211_EXT_FEATURES, 4421 NUM_NL80211_EXT_FEATURES,
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index a27222d5b413..616d04761730 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -454,6 +454,14 @@ struct ovs_key_ct_labels {
454#define OVS_CS_F_REPLY_DIR 0x08 /* Flow is in the reply direction. */ 454#define OVS_CS_F_REPLY_DIR 0x08 /* Flow is in the reply direction. */
455#define OVS_CS_F_INVALID 0x10 /* Could not track connection. */ 455#define OVS_CS_F_INVALID 0x10 /* Could not track connection. */
456#define OVS_CS_F_TRACKED 0x20 /* Conntrack has occurred. */ 456#define OVS_CS_F_TRACKED 0x20 /* Conntrack has occurred. */
457#define OVS_CS_F_SRC_NAT 0x40 /* Packet's source address/port was
458 * mangled by NAT.
459 */
460#define OVS_CS_F_DST_NAT 0x80 /* Packet's destination address/port
461 * was mangled by NAT.
462 */
463
464#define OVS_CS_F_NAT_MASK (OVS_CS_F_SRC_NAT | OVS_CS_F_DST_NAT)
457 465
458/** 466/**
459 * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. 467 * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.
@@ -632,6 +640,8 @@ struct ovs_action_hash {
632 * mask. For each bit set in the mask, the corresponding bit in the value is 640 * mask. For each bit set in the mask, the corresponding bit in the value is
633 * copied to the connection tracking label field in the connection. 641 * copied to the connection tracking label field in the connection.
634 * @OVS_CT_ATTR_HELPER: variable length string defining conntrack ALG. 642 * @OVS_CT_ATTR_HELPER: variable length string defining conntrack ALG.
643 * @OVS_CT_ATTR_NAT: Nested OVS_NAT_ATTR_* for performing L3 network address
644 * translation (NAT) on the packet.
635 */ 645 */
636enum ovs_ct_attr { 646enum ovs_ct_attr {
637 OVS_CT_ATTR_UNSPEC, 647 OVS_CT_ATTR_UNSPEC,
@@ -641,12 +651,51 @@ enum ovs_ct_attr {
641 OVS_CT_ATTR_LABELS, /* labels to associate with this connection. */ 651 OVS_CT_ATTR_LABELS, /* labels to associate with this connection. */
642 OVS_CT_ATTR_HELPER, /* netlink helper to assist detection of 652 OVS_CT_ATTR_HELPER, /* netlink helper to assist detection of
643 related connections. */ 653 related connections. */
654 OVS_CT_ATTR_NAT, /* Nested OVS_NAT_ATTR_* */
644 __OVS_CT_ATTR_MAX 655 __OVS_CT_ATTR_MAX
645}; 656};
646 657
647#define OVS_CT_ATTR_MAX (__OVS_CT_ATTR_MAX - 1) 658#define OVS_CT_ATTR_MAX (__OVS_CT_ATTR_MAX - 1)
648 659
649/** 660/**
661 * enum ovs_nat_attr - Attributes for %OVS_CT_ATTR_NAT.
662 *
663 * @OVS_NAT_ATTR_SRC: Flag for Source NAT (mangle source address/port).
664 * @OVS_NAT_ATTR_DST: Flag for Destination NAT (mangle destination
665 * address/port). Only one of (@OVS_NAT_ATTR_SRC, @OVS_NAT_ATTR_DST) may be
666 * specified. Effective only for packets for ct_state NEW connections.
667 * Packets of committed connections are mangled by the NAT action according to
668 * the committed NAT type regardless of the flags specified. As a corollary, a
669 * NAT action without a NAT type flag will only mangle packets of committed
670 * connections. The following NAT attributes only apply for NEW
671 * (non-committed) connections, and they may be included only when the CT
672 * action has the @OVS_CT_ATTR_COMMIT flag and either @OVS_NAT_ATTR_SRC or
673 * @OVS_NAT_ATTR_DST is also included.
674 * @OVS_NAT_ATTR_IP_MIN: struct in_addr or struct in6_addr
675 * @OVS_NAT_ATTR_IP_MAX: struct in_addr or struct in6_addr
676 * @OVS_NAT_ATTR_PROTO_MIN: u16 L4 protocol specific lower boundary (port)
677 * @OVS_NAT_ATTR_PROTO_MAX: u16 L4 protocol specific upper boundary (port)
678 * @OVS_NAT_ATTR_PERSISTENT: Flag for persistent IP mapping across reboots
679 * @OVS_NAT_ATTR_PROTO_HASH: Flag for pseudo random L4 port mapping (MD5)
680 * @OVS_NAT_ATTR_PROTO_RANDOM: Flag for fully randomized L4 port mapping
681 */
682enum ovs_nat_attr {
683 OVS_NAT_ATTR_UNSPEC,
684 OVS_NAT_ATTR_SRC,
685 OVS_NAT_ATTR_DST,
686 OVS_NAT_ATTR_IP_MIN,
687 OVS_NAT_ATTR_IP_MAX,
688 OVS_NAT_ATTR_PROTO_MIN,
689 OVS_NAT_ATTR_PROTO_MAX,
690 OVS_NAT_ATTR_PERSISTENT,
691 OVS_NAT_ATTR_PROTO_HASH,
692 OVS_NAT_ATTR_PROTO_RANDOM,
693 __OVS_NAT_ATTR_MAX,
694};
695
696#define OVS_NAT_ATTR_MAX (__OVS_NAT_ATTR_MAX - 1)
697
698/**
650 * enum ovs_action_attr - Action types. 699 * enum ovs_action_attr - Action types.
651 * 700 *
652 * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. 701 * @OVS_ACTION_ATTR_OUTPUT: Output packet to port.
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 439873775d49..c43c5f78b9c4 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -172,6 +172,7 @@ enum {
172 TCA_U32_INDEV, 172 TCA_U32_INDEV,
173 TCA_U32_PCNT, 173 TCA_U32_PCNT,
174 TCA_U32_MARK, 174 TCA_U32_MARK,
175 TCA_U32_FLAGS,
175 __TCA_U32_MAX 176 __TCA_U32_MAX
176}; 177};
177 178
@@ -416,6 +417,8 @@ enum {
416 TCA_FLOWER_KEY_TCP_DST, /* be16 */ 417 TCA_FLOWER_KEY_TCP_DST, /* be16 */
417 TCA_FLOWER_KEY_UDP_SRC, /* be16 */ 418 TCA_FLOWER_KEY_UDP_SRC, /* be16 */
418 TCA_FLOWER_KEY_UDP_DST, /* be16 */ 419 TCA_FLOWER_KEY_UDP_DST, /* be16 */
420
421 TCA_FLOWER_FLAGS,
419 __TCA_FLOWER_MAX, 422 __TCA_FLOWER_MAX,
420}; 423};
421 424
diff --git a/include/uapi/linux/rfkill.h b/include/uapi/linux/rfkill.h
index 058757f7a733..2e00dcebebd0 100644
--- a/include/uapi/linux/rfkill.h
+++ b/include/uapi/linux/rfkill.h
@@ -59,6 +59,8 @@ enum rfkill_type {
59 * @RFKILL_OP_DEL: a device was removed 59 * @RFKILL_OP_DEL: a device was removed
60 * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device 60 * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device
61 * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all) 61 * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all)
62 * into a state, also updating the default state used for devices that
63 * are hot-plugged later.
62 */ 64 */
63enum rfkill_operation { 65enum rfkill_operation {
64 RFKILL_OP_ADD = 0, 66 RFKILL_OP_ADD = 0,
diff --git a/include/uapi/linux/tc_act/tc_ife.h b/include/uapi/linux/tc_act/tc_ife.h
new file mode 100644
index 000000000000..d648ff66586f
--- /dev/null
+++ b/include/uapi/linux/tc_act/tc_ife.h
@@ -0,0 +1,38 @@
1#ifndef __UAPI_TC_IFE_H
2#define __UAPI_TC_IFE_H
3
4#include <linux/types.h>
5#include <linux/pkt_cls.h>
6
7#define TCA_ACT_IFE 25
8/* Flag bits for now just encoding/decoding; mutually exclusive */
9#define IFE_ENCODE 1
10#define IFE_DECODE 0
11
12struct tc_ife {
13 tc_gen;
14 __u16 flags;
15};
16
17/*XXX: We need to encode the total number of bytes consumed */
18enum {
19 TCA_IFE_UNSPEC,
20 TCA_IFE_PARMS,
21 TCA_IFE_TM,
22 TCA_IFE_DMAC,
23 TCA_IFE_SMAC,
24 TCA_IFE_TYPE,
25 TCA_IFE_METALST,
26 __TCA_IFE_MAX
27};
28#define TCA_IFE_MAX (__TCA_IFE_MAX - 1)
29
30#define IFE_META_SKBMARK 1
31#define IFE_META_HASHID 2
32#define IFE_META_PRIO 3
33#define IFE_META_QMAP 4
34/*Can be overridden at runtime by module option*/
35#define __IFE_META_MAX 5
36#define IFE_META_MAX (__IFE_META_MAX - 1)
37
38#endif
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index 65a77b071e22..53e8e3fe6b1b 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -196,6 +196,11 @@ struct tcp_info {
196 __u64 tcpi_bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived */ 196 __u64 tcpi_bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived */
197 __u32 tcpi_segs_out; /* RFC4898 tcpEStatsPerfSegsOut */ 197 __u32 tcpi_segs_out; /* RFC4898 tcpEStatsPerfSegsOut */
198 __u32 tcpi_segs_in; /* RFC4898 tcpEStatsPerfSegsIn */ 198 __u32 tcpi_segs_in; /* RFC4898 tcpEStatsPerfSegsIn */
199
200 __u32 tcpi_notsent_bytes;
201 __u32 tcpi_min_rtt;
202 __u32 tcpi_data_segs_in; /* RFC4898 tcpEStatsDataSegsIn */
203 __u32 tcpi_data_segs_out; /* RFC4898 tcpEStatsDataSegsOut */
199}; 204};
200 205
201/* for TCP_MD5SIG socket option */ 206/* for TCP_MD5SIG socket option */
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
index 252ffd4801ef..4f20dbc42910 100644
--- a/include/xen/interface/io/netif.h
+++ b/include/xen/interface/io/netif.h
@@ -1,16 +1,34 @@
1/****************************************************************************** 1/******************************************************************************
2 * netif.h 2 * xen_netif.h
3 * 3 *
4 * Unified network-device I/O interface for Xen guest OSes. 4 * Unified network-device I/O interface for Xen guest OSes.
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
6 * Copyright (c) 2003-2004, Keir Fraser 24 * Copyright (c) 2003-2004, Keir Fraser
7 */ 25 */
8 26
9#ifndef __XEN_PUBLIC_IO_NETIF_H__ 27#ifndef __XEN_PUBLIC_IO_XEN_NETIF_H__
10#define __XEN_PUBLIC_IO_NETIF_H__ 28#define __XEN_PUBLIC_IO_XEN_NETIF_H__
11 29
12#include <xen/interface/io/ring.h> 30#include "ring.h"
13#include <xen/interface/grant_table.h> 31#include "../grant_table.h"
14 32
15/* 33/*
16 * Older implementation of Xen network frontend / backend has an 34 * Older implementation of Xen network frontend / backend has an
@@ -38,10 +56,10 @@
38 * that it cannot safely queue packets (as it may not be kicked to send them). 56 * that it cannot safely queue packets (as it may not be kicked to send them).
39 */ 57 */
40 58
41 /* 59/*
42 * "feature-split-event-channels" is introduced to separate guest TX 60 * "feature-split-event-channels" is introduced to separate guest TX
43 * and RX notificaion. Backend either doesn't support this feature or 61 * and RX notification. Backend either doesn't support this feature or
44 * advertise it via xenstore as 0 (disabled) or 1 (enabled). 62 * advertises it via xenstore as 0 (disabled) or 1 (enabled).
45 * 63 *
46 * To make use of this feature, frontend should allocate two event 64 * To make use of this feature, frontend should allocate two event
47 * channels for TX and RX, advertise them to backend as 65 * channels for TX and RX, advertise them to backend as
@@ -118,151 +136,804 @@
118 */ 136 */
119 137
120/* 138/*
121 * This is the 'wire' format for packets: 139 * "feature-multicast-control" and "feature-dynamic-multicast-control"
122 * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags) 140 * advertise the capability to filter ethernet multicast packets in the
123 * [Request 2: xen_netif_extra_info] (only if request 1 has XEN_NETTXF_extra_info) 141 * backend. If the frontend wishes to take advantage of this feature then
124 * [Request 3: xen_netif_extra_info] (only if request 2 has XEN_NETIF_EXTRA_MORE) 142 * it may set "request-multicast-control". If the backend only advertises
125 * Request 4: xen_netif_tx_request -- XEN_NETTXF_more_data 143 * "feature-multicast-control" then "request-multicast-control" must be set
126 * Request 5: xen_netif_tx_request -- XEN_NETTXF_more_data 144 * before the frontend moves into the connected state. The backend will
145 * sample the value on this state transition and any subsequent change in
146 * value will have no effect. However, if the backend also advertises
147 * "feature-dynamic-multicast-control" then "request-multicast-control"
148 * may be set by the frontend at any time. In this case, the backend will
149 * watch the value and re-sample on watch events.
150 *
151 * If the sampled value of "request-multicast-control" is set then the
152 * backend transmit side should no longer flood multicast packets to the
153 * frontend, it should instead drop any multicast packet that does not
154 * match in a filter list.
155 * The list is amended by the frontend by sending dummy transmit requests
156 * containing XEN_NETIF_EXTRA_TYPE_MCAST_{ADD,DEL} extra-info fragments as
157 * specified below.
158 * Note that the filter list may be amended even if the sampled value of
159 * "request-multicast-control" is not set, however the filter should only
160 * be applied if it is set.
161 */
162
163/*
164 * Control ring
165 * ============
166 *
167 * Some features, such as hashing (detailed below), require a
168 * significant amount of out-of-band data to be passed from frontend to
169 * backend. Use of xenstore is not suitable for large quantities of data
170 * because of quota limitations and so a dedicated 'control ring' is used.
171 * The ability of the backend to use a control ring is advertised by
172 * setting:
173 *
174 * /local/domain/X/backend/<domid>/<vif>/feature-ctrl-ring = "1"
175 *
176 * The frontend provides a control ring to the backend by setting:
177 *
178 * /local/domain/<domid>/device/vif/<vif>/ctrl-ring-ref = <gref>
179 * /local/domain/<domid>/device/vif/<vif>/event-channel-ctrl = <port>
180 *
181 * where <gref> is the grant reference of the shared page used to
182 * implement the control ring and <port> is an event channel to be used
183 * as a mailbox interrupt. These keys must be set before the frontend
184 * moves into the connected state.
185 *
186 * The control ring uses a fixed request/response message size and is
187 * balanced (i.e. one request to one response), so operationally it is much
188 * the same as a transmit or receive ring.
189 * Note that there is no requirement that responses are issued in the same
190 * order as requests.
191 */
192
193/*
194 * Hash types
195 * ==========
196 *
197 * For the purposes of the definitions below, 'Packet[]' is an array of
198 * octets containing an IP packet without options, 'Array[X..Y]' means a
199 * sub-array of 'Array' containing bytes X thru Y inclusive, and '+' is
200 * used to indicate concatenation of arrays.
201 */
202
203/*
204 * A hash calculated over an IP version 4 header as follows:
205 *
206 * Buffer[0..8] = Packet[12..15] (source address) +
207 * Packet[16..19] (destination address)
208 *
209 * Result = Hash(Buffer, 8)
210 */
211#define _XEN_NETIF_CTRL_HASH_TYPE_IPV4 0
212#define XEN_NETIF_CTRL_HASH_TYPE_IPV4 \
213 (1 << _XEN_NETIF_CTRL_HASH_TYPE_IPV4)
214
215/*
216 * A hash calculated over an IP version 4 header and TCP header as
217 * follows:
218 *
219 * Buffer[0..12] = Packet[12..15] (source address) +
220 * Packet[16..19] (destination address) +
221 * Packet[20..21] (source port) +
222 * Packet[22..23] (destination port)
223 *
224 * Result = Hash(Buffer, 12)
225 */
226#define _XEN_NETIF_CTRL_HASH_TYPE_IPV4_TCP 1
227#define XEN_NETIF_CTRL_HASH_TYPE_IPV4_TCP \
228 (1 << _XEN_NETIF_CTRL_HASH_TYPE_IPV4_TCP)
229
230/*
231 * A hash calculated over an IP version 6 header as follows:
232 *
233 * Buffer[0..32] = Packet[8..23] (source address ) +
234 * Packet[24..39] (destination address)
235 *
236 * Result = Hash(Buffer, 32)
237 */
238#define _XEN_NETIF_CTRL_HASH_TYPE_IPV6 2
239#define XEN_NETIF_CTRL_HASH_TYPE_IPV6 \
240 (1 << _XEN_NETIF_CTRL_HASH_TYPE_IPV6)
241
242/*
243 * A hash calculated over an IP version 6 header and TCP header as
244 * follows:
245 *
246 * Buffer[0..36] = Packet[8..23] (source address) +
247 * Packet[24..39] (destination address) +
248 * Packet[40..41] (source port) +
249 * Packet[42..43] (destination port)
250 *
251 * Result = Hash(Buffer, 36)
252 */
253#define _XEN_NETIF_CTRL_HASH_TYPE_IPV6_TCP 3
254#define XEN_NETIF_CTRL_HASH_TYPE_IPV6_TCP \
255 (1 << _XEN_NETIF_CTRL_HASH_TYPE_IPV6_TCP)
256
257/*
258 * Hash algorithms
259 * ===============
260 */
261
262#define XEN_NETIF_CTRL_HASH_ALGORITHM_NONE 0
263
264/*
265 * Toeplitz hash:
266 */
267
268#define XEN_NETIF_CTRL_HASH_ALGORITHM_TOEPLITZ 1
269
270/*
271 * This algorithm uses a 'key' as well as the data buffer itself.
272 * (Buffer[] and Key[] are treated as shift-registers where the MSB of
273 * Buffer/Key[0] is considered 'left-most' and the LSB of Buffer/Key[N-1]
274 * is the 'right-most').
275 *
276 * Value = 0
277 * For number of bits in Buffer[]
278 * If (left-most bit of Buffer[] is 1)
279 * Value ^= left-most 32 bits of Key[]
280 * Key[] << 1
281 * Buffer[] << 1
282 *
283 * The code below is provided for convenience where an operating system
284 * does not already provide an implementation.
285 */
286#ifdef XEN_NETIF_DEFINE_TOEPLITZ
287static uint32_t xen_netif_toeplitz_hash(const uint8_t *key,
288 unsigned int keylen,
289 const uint8_t *buf, unsigned int buflen)
290{
291 unsigned int keyi, bufi;
292 uint64_t prefix = 0;
293 uint64_t hash = 0;
294
295 /* Pre-load prefix with the first 8 bytes of the key */
296 for (keyi = 0; keyi < 8; keyi++) {
297 prefix <<= 8;
298 prefix |= (keyi < keylen) ? key[keyi] : 0;
299 }
300
301 for (bufi = 0; bufi < buflen; bufi++) {
302 uint8_t byte = buf[bufi];
303 unsigned int bit;
304
305 for (bit = 0; bit < 8; bit++) {
306 if (byte & 0x80)
307 hash ^= prefix;
308 prefix <<= 1;
309 byte <<= 1;
310 }
311
312 /*
313 * 'prefix' has now been left-shifted by 8, so
314 * OR in the next byte.
315 */
316 prefix |= (keyi < keylen) ? key[keyi] : 0;
317 keyi++;
318 }
319
320 /* The valid part of the hash is in the upper 32 bits. */
321 return hash >> 32;
322}
323#endif /* XEN_NETIF_DEFINE_TOEPLITZ */
324
325/*
326 * Control requests (struct xen_netif_ctrl_request)
327 * ================================================
328 *
329 * All requests have the following format:
330 *
331 * 0 1 2 3 4 5 6 7 octet
332 * +-----+-----+-----+-----+-----+-----+-----+-----+
333 * | id | type | data[0] |
334 * +-----+-----+-----+-----+-----+-----+-----+-----+
335 * | data[1] | data[2] |
336 * +-----+-----+-----+-----+-----------------------+
337 *
338 * id: the request identifier, echoed in response.
339 * type: the type of request (see below)
340 * data[]: any data associated with the request (determined by type)
341 */
342
343struct xen_netif_ctrl_request {
344 uint16_t id;
345 uint16_t type;
346
347#define XEN_NETIF_CTRL_TYPE_INVALID 0
348#define XEN_NETIF_CTRL_TYPE_GET_HASH_FLAGS 1
349#define XEN_NETIF_CTRL_TYPE_SET_HASH_FLAGS 2
350#define XEN_NETIF_CTRL_TYPE_SET_HASH_KEY 3
351#define XEN_NETIF_CTRL_TYPE_GET_HASH_MAPPING_SIZE 4
352#define XEN_NETIF_CTRL_TYPE_SET_HASH_MAPPING_SIZE 5
353#define XEN_NETIF_CTRL_TYPE_SET_HASH_MAPPING 6
354#define XEN_NETIF_CTRL_TYPE_SET_HASH_ALGORITHM 7
355
356 uint32_t data[3];
357};
358
359/*
360 * Control responses (struct xen_netif_ctrl_response)
361 * ==================================================
362 *
363 * All responses have the following format:
364 *
365 * 0 1 2 3 4 5 6 7 octet
366 * +-----+-----+-----+-----+-----+-----+-----+-----+
367 * | id | type | status |
368 * +-----+-----+-----+-----+-----+-----+-----+-----+
369 * | data |
370 * +-----+-----+-----+-----+
371 *
372 * id: the corresponding request identifier
373 * type: the type of the corresponding request
374 * status: the status of request processing
375 * data: any data associated with the response (determined by type and
376 * status)
377 */
378
379struct xen_netif_ctrl_response {
380 uint16_t id;
381 uint16_t type;
382 uint32_t status;
383
384#define XEN_NETIF_CTRL_STATUS_SUCCESS 0
385#define XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED 1
386#define XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER 2
387#define XEN_NETIF_CTRL_STATUS_BUFFER_OVERFLOW 3
388
389 uint32_t data;
390};
391
392/*
393 * Control messages
394 * ================
395 *
396 * XEN_NETIF_CTRL_TYPE_SET_HASH_ALGORITHM
397 * --------------------------------------
398 *
399 * This is sent by the frontend to set the desired hash algorithm.
400 *
401 * Request:
402 *
403 * type = XEN_NETIF_CTRL_TYPE_SET_HASH_ALGORITHM
404 * data[0] = a XEN_NETIF_CTRL_HASH_ALGORITHM_* value
405 * data[1] = 0
406 * data[2] = 0
407 *
408 * Response:
409 *
410 * status = XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED - Operation not
411 * supported
412 * XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER - The algorithm is not
413 * supported
414 * XEN_NETIF_CTRL_STATUS_SUCCESS - Operation successful
415 *
416 * NOTE: Setting data[0] to XEN_NETIF_CTRL_HASH_ALGORITHM_NONE disables
417 * hashing and the backend is free to choose how it steers packets
418 * to queues (which is the default behaviour).
419 *
420 * XEN_NETIF_CTRL_TYPE_GET_HASH_FLAGS
421 * ----------------------------------
422 *
423 * This is sent by the frontend to query the types of hash supported by
424 * the backend.
425 *
426 * Request:
427 *
428 * type = XEN_NETIF_CTRL_TYPE_GET_HASH_FLAGS
429 * data[0] = 0
430 * data[1] = 0
431 * data[2] = 0
432 *
433 * Response:
434 *
435 * status = XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED - Operation not supported
436 * XEN_NETIF_CTRL_STATUS_SUCCESS - Operation successful
437 * data = supported hash types (if operation was successful)
438 *
439 * NOTE: A valid hash algorithm must be selected before this operation can
440 * succeed.
441 *
442 * XEN_NETIF_CTRL_TYPE_SET_HASH_FLAGS
443 * ----------------------------------
444 *
445 * This is sent by the frontend to set the types of hash that the backend
446 * should calculate. (See above for hash type definitions).
447 * Note that the 'maximal' type of hash should always be chosen. For
448 * example, if the frontend sets both IPV4 and IPV4_TCP hash types then
449 * the latter hash type should be calculated for any TCP packet and the
450 * former only calculated for non-TCP packets.
451 *
452 * Request:
453 *
454 * type = XEN_NETIF_CTRL_TYPE_SET_HASH_FLAGS
455 * data[0] = bitwise OR of XEN_NETIF_CTRL_HASH_TYPE_* values
456 * data[1] = 0
457 * data[2] = 0
458 *
459 * Response:
460 *
461 * status = XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED - Operation not
462 * supported
463 * XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER - One or more flag
464 * value is invalid or
465 * unsupported
466 * XEN_NETIF_CTRL_STATUS_SUCCESS - Operation successful
467 * data = 0
468 *
469 * NOTE: A valid hash algorithm must be selected before this operation can
470 * succeed.
471 * Also, setting data[0] to zero disables hashing and the backend
472 * is free to choose how it steers packets to queues.
473 *
474 * XEN_NETIF_CTRL_TYPE_SET_HASH_KEY
475 * --------------------------------
476 *
477 * This is sent by the frontend to set the key of the hash if the algorithm
478 * requires it. (See hash algorithms above).
479 *
480 * Request:
481 *
482 * type = XEN_NETIF_CTRL_TYPE_SET_HASH_KEY
483 * data[0] = grant reference of page containing the key (assumed to
484 * start at beginning of grant)
485 * data[1] = size of key in octets
486 * data[2] = 0
487 *
488 * Response:
489 *
490 * status = XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED - Operation not
491 * supported
492 * XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER - Key size is invalid
493 * XEN_NETIF_CTRL_STATUS_BUFFER_OVERFLOW - Key size is larger
494 * than the backend
495 * supports
496 * XEN_NETIF_CTRL_STATUS_SUCCESS - Operation successful
497 * data = 0
498 *
499 * NOTE: Any key octets not specified are assumed to be zero (the key
500 * is assumed to be empty by default) and specifying a new key
501 * invalidates any previous key, hence specifying a key size of
502 * zero will clear the key (which ensures that the calculated hash
503 * will always be zero).
504 * The maximum size of key is algorithm and backend specific, but
505 * is also limited by the single grant reference.
506 * The grant reference may be read-only and must remain valid until
507 * the response has been processed.
508 *
509 * XEN_NETIF_CTRL_TYPE_GET_HASH_MAPPING_SIZE
510 * -----------------------------------------
511 *
512 * This is sent by the frontend to query the maximum size of mapping
513 * table supported by the backend. The size is specified in terms of
514 * table entries.
515 *
516 * Request:
517 *
518 * type = XEN_NETIF_CTRL_TYPE_GET_HASH_MAPPING_SIZE
519 * data[0] = 0
520 * data[1] = 0
521 * data[2] = 0
522 *
523 * Response:
524 *
525 * status = XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED - Operation not supported
526 * XEN_NETIF_CTRL_STATUS_SUCCESS - Operation successful
527 * data = maximum number of entries allowed in the mapping table
528 * (if operation was successful) or zero if a mapping table is
529 * not supported (i.e. hash mapping is done only by modular
530 * arithmetic).
531 *
532 * XEN_NETIF_CTRL_TYPE_SET_HASH_MAPPING_SIZE
533 * -------------------------------------
534 *
535 * This is sent by the frontend to set the actual size of the mapping
536 * table to be used by the backend. The size is specified in terms of
537 * table entries.
538 * Any previous table is invalidated by this message and any new table
539 * is assumed to be zero filled.
540 *
541 * Request:
542 *
543 * type = XEN_NETIF_CTRL_TYPE_SET_HASH_MAPPING_SIZE
544 * data[0] = number of entries in mapping table
545 * data[1] = 0
546 * data[2] = 0
547 *
548 * Response:
549 *
550 * status = XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED - Operation not
551 * supported
552 * XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER - Table size is invalid
553 * XEN_NETIF_CTRL_STATUS_SUCCESS - Operation successful
554 * data = 0
555 *
556 * NOTE: Setting data[0] to 0 means that hash mapping should be done
557 * using modular arithmetic.
558 *
559 * XEN_NETIF_CTRL_TYPE_SET_HASH_MAPPING
560 * ------------------------------------
561 *
562 * This is sent by the frontend to set the content of the table mapping
563 * hash value to queue number. The backend should calculate the hash from
564 * the packet header, use it as an index into the table (modulo the size
565 * of the table) and then steer the packet to the queue number found at
566 * that index.
567 *
568 * Request:
569 *
570 * type = XEN_NETIF_CTRL_TYPE_SET_HASH_MAPPING
571 * data[0] = grant reference of page containing the mapping (sub-)table
572 * (assumed to start at beginning of grant)
573 * data[1] = size of (sub-)table in entries
574 * data[2] = offset, in entries, of sub-table within overall table
575 *
576 * Response:
577 *
578 * status = XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED - Operation not
579 * supported
580 * XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER - Table size or content
581 * is invalid
582 * XEN_NETIF_CTRL_STATUS_BUFFER_OVERFLOW - Table size is larger
583 * than the backend
584 * supports
585 * XEN_NETIF_CTRL_STATUS_SUCCESS - Operation successful
586 * data = 0
587 *
588 * NOTE: The overall table has the following format:
589 *
590 * 0 1 2 3 4 5 6 7 octet
591 * +-----+-----+-----+-----+-----+-----+-----+-----+
592 * | mapping[0] | mapping[1] |
593 * +-----+-----+-----+-----+-----+-----+-----+-----+
594 * | . |
595 * | . |
596 * | . |
597 * +-----+-----+-----+-----+-----+-----+-----+-----+
598 * | mapping[N-2] | mapping[N-1] |
599 * +-----+-----+-----+-----+-----+-----+-----+-----+
600 *
601 * where N is specified by a XEN_NETIF_CTRL_TYPE_SET_HASH_MAPPING_SIZE
602 * message and each mapping must specifies a queue between 0 and
603 * "multi-queue-num-queues" (see above).
604 * The backend may support a mapping table larger than can be
605 * mapped by a single grant reference. Thus sub-tables within a
606 * larger table can be individually set by sending multiple messages
607 * with differing offset values. Specifying a new sub-table does not
608 * invalidate any table data outside that range.
609 * The grant reference may be read-only and must remain valid until
610 * the response has been processed.
611 */
612
613DEFINE_RING_TYPES(xen_netif_ctrl,
614 struct xen_netif_ctrl_request,
615 struct xen_netif_ctrl_response);
616
617/*
618 * Guest transmit
619 * ==============
620 *
621 * This is the 'wire' format for transmit (frontend -> backend) packets:
622 *
623 * Fragment 1: xen_netif_tx_request_t - flags = XEN_NETTXF_*
624 * size = total packet size
625 * [Extra 1: xen_netif_extra_info_t] - (only if fragment 1 flags include
626 * XEN_NETTXF_extra_info)
627 * ...
628 * [Extra N: xen_netif_extra_info_t] - (only if extra N-1 flags include
629 * XEN_NETIF_EXTRA_MORE)
127 * ... 630 * ...
128 * Request N: xen_netif_tx_request -- 0 631 * Fragment N: xen_netif_tx_request_t - (only if fragment N-1 flags include
632 * XEN_NETTXF_more_data - flags on preceding
633 * extras are not relevant here)
634 * flags = 0
635 * size = fragment size
636 *
637 * NOTE:
638 *
639 * This format slightly is different from that used for receive
640 * (backend -> frontend) packets. Specifically, in a multi-fragment
641 * packet the actual size of fragment 1 can only be determined by
642 * subtracting the sizes of fragments 2..N from the total packet size.
643 *
644 * Ring slot size is 12 octets, however not all request/response
645 * structs use the full size.
646 *
647 * tx request data (xen_netif_tx_request_t)
648 * ------------------------------------
649 *
650 * 0 1 2 3 4 5 6 7 octet
651 * +-----+-----+-----+-----+-----+-----+-----+-----+
652 * | grant ref | offset | flags |
653 * +-----+-----+-----+-----+-----+-----+-----+-----+
654 * | id | size |
655 * +-----+-----+-----+-----+
656 *
657 * grant ref: Reference to buffer page.
658 * offset: Offset within buffer page.
659 * flags: XEN_NETTXF_*.
660 * id: request identifier, echoed in response.
661 * size: packet size in bytes.
662 *
663 * tx response (xen_netif_tx_response_t)
664 * ---------------------------------
665 *
666 * 0 1 2 3 4 5 6 7 octet
667 * +-----+-----+-----+-----+-----+-----+-----+-----+
668 * | id | status | unused |
669 * +-----+-----+-----+-----+-----+-----+-----+-----+
670 * | unused |
671 * +-----+-----+-----+-----+
672 *
673 * id: reflects id in transmit request
674 * status: XEN_NETIF_RSP_*
675 *
676 * Guest receive
677 * =============
678 *
679 * This is the 'wire' format for receive (backend -> frontend) packets:
680 *
681 * Fragment 1: xen_netif_rx_request_t - flags = XEN_NETRXF_*
682 * size = fragment size
683 * [Extra 1: xen_netif_extra_info_t] - (only if fragment 1 flags include
684 * XEN_NETRXF_extra_info)
685 * ...
686 * [Extra N: xen_netif_extra_info_t] - (only if extra N-1 flags include
687 * XEN_NETIF_EXTRA_MORE)
688 * ...
689 * Fragment N: xen_netif_rx_request_t - (only if fragment N-1 flags include
690 * XEN_NETRXF_more_data - flags on preceding
691 * extras are not relevant here)
692 * flags = 0
693 * size = fragment size
694 *
695 * NOTE:
696 *
697 * This format slightly is different from that used for transmit
698 * (frontend -> backend) packets. Specifically, in a multi-fragment
699 * packet the size of the packet can only be determined by summing the
700 * sizes of fragments 1..N.
701 *
702 * Ring slot size is 8 octets.
703 *
704 * rx request (xen_netif_rx_request_t)
705 * -------------------------------
706 *
707 * 0 1 2 3 4 5 6 7 octet
708 * +-----+-----+-----+-----+-----+-----+-----+-----+
709 * | id | pad | gref |
710 * +-----+-----+-----+-----+-----+-----+-----+-----+
711 *
712 * id: request identifier, echoed in response.
713 * gref: reference to incoming granted frame.
714 *
715 * rx response (xen_netif_rx_response_t)
716 * ---------------------------------
717 *
718 * 0 1 2 3 4 5 6 7 octet
719 * +-----+-----+-----+-----+-----+-----+-----+-----+
720 * | id | offset | flags | status |
721 * +-----+-----+-----+-----+-----+-----+-----+-----+
722 *
723 * id: reflects id in receive request
724 * offset: offset in page of start of received packet
725 * flags: XEN_NETRXF_*
726 * status: -ve: XEN_NETIF_RSP_*; +ve: Rx'ed pkt size.
727 *
728 * NOTE: Historically, to support GSO on the frontend receive side, Linux
729 * netfront does not make use of the rx response id (because, as
730 * described below, extra info structures overlay the id field).
731 * Instead it assumes that responses always appear in the same ring
732 * slot as their corresponding request. Thus, to maintain
733 * compatibility, backends must make sure this is the case.
734 *
735 * Extra Info
736 * ==========
737 *
738 * Can be present if initial request or response has NET{T,R}XF_extra_info,
739 * or previous extra request has XEN_NETIF_EXTRA_MORE.
740 *
741 * The struct therefore needs to fit into either a tx or rx slot and
742 * is therefore limited to 8 octets.
743 *
744 * NOTE: Because extra info data overlays the usual request/response
745 * structures, there is no id information in the opposite direction.
746 * So, if an extra info overlays an rx response the frontend can
747 * assume that it is in the same ring slot as the request that was
748 * consumed to make the slot available, and the backend must ensure
749 * this assumption is true.
750 *
751 * extra info (xen_netif_extra_info_t)
752 * -------------------------------
753 *
754 * General format:
755 *
756 * 0 1 2 3 4 5 6 7 octet
757 * +-----+-----+-----+-----+-----+-----+-----+-----+
758 * |type |flags| type specific data |
759 * +-----+-----+-----+-----+-----+-----+-----+-----+
760 * | padding for tx |
761 * +-----+-----+-----+-----+
762 *
763 * type: XEN_NETIF_EXTRA_TYPE_*
764 * flags: XEN_NETIF_EXTRA_FLAG_*
765 * padding for tx: present only in the tx case due to 8 octet limit
766 * from rx case. Not shown in type specific entries
767 * below.
768 *
769 * XEN_NETIF_EXTRA_TYPE_GSO:
770 *
771 * 0 1 2 3 4 5 6 7 octet
772 * +-----+-----+-----+-----+-----+-----+-----+-----+
773 * |type |flags| size |type | pad | features |
774 * +-----+-----+-----+-----+-----+-----+-----+-----+
775 *
776 * type: Must be XEN_NETIF_EXTRA_TYPE_GSO
777 * flags: XEN_NETIF_EXTRA_FLAG_*
778 * size: Maximum payload size of each segment. For example,
779 * for TCP this is just the path MSS.
780 * type: XEN_NETIF_GSO_TYPE_*: This determines the protocol of
781 * the packet and any extra features required to segment the
782 * packet properly.
783 * features: EN_XEN_NETIF_GSO_FEAT_*: This specifies any extra GSO
784 * features required to process this packet, such as ECN
785 * support for TCPv4.
786 *
787 * XEN_NETIF_EXTRA_TYPE_MCAST_{ADD,DEL}:
788 *
789 * 0 1 2 3 4 5 6 7 octet
790 * +-----+-----+-----+-----+-----+-----+-----+-----+
791 * |type |flags| addr |
792 * +-----+-----+-----+-----+-----+-----+-----+-----+
793 *
794 * type: Must be XEN_NETIF_EXTRA_TYPE_MCAST_{ADD,DEL}
795 * flags: XEN_NETIF_EXTRA_FLAG_*
796 * addr: address to add/remove
797 *
798 * XEN_NETIF_EXTRA_TYPE_HASH:
799 *
800 * A backend that supports teoplitz hashing is assumed to accept
801 * this type of extra info in transmit packets.
802 * A frontend that enables hashing is assumed to accept
803 * this type of extra info in receive packets.
804 *
805 * 0 1 2 3 4 5 6 7 octet
806 * +-----+-----+-----+-----+-----+-----+-----+-----+
807 * |type |flags|htype| alg |LSB ---- value ---- MSB|
808 * +-----+-----+-----+-----+-----+-----+-----+-----+
809 *
810 * type: Must be XEN_NETIF_EXTRA_TYPE_HASH
811 * flags: XEN_NETIF_EXTRA_FLAG_*
812 * htype: Hash type (one of _XEN_NETIF_CTRL_HASH_TYPE_* - see above)
813 * alg: The algorithm used to calculate the hash (one of
814 * XEN_NETIF_CTRL_HASH_TYPE_ALGORITHM_* - see above)
815 * value: Hash value
129 */ 816 */
130 817
131/* Protocol checksum field is blank in the packet (hardware offload)? */ 818/* Protocol checksum field is blank in the packet (hardware offload)? */
132#define _XEN_NETTXF_csum_blank (0) 819#define _XEN_NETTXF_csum_blank (0)
133#define XEN_NETTXF_csum_blank (1U<<_XEN_NETTXF_csum_blank) 820#define XEN_NETTXF_csum_blank (1U<<_XEN_NETTXF_csum_blank)
134 821
135/* Packet data has been validated against protocol checksum. */ 822/* Packet data has been validated against protocol checksum. */
136#define _XEN_NETTXF_data_validated (1) 823#define _XEN_NETTXF_data_validated (1)
137#define XEN_NETTXF_data_validated (1U<<_XEN_NETTXF_data_validated) 824#define XEN_NETTXF_data_validated (1U<<_XEN_NETTXF_data_validated)
138 825
139/* Packet continues in the next request descriptor. */ 826/* Packet continues in the next request descriptor. */
140#define _XEN_NETTXF_more_data (2) 827#define _XEN_NETTXF_more_data (2)
141#define XEN_NETTXF_more_data (1U<<_XEN_NETTXF_more_data) 828#define XEN_NETTXF_more_data (1U<<_XEN_NETTXF_more_data)
142 829
143/* Packet to be followed by extra descriptor(s). */ 830/* Packet to be followed by extra descriptor(s). */
144#define _XEN_NETTXF_extra_info (3) 831#define _XEN_NETTXF_extra_info (3)
145#define XEN_NETTXF_extra_info (1U<<_XEN_NETTXF_extra_info) 832#define XEN_NETTXF_extra_info (1U<<_XEN_NETTXF_extra_info)
146 833
147#define XEN_NETIF_MAX_TX_SIZE 0xFFFF 834#define XEN_NETIF_MAX_TX_SIZE 0xFFFF
148struct xen_netif_tx_request { 835struct xen_netif_tx_request {
149 grant_ref_t gref; /* Reference to buffer page */ 836 grant_ref_t gref;
150 uint16_t offset; /* Offset within buffer page */ 837 uint16_t offset;
151 uint16_t flags; /* XEN_NETTXF_* */ 838 uint16_t flags;
152 uint16_t id; /* Echoed in response message. */ 839 uint16_t id;
153 uint16_t size; /* Packet size in bytes. */ 840 uint16_t size;
154}; 841};
155 842
156/* Types of xen_netif_extra_info descriptors. */ 843/* Types of xen_netif_extra_info descriptors. */
157#define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */ 844#define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */
158#define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */ 845#define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */
159#define XEN_NETIF_EXTRA_TYPE_MCAST_ADD (2) /* u.mcast */ 846#define XEN_NETIF_EXTRA_TYPE_MCAST_ADD (2) /* u.mcast */
160#define XEN_NETIF_EXTRA_TYPE_MCAST_DEL (3) /* u.mcast */ 847#define XEN_NETIF_EXTRA_TYPE_MCAST_DEL (3) /* u.mcast */
161#define XEN_NETIF_EXTRA_TYPE_MAX (4) 848#define XEN_NETIF_EXTRA_TYPE_HASH (4) /* u.hash */
849#define XEN_NETIF_EXTRA_TYPE_MAX (5)
162 850
163/* xen_netif_extra_info flags. */ 851/* xen_netif_extra_info_t flags. */
164#define _XEN_NETIF_EXTRA_FLAG_MORE (0) 852#define _XEN_NETIF_EXTRA_FLAG_MORE (0)
165#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE) 853#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
166 854
167/* GSO types */ 855/* GSO types */
168#define XEN_NETIF_GSO_TYPE_NONE (0) 856#define XEN_NETIF_GSO_TYPE_NONE (0)
169#define XEN_NETIF_GSO_TYPE_TCPV4 (1) 857#define XEN_NETIF_GSO_TYPE_TCPV4 (1)
170#define XEN_NETIF_GSO_TYPE_TCPV6 (2) 858#define XEN_NETIF_GSO_TYPE_TCPV6 (2)
171 859
172/* 860/*
173 * This structure needs to fit within both netif_tx_request and 861 * This structure needs to fit within both xen_netif_tx_request_t and
174 * netif_rx_response for compatibility. 862 * xen_netif_rx_response_t for compatibility.
175 */ 863 */
176struct xen_netif_extra_info { 864struct xen_netif_extra_info {
177 uint8_t type; /* XEN_NETIF_EXTRA_TYPE_* */ 865 uint8_t type;
178 uint8_t flags; /* XEN_NETIF_EXTRA_FLAG_* */ 866 uint8_t flags;
179
180 union { 867 union {
181 struct { 868 struct {
182 /*
183 * Maximum payload size of each segment. For
184 * example, for TCP this is just the path MSS.
185 */
186 uint16_t size; 869 uint16_t size;
187 870 uint8_t type;
188 /*
189 * GSO type. This determines the protocol of
190 * the packet and any extra features required
191 * to segment the packet properly.
192 */
193 uint8_t type; /* XEN_NETIF_GSO_TYPE_* */
194
195 /* Future expansion. */
196 uint8_t pad; 871 uint8_t pad;
197 872 uint16_t features;
198 /*
199 * GSO features. This specifies any extra GSO
200 * features required to process this packet,
201 * such as ECN support for TCPv4.
202 */
203 uint16_t features; /* XEN_NETIF_GSO_FEAT_* */
204 } gso; 873 } gso;
205
206 struct { 874 struct {
207 uint8_t addr[6]; /* Address to add/remove. */ 875 uint8_t addr[6];
208 } mcast; 876 } mcast;
209 877 struct {
878 uint8_t type;
879 uint8_t algorithm;
880 uint8_t value[4];
881 } hash;
210 uint16_t pad[3]; 882 uint16_t pad[3];
211 } u; 883 } u;
212}; 884};
213 885
214struct xen_netif_tx_response { 886struct xen_netif_tx_response {
215 uint16_t id; 887 uint16_t id;
216 int16_t status; /* XEN_NETIF_RSP_* */ 888 int16_t status;
217}; 889};
218 890
219struct xen_netif_rx_request { 891struct xen_netif_rx_request {
220 uint16_t id; /* Echoed in response message. */ 892 uint16_t id; /* Echoed in response message. */
221 grant_ref_t gref; /* Reference to incoming granted frame */ 893 uint16_t pad;
894 grant_ref_t gref;
222}; 895};
223 896
224/* Packet data has been validated against protocol checksum. */ 897/* Packet data has been validated against protocol checksum. */
225#define _XEN_NETRXF_data_validated (0) 898#define _XEN_NETRXF_data_validated (0)
226#define XEN_NETRXF_data_validated (1U<<_XEN_NETRXF_data_validated) 899#define XEN_NETRXF_data_validated (1U<<_XEN_NETRXF_data_validated)
227 900
228/* Protocol checksum field is blank in the packet (hardware offload)? */ 901/* Protocol checksum field is blank in the packet (hardware offload)? */
229#define _XEN_NETRXF_csum_blank (1) 902#define _XEN_NETRXF_csum_blank (1)
230#define XEN_NETRXF_csum_blank (1U<<_XEN_NETRXF_csum_blank) 903#define XEN_NETRXF_csum_blank (1U<<_XEN_NETRXF_csum_blank)
231 904
232/* Packet continues in the next request descriptor. */ 905/* Packet continues in the next request descriptor. */
233#define _XEN_NETRXF_more_data (2) 906#define _XEN_NETRXF_more_data (2)
234#define XEN_NETRXF_more_data (1U<<_XEN_NETRXF_more_data) 907#define XEN_NETRXF_more_data (1U<<_XEN_NETRXF_more_data)
235 908
236/* Packet to be followed by extra descriptor(s). */ 909/* Packet to be followed by extra descriptor(s). */
237#define _XEN_NETRXF_extra_info (3) 910#define _XEN_NETRXF_extra_info (3)
238#define XEN_NETRXF_extra_info (1U<<_XEN_NETRXF_extra_info) 911#define XEN_NETRXF_extra_info (1U<<_XEN_NETRXF_extra_info)
239 912
240/* GSO Prefix descriptor. */ 913/* Packet has GSO prefix. Deprecated but included for compatibility */
241#define _XEN_NETRXF_gso_prefix (4) 914#define _XEN_NETRXF_gso_prefix (4)
242#define XEN_NETRXF_gso_prefix (1U<<_XEN_NETRXF_gso_prefix) 915#define XEN_NETRXF_gso_prefix (1U<<_XEN_NETRXF_gso_prefix)
243 916
244struct xen_netif_rx_response { 917struct xen_netif_rx_response {
245 uint16_t id; 918 uint16_t id;
246 uint16_t offset; /* Offset in page of start of received packet */ 919 uint16_t offset;
247 uint16_t flags; /* XEN_NETRXF_* */ 920 uint16_t flags;
248 int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */ 921 int16_t status;
249}; 922};
250 923
251/* 924/*
252 * Generate netif ring structures and types. 925 * Generate xen_netif ring structures and types.
253 */ 926 */
254 927
255DEFINE_RING_TYPES(xen_netif_tx, 928DEFINE_RING_TYPES(xen_netif_tx, struct xen_netif_tx_request,
256 struct xen_netif_tx_request,
257 struct xen_netif_tx_response); 929 struct xen_netif_tx_response);
258DEFINE_RING_TYPES(xen_netif_rx, 930DEFINE_RING_TYPES(xen_netif_rx, struct xen_netif_rx_request,
259 struct xen_netif_rx_request,
260 struct xen_netif_rx_response); 931 struct xen_netif_rx_response);
261 932
262#define XEN_NETIF_RSP_DROPPED -2 933#define XEN_NETIF_RSP_DROPPED -2
263#define XEN_NETIF_RSP_ERROR -1 934#define XEN_NETIF_RSP_ERROR -1
264#define XEN_NETIF_RSP_OKAY 0 935#define XEN_NETIF_RSP_OKAY 0
265/* No response: used for auxiliary requests (e.g., xen_netif_extra_info). */ 936/* No response: used for auxiliary requests (e.g., xen_netif_extra_info_t). */
266#define XEN_NETIF_RSP_NULL 1 937#define XEN_NETIF_RSP_NULL 1
267 938
268#endif 939#endif