summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-06 21:39:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-06 21:39:49 -0400
commit1c8c5a9d38f607c0b6fd12c91cbe1a4418762a21 (patch)
treedcc97181d4d187252e0cc8fdf29d9b365fa3ffd0 /include
parent285767604576148fc1be7fcd112e4a90eb0d6ad2 (diff)
parent7170e6045a6a8b33f4fa5753589dc77b16198e2d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: 1) Add Maglev hashing scheduler to IPVS, from Inju Song. 2) Lots of new TC subsystem tests from Roman Mashak. 3) Add TCP zero copy receive and fix delayed acks and autotuning with SO_RCVLOWAT, from Eric Dumazet. 4) Add XDP_REDIRECT support to mlx5 driver, from Jesper Dangaard Brouer. 5) Add ttl inherit support to vxlan, from Hangbin Liu. 6) Properly separate ipv6 routes into their logically independant components. fib6_info for the routing table, and fib6_nh for sets of nexthops, which thus can be shared. From David Ahern. 7) Add bpf_xdp_adjust_tail helper, which can be used to generate ICMP messages from XDP programs. From Nikita V. Shirokov. 8) Lots of long overdue cleanups to the r8169 driver, from Heiner Kallweit. 9) Add BTF ("BPF Type Format"), from Martin KaFai Lau. 10) Add traffic condition monitoring to iwlwifi, from Luca Coelho. 11) Plumb extack down into fib_rules, from Roopa Prabhu. 12) Add Flower classifier offload support to igb, from Vinicius Costa Gomes. 13) Add UDP GSO support, from Willem de Bruijn. 14) Add documentation for eBPF helpers, from Quentin Monnet. 15) Add TLS tx offload to mlx5, from Ilya Lesokhin. 16) Allow applications to be given the number of bytes available to read on a socket via a control message returned from recvmsg(), from Soheil Hassas Yeganeh. 17) Add x86_32 eBPF JIT compiler, from Wang YanQing. 18) Add AF_XDP sockets, with zerocopy support infrastructure as well. From Björn Töpel. 19) Remove indirect load support from all of the BPF JITs and handle these operations in the verifier by translating them into native BPF instead. From Daniel Borkmann. 20) Add GRO support to ipv6 gre tunnels, from Eran Ben Elisha. 21) Allow XDP programs to do lookups in the main kernel routing tables for forwarding. From David Ahern. 22) Allow drivers to store hardware state into an ELF section of kernel dump vmcore files, and use it in cxgb4. From Rahul Lakkireddy. 23) Various RACK and loss detection improvements in TCP, from Yuchung Cheng. 24) Add TCP SACK compression, from Eric Dumazet. 25) Add User Mode Helper support and basic bpfilter infrastructure, from Alexei Starovoitov. 26) Support ports and protocol values in RTM_GETROUTE, from Roopa Prabhu. 27) Support bulking in ->ndo_xdp_xmit() API, from Jesper Dangaard Brouer. 28) Add lots of forwarding selftests, from Petr Machata. 29) Add generic network device failover driver, from Sridhar Samudrala. * ra.kernel.org:/pub/scm/linux/kernel/git/davem/net-next: (1959 commits) strparser: Add __strp_unpause and use it in ktls. rxrpc: Fix terminal retransmission connection ID to include the channel net: hns3: Optimize PF CMDQ interrupt switching process net: hns3: Fix for VF mailbox receiving unknown message net: hns3: Fix for VF mailbox cannot receiving PF response bnx2x: use the right constant Revert "net: sched: cls: Fix offloading when ingress dev is vxlan" net: dsa: b53: Fix for brcm tag issue in Cygnus SoC enic: fix UDP rss bits netdev-FAQ: clarify DaveM's position for stable backports rtnetlink: validate attributes in do_setlink() mlxsw: Add extack messages for port_{un, }split failures netdevsim: Add extack error message for devlink reload devlink: Add extack to reload and port_{un, }split operations net: metrics: add proper netlink validation ipmr: fix error path when ipmr_new_table fails ip6mr: only set ip6mr_table from setsockopt when ip6mr_new_table succeeds net: hns3: remove unused hclgevf_cfg_func_mta_filter netfilter: provide udp*_lib_lookup for nf_tproxy qed*: Utilize FW 8.37.2.0 ...
Diffstat (limited to 'include')
-rw-r--r--include/dt-bindings/net/microchip-lan78xx.h21
-rw-r--r--include/linux/avf/virtchnl.h4
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/bpf-cgroup.h24
-rw-r--r--include/linux/bpf.h86
-rw-r--r--include/linux/bpf_lirc.h29
-rw-r--r--include/linux/bpf_trace.h1
-rw-r--r--include/linux/bpf_types.h12
-rw-r--r--include/linux/bpf_verifier.h13
-rw-r--r--include/linux/bpfilter.h15
-rw-r--r--include/linux/brcmphy.h4
-rw-r--r--include/linux/btf.h50
-rw-r--r--include/linux/crash_dump.h18
-rw-r--r--include/linux/ethtool.h5
-rw-r--r--include/linux/filter.h81
-rw-r--r--include/linux/fsl/ptp_qoriq.h141
-rw-r--r--include/linux/if_bridge.h29
-rw-r--r--include/linux/if_macvlan.h29
-rw-r--r--include/linux/if_tun.h4
-rw-r--r--include/linux/if_vlan.h4
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/kcore.h6
-rw-r--r--include/linux/mdio-bitbang.h2
-rw-r--r--include/linux/mdio-gpio.h9
-rw-r--r--include/linux/mdio.h1
-rw-r--r--include/linux/microchipphy.h3
-rw-r--r--include/linux/mlx4/device.h1
-rw-r--r--include/linux/mlx5/device.h11
-rw-r--r--include/linux/mlx5/driver.h18
-rw-r--r--include/linux/mlx5/fs.h6
-rw-r--r--include/linux/mlx5/mlx5_ifc.h84
-rw-r--r--include/linux/mlx5/mlx5_ifc_fpga.h93
-rw-r--r--include/linux/mmc/sdio_ids.h1
-rw-r--r--include/linux/mroute_base.h10
-rw-r--r--include/linux/net.h1
-rw-r--r--include/linux/net_dim.h69
-rw-r--r--include/linux/netdev_features.h6
-rw-r--r--include/linux/netdevice.h96
-rw-r--r--include/linux/netfilter.h34
-rw-r--r--include/linux/netfilter/nf_osf.h33
-rw-r--r--include/linux/netfilter/nfnetlink.h1
-rw-r--r--include/linux/netfilter_bridge/ebtables.h4
-rw-r--r--include/linux/perf_event.h5
-rw-r--r--include/linux/phy.h69
-rw-r--r--include/linux/phy/phy.h1
-rw-r--r--include/linux/platform_data/b53.h4
-rw-r--r--include/linux/platform_data/mdio-gpio.h33
-rw-r--r--include/linux/platform_data/mv88e6xxx.h18
-rw-r--r--include/linux/qed/common_hsi.h4
-rw-r--r--include/linux/qed/iscsi_common.h8
-rw-r--r--include/linux/qed/qed_eth_if.h5
-rw-r--r--include/linux/qed/qed_if.h284
-rw-r--r--include/linux/qed/qed_ll2_if.h10
-rw-r--r--include/linux/qed/qed_rdma_if.h16
-rw-r--r--include/linux/qed/roce_common.h1
-rw-r--r--include/linux/rhashtable.h38
-rw-r--r--include/linux/skb_array.h5
-rw-r--r--include/linux/skbuff.h28
-rw-r--r--include/linux/soc/ti/knav_dma.h12
-rw-r--r--include/linux/soc/ti/knav_qmss.h1
-rw-r--r--include/linux/socket.h5
-rw-r--r--include/linux/tcp.h5
-rw-r--r--include/linux/tnum.h4
-rw-r--r--include/linux/trace_events.h17
-rw-r--r--include/linux/u64_stats_sync.h14
-rw-r--r--include/linux/udp.h3
-rw-r--r--include/linux/umh.h12
-rw-r--r--include/net/addrconf.h43
-rw-r--r--include/net/ax88796.h14
-rw-r--r--include/net/bluetooth/hci_core.h2
-rw-r--r--include/net/bonding.h11
-rw-r--r--include/net/cfg80211.h131
-rw-r--r--include/net/dcbnl.h4
-rw-r--r--include/net/devlink.h39
-rw-r--r--include/net/dsa.h37
-rw-r--r--include/net/erspan.h28
-rw-r--r--include/net/failover.h36
-rw-r--r--include/net/fib_rules.h3
-rw-r--r--include/net/flow_dissector.h7
-rw-r--r--include/net/if_inet6.h6
-rw-r--r--include/net/inet_connection_sock.h24
-rw-r--r--include/net/inet_sock.h1
-rw-r--r--include/net/inet_timewait_sock.h2
-rw-r--r--include/net/ip.h9
-rw-r--r--include/net/ip6_fib.h211
-rw-r--r--include/net/ip6_route.h85
-rw-r--r--include/net/ip_fib.h2
-rw-r--r--include/net/ip_tunnels.h15
-rw-r--r--include/net/ip_vs.h11
-rw-r--r--include/net/ipv6.h11
-rw-r--r--include/net/mac80211.h18
-rw-r--r--include/net/neighbour.h19
-rw-r--r--include/net/net_failover.h40
-rw-r--r--include/net/netfilter/ipv4/nf_nat_masquerade.h2
-rw-r--r--include/net/netfilter/ipv6/nf_nat_masquerade.h2
-rw-r--r--include/net/netfilter/nf_conntrack_count.h11
-rw-r--r--include/net/netfilter/nf_flow_table.h24
-rw-r--r--include/net/netfilter/nf_nat.h6
-rw-r--r--include/net/netfilter/nf_nat_core.h11
-rw-r--r--include/net/netfilter/nf_nat_l3proto.h64
-rw-r--r--include/net/netfilter/nf_nat_l4proto.h8
-rw-r--r--include/net/netfilter/nf_nat_redirect.h2
-rw-r--r--include/net/netfilter/nf_socket.h17
-rw-r--r--include/net/netfilter/nf_tables.h88
-rw-r--r--include/net/netfilter/nf_tables_core.h11
-rw-r--r--include/net/netfilter/nf_tproxy.h113
-rw-r--r--include/net/netfilter/nfnetlink_log.h17
-rw-r--r--include/net/netfilter/nft_meta.h44
-rw-r--r--include/net/netns/ipv4.h2
-rw-r--r--include/net/netns/ipv6.h4
-rw-r--r--include/net/netns/nftables.h3
-rw-r--r--include/net/page_pool.h144
-rw-r--r--include/net/pkt_cls.h20
-rw-r--r--include/net/route.h1
-rw-r--r--include/net/rtnetlink.h4
-rw-r--r--include/net/sch_generic.h22
-rw-r--r--include/net/sctp/constants.h5
-rw-r--r--include/net/sctp/sctp.h52
-rw-r--r--include/net/sctp/sm.h4
-rw-r--r--include/net/sctp/structs.h6
-rw-r--r--include/net/seg6.h7
-rw-r--r--include/net/seg6_local.h32
-rw-r--r--include/net/sock.h25
-rw-r--r--include/net/strparser.h2
-rw-r--r--include/net/switchdev.h1
-rw-r--r--include/net/tcp.h30
-rw-r--r--include/net/tipc.h4
-rw-r--r--include/net/tls.h127
-rw-r--r--include/net/udp.h4
-rw-r--r--include/net/vxlan.h1
-rw-r--r--include/net/xdp.h99
-rw-r--r--include/net/xdp_sock.h99
-rw-r--r--include/trace/events/bpf.h355
-rw-r--r--include/trace/events/fib.h107
-rw-r--r--include/trace/events/fib6.h43
-rw-r--r--include/trace/events/rxrpc.h32
-rw-r--r--include/trace/events/tcp.h78
-rw-r--r--include/trace/events/xdp.h50
-rw-r--r--include/uapi/linux/bpf.h2220
-rw-r--r--include/uapi/linux/bpfilter.h21
-rw-r--r--include/uapi/linux/btf.h113
-rw-r--r--include/uapi/linux/cn_proc.h4
-rw-r--r--include/uapi/linux/dcbnl.h11
-rw-r--r--include/uapi/linux/devlink.h14
-rw-r--r--include/uapi/linux/elf.h1
-rw-r--r--include/uapi/linux/if_addr.h1
-rw-r--r--include/uapi/linux/if_link.h2
-rw-r--r--include/uapi/linux/if_xdp.h78
-rw-r--r--include/uapi/linux/netfilter/nf_nat.h12
-rw-r--r--include/uapi/linux/netfilter/nf_osf.h86
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h67
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_conntrack.h1
-rw-r--r--include/uapi/linux/netfilter/xt_osf.h106
-rw-r--r--include/uapi/linux/netfilter_bridge/ebtables.h6
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_srh.h43
-rw-r--r--include/uapi/linux/nl80211.h99
-rw-r--r--include/uapi/linux/openvswitch.h28
-rw-r--r--include/uapi/linux/pci_regs.h2
-rw-r--r--include/uapi/linux/pkt_cls.h1
-rw-r--r--include/uapi/linux/rtnetlink.h8
-rw-r--r--include/uapi/linux/seg6_local.h12
-rw-r--r--include/uapi/linux/snmp.h3
-rw-r--r--include/uapi/linux/tcp.h16
-rw-r--r--include/uapi/linux/tipc.h12
-rw-r--r--include/uapi/linux/tipc_config.h5
-rw-r--r--include/uapi/linux/tipc_netlink.h1
-rw-r--r--include/uapi/linux/udp.h1
-rw-r--r--include/uapi/linux/virtio_net.h3
-rw-r--r--include/uapi/linux/vmcore.h18
169 files changed, 5538 insertions, 1712 deletions
diff --git a/include/dt-bindings/net/microchip-lan78xx.h b/include/dt-bindings/net/microchip-lan78xx.h
new file mode 100644
index 000000000000..0742ff075307
--- /dev/null
+++ b/include/dt-bindings/net/microchip-lan78xx.h
@@ -0,0 +1,21 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _DT_BINDINGS_MICROCHIP_LAN78XX_H
3#define _DT_BINDINGS_MICROCHIP_LAN78XX_H
4
5/* LED modes for LAN7800/LAN7850 embedded PHY */
6
7#define LAN78XX_LINK_ACTIVITY 0
8#define LAN78XX_LINK_1000_ACTIVITY 1
9#define LAN78XX_LINK_100_ACTIVITY 2
10#define LAN78XX_LINK_10_ACTIVITY 3
11#define LAN78XX_LINK_100_1000_ACTIVITY 4
12#define LAN78XX_LINK_10_1000_ACTIVITY 5
13#define LAN78XX_LINK_10_100_ACTIVITY 6
14#define LAN78XX_DUPLEX_COLLISION 8
15#define LAN78XX_COLLISION 9
16#define LAN78XX_ACTIVITY 10
17#define LAN78XX_AUTONEG_FAULT 12
18#define LAN78XX_FORCE_LED_OFF 14
19#define LAN78XX_FORCE_LED_ON 15
20
21#endif
diff --git a/include/linux/avf/virtchnl.h b/include/linux/avf/virtchnl.h
index b0a7f315bfbe..212b3822d180 100644
--- a/include/linux/avf/virtchnl.h
+++ b/include/linux/avf/virtchnl.h
@@ -485,7 +485,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_key);
485struct virtchnl_rss_lut { 485struct virtchnl_rss_lut {
486 u16 vsi_id; 486 u16 vsi_id;
487 u16 lut_entries; 487 u16 lut_entries;
488 u8 lut[1]; /* RSS lookup table*/ 488 u8 lut[1]; /* RSS lookup table */
489}; 489};
490 490
491VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_lut); 491VIRTCHNL_CHECK_STRUCT_LEN(6, virtchnl_rss_lut);
@@ -819,7 +819,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
819 return VIRTCHNL_ERR_PARAM; 819 return VIRTCHNL_ERR_PARAM;
820 } 820 }
821 /* few more checks */ 821 /* few more checks */
822 if ((valid_len != msglen) || (err_msg_format)) 822 if (err_msg_format || valid_len != msglen)
823 return VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH; 823 return VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH;
824 824
825 return 0; 825 return 0;
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 4955e0863b83..c05f24fac4f6 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -150,5 +150,6 @@ extern int do_execveat(int, struct filename *,
150 const char __user * const __user *, 150 const char __user * const __user *,
151 const char __user * const __user *, 151 const char __user * const __user *,
152 int); 152 int);
153int do_execve_file(struct file *file, void *__argv, void *__envp);
153 154
154#endif /* _LINUX_BINFMTS_H */ 155#endif /* _LINUX_BINFMTS_H */
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index 30d15e64b993..975fb4cf1bb7 100644
--- a/include/linux/bpf-cgroup.h
+++ b/include/linux/bpf-cgroup.h
@@ -66,7 +66,8 @@ int __cgroup_bpf_run_filter_sk(struct sock *sk,
66 66
67int __cgroup_bpf_run_filter_sock_addr(struct sock *sk, 67int __cgroup_bpf_run_filter_sock_addr(struct sock *sk,
68 struct sockaddr *uaddr, 68 struct sockaddr *uaddr,
69 enum bpf_attach_type type); 69 enum bpf_attach_type type,
70 void *t_ctx);
70 71
71int __cgroup_bpf_run_filter_sock_ops(struct sock *sk, 72int __cgroup_bpf_run_filter_sock_ops(struct sock *sk,
72 struct bpf_sock_ops_kern *sock_ops, 73 struct bpf_sock_ops_kern *sock_ops,
@@ -120,16 +121,18 @@ int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor,
120({ \ 121({ \
121 int __ret = 0; \ 122 int __ret = 0; \
122 if (cgroup_bpf_enabled) \ 123 if (cgroup_bpf_enabled) \
123 __ret = __cgroup_bpf_run_filter_sock_addr(sk, uaddr, type); \ 124 __ret = __cgroup_bpf_run_filter_sock_addr(sk, uaddr, type, \
125 NULL); \
124 __ret; \ 126 __ret; \
125}) 127})
126 128
127#define BPF_CGROUP_RUN_SA_PROG_LOCK(sk, uaddr, type) \ 129#define BPF_CGROUP_RUN_SA_PROG_LOCK(sk, uaddr, type, t_ctx) \
128({ \ 130({ \
129 int __ret = 0; \ 131 int __ret = 0; \
130 if (cgroup_bpf_enabled) { \ 132 if (cgroup_bpf_enabled) { \
131 lock_sock(sk); \ 133 lock_sock(sk); \
132 __ret = __cgroup_bpf_run_filter_sock_addr(sk, uaddr, type); \ 134 __ret = __cgroup_bpf_run_filter_sock_addr(sk, uaddr, type, \
135 t_ctx); \
133 release_sock(sk); \ 136 release_sock(sk); \
134 } \ 137 } \
135 __ret; \ 138 __ret; \
@@ -151,10 +154,16 @@ int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor,
151 BPF_CGROUP_RUN_SA_PROG(sk, uaddr, BPF_CGROUP_INET6_CONNECT) 154 BPF_CGROUP_RUN_SA_PROG(sk, uaddr, BPF_CGROUP_INET6_CONNECT)
152 155
153#define BPF_CGROUP_RUN_PROG_INET4_CONNECT_LOCK(sk, uaddr) \ 156#define BPF_CGROUP_RUN_PROG_INET4_CONNECT_LOCK(sk, uaddr) \
154 BPF_CGROUP_RUN_SA_PROG_LOCK(sk, uaddr, BPF_CGROUP_INET4_CONNECT) 157 BPF_CGROUP_RUN_SA_PROG_LOCK(sk, uaddr, BPF_CGROUP_INET4_CONNECT, NULL)
155 158
156#define BPF_CGROUP_RUN_PROG_INET6_CONNECT_LOCK(sk, uaddr) \ 159#define BPF_CGROUP_RUN_PROG_INET6_CONNECT_LOCK(sk, uaddr) \
157 BPF_CGROUP_RUN_SA_PROG_LOCK(sk, uaddr, BPF_CGROUP_INET6_CONNECT) 160 BPF_CGROUP_RUN_SA_PROG_LOCK(sk, uaddr, BPF_CGROUP_INET6_CONNECT, NULL)
161
162#define BPF_CGROUP_RUN_PROG_UDP4_SENDMSG_LOCK(sk, uaddr, t_ctx) \
163 BPF_CGROUP_RUN_SA_PROG_LOCK(sk, uaddr, BPF_CGROUP_UDP4_SENDMSG, t_ctx)
164
165#define BPF_CGROUP_RUN_PROG_UDP6_SENDMSG_LOCK(sk, uaddr, t_ctx) \
166 BPF_CGROUP_RUN_SA_PROG_LOCK(sk, uaddr, BPF_CGROUP_UDP6_SENDMSG, t_ctx)
158 167
159#define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) \ 168#define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) \
160({ \ 169({ \
@@ -185,6 +194,7 @@ struct cgroup_bpf {};
185static inline void cgroup_bpf_put(struct cgroup *cgrp) {} 194static inline void cgroup_bpf_put(struct cgroup *cgrp) {}
186static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; } 195static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; }
187 196
197#define cgroup_bpf_enabled (0)
188#define BPF_CGROUP_PRE_CONNECT_ENABLED(sk) (0) 198#define BPF_CGROUP_PRE_CONNECT_ENABLED(sk) (0)
189#define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk,skb) ({ 0; }) 199#define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk,skb) ({ 0; })
190#define BPF_CGROUP_RUN_PROG_INET_EGRESS(sk,skb) ({ 0; }) 200#define BPF_CGROUP_RUN_PROG_INET_EGRESS(sk,skb) ({ 0; })
@@ -197,6 +207,8 @@ static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; }
197#define BPF_CGROUP_RUN_PROG_INET4_CONNECT_LOCK(sk, uaddr) ({ 0; }) 207#define BPF_CGROUP_RUN_PROG_INET4_CONNECT_LOCK(sk, uaddr) ({ 0; })
198#define BPF_CGROUP_RUN_PROG_INET6_CONNECT(sk, uaddr) ({ 0; }) 208#define BPF_CGROUP_RUN_PROG_INET6_CONNECT(sk, uaddr) ({ 0; })
199#define BPF_CGROUP_RUN_PROG_INET6_CONNECT_LOCK(sk, uaddr) ({ 0; }) 209#define BPF_CGROUP_RUN_PROG_INET6_CONNECT_LOCK(sk, uaddr) ({ 0; })
210#define BPF_CGROUP_RUN_PROG_UDP4_SENDMSG_LOCK(sk, uaddr, t_ctx) ({ 0; })
211#define BPF_CGROUP_RUN_PROG_UDP6_SENDMSG_LOCK(sk, uaddr, t_ctx) ({ 0; })
200#define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; }) 212#define BPF_CGROUP_RUN_PROG_SOCK_OPS(sock_ops) ({ 0; })
201#define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; }) 213#define BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type,major,minor,access) ({ 0; })
202 214
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 469b20e1dd7e..995c3b1e59bf 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -22,6 +22,8 @@ struct perf_event;
22struct bpf_prog; 22struct bpf_prog;
23struct bpf_map; 23struct bpf_map;
24struct sock; 24struct sock;
25struct seq_file;
26struct btf;
25 27
26/* map is generic key/value storage optionally accesible by eBPF programs */ 28/* map is generic key/value storage optionally accesible by eBPF programs */
27struct bpf_map_ops { 29struct bpf_map_ops {
@@ -44,10 +46,14 @@ struct bpf_map_ops {
44 void (*map_fd_put_ptr)(void *ptr); 46 void (*map_fd_put_ptr)(void *ptr);
45 u32 (*map_gen_lookup)(struct bpf_map *map, struct bpf_insn *insn_buf); 47 u32 (*map_gen_lookup)(struct bpf_map *map, struct bpf_insn *insn_buf);
46 u32 (*map_fd_sys_lookup_elem)(void *ptr); 48 u32 (*map_fd_sys_lookup_elem)(void *ptr);
49 void (*map_seq_show_elem)(struct bpf_map *map, void *key,
50 struct seq_file *m);
51 int (*map_check_btf)(const struct bpf_map *map, const struct btf *btf,
52 u32 key_type_id, u32 value_type_id);
47}; 53};
48 54
49struct bpf_map { 55struct bpf_map {
50 /* 1st cacheline with read-mostly members of which some 56 /* The first two cachelines with read-mostly members of which some
51 * are also accessed in fast-path (e.g. ops, max_entries). 57 * are also accessed in fast-path (e.g. ops, max_entries).
52 */ 58 */
53 const struct bpf_map_ops *ops ____cacheline_aligned; 59 const struct bpf_map_ops *ops ____cacheline_aligned;
@@ -63,10 +69,13 @@ struct bpf_map {
63 u32 pages; 69 u32 pages;
64 u32 id; 70 u32 id;
65 int numa_node; 71 int numa_node;
72 u32 btf_key_type_id;
73 u32 btf_value_type_id;
74 struct btf *btf;
66 bool unpriv_array; 75 bool unpriv_array;
67 /* 7 bytes hole */ 76 /* 55 bytes hole */
68 77
69 /* 2nd cacheline with misc members to avoid false sharing 78 /* The 3rd and 4th cacheline with misc members to avoid false sharing
70 * particularly with refcounting. 79 * particularly with refcounting.
71 */ 80 */
72 struct user_struct *user ____cacheline_aligned; 81 struct user_struct *user ____cacheline_aligned;
@@ -101,6 +110,16 @@ static inline struct bpf_offloaded_map *map_to_offmap(struct bpf_map *map)
101 return container_of(map, struct bpf_offloaded_map, map); 110 return container_of(map, struct bpf_offloaded_map, map);
102} 111}
103 112
113static inline bool bpf_map_offload_neutral(const struct bpf_map *map)
114{
115 return map->map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY;
116}
117
118static inline bool bpf_map_support_seq_show(const struct bpf_map *map)
119{
120 return map->ops->map_seq_show_elem && map->ops->map_check_btf;
121}
122
104extern const struct bpf_map_ops bpf_map_offload_ops; 123extern const struct bpf_map_ops bpf_map_offload_ops;
105 124
106/* function argument constraints */ 125/* function argument constraints */
@@ -221,6 +240,8 @@ struct bpf_verifier_ops {
221 struct bpf_insn_access_aux *info); 240 struct bpf_insn_access_aux *info);
222 int (*gen_prologue)(struct bpf_insn *insn, bool direct_write, 241 int (*gen_prologue)(struct bpf_insn *insn, bool direct_write,
223 const struct bpf_prog *prog); 242 const struct bpf_prog *prog);
243 int (*gen_ld_abs)(const struct bpf_insn *orig,
244 struct bpf_insn *insn_buf);
224 u32 (*convert_ctx_access)(enum bpf_access_type type, 245 u32 (*convert_ctx_access)(enum bpf_access_type type,
225 const struct bpf_insn *src, 246 const struct bpf_insn *src,
226 struct bpf_insn *dst, 247 struct bpf_insn *dst,
@@ -442,6 +463,8 @@ int bpf_fd_htab_map_update_elem(struct bpf_map *map, struct file *map_file,
442int bpf_fd_htab_map_lookup_elem(struct bpf_map *map, void *key, u32 *value); 463int bpf_fd_htab_map_lookup_elem(struct bpf_map *map, void *key, u32 *value);
443 464
444int bpf_get_file_flag(int flags); 465int bpf_get_file_flag(int flags);
466int bpf_check_uarg_tail_zero(void __user *uaddr, size_t expected_size,
467 size_t actual_size);
445 468
446/* memcpy that is used with 8-byte aligned pointers, power-of-8 size and 469/* memcpy that is used with 8-byte aligned pointers, power-of-8 size and
447 * forced to use 'long' read/writes to try to atomically copy long counters. 470 * forced to use 'long' read/writes to try to atomically copy long counters.
@@ -464,14 +487,17 @@ int bpf_check(struct bpf_prog **fp, union bpf_attr *attr);
464void bpf_patch_call_args(struct bpf_insn *insn, u32 stack_depth); 487void bpf_patch_call_args(struct bpf_insn *insn, u32 stack_depth);
465 488
466/* Map specifics */ 489/* Map specifics */
467struct net_device *__dev_map_lookup_elem(struct bpf_map *map, u32 key); 490struct xdp_buff;
491
492struct bpf_dtab_netdev *__dev_map_lookup_elem(struct bpf_map *map, u32 key);
468void __dev_map_insert_ctx(struct bpf_map *map, u32 index); 493void __dev_map_insert_ctx(struct bpf_map *map, u32 index);
469void __dev_map_flush(struct bpf_map *map); 494void __dev_map_flush(struct bpf_map *map);
495int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp,
496 struct net_device *dev_rx);
470 497
471struct bpf_cpu_map_entry *__cpu_map_lookup_elem(struct bpf_map *map, u32 key); 498struct bpf_cpu_map_entry *__cpu_map_lookup_elem(struct bpf_map *map, u32 key);
472void __cpu_map_insert_ctx(struct bpf_map *map, u32 index); 499void __cpu_map_insert_ctx(struct bpf_map *map, u32 index);
473void __cpu_map_flush(struct bpf_map *map); 500void __cpu_map_flush(struct bpf_map *map);
474struct xdp_buff;
475int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_buff *xdp, 501int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_buff *xdp,
476 struct net_device *dev_rx); 502 struct net_device *dev_rx);
477 503
@@ -550,6 +576,16 @@ static inline void __dev_map_flush(struct bpf_map *map)
550{ 576{
551} 577}
552 578
579struct xdp_buff;
580struct bpf_dtab_netdev;
581
582static inline
583int dev_map_enqueue(struct bpf_dtab_netdev *dst, struct xdp_buff *xdp,
584 struct net_device *dev_rx)
585{
586 return 0;
587}
588
553static inline 589static inline
554struct bpf_cpu_map_entry *__cpu_map_lookup_elem(struct bpf_map *map, u32 key) 590struct bpf_cpu_map_entry *__cpu_map_lookup_elem(struct bpf_map *map, u32 key)
555{ 591{
@@ -564,7 +600,6 @@ static inline void __cpu_map_flush(struct bpf_map *map)
564{ 600{
565} 601}
566 602
567struct xdp_buff;
568static inline int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu, 603static inline int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu,
569 struct xdp_buff *xdp, 604 struct xdp_buff *xdp,
570 struct net_device *dev_rx) 605 struct net_device *dev_rx)
@@ -606,7 +641,7 @@ bool bpf_offload_dev_match(struct bpf_prog *prog, struct bpf_map *map);
606#if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL) 641#if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL)
607int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr); 642int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr);
608 643
609static inline bool bpf_prog_is_dev_bound(struct bpf_prog_aux *aux) 644static inline bool bpf_prog_is_dev_bound(const struct bpf_prog_aux *aux)
610{ 645{
611 return aux->offload_requested; 646 return aux->offload_requested;
612} 647}
@@ -647,6 +682,7 @@ static inline void bpf_map_offload_map_free(struct bpf_map *map)
647 682
648#if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_INET) 683#if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_INET)
649struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key); 684struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key);
685struct sock *__sock_hash_lookup_elem(struct bpf_map *map, void *key);
650int sock_map_prog(struct bpf_map *map, struct bpf_prog *prog, u32 type); 686int sock_map_prog(struct bpf_map *map, struct bpf_prog *prog, u32 type);
651#else 687#else
652static inline struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key) 688static inline struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key)
@@ -654,6 +690,12 @@ static inline struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key)
654 return NULL; 690 return NULL;
655} 691}
656 692
693static inline struct sock *__sock_hash_lookup_elem(struct bpf_map *map,
694 void *key)
695{
696 return NULL;
697}
698
657static inline int sock_map_prog(struct bpf_map *map, 699static inline int sock_map_prog(struct bpf_map *map,
658 struct bpf_prog *prog, 700 struct bpf_prog *prog,
659 u32 type) 701 u32 type)
@@ -662,6 +704,31 @@ static inline int sock_map_prog(struct bpf_map *map,
662} 704}
663#endif 705#endif
664 706
707#if defined(CONFIG_XDP_SOCKETS)
708struct xdp_sock;
709struct xdp_sock *__xsk_map_lookup_elem(struct bpf_map *map, u32 key);
710int __xsk_map_redirect(struct bpf_map *map, struct xdp_buff *xdp,
711 struct xdp_sock *xs);
712void __xsk_map_flush(struct bpf_map *map);
713#else
714struct xdp_sock;
715static inline struct xdp_sock *__xsk_map_lookup_elem(struct bpf_map *map,
716 u32 key)
717{
718 return NULL;
719}
720
721static inline int __xsk_map_redirect(struct bpf_map *map, struct xdp_buff *xdp,
722 struct xdp_sock *xs)
723{
724 return -EOPNOTSUPP;
725}
726
727static inline void __xsk_map_flush(struct bpf_map *map)
728{
729}
730#endif
731
665/* verifier prototypes for helper functions called from eBPF programs */ 732/* verifier prototypes for helper functions called from eBPF programs */
666extern const struct bpf_func_proto bpf_map_lookup_elem_proto; 733extern const struct bpf_func_proto bpf_map_lookup_elem_proto;
667extern const struct bpf_func_proto bpf_map_update_elem_proto; 734extern const struct bpf_func_proto bpf_map_update_elem_proto;
@@ -675,10 +742,11 @@ extern const struct bpf_func_proto bpf_ktime_get_ns_proto;
675extern const struct bpf_func_proto bpf_get_current_pid_tgid_proto; 742extern const struct bpf_func_proto bpf_get_current_pid_tgid_proto;
676extern const struct bpf_func_proto bpf_get_current_uid_gid_proto; 743extern const struct bpf_func_proto bpf_get_current_uid_gid_proto;
677extern const struct bpf_func_proto bpf_get_current_comm_proto; 744extern const struct bpf_func_proto bpf_get_current_comm_proto;
678extern const struct bpf_func_proto bpf_skb_vlan_push_proto;
679extern const struct bpf_func_proto bpf_skb_vlan_pop_proto;
680extern const struct bpf_func_proto bpf_get_stackid_proto; 745extern const struct bpf_func_proto bpf_get_stackid_proto;
746extern const struct bpf_func_proto bpf_get_stack_proto;
681extern const struct bpf_func_proto bpf_sock_map_update_proto; 747extern const struct bpf_func_proto bpf_sock_map_update_proto;
748extern const struct bpf_func_proto bpf_sock_hash_update_proto;
749extern const struct bpf_func_proto bpf_get_current_cgroup_id_proto;
682 750
683/* Shared helpers among cBPF and eBPF. */ 751/* Shared helpers among cBPF and eBPF. */
684void bpf_user_rnd_init_once(void); 752void bpf_user_rnd_init_once(void);
diff --git a/include/linux/bpf_lirc.h b/include/linux/bpf_lirc.h
new file mode 100644
index 000000000000..5f8a4283092d
--- /dev/null
+++ b/include/linux/bpf_lirc.h
@@ -0,0 +1,29 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _BPF_LIRC_H
3#define _BPF_LIRC_H
4
5#include <uapi/linux/bpf.h>
6
7#ifdef CONFIG_BPF_LIRC_MODE2
8int lirc_prog_attach(const union bpf_attr *attr);
9int lirc_prog_detach(const union bpf_attr *attr);
10int lirc_prog_query(const union bpf_attr *attr, union bpf_attr __user *uattr);
11#else
12static inline int lirc_prog_attach(const union bpf_attr *attr)
13{
14 return -EINVAL;
15}
16
17static inline int lirc_prog_detach(const union bpf_attr *attr)
18{
19 return -EINVAL;
20}
21
22static inline int lirc_prog_query(const union bpf_attr *attr,
23 union bpf_attr __user *uattr)
24{
25 return -EINVAL;
26}
27#endif
28
29#endif /* _BPF_LIRC_H */
diff --git a/include/linux/bpf_trace.h b/include/linux/bpf_trace.h
index e6fe98ae3794..ddf896abcfb6 100644
--- a/include/linux/bpf_trace.h
+++ b/include/linux/bpf_trace.h
@@ -2,7 +2,6 @@
2#ifndef __LINUX_BPF_TRACE_H__ 2#ifndef __LINUX_BPF_TRACE_H__
3#define __LINUX_BPF_TRACE_H__ 3#define __LINUX_BPF_TRACE_H__
4 4
5#include <trace/events/bpf.h>
6#include <trace/events/xdp.h> 5#include <trace/events/xdp.h>
7 6
8#endif /* __LINUX_BPF_TRACE_H__ */ 7#endif /* __LINUX_BPF_TRACE_H__ */
diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h
index 2b28fcf6f6ae..c5700c2d5549 100644
--- a/include/linux/bpf_types.h
+++ b/include/linux/bpf_types.h
@@ -9,9 +9,10 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_XDP, xdp)
9BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SKB, cg_skb) 9BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SKB, cg_skb)
10BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK, cg_sock) 10BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK, cg_sock)
11BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK_ADDR, cg_sock_addr) 11BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK_ADDR, cg_sock_addr)
12BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_IN, lwt_inout) 12BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_IN, lwt_in)
13BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_OUT, lwt_inout) 13BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_OUT, lwt_out)
14BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_XMIT, lwt_xmit) 14BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_XMIT, lwt_xmit)
15BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_SEG6LOCAL, lwt_seg6local)
15BPF_PROG_TYPE(BPF_PROG_TYPE_SOCK_OPS, sock_ops) 16BPF_PROG_TYPE(BPF_PROG_TYPE_SOCK_OPS, sock_ops)
16BPF_PROG_TYPE(BPF_PROG_TYPE_SK_SKB, sk_skb) 17BPF_PROG_TYPE(BPF_PROG_TYPE_SK_SKB, sk_skb)
17BPF_PROG_TYPE(BPF_PROG_TYPE_SK_MSG, sk_msg) 18BPF_PROG_TYPE(BPF_PROG_TYPE_SK_MSG, sk_msg)
@@ -25,6 +26,9 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_RAW_TRACEPOINT, raw_tracepoint)
25#ifdef CONFIG_CGROUP_BPF 26#ifdef CONFIG_CGROUP_BPF
26BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev) 27BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_DEVICE, cg_dev)
27#endif 28#endif
29#ifdef CONFIG_BPF_LIRC_MODE2
30BPF_PROG_TYPE(BPF_PROG_TYPE_LIRC_MODE2, lirc_mode2)
31#endif
28 32
29BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops) 33BPF_MAP_TYPE(BPF_MAP_TYPE_ARRAY, array_map_ops)
30BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_ARRAY, percpu_array_map_ops) 34BPF_MAP_TYPE(BPF_MAP_TYPE_PERCPU_ARRAY, percpu_array_map_ops)
@@ -47,6 +51,10 @@ BPF_MAP_TYPE(BPF_MAP_TYPE_HASH_OF_MAPS, htab_of_maps_map_ops)
47BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops) 51BPF_MAP_TYPE(BPF_MAP_TYPE_DEVMAP, dev_map_ops)
48#if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_INET) 52#if defined(CONFIG_STREAM_PARSER) && defined(CONFIG_INET)
49BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKMAP, sock_map_ops) 53BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKMAP, sock_map_ops)
54BPF_MAP_TYPE(BPF_MAP_TYPE_SOCKHASH, sock_hash_ops)
50#endif 55#endif
51BPF_MAP_TYPE(BPF_MAP_TYPE_CPUMAP, cpu_map_ops) 56BPF_MAP_TYPE(BPF_MAP_TYPE_CPUMAP, cpu_map_ops)
57#if defined(CONFIG_XDP_SOCKETS)
58BPF_MAP_TYPE(BPF_MAP_TYPE_XSKMAP, xsk_map_ops)
59#endif
52#endif 60#endif
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index df36b1b08af0..38b04f559ad3 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -174,6 +174,11 @@ static inline bool bpf_verifier_log_needed(const struct bpf_verifier_log *log)
174 174
175#define BPF_MAX_SUBPROGS 256 175#define BPF_MAX_SUBPROGS 256
176 176
177struct bpf_subprog_info {
178 u32 start; /* insn idx of function entry point */
179 u16 stack_depth; /* max. stack depth used by this function */
180};
181
177/* single container for all structs 182/* single container for all structs
178 * one verifier_env per bpf_check() call 183 * one verifier_env per bpf_check() call
179 */ 184 */
@@ -192,14 +197,12 @@ struct bpf_verifier_env {
192 bool seen_direct_write; 197 bool seen_direct_write;
193 struct bpf_insn_aux_data *insn_aux_data; /* array of per-insn state */ 198 struct bpf_insn_aux_data *insn_aux_data; /* array of per-insn state */
194 struct bpf_verifier_log log; 199 struct bpf_verifier_log log;
195 u32 subprog_starts[BPF_MAX_SUBPROGS]; 200 struct bpf_subprog_info subprog_info[BPF_MAX_SUBPROGS + 1];
196 /* computes the stack depth of each bpf function */
197 u16 subprog_stack_depth[BPF_MAX_SUBPROGS + 1];
198 u32 subprog_cnt; 201 u32 subprog_cnt;
199}; 202};
200 203
201void bpf_verifier_vlog(struct bpf_verifier_log *log, const char *fmt, 204__printf(2, 0) void bpf_verifier_vlog(struct bpf_verifier_log *log,
202 va_list args); 205 const char *fmt, va_list args);
203__printf(2, 3) void bpf_verifier_log_write(struct bpf_verifier_env *env, 206__printf(2, 3) void bpf_verifier_log_write(struct bpf_verifier_env *env,
204 const char *fmt, ...); 207 const char *fmt, ...);
205 208
diff --git a/include/linux/bpfilter.h b/include/linux/bpfilter.h
new file mode 100644
index 000000000000..687b1760bb9f
--- /dev/null
+++ b/include/linux/bpfilter.h
@@ -0,0 +1,15 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_BPFILTER_H
3#define _LINUX_BPFILTER_H
4
5#include <uapi/linux/bpfilter.h>
6
7struct sock;
8int bpfilter_ip_set_sockopt(struct sock *sk, int optname, char *optval,
9 unsigned int optlen);
10int bpfilter_ip_get_sockopt(struct sock *sk, int optname, char *optval,
11 int *optlen);
12extern int (*bpfilter_process_sockopt)(struct sock *sk, int optname,
13 char __user *optval,
14 unsigned int optlen, bool is_set);
15#endif
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index b324e01ccf2d..daa9234a9baf 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -85,6 +85,7 @@
85#define MII_BCM54XX_EXP_SEL 0x17 /* Expansion register select */ 85#define MII_BCM54XX_EXP_SEL 0x17 /* Expansion register select */
86#define MII_BCM54XX_EXP_SEL_SSD 0x0e00 /* Secondary SerDes select */ 86#define MII_BCM54XX_EXP_SEL_SSD 0x0e00 /* Secondary SerDes select */
87#define MII_BCM54XX_EXP_SEL_ER 0x0f00 /* Expansion register select */ 87#define MII_BCM54XX_EXP_SEL_ER 0x0f00 /* Expansion register select */
88#define MII_BCM54XX_EXP_SEL_ETC 0x0d00 /* Expansion register spare + 2k mem */
88 89
89#define MII_BCM54XX_AUX_CTL 0x18 /* Auxiliary control register */ 90#define MII_BCM54XX_AUX_CTL 0x18 /* Auxiliary control register */
90#define MII_BCM54XX_ISR 0x1a /* BCM54xx interrupt status register */ 91#define MII_BCM54XX_ISR 0x1a /* BCM54xx interrupt status register */
@@ -219,6 +220,9 @@
219#define BCM54810_SHD_CLK_CTL 0x3 220#define BCM54810_SHD_CLK_CTL 0x3
220#define BCM54810_SHD_CLK_CTL_GTXCLK_EN (1 << 9) 221#define BCM54810_SHD_CLK_CTL_GTXCLK_EN (1 << 9)
221 222
223/* BCM54612E Registers */
224#define BCM54612E_EXP_SPARE0 (MII_BCM54XX_EXP_SEL_ETC + 0x34)
225#define BCM54612E_LED4_CLK125OUT_EN (1 << 1)
222 226
223/*****************************************************************************/ 227/*****************************************************************************/
224/* Fast Ethernet Transceiver definitions. */ 228/* Fast Ethernet Transceiver definitions. */
diff --git a/include/linux/btf.h b/include/linux/btf.h
new file mode 100644
index 000000000000..e076c4697049
--- /dev/null
+++ b/include/linux/btf.h
@@ -0,0 +1,50 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright (c) 2018 Facebook */
3
4#ifndef _LINUX_BTF_H
5#define _LINUX_BTF_H 1
6
7#include <linux/types.h>
8
9struct btf;
10struct btf_type;
11union bpf_attr;
12
13extern const struct file_operations btf_fops;
14
15void btf_put(struct btf *btf);
16int btf_new_fd(const union bpf_attr *attr);
17struct btf *btf_get_by_fd(int fd);
18int btf_get_info_by_fd(const struct btf *btf,
19 const union bpf_attr *attr,
20 union bpf_attr __user *uattr);
21/* Figure out the size of a type_id. If type_id is a modifier
22 * (e.g. const), it will be resolved to find out the type with size.
23 *
24 * For example:
25 * In describing "const void *", type_id is "const" and "const"
26 * refers to "void *". The return type will be "void *".
27 *
28 * If type_id is a simple "int", then return type will be "int".
29 *
30 * @btf: struct btf object
31 * @type_id: Find out the size of type_id. The type_id of the return
32 * type is set to *type_id.
33 * @ret_size: It can be NULL. If not NULL, the size of the return
34 * type is set to *ret_size.
35 * Return: The btf_type (resolved to another type with size info if needed).
36 * NULL is returned if type_id itself does not have size info
37 * (e.g. void) or it cannot be resolved to another type that
38 * has size info.
39 * *type_id and *ret_size will not be changed in the
40 * NULL return case.
41 */
42const struct btf_type *btf_type_id_size(const struct btf *btf,
43 u32 *type_id,
44 u32 *ret_size);
45void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj,
46 struct seq_file *m);
47int btf_get_fd_by_id(u32 id);
48u32 btf_id(const struct btf *btf);
49
50#endif
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index f7ac2aa93269..3e4ba9d753c8 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -5,6 +5,7 @@
5#include <linux/kexec.h> 5#include <linux/kexec.h>
6#include <linux/proc_fs.h> 6#include <linux/proc_fs.h>
7#include <linux/elf.h> 7#include <linux/elf.h>
8#include <uapi/linux/vmcore.h>
8 9
9#include <asm/pgtable.h> /* for pgprot_t */ 10#include <asm/pgtable.h> /* for pgprot_t */
10 11
@@ -93,4 +94,21 @@ static inline bool is_kdump_kernel(void) { return 0; }
93#endif /* CONFIG_CRASH_DUMP */ 94#endif /* CONFIG_CRASH_DUMP */
94 95
95extern unsigned long saved_max_pfn; 96extern unsigned long saved_max_pfn;
97
98/* Device Dump information to be filled by drivers */
99struct vmcoredd_data {
100 char dump_name[VMCOREDD_MAX_NAME_BYTES]; /* Unique name of the dump */
101 unsigned int size; /* Size of the dump */
102 /* Driver's registered callback to be invoked to collect dump */
103 int (*vmcoredd_callback)(struct vmcoredd_data *data, void *buf);
104};
105
106#ifdef CONFIG_PROC_VMCORE_DEVICE_DUMP
107int vmcore_add_device_dump(struct vmcoredd_data *data);
108#else
109static inline int vmcore_add_device_dump(struct vmcoredd_data *data)
110{
111 return -EOPNOTSUPP;
112}
113#endif /* CONFIG_PROC_VMCORE_DEVICE_DUMP */
96#endif /* LINUX_CRASHDUMP_H */ 114#endif /* LINUX_CRASHDUMP_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index b32cd2062f18..f8a2245b70ac 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -312,6 +312,9 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
312 * by kernel. Returns a negative error code or zero. 312 * by kernel. Returns a negative error code or zero.
313 * @get_fecparam: Get the network device Forward Error Correction parameters. 313 * @get_fecparam: Get the network device Forward Error Correction parameters.
314 * @set_fecparam: Set the network device Forward Error Correction parameters. 314 * @set_fecparam: Set the network device Forward Error Correction parameters.
315 * @get_ethtool_phy_stats: Return extended statistics about the PHY device.
316 * This is only useful if the device maintains PHY statistics and
317 * cannot use the standard PHY library helpers.
315 * 318 *
316 * All operations are optional (i.e. the function pointer may be set 319 * All operations are optional (i.e. the function pointer may be set
317 * to %NULL) and callers must take this into account. Callers must 320 * to %NULL) and callers must take this into account. Callers must
@@ -407,5 +410,7 @@ struct ethtool_ops {
407 struct ethtool_fecparam *); 410 struct ethtool_fecparam *);
408 int (*set_fecparam)(struct net_device *, 411 int (*set_fecparam)(struct net_device *,
409 struct ethtool_fecparam *); 412 struct ethtool_fecparam *);
413 void (*get_ethtool_phy_stats)(struct net_device *,
414 struct ethtool_stats *, u64 *);
410}; 415};
411#endif /* _LINUX_ETHTOOL_H */ 416#endif /* _LINUX_ETHTOOL_H */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index fc4e8f91b03d..45fc0f5000d8 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -30,6 +30,7 @@ struct sock;
30struct seccomp_data; 30struct seccomp_data;
31struct bpf_prog_aux; 31struct bpf_prog_aux;
32struct xdp_rxq_info; 32struct xdp_rxq_info;
33struct xdp_buff;
33 34
34/* ArgX, context and stack frame pointer register positions. Note, 35/* ArgX, context and stack frame pointer register positions. Note,
35 * Arg1, Arg2, Arg3, etc are used as argument mappings of function 36 * Arg1, Arg2, Arg3, etc are used as argument mappings of function
@@ -46,7 +47,9 @@ struct xdp_rxq_info;
46/* Additional register mappings for converted user programs. */ 47/* Additional register mappings for converted user programs. */
47#define BPF_REG_A BPF_REG_0 48#define BPF_REG_A BPF_REG_0
48#define BPF_REG_X BPF_REG_7 49#define BPF_REG_X BPF_REG_7
49#define BPF_REG_TMP BPF_REG_8 50#define BPF_REG_TMP BPF_REG_2 /* scratch reg */
51#define BPF_REG_D BPF_REG_8 /* data, callee-saved */
52#define BPF_REG_H BPF_REG_9 /* hlen, callee-saved */
50 53
51/* Kernel hidden auxiliary/helper register for hardening step. 54/* Kernel hidden auxiliary/helper register for hardening step.
52 * Only used by eBPF JITs. It's nothing more than a temporary 55 * Only used by eBPF JITs. It's nothing more than a temporary
@@ -286,8 +289,21 @@ struct xdp_rxq_info;
286 .off = OFF, \ 289 .off = OFF, \
287 .imm = 0 }) 290 .imm = 0 })
288 291
292/* Relative call */
293
294#define BPF_CALL_REL(TGT) \
295 ((struct bpf_insn) { \
296 .code = BPF_JMP | BPF_CALL, \
297 .dst_reg = 0, \
298 .src_reg = BPF_PSEUDO_CALL, \
299 .off = 0, \
300 .imm = TGT })
301
289/* Function call */ 302/* Function call */
290 303
304#define BPF_CAST_CALL(x) \
305 ((u64 (*)(u64, u64, u64, u64, u64))(x))
306
291#define BPF_EMIT_CALL(FUNC) \ 307#define BPF_EMIT_CALL(FUNC) \
292 ((struct bpf_insn) { \ 308 ((struct bpf_insn) { \
293 .code = BPF_JMP | BPF_CALL, \ 309 .code = BPF_JMP | BPF_CALL, \
@@ -467,7 +483,8 @@ struct bpf_prog {
467 dst_needed:1, /* Do we need dst entry? */ 483 dst_needed:1, /* Do we need dst entry? */
468 blinded:1, /* Was blinded */ 484 blinded:1, /* Was blinded */
469 is_func:1, /* program is a bpf function */ 485 is_func:1, /* program is a bpf function */
470 kprobe_override:1; /* Do we override a kprobe? */ 486 kprobe_override:1, /* Do we override a kprobe? */
487 has_callchain_buf:1; /* callchain buffer allocated? */
471 enum bpf_prog_type type; /* Type of BPF program */ 488 enum bpf_prog_type type; /* Type of BPF program */
472 enum bpf_attach_type expected_attach_type; /* For some prog types */ 489 enum bpf_attach_type expected_attach_type; /* For some prog types */
473 u32 len; /* Number of filter blocks */ 490 u32 len; /* Number of filter blocks */
@@ -500,14 +517,6 @@ struct bpf_skb_data_end {
500 void *data_end; 517 void *data_end;
501}; 518};
502 519
503struct xdp_buff {
504 void *data;
505 void *data_end;
506 void *data_meta;
507 void *data_hard_start;
508 struct xdp_rxq_info *rxq;
509};
510
511struct sk_msg_buff { 520struct sk_msg_buff {
512 void *data; 521 void *data;
513 void *data_end; 522 void *data_end;
@@ -519,9 +528,9 @@ struct sk_msg_buff {
519 int sg_end; 528 int sg_end;
520 struct scatterlist sg_data[MAX_SKB_FRAGS]; 529 struct scatterlist sg_data[MAX_SKB_FRAGS];
521 bool sg_copy[MAX_SKB_FRAGS]; 530 bool sg_copy[MAX_SKB_FRAGS];
522 __u32 key;
523 __u32 flags; 531 __u32 flags;
524 struct bpf_map *map; 532 struct sock *sk_redir;
533 struct sock *sk;
525 struct sk_buff *skb; 534 struct sk_buff *skb;
526 struct list_head list; 535 struct list_head list;
527}; 536};
@@ -630,16 +639,34 @@ static inline bool bpf_prog_was_classic(const struct bpf_prog *prog)
630 return prog->type == BPF_PROG_TYPE_UNSPEC; 639 return prog->type == BPF_PROG_TYPE_UNSPEC;
631} 640}
632 641
633static inline bool 642static inline u32 bpf_ctx_off_adjust_machine(u32 size)
634bpf_ctx_narrow_access_ok(u32 off, u32 size, const u32 size_default)
635{ 643{
636 bool off_ok; 644 const u32 size_machine = sizeof(unsigned long);
645
646 if (size > size_machine && size % size_machine == 0)
647 size = size_machine;
648
649 return size;
650}
651
652static inline bool bpf_ctx_narrow_align_ok(u32 off, u32 size_access,
653 u32 size_default)
654{
655 size_default = bpf_ctx_off_adjust_machine(size_default);
656 size_access = bpf_ctx_off_adjust_machine(size_access);
657
637#ifdef __LITTLE_ENDIAN 658#ifdef __LITTLE_ENDIAN
638 off_ok = (off & (size_default - 1)) == 0; 659 return (off & (size_default - 1)) == 0;
639#else 660#else
640 off_ok = (off & (size_default - 1)) + size == size_default; 661 return (off & (size_default - 1)) + size_access == size_default;
641#endif 662#endif
642 return off_ok && size <= size_default && (size & (size - 1)) == 0; 663}
664
665static inline bool
666bpf_ctx_narrow_access_ok(u32 off, u32 size, u32 size_default)
667{
668 return bpf_ctx_narrow_align_ok(off, size, size_default) &&
669 size <= size_default && (size & (size - 1)) == 0;
643} 670}
644 671
645#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) 672#define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0]))
@@ -766,27 +793,12 @@ struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,
766 * This does not appear to be a real limitation for existing software. 793 * This does not appear to be a real limitation for existing software.
767 */ 794 */
768int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb, 795int xdp_do_generic_redirect(struct net_device *dev, struct sk_buff *skb,
769 struct bpf_prog *prog); 796 struct xdp_buff *xdp, struct bpf_prog *prog);
770int xdp_do_redirect(struct net_device *dev, 797int xdp_do_redirect(struct net_device *dev,
771 struct xdp_buff *xdp, 798 struct xdp_buff *xdp,
772 struct bpf_prog *prog); 799 struct bpf_prog *prog);
773void xdp_do_flush_map(void); 800void xdp_do_flush_map(void);
774 801
775/* Drivers not supporting XDP metadata can use this helper, which
776 * rejects any room expansion for metadata as a result.
777 */
778static __always_inline void
779xdp_set_data_meta_invalid(struct xdp_buff *xdp)
780{
781 xdp->data_meta = xdp->data + 1;
782}
783
784static __always_inline bool
785xdp_data_meta_unsupported(const struct xdp_buff *xdp)
786{
787 return unlikely(xdp->data_meta > xdp->data);
788}
789
790void bpf_warn_invalid_xdp_action(u32 act); 802void bpf_warn_invalid_xdp_action(u32 act);
791 803
792struct sock *do_sk_redirect_map(struct sk_buff *skb); 804struct sock *do_sk_redirect_map(struct sk_buff *skb);
@@ -1029,6 +1041,7 @@ struct bpf_sock_addr_kern {
1029 * only two (src and dst) are available at convert_ctx_access time 1041 * only two (src and dst) are available at convert_ctx_access time
1030 */ 1042 */
1031 u64 tmp_reg; 1043 u64 tmp_reg;
1044 void *t_ctx; /* Attach type specific context. */
1032}; 1045};
1033 1046
1034struct bpf_sock_ops_kern { 1047struct bpf_sock_ops_kern {
diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
new file mode 100644
index 000000000000..b462d9ea8007
--- /dev/null
+++ b/include/linux/fsl/ptp_qoriq.h
@@ -0,0 +1,141 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2010 OMICRON electronics GmbH
4 * Copyright 2018 NXP
5 */
6#ifndef __PTP_QORIQ_H__
7#define __PTP_QORIQ_H__
8
9#include <linux/io.h>
10#include <linux/ptp_clock_kernel.h>
11
12/*
13 * qoriq ptp registers
14 * Generated by regen.tcl on Thu May 13 01:38:57 PM CEST 2010
15 */
16struct qoriq_ptp_registers {
17 u32 tmr_ctrl; /* Timer control register */
18 u32 tmr_tevent; /* Timestamp event register */
19 u32 tmr_temask; /* Timer event mask register */
20 u32 tmr_pevent; /* Timestamp event register */
21 u32 tmr_pemask; /* Timer event mask register */
22 u32 tmr_stat; /* Timestamp status register */
23 u32 tmr_cnt_h; /* Timer counter high register */
24 u32 tmr_cnt_l; /* Timer counter low register */
25 u32 tmr_add; /* Timer drift compensation addend register */
26 u32 tmr_acc; /* Timer accumulator register */
27 u32 tmr_prsc; /* Timer prescale */
28 u8 res1[4];
29 u32 tmroff_h; /* Timer offset high */
30 u32 tmroff_l; /* Timer offset low */
31 u8 res2[8];
32 u32 tmr_alarm1_h; /* Timer alarm 1 high register */
33 u32 tmr_alarm1_l; /* Timer alarm 1 high register */
34 u32 tmr_alarm2_h; /* Timer alarm 2 high register */
35 u32 tmr_alarm2_l; /* Timer alarm 2 high register */
36 u8 res3[48];
37 u32 tmr_fiper1; /* Timer fixed period interval */
38 u32 tmr_fiper2; /* Timer fixed period interval */
39 u32 tmr_fiper3; /* Timer fixed period interval */
40 u8 res4[20];
41 u32 tmr_etts1_h; /* Timestamp of general purpose external trigger */
42 u32 tmr_etts1_l; /* Timestamp of general purpose external trigger */
43 u32 tmr_etts2_h; /* Timestamp of general purpose external trigger */
44 u32 tmr_etts2_l; /* Timestamp of general purpose external trigger */
45};
46
47/* Bit definitions for the TMR_CTRL register */
48#define ALM1P (1<<31) /* Alarm1 output polarity */
49#define ALM2P (1<<30) /* Alarm2 output polarity */
50#define FIPERST (1<<28) /* FIPER start indication */
51#define PP1L (1<<27) /* Fiper1 pulse loopback mode enabled. */
52#define PP2L (1<<26) /* Fiper2 pulse loopback mode enabled. */
53#define TCLK_PERIOD_SHIFT (16) /* 1588 timer reference clock period. */
54#define TCLK_PERIOD_MASK (0x3ff)
55#define RTPE (1<<15) /* Record Tx Timestamp to PAL Enable. */
56#define FRD (1<<14) /* FIPER Realignment Disable */
57#define ESFDP (1<<11) /* External Tx/Rx SFD Polarity. */
58#define ESFDE (1<<10) /* External Tx/Rx SFD Enable. */
59#define ETEP2 (1<<9) /* External trigger 2 edge polarity */
60#define ETEP1 (1<<8) /* External trigger 1 edge polarity */
61#define COPH (1<<7) /* Generated clock output phase. */
62#define CIPH (1<<6) /* External oscillator input clock phase */
63#define TMSR (1<<5) /* Timer soft reset. */
64#define BYP (1<<3) /* Bypass drift compensated clock */
65#define TE (1<<2) /* 1588 timer enable. */
66#define CKSEL_SHIFT (0) /* 1588 Timer reference clock source */
67#define CKSEL_MASK (0x3)
68
69/* Bit definitions for the TMR_TEVENT register */
70#define ETS2 (1<<25) /* External trigger 2 timestamp sampled */
71#define ETS1 (1<<24) /* External trigger 1 timestamp sampled */
72#define ALM2 (1<<17) /* Current time = alarm time register 2 */
73#define ALM1 (1<<16) /* Current time = alarm time register 1 */
74#define PP1 (1<<7) /* periodic pulse generated on FIPER1 */
75#define PP2 (1<<6) /* periodic pulse generated on FIPER2 */
76#define PP3 (1<<5) /* periodic pulse generated on FIPER3 */
77
78/* Bit definitions for the TMR_TEMASK register */
79#define ETS2EN (1<<25) /* External trigger 2 timestamp enable */
80#define ETS1EN (1<<24) /* External trigger 1 timestamp enable */
81#define ALM2EN (1<<17) /* Timer ALM2 event enable */
82#define ALM1EN (1<<16) /* Timer ALM1 event enable */
83#define PP1EN (1<<7) /* Periodic pulse event 1 enable */
84#define PP2EN (1<<6) /* Periodic pulse event 2 enable */
85
86/* Bit definitions for the TMR_PEVENT register */
87#define TXP2 (1<<9) /* PTP transmitted timestamp im TXTS2 */
88#define TXP1 (1<<8) /* PTP transmitted timestamp in TXTS1 */
89#define RXP (1<<0) /* PTP frame has been received */
90
91/* Bit definitions for the TMR_PEMASK register */
92#define TXP2EN (1<<9) /* Transmit PTP packet event 2 enable */
93#define TXP1EN (1<<8) /* Transmit PTP packet event 1 enable */
94#define RXPEN (1<<0) /* Receive PTP packet event enable */
95
96/* Bit definitions for the TMR_STAT register */
97#define STAT_VEC_SHIFT (0) /* Timer general purpose status vector */
98#define STAT_VEC_MASK (0x3f)
99
100/* Bit definitions for the TMR_PRSC register */
101#define PRSC_OCK_SHIFT (0) /* Output clock division/prescale factor. */
102#define PRSC_OCK_MASK (0xffff)
103
104
105#define DRIVER "ptp_qoriq"
106#define DEFAULT_CKSEL 1
107#define N_EXT_TS 2
108#define REG_SIZE sizeof(struct qoriq_ptp_registers)
109
110struct qoriq_ptp {
111 struct qoriq_ptp_registers __iomem *regs;
112 spinlock_t lock; /* protects regs */
113 struct ptp_clock *clock;
114 struct ptp_clock_info caps;
115 struct resource *rsrc;
116 int irq;
117 int phc_index;
118 u64 alarm_interval; /* for periodic alarm */
119 u64 alarm_value;
120 u32 tclk_period; /* nanoseconds */
121 u32 tmr_prsc;
122 u32 tmr_add;
123 u32 cksel;
124 u32 tmr_fiper1;
125 u32 tmr_fiper2;
126};
127
128static inline u32 qoriq_read(unsigned __iomem *addr)
129{
130 u32 val;
131
132 val = ioread32be(addr);
133 return val;
134}
135
136static inline void qoriq_write(unsigned __iomem *addr, u32 val)
137{
138 iowrite32be(val, addr);
139}
140
141#endif
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 02639ebea2f0..7843b98e1c6e 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -50,6 +50,7 @@ struct br_ip_list {
50#define BR_VLAN_TUNNEL BIT(13) 50#define BR_VLAN_TUNNEL BIT(13)
51#define BR_BCAST_FLOOD BIT(14) 51#define BR_BCAST_FLOOD BIT(14)
52#define BR_NEIGH_SUPPRESS BIT(15) 52#define BR_NEIGH_SUPPRESS BIT(15)
53#define BR_ISOLATED BIT(16)
53 54
54#define BR_DEFAULT_AGEING_TIME (300 * HZ) 55#define BR_DEFAULT_AGEING_TIME (300 * HZ)
55 56
@@ -93,11 +94,39 @@ static inline bool br_multicast_router(const struct net_device *dev)
93 94
94#if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING) 95#if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_BRIDGE_VLAN_FILTERING)
95bool br_vlan_enabled(const struct net_device *dev); 96bool br_vlan_enabled(const struct net_device *dev);
97int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid);
98int br_vlan_get_info(const struct net_device *dev, u16 vid,
99 struct bridge_vlan_info *p_vinfo);
96#else 100#else
97static inline bool br_vlan_enabled(const struct net_device *dev) 101static inline bool br_vlan_enabled(const struct net_device *dev)
98{ 102{
99 return false; 103 return false;
100} 104}
105
106static inline int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid)
107{
108 return -1;
109}
110
111static inline int br_vlan_get_info(const struct net_device *dev, u16 vid,
112 struct bridge_vlan_info *p_vinfo)
113{
114 return -1;
115}
116#endif
117
118#if IS_ENABLED(CONFIG_BRIDGE)
119struct net_device *br_fdb_find_port(const struct net_device *br_dev,
120 const unsigned char *addr,
121 __u16 vid);
122#else
123static inline struct net_device *
124br_fdb_find_port(const struct net_device *br_dev,
125 const unsigned char *addr,
126 __u16 vid)
127{
128 return NULL;
129}
101#endif 130#endif
102 131
103#endif 132#endif
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 4cb7aeeafce0..2e55e4cdbd8a 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -21,7 +21,7 @@ struct macvlan_dev {
21 struct hlist_node hlist; 21 struct hlist_node hlist;
22 struct macvlan_port *port; 22 struct macvlan_port *port;
23 struct net_device *lowerdev; 23 struct net_device *lowerdev;
24 void *fwd_priv; 24 void *accel_priv;
25 struct vlan_pcpu_stats __percpu *pcpu_stats; 25 struct vlan_pcpu_stats __percpu *pcpu_stats;
26 26
27 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ); 27 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
@@ -61,10 +61,6 @@ extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
61 struct nlattr *tb[], struct nlattr *data[], 61 struct nlattr *tb[], struct nlattr *data[],
62 struct netlink_ext_ack *extack); 62 struct netlink_ext_ack *extack);
63 63
64extern void macvlan_count_rx(const struct macvlan_dev *vlan,
65 unsigned int len, bool success,
66 bool multicast);
67
68extern void macvlan_dellink(struct net_device *dev, struct list_head *head); 64extern void macvlan_dellink(struct net_device *dev, struct list_head *head);
69 65
70extern int macvlan_link_register(struct rtnl_link_ops *ops); 66extern int macvlan_link_register(struct rtnl_link_ops *ops);
@@ -86,4 +82,27 @@ macvlan_dev_real_dev(const struct net_device *dev)
86} 82}
87#endif 83#endif
88 84
85static inline void *macvlan_accel_priv(struct net_device *dev)
86{
87 struct macvlan_dev *macvlan = netdev_priv(dev);
88
89 return macvlan->accel_priv;
90}
91
92static inline bool macvlan_supports_dest_filter(struct net_device *dev)
93{
94 struct macvlan_dev *macvlan = netdev_priv(dev);
95
96 return macvlan->mode == MACVLAN_MODE_PRIVATE ||
97 macvlan->mode == MACVLAN_MODE_VEPA ||
98 macvlan->mode == MACVLAN_MODE_BRIDGE;
99}
100
101static inline int macvlan_release_l2fw_offload(struct net_device *dev)
102{
103 struct macvlan_dev *macvlan = netdev_priv(dev);
104
105 macvlan->accel_priv = NULL;
106 return dev_uc_add(macvlan->lowerdev, dev->dev_addr);
107}
89#endif /* _LINUX_IF_MACVLAN_H */ 108#endif /* _LINUX_IF_MACVLAN_H */
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index fd00170b494f..3d2996dc7d85 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -22,7 +22,7 @@
22#if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE) 22#if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE)
23struct socket *tun_get_socket(struct file *); 23struct socket *tun_get_socket(struct file *);
24struct ptr_ring *tun_get_tx_ring(struct file *file); 24struct ptr_ring *tun_get_tx_ring(struct file *file);
25bool tun_is_xdp_buff(void *ptr); 25bool tun_is_xdp_frame(void *ptr);
26void *tun_xdp_to_ptr(void *ptr); 26void *tun_xdp_to_ptr(void *ptr);
27void *tun_ptr_to_xdp(void *ptr); 27void *tun_ptr_to_xdp(void *ptr);
28void tun_ptr_free(void *ptr); 28void tun_ptr_free(void *ptr);
@@ -39,7 +39,7 @@ static inline struct ptr_ring *tun_get_tx_ring(struct file *f)
39{ 39{
40 return ERR_PTR(-EINVAL); 40 return ERR_PTR(-EINVAL);
41} 41}
42static inline bool tun_is_xdp_buff(void *ptr) 42static inline bool tun_is_xdp_frame(void *ptr)
43{ 43{
44 return false; 44 return false;
45} 45}
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 78a5a90b4267..83ea4df6ab81 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -331,7 +331,7 @@ static inline bool vlan_hw_offload_capable(netdev_features_t features,
331 * @mac_len: MAC header length including outer vlan headers 331 * @mac_len: MAC header length including outer vlan headers
332 * 332 *
333 * Inserts the VLAN tag into @skb as part of the payload at offset mac_len 333 * Inserts the VLAN tag into @skb as part of the payload at offset mac_len
334 * Returns error if skb_cow_head failes. 334 * Returns error if skb_cow_head fails.
335 * 335 *
336 * Does not change skb->protocol so this function can be used during receive. 336 * Does not change skb->protocol so this function can be used during receive.
337 */ 337 */
@@ -379,7 +379,7 @@ static inline int __vlan_insert_inner_tag(struct sk_buff *skb,
379 * @vlan_tci: VLAN TCI to insert 379 * @vlan_tci: VLAN TCI to insert
380 * 380 *
381 * Inserts the VLAN tag into @skb as part of the payload 381 * Inserts the VLAN tag into @skb as part of the payload
382 * Returns error if skb_cow_head failes. 382 * Returns error if skb_cow_head fails.
383 * 383 *
384 * Does not change skb->protocol so this function can be used during receive. 384 * Does not change skb->protocol so this function can be used during receive.
385 */ 385 */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index e16fe7d44a71..27650f1bff3d 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -139,6 +139,7 @@ struct in_ifaddr {
139 __be32 ifa_local; 139 __be32 ifa_local;
140 __be32 ifa_address; 140 __be32 ifa_address;
141 __be32 ifa_mask; 141 __be32 ifa_mask;
142 __u32 ifa_rt_priority;
142 __be32 ifa_broadcast; 143 __be32 ifa_broadcast;
143 unsigned char ifa_scope; 144 unsigned char ifa_scope;
144 unsigned char ifa_prefixlen; 145 unsigned char ifa_prefixlen;
diff --git a/include/linux/kcore.h b/include/linux/kcore.h
index 80db19d3a505..8de55e4b5ee9 100644
--- a/include/linux/kcore.h
+++ b/include/linux/kcore.h
@@ -28,6 +28,12 @@ struct vmcore {
28 loff_t offset; 28 loff_t offset;
29}; 29};
30 30
31struct vmcoredd_node {
32 struct list_head list; /* List of dumps */
33 void *buf; /* Buffer containing device's dump */
34 unsigned int size; /* Size of the buffer */
35};
36
31#ifdef CONFIG_PROC_KCORE 37#ifdef CONFIG_PROC_KCORE
32extern void kclist_add(struct kcore_list *, void *, size_t, int type); 38extern void kclist_add(struct kcore_list *, void *, size_t, int type);
33#else 39#else
diff --git a/include/linux/mdio-bitbang.h b/include/linux/mdio-bitbang.h
index a8ac9cfa014c..5d71e8a8500f 100644
--- a/include/linux/mdio-bitbang.h
+++ b/include/linux/mdio-bitbang.h
@@ -33,8 +33,6 @@ struct mdiobb_ops {
33 33
34struct mdiobb_ctrl { 34struct mdiobb_ctrl {
35 const struct mdiobb_ops *ops; 35 const struct mdiobb_ops *ops;
36 /* reset callback */
37 int (*reset)(struct mii_bus *bus);
38}; 36};
39 37
40/* The returned bus is not yet registered with the phy layer. */ 38/* The returned bus is not yet registered with the phy layer. */
diff --git a/include/linux/mdio-gpio.h b/include/linux/mdio-gpio.h
new file mode 100644
index 000000000000..cea443a672cb
--- /dev/null
+++ b/include/linux/mdio-gpio.h
@@ -0,0 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __LINUX_MDIO_GPIO_H
3#define __LINUX_MDIO_GPIO_H
4
5#define MDIO_GPIO_MDC 0
6#define MDIO_GPIO_MDIO 1
7#define MDIO_GPIO_MDO 2
8
9#endif
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index 2cfffe586885..bfa7114167d7 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -29,7 +29,6 @@ enum mdio_mutex_lock_class {
29struct mdio_device { 29struct mdio_device {
30 struct device dev; 30 struct device dev;
31 31
32 const struct dev_pm_ops *pm_ops;
33 struct mii_bus *bus; 32 struct mii_bus *bus;
34 char modalias[MDIO_NAME_SIZE]; 33 char modalias[MDIO_NAME_SIZE];
35 34
diff --git a/include/linux/microchipphy.h b/include/linux/microchipphy.h
index 8f9c90379732..8c40128af240 100644
--- a/include/linux/microchipphy.h
+++ b/include/linux/microchipphy.h
@@ -70,6 +70,9 @@
70#define LAN88XX_MMD3_CHIP_ID (32877) 70#define LAN88XX_MMD3_CHIP_ID (32877)
71#define LAN88XX_MMD3_CHIP_REV (32878) 71#define LAN88XX_MMD3_CHIP_REV (32878)
72 72
73/* Registers specific to the LAN7800/LAN7850 embedded phy */
74#define LAN78XX_PHY_LED_MODE_SELECT (0x1D)
75
73/* DSP registers */ 76/* DSP registers */
74#define PHY_ARDENNES_MMD_DEV_3_PHY_CFG (0x806A) 77#define PHY_ARDENNES_MMD_DEV_3_PHY_CFG (0x806A)
75#define PHY_ARDENNES_MMD_DEV_3_PHY_CFG_ZD_DLY_EN_ (0x2000) 78#define PHY_ARDENNES_MMD_DEV_3_PHY_CFG_ZD_DLY_EN_ (0x2000)
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 81d0799b6091..122e7e9d3091 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -225,6 +225,7 @@ enum {
225 MLX4_DEV_CAP_FLAG2_SVLAN_BY_QP = 1ULL << 36, 225 MLX4_DEV_CAP_FLAG2_SVLAN_BY_QP = 1ULL << 36,
226 MLX4_DEV_CAP_FLAG2_SL_TO_VL_CHANGE_EVENT = 1ULL << 37, 226 MLX4_DEV_CAP_FLAG2_SL_TO_VL_CHANGE_EVENT = 1ULL << 37,
227 MLX4_DEV_CAP_FLAG2_USER_MAC_EN = 1ULL << 38, 227 MLX4_DEV_CAP_FLAG2_USER_MAC_EN = 1ULL << 38,
228 MLX4_DEV_CAP_FLAG2_DRIVER_VERSION_TO_FW = 1ULL << 39,
228}; 229};
229 230
230enum { 231enum {
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 2bc27f8c5b87..0f006cf8343d 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -314,6 +314,7 @@ enum mlx5_event {
314 MLX5_EVENT_TYPE_PORT_CHANGE = 0x09, 314 MLX5_EVENT_TYPE_PORT_CHANGE = 0x09,
315 MLX5_EVENT_TYPE_GPIO_EVENT = 0x15, 315 MLX5_EVENT_TYPE_GPIO_EVENT = 0x15,
316 MLX5_EVENT_TYPE_PORT_MODULE_EVENT = 0x16, 316 MLX5_EVENT_TYPE_PORT_MODULE_EVENT = 0x16,
317 MLX5_EVENT_TYPE_TEMP_WARN_EVENT = 0x17,
317 MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19, 318 MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19,
318 MLX5_EVENT_TYPE_GENERAL_EVENT = 0x22, 319 MLX5_EVENT_TYPE_GENERAL_EVENT = 0x22,
319 MLX5_EVENT_TYPE_PPS_EVENT = 0x25, 320 MLX5_EVENT_TYPE_PPS_EVENT = 0x25,
@@ -330,6 +331,7 @@ enum mlx5_event {
330 MLX5_EVENT_TYPE_DCT_DRAINED = 0x1c, 331 MLX5_EVENT_TYPE_DCT_DRAINED = 0x1c,
331 332
332 MLX5_EVENT_TYPE_FPGA_ERROR = 0x20, 333 MLX5_EVENT_TYPE_FPGA_ERROR = 0x20,
334 MLX5_EVENT_TYPE_FPGA_QP_ERROR = 0x21,
333}; 335};
334 336
335enum { 337enum {
@@ -626,6 +628,11 @@ struct mlx5_eqe_dct {
626 __be32 dctn; 628 __be32 dctn;
627}; 629};
628 630
631struct mlx5_eqe_temp_warning {
632 __be64 sensor_warning_msb;
633 __be64 sensor_warning_lsb;
634} __packed;
635
629union ev_data { 636union ev_data {
630 __be32 raw[7]; 637 __be32 raw[7];
631 struct mlx5_eqe_cmd cmd; 638 struct mlx5_eqe_cmd cmd;
@@ -642,6 +649,7 @@ union ev_data {
642 struct mlx5_eqe_port_module port_module; 649 struct mlx5_eqe_port_module port_module;
643 struct mlx5_eqe_pps pps; 650 struct mlx5_eqe_pps pps;
644 struct mlx5_eqe_dct dct; 651 struct mlx5_eqe_dct dct;
652 struct mlx5_eqe_temp_warning temp_warning;
645} __packed; 653} __packed;
646 654
647struct mlx5_eqe { 655struct mlx5_eqe {
@@ -1152,6 +1160,9 @@ enum mlx5_qcam_feature_groups {
1152#define MLX5_CAP_PCAM_FEATURE(mdev, fld) \ 1160#define MLX5_CAP_PCAM_FEATURE(mdev, fld) \
1153 MLX5_GET(pcam_reg, (mdev)->caps.pcam, feature_cap_mask.enhanced_features.fld) 1161 MLX5_GET(pcam_reg, (mdev)->caps.pcam, feature_cap_mask.enhanced_features.fld)
1154 1162
1163#define MLX5_CAP_PCAM_REG(mdev, reg) \
1164 MLX5_GET(pcam_reg, (mdev)->caps.pcam, port_access_reg_cap_mask.regs_5000_to_507f.reg)
1165
1155#define MLX5_CAP_MCAM_REG(mdev, reg) \ 1166#define MLX5_CAP_MCAM_REG(mdev, reg) \
1156 MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_access_reg_cap_mask.access_regs.reg) 1167 MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_access_reg_cap_mask.access_regs.reg)
1157 1168
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index d703774982ca..80cbb7fdce4a 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -124,6 +124,8 @@ enum {
124 MLX5_REG_PAOS = 0x5006, 124 MLX5_REG_PAOS = 0x5006,
125 MLX5_REG_PFCC = 0x5007, 125 MLX5_REG_PFCC = 0x5007,
126 MLX5_REG_PPCNT = 0x5008, 126 MLX5_REG_PPCNT = 0x5008,
127 MLX5_REG_PPTB = 0x500b,
128 MLX5_REG_PBMC = 0x500c,
127 MLX5_REG_PMAOS = 0x5012, 129 MLX5_REG_PMAOS = 0x5012,
128 MLX5_REG_PUDE = 0x5009, 130 MLX5_REG_PUDE = 0x5009,
129 MLX5_REG_PMPE = 0x5010, 131 MLX5_REG_PMPE = 0x5010,
@@ -981,16 +983,24 @@ static inline u32 mlx5_base_mkey(const u32 key)
981 return key & 0xffffff00u; 983 return key & 0xffffff00u;
982} 984}
983 985
984static inline void mlx5_core_init_cq_frag_buf(struct mlx5_frag_buf_ctrl *fbc, 986static inline void mlx5_fill_fbc(u8 log_stride, u8 log_sz,
985 void *cqc) 987 struct mlx5_frag_buf_ctrl *fbc)
986{ 988{
987 fbc->log_stride = 6 + MLX5_GET(cqc, cqc, cqe_sz); 989 fbc->log_stride = log_stride;
988 fbc->log_sz = MLX5_GET(cqc, cqc, log_cq_size); 990 fbc->log_sz = log_sz;
989 fbc->sz_m1 = (1 << fbc->log_sz) - 1; 991 fbc->sz_m1 = (1 << fbc->log_sz) - 1;
990 fbc->log_frag_strides = PAGE_SHIFT - fbc->log_stride; 992 fbc->log_frag_strides = PAGE_SHIFT - fbc->log_stride;
991 fbc->frag_sz_m1 = (1 << fbc->log_frag_strides) - 1; 993 fbc->frag_sz_m1 = (1 << fbc->log_frag_strides) - 1;
992} 994}
993 995
996static inline void mlx5_core_init_cq_frag_buf(struct mlx5_frag_buf_ctrl *fbc,
997 void *cqc)
998{
999 mlx5_fill_fbc(6 + MLX5_GET(cqc, cqc, cqe_sz),
1000 MLX5_GET(cqc, cqc, log_cq_size),
1001 fbc);
1002}
1003
994static inline void *mlx5_frag_buf_get_wqe(struct mlx5_frag_buf_ctrl *fbc, 1004static inline void *mlx5_frag_buf_get_wqe(struct mlx5_frag_buf_ctrl *fbc,
995 u32 ix) 1005 u32 ix)
996{ 1006{
diff --git a/include/linux/mlx5/fs.h b/include/linux/mlx5/fs.h
index 47aecc4fa8c2..9f4d32e41c06 100644
--- a/include/linux/mlx5/fs.h
+++ b/include/linux/mlx5/fs.h
@@ -90,8 +90,12 @@ struct mlx5_flow_destination {
90 union { 90 union {
91 u32 tir_num; 91 u32 tir_num;
92 struct mlx5_flow_table *ft; 92 struct mlx5_flow_table *ft;
93 u32 vport_num;
94 struct mlx5_fc *counter; 93 struct mlx5_fc *counter;
94 struct {
95 u16 num;
96 u16 vhca_id;
97 bool vhca_id_valid;
98 } vport;
95 }; 99 };
96}; 100};
97 101
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 1aad455538f4..8e0b8865f91e 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -60,6 +60,7 @@ enum {
60 MLX5_EVENT_TYPE_CODING_COMMAND_INTERFACE_COMPLETION = 0xa, 60 MLX5_EVENT_TYPE_CODING_COMMAND_INTERFACE_COMPLETION = 0xa,
61 MLX5_EVENT_TYPE_CODING_PAGE_REQUEST = 0xb, 61 MLX5_EVENT_TYPE_CODING_PAGE_REQUEST = 0xb,
62 MLX5_EVENT_TYPE_CODING_FPGA_ERROR = 0x20, 62 MLX5_EVENT_TYPE_CODING_FPGA_ERROR = 0x20,
63 MLX5_EVENT_TYPE_CODING_FPGA_QP_ERROR = 0x21
63}; 64};
64 65
65enum { 66enum {
@@ -356,22 +357,6 @@ struct mlx5_ifc_odp_per_transport_service_cap_bits {
356 u8 reserved_at_6[0x1a]; 357 u8 reserved_at_6[0x1a];
357}; 358};
358 359
359struct mlx5_ifc_ipv4_layout_bits {
360 u8 reserved_at_0[0x60];
361
362 u8 ipv4[0x20];
363};
364
365struct mlx5_ifc_ipv6_layout_bits {
366 u8 ipv6[16][0x8];
367};
368
369union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits {
370 struct mlx5_ifc_ipv6_layout_bits ipv6_layout;
371 struct mlx5_ifc_ipv4_layout_bits ipv4_layout;
372 u8 reserved_at_0[0x80];
373};
374
375struct mlx5_ifc_fte_match_set_lyr_2_4_bits { 360struct mlx5_ifc_fte_match_set_lyr_2_4_bits {
376 u8 smac_47_16[0x20]; 361 u8 smac_47_16[0x20];
377 362
@@ -412,7 +397,7 @@ struct mlx5_ifc_fte_match_set_misc_bits {
412 u8 reserved_at_0[0x8]; 397 u8 reserved_at_0[0x8];
413 u8 source_sqn[0x18]; 398 u8 source_sqn[0x18];
414 399
415 u8 reserved_at_20[0x10]; 400 u8 source_eswitch_owner_vhca_id[0x10];
416 u8 source_port[0x10]; 401 u8 source_port[0x10];
417 402
418 u8 outer_second_prio[0x3]; 403 u8 outer_second_prio[0x3];
@@ -540,7 +525,9 @@ struct mlx5_ifc_flow_table_nic_cap_bits {
540}; 525};
541 526
542struct mlx5_ifc_flow_table_eswitch_cap_bits { 527struct mlx5_ifc_flow_table_eswitch_cap_bits {
543 u8 reserved_at_0[0x200]; 528 u8 reserved_at_0[0x1c];
529 u8 fdb_multi_path_to_table[0x1];
530 u8 reserved_at_1d[0x1e3];
544 531
545 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_esw_fdb; 532 struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_esw_fdb;
546 533
@@ -557,7 +544,8 @@ struct mlx5_ifc_e_switch_cap_bits {
557 u8 vport_svlan_insert[0x1]; 544 u8 vport_svlan_insert[0x1];
558 u8 vport_cvlan_insert_if_not_exist[0x1]; 545 u8 vport_cvlan_insert_if_not_exist[0x1];
559 u8 vport_cvlan_insert_overwrite[0x1]; 546 u8 vport_cvlan_insert_overwrite[0x1];
560 u8 reserved_at_5[0x19]; 547 u8 reserved_at_5[0x18];
548 u8 merged_eswitch[0x1];
561 u8 nic_vport_node_guid_modify[0x1]; 549 u8 nic_vport_node_guid_modify[0x1];
562 u8 nic_vport_port_guid_modify[0x1]; 550 u8 nic_vport_port_guid_modify[0x1];
563 551
@@ -925,7 +913,7 @@ struct mlx5_ifc_cmd_hca_cap_bits {
925 u8 log_max_msg[0x5]; 913 u8 log_max_msg[0x5];
926 u8 reserved_at_1c8[0x4]; 914 u8 reserved_at_1c8[0x4];
927 u8 max_tc[0x4]; 915 u8 max_tc[0x4];
928 u8 reserved_at_1d0[0x1]; 916 u8 temp_warn_event[0x1];
929 u8 dcbx[0x1]; 917 u8 dcbx[0x1];
930 u8 general_notification_event[0x1]; 918 u8 general_notification_event[0x1];
931 u8 reserved_at_1d3[0x2]; 919 u8 reserved_at_1d3[0x2];
@@ -1147,8 +1135,9 @@ enum mlx5_flow_destination_type {
1147struct mlx5_ifc_dest_format_struct_bits { 1135struct mlx5_ifc_dest_format_struct_bits {
1148 u8 destination_type[0x8]; 1136 u8 destination_type[0x8];
1149 u8 destination_id[0x18]; 1137 u8 destination_id[0x18];
1150 1138 u8 destination_eswitch_owner_vhca_id_valid[0x1];
1151 u8 reserved_at_20[0x20]; 1139 u8 reserved_at_21[0xf];
1140 u8 destination_eswitch_owner_vhca_id[0x10];
1152}; 1141};
1153 1142
1154struct mlx5_ifc_flow_counter_list_bits { 1143struct mlx5_ifc_flow_counter_list_bits {
@@ -6993,7 +6982,9 @@ struct mlx5_ifc_create_flow_group_in_bits {
6993 u8 reserved_at_a0[0x8]; 6982 u8 reserved_at_a0[0x8];
6994 u8 table_id[0x18]; 6983 u8 table_id[0x18];
6995 6984
6996 u8 reserved_at_c0[0x20]; 6985 u8 source_eswitch_owner_vhca_id_valid[0x1];
6986
6987 u8 reserved_at_c1[0x1f];
6997 6988
6998 u8 start_flow_index[0x20]; 6989 u8 start_flow_index[0x20];
6999 6990
@@ -8015,6 +8006,17 @@ struct mlx5_ifc_pcam_enhanced_features_bits {
8015 u8 ppcnt_statistical_group[0x1]; 8006 u8 ppcnt_statistical_group[0x1];
8016}; 8007};
8017 8008
8009struct mlx5_ifc_pcam_regs_5000_to_507f_bits {
8010 u8 port_access_reg_cap_mask_127_to_96[0x20];
8011 u8 port_access_reg_cap_mask_95_to_64[0x20];
8012 u8 port_access_reg_cap_mask_63_to_32[0x20];
8013
8014 u8 port_access_reg_cap_mask_31_to_13[0x13];
8015 u8 pbmc[0x1];
8016 u8 pptb[0x1];
8017 u8 port_access_reg_cap_mask_10_to_0[0xb];
8018};
8019
8018struct mlx5_ifc_pcam_reg_bits { 8020struct mlx5_ifc_pcam_reg_bits {
8019 u8 reserved_at_0[0x8]; 8021 u8 reserved_at_0[0x8];
8020 u8 feature_group[0x8]; 8022 u8 feature_group[0x8];
@@ -8024,6 +8026,7 @@ struct mlx5_ifc_pcam_reg_bits {
8024 u8 reserved_at_20[0x20]; 8026 u8 reserved_at_20[0x20];
8025 8027
8026 union { 8028 union {
8029 struct mlx5_ifc_pcam_regs_5000_to_507f_bits regs_5000_to_507f;
8027 u8 reserved_at_0[0x80]; 8030 u8 reserved_at_0[0x80];
8028 } port_access_reg_cap_mask; 8031 } port_access_reg_cap_mask;
8029 8032
@@ -8788,6 +8791,41 @@ struct mlx5_ifc_qpts_reg_bits {
8788 u8 trust_state[0x3]; 8791 u8 trust_state[0x3];
8789}; 8792};
8790 8793
8794struct mlx5_ifc_pptb_reg_bits {
8795 u8 reserved_at_0[0x2];
8796 u8 mm[0x2];
8797 u8 reserved_at_4[0x4];
8798 u8 local_port[0x8];
8799 u8 reserved_at_10[0x6];
8800 u8 cm[0x1];
8801 u8 um[0x1];
8802 u8 pm[0x8];
8803
8804 u8 prio_x_buff[0x20];
8805
8806 u8 pm_msb[0x8];
8807 u8 reserved_at_48[0x10];
8808 u8 ctrl_buff[0x4];
8809 u8 untagged_buff[0x4];
8810};
8811
8812struct mlx5_ifc_pbmc_reg_bits {
8813 u8 reserved_at_0[0x8];
8814 u8 local_port[0x8];
8815 u8 reserved_at_10[0x10];
8816
8817 u8 xoff_timer_value[0x10];
8818 u8 xoff_refresh[0x10];
8819
8820 u8 reserved_at_40[0x9];
8821 u8 fullness_threshold[0x7];
8822 u8 port_buffer_size[0x10];
8823
8824 struct mlx5_ifc_bufferx_reg_bits buffer[10];
8825
8826 u8 reserved_at_2e0[0x40];
8827};
8828
8791struct mlx5_ifc_qtct_reg_bits { 8829struct mlx5_ifc_qtct_reg_bits {
8792 u8 reserved_at_0[0x8]; 8830 u8 reserved_at_0[0x8];
8793 u8 port_number[0x8]; 8831 u8 port_number[0x8];
diff --git a/include/linux/mlx5/mlx5_ifc_fpga.h b/include/linux/mlx5/mlx5_ifc_fpga.h
index ec052491ba3d..64d0f40d4cc3 100644
--- a/include/linux/mlx5/mlx5_ifc_fpga.h
+++ b/include/linux/mlx5/mlx5_ifc_fpga.h
@@ -32,12 +32,29 @@
32#ifndef MLX5_IFC_FPGA_H 32#ifndef MLX5_IFC_FPGA_H
33#define MLX5_IFC_FPGA_H 33#define MLX5_IFC_FPGA_H
34 34
35struct mlx5_ifc_ipv4_layout_bits {
36 u8 reserved_at_0[0x60];
37
38 u8 ipv4[0x20];
39};
40
41struct mlx5_ifc_ipv6_layout_bits {
42 u8 ipv6[16][0x8];
43};
44
45union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits {
46 struct mlx5_ifc_ipv6_layout_bits ipv6_layout;
47 struct mlx5_ifc_ipv4_layout_bits ipv4_layout;
48 u8 reserved_at_0[0x80];
49};
50
35enum { 51enum {
36 MLX5_FPGA_CAP_SANDBOX_VENDOR_ID_MLNX = 0x2c9, 52 MLX5_FPGA_CAP_SANDBOX_VENDOR_ID_MLNX = 0x2c9,
37}; 53};
38 54
39enum { 55enum {
40 MLX5_FPGA_CAP_SANDBOX_PRODUCT_ID_IPSEC = 0x2, 56 MLX5_FPGA_CAP_SANDBOX_PRODUCT_ID_IPSEC = 0x2,
57 MLX5_FPGA_CAP_SANDBOX_PRODUCT_ID_TLS = 0x3,
41}; 58};
42 59
43struct mlx5_ifc_fpga_shell_caps_bits { 60struct mlx5_ifc_fpga_shell_caps_bits {
@@ -370,6 +387,27 @@ struct mlx5_ifc_fpga_destroy_qp_out_bits {
370 u8 reserved_at_40[0x40]; 387 u8 reserved_at_40[0x40];
371}; 388};
372 389
390struct mlx5_ifc_tls_extended_cap_bits {
391 u8 aes_gcm_128[0x1];
392 u8 aes_gcm_256[0x1];
393 u8 reserved_at_2[0x1e];
394 u8 reserved_at_20[0x20];
395 u8 context_capacity_total[0x20];
396 u8 context_capacity_rx[0x20];
397 u8 context_capacity_tx[0x20];
398 u8 reserved_at_a0[0x10];
399 u8 tls_counter_size[0x10];
400 u8 tls_counters_addr_low[0x20];
401 u8 tls_counters_addr_high[0x20];
402 u8 rx[0x1];
403 u8 tx[0x1];
404 u8 tls_v12[0x1];
405 u8 tls_v13[0x1];
406 u8 lro[0x1];
407 u8 ipv6[0x1];
408 u8 reserved_at_106[0x1a];
409};
410
373struct mlx5_ifc_ipsec_extended_cap_bits { 411struct mlx5_ifc_ipsec_extended_cap_bits {
374 u8 encapsulation[0x20]; 412 u8 encapsulation[0x20];
375 413
@@ -432,6 +470,22 @@ struct mlx5_ifc_ipsec_counters_bits {
432 u8 dropped_cmd[0x40]; 470 u8 dropped_cmd[0x40];
433}; 471};
434 472
473enum {
474 MLX5_FPGA_QP_ERROR_EVENT_SYNDROME_RETRY_COUNTER_EXPIRED = 0x1,
475 MLX5_FPGA_QP_ERROR_EVENT_SYNDROME_RNR_EXPIRED = 0x2,
476};
477
478struct mlx5_ifc_fpga_qp_error_event_bits {
479 u8 reserved_at_0[0x40];
480
481 u8 reserved_at_40[0x18];
482 u8 syndrome[0x8];
483
484 u8 reserved_at_60[0x60];
485
486 u8 reserved_at_c0[0x8];
487 u8 fpga_qpn[0x18];
488};
435enum mlx5_ifc_fpga_ipsec_response_syndrome { 489enum mlx5_ifc_fpga_ipsec_response_syndrome {
436 MLX5_FPGA_IPSEC_RESPONSE_SUCCESS = 0, 490 MLX5_FPGA_IPSEC_RESPONSE_SUCCESS = 0,
437 MLX5_FPGA_IPSEC_RESPONSE_ILLEGAL_REQUEST = 1, 491 MLX5_FPGA_IPSEC_RESPONSE_ILLEGAL_REQUEST = 1,
@@ -519,4 +573,43 @@ struct mlx5_ifc_fpga_ipsec_sa {
519 __be16 reserved2; 573 __be16 reserved2;
520} __packed; 574} __packed;
521 575
576enum fpga_tls_cmds {
577 CMD_SETUP_STREAM = 0x1001,
578 CMD_TEARDOWN_STREAM = 0x1002,
579};
580
581#define MLX5_TLS_1_2 (0)
582
583#define MLX5_TLS_ALG_AES_GCM_128 (0)
584#define MLX5_TLS_ALG_AES_GCM_256 (1)
585
586struct mlx5_ifc_tls_cmd_bits {
587 u8 command_type[0x20];
588 u8 ipv6[0x1];
589 u8 direction_sx[0x1];
590 u8 tls_version[0x2];
591 u8 reserved[0x1c];
592 u8 swid[0x20];
593 u8 src_port[0x10];
594 u8 dst_port[0x10];
595 union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits src_ipv4_src_ipv6;
596 union mlx5_ifc_ipv6_layout_ipv4_layout_auto_bits dst_ipv4_dst_ipv6;
597 u8 tls_rcd_sn[0x40];
598 u8 tcp_sn[0x20];
599 u8 tls_implicit_iv[0x20];
600 u8 tls_xor_iv[0x40];
601 u8 encryption_key[0x100];
602 u8 alg[4];
603 u8 reserved2[0x1c];
604 u8 reserved3[0x4a0];
605};
606
607struct mlx5_ifc_tls_resp_bits {
608 u8 syndrome[0x20];
609 u8 stream_id[0x20];
610 u8 reserverd[0x40];
611};
612
613#define MLX5_TLS_COMMAND_SIZE (0x100)
614
522#endif /* MLX5_IFC_FPGA_H */ 615#endif /* MLX5_IFC_FPGA_H */
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index 2836a96e014a..4224902a8e22 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -35,6 +35,7 @@
35#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335 35#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
36#define SDIO_DEVICE_ID_BROADCOM_4339 0x4339 36#define SDIO_DEVICE_ID_BROADCOM_4339 0x4339
37#define SDIO_DEVICE_ID_BROADCOM_43362 0xa962 37#define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
38#define SDIO_DEVICE_ID_BROADCOM_43364 0xa9a4
38#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6 39#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
39#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345 40#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
40#define SDIO_DEVICE_ID_BROADCOM_43455 0xa9bf 41#define SDIO_DEVICE_ID_BROADCOM_43455 0xa9bf
diff --git a/include/linux/mroute_base.h b/include/linux/mroute_base.h
index d617fe45543e..d633f737b3c6 100644
--- a/include/linux/mroute_base.h
+++ b/include/linux/mroute_base.h
@@ -307,16 +307,6 @@ static inline void vif_device_init(struct vif_device *v,
307{ 307{
308} 308}
309 309
310static inline void *
311mr_table_alloc(struct net *net, u32 id,
312 struct mr_table_ops *ops,
313 void (*expire_func)(struct timer_list *t),
314 void (*table_set)(struct mr_table *mrt,
315 struct net *net))
316{
317 return NULL;
318}
319
320static inline void *mr_mfc_find_parent(struct mr_table *mrt, 310static inline void *mr_mfc_find_parent(struct mr_table *mrt,
321 void *hasharg, int parent) 311 void *hasharg, int parent)
322{ 312{
diff --git a/include/linux/net.h b/include/linux/net.h
index 3fd9d8c16581..08b6eb964dd6 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -198,6 +198,7 @@ struct proto_ops {
198 int offset, size_t size, int flags); 198 int offset, size_t size, int flags);
199 int (*sendmsg_locked)(struct sock *sk, struct msghdr *msg, 199 int (*sendmsg_locked)(struct sock *sk, struct msghdr *msg,
200 size_t size); 200 size_t size);
201 int (*set_rcvlowat)(struct sock *sk, int val);
201}; 202};
202 203
203#define DECLARE_SOCKADDR(type, dst, src) \ 204#define DECLARE_SOCKADDR(type, dst, src) \
diff --git a/include/linux/net_dim.h b/include/linux/net_dim.h
index 29ed8fd6379a..db99240d00bd 100644
--- a/include/linux/net_dim.h
+++ b/include/linux/net_dim.h
@@ -103,11 +103,12 @@ enum {
103#define NET_DIM_PARAMS_NUM_PROFILES 5 103#define NET_DIM_PARAMS_NUM_PROFILES 5
104/* Adaptive moderation profiles */ 104/* Adaptive moderation profiles */
105#define NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE 256 105#define NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE 256
106#define NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE 128
106#define NET_DIM_DEF_PROFILE_CQE 1 107#define NET_DIM_DEF_PROFILE_CQE 1
107#define NET_DIM_DEF_PROFILE_EQE 1 108#define NET_DIM_DEF_PROFILE_EQE 1
108 109
109/* All profiles sizes must be NET_PARAMS_DIM_NUM_PROFILES */ 110/* All profiles sizes must be NET_PARAMS_DIM_NUM_PROFILES */
110#define NET_DIM_EQE_PROFILES { \ 111#define NET_DIM_RX_EQE_PROFILES { \
111 {1, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 112 {1, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
112 {8, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 113 {8, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
113 {64, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 114 {64, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
@@ -115,7 +116,7 @@ enum {
115 {256, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \ 116 {256, NET_DIM_DEFAULT_RX_CQ_MODERATION_PKTS_FROM_EQE}, \
116} 117}
117 118
118#define NET_DIM_CQE_PROFILES { \ 119#define NET_DIM_RX_CQE_PROFILES { \
119 {2, 256}, \ 120 {2, 256}, \
120 {8, 128}, \ 121 {8, 128}, \
121 {16, 64}, \ 122 {16, 64}, \
@@ -123,32 +124,68 @@ enum {
123 {64, 64} \ 124 {64, 64} \
124} 125}
125 126
127#define NET_DIM_TX_EQE_PROFILES { \
128 {1, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \
129 {8, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \
130 {32, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \
131 {64, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE}, \
132 {128, NET_DIM_DEFAULT_TX_CQ_MODERATION_PKTS_FROM_EQE} \
133}
134
135#define NET_DIM_TX_CQE_PROFILES { \
136 {5, 128}, \
137 {8, 64}, \
138 {16, 32}, \
139 {32, 32}, \
140 {64, 32} \
141}
142
126static const struct net_dim_cq_moder 143static const struct net_dim_cq_moder
127profile[NET_DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = { 144rx_profile[NET_DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
128 NET_DIM_EQE_PROFILES, 145 NET_DIM_RX_EQE_PROFILES,
129 NET_DIM_CQE_PROFILES, 146 NET_DIM_RX_CQE_PROFILES,
130}; 147};
131 148
132static inline struct net_dim_cq_moder net_dim_get_profile(u8 cq_period_mode, 149static const struct net_dim_cq_moder
133 int ix) 150tx_profile[NET_DIM_CQ_PERIOD_NUM_MODES][NET_DIM_PARAMS_NUM_PROFILES] = {
151 NET_DIM_TX_EQE_PROFILES,
152 NET_DIM_TX_CQE_PROFILES,
153};
154
155static inline struct net_dim_cq_moder
156net_dim_get_rx_moderation(u8 cq_period_mode, int ix)
134{ 157{
135 struct net_dim_cq_moder cq_moder; 158 struct net_dim_cq_moder cq_moder = rx_profile[cq_period_mode][ix];
136 159
137 cq_moder = profile[cq_period_mode][ix];
138 cq_moder.cq_period_mode = cq_period_mode; 160 cq_moder.cq_period_mode = cq_period_mode;
139 return cq_moder; 161 return cq_moder;
140} 162}
141 163
142static inline struct net_dim_cq_moder net_dim_get_def_profile(u8 rx_cq_period_mode) 164static inline struct net_dim_cq_moder
165net_dim_get_def_rx_moderation(u8 cq_period_mode)
166{
167 u8 profile_ix = cq_period_mode == NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE ?
168 NET_DIM_DEF_PROFILE_CQE : NET_DIM_DEF_PROFILE_EQE;
169
170 return net_dim_get_rx_moderation(cq_period_mode, profile_ix);
171}
172
173static inline struct net_dim_cq_moder
174net_dim_get_tx_moderation(u8 cq_period_mode, int ix)
143{ 175{
144 int default_profile_ix; 176 struct net_dim_cq_moder cq_moder = tx_profile[cq_period_mode][ix];
177
178 cq_moder.cq_period_mode = cq_period_mode;
179 return cq_moder;
180}
145 181
146 if (rx_cq_period_mode == NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE) 182static inline struct net_dim_cq_moder
147 default_profile_ix = NET_DIM_DEF_PROFILE_CQE; 183net_dim_get_def_tx_moderation(u8 cq_period_mode)
148 else /* NET_DIM_CQ_PERIOD_MODE_START_FROM_EQE */ 184{
149 default_profile_ix = NET_DIM_DEF_PROFILE_EQE; 185 u8 profile_ix = cq_period_mode == NET_DIM_CQ_PERIOD_MODE_START_FROM_CQE ?
186 NET_DIM_DEF_PROFILE_CQE : NET_DIM_DEF_PROFILE_EQE;
150 187
151 return net_dim_get_profile(rx_cq_period_mode, default_profile_ix); 188 return net_dim_get_tx_moderation(cq_period_mode, profile_ix);
152} 189}
153 190
154static inline bool net_dim_on_top(struct net_dim *dim) 191static inline bool net_dim_on_top(struct net_dim *dim)
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 35b79f47a13d..623bb8ced060 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -55,8 +55,9 @@ enum {
55 NETIF_F_GSO_SCTP_BIT, /* ... SCTP fragmentation */ 55 NETIF_F_GSO_SCTP_BIT, /* ... SCTP fragmentation */
56 NETIF_F_GSO_ESP_BIT, /* ... ESP with TSO */ 56 NETIF_F_GSO_ESP_BIT, /* ... ESP with TSO */
57 NETIF_F_GSO_UDP_BIT, /* ... UFO, deprecated except tuntap */ 57 NETIF_F_GSO_UDP_BIT, /* ... UFO, deprecated except tuntap */
58 NETIF_F_GSO_UDP_L4_BIT, /* ... UDP payload GSO (not UFO) */
58 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ 59 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
59 NETIF_F_GSO_UDP_BIT, 60 NETIF_F_GSO_UDP_L4_BIT,
60 61
61 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ 62 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
62 NETIF_F_SCTP_CRC_BIT, /* SCTP checksum offload */ 63 NETIF_F_SCTP_CRC_BIT, /* SCTP checksum offload */
@@ -77,6 +78,7 @@ enum {
77 NETIF_F_HW_ESP_BIT, /* Hardware ESP transformation offload */ 78 NETIF_F_HW_ESP_BIT, /* Hardware ESP transformation offload */
78 NETIF_F_HW_ESP_TX_CSUM_BIT, /* ESP with TX checksum offload */ 79 NETIF_F_HW_ESP_TX_CSUM_BIT, /* ESP with TX checksum offload */
79 NETIF_F_RX_UDP_TUNNEL_PORT_BIT, /* Offload of RX port for UDP tunnels */ 80 NETIF_F_RX_UDP_TUNNEL_PORT_BIT, /* Offload of RX port for UDP tunnels */
81 NETIF_F_HW_TLS_TX_BIT, /* Hardware TLS TX offload */
80 82
81 NETIF_F_GRO_HW_BIT, /* Hardware Generic receive offload */ 83 NETIF_F_GRO_HW_BIT, /* Hardware Generic receive offload */
82 NETIF_F_HW_TLS_RECORD_BIT, /* Offload TLS record */ 84 NETIF_F_HW_TLS_RECORD_BIT, /* Offload TLS record */
@@ -147,6 +149,8 @@ enum {
147#define NETIF_F_HW_ESP_TX_CSUM __NETIF_F(HW_ESP_TX_CSUM) 149#define NETIF_F_HW_ESP_TX_CSUM __NETIF_F(HW_ESP_TX_CSUM)
148#define NETIF_F_RX_UDP_TUNNEL_PORT __NETIF_F(RX_UDP_TUNNEL_PORT) 150#define NETIF_F_RX_UDP_TUNNEL_PORT __NETIF_F(RX_UDP_TUNNEL_PORT)
149#define NETIF_F_HW_TLS_RECORD __NETIF_F(HW_TLS_RECORD) 151#define NETIF_F_HW_TLS_RECORD __NETIF_F(HW_TLS_RECORD)
152#define NETIF_F_GSO_UDP_L4 __NETIF_F(GSO_UDP_L4)
153#define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX)
150 154
151#define for_each_netdev_feature(mask_addr, bit) \ 155#define for_each_netdev_feature(mask_addr, bit) \
152 for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT) 156 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 cf44503ea81a..3ec9850c7936 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -791,6 +791,7 @@ enum tc_setup_type {
791 TC_SETUP_QDISC_CBS, 791 TC_SETUP_QDISC_CBS,
792 TC_SETUP_QDISC_RED, 792 TC_SETUP_QDISC_RED,
793 TC_SETUP_QDISC_PRIO, 793 TC_SETUP_QDISC_PRIO,
794 TC_SETUP_QDISC_MQ,
794}; 795};
795 796
796/* These structures hold the attributes of bpf state that are being passed 797/* These structures hold the attributes of bpf state that are being passed
@@ -817,10 +818,13 @@ enum bpf_netdev_command {
817 BPF_OFFLOAD_DESTROY, 818 BPF_OFFLOAD_DESTROY,
818 BPF_OFFLOAD_MAP_ALLOC, 819 BPF_OFFLOAD_MAP_ALLOC,
819 BPF_OFFLOAD_MAP_FREE, 820 BPF_OFFLOAD_MAP_FREE,
821 XDP_QUERY_XSK_UMEM,
822 XDP_SETUP_XSK_UMEM,
820}; 823};
821 824
822struct bpf_prog_offload_ops; 825struct bpf_prog_offload_ops;
823struct netlink_ext_ack; 826struct netlink_ext_ack;
827struct xdp_umem;
824 828
825struct netdev_bpf { 829struct netdev_bpf {
826 enum bpf_netdev_command command; 830 enum bpf_netdev_command command;
@@ -851,6 +855,11 @@ struct netdev_bpf {
851 struct { 855 struct {
852 struct bpf_offloaded_map *offmap; 856 struct bpf_offloaded_map *offmap;
853 }; 857 };
858 /* XDP_SETUP_XSK_UMEM */
859 struct {
860 struct xdp_umem *umem;
861 u16 queue_id;
862 } xsk;
854 }; 863 };
855}; 864};
856 865
@@ -865,6 +874,26 @@ struct xfrmdev_ops {
865}; 874};
866#endif 875#endif
867 876
877#if IS_ENABLED(CONFIG_TLS_DEVICE)
878enum tls_offload_ctx_dir {
879 TLS_OFFLOAD_CTX_DIR_RX,
880 TLS_OFFLOAD_CTX_DIR_TX,
881};
882
883struct tls_crypto_info;
884struct tls_context;
885
886struct tlsdev_ops {
887 int (*tls_dev_add)(struct net_device *netdev, struct sock *sk,
888 enum tls_offload_ctx_dir direction,
889 struct tls_crypto_info *crypto_info,
890 u32 start_offload_tcp_sn);
891 void (*tls_dev_del)(struct net_device *netdev,
892 struct tls_context *ctx,
893 enum tls_offload_ctx_dir direction);
894};
895#endif
896
868struct dev_ifalias { 897struct dev_ifalias {
869 struct rcu_head rcuhead; 898 struct rcu_head rcuhead;
870 char ifalias[]; 899 char ifalias[];
@@ -1165,12 +1194,13 @@ struct dev_ifalias {
1165 * This function is used to set or query state related to XDP on the 1194 * This function is used to set or query state related to XDP on the
1166 * netdevice and manage BPF offload. See definition of 1195 * netdevice and manage BPF offload. See definition of
1167 * enum bpf_netdev_command for details. 1196 * enum bpf_netdev_command for details.
1168 * int (*ndo_xdp_xmit)(struct net_device *dev, struct xdp_buff *xdp); 1197 * int (*ndo_xdp_xmit)(struct net_device *dev, int n, struct xdp_frame **xdp,
1169 * This function is used to submit a XDP packet for transmit on a 1198 * u32 flags);
1170 * netdevice. 1199 * This function is used to submit @n XDP packets for transmit on a
1171 * void (*ndo_xdp_flush)(struct net_device *dev); 1200 * netdevice. Returns number of frames successfully transmitted, frames
1172 * This function is used to inform the driver to flush a particular 1201 * that got dropped are freed/returned via xdp_return_frame().
1173 * xdp tx queue. Must be called on same CPU as xdp_xmit. 1202 * Returns negative number, means general error invoking ndo, meaning
1203 * no frames were xmit'ed and core-caller will free all frames.
1174 */ 1204 */
1175struct net_device_ops { 1205struct net_device_ops {
1176 int (*ndo_init)(struct net_device *dev); 1206 int (*ndo_init)(struct net_device *dev);
@@ -1355,9 +1385,11 @@ struct net_device_ops {
1355 int needed_headroom); 1385 int needed_headroom);
1356 int (*ndo_bpf)(struct net_device *dev, 1386 int (*ndo_bpf)(struct net_device *dev,
1357 struct netdev_bpf *bpf); 1387 struct netdev_bpf *bpf);
1358 int (*ndo_xdp_xmit)(struct net_device *dev, 1388 int (*ndo_xdp_xmit)(struct net_device *dev, int n,
1359 struct xdp_buff *xdp); 1389 struct xdp_frame **xdp,
1360 void (*ndo_xdp_flush)(struct net_device *dev); 1390 u32 flags);
1391 int (*ndo_xsk_async_xmit)(struct net_device *dev,
1392 u32 queue_id);
1361}; 1393};
1362 1394
1363/** 1395/**
@@ -1401,6 +1433,8 @@ struct net_device_ops {
1401 * entity (i.e. the master device for bridged veth) 1433 * entity (i.e. the master device for bridged veth)
1402 * @IFF_MACSEC: device is a MACsec device 1434 * @IFF_MACSEC: device is a MACsec device
1403 * @IFF_NO_RX_HANDLER: device doesn't support the rx_handler hook 1435 * @IFF_NO_RX_HANDLER: device doesn't support the rx_handler hook
1436 * @IFF_FAILOVER: device is a failover master device
1437 * @IFF_FAILOVER_SLAVE: device is lower dev of a failover master device
1404 */ 1438 */
1405enum netdev_priv_flags { 1439enum netdev_priv_flags {
1406 IFF_802_1Q_VLAN = 1<<0, 1440 IFF_802_1Q_VLAN = 1<<0,
@@ -1430,6 +1464,8 @@ enum netdev_priv_flags {
1430 IFF_PHONY_HEADROOM = 1<<24, 1464 IFF_PHONY_HEADROOM = 1<<24,
1431 IFF_MACSEC = 1<<25, 1465 IFF_MACSEC = 1<<25,
1432 IFF_NO_RX_HANDLER = 1<<26, 1466 IFF_NO_RX_HANDLER = 1<<26,
1467 IFF_FAILOVER = 1<<27,
1468 IFF_FAILOVER_SLAVE = 1<<28,
1433}; 1469};
1434 1470
1435#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN 1471#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1458,6 +1494,8 @@ enum netdev_priv_flags {
1458#define IFF_RXFH_CONFIGURED IFF_RXFH_CONFIGURED 1494#define IFF_RXFH_CONFIGURED IFF_RXFH_CONFIGURED
1459#define IFF_MACSEC IFF_MACSEC 1495#define IFF_MACSEC IFF_MACSEC
1460#define IFF_NO_RX_HANDLER IFF_NO_RX_HANDLER 1496#define IFF_NO_RX_HANDLER IFF_NO_RX_HANDLER
1497#define IFF_FAILOVER IFF_FAILOVER
1498#define IFF_FAILOVER_SLAVE IFF_FAILOVER_SLAVE
1461 1499
1462/** 1500/**
1463 * struct net_device - The DEVICE structure. 1501 * struct net_device - The DEVICE structure.
@@ -1750,6 +1788,10 @@ struct net_device {
1750 const struct xfrmdev_ops *xfrmdev_ops; 1788 const struct xfrmdev_ops *xfrmdev_ops;
1751#endif 1789#endif
1752 1790
1791#if IS_ENABLED(CONFIG_TLS_DEVICE)
1792 const struct tlsdev_ops *tlsdev_ops;
1793#endif
1794
1753 const struct header_ops *header_ops; 1795 const struct header_ops *header_ops;
1754 1796
1755 unsigned int flags; 1797 unsigned int flags;
@@ -2304,8 +2346,19 @@ enum netdev_lag_tx_type {
2304 NETDEV_LAG_TX_TYPE_HASH, 2346 NETDEV_LAG_TX_TYPE_HASH,
2305}; 2347};
2306 2348
2349enum netdev_lag_hash {
2350 NETDEV_LAG_HASH_NONE,
2351 NETDEV_LAG_HASH_L2,
2352 NETDEV_LAG_HASH_L34,
2353 NETDEV_LAG_HASH_L23,
2354 NETDEV_LAG_HASH_E23,
2355 NETDEV_LAG_HASH_E34,
2356 NETDEV_LAG_HASH_UNKNOWN,
2357};
2358
2307struct netdev_lag_upper_info { 2359struct netdev_lag_upper_info {
2308 enum netdev_lag_tx_type tx_type; 2360 enum netdev_lag_tx_type tx_type;
2361 enum netdev_lag_hash hash_type;
2309}; 2362};
2310 2363
2311struct netdev_lag_lower_state_info { 2364struct netdev_lag_lower_state_info {
@@ -2486,6 +2539,7 @@ void dev_disable_lro(struct net_device *dev);
2486int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb); 2539int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb);
2487int dev_queue_xmit(struct sk_buff *skb); 2540int dev_queue_xmit(struct sk_buff *skb);
2488int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv); 2541int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv);
2542int dev_direct_xmit(struct sk_buff *skb, u16 queue_id);
2489int register_netdevice(struct net_device *dev); 2543int register_netdevice(struct net_device *dev);
2490void unregister_netdevice_queue(struct net_device *dev, struct list_head *head); 2544void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
2491void unregister_netdevice_many(struct list_head *head); 2545void unregister_netdevice_many(struct list_head *head);
@@ -3213,19 +3267,6 @@ static inline int netif_set_xps_queue(struct net_device *dev,
3213} 3267}
3214#endif 3268#endif
3215 3269
3216u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb,
3217 unsigned int num_tx_queues);
3218
3219/*
3220 * Returns a Tx hash for the given packet when dev->real_num_tx_queues is used
3221 * as a distribution range limit for the returned value.
3222 */
3223static inline u16 skb_tx_hash(const struct net_device *dev,
3224 struct sk_buff *skb)
3225{
3226 return __skb_tx_hash(dev, skb, dev->real_num_tx_queues);
3227}
3228
3229/** 3270/**
3230 * netif_is_multiqueue - test if device has multiple transmit queues 3271 * netif_is_multiqueue - test if device has multiple transmit queues
3231 * @dev: network device 3272 * @dev: network device
@@ -4186,6 +4227,7 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)
4186 BUILD_BUG_ON(SKB_GSO_SCTP != (NETIF_F_GSO_SCTP >> NETIF_F_GSO_SHIFT)); 4227 BUILD_BUG_ON(SKB_GSO_SCTP != (NETIF_F_GSO_SCTP >> NETIF_F_GSO_SHIFT));
4187 BUILD_BUG_ON(SKB_GSO_ESP != (NETIF_F_GSO_ESP >> NETIF_F_GSO_SHIFT)); 4228 BUILD_BUG_ON(SKB_GSO_ESP != (NETIF_F_GSO_ESP >> NETIF_F_GSO_SHIFT));
4188 BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_GSO_UDP >> NETIF_F_GSO_SHIFT)); 4229 BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_GSO_UDP >> NETIF_F_GSO_SHIFT));
4230 BUILD_BUG_ON(SKB_GSO_UDP_L4 != (NETIF_F_GSO_UDP_L4 >> NETIF_F_GSO_SHIFT));
4189 4231
4190 return (features & feature) == feature; 4232 return (features & feature) == feature;
4191} 4233}
@@ -4308,6 +4350,16 @@ static inline bool netif_is_rxfh_configured(const struct net_device *dev)
4308 return dev->priv_flags & IFF_RXFH_CONFIGURED; 4350 return dev->priv_flags & IFF_RXFH_CONFIGURED;
4309} 4351}
4310 4352
4353static inline bool netif_is_failover(const struct net_device *dev)
4354{
4355 return dev->priv_flags & IFF_FAILOVER;
4356}
4357
4358static inline bool netif_is_failover_slave(const struct net_device *dev)
4359{
4360 return dev->priv_flags & IFF_FAILOVER_SLAVE;
4361}
4362
4311/* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */ 4363/* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */
4312static inline void netif_keep_dst(struct net_device *dev) 4364static inline void netif_keep_dst(struct net_device *dev)
4313{ 4365{
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 85a1a0b32c66..04551af2ff23 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -67,7 +67,6 @@ struct nf_hook_ops {
67 struct net_device *dev; 67 struct net_device *dev;
68 void *priv; 68 void *priv;
69 u_int8_t pf; 69 u_int8_t pf;
70 bool nat_hook;
71 unsigned int hooknum; 70 unsigned int hooknum;
72 /* Hooks are ordered in ascending priority. */ 71 /* Hooks are ordered in ascending priority. */
73 int priority; 72 int priority;
@@ -321,18 +320,33 @@ int nf_route(struct net *net, struct dst_entry **dst, struct flowi *fl,
321int nf_reroute(struct sk_buff *skb, struct nf_queue_entry *entry); 320int nf_reroute(struct sk_buff *skb, struct nf_queue_entry *entry);
322 321
323#include <net/flow.h> 322#include <net/flow.h>
324extern void (*nf_nat_decode_session_hook)(struct sk_buff *, struct flowi *); 323
324struct nf_conn;
325enum nf_nat_manip_type;
326struct nlattr;
327enum ip_conntrack_dir;
328
329struct nf_nat_hook {
330 int (*parse_nat_setup)(struct nf_conn *ct, enum nf_nat_manip_type manip,
331 const struct nlattr *attr);
332 void (*decode_session)(struct sk_buff *skb, struct flowi *fl);
333 unsigned int (*manip_pkt)(struct sk_buff *skb, struct nf_conn *ct,
334 enum nf_nat_manip_type mtype,
335 enum ip_conntrack_dir dir);
336};
337
338extern struct nf_nat_hook __rcu *nf_nat_hook;
325 339
326static inline void 340static inline void
327nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) 341nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
328{ 342{
329#ifdef CONFIG_NF_NAT_NEEDED 343#ifdef CONFIG_NF_NAT_NEEDED
330 void (*decodefn)(struct sk_buff *, struct flowi *); 344 struct nf_nat_hook *nat_hook;
331 345
332 rcu_read_lock(); 346 rcu_read_lock();
333 decodefn = rcu_dereference(nf_nat_decode_session_hook); 347 nat_hook = rcu_dereference(nf_nat_hook);
334 if (decodefn) 348 if (nat_hook->decode_session)
335 decodefn(skb, fl); 349 nat_hook->decode_session(skb, fl);
336 rcu_read_unlock(); 350 rcu_read_unlock();
337#endif 351#endif
338} 352}
@@ -374,13 +388,19 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
374 388
375extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu; 389extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu;
376void nf_ct_attach(struct sk_buff *, const struct sk_buff *); 390void nf_ct_attach(struct sk_buff *, const struct sk_buff *);
377extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu;
378#else 391#else
379static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 392static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
380#endif 393#endif
381 394
382struct nf_conn; 395struct nf_conn;
383enum ip_conntrack_info; 396enum ip_conntrack_info;
397
398struct nf_ct_hook {
399 int (*update)(struct net *net, struct sk_buff *skb);
400 void (*destroy)(struct nf_conntrack *);
401};
402extern struct nf_ct_hook __rcu *nf_ct_hook;
403
384struct nlattr; 404struct nlattr;
385 405
386struct nfnl_ct_hook { 406struct nfnl_ct_hook {
diff --git a/include/linux/netfilter/nf_osf.h b/include/linux/netfilter/nf_osf.h
new file mode 100644
index 000000000000..0e114c492fb8
--- /dev/null
+++ b/include/linux/netfilter/nf_osf.h
@@ -0,0 +1,33 @@
1#include <uapi/linux/netfilter/nf_osf.h>
2
3/* Initial window size option state machine: multiple of mss, mtu or
4 * plain numeric value. Can also be made as plain numeric value which
5 * is not a multiple of specified value.
6 */
7enum nf_osf_window_size_options {
8 OSF_WSS_PLAIN = 0,
9 OSF_WSS_MSS,
10 OSF_WSS_MTU,
11 OSF_WSS_MODULO,
12 OSF_WSS_MAX,
13};
14
15enum osf_fmatch_states {
16 /* Packet does not match the fingerprint */
17 FMATCH_WRONG = 0,
18 /* Packet matches the fingerprint */
19 FMATCH_OK,
20 /* Options do not match the fingerprint, but header does */
21 FMATCH_OPT_WRONG,
22};
23
24struct nf_osf_finger {
25 struct rcu_head rcu_head;
26 struct list_head finger_entry;
27 struct nf_osf_user_finger finger;
28};
29
30bool nf_osf_match(const struct sk_buff *skb, u_int8_t family,
31 int hooknum, struct net_device *in, struct net_device *out,
32 const struct nf_osf_info *info, struct net *net,
33 const struct list_head *nf_osf_fingers);
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 34551f8aaf9d..3ecc3050be0e 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -31,6 +31,7 @@ struct nfnetlink_subsystem {
31 const struct nfnl_callback *cb; /* callback for individual types */ 31 const struct nfnl_callback *cb; /* callback for individual types */
32 int (*commit)(struct net *net, struct sk_buff *skb); 32 int (*commit)(struct net *net, struct sk_buff *skb);
33 int (*abort)(struct net *net, struct sk_buff *skb); 33 int (*abort)(struct net *net, struct sk_buff *skb);
34 void (*cleanup)(struct net *net);
34 bool (*valid_genid)(struct net *net, u32 genid); 35 bool (*valid_genid)(struct net *net, u32 genid);
35}; 36};
36 37
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 0773b5a032f1..c6935be7c6ca 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -17,10 +17,6 @@
17#include <linux/if_ether.h> 17#include <linux/if_ether.h>
18#include <uapi/linux/netfilter_bridge/ebtables.h> 18#include <uapi/linux/netfilter_bridge/ebtables.h>
19 19
20/* return values for match() functions */
21#define EBT_MATCH 0
22#define EBT_NOMATCH 1
23
24struct ebt_match { 20struct ebt_match {
25 struct list_head list; 21 struct list_head list;
26 const char name[EBT_FUNCTION_MAXNAMELEN]; 22 const char name[EBT_FUNCTION_MAXNAMELEN];
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index bea0b0cd4bf7..1fa12887ec02 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -868,6 +868,7 @@ extern void perf_event_exit_task(struct task_struct *child);
868extern void perf_event_free_task(struct task_struct *task); 868extern void perf_event_free_task(struct task_struct *task);
869extern void perf_event_delayed_put(struct task_struct *task); 869extern void perf_event_delayed_put(struct task_struct *task);
870extern struct file *perf_event_get(unsigned int fd); 870extern struct file *perf_event_get(unsigned int fd);
871extern const struct perf_event *perf_get_event(struct file *file);
871extern const struct perf_event_attr *perf_event_attrs(struct perf_event *event); 872extern const struct perf_event_attr *perf_event_attrs(struct perf_event *event);
872extern void perf_event_print_debug(void); 873extern void perf_event_print_debug(void);
873extern void perf_pmu_disable(struct pmu *pmu); 874extern void perf_pmu_disable(struct pmu *pmu);
@@ -1297,6 +1298,10 @@ static inline void perf_event_exit_task(struct task_struct *child) { }
1297static inline void perf_event_free_task(struct task_struct *task) { } 1298static inline void perf_event_free_task(struct task_struct *task) { }
1298static inline void perf_event_delayed_put(struct task_struct *task) { } 1299static inline void perf_event_delayed_put(struct task_struct *task) { }
1299static inline struct file *perf_event_get(unsigned int fd) { return ERR_PTR(-EINVAL); } 1300static inline struct file *perf_event_get(unsigned int fd) { return ERR_PTR(-EINVAL); }
1301static inline const struct perf_event *perf_get_event(struct file *file)
1302{
1303 return ERR_PTR(-EINVAL);
1304}
1300static inline const struct perf_event_attr *perf_event_attrs(struct perf_event *event) 1305static inline const struct perf_event_attr *perf_event_attrs(struct perf_event *event)
1301{ 1306{
1302 return ERR_PTR(-EINVAL); 1307 return ERR_PTR(-EINVAL);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index f0b5870a6d40..6cd09098427c 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -406,13 +406,17 @@ struct phy_device {
406 u32 phy_id; 406 u32 phy_id;
407 407
408 struct phy_c45_device_ids c45_ids; 408 struct phy_c45_device_ids c45_ids;
409 bool is_c45; 409 unsigned is_c45:1;
410 bool is_internal; 410 unsigned is_internal:1;
411 bool is_pseudo_fixed_link; 411 unsigned is_pseudo_fixed_link:1;
412 bool has_fixups; 412 unsigned has_fixups:1;
413 bool suspended; 413 unsigned suspended:1;
414 bool sysfs_links; 414 unsigned sysfs_links:1;
415 bool loopback_enabled; 415 unsigned loopback_enabled:1;
416
417 unsigned autoneg:1;
418 /* The most recently read link state */
419 unsigned link:1;
416 420
417 enum phy_state state; 421 enum phy_state state;
418 422
@@ -429,9 +433,6 @@ struct phy_device {
429 int pause; 433 int pause;
430 int asym_pause; 434 int asym_pause;
431 435
432 /* The most recently read link state */
433 int link;
434
435 /* Enabled Interrupts */ 436 /* Enabled Interrupts */
436 u32 interrupts; 437 u32 interrupts;
437 438
@@ -444,8 +445,6 @@ struct phy_device {
444 /* Energy efficient ethernet modes which should be prohibited */ 445 /* Energy efficient ethernet modes which should be prohibited */
445 u32 eee_broken_modes; 446 u32 eee_broken_modes;
446 447
447 int autoneg;
448
449 int link_timeout; 448 int link_timeout;
450 449
451#ifdef CONFIG_LED_TRIGGER_PHY 450#ifdef CONFIG_LED_TRIGGER_PHY
@@ -1068,6 +1067,52 @@ int __init mdio_bus_init(void);
1068void mdio_bus_exit(void); 1067void mdio_bus_exit(void);
1069#endif 1068#endif
1070 1069
1070/* Inline function for use within net/core/ethtool.c (built-in) */
1071static inline int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data)
1072{
1073 if (!phydev->drv)
1074 return -EIO;
1075
1076 mutex_lock(&phydev->lock);
1077 phydev->drv->get_strings(phydev, data);
1078 mutex_unlock(&phydev->lock);
1079
1080 return 0;
1081}
1082
1083static inline int phy_ethtool_get_sset_count(struct phy_device *phydev)
1084{
1085 int ret;
1086
1087 if (!phydev->drv)
1088 return -EIO;
1089
1090 if (phydev->drv->get_sset_count &&
1091 phydev->drv->get_strings &&
1092 phydev->drv->get_stats) {
1093 mutex_lock(&phydev->lock);
1094 ret = phydev->drv->get_sset_count(phydev);
1095 mutex_unlock(&phydev->lock);
1096
1097 return ret;
1098 }
1099
1100 return -EOPNOTSUPP;
1101}
1102
1103static inline int phy_ethtool_get_stats(struct phy_device *phydev,
1104 struct ethtool_stats *stats, u64 *data)
1105{
1106 if (!phydev->drv)
1107 return -EIO;
1108
1109 mutex_lock(&phydev->lock);
1110 phydev->drv->get_stats(phydev, stats, data);
1111 mutex_unlock(&phydev->lock);
1112
1113 return 0;
1114}
1115
1071extern struct bus_type mdio_bus_type; 1116extern struct bus_type mdio_bus_type;
1072 1117
1073struct mdio_board_info { 1118struct mdio_board_info {
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index c9d14eeee7f5..9713aebdd348 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -36,6 +36,7 @@ enum phy_mode {
36 PHY_MODE_USB_DEVICE_SS, 36 PHY_MODE_USB_DEVICE_SS,
37 PHY_MODE_USB_OTG, 37 PHY_MODE_USB_OTG,
38 PHY_MODE_SGMII, 38 PHY_MODE_SGMII,
39 PHY_MODE_2500SGMII,
39 PHY_MODE_10GKR, 40 PHY_MODE_10GKR,
40 PHY_MODE_UFS_HS_A, 41 PHY_MODE_UFS_HS_A,
41 PHY_MODE_UFS_HS_B, 42 PHY_MODE_UFS_HS_B,
diff --git a/include/linux/platform_data/b53.h b/include/linux/platform_data/b53.h
index 69d279c0da96..8eaef2f2b691 100644
--- a/include/linux/platform_data/b53.h
+++ b/include/linux/platform_data/b53.h
@@ -20,8 +20,12 @@
20#define __B53_H 20#define __B53_H
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <net/dsa.h>
23 24
24struct b53_platform_data { 25struct b53_platform_data {
26 /* Must be first such that dsa_register_switch() can access it */
27 struct dsa_chip_data cd;
28
25 u32 chip_id; 29 u32 chip_id;
26 u16 enabled_ports; 30 u16 enabled_ports;
27 31
diff --git a/include/linux/platform_data/mdio-gpio.h b/include/linux/platform_data/mdio-gpio.h
deleted file mode 100644
index 11f00cdabe3d..000000000000
--- a/include/linux/platform_data/mdio-gpio.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * MDIO-GPIO bus platform data structures
3 *
4 * Copyright (C) 2008, Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#ifndef __LINUX_MDIO_GPIO_H
12#define __LINUX_MDIO_GPIO_H
13
14#include <linux/mdio-bitbang.h>
15
16struct mdio_gpio_platform_data {
17 /* GPIO numbers for bus pins */
18 unsigned int mdc;
19 unsigned int mdio;
20 unsigned int mdo;
21
22 bool mdc_active_low;
23 bool mdio_active_low;
24 bool mdo_active_low;
25
26 u32 phy_mask;
27 u32 phy_ignore_ta_mask;
28 int irqs[PHY_MAX_ADDR];
29 /* reset callback */
30 int (*reset)(struct mii_bus *bus);
31};
32
33#endif /* __LINUX_MDIO_GPIO_H */
diff --git a/include/linux/platform_data/mv88e6xxx.h b/include/linux/platform_data/mv88e6xxx.h
new file mode 100644
index 000000000000..f63af2955ea0
--- /dev/null
+++ b/include/linux/platform_data/mv88e6xxx.h
@@ -0,0 +1,18 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __DSA_MV88E6XXX_H
3#define __DSA_MV88E6XXX_H
4
5#include <net/dsa.h>
6
7struct dsa_mv88e6xxx_pdata {
8 /* Must be first, such that dsa_register_switch() can access this
9 * without gory pointer manipulations
10 */
11 struct dsa_chip_data cd;
12 const char *compatible;
13 unsigned int enabled_ports;
14 struct net_device *netdev;
15 u32 eeprom_len;
16};
17
18#endif
diff --git a/include/linux/qed/common_hsi.h b/include/linux/qed/common_hsi.h
index 13c8ab171437..0081fa6d1268 100644
--- a/include/linux/qed/common_hsi.h
+++ b/include/linux/qed/common_hsi.h
@@ -109,8 +109,8 @@
109#define MAX_NUM_LL2_TX_STATS_COUNTERS 48 109#define MAX_NUM_LL2_TX_STATS_COUNTERS 48
110 110
111#define FW_MAJOR_VERSION 8 111#define FW_MAJOR_VERSION 8
112#define FW_MINOR_VERSION 33 112#define FW_MINOR_VERSION 37
113#define FW_REVISION_VERSION 11 113#define FW_REVISION_VERSION 2
114#define FW_ENGINEERING_VERSION 0 114#define FW_ENGINEERING_VERSION 0
115 115
116/***********************/ 116/***********************/
diff --git a/include/linux/qed/iscsi_common.h b/include/linux/qed/iscsi_common.h
index 938df614cb6a..b34c573f2b30 100644
--- a/include/linux/qed/iscsi_common.h
+++ b/include/linux/qed/iscsi_common.h
@@ -799,8 +799,8 @@ struct e4_mstorm_iscsi_task_ag_ctx {
799#define E4_MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT 0 799#define E4_MSTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT 0
800#define E4_MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK 0x1 800#define E4_MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK 0x1
801#define E4_MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT 4 801#define E4_MSTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT 4
802#define E4_MSTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1 802#define E4_MSTORM_ISCSI_TASK_AG_CTX_CONN_CLEAR_SQ_FLAG_MASK 0x1
803#define E4_MSTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5 803#define E4_MSTORM_ISCSI_TASK_AG_CTX_CONN_CLEAR_SQ_FLAG_SHIFT 5
804#define E4_MSTORM_ISCSI_TASK_AG_CTX_VALID_MASK 0x1 804#define E4_MSTORM_ISCSI_TASK_AG_CTX_VALID_MASK 0x1
805#define E4_MSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT 6 805#define E4_MSTORM_ISCSI_TASK_AG_CTX_VALID_SHIFT 6
806#define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_MASK 0x1 806#define E4_MSTORM_ISCSI_TASK_AG_CTX_TASK_CLEANUP_FLAG_MASK 0x1
@@ -849,8 +849,8 @@ struct e4_ustorm_iscsi_task_ag_ctx {
849#define E4_USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT 0 849#define E4_USTORM_ISCSI_TASK_AG_CTX_CONNECTION_TYPE_SHIFT 0
850#define E4_USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK 0x1 850#define E4_USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_MASK 0x1
851#define E4_USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT 4 851#define E4_USTORM_ISCSI_TASK_AG_CTX_EXIST_IN_QM0_SHIFT 4
852#define E4_USTORM_ISCSI_TASK_AG_CTX_BIT1_MASK 0x1 852#define E4_USTORM_ISCSI_TASK_AG_CTX_CONN_CLEAR_SQ_FLAG_MASK 0x1
853#define E4_USTORM_ISCSI_TASK_AG_CTX_BIT1_SHIFT 5 853#define E4_USTORM_ISCSI_TASK_AG_CTX_CONN_CLEAR_SQ_FLAG_SHIFT 5
854#define E4_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_MASK 0x3 854#define E4_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_MASK 0x3
855#define E4_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_SHIFT 6 855#define E4_USTORM_ISCSI_TASK_AG_CTX_HQ_SCANNED_CF_SHIFT 6
856 u8 flags1; 856 u8 flags1;
diff --git a/include/linux/qed/qed_eth_if.h b/include/linux/qed/qed_eth_if.h
index 147d08ccf813..2978fa4add42 100644
--- a/include/linux/qed/qed_eth_if.h
+++ b/include/linux/qed/qed_eth_if.h
@@ -66,6 +66,7 @@ enum qed_filter_config_mode {
66 QED_FILTER_CONFIG_MODE_5_TUPLE, 66 QED_FILTER_CONFIG_MODE_5_TUPLE,
67 QED_FILTER_CONFIG_MODE_L4_PORT, 67 QED_FILTER_CONFIG_MODE_L4_PORT,
68 QED_FILTER_CONFIG_MODE_IP_DEST, 68 QED_FILTER_CONFIG_MODE_IP_DEST,
69 QED_FILTER_CONFIG_MODE_IP_SRC,
69}; 70};
70 71
71struct qed_ntuple_filter_params { 72struct qed_ntuple_filter_params {
@@ -88,6 +89,9 @@ struct qed_ntuple_filter_params {
88 89
89 /* true iff this filter is to be added. Else to be removed */ 90 /* true iff this filter is to be added. Else to be removed */
90 bool b_is_add; 91 bool b_is_add;
92
93 /* If flow needs to be dropped */
94 bool b_is_drop;
91}; 95};
92 96
93struct qed_dev_eth_info { 97struct qed_dev_eth_info {
@@ -352,6 +356,7 @@ struct qed_eth_ops {
352 int (*configure_arfs_searcher)(struct qed_dev *cdev, 356 int (*configure_arfs_searcher)(struct qed_dev *cdev,
353 enum qed_filter_config_mode mode); 357 enum qed_filter_config_mode mode);
354 int (*get_coalesce)(struct qed_dev *cdev, u16 *coal, void *handle); 358 int (*get_coalesce)(struct qed_dev *cdev, u16 *coal, void *handle);
359 int (*req_bulletin_update_mac)(struct qed_dev *cdev, u8 *mac);
355}; 360};
356 361
357const struct qed_eth_ops *qed_get_eth_ops(void); 362const struct qed_eth_ops *qed_get_eth_ops(void);
diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h
index b5b2bc9eacca..b4040023cbfb 100644
--- a/include/linux/qed/qed_if.h
+++ b/include/linux/qed/qed_if.h
@@ -159,6 +159,9 @@ struct qed_dcbx_get {
159enum qed_nvm_images { 159enum qed_nvm_images {
160 QED_NVM_IMAGE_ISCSI_CFG, 160 QED_NVM_IMAGE_ISCSI_CFG,
161 QED_NVM_IMAGE_FCOE_CFG, 161 QED_NVM_IMAGE_FCOE_CFG,
162 QED_NVM_IMAGE_NVM_CFG1,
163 QED_NVM_IMAGE_DEFAULT_CFG,
164 QED_NVM_IMAGE_NVM_META,
162}; 165};
163 166
164struct qed_link_eee_params { 167struct qed_link_eee_params {
@@ -179,6 +182,272 @@ enum qed_led_mode {
179 QED_LED_MODE_RESTORE 182 QED_LED_MODE_RESTORE
180}; 183};
181 184
185struct qed_mfw_tlv_eth {
186 u16 lso_maxoff_size;
187 bool lso_maxoff_size_set;
188 u16 lso_minseg_size;
189 bool lso_minseg_size_set;
190 u8 prom_mode;
191 bool prom_mode_set;
192 u16 tx_descr_size;
193 bool tx_descr_size_set;
194 u16 rx_descr_size;
195 bool rx_descr_size_set;
196 u16 netq_count;
197 bool netq_count_set;
198 u32 tcp4_offloads;
199 bool tcp4_offloads_set;
200 u32 tcp6_offloads;
201 bool tcp6_offloads_set;
202 u16 tx_descr_qdepth;
203 bool tx_descr_qdepth_set;
204 u16 rx_descr_qdepth;
205 bool rx_descr_qdepth_set;
206 u8 iov_offload;
207#define QED_MFW_TLV_IOV_OFFLOAD_NONE (0)
208#define QED_MFW_TLV_IOV_OFFLOAD_MULTIQUEUE (1)
209#define QED_MFW_TLV_IOV_OFFLOAD_VEB (2)
210#define QED_MFW_TLV_IOV_OFFLOAD_VEPA (3)
211 bool iov_offload_set;
212 u8 txqs_empty;
213 bool txqs_empty_set;
214 u8 rxqs_empty;
215 bool rxqs_empty_set;
216 u8 num_txqs_full;
217 bool num_txqs_full_set;
218 u8 num_rxqs_full;
219 bool num_rxqs_full_set;
220};
221
222#define QED_MFW_TLV_TIME_SIZE 14
223struct qed_mfw_tlv_time {
224 bool b_set;
225 u8 month;
226 u8 day;
227 u8 hour;
228 u8 min;
229 u16 msec;
230 u16 usec;
231};
232
233struct qed_mfw_tlv_fcoe {
234 u8 scsi_timeout;
235 bool scsi_timeout_set;
236 u32 rt_tov;
237 bool rt_tov_set;
238 u32 ra_tov;
239 bool ra_tov_set;
240 u32 ed_tov;
241 bool ed_tov_set;
242 u32 cr_tov;
243 bool cr_tov_set;
244 u8 boot_type;
245 bool boot_type_set;
246 u8 npiv_state;
247 bool npiv_state_set;
248 u32 num_npiv_ids;
249 bool num_npiv_ids_set;
250 u8 switch_name[8];
251 bool switch_name_set;
252 u16 switch_portnum;
253 bool switch_portnum_set;
254 u8 switch_portid[3];
255 bool switch_portid_set;
256 u8 vendor_name[8];
257 bool vendor_name_set;
258 u8 switch_model[8];
259 bool switch_model_set;
260 u8 switch_fw_version[8];
261 bool switch_fw_version_set;
262 u8 qos_pri;
263 bool qos_pri_set;
264 u8 port_alias[3];
265 bool port_alias_set;
266 u8 port_state;
267#define QED_MFW_TLV_PORT_STATE_OFFLINE (0)
268#define QED_MFW_TLV_PORT_STATE_LOOP (1)
269#define QED_MFW_TLV_PORT_STATE_P2P (2)
270#define QED_MFW_TLV_PORT_STATE_FABRIC (3)
271 bool port_state_set;
272 u16 fip_tx_descr_size;
273 bool fip_tx_descr_size_set;
274 u16 fip_rx_descr_size;
275 bool fip_rx_descr_size_set;
276 u16 link_failures;
277 bool link_failures_set;
278 u8 fcoe_boot_progress;
279 bool fcoe_boot_progress_set;
280 u64 rx_bcast;
281 bool rx_bcast_set;
282 u64 tx_bcast;
283 bool tx_bcast_set;
284 u16 fcoe_txq_depth;
285 bool fcoe_txq_depth_set;
286 u16 fcoe_rxq_depth;
287 bool fcoe_rxq_depth_set;
288 u64 fcoe_rx_frames;
289 bool fcoe_rx_frames_set;
290 u64 fcoe_rx_bytes;
291 bool fcoe_rx_bytes_set;
292 u64 fcoe_tx_frames;
293 bool fcoe_tx_frames_set;
294 u64 fcoe_tx_bytes;
295 bool fcoe_tx_bytes_set;
296 u16 crc_count;
297 bool crc_count_set;
298 u32 crc_err_src_fcid[5];
299 bool crc_err_src_fcid_set[5];
300 struct qed_mfw_tlv_time crc_err[5];
301 u16 losync_err;
302 bool losync_err_set;
303 u16 losig_err;
304 bool losig_err_set;
305 u16 primtive_err;
306 bool primtive_err_set;
307 u16 disparity_err;
308 bool disparity_err_set;
309 u16 code_violation_err;
310 bool code_violation_err_set;
311 u32 flogi_param[4];
312 bool flogi_param_set[4];
313 struct qed_mfw_tlv_time flogi_tstamp;
314 u32 flogi_acc_param[4];
315 bool flogi_acc_param_set[4];
316 struct qed_mfw_tlv_time flogi_acc_tstamp;
317 u32 flogi_rjt;
318 bool flogi_rjt_set;
319 struct qed_mfw_tlv_time flogi_rjt_tstamp;
320 u32 fdiscs;
321 bool fdiscs_set;
322 u8 fdisc_acc;
323 bool fdisc_acc_set;
324 u8 fdisc_rjt;
325 bool fdisc_rjt_set;
326 u8 plogi;
327 bool plogi_set;
328 u8 plogi_acc;
329 bool plogi_acc_set;
330 u8 plogi_rjt;
331 bool plogi_rjt_set;
332 u32 plogi_dst_fcid[5];
333 bool plogi_dst_fcid_set[5];
334 struct qed_mfw_tlv_time plogi_tstamp[5];
335 u32 plogi_acc_src_fcid[5];
336 bool plogi_acc_src_fcid_set[5];
337 struct qed_mfw_tlv_time plogi_acc_tstamp[5];
338 u8 tx_plogos;
339 bool tx_plogos_set;
340 u8 plogo_acc;
341 bool plogo_acc_set;
342 u8 plogo_rjt;
343 bool plogo_rjt_set;
344 u32 plogo_src_fcid[5];
345 bool plogo_src_fcid_set[5];
346 struct qed_mfw_tlv_time plogo_tstamp[5];
347 u8 rx_logos;
348 bool rx_logos_set;
349 u8 tx_accs;
350 bool tx_accs_set;
351 u8 tx_prlis;
352 bool tx_prlis_set;
353 u8 rx_accs;
354 bool rx_accs_set;
355 u8 tx_abts;
356 bool tx_abts_set;
357 u8 rx_abts_acc;
358 bool rx_abts_acc_set;
359 u8 rx_abts_rjt;
360 bool rx_abts_rjt_set;
361 u32 abts_dst_fcid[5];
362 bool abts_dst_fcid_set[5];
363 struct qed_mfw_tlv_time abts_tstamp[5];
364 u8 rx_rscn;
365 bool rx_rscn_set;
366 u32 rx_rscn_nport[4];
367 bool rx_rscn_nport_set[4];
368 u8 tx_lun_rst;
369 bool tx_lun_rst_set;
370 u8 abort_task_sets;
371 bool abort_task_sets_set;
372 u8 tx_tprlos;
373 bool tx_tprlos_set;
374 u8 tx_nos;
375 bool tx_nos_set;
376 u8 rx_nos;
377 bool rx_nos_set;
378 u8 ols;
379 bool ols_set;
380 u8 lr;
381 bool lr_set;
382 u8 lrr;
383 bool lrr_set;
384 u8 tx_lip;
385 bool tx_lip_set;
386 u8 rx_lip;
387 bool rx_lip_set;
388 u8 eofa;
389 bool eofa_set;
390 u8 eofni;
391 bool eofni_set;
392 u8 scsi_chks;
393 bool scsi_chks_set;
394 u8 scsi_cond_met;
395 bool scsi_cond_met_set;
396 u8 scsi_busy;
397 bool scsi_busy_set;
398 u8 scsi_inter;
399 bool scsi_inter_set;
400 u8 scsi_inter_cond_met;
401 bool scsi_inter_cond_met_set;
402 u8 scsi_rsv_conflicts;
403 bool scsi_rsv_conflicts_set;
404 u8 scsi_tsk_full;
405 bool scsi_tsk_full_set;
406 u8 scsi_aca_active;
407 bool scsi_aca_active_set;
408 u8 scsi_tsk_abort;
409 bool scsi_tsk_abort_set;
410 u32 scsi_rx_chk[5];
411 bool scsi_rx_chk_set[5];
412 struct qed_mfw_tlv_time scsi_chk_tstamp[5];
413};
414
415struct qed_mfw_tlv_iscsi {
416 u8 target_llmnr;
417 bool target_llmnr_set;
418 u8 header_digest;
419 bool header_digest_set;
420 u8 data_digest;
421 bool data_digest_set;
422 u8 auth_method;
423#define QED_MFW_TLV_AUTH_METHOD_NONE (1)
424#define QED_MFW_TLV_AUTH_METHOD_CHAP (2)
425#define QED_MFW_TLV_AUTH_METHOD_MUTUAL_CHAP (3)
426 bool auth_method_set;
427 u16 boot_taget_portal;
428 bool boot_taget_portal_set;
429 u16 frame_size;
430 bool frame_size_set;
431 u16 tx_desc_size;
432 bool tx_desc_size_set;
433 u16 rx_desc_size;
434 bool rx_desc_size_set;
435 u8 boot_progress;
436 bool boot_progress_set;
437 u16 tx_desc_qdepth;
438 bool tx_desc_qdepth_set;
439 u16 rx_desc_qdepth;
440 bool rx_desc_qdepth_set;
441 u64 rx_frames;
442 bool rx_frames_set;
443 u64 rx_bytes;
444 bool rx_bytes_set;
445 u64 tx_frames;
446 bool tx_frames_set;
447 u64 tx_bytes;
448 bool tx_bytes_set;
449};
450
182#define DIRECT_REG_WR(reg_addr, val) writel((u32)val, \ 451#define DIRECT_REG_WR(reg_addr, val) writel((u32)val, \
183 (void __iomem *)(reg_addr)) 452 (void __iomem *)(reg_addr))
184 453
@@ -336,7 +605,6 @@ struct qed_dev_info {
336 u8 num_hwfns; 605 u8 num_hwfns;
337 606
338 u8 hw_mac[ETH_ALEN]; 607 u8 hw_mac[ETH_ALEN];
339 bool is_mf_default;
340 608
341 /* FW version */ 609 /* FW version */
342 u16 fw_major; 610 u16 fw_major;
@@ -356,7 +624,7 @@ struct qed_dev_info {
356#define QED_MFW_VERSION_3_OFFSET 24 624#define QED_MFW_VERSION_3_OFFSET 24
357 625
358 u32 flash_size; 626 u32 flash_size;
359 u8 mf_mode; 627 bool b_inter_pf_switch;
360 bool tx_switching; 628 bool tx_switching;
361 bool rdma_supported; 629 bool rdma_supported;
362 u16 mtu; 630 u16 mtu;
@@ -483,6 +751,14 @@ struct qed_int_info {
483 u8 used_cnt; 751 u8 used_cnt;
484}; 752};
485 753
754struct qed_generic_tlvs {
755#define QED_TLV_IP_CSUM BIT(0)
756#define QED_TLV_LSO BIT(1)
757 u16 feat_flags;
758#define QED_TLV_MAC_COUNT 3
759 u8 mac[QED_TLV_MAC_COUNT][ETH_ALEN];
760};
761
486#define QED_NVM_SIGNATURE 0x12435687 762#define QED_NVM_SIGNATURE 0x12435687
487 763
488enum qed_nvm_flash_cmd { 764enum qed_nvm_flash_cmd {
@@ -497,6 +773,8 @@ struct qed_common_cb_ops {
497 void (*link_update)(void *dev, 773 void (*link_update)(void *dev,
498 struct qed_link_output *link); 774 struct qed_link_output *link);
499 void (*dcbx_aen)(void *dev, struct qed_dcbx_get *get, u32 mib_type); 775 void (*dcbx_aen)(void *dev, struct qed_dcbx_get *get, u32 mib_type);
776 void (*get_generic_tlv_data)(void *dev, struct qed_generic_tlvs *data);
777 void (*get_protocol_tlv_data)(void *dev, void *data);
500}; 778};
501 779
502struct qed_selftest_ops { 780struct qed_selftest_ops {
@@ -851,6 +1129,7 @@ struct qed_eth_stats_common {
851 u64 rx_bcast_pkts; 1129 u64 rx_bcast_pkts;
852 u64 mftag_filter_discards; 1130 u64 mftag_filter_discards;
853 u64 mac_filter_discards; 1131 u64 mac_filter_discards;
1132 u64 gft_filter_drop;
854 u64 tx_ucast_bytes; 1133 u64 tx_ucast_bytes;
855 u64 tx_mcast_bytes; 1134 u64 tx_mcast_bytes;
856 u64 tx_bcast_bytes; 1135 u64 tx_bcast_bytes;
@@ -901,6 +1180,7 @@ struct qed_eth_stats_common {
901 u64 tx_mac_mc_packets; 1180 u64 tx_mac_mc_packets;
902 u64 tx_mac_bc_packets; 1181 u64 tx_mac_bc_packets;
903 u64 tx_mac_ctrl_frames; 1182 u64 tx_mac_ctrl_frames;
1183 u64 link_change_count;
904}; 1184};
905 1185
906struct qed_eth_stats_bb { 1186struct qed_eth_stats_bb {
diff --git a/include/linux/qed/qed_ll2_if.h b/include/linux/qed/qed_ll2_if.h
index 266c1fb45387..5eb022953aca 100644
--- a/include/linux/qed/qed_ll2_if.h
+++ b/include/linux/qed/qed_ll2_if.h
@@ -202,6 +202,7 @@ struct qed_ll2_tx_pkt_info {
202 bool enable_ip_cksum; 202 bool enable_ip_cksum;
203 bool enable_l4_cksum; 203 bool enable_l4_cksum;
204 bool calc_ip_len; 204 bool calc_ip_len;
205 bool remove_stag;
205}; 206};
206 207
207#define QED_LL2_UNUSED_HANDLE (0xff) 208#define QED_LL2_UNUSED_HANDLE (0xff)
@@ -220,6 +221,11 @@ struct qed_ll2_params {
220 u8 ll2_mac_address[ETH_ALEN]; 221 u8 ll2_mac_address[ETH_ALEN];
221}; 222};
222 223
224enum qed_ll2_xmit_flags {
225 /* FIP discovery packet */
226 QED_LL2_XMIT_FLAGS_FIP_DISCOVERY
227};
228
223struct qed_ll2_ops { 229struct qed_ll2_ops {
224/** 230/**
225 * @brief start - initializes ll2 231 * @brief start - initializes ll2
@@ -245,10 +251,12 @@ struct qed_ll2_ops {
245 * 251 *
246 * @param cdev 252 * @param cdev
247 * @param skb 253 * @param skb
254 * @param xmit_flags - Transmit options defined by the enum qed_ll2_xmit_flags.
248 * 255 *
249 * @return 0 on success, otherwise error value. 256 * @return 0 on success, otherwise error value.
250 */ 257 */
251 int (*start_xmit)(struct qed_dev *cdev, struct sk_buff *skb); 258 int (*start_xmit)(struct qed_dev *cdev, struct sk_buff *skb,
259 unsigned long xmit_flags);
252 260
253/** 261/**
254 * @brief register_cb_ops - protocol driver register the callback for Rx/Tx 262 * @brief register_cb_ops - protocol driver register the callback for Rx/Tx
diff --git a/include/linux/qed/qed_rdma_if.h b/include/linux/qed/qed_rdma_if.h
index 4dd72ba210f5..df4d13f7e191 100644
--- a/include/linux/qed/qed_rdma_if.h
+++ b/include/linux/qed/qed_rdma_if.h
@@ -65,8 +65,7 @@ enum qed_roce_qp_state {
65enum qed_rdma_tid_type { 65enum qed_rdma_tid_type {
66 QED_RDMA_TID_REGISTERED_MR, 66 QED_RDMA_TID_REGISTERED_MR,
67 QED_RDMA_TID_FMR, 67 QED_RDMA_TID_FMR,
68 QED_RDMA_TID_MW_TYPE1, 68 QED_RDMA_TID_MW
69 QED_RDMA_TID_MW_TYPE2A
70}; 69};
71 70
72struct qed_rdma_events { 71struct qed_rdma_events {
@@ -280,7 +279,6 @@ struct qed_rdma_register_tid_in_params {
280 279
281 bool dif_enabled; 280 bool dif_enabled;
282 u64 dif_error_addr; 281 u64 dif_error_addr;
283 u64 dif_runt_addr;
284}; 282};
285 283
286struct qed_rdma_create_cq_in_params { 284struct qed_rdma_create_cq_in_params {
@@ -485,7 +483,9 @@ enum qed_iwarp_event_type {
485 QED_IWARP_EVENT_ACTIVE_MPA_REPLY, 483 QED_IWARP_EVENT_ACTIVE_MPA_REPLY,
486 QED_IWARP_EVENT_LOCAL_ACCESS_ERROR, 484 QED_IWARP_EVENT_LOCAL_ACCESS_ERROR,
487 QED_IWARP_EVENT_REMOTE_OPERATION_ERROR, 485 QED_IWARP_EVENT_REMOTE_OPERATION_ERROR,
488 QED_IWARP_EVENT_TERMINATE_RECEIVED 486 QED_IWARP_EVENT_TERMINATE_RECEIVED,
487 QED_IWARP_EVENT_SRQ_LIMIT,
488 QED_IWARP_EVENT_SRQ_EMPTY,
489}; 489};
490 490
491enum qed_tcp_ip_version { 491enum qed_tcp_ip_version {
@@ -646,6 +646,14 @@ struct qed_rdma_ops {
646 int (*rdma_alloc_tid)(void *rdma_cxt, u32 *itid); 646 int (*rdma_alloc_tid)(void *rdma_cxt, u32 *itid);
647 void (*rdma_free_tid)(void *rdma_cxt, u32 itid); 647 void (*rdma_free_tid)(void *rdma_cxt, u32 itid);
648 648
649 int (*rdma_create_srq)(void *rdma_cxt,
650 struct qed_rdma_create_srq_in_params *iparams,
651 struct qed_rdma_create_srq_out_params *oparams);
652 int (*rdma_destroy_srq)(void *rdma_cxt,
653 struct qed_rdma_destroy_srq_in_params *iparams);
654 int (*rdma_modify_srq)(void *rdma_cxt,
655 struct qed_rdma_modify_srq_in_params *iparams);
656
649 int (*ll2_acquire_connection)(void *rdma_cxt, 657 int (*ll2_acquire_connection)(void *rdma_cxt,
650 struct qed_ll2_acquire_data *data); 658 struct qed_ll2_acquire_data *data);
651 659
diff --git a/include/linux/qed/roce_common.h b/include/linux/qed/roce_common.h
index 193bcef302e1..473fba76aa77 100644
--- a/include/linux/qed/roce_common.h
+++ b/include/linux/qed/roce_common.h
@@ -43,6 +43,7 @@
43#define ROCE_MAX_QPS (32 * 1024) 43#define ROCE_MAX_QPS (32 * 1024)
44#define ROCE_DCQCN_NP_MAX_QPS (64) 44#define ROCE_DCQCN_NP_MAX_QPS (64)
45#define ROCE_DCQCN_RP_MAX_QPS (64) 45#define ROCE_DCQCN_RP_MAX_QPS (64)
46#define ROCE_LKEY_MW_DIF_EN_BIT (28)
46 47
47/* Affiliated asynchronous events / errors enumeration */ 48/* Affiliated asynchronous events / errors enumeration */
48enum roce_async_events_type { 49enum roce_async_events_type {
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index 1f8ad121eb43..4e1f535c2034 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -836,9 +836,8 @@ out:
836 * 836 *
837 * It is safe to call this function from atomic context. 837 * It is safe to call this function from atomic context.
838 * 838 *
839 * Will trigger an automatic deferred table resizing if the size grows 839 * Will trigger an automatic deferred table resizing if residency in the
840 * beyond the watermark indicated by grow_decision() which can be passed 840 * table grows beyond 70%.
841 * to rhashtable_init().
842 */ 841 */
843static inline int rhashtable_insert_fast( 842static inline int rhashtable_insert_fast(
844 struct rhashtable *ht, struct rhash_head *obj, 843 struct rhashtable *ht, struct rhash_head *obj,
@@ -866,9 +865,8 @@ static inline int rhashtable_insert_fast(
866 * 865 *
867 * It is safe to call this function from atomic context. 866 * It is safe to call this function from atomic context.
868 * 867 *
869 * Will trigger an automatic deferred table resizing if the size grows 868 * Will trigger an automatic deferred table resizing if residency in the
870 * beyond the watermark indicated by grow_decision() which can be passed 869 * table grows beyond 70%.
871 * to rhashtable_init().
872 */ 870 */
873static inline int rhltable_insert_key( 871static inline int rhltable_insert_key(
874 struct rhltable *hlt, const void *key, struct rhlist_head *list, 872 struct rhltable *hlt, const void *key, struct rhlist_head *list,
@@ -890,9 +888,8 @@ static inline int rhltable_insert_key(
890 * 888 *
891 * It is safe to call this function from atomic context. 889 * It is safe to call this function from atomic context.
892 * 890 *
893 * Will trigger an automatic deferred table resizing if the size grows 891 * Will trigger an automatic deferred table resizing if residency in the
894 * beyond the watermark indicated by grow_decision() which can be passed 892 * table grows beyond 70%.
895 * to rhashtable_init().
896 */ 893 */
897static inline int rhltable_insert( 894static inline int rhltable_insert(
898 struct rhltable *hlt, struct rhlist_head *list, 895 struct rhltable *hlt, struct rhlist_head *list,
@@ -922,9 +919,8 @@ static inline int rhltable_insert(
922 * 919 *
923 * It is safe to call this function from atomic context. 920 * It is safe to call this function from atomic context.
924 * 921 *
925 * Will trigger an automatic deferred table resizing if the size grows 922 * Will trigger an automatic deferred table resizing if residency in the
926 * beyond the watermark indicated by grow_decision() which can be passed 923 * table grows beyond 70%.
927 * to rhashtable_init().
928 */ 924 */
929static inline int rhashtable_lookup_insert_fast( 925static inline int rhashtable_lookup_insert_fast(
930 struct rhashtable *ht, struct rhash_head *obj, 926 struct rhashtable *ht, struct rhash_head *obj,
@@ -981,9 +977,8 @@ static inline void *rhashtable_lookup_get_insert_fast(
981 * 977 *
982 * Lookups may occur in parallel with hashtable mutations and resizing. 978 * Lookups may occur in parallel with hashtable mutations and resizing.
983 * 979 *
984 * Will trigger an automatic deferred table resizing if the size grows 980 * Will trigger an automatic deferred table resizing if residency in the
985 * beyond the watermark indicated by grow_decision() which can be passed 981 * table grows beyond 70%.
986 * to rhashtable_init().
987 * 982 *
988 * Returns zero on success. 983 * Returns zero on success.
989 */ 984 */
@@ -1134,8 +1129,8 @@ static inline int __rhashtable_remove_fast(
1134 * walk the bucket chain upon removal. The removal operation is thus 1129 * walk the bucket chain upon removal. The removal operation is thus
1135 * considerable slow if the hash table is not correctly sized. 1130 * considerable slow if the hash table is not correctly sized.
1136 * 1131 *
1137 * Will automatically shrink the table via rhashtable_expand() if the 1132 * Will automatically shrink the table if permitted when residency drops
1138 * shrink_decision function specified at rhashtable_init() returns true. 1133 * below 30%.
1139 * 1134 *
1140 * Returns zero on success, -ENOENT if the entry could not be found. 1135 * Returns zero on success, -ENOENT if the entry could not be found.
1141 */ 1136 */
@@ -1156,8 +1151,8 @@ static inline int rhashtable_remove_fast(
1156 * walk the bucket chain upon removal. The removal operation is thus 1151 * walk the bucket chain upon removal. The removal operation is thus
1157 * considerable slow if the hash table is not correctly sized. 1152 * considerable slow if the hash table is not correctly sized.
1158 * 1153 *
1159 * Will automatically shrink the table via rhashtable_expand() if the 1154 * Will automatically shrink the table if permitted when residency drops
1160 * shrink_decision function specified at rhashtable_init() returns true. 1155 * below 30%
1161 * 1156 *
1162 * Returns zero on success, -ENOENT if the entry could not be found. 1157 * Returns zero on success, -ENOENT if the entry could not be found.
1163 */ 1158 */
@@ -1273,8 +1268,9 @@ static inline int rhashtable_walk_init(struct rhashtable *ht,
1273 * For a completely stable walk you should construct your own data 1268 * For a completely stable walk you should construct your own data
1274 * structure outside the hash table. 1269 * structure outside the hash table.
1275 * 1270 *
1276 * This function may sleep so you must not call it from interrupt 1271 * This function may be called from any process context, including
1277 * context or with spin locks held. 1272 * non-preemptable context, but cannot be called from softirq or
1273 * hardirq context.
1278 * 1274 *
1279 * You must call rhashtable_walk_exit after this function returns. 1275 * You must call rhashtable_walk_exit after this function returns.
1280 */ 1276 */
diff --git a/include/linux/skb_array.h b/include/linux/skb_array.h
index a6b6e8bb3d7b..62d9b0a6329f 100644
--- a/include/linux/skb_array.h
+++ b/include/linux/skb_array.h
@@ -97,6 +97,11 @@ static inline bool skb_array_empty_any(struct skb_array *a)
97 return ptr_ring_empty_any(&a->ring); 97 return ptr_ring_empty_any(&a->ring);
98} 98}
99 99
100static inline struct sk_buff *__skb_array_consume(struct skb_array *a)
101{
102 return __ptr_ring_consume(&a->ring);
103}
104
100static inline struct sk_buff *skb_array_consume(struct skb_array *a) 105static inline struct sk_buff *skb_array_consume(struct skb_array *a)
101{ 106{
102 return ptr_ring_consume(&a->ring); 107 return ptr_ring_consume(&a->ring);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 89198379b39d..c86885954994 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -573,6 +573,8 @@ enum {
573 SKB_GSO_ESP = 1 << 15, 573 SKB_GSO_ESP = 1 << 15,
574 574
575 SKB_GSO_UDP = 1 << 16, 575 SKB_GSO_UDP = 1 << 16,
576
577 SKB_GSO_UDP_L4 = 1 << 17,
576}; 578};
577 579
578#if BITS_PER_LONG > 32 580#if BITS_PER_LONG > 32
@@ -852,8 +854,6 @@ struct sk_buff {
852/* 854/*
853 * Handling routines are only of interest to the kernel 855 * Handling routines are only of interest to the kernel
854 */ 856 */
855#include <linux/slab.h>
856
857 857
858#define SKB_ALLOC_FCLONE 0x01 858#define SKB_ALLOC_FCLONE 0x01
859#define SKB_ALLOC_RX 0x02 859#define SKB_ALLOC_RX 0x02
@@ -1032,6 +1032,7 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
1032struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 1032struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
1033int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); 1033int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
1034struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority); 1034struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority);
1035void skb_copy_header(struct sk_buff *new, const struct sk_buff *old);
1035struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority); 1036struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority);
1036struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom, 1037struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom,
1037 gfp_t gfp_mask, bool fclone); 1038 gfp_t gfp_mask, bool fclone);
@@ -1168,7 +1169,7 @@ void __skb_get_hash(struct sk_buff *skb);
1168u32 __skb_get_hash_symmetric(const struct sk_buff *skb); 1169u32 __skb_get_hash_symmetric(const struct sk_buff *skb);
1169u32 skb_get_poff(const struct sk_buff *skb); 1170u32 skb_get_poff(const struct sk_buff *skb);
1170u32 __skb_get_poff(const struct sk_buff *skb, void *data, 1171u32 __skb_get_poff(const struct sk_buff *skb, void *data,
1171 const struct flow_keys *keys, int hlen); 1172 const struct flow_keys_basic *keys, int hlen);
1172__be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto, 1173__be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto,
1173 void *data, int hlen_proto); 1174 void *data, int hlen_proto);
1174 1175
@@ -1205,13 +1206,14 @@ static inline bool skb_flow_dissect_flow_keys(const struct sk_buff *skb,
1205 NULL, 0, 0, 0, flags); 1206 NULL, 0, 0, 0, flags);
1206} 1207}
1207 1208
1208static inline bool skb_flow_dissect_flow_keys_buf(struct flow_keys *flow, 1209static inline bool
1209 void *data, __be16 proto, 1210skb_flow_dissect_flow_keys_basic(const struct sk_buff *skb,
1210 int nhoff, int hlen, 1211 struct flow_keys_basic *flow, void *data,
1211 unsigned int flags) 1212 __be16 proto, int nhoff, int hlen,
1213 unsigned int flags)
1212{ 1214{
1213 memset(flow, 0, sizeof(*flow)); 1215 memset(flow, 0, sizeof(*flow));
1214 return __skb_flow_dissect(NULL, &flow_keys_buf_dissector, flow, 1216 return __skb_flow_dissect(skb, &flow_keys_basic_dissector, flow,
1215 data, proto, nhoff, hlen, flags); 1217 data, proto, nhoff, hlen, flags);
1216} 1218}
1217 1219
@@ -2347,11 +2349,12 @@ static inline void skb_pop_mac_header(struct sk_buff *skb)
2347static inline void skb_probe_transport_header(struct sk_buff *skb, 2349static inline void skb_probe_transport_header(struct sk_buff *skb,
2348 const int offset_hint) 2350 const int offset_hint)
2349{ 2351{
2350 struct flow_keys keys; 2352 struct flow_keys_basic keys;
2351 2353
2352 if (skb_transport_header_was_set(skb)) 2354 if (skb_transport_header_was_set(skb))
2353 return; 2355 return;
2354 else if (skb_flow_dissect_flow_keys(skb, &keys, 0)) 2356
2357 if (skb_flow_dissect_flow_keys_basic(skb, &keys, 0, 0, 0, 0, 0))
2355 skb_set_transport_header(skb, keys.control.thoff); 2358 skb_set_transport_header(skb, keys.control.thoff);
2356 else 2359 else
2357 skb_set_transport_header(skb, offset_hint); 2360 skb_set_transport_header(skb, offset_hint);
@@ -3131,6 +3134,7 @@ static inline void *skb_push_rcsum(struct sk_buff *skb, unsigned int len)
3131 return skb->data; 3134 return skb->data;
3132} 3135}
3133 3136
3137int pskb_trim_rcsum_slow(struct sk_buff *skb, unsigned int len);
3134/** 3138/**
3135 * pskb_trim_rcsum - trim received skb and update checksum 3139 * pskb_trim_rcsum - trim received skb and update checksum
3136 * @skb: buffer to trim 3140 * @skb: buffer to trim
@@ -3144,9 +3148,7 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
3144{ 3148{
3145 if (likely(len >= skb->len)) 3149 if (likely(len >= skb->len))
3146 return 0; 3150 return 0;
3147 if (skb->ip_summed == CHECKSUM_COMPLETE) 3151 return pskb_trim_rcsum_slow(skb, len);
3148 skb->ip_summed = CHECKSUM_NONE;
3149 return __pskb_trim(skb, len);
3150} 3152}
3151 3153
3152static inline int __skb_trim_rcsum(struct sk_buff *skb, unsigned int len) 3154static inline int __skb_trim_rcsum(struct sk_buff *skb, unsigned int len)
diff --git a/include/linux/soc/ti/knav_dma.h b/include/linux/soc/ti/knav_dma.h
index 66693bc4c6ad..7127ec301537 100644
--- a/include/linux/soc/ti/knav_dma.h
+++ b/include/linux/soc/ti/knav_dma.h
@@ -167,6 +167,8 @@ struct knav_dma_desc {
167void *knav_dma_open_channel(struct device *dev, const char *name, 167void *knav_dma_open_channel(struct device *dev, const char *name,
168 struct knav_dma_cfg *config); 168 struct knav_dma_cfg *config);
169void knav_dma_close_channel(void *channel); 169void knav_dma_close_channel(void *channel);
170int knav_dma_get_flow(void *channel);
171bool knav_dma_device_ready(void);
170#else 172#else
171static inline void *knav_dma_open_channel(struct device *dev, const char *name, 173static inline void *knav_dma_open_channel(struct device *dev, const char *name,
172 struct knav_dma_cfg *config) 174 struct knav_dma_cfg *config)
@@ -176,6 +178,16 @@ static inline void *knav_dma_open_channel(struct device *dev, const char *name,
176static inline void knav_dma_close_channel(void *channel) 178static inline void knav_dma_close_channel(void *channel)
177{} 179{}
178 180
181static inline int knav_dma_get_flow(void *channel)
182{
183 return -EINVAL;
184}
185
186static inline bool knav_dma_device_ready(void)
187{
188 return false;
189}
190
179#endif 191#endif
180 192
181#endif /* __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__ */ 193#endif /* __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__ */
diff --git a/include/linux/soc/ti/knav_qmss.h b/include/linux/soc/ti/knav_qmss.h
index 9f0ebb3bad27..9745df6ed9d3 100644
--- a/include/linux/soc/ti/knav_qmss.h
+++ b/include/linux/soc/ti/knav_qmss.h
@@ -86,5 +86,6 @@ int knav_pool_desc_map(void *ph, void *desc, unsigned size,
86void *knav_pool_desc_unmap(void *ph, dma_addr_t dma, unsigned dma_sz); 86void *knav_pool_desc_unmap(void *ph, dma_addr_t dma, unsigned dma_sz);
87dma_addr_t knav_pool_desc_virt_to_dma(void *ph, void *virt); 87dma_addr_t knav_pool_desc_virt_to_dma(void *ph, void *virt);
88void *knav_pool_desc_dma_to_virt(void *ph, dma_addr_t dma); 88void *knav_pool_desc_dma_to_virt(void *ph, dma_addr_t dma);
89bool knav_qmss_device_ready(void);
89 90
90#endif /* __SOC_TI_KNAV_QMSS_H__ */ 91#endif /* __SOC_TI_KNAV_QMSS_H__ */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index ea50f4a65816..7ed4713d5337 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -207,8 +207,9 @@ struct ucred {
207 * PF_SMC protocol family that 207 * PF_SMC protocol family that
208 * reuses AF_INET address family 208 * reuses AF_INET address family
209 */ 209 */
210#define AF_XDP 44 /* XDP sockets */
210 211
211#define AF_MAX 44 /* For now.. */ 212#define AF_MAX 45 /* For now.. */
212 213
213/* Protocol families, same as address families. */ 214/* Protocol families, same as address families. */
214#define PF_UNSPEC AF_UNSPEC 215#define PF_UNSPEC AF_UNSPEC
@@ -257,6 +258,7 @@ struct ucred {
257#define PF_KCM AF_KCM 258#define PF_KCM AF_KCM
258#define PF_QIPCRTR AF_QIPCRTR 259#define PF_QIPCRTR AF_QIPCRTR
259#define PF_SMC AF_SMC 260#define PF_SMC AF_SMC
261#define PF_XDP AF_XDP
260#define PF_MAX AF_MAX 262#define PF_MAX AF_MAX
261 263
262/* Maximum queue length specifiable by listen. */ 264/* Maximum queue length specifiable by listen. */
@@ -338,6 +340,7 @@ struct ucred {
338#define SOL_NFC 280 340#define SOL_NFC 280
339#define SOL_KCM 281 341#define SOL_KCM 281
340#define SOL_TLS 282 342#define SOL_TLS 282
343#define SOL_XDP 283
341 344
342/* IPX options */ 345/* IPX options */
343#define IPX_TYPE 1 346#define IPX_TYPE 1
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 8f4c54986f97..72705eaf4b84 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -218,6 +218,7 @@ struct tcp_sock {
218 reord:1; /* reordering detected */ 218 reord:1; /* reordering detected */
219 } rack; 219 } rack;
220 u16 advmss; /* Advertised MSS */ 220 u16 advmss; /* Advertised MSS */
221 u8 compressed_ack;
221 u32 chrono_start; /* Start time in jiffies of a TCP chrono */ 222 u32 chrono_start; /* Start time in jiffies of a TCP chrono */
222 u32 chrono_stat[3]; /* Time in jiffies for chrono_stat stats */ 223 u32 chrono_stat[3]; /* Time in jiffies for chrono_stat stats */
223 u8 chrono_type:2, /* current chronograph type */ 224 u8 chrono_type:2, /* current chronograph type */
@@ -228,7 +229,7 @@ struct tcp_sock {
228 unused:2; 229 unused:2;
229 u8 nonagle : 4,/* Disable Nagle algorithm? */ 230 u8 nonagle : 4,/* Disable Nagle algorithm? */
230 thin_lto : 1,/* Use linear timeouts for thin streams */ 231 thin_lto : 1,/* Use linear timeouts for thin streams */
231 unused1 : 1, 232 recvmsg_inq : 1,/* Indicate # of bytes in queue upon recvmsg */
232 repair : 1, 233 repair : 1,
233 frto : 1;/* F-RTO (RFC5682) activated in CA_Loss */ 234 frto : 1;/* F-RTO (RFC5682) activated in CA_Loss */
234 u8 repair_queue; 235 u8 repair_queue;
@@ -281,6 +282,7 @@ struct tcp_sock {
281 * receiver in Recovery. */ 282 * receiver in Recovery. */
282 u32 prr_out; /* Total number of pkts sent during Recovery. */ 283 u32 prr_out; /* Total number of pkts sent during Recovery. */
283 u32 delivered; /* Total data packets delivered incl. rexmits */ 284 u32 delivered; /* Total data packets delivered incl. rexmits */
285 u32 delivered_ce; /* Like the above but only ECE marked packets */
284 u32 lost; /* Total data packets lost incl. rexmits */ 286 u32 lost; /* Total data packets lost incl. rexmits */
285 u32 app_limited; /* limited until "delivered" reaches this val */ 287 u32 app_limited; /* limited until "delivered" reaches this val */
286 u64 first_tx_mstamp; /* start of window send phase */ 288 u64 first_tx_mstamp; /* start of window send phase */
@@ -296,6 +298,7 @@ struct tcp_sock {
296 u32 sacked_out; /* SACK'd packets */ 298 u32 sacked_out; /* SACK'd packets */
297 299
298 struct hrtimer pacing_timer; 300 struct hrtimer pacing_timer;
301 struct hrtimer compressed_ack_timer;
299 302
300 /* from STCP, retrans queue hinting */ 303 /* from STCP, retrans queue hinting */
301 struct sk_buff* lost_skb_hint; 304 struct sk_buff* lost_skb_hint;
diff --git a/include/linux/tnum.h b/include/linux/tnum.h
index 0d2d3da46139..c7dc2b5902c0 100644
--- a/include/linux/tnum.h
+++ b/include/linux/tnum.h
@@ -23,8 +23,10 @@ struct tnum tnum_range(u64 min, u64 max);
23/* Arithmetic and logical ops */ 23/* Arithmetic and logical ops */
24/* Shift a tnum left (by a fixed shift) */ 24/* Shift a tnum left (by a fixed shift) */
25struct tnum tnum_lshift(struct tnum a, u8 shift); 25struct tnum tnum_lshift(struct tnum a, u8 shift);
26/* Shift a tnum right (by a fixed shift) */ 26/* Shift (rsh) a tnum right (by a fixed shift) */
27struct tnum tnum_rshift(struct tnum a, u8 shift); 27struct tnum tnum_rshift(struct tnum a, u8 shift);
28/* Shift (arsh) a tnum right (by a fixed min_shift) */
29struct tnum tnum_arshift(struct tnum a, u8 min_shift);
28/* Add two tnums, return @a + @b */ 30/* Add two tnums, return @a + @b */
29struct tnum tnum_add(struct tnum a, struct tnum b); 31struct tnum tnum_add(struct tnum a, struct tnum b);
30/* Subtract two tnums, return @a - @b */ 32/* Subtract two tnums, return @a - @b */
diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
index d1c442d9bd85..78a010e19ed4 100644
--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -472,6 +472,9 @@ int perf_event_query_prog_array(struct perf_event *event, void __user *info);
472int bpf_probe_register(struct bpf_raw_event_map *btp, struct bpf_prog *prog); 472int bpf_probe_register(struct bpf_raw_event_map *btp, struct bpf_prog *prog);
473int bpf_probe_unregister(struct bpf_raw_event_map *btp, struct bpf_prog *prog); 473int bpf_probe_unregister(struct bpf_raw_event_map *btp, struct bpf_prog *prog);
474struct bpf_raw_event_map *bpf_find_raw_tracepoint(const char *name); 474struct bpf_raw_event_map *bpf_find_raw_tracepoint(const char *name);
475int bpf_get_perf_event_info(const struct perf_event *event, u32 *prog_id,
476 u32 *fd_type, const char **buf,
477 u64 *probe_offset, u64 *probe_addr);
475#else 478#else
476static inline unsigned int trace_call_bpf(struct trace_event_call *call, void *ctx) 479static inline unsigned int trace_call_bpf(struct trace_event_call *call, void *ctx)
477{ 480{
@@ -503,6 +506,13 @@ static inline struct bpf_raw_event_map *bpf_find_raw_tracepoint(const char *name
503{ 506{
504 return NULL; 507 return NULL;
505} 508}
509static inline int bpf_get_perf_event_info(const struct perf_event *event,
510 u32 *prog_id, u32 *fd_type,
511 const char **buf, u64 *probe_offset,
512 u64 *probe_addr)
513{
514 return -EOPNOTSUPP;
515}
506#endif 516#endif
507 517
508enum { 518enum {
@@ -559,10 +569,17 @@ extern void perf_trace_del(struct perf_event *event, int flags);
559#ifdef CONFIG_KPROBE_EVENTS 569#ifdef CONFIG_KPROBE_EVENTS
560extern int perf_kprobe_init(struct perf_event *event, bool is_retprobe); 570extern int perf_kprobe_init(struct perf_event *event, bool is_retprobe);
561extern void perf_kprobe_destroy(struct perf_event *event); 571extern void perf_kprobe_destroy(struct perf_event *event);
572extern int bpf_get_kprobe_info(const struct perf_event *event,
573 u32 *fd_type, const char **symbol,
574 u64 *probe_offset, u64 *probe_addr,
575 bool perf_type_tracepoint);
562#endif 576#endif
563#ifdef CONFIG_UPROBE_EVENTS 577#ifdef CONFIG_UPROBE_EVENTS
564extern int perf_uprobe_init(struct perf_event *event, bool is_retprobe); 578extern int perf_uprobe_init(struct perf_event *event, bool is_retprobe);
565extern void perf_uprobe_destroy(struct perf_event *event); 579extern void perf_uprobe_destroy(struct perf_event *event);
580extern int bpf_get_uprobe_info(const struct perf_event *event,
581 u32 *fd_type, const char **filename,
582 u64 *probe_offset, bool perf_type_tracepoint);
566#endif 583#endif
567extern int ftrace_profile_set_filter(struct perf_event *event, int event_id, 584extern int ftrace_profile_set_filter(struct perf_event *event, int event_id,
568 char *filter_str); 585 char *filter_str);
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
index 07ee0f84a46c..a27604f99ed0 100644
--- a/include/linux/u64_stats_sync.h
+++ b/include/linux/u64_stats_sync.h
@@ -112,20 +112,6 @@ u64_stats_update_end_irqrestore(struct u64_stats_sync *syncp,
112#endif 112#endif
113} 113}
114 114
115static inline void u64_stats_update_begin_raw(struct u64_stats_sync *syncp)
116{
117#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
118 raw_write_seqcount_begin(&syncp->seq);
119#endif
120}
121
122static inline void u64_stats_update_end_raw(struct u64_stats_sync *syncp)
123{
124#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
125 raw_write_seqcount_end(&syncp->seq);
126#endif
127}
128
129static inline unsigned int __u64_stats_fetch_begin(const struct u64_stats_sync *syncp) 115static inline unsigned int __u64_stats_fetch_begin(const struct u64_stats_sync *syncp)
130{ 116{
131#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 117#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
diff --git a/include/linux/udp.h b/include/linux/udp.h
index eaea63bc79bb..ca840345571b 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -55,6 +55,7 @@ struct udp_sock {
55 * when the socket is uncorked. 55 * when the socket is uncorked.
56 */ 56 */
57 __u16 len; /* total length of pending frames */ 57 __u16 len; /* total length of pending frames */
58 __u16 gso_size;
58 /* 59 /*
59 * Fields specific to UDP-Lite. 60 * Fields specific to UDP-Lite.
60 */ 61 */
@@ -87,6 +88,8 @@ struct udp_sock {
87 int forward_deficit; 88 int forward_deficit;
88}; 89};
89 90
91#define UDP_MAX_SEGMENTS (1 << 6UL)
92
90static inline struct udp_sock *udp_sk(const struct sock *sk) 93static inline struct udp_sock *udp_sk(const struct sock *sk)
91{ 94{
92 return (struct udp_sock *)sk; 95 return (struct udp_sock *)sk;
diff --git a/include/linux/umh.h b/include/linux/umh.h
index 244aff638220..5c812acbb80a 100644
--- a/include/linux/umh.h
+++ b/include/linux/umh.h
@@ -22,8 +22,10 @@ struct subprocess_info {
22 const char *path; 22 const char *path;
23 char **argv; 23 char **argv;
24 char **envp; 24 char **envp;
25 struct file *file;
25 int wait; 26 int wait;
26 int retval; 27 int retval;
28 pid_t pid;
27 int (*init)(struct subprocess_info *info, struct cred *new); 29 int (*init)(struct subprocess_info *info, struct cred *new);
28 void (*cleanup)(struct subprocess_info *info); 30 void (*cleanup)(struct subprocess_info *info);
29 void *data; 31 void *data;
@@ -38,6 +40,16 @@ call_usermodehelper_setup(const char *path, char **argv, char **envp,
38 int (*init)(struct subprocess_info *info, struct cred *new), 40 int (*init)(struct subprocess_info *info, struct cred *new),
39 void (*cleanup)(struct subprocess_info *), void *data); 41 void (*cleanup)(struct subprocess_info *), void *data);
40 42
43struct subprocess_info *call_usermodehelper_setup_file(struct file *file,
44 int (*init)(struct subprocess_info *info, struct cred *new),
45 void (*cleanup)(struct subprocess_info *), void *data);
46struct umh_info {
47 struct file *pipe_to_umh;
48 struct file *pipe_from_umh;
49 pid_t pid;
50};
51int fork_usermode_blob(void *data, size_t len, struct umh_info *info);
52
41extern int 53extern int
42call_usermodehelper_exec(struct subprocess_info *info, int wait); 54call_usermodehelper_exec(struct subprocess_info *info, int wait);
43 55
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 378d601258be..5f43f7a70fe6 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -59,6 +59,19 @@ struct in6_validator_info {
59 struct netlink_ext_ack *extack; 59 struct netlink_ext_ack *extack;
60}; 60};
61 61
62struct ifa6_config {
63 const struct in6_addr *pfx;
64 unsigned int plen;
65
66 const struct in6_addr *peer_pfx;
67
68 u32 rt_priority;
69 u32 ifa_flags;
70 u32 preferred_lft;
71 u32 valid_lft;
72 u16 scope;
73};
74
62int addrconf_init(void); 75int addrconf_init(void);
63void addrconf_cleanup(void); 76void addrconf_cleanup(void);
64 77
@@ -223,6 +236,22 @@ struct ipv6_stub {
223 const struct in6_addr *addr); 236 const struct in6_addr *addr);
224 int (*ipv6_dst_lookup)(struct net *net, struct sock *sk, 237 int (*ipv6_dst_lookup)(struct net *net, struct sock *sk,
225 struct dst_entry **dst, struct flowi6 *fl6); 238 struct dst_entry **dst, struct flowi6 *fl6);
239
240 struct fib6_table *(*fib6_get_table)(struct net *net, u32 id);
241 struct fib6_info *(*fib6_lookup)(struct net *net, int oif,
242 struct flowi6 *fl6, int flags);
243 struct fib6_info *(*fib6_table_lookup)(struct net *net,
244 struct fib6_table *table,
245 int oif, struct flowi6 *fl6,
246 int flags);
247 struct fib6_info *(*fib6_multipath_select)(const struct net *net,
248 struct fib6_info *f6i,
249 struct flowi6 *fl6, int oif,
250 const struct sk_buff *skb,
251 int strict);
252 u32 (*ip6_mtu_from_fib6)(struct fib6_info *f6i, struct in6_addr *daddr,
253 struct in6_addr *saddr);
254
226 void (*udpv6_encap_enable)(void); 255 void (*udpv6_encap_enable)(void);
227 void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr, 256 void (*ndisc_send_na)(struct net_device *dev, const struct in6_addr *daddr,
228 const struct in6_addr *solicited_addr, 257 const struct in6_addr *solicited_addr,
@@ -308,6 +337,20 @@ static inline struct inet6_dev *__in6_dev_get(const struct net_device *dev)
308} 337}
309 338
310/** 339/**
340 * __in6_dev_get_safely - get inet6_dev pointer from netdevice
341 * @dev: network device
342 *
343 * This is a safer version of __in6_dev_get
344 */
345static inline struct inet6_dev *__in6_dev_get_safely(const struct net_device *dev)
346{
347 if (likely(dev))
348 return rcu_dereference_rtnl(dev->ip6_ptr);
349 else
350 return NULL;
351}
352
353/**
311 * in6_dev_get - get inet6_dev pointer from netdevice 354 * in6_dev_get - get inet6_dev pointer from netdevice
312 * @dev: network device 355 * @dev: network device
313 * 356 *
diff --git a/include/net/ax88796.h b/include/net/ax88796.h
index b9a3beca0ce4..84b3785d0e66 100644
--- a/include/net/ax88796.h
+++ b/include/net/ax88796.h
@@ -12,6 +12,10 @@
12#ifndef __NET_AX88796_PLAT_H 12#ifndef __NET_AX88796_PLAT_H
13#define __NET_AX88796_PLAT_H 13#define __NET_AX88796_PLAT_H
14 14
15struct sk_buff;
16struct net_device;
17struct platform_device;
18
15#define AXFLG_HAS_EEPROM (1<<0) 19#define AXFLG_HAS_EEPROM (1<<0)
16#define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ 20#define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */
17#define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */ 21#define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */
@@ -26,6 +30,16 @@ struct ax_plat_data {
26 u32 *reg_offsets; /* register offsets */ 30 u32 *reg_offsets; /* register offsets */
27 u8 *mac_addr; /* MAC addr (only used when 31 u8 *mac_addr; /* MAC addr (only used when
28 AXFLG_MAC_FROMPLATFORM is used */ 32 AXFLG_MAC_FROMPLATFORM is used */
33
34 /* uses default ax88796 buffer if set to NULL */
35 void (*block_output)(struct net_device *dev, int count,
36 const unsigned char *buf, int star_page);
37 void (*block_input)(struct net_device *dev, int count,
38 struct sk_buff *skb, int ring_offset);
39 /* returns nonzero if a pending interrupt request might by caused by
40 * the ax88786. Handles all interrupts if set to NULL
41 */
42 int (*check_irq)(struct platform_device *pdev);
29}; 43};
30 44
31#endif /* __NET_AX88796_PLAT_H */ 45#endif /* __NET_AX88796_PLAT_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index b619a190ff12..893bbbb5d2fa 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1393,6 +1393,8 @@ struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen,
1393 const void *param, u32 timeout); 1393 const void *param, u32 timeout);
1394struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, 1394struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen,
1395 const void *param, u8 event, u32 timeout); 1395 const void *param, u8 event, u32 timeout);
1396int __hci_cmd_send(struct hci_dev *hdev, u16 opcode, u32 plen,
1397 const void *param);
1396 1398
1397int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, 1399int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen,
1398 const void *param); 1400 const void *param);
diff --git a/include/net/bonding.h b/include/net/bonding.h
index b52235158836..808f1d167349 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -285,8 +285,15 @@ static inline bool bond_needs_speed_duplex(const struct bonding *bond)
285 285
286static inline bool bond_is_nondyn_tlb(const struct bonding *bond) 286static inline bool bond_is_nondyn_tlb(const struct bonding *bond)
287{ 287{
288 return (BOND_MODE(bond) == BOND_MODE_TLB) && 288 return (bond_is_lb(bond) && bond->params.tlb_dynamic_lb == 0);
289 (bond->params.tlb_dynamic_lb == 0); 289}
290
291static inline bool bond_mode_can_use_xmit_hash(const struct bonding *bond)
292{
293 return (BOND_MODE(bond) == BOND_MODE_8023AD ||
294 BOND_MODE(bond) == BOND_MODE_XOR ||
295 BOND_MODE(bond) == BOND_MODE_TLB ||
296 BOND_MODE(bond) == BOND_MODE_ALB);
290} 297}
291 298
292static inline bool bond_mode_uses_xmit_hash(const struct bonding *bond) 299static inline bool bond_mode_uses_xmit_hash(const struct bonding *bond)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 250dac390806..5fbfe61f41c6 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1080,6 +1080,37 @@ struct sta_bss_parameters {
1080}; 1080};
1081 1081
1082/** 1082/**
1083 * struct cfg80211_txq_stats - TXQ statistics for this TID
1084 * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
1085 * indicate the relevant values in this struct are filled
1086 * @backlog_bytes: total number of bytes currently backlogged
1087 * @backlog_packets: total number of packets currently backlogged
1088 * @flows: number of new flows seen
1089 * @drops: total number of packets dropped
1090 * @ecn_marks: total number of packets marked with ECN CE
1091 * @overlimit: number of drops due to queue space overflow
1092 * @overmemory: number of drops due to memory limit overflow
1093 * @collisions: number of hash collisions
1094 * @tx_bytes: total number of bytes dequeued
1095 * @tx_packets: total number of packets dequeued
1096 * @max_flows: maximum number of flows supported
1097 */
1098struct cfg80211_txq_stats {
1099 u32 filled;
1100 u32 backlog_bytes;
1101 u32 backlog_packets;
1102 u32 flows;
1103 u32 drops;
1104 u32 ecn_marks;
1105 u32 overlimit;
1106 u32 overmemory;
1107 u32 collisions;
1108 u32 tx_bytes;
1109 u32 tx_packets;
1110 u32 max_flows;
1111};
1112
1113/**
1083 * struct cfg80211_tid_stats - per-TID statistics 1114 * struct cfg80211_tid_stats - per-TID statistics
1084 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to 1115 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
1085 * indicate the relevant values in this struct are filled 1116 * indicate the relevant values in this struct are filled
@@ -1088,6 +1119,7 @@ struct sta_bss_parameters {
1088 * @tx_msdu_retries: number of retries (not counting the first) for 1119 * @tx_msdu_retries: number of retries (not counting the first) for
1089 * transmitted MSDUs 1120 * transmitted MSDUs
1090 * @tx_msdu_failed: number of failed transmitted MSDUs 1121 * @tx_msdu_failed: number of failed transmitted MSDUs
1122 * @txq_stats: TXQ statistics
1091 */ 1123 */
1092struct cfg80211_tid_stats { 1124struct cfg80211_tid_stats {
1093 u32 filled; 1125 u32 filled;
@@ -1095,6 +1127,7 @@ struct cfg80211_tid_stats {
1095 u64 tx_msdu; 1127 u64 tx_msdu;
1096 u64 tx_msdu_retries; 1128 u64 tx_msdu_retries;
1097 u64 tx_msdu_failed; 1129 u64 tx_msdu_failed;
1130 struct cfg80211_txq_stats txq_stats;
1098}; 1131};
1099 1132
1100#define IEEE80211_MAX_CHAINS 4 1133#define IEEE80211_MAX_CHAINS 4
@@ -1151,7 +1184,10 @@ struct cfg80211_tid_stats {
1151 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer 1184 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
1152 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last 1185 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
1153 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. 1186 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
1187 * Note that this doesn't use the @filled bit, but is used if non-NULL.
1154 * @ack_signal: signal strength (in dBm) of the last ACK frame. 1188 * @ack_signal: signal strength (in dBm) of the last ACK frame.
1189 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
1190 * been sent.
1155 */ 1191 */
1156struct station_info { 1192struct station_info {
1157 u64 filled; 1193 u64 filled;
@@ -1195,8 +1231,9 @@ struct station_info {
1195 u64 rx_beacon; 1231 u64 rx_beacon;
1196 u64 rx_duration; 1232 u64 rx_duration;
1197 u8 rx_beacon_signal_avg; 1233 u8 rx_beacon_signal_avg;
1198 struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; 1234 struct cfg80211_tid_stats *pertid;
1199 s8 ack_signal; 1235 s8 ack_signal;
1236 s8 avg_ack_signal;
1200}; 1237};
1201 1238
1202#if IS_ENABLED(CONFIG_CFG80211) 1239#if IS_ENABLED(CONFIG_CFG80211)
@@ -2188,9 +2225,14 @@ struct cfg80211_connect_params {
2188 * have to be updated as part of update_connect_params() call. 2225 * have to be updated as part of update_connect_params() call.
2189 * 2226 *
2190 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated 2227 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
2228 * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
2229 * username, erp sequence number and rrk) are updated
2230 * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2191 */ 2231 */
2192enum cfg80211_connect_params_changed { 2232enum cfg80211_connect_params_changed {
2193 UPDATE_ASSOC_IES = BIT(0), 2233 UPDATE_ASSOC_IES = BIT(0),
2234 UPDATE_FILS_ERP_INFO = BIT(1),
2235 UPDATE_AUTH_TYPE = BIT(2),
2194}; 2236};
2195 2237
2196/** 2238/**
@@ -2201,6 +2243,9 @@ enum cfg80211_connect_params_changed {
2201 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 2243 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2202 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed 2244 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
2203 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled 2245 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
2246 * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
2247 * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
2248 * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2204 */ 2249 */
2205enum wiphy_params_flags { 2250enum wiphy_params_flags {
2206 WIPHY_PARAM_RETRY_SHORT = 1 << 0, 2251 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
@@ -2209,6 +2254,9 @@ enum wiphy_params_flags {
2209 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 2254 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
2210 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, 2255 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
2211 WIPHY_PARAM_DYN_ACK = 1 << 5, 2256 WIPHY_PARAM_DYN_ACK = 1 << 5,
2257 WIPHY_PARAM_TXQ_LIMIT = 1 << 6,
2258 WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7,
2259 WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
2212}; 2260};
2213 2261
2214/** 2262/**
@@ -2961,6 +3009,9 @@ struct cfg80211_external_auth_params {
2961 * 3009 *
2962 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS 3010 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
2963 * 3011 *
3012 * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
3013 * function should return phy stats, and interface stats otherwise.
3014 *
2964 * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake. 3015 * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
2965 * If not deleted through @del_pmk the PMK remains valid until disconnect 3016 * If not deleted through @del_pmk the PMK remains valid until disconnect
2966 * upon which the driver should clear it. 3017 * upon which the driver should clear it.
@@ -3262,6 +3313,10 @@ struct cfg80211_ops {
3262 struct net_device *dev, 3313 struct net_device *dev,
3263 const bool enabled); 3314 const bool enabled);
3264 3315
3316 int (*get_txq_stats)(struct wiphy *wiphy,
3317 struct wireless_dev *wdev,
3318 struct cfg80211_txq_stats *txqstats);
3319
3265 int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev, 3320 int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
3266 const struct cfg80211_pmk_conf *conf); 3321 const struct cfg80211_pmk_conf *conf);
3267 int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev, 3322 int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
@@ -3806,6 +3861,10 @@ struct wiphy_iftype_ext_capab {
3806 * bitmap of &enum nl80211_band values. For instance, for 3861 * bitmap of &enum nl80211_band values. For instance, for
3807 * NL80211_BAND_2GHZ, bit 0 would be set 3862 * NL80211_BAND_2GHZ, bit 0 would be set
3808 * (i.e. BIT(NL80211_BAND_2GHZ)). 3863 * (i.e. BIT(NL80211_BAND_2GHZ)).
3864 *
3865 * @txq_limit: configuration of internal TX queue frame limit
3866 * @txq_memory_limit: configuration internal TX queue memory limit
3867 * @txq_quantum: configuration of internal TX queue scheduler quantum
3809 */ 3868 */
3810struct wiphy { 3869struct wiphy {
3811 /* assign these fields before you register the wiphy */ 3870 /* assign these fields before you register the wiphy */
@@ -3940,6 +3999,10 @@ struct wiphy {
3940 3999
3941 u8 nan_supported_bands; 4000 u8 nan_supported_bands;
3942 4001
4002 u32 txq_limit;
4003 u32 txq_memory_limit;
4004 u32 txq_quantum;
4005
3943 char priv[0] __aligned(NETDEV_ALIGN); 4006 char priv[0] __aligned(NETDEV_ALIGN);
3944}; 4007};
3945 4008
@@ -5363,6 +5426,30 @@ static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
5363#endif 5426#endif
5364 5427
5365/** 5428/**
5429 * struct cfg80211_fils_resp_params - FILS connection response params
5430 * @kek: KEK derived from a successful FILS connection (may be %NULL)
5431 * @kek_len: Length of @fils_kek in octets
5432 * @update_erp_next_seq_num: Boolean value to specify whether the value in
5433 * @erp_next_seq_num is valid.
5434 * @erp_next_seq_num: The next sequence number to use in ERP message in
5435 * FILS Authentication. This value should be specified irrespective of the
5436 * status for a FILS connection.
5437 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
5438 * @pmk_len: Length of @pmk in octets
5439 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
5440 * used for this FILS connection (may be %NULL).
5441 */
5442struct cfg80211_fils_resp_params {
5443 const u8 *kek;
5444 size_t kek_len;
5445 bool update_erp_next_seq_num;
5446 u16 erp_next_seq_num;
5447 const u8 *pmk;
5448 size_t pmk_len;
5449 const u8 *pmkid;
5450};
5451
5452/**
5366 * struct cfg80211_connect_resp_params - Connection response params 5453 * struct cfg80211_connect_resp_params - Connection response params
5367 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use 5454 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
5368 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 5455 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
@@ -5380,17 +5467,7 @@ static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
5380 * @req_ie_len: Association request IEs length 5467 * @req_ie_len: Association request IEs length
5381 * @resp_ie: Association response IEs (may be %NULL) 5468 * @resp_ie: Association response IEs (may be %NULL)
5382 * @resp_ie_len: Association response IEs length 5469 * @resp_ie_len: Association response IEs length
5383 * @fils_kek: KEK derived from a successful FILS connection (may be %NULL) 5470 * @fils: FILS connection response parameters.
5384 * @fils_kek_len: Length of @fils_kek in octets
5385 * @update_erp_next_seq_num: Boolean value to specify whether the value in
5386 * @fils_erp_next_seq_num is valid.
5387 * @fils_erp_next_seq_num: The next sequence number to use in ERP message in
5388 * FILS Authentication. This value should be specified irrespective of the
5389 * status for a FILS connection.
5390 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
5391 * @pmk_len: Length of @pmk in octets
5392 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
5393 * used for this FILS connection (may be %NULL).
5394 * @timeout_reason: Reason for connection timeout. This is used when the 5471 * @timeout_reason: Reason for connection timeout. This is used when the
5395 * connection fails due to a timeout instead of an explicit rejection from 5472 * connection fails due to a timeout instead of an explicit rejection from
5396 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is 5473 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
@@ -5406,13 +5483,7 @@ struct cfg80211_connect_resp_params {
5406 size_t req_ie_len; 5483 size_t req_ie_len;
5407 const u8 *resp_ie; 5484 const u8 *resp_ie;
5408 size_t resp_ie_len; 5485 size_t resp_ie_len;
5409 const u8 *fils_kek; 5486 struct cfg80211_fils_resp_params fils;
5410 size_t fils_kek_len;
5411 bool update_erp_next_seq_num;
5412 u16 fils_erp_next_seq_num;
5413 const u8 *pmk;
5414 size_t pmk_len;
5415 const u8 *pmkid;
5416 enum nl80211_timeout_reason timeout_reason; 5487 enum nl80211_timeout_reason timeout_reason;
5417}; 5488};
5418 5489
@@ -5558,6 +5629,7 @@ cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
5558 * @req_ie_len: association request IEs length 5629 * @req_ie_len: association request IEs length
5559 * @resp_ie: association response IEs (may be %NULL) 5630 * @resp_ie: association response IEs (may be %NULL)
5560 * @resp_ie_len: assoc response IEs length 5631 * @resp_ie_len: assoc response IEs length
5632 * @fils: FILS related roaming information.
5561 */ 5633 */
5562struct cfg80211_roam_info { 5634struct cfg80211_roam_info {
5563 struct ieee80211_channel *channel; 5635 struct ieee80211_channel *channel;
@@ -5567,6 +5639,7 @@ struct cfg80211_roam_info {
5567 size_t req_ie_len; 5639 size_t req_ie_len;
5568 const u8 *resp_ie; 5640 const u8 *resp_ie;
5569 size_t resp_ie_len; 5641 size_t resp_ie_len;
5642 struct cfg80211_fils_resp_params fils;
5570}; 5643};
5571 5644
5572/** 5645/**
@@ -5648,6 +5721,26 @@ void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
5648 struct ieee80211_channel *chan, 5721 struct ieee80211_channel *chan,
5649 gfp_t gfp); 5722 gfp_t gfp);
5650 5723
5724/**
5725 * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
5726 *
5727 * @sinfo: the station information
5728 * @gfp: allocation flags
5729 */
5730int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
5731
5732/**
5733 * cfg80211_sinfo_release_content - release contents of station info
5734 * @sinfo: the station information
5735 *
5736 * Releases any potentially allocated sub-information of the station
5737 * information, but not the struct itself (since it's typically on
5738 * the stack.)
5739 */
5740static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
5741{
5742 kfree(sinfo->pertid);
5743}
5651 5744
5652/** 5745/**
5653 * cfg80211_new_sta - notify userspace about station 5746 * cfg80211_new_sta - notify userspace about station
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index 207d9ba1f92c..0e5e91be2d30 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -101,6 +101,10 @@ struct dcbnl_rtnl_ops {
101 /* CEE peer */ 101 /* CEE peer */
102 int (*cee_peer_getpg) (struct net_device *, struct cee_pg *); 102 int (*cee_peer_getpg) (struct net_device *, struct cee_pg *);
103 int (*cee_peer_getpfc) (struct net_device *, struct cee_pfc *); 103 int (*cee_peer_getpfc) (struct net_device *, struct cee_pfc *);
104
105 /* buffer settings */
106 int (*dcbnl_getbuffer)(struct net_device *, struct dcbnl_buffer *);
107 int (*dcbnl_setbuffer)(struct net_device *, struct dcbnl_buffer *);
104}; 108};
105 109
106#endif /* __NET_DCBNL_H__ */ 110#endif /* __NET_DCBNL_H__ */
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 2e4f71e16e95..e336ea9c73df 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -35,6 +35,14 @@ struct devlink {
35 char priv[0] __aligned(NETDEV_ALIGN); 35 char priv[0] __aligned(NETDEV_ALIGN);
36}; 36};
37 37
38struct devlink_port_attrs {
39 bool set;
40 enum devlink_port_flavour flavour;
41 u32 port_number; /* same value as "split group" */
42 bool split;
43 u32 split_subport_number;
44};
45
38struct devlink_port { 46struct devlink_port {
39 struct list_head list; 47 struct list_head list;
40 struct devlink *devlink; 48 struct devlink *devlink;
@@ -43,8 +51,7 @@ struct devlink_port {
43 enum devlink_port_type type; 51 enum devlink_port_type type;
44 enum devlink_port_type desired_type; 52 enum devlink_port_type desired_type;
45 void *type_dev; 53 void *type_dev;
46 bool split; 54 struct devlink_port_attrs attrs;
47 u32 split_group;
48}; 55};
49 56
50struct devlink_sb_pool_info { 57struct devlink_sb_pool_info {
@@ -289,12 +296,13 @@ struct devlink_resource {
289#define DEVLINK_RESOURCE_ID_PARENT_TOP 0 296#define DEVLINK_RESOURCE_ID_PARENT_TOP 0
290 297
291struct devlink_ops { 298struct devlink_ops {
292 int (*reload)(struct devlink *devlink); 299 int (*reload)(struct devlink *devlink, struct netlink_ext_ack *extack);
293 int (*port_type_set)(struct devlink_port *devlink_port, 300 int (*port_type_set)(struct devlink_port *devlink_port,
294 enum devlink_port_type port_type); 301 enum devlink_port_type port_type);
295 int (*port_split)(struct devlink *devlink, unsigned int port_index, 302 int (*port_split)(struct devlink *devlink, unsigned int port_index,
296 unsigned int count); 303 unsigned int count, struct netlink_ext_ack *extack);
297 int (*port_unsplit)(struct devlink *devlink, unsigned int port_index); 304 int (*port_unsplit)(struct devlink *devlink, unsigned int port_index,
305 struct netlink_ext_ack *extack);
298 int (*sb_pool_get)(struct devlink *devlink, unsigned int sb_index, 306 int (*sb_pool_get)(struct devlink *devlink, unsigned int sb_index,
299 u16 pool_index, 307 u16 pool_index,
300 struct devlink_sb_pool_info *pool_info); 308 struct devlink_sb_pool_info *pool_info);
@@ -367,8 +375,12 @@ void devlink_port_type_eth_set(struct devlink_port *devlink_port,
367void devlink_port_type_ib_set(struct devlink_port *devlink_port, 375void devlink_port_type_ib_set(struct devlink_port *devlink_port,
368 struct ib_device *ibdev); 376 struct ib_device *ibdev);
369void devlink_port_type_clear(struct devlink_port *devlink_port); 377void devlink_port_type_clear(struct devlink_port *devlink_port);
370void devlink_port_split_set(struct devlink_port *devlink_port, 378void devlink_port_attrs_set(struct devlink_port *devlink_port,
371 u32 split_group); 379 enum devlink_port_flavour flavour,
380 u32 port_number, bool split,
381 u32 split_subport_number);
382int devlink_port_get_phys_port_name(struct devlink_port *devlink_port,
383 char *name, size_t len);
372int devlink_sb_register(struct devlink *devlink, unsigned int sb_index, 384int devlink_sb_register(struct devlink *devlink, unsigned int sb_index,
373 u32 size, u16 ingress_pools_count, 385 u32 size, u16 ingress_pools_count,
374 u16 egress_pools_count, u16 ingress_tc_count, 386 u16 egress_pools_count, u16 ingress_tc_count,
@@ -466,11 +478,20 @@ static inline void devlink_port_type_clear(struct devlink_port *devlink_port)
466{ 478{
467} 479}
468 480
469static inline void devlink_port_split_set(struct devlink_port *devlink_port, 481static inline void devlink_port_attrs_set(struct devlink_port *devlink_port,
470 u32 split_group) 482 enum devlink_port_flavour flavour,
483 u32 port_number, bool split,
484 u32 split_subport_number)
471{ 485{
472} 486}
473 487
488static inline int
489devlink_port_get_phys_port_name(struct devlink_port *devlink_port,
490 char *name, size_t len)
491{
492 return -EOPNOTSUPP;
493}
494
474static inline int devlink_sb_register(struct devlink *devlink, 495static inline int devlink_sb_register(struct devlink *devlink,
475 unsigned int sb_index, u32 size, 496 unsigned int sb_index, u32 size,
476 u16 ingress_pools_count, 497 u16 ingress_pools_count,
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 60fb4ec8ba61..fdbd6082945d 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -20,12 +20,14 @@
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/ethtool.h> 21#include <linux/ethtool.h>
22#include <linux/net_tstamp.h> 22#include <linux/net_tstamp.h>
23#include <linux/phy.h>
23#include <net/devlink.h> 24#include <net/devlink.h>
24#include <net/switchdev.h> 25#include <net/switchdev.h>
25 26
26struct tc_action; 27struct tc_action;
27struct phy_device; 28struct phy_device;
28struct fixed_phy_status; 29struct fixed_phy_status;
30struct phylink_link_state;
29 31
30enum dsa_tag_protocol { 32enum dsa_tag_protocol {
31 DSA_TAG_PROTO_NONE = 0, 33 DSA_TAG_PROTO_NONE = 0,
@@ -199,6 +201,7 @@ struct dsa_port {
199 u8 stp_state; 201 u8 stp_state;
200 struct net_device *bridge_dev; 202 struct net_device *bridge_dev;
201 struct devlink_port devlink_port; 203 struct devlink_port devlink_port;
204 struct phylink *pl;
202 /* 205 /*
203 * Original copy of the master netdev ethtool_ops 206 * Original copy of the master netdev ethtool_ops
204 */ 207 */
@@ -354,12 +357,36 @@ struct dsa_switch_ops {
354 struct fixed_phy_status *st); 357 struct fixed_phy_status *st);
355 358
356 /* 359 /*
360 * PHYLINK integration
361 */
362 void (*phylink_validate)(struct dsa_switch *ds, int port,
363 unsigned long *supported,
364 struct phylink_link_state *state);
365 int (*phylink_mac_link_state)(struct dsa_switch *ds, int port,
366 struct phylink_link_state *state);
367 void (*phylink_mac_config)(struct dsa_switch *ds, int port,
368 unsigned int mode,
369 const struct phylink_link_state *state);
370 void (*phylink_mac_an_restart)(struct dsa_switch *ds, int port);
371 void (*phylink_mac_link_down)(struct dsa_switch *ds, int port,
372 unsigned int mode,
373 phy_interface_t interface);
374 void (*phylink_mac_link_up)(struct dsa_switch *ds, int port,
375 unsigned int mode,
376 phy_interface_t interface,
377 struct phy_device *phydev);
378 void (*phylink_fixed_state)(struct dsa_switch *ds, int port,
379 struct phylink_link_state *state);
380 /*
357 * ethtool hardware statistics. 381 * ethtool hardware statistics.
358 */ 382 */
359 void (*get_strings)(struct dsa_switch *ds, int port, uint8_t *data); 383 void (*get_strings)(struct dsa_switch *ds, int port,
384 u32 stringset, uint8_t *data);
360 void (*get_ethtool_stats)(struct dsa_switch *ds, 385 void (*get_ethtool_stats)(struct dsa_switch *ds,
361 int port, uint64_t *data); 386 int port, uint64_t *data);
362 int (*get_sset_count)(struct dsa_switch *ds, int port); 387 int (*get_sset_count)(struct dsa_switch *ds, int port, int sset);
388 void (*get_ethtool_phy_stats)(struct dsa_switch *ds,
389 int port, uint64_t *data);
363 390
364 /* 391 /*
365 * ethtool Wake-on-LAN 392 * ethtool Wake-on-LAN
@@ -588,4 +615,10 @@ static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev,
588#define BRCM_TAG_GET_PORT(v) ((v) >> 8) 615#define BRCM_TAG_GET_PORT(v) ((v) >> 8)
589#define BRCM_TAG_GET_QUEUE(v) ((v) & 0xff) 616#define BRCM_TAG_GET_QUEUE(v) ((v) & 0xff)
590 617
618
619int dsa_port_get_phy_strings(struct dsa_port *dp, uint8_t *data);
620int dsa_port_get_ethtool_phy_stats(struct dsa_port *dp, uint64_t *data);
621int dsa_port_get_phy_sset_count(struct dsa_port *dp);
622void dsa_port_phylink_mac_change(struct dsa_switch *ds, int port, bool up);
623
591#endif 624#endif
diff --git a/include/net/erspan.h b/include/net/erspan.h
index d044aa60cc76..b39643ef4c95 100644
--- a/include/net/erspan.h
+++ b/include/net/erspan.h
@@ -219,6 +219,33 @@ static inline __be32 erspan_get_timestamp(void)
219 return htonl((u32)h_usecs); 219 return htonl((u32)h_usecs);
220} 220}
221 221
222/* ERSPAN BSO (Bad/Short/Oversized), see RFC1757
223 * 00b --> Good frame with no error, or unknown integrity
224 * 01b --> Payload is a Short Frame
225 * 10b --> Payload is an Oversized Frame
226 * 11b --> Payload is a Bad Frame with CRC or Alignment Error
227 */
228enum erspan_bso {
229 BSO_NOERROR = 0x0,
230 BSO_SHORT = 0x1,
231 BSO_OVERSIZED = 0x2,
232 BSO_BAD = 0x3,
233};
234
235static inline u8 erspan_detect_bso(struct sk_buff *skb)
236{
237 /* BSO_BAD is not handled because the frame CRC
238 * or alignment error information is in FCS.
239 */
240 if (skb->len < ETH_ZLEN)
241 return BSO_SHORT;
242
243 if (skb->len > ETH_FRAME_LEN)
244 return BSO_OVERSIZED;
245
246 return BSO_NOERROR;
247}
248
222static inline void erspan_build_header_v2(struct sk_buff *skb, 249static inline void erspan_build_header_v2(struct sk_buff *skb,
223 u32 id, u8 direction, u16 hwid, 250 u32 id, u8 direction, u16 hwid,
224 bool truncate, bool is_ipv4) 251 bool truncate, bool is_ipv4)
@@ -248,6 +275,7 @@ static inline void erspan_build_header_v2(struct sk_buff *skb,
248 vlan_tci = ntohs(qp->tci); 275 vlan_tci = ntohs(qp->tci);
249 } 276 }
250 277
278 bso = erspan_detect_bso(skb);
251 skb_push(skb, sizeof(*ershdr) + ERSPAN_V2_MDSIZE); 279 skb_push(skb, sizeof(*ershdr) + ERSPAN_V2_MDSIZE);
252 ershdr = (struct erspan_base_hdr *)skb->data; 280 ershdr = (struct erspan_base_hdr *)skb->data;
253 memset(ershdr, 0, sizeof(*ershdr) + ERSPAN_V2_MDSIZE); 281 memset(ershdr, 0, sizeof(*ershdr) + ERSPAN_V2_MDSIZE);
diff --git a/include/net/failover.h b/include/net/failover.h
new file mode 100644
index 000000000000..bb15438f39c7
--- /dev/null
+++ b/include/net/failover.h
@@ -0,0 +1,36 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright (c) 2018, Intel Corporation. */
3
4#ifndef _FAILOVER_H
5#define _FAILOVER_H
6
7#include <linux/netdevice.h>
8
9struct failover_ops {
10 int (*slave_pre_register)(struct net_device *slave_dev,
11 struct net_device *failover_dev);
12 int (*slave_register)(struct net_device *slave_dev,
13 struct net_device *failover_dev);
14 int (*slave_pre_unregister)(struct net_device *slave_dev,
15 struct net_device *failover_dev);
16 int (*slave_unregister)(struct net_device *slave_dev,
17 struct net_device *failover_dev);
18 int (*slave_link_change)(struct net_device *slave_dev,
19 struct net_device *failover_dev);
20 int (*slave_name_change)(struct net_device *slave_dev,
21 struct net_device *failover_dev);
22 rx_handler_result_t (*slave_handle_frame)(struct sk_buff **pskb);
23};
24
25struct failover {
26 struct list_head list;
27 struct net_device __rcu *failover_dev;
28 struct failover_ops __rcu *ops;
29};
30
31struct failover *failover_register(struct net_device *dev,
32 struct failover_ops *ops);
33void failover_unregister(struct failover *failover);
34int failover_slave_unregister(struct net_device *slave_dev);
35
36#endif /* _FAILOVER_H */
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index e5cfcfc7dd93..b473df5b9512 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -75,7 +75,8 @@ struct fib_rules_ops {
75 int (*configure)(struct fib_rule *, 75 int (*configure)(struct fib_rule *,
76 struct sk_buff *, 76 struct sk_buff *,
77 struct fib_rule_hdr *, 77 struct fib_rule_hdr *,
78 struct nlattr **); 78 struct nlattr **,
79 struct netlink_ext_ack *);
79 int (*delete)(struct fib_rule *); 80 int (*delete)(struct fib_rule *);
80 int (*compare)(struct fib_rule *, 81 int (*compare)(struct fib_rule *,
81 struct fib_rule_hdr *, 82 struct fib_rule_hdr *,
diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index d1fcf2442a42..adc24df56b90 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -226,6 +226,11 @@ struct flow_dissector {
226 unsigned short int offset[FLOW_DISSECTOR_KEY_MAX]; 226 unsigned short int offset[FLOW_DISSECTOR_KEY_MAX];
227}; 227};
228 228
229struct flow_keys_basic {
230 struct flow_dissector_key_control control;
231 struct flow_dissector_key_basic basic;
232};
233
229struct flow_keys { 234struct flow_keys {
230 struct flow_dissector_key_control control; 235 struct flow_dissector_key_control control;
231#define FLOW_KEYS_HASH_START_FIELD basic 236#define FLOW_KEYS_HASH_START_FIELD basic
@@ -244,7 +249,7 @@ __be32 flow_get_u32_src(const struct flow_keys *flow);
244__be32 flow_get_u32_dst(const struct flow_keys *flow); 249__be32 flow_get_u32_dst(const struct flow_keys *flow);
245 250
246extern struct flow_dissector flow_keys_dissector; 251extern struct flow_dissector flow_keys_dissector;
247extern struct flow_dissector flow_keys_buf_dissector; 252extern struct flow_dissector flow_keys_basic_dissector;
248 253
249/* struct flow_keys_digest: 254/* struct flow_keys_digest:
250 * 255 *
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index d4088d1a688d..d7578cf49c3a 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -42,6 +42,7 @@ enum {
42struct inet6_ifaddr { 42struct inet6_ifaddr {
43 struct in6_addr addr; 43 struct in6_addr addr;
44 __u32 prefix_len; 44 __u32 prefix_len;
45 __u32 rt_priority;
45 46
46 /* In seconds, relative to tstamp. Expiry is at tstamp + HZ * lft. */ 47 /* In seconds, relative to tstamp. Expiry is at tstamp + HZ * lft. */
47 __u32 valid_lft; 48 __u32 valid_lft;
@@ -64,7 +65,7 @@ struct inet6_ifaddr {
64 struct delayed_work dad_work; 65 struct delayed_work dad_work;
65 66
66 struct inet6_dev *idev; 67 struct inet6_dev *idev;
67 struct rt6_info *rt; 68 struct fib6_info *rt;
68 69
69 struct hlist_node addr_lst; 70 struct hlist_node addr_lst;
70 struct list_head if_list; 71 struct list_head if_list;
@@ -143,8 +144,7 @@ struct ipv6_ac_socklist {
143 144
144struct ifacaddr6 { 145struct ifacaddr6 {
145 struct in6_addr aca_addr; 146 struct in6_addr aca_addr;
146 struct inet6_dev *aca_idev; 147 struct fib6_info *aca_rt;
147 struct rt6_info *aca_rt;
148 struct ifacaddr6 *aca_next; 148 struct ifacaddr6 *aca_next;
149 int aca_users; 149 int aca_users;
150 refcount_t aca_refcnt; 150 refcount_t aca_refcnt;
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index b68fea022a82..0a6c9e0f2b5a 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -23,8 +23,6 @@
23#include <net/inet_sock.h> 23#include <net/inet_sock.h>
24#include <net/request_sock.h> 24#include <net/request_sock.h>
25 25
26#define INET_CSK_DEBUG 1
27
28/* Cancel timers, when they are not required. */ 26/* Cancel timers, when they are not required. */
29#undef INET_CSK_CLEAR_TIMERS 27#undef INET_CSK_CLEAR_TIMERS
30 28
@@ -77,6 +75,7 @@ struct inet_connection_sock_af_ops {
77 * @icsk_af_ops Operations which are AF_INET{4,6} specific 75 * @icsk_af_ops Operations which are AF_INET{4,6} specific
78 * @icsk_ulp_ops Pluggable ULP control hook 76 * @icsk_ulp_ops Pluggable ULP control hook
79 * @icsk_ulp_data ULP private data 77 * @icsk_ulp_data ULP private data
78 * @icsk_clean_acked Clean acked data hook
80 * @icsk_listen_portaddr_node hash to the portaddr listener hashtable 79 * @icsk_listen_portaddr_node hash to the portaddr listener hashtable
81 * @icsk_ca_state: Congestion control state 80 * @icsk_ca_state: Congestion control state
82 * @icsk_retransmits: Number of unrecovered [RTO] timeouts 81 * @icsk_retransmits: Number of unrecovered [RTO] timeouts
@@ -102,6 +101,7 @@ struct inet_connection_sock {
102 const struct inet_connection_sock_af_ops *icsk_af_ops; 101 const struct inet_connection_sock_af_ops *icsk_af_ops;
103 const struct tcp_ulp_ops *icsk_ulp_ops; 102 const struct tcp_ulp_ops *icsk_ulp_ops;
104 void *icsk_ulp_data; 103 void *icsk_ulp_data;
104 void (*icsk_clean_acked)(struct sock *sk, u32 acked_seq);
105 struct hlist_node icsk_listen_portaddr_node; 105 struct hlist_node icsk_listen_portaddr_node;
106 unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu); 106 unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu);
107 __u8 icsk_ca_state:6, 107 __u8 icsk_ca_state:6,
@@ -194,10 +194,6 @@ static inline void inet_csk_delack_init(struct sock *sk)
194void inet_csk_delete_keepalive_timer(struct sock *sk); 194void inet_csk_delete_keepalive_timer(struct sock *sk);
195void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long timeout); 195void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long timeout);
196 196
197#ifdef INET_CSK_DEBUG
198extern const char inet_csk_timer_bug_msg[];
199#endif
200
201static inline void inet_csk_clear_xmit_timer(struct sock *sk, const int what) 197static inline void inet_csk_clear_xmit_timer(struct sock *sk, const int what)
202{ 198{
203 struct inet_connection_sock *icsk = inet_csk(sk); 199 struct inet_connection_sock *icsk = inet_csk(sk);
@@ -212,12 +208,9 @@ static inline void inet_csk_clear_xmit_timer(struct sock *sk, const int what)
212#ifdef INET_CSK_CLEAR_TIMERS 208#ifdef INET_CSK_CLEAR_TIMERS
213 sk_stop_timer(sk, &icsk->icsk_delack_timer); 209 sk_stop_timer(sk, &icsk->icsk_delack_timer);
214#endif 210#endif
211 } else {
212 pr_debug("inet_csk BUG: unknown timer value\n");
215 } 213 }
216#ifdef INET_CSK_DEBUG
217 else {
218 pr_debug("%s", inet_csk_timer_bug_msg);
219 }
220#endif
221} 214}
222 215
223/* 216/*
@@ -230,10 +223,8 @@ static inline void inet_csk_reset_xmit_timer(struct sock *sk, const int what,
230 struct inet_connection_sock *icsk = inet_csk(sk); 223 struct inet_connection_sock *icsk = inet_csk(sk);
231 224
232 if (when > max_when) { 225 if (when > max_when) {
233#ifdef INET_CSK_DEBUG
234 pr_debug("reset_xmit_timer: sk=%p %d when=0x%lx, caller=%p\n", 226 pr_debug("reset_xmit_timer: sk=%p %d when=0x%lx, caller=%p\n",
235 sk, what, when, current_text_addr()); 227 sk, what, when, current_text_addr());
236#endif
237 when = max_when; 228 when = max_when;
238 } 229 }
239 230
@@ -247,12 +238,9 @@ static inline void inet_csk_reset_xmit_timer(struct sock *sk, const int what,
247 icsk->icsk_ack.pending |= ICSK_ACK_TIMER; 238 icsk->icsk_ack.pending |= ICSK_ACK_TIMER;
248 icsk->icsk_ack.timeout = jiffies + when; 239 icsk->icsk_ack.timeout = jiffies + when;
249 sk_reset_timer(sk, &icsk->icsk_delack_timer, icsk->icsk_ack.timeout); 240 sk_reset_timer(sk, &icsk->icsk_delack_timer, icsk->icsk_ack.timeout);
241 } else {
242 pr_debug("inet_csk BUG: unknown timer value\n");
250 } 243 }
251#ifdef INET_CSK_DEBUG
252 else {
253 pr_debug("%s", inet_csk_timer_bug_msg);
254 }
255#endif
256} 244}
257 245
258static inline unsigned long 246static inline unsigned long
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 0a671c32d6b9..83d5b3c2ac42 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -147,6 +147,7 @@ struct inet_cork {
147 __u8 ttl; 147 __u8 ttl;
148 __s16 tos; 148 __s16 tos;
149 char priority; 149 char priority;
150 __u16 gso_size;
150}; 151};
151 152
152struct inet_cork_full { 153struct inet_cork_full {
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index c7be1ca8e562..78775038f011 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -61,7 +61,7 @@ struct inet_timewait_sock {
61#define tw_cookie __tw_common.skc_cookie 61#define tw_cookie __tw_common.skc_cookie
62#define tw_dr __tw_common.skc_tw_dr 62#define tw_dr __tw_common.skc_tw_dr
63 63
64 int tw_timeout; 64 __u32 tw_mark;
65 volatile unsigned char tw_substate; 65 volatile unsigned char tw_substate;
66 unsigned char tw_rcv_wscale; 66 unsigned char tw_rcv_wscale;
67 67
diff --git a/include/net/ip.h b/include/net/ip.h
index ecffd843e7b8..0d2281b4b27a 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -76,6 +76,7 @@ struct ipcm_cookie {
76 __u8 ttl; 76 __u8 ttl;
77 __s16 tos; 77 __s16 tos;
78 char priority; 78 char priority;
79 __u16 gso_size;
79}; 80};
80 81
81#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) 82#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb))
@@ -171,7 +172,7 @@ struct sk_buff *ip_make_skb(struct sock *sk, struct flowi4 *fl4,
171 int len, int odd, struct sk_buff *skb), 172 int len, int odd, struct sk_buff *skb),
172 void *from, int length, int transhdrlen, 173 void *from, int length, int transhdrlen,
173 struct ipcm_cookie *ipc, struct rtable **rtp, 174 struct ipcm_cookie *ipc, struct rtable **rtp,
174 unsigned int flags); 175 struct inet_cork *cork, unsigned int flags);
175 176
176static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4) 177static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4)
177{ 178{
@@ -396,6 +397,9 @@ static inline unsigned int ip_skb_dst_mtu(struct sock *sk,
396 return min(READ_ONCE(skb_dst(skb)->dev->mtu), IP_MAX_MTU); 397 return min(READ_ONCE(skb_dst(skb)->dev->mtu), IP_MAX_MTU);
397} 398}
398 399
400int ip_metrics_convert(struct net *net, struct nlattr *fc_mx, int fc_mx_len,
401 u32 *metrics);
402
399u32 ip_idents_reserve(u32 hash, int segs); 403u32 ip_idents_reserve(u32 hash, int segs);
400void __ip_select_ident(struct net *net, struct iphdr *iph, int segs); 404void __ip_select_ident(struct net *net, struct iphdr *iph, int segs);
401 405
@@ -660,4 +664,7 @@ extern int sysctl_icmp_msgs_burst;
660int ip_misc_proc_init(void); 664int ip_misc_proc_init(void);
661#endif 665#endif
662 666
667int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto,
668 struct netlink_ext_ack *extack);
669
663#endif /* _IP_H */ 670#endif /* _IP_H */
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 0e79c3408569..5cba71d2dc44 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -38,6 +38,7 @@
38#endif 38#endif
39 39
40struct rt6_info; 40struct rt6_info;
41struct fib6_info;
41 42
42struct fib6_config { 43struct fib6_config {
43 u32 fc_table; 44 u32 fc_table;
@@ -74,12 +75,12 @@ struct fib6_node {
74#ifdef CONFIG_IPV6_SUBTREES 75#ifdef CONFIG_IPV6_SUBTREES
75 struct fib6_node __rcu *subtree; 76 struct fib6_node __rcu *subtree;
76#endif 77#endif
77 struct rt6_info __rcu *leaf; 78 struct fib6_info __rcu *leaf;
78 79
79 __u16 fn_bit; /* bit key */ 80 __u16 fn_bit; /* bit key */
80 __u16 fn_flags; 81 __u16 fn_flags;
81 int fn_sernum; 82 int fn_sernum;
82 struct rt6_info __rcu *rr_ptr; 83 struct fib6_info __rcu *rr_ptr;
83 struct rcu_head rcu; 84 struct rcu_head rcu;
84}; 85};
85 86
@@ -94,11 +95,6 @@ struct fib6_gc_args {
94#define FIB6_SUBTREE(fn) (rcu_dereference_protected((fn)->subtree, 1)) 95#define FIB6_SUBTREE(fn) (rcu_dereference_protected((fn)->subtree, 1))
95#endif 96#endif
96 97
97struct mx6_config {
98 const u32 *mx;
99 DECLARE_BITMAP(mx_valid, RTAX_MAX);
100};
101
102/* 98/*
103 * routing information 99 * routing information
104 * 100 *
@@ -127,92 +123,104 @@ struct rt6_exception {
127#define FIB6_EXCEPTION_BUCKET_SIZE (1 << FIB6_EXCEPTION_BUCKET_SIZE_SHIFT) 123#define FIB6_EXCEPTION_BUCKET_SIZE (1 << FIB6_EXCEPTION_BUCKET_SIZE_SHIFT)
128#define FIB6_MAX_DEPTH 5 124#define FIB6_MAX_DEPTH 5
129 125
130struct rt6_info { 126struct fib6_nh {
131 struct dst_entry dst; 127 struct in6_addr nh_gw;
132 struct rt6_info __rcu *rt6_next; 128 struct net_device *nh_dev;
133 struct rt6_info *from; 129 struct lwtunnel_state *nh_lwtstate;
134 130
135 /* 131 unsigned int nh_flags;
136 * Tail elements of dst_entry (__refcnt etc.) 132 atomic_t nh_upper_bound;
137 * and these elements (rarely used in hot path) are in 133 int nh_weight;
138 * the same cache line. 134};
139 */
140 struct fib6_table *rt6i_table;
141 struct fib6_node __rcu *rt6i_node;
142 135
143 struct in6_addr rt6i_gateway; 136struct fib6_info {
137 struct fib6_table *fib6_table;
138 struct fib6_info __rcu *fib6_next;
139 struct fib6_node __rcu *fib6_node;
144 140
145 /* Multipath routes: 141 /* Multipath routes:
146 * siblings is a list of rt6_info that have the the same metric/weight, 142 * siblings is a list of fib6_info that have the the same metric/weight,
147 * destination, but not the same gateway. nsiblings is just a cache 143 * destination, but not the same gateway. nsiblings is just a cache
148 * to speed up lookup. 144 * to speed up lookup.
149 */ 145 */
150 struct list_head rt6i_siblings; 146 struct list_head fib6_siblings;
151 unsigned int rt6i_nsiblings; 147 unsigned int fib6_nsiblings;
152 atomic_t rt6i_nh_upper_bound;
153 148
154 atomic_t rt6i_ref; 149 atomic_t fib6_ref;
150 unsigned long expires;
151 struct dst_metrics *fib6_metrics;
152#define fib6_pmtu fib6_metrics->metrics[RTAX_MTU-1]
155 153
156 unsigned int rt6i_nh_flags; 154 struct rt6key fib6_dst;
155 u32 fib6_flags;
156 struct rt6key fib6_src;
157 struct rt6key fib6_prefsrc;
157 158
158 /* These are in a separate cache line. */ 159 struct rt6_info * __percpu *rt6i_pcpu;
159 struct rt6key rt6i_dst ____cacheline_aligned_in_smp; 160 struct rt6_exception_bucket __rcu *rt6i_exception_bucket;
160 u32 rt6i_flags; 161
162 u32 fib6_metric;
163 u8 fib6_protocol;
164 u8 fib6_type;
165 u8 exception_bucket_flushed:1,
166 should_flush:1,
167 dst_nocount:1,
168 dst_nopolicy:1,
169 dst_host:1,
170 unused:3;
171
172 struct fib6_nh fib6_nh;
173};
174
175struct rt6_info {
176 struct dst_entry dst;
177 struct fib6_info __rcu *from;
178
179 struct rt6key rt6i_dst;
161 struct rt6key rt6i_src; 180 struct rt6key rt6i_src;
181 struct in6_addr rt6i_gateway;
182 struct inet6_dev *rt6i_idev;
183 u32 rt6i_flags;
162 struct rt6key rt6i_prefsrc; 184 struct rt6key rt6i_prefsrc;
163 185
164 struct list_head rt6i_uncached; 186 struct list_head rt6i_uncached;
165 struct uncached_list *rt6i_uncached_list; 187 struct uncached_list *rt6i_uncached_list;
166 188
167 struct inet6_dev *rt6i_idev;
168 struct rt6_info * __percpu *rt6i_pcpu;
169 struct rt6_exception_bucket __rcu *rt6i_exception_bucket;
170
171 u32 rt6i_metric;
172 u32 rt6i_pmtu;
173 /* more non-fragment space at head required */ 189 /* more non-fragment space at head required */
174 int rt6i_nh_weight;
175 unsigned short rt6i_nfheader_len; 190 unsigned short rt6i_nfheader_len;
176 u8 rt6i_protocol;
177 u8 exception_bucket_flushed:1,
178 should_flush:1,
179 unused:6;
180}; 191};
181 192
182#define for_each_fib6_node_rt_rcu(fn) \ 193#define for_each_fib6_node_rt_rcu(fn) \
183 for (rt = rcu_dereference((fn)->leaf); rt; \ 194 for (rt = rcu_dereference((fn)->leaf); rt; \
184 rt = rcu_dereference(rt->rt6_next)) 195 rt = rcu_dereference(rt->fib6_next))
185 196
186#define for_each_fib6_walker_rt(w) \ 197#define for_each_fib6_walker_rt(w) \
187 for (rt = (w)->leaf; rt; \ 198 for (rt = (w)->leaf; rt; \
188 rt = rcu_dereference_protected(rt->rt6_next, 1)) 199 rt = rcu_dereference_protected(rt->fib6_next, 1))
189 200
190static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) 201static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
191{ 202{
192 return ((struct rt6_info *)dst)->rt6i_idev; 203 return ((struct rt6_info *)dst)->rt6i_idev;
193} 204}
194 205
195static inline void rt6_clean_expires(struct rt6_info *rt) 206static inline void fib6_clean_expires(struct fib6_info *f6i)
196{ 207{
197 rt->rt6i_flags &= ~RTF_EXPIRES; 208 f6i->fib6_flags &= ~RTF_EXPIRES;
198 rt->dst.expires = 0; 209 f6i->expires = 0;
199} 210}
200 211
201static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires) 212static inline void fib6_set_expires(struct fib6_info *f6i,
213 unsigned long expires)
202{ 214{
203 rt->dst.expires = expires; 215 f6i->expires = expires;
204 rt->rt6i_flags |= RTF_EXPIRES; 216 f6i->fib6_flags |= RTF_EXPIRES;
205} 217}
206 218
207static inline void rt6_update_expires(struct rt6_info *rt0, int timeout) 219static inline bool fib6_check_expired(const struct fib6_info *f6i)
208{ 220{
209 struct rt6_info *rt; 221 if (f6i->fib6_flags & RTF_EXPIRES)
210 222 return time_after(jiffies, f6i->expires);
211 for (rt = rt0; rt && !(rt->rt6i_flags & RTF_EXPIRES); rt = rt->from); 223 return false;
212 if (rt && rt != rt0)
213 rt0->dst.expires = rt->dst.expires;
214 dst_set_expires(&rt0->dst, timeout);
215 rt0->rt6i_flags |= RTF_EXPIRES;
216} 224}
217 225
218/* Function to safely get fn->sernum for passed in rt 226/* Function to safely get fn->sernum for passed in rt
@@ -220,14 +228,13 @@ static inline void rt6_update_expires(struct rt6_info *rt0, int timeout)
220 * Return true if we can get cookie safely 228 * Return true if we can get cookie safely
221 * Return false if not 229 * Return false if not
222 */ 230 */
223static inline bool rt6_get_cookie_safe(const struct rt6_info *rt, 231static inline bool fib6_get_cookie_safe(const struct fib6_info *f6i,
224 u32 *cookie) 232 u32 *cookie)
225{ 233{
226 struct fib6_node *fn; 234 struct fib6_node *fn;
227 bool status = false; 235 bool status = false;
228 236
229 rcu_read_lock(); 237 fn = rcu_dereference(f6i->fib6_node);
230 fn = rcu_dereference(rt->rt6i_node);
231 238
232 if (fn) { 239 if (fn) {
233 *cookie = fn->fn_sernum; 240 *cookie = fn->fn_sernum;
@@ -236,19 +243,22 @@ static inline bool rt6_get_cookie_safe(const struct rt6_info *rt,
236 status = true; 243 status = true;
237 } 244 }
238 245
239 rcu_read_unlock();
240 return status; 246 return status;
241} 247}
242 248
243static inline u32 rt6_get_cookie(const struct rt6_info *rt) 249static inline u32 rt6_get_cookie(const struct rt6_info *rt)
244{ 250{
251 struct fib6_info *from;
245 u32 cookie = 0; 252 u32 cookie = 0;
246 253
247 if (rt->rt6i_flags & RTF_PCPU || 254 rcu_read_lock();
248 (unlikely(!list_empty(&rt->rt6i_uncached)) && rt->from)) 255
249 rt = rt->from; 256 from = rcu_dereference(rt->from);
257 if (from && (rt->rt6i_flags & RTF_PCPU ||
258 unlikely(!list_empty(&rt->rt6i_uncached))))
259 fib6_get_cookie_safe(from, &cookie);
250 260
251 rt6_get_cookie_safe(rt, &cookie); 261 rcu_read_unlock();
252 262
253 return cookie; 263 return cookie;
254} 264}
@@ -262,20 +272,18 @@ static inline void ip6_rt_put(struct rt6_info *rt)
262 dst_release(&rt->dst); 272 dst_release(&rt->dst);
263} 273}
264 274
265void rt6_free_pcpu(struct rt6_info *non_pcpu_rt); 275struct fib6_info *fib6_info_alloc(gfp_t gfp_flags);
276void fib6_info_destroy(struct fib6_info *f6i);
266 277
267static inline void rt6_hold(struct rt6_info *rt) 278static inline void fib6_info_hold(struct fib6_info *f6i)
268{ 279{
269 atomic_inc(&rt->rt6i_ref); 280 atomic_inc(&f6i->fib6_ref);
270} 281}
271 282
272static inline void rt6_release(struct rt6_info *rt) 283static inline void fib6_info_release(struct fib6_info *f6i)
273{ 284{
274 if (atomic_dec_and_test(&rt->rt6i_ref)) { 285 if (f6i && atomic_dec_and_test(&f6i->fib6_ref))
275 rt6_free_pcpu(rt); 286 fib6_info_destroy(f6i);
276 dst_dev_put(&rt->dst);
277 dst_release(&rt->dst);
278 }
279} 287}
280 288
281enum fib6_walk_state { 289enum fib6_walk_state {
@@ -291,7 +299,7 @@ enum fib6_walk_state {
291struct fib6_walker { 299struct fib6_walker {
292 struct list_head lh; 300 struct list_head lh;
293 struct fib6_node *root, *node; 301 struct fib6_node *root, *node;
294 struct rt6_info *leaf; 302 struct fib6_info *leaf;
295 enum fib6_walk_state state; 303 enum fib6_walk_state state;
296 unsigned int skip; 304 unsigned int skip;
297 unsigned int count; 305 unsigned int count;
@@ -355,7 +363,7 @@ typedef struct rt6_info *(*pol_lookup_t)(struct net *,
355 363
356struct fib6_entry_notifier_info { 364struct fib6_entry_notifier_info {
357 struct fib_notifier_info info; /* must be first */ 365 struct fib_notifier_info info; /* must be first */
358 struct rt6_info *rt; 366 struct fib6_info *rt;
359}; 367};
360 368
361/* 369/*
@@ -368,24 +376,49 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
368 const struct sk_buff *skb, 376 const struct sk_buff *skb,
369 int flags, pol_lookup_t lookup); 377 int flags, pol_lookup_t lookup);
370 378
371struct fib6_node *fib6_lookup(struct fib6_node *root, 379/* called with rcu lock held; can return error pointer
372 const struct in6_addr *daddr, 380 * caller needs to select path
373 const struct in6_addr *saddr); 381 */
382struct fib6_info *fib6_lookup(struct net *net, int oif, struct flowi6 *fl6,
383 int flags);
384
385/* called with rcu lock held; caller needs to select path */
386struct fib6_info *fib6_table_lookup(struct net *net, struct fib6_table *table,
387 int oif, struct flowi6 *fl6, int strict);
388
389struct fib6_info *fib6_multipath_select(const struct net *net,
390 struct fib6_info *match,
391 struct flowi6 *fl6, int oif,
392 const struct sk_buff *skb, int strict);
393
394struct fib6_node *fib6_node_lookup(struct fib6_node *root,
395 const struct in6_addr *daddr,
396 const struct in6_addr *saddr);
374 397
375struct fib6_node *fib6_locate(struct fib6_node *root, 398struct fib6_node *fib6_locate(struct fib6_node *root,
376 const struct in6_addr *daddr, int dst_len, 399 const struct in6_addr *daddr, int dst_len,
377 const struct in6_addr *saddr, int src_len, 400 const struct in6_addr *saddr, int src_len,
378 bool exact_match); 401 bool exact_match);
379 402
380void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg), 403void fib6_clean_all(struct net *net, int (*func)(struct fib6_info *, void *arg),
381 void *arg); 404 void *arg);
382 405
383int fib6_add(struct fib6_node *root, struct rt6_info *rt, 406int fib6_add(struct fib6_node *root, struct fib6_info *rt,
384 struct nl_info *info, struct mx6_config *mxc, 407 struct nl_info *info, struct netlink_ext_ack *extack);
385 struct netlink_ext_ack *extack); 408int fib6_del(struct fib6_info *rt, struct nl_info *info);
386int fib6_del(struct rt6_info *rt, struct nl_info *info); 409
410static inline struct net_device *fib6_info_nh_dev(const struct fib6_info *f6i)
411{
412 return f6i->fib6_nh.nh_dev;
413}
414
415static inline
416struct lwtunnel_state *fib6_info_nh_lwt(const struct fib6_info *f6i)
417{
418 return f6i->fib6_nh.nh_lwtstate;
419}
387 420
388void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info, 421void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,
389 unsigned int flags); 422 unsigned int flags);
390 423
391void fib6_run_gc(unsigned long expires, struct net *net, bool force); 424void fib6_run_gc(unsigned long expires, struct net *net, bool force);
@@ -416,8 +449,14 @@ void __net_exit fib6_notifier_exit(struct net *net);
416unsigned int fib6_tables_seq_read(struct net *net); 449unsigned int fib6_tables_seq_read(struct net *net);
417int fib6_tables_dump(struct net *net, struct notifier_block *nb); 450int fib6_tables_dump(struct net *net, struct notifier_block *nb);
418 451
419void fib6_update_sernum(struct rt6_info *rt); 452void fib6_update_sernum(struct net *net, struct fib6_info *rt);
420void fib6_update_sernum_upto_root(struct net *net, struct rt6_info *rt); 453void fib6_update_sernum_upto_root(struct net *net, struct fib6_info *rt);
454
455void fib6_metric_set(struct fib6_info *f6i, int metric, u32 val);
456static inline bool fib6_metric_locked(struct fib6_info *f6i, int metric)
457{
458 return !!(f6i->fib6_metrics->metrics[RTAX_LOCK - 1] & (1 << metric));
459}
421 460
422#ifdef CONFIG_IPV6_MULTIPLE_TABLES 461#ifdef CONFIG_IPV6_MULTIPLE_TABLES
423int fib6_rules_init(void); 462int fib6_rules_init(void);
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 08b132381984..59656fc580df 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -66,12 +66,6 @@ static inline bool rt6_need_strict(const struct in6_addr *daddr)
66 (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK); 66 (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
67} 67}
68 68
69static inline bool rt6_qualify_for_ecmp(const struct rt6_info *rt)
70{
71 return (rt->rt6i_flags & (RTF_GATEWAY|RTF_ADDRCONF|RTF_DYNAMIC)) ==
72 RTF_GATEWAY;
73}
74
75void ip6_route_input(struct sk_buff *skb); 69void ip6_route_input(struct sk_buff *skb);
76struct dst_entry *ip6_route_input_lookup(struct net *net, 70struct dst_entry *ip6_route_input_lookup(struct net *net,
77 struct net_device *dev, 71 struct net_device *dev,
@@ -100,29 +94,29 @@ void ip6_route_cleanup(void);
100 94
101int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg); 95int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg);
102 96
103int ip6_route_add(struct fib6_config *cfg, struct netlink_ext_ack *extack); 97int ip6_route_add(struct fib6_config *cfg, gfp_t gfp_flags,
104int ip6_ins_rt(struct rt6_info *); 98 struct netlink_ext_ack *extack);
105int ip6_del_rt(struct rt6_info *); 99int ip6_ins_rt(struct net *net, struct fib6_info *f6i);
100int ip6_del_rt(struct net *net, struct fib6_info *f6i);
106 101
107void rt6_flush_exceptions(struct rt6_info *rt); 102void rt6_flush_exceptions(struct fib6_info *f6i);
108int rt6_remove_exception_rt(struct rt6_info *rt); 103void rt6_age_exceptions(struct fib6_info *f6i, struct fib6_gc_args *gc_args,
109void rt6_age_exceptions(struct rt6_info *rt, struct fib6_gc_args *gc_args,
110 unsigned long now); 104 unsigned long now);
111 105
112static inline int ip6_route_get_saddr(struct net *net, struct rt6_info *rt, 106static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i,
113 const struct in6_addr *daddr, 107 const struct in6_addr *daddr,
114 unsigned int prefs, 108 unsigned int prefs,
115 struct in6_addr *saddr) 109 struct in6_addr *saddr)
116{ 110{
117 struct inet6_dev *idev =
118 rt ? ip6_dst_idev((struct dst_entry *)rt) : NULL;
119 int err = 0; 111 int err = 0;
120 112
121 if (rt && rt->rt6i_prefsrc.plen) 113 if (f6i && f6i->fib6_prefsrc.plen) {
122 *saddr = rt->rt6i_prefsrc.addr; 114 *saddr = f6i->fib6_prefsrc.addr;
123 else 115 } else {
124 err = ipv6_dev_get_saddr(net, idev ? idev->dev : NULL, 116 struct net_device *dev = f6i ? fib6_info_nh_dev(f6i) : NULL;
125 daddr, prefs, saddr); 117
118 err = ipv6_dev_get_saddr(net, dev, daddr, prefs, saddr);
119 }
126 120
127 return err; 121 return err;
128} 122}
@@ -137,8 +131,9 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct flowi6 *fl6);
137 131
138void fib6_force_start_gc(struct net *net); 132void fib6_force_start_gc(struct net *net);
139 133
140struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, 134struct fib6_info *addrconf_f6i_alloc(struct net *net, struct inet6_dev *idev,
141 const struct in6_addr *addr, bool anycast); 135 const struct in6_addr *addr, bool anycast,
136 gfp_t gfp_flags);
142 137
143struct rt6_info *ip6_dst_alloc(struct net *net, struct net_device *dev, 138struct rt6_info *ip6_dst_alloc(struct net *net, struct net_device *dev,
144 int flags); 139 int flags);
@@ -147,9 +142,11 @@ struct rt6_info *ip6_dst_alloc(struct net *net, struct net_device *dev,
147 * support functions for ND 142 * support functions for ND
148 * 143 *
149 */ 144 */
150struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, 145struct fib6_info *rt6_get_dflt_router(struct net *net,
146 const struct in6_addr *addr,
151 struct net_device *dev); 147 struct net_device *dev);
152struct rt6_info *rt6_add_dflt_router(const struct in6_addr *gwaddr, 148struct fib6_info *rt6_add_dflt_router(struct net *net,
149 const struct in6_addr *gwaddr,
153 struct net_device *dev, unsigned int pref); 150 struct net_device *dev, unsigned int pref);
154 151
155void rt6_purge_dflt_routers(struct net *net); 152void rt6_purge_dflt_routers(struct net *net);
@@ -174,14 +171,14 @@ struct rt6_rtnl_dump_arg {
174 struct net *net; 171 struct net *net;
175}; 172};
176 173
177int rt6_dump_route(struct rt6_info *rt, void *p_arg); 174int rt6_dump_route(struct fib6_info *f6i, void *p_arg);
178void rt6_mtu_change(struct net_device *dev, unsigned int mtu); 175void rt6_mtu_change(struct net_device *dev, unsigned int mtu);
179void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); 176void rt6_remove_prefsrc(struct inet6_ifaddr *ifp);
180void rt6_clean_tohost(struct net *net, struct in6_addr *gateway); 177void rt6_clean_tohost(struct net *net, struct in6_addr *gateway);
181void rt6_sync_up(struct net_device *dev, unsigned int nh_flags); 178void rt6_sync_up(struct net_device *dev, unsigned int nh_flags);
182void rt6_disable_ip(struct net_device *dev, unsigned long event); 179void rt6_disable_ip(struct net_device *dev, unsigned long event);
183void rt6_sync_down_dev(struct net_device *dev, unsigned long event); 180void rt6_sync_down_dev(struct net_device *dev, unsigned long event);
184void rt6_multipath_rebalance(struct rt6_info *rt); 181void rt6_multipath_rebalance(struct fib6_info *f6i);
185 182
186void rt6_uncached_list_add(struct rt6_info *rt); 183void rt6_uncached_list_add(struct rt6_info *rt);
187void rt6_uncached_list_del(struct rt6_info *rt); 184void rt6_uncached_list_del(struct rt6_info *rt);
@@ -269,12 +266,38 @@ static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt,
269 return daddr; 266 return daddr;
270} 267}
271 268
272static inline bool rt6_duplicate_nexthop(struct rt6_info *a, struct rt6_info *b) 269static inline bool rt6_duplicate_nexthop(struct fib6_info *a, struct fib6_info *b)
273{ 270{
274 return a->dst.dev == b->dst.dev && 271 return a->fib6_nh.nh_dev == b->fib6_nh.nh_dev &&
275 a->rt6i_idev == b->rt6i_idev && 272 ipv6_addr_equal(&a->fib6_nh.nh_gw, &b->fib6_nh.nh_gw) &&
276 ipv6_addr_equal(&a->rt6i_gateway, &b->rt6i_gateway) && 273 !lwtunnel_cmp_encap(a->fib6_nh.nh_lwtstate, b->fib6_nh.nh_lwtstate);
277 !lwtunnel_cmp_encap(a->dst.lwtstate, b->dst.lwtstate);
278} 274}
279 275
276static inline unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst)
277{
278 struct inet6_dev *idev;
279 unsigned int mtu;
280
281 if (dst_metric_locked(dst, RTAX_MTU)) {
282 mtu = dst_metric_raw(dst, RTAX_MTU);
283 if (mtu)
284 return mtu;
285 }
286
287 mtu = IPV6_MIN_MTU;
288 rcu_read_lock();
289 idev = __in6_dev_get(dst->dev);
290 if (idev)
291 mtu = idev->cnf.mtu6;
292 rcu_read_unlock();
293
294 return mtu;
295}
296
297u32 ip6_mtu_from_fib6(struct fib6_info *f6i, struct in6_addr *daddr,
298 struct in6_addr *saddr);
299
300struct neighbour *ip6_neigh_lookup(const struct in6_addr *gw,
301 struct net_device *dev, struct sk_buff *skb,
302 const void *daddr);
280#endif 303#endif
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 81d0f2107ff1..69c91d1934c1 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -449,4 +449,6 @@ static inline void fib_proc_exit(struct net *net)
449} 449}
450#endif 450#endif
451 451
452u32 ip_mtu_from_fib_result(struct fib_result *res, __be32 daddr);
453
452#endif /* _NET_FIB_H */ 454#endif /* _NET_FIB_H */
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 540a4b4417bf..90ff430f5e9d 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -379,6 +379,17 @@ static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph,
379 return 0; 379 return 0;
380} 380}
381 381
382static inline u8 ip_tunnel_get_ttl(const struct iphdr *iph,
383 const struct sk_buff *skb)
384{
385 if (skb->protocol == htons(ETH_P_IP))
386 return iph->ttl;
387 else if (skb->protocol == htons(ETH_P_IPV6))
388 return ((const struct ipv6hdr *)iph)->hop_limit;
389 else
390 return 0;
391}
392
382/* Propogate ECN bits out */ 393/* Propogate ECN bits out */
383static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph, 394static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
384 const struct sk_buff *skb) 395 const struct sk_buff *skb)
@@ -466,12 +477,12 @@ static inline struct ip_tunnel_info *lwt_tun_info(struct lwtunnel_state *lwtstat
466 return (struct ip_tunnel_info *)lwtstate->data; 477 return (struct ip_tunnel_info *)lwtstate->data;
467} 478}
468 479
469extern struct static_key ip_tunnel_metadata_cnt; 480DECLARE_STATIC_KEY_FALSE(ip_tunnel_metadata_cnt);
470 481
471/* Returns > 0 if metadata should be collected */ 482/* Returns > 0 if metadata should be collected */
472static inline int ip_tunnel_collect_metadata(void) 483static inline int ip_tunnel_collect_metadata(void)
473{ 484{
474 return static_key_false(&ip_tunnel_metadata_cnt); 485 return static_branch_unlikely(&ip_tunnel_metadata_cnt);
475} 486}
476 487
477void __init ip_tunnel_core_init(void); 488void __init ip_tunnel_core_init(void);
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index aea7a124e66b..6d6e21dee462 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -656,6 +656,7 @@ struct ip_vs_dest {
656 volatile unsigned int flags; /* dest status flags */ 656 volatile unsigned int flags; /* dest status flags */
657 atomic_t conn_flags; /* flags to copy to conn */ 657 atomic_t conn_flags; /* flags to copy to conn */
658 atomic_t weight; /* server weight */ 658 atomic_t weight; /* server weight */
659 atomic_t last_weight; /* server latest weight */
659 660
660 refcount_t refcnt; /* reference counter */ 661 refcount_t refcnt; /* reference counter */
661 struct ip_vs_stats stats; /* statistics */ 662 struct ip_vs_stats stats; /* statistics */
@@ -750,14 +751,14 @@ struct ip_vs_app {
750 * 2=Mangled but checksum was not updated 751 * 2=Mangled but checksum was not updated
751 */ 752 */
752 int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *, 753 int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *,
753 struct sk_buff *, int *diff); 754 struct sk_buff *, int *diff, struct ip_vs_iphdr *ipvsh);
754 755
755 /* input hook: Process packet in outin direction, diff set for TCP. 756 /* input hook: Process packet in outin direction, diff set for TCP.
756 * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok, 757 * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok,
757 * 2=Mangled but checksum was not updated 758 * 2=Mangled but checksum was not updated
758 */ 759 */
759 int (*pkt_in)(struct ip_vs_app *, struct ip_vs_conn *, 760 int (*pkt_in)(struct ip_vs_app *, struct ip_vs_conn *,
760 struct sk_buff *, int *diff); 761 struct sk_buff *, int *diff, struct ip_vs_iphdr *ipvsh);
761 762
762 /* ip_vs_app initializer */ 763 /* ip_vs_app initializer */
763 int (*init_conn)(struct ip_vs_app *, struct ip_vs_conn *); 764 int (*init_conn)(struct ip_vs_app *, struct ip_vs_conn *);
@@ -1315,8 +1316,10 @@ int register_ip_vs_app_inc(struct netns_ipvs *ipvs, struct ip_vs_app *app, __u16
1315int ip_vs_app_inc_get(struct ip_vs_app *inc); 1316int ip_vs_app_inc_get(struct ip_vs_app *inc);
1316void ip_vs_app_inc_put(struct ip_vs_app *inc); 1317void ip_vs_app_inc_put(struct ip_vs_app *inc);
1317 1318
1318int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); 1319int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb,
1319int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); 1320 struct ip_vs_iphdr *ipvsh);
1321int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb,
1322 struct ip_vs_iphdr *ipvsh);
1320 1323
1321int register_ip_vs_pe(struct ip_vs_pe *pe); 1324int register_ip_vs_pe(struct ip_vs_pe *pe);
1322int unregister_ip_vs_pe(struct ip_vs_pe *pe); 1325int unregister_ip_vs_pe(struct ip_vs_pe *pe);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 836f31af1369..16475c269749 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -298,6 +298,7 @@ struct ipcm6_cookie {
298 __s16 tclass; 298 __s16 tclass;
299 __s8 dontfrag; 299 __s8 dontfrag;
300 struct ipv6_txoptions *opt; 300 struct ipv6_txoptions *opt;
301 __u16 gso_size;
301}; 302};
302 303
303static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np) 304static inline struct ipv6_txoptions *txopt_get(const struct ipv6_pinfo *np)
@@ -906,6 +907,11 @@ static inline __be32 ip6_make_flowinfo(unsigned int tclass, __be32 flowlabel)
906 return htonl(tclass << IPV6_TCLASS_SHIFT) | flowlabel; 907 return htonl(tclass << IPV6_TCLASS_SHIFT) | flowlabel;
907} 908}
908 909
910static inline __be32 flowi6_get_flowlabel(const struct flowi6 *fl6)
911{
912 return fl6->flowlabel & IPV6_FLOWLABEL_MASK;
913}
914
909/* 915/*
910 * Prototypes exported by ipv6 916 * Prototypes exported by ipv6
911 */ 917 */
@@ -950,6 +956,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
950 void *from, int length, int transhdrlen, 956 void *from, int length, int transhdrlen,
951 struct ipcm6_cookie *ipc6, struct flowi6 *fl6, 957 struct ipcm6_cookie *ipc6, struct flowi6 *fl6,
952 struct rt6_info *rt, unsigned int flags, 958 struct rt6_info *rt, unsigned int flags,
959 struct inet_cork_full *cork,
953 const struct sockcm_cookie *sockc); 960 const struct sockcm_cookie *sockc);
954 961
955static inline struct sk_buff *ip6_finish_skb(struct sock *sk) 962static inline struct sk_buff *ip6_finish_skb(struct sock *sk)
@@ -958,8 +965,6 @@ static inline struct sk_buff *ip6_finish_skb(struct sock *sk)
958 &inet6_sk(sk)->cork); 965 &inet6_sk(sk)->cork);
959} 966}
960 967
961unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst);
962
963int ip6_dst_lookup(struct net *net, struct sock *sk, struct dst_entry **dst, 968int ip6_dst_lookup(struct net *net, struct sock *sk, struct dst_entry **dst,
964 struct flowi6 *fl6); 969 struct flowi6 *fl6);
965struct dst_entry *ip6_dst_lookup_flow(const struct sock *sk, struct flowi6 *fl6, 970struct dst_entry *ip6_dst_lookup_flow(const struct sock *sk, struct flowi6 *fl6,
@@ -1044,8 +1049,6 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info);
1044void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu); 1049void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu);
1045 1050
1046int inet6_release(struct socket *sock); 1051int inet6_release(struct socket *sock);
1047int __inet6_bind(struct sock *sock, struct sockaddr *uaddr, int addr_len,
1048 bool force_bind_address_no_port, bool with_lock);
1049int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len); 1052int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
1050int inet6_getname(struct socket *sock, struct sockaddr *uaddr, 1053int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
1051 int peer); 1054 int peer);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b2f3a0c018e7..851a5e19ae32 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3378,6 +3378,8 @@ enum ieee80211_reconfig_type {
3378 * frame in case that no beacon was heard from the AP/P2P GO. 3378 * frame in case that no beacon was heard from the AP/P2P GO.
3379 * The callback will be called before each transmission and upon return 3379 * The callback will be called before each transmission and upon return
3380 * mac80211 will transmit the frame right away. 3380 * mac80211 will transmit the frame right away.
3381 * If duration is greater than zero, mac80211 hints to the driver the
3382 * duration for which the operation is requested.
3381 * The callback is optional and can (should!) sleep. 3383 * The callback is optional and can (should!) sleep.
3382 * 3384 *
3383 * @mgd_protect_tdls_discover: Protect a TDLS discovery session. After sending 3385 * @mgd_protect_tdls_discover: Protect a TDLS discovery session. After sending
@@ -3697,7 +3699,8 @@ struct ieee80211_ops {
3697 u32 sset, u8 *data); 3699 u32 sset, u8 *data);
3698 3700
3699 void (*mgd_prepare_tx)(struct ieee80211_hw *hw, 3701 void (*mgd_prepare_tx)(struct ieee80211_hw *hw,
3700 struct ieee80211_vif *vif); 3702 struct ieee80211_vif *vif,
3703 u16 duration);
3701 3704
3702 void (*mgd_protect_tdls_discover)(struct ieee80211_hw *hw, 3705 void (*mgd_protect_tdls_discover)(struct ieee80211_hw *hw,
3703 struct ieee80211_vif *vif); 3706 struct ieee80211_vif *vif);
@@ -4450,6 +4453,19 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
4450u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif); 4453u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif);
4451 4454
4452/** 4455/**
4456 * ieee80211_csa_set_counter - request mac80211 to set csa counter
4457 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
4458 * @counter: the new value for the counter
4459 *
4460 * The csa counter can be changed by the device, this API should be
4461 * used by the device driver to update csa counter in mac80211.
4462 *
4463 * It should never be used together with ieee80211_csa_update_counter(),
4464 * as it will cause a race condition around the counter value.
4465 */
4466void ieee80211_csa_set_counter(struct ieee80211_vif *vif, u8 counter);
4467
4468/**
4453 * ieee80211_csa_finish - notify mac80211 about channel switch 4469 * ieee80211_csa_finish - notify mac80211 about channel switch
4454 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 4470 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
4455 * 4471 *
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index e421f86af043..6c1eecd56a4d 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -246,6 +246,7 @@ static inline void *neighbour_priv(const struct neighbour *n)
246#define NEIGH_UPDATE_F_OVERRIDE 0x00000001 246#define NEIGH_UPDATE_F_OVERRIDE 0x00000001
247#define NEIGH_UPDATE_F_WEAK_OVERRIDE 0x00000002 247#define NEIGH_UPDATE_F_WEAK_OVERRIDE 0x00000002
248#define NEIGH_UPDATE_F_OVERRIDE_ISROUTER 0x00000004 248#define NEIGH_UPDATE_F_OVERRIDE_ISROUTER 0x00000004
249#define NEIGH_UPDATE_F_EXT_LEARNED 0x20000000
249#define NEIGH_UPDATE_F_ISROUTER 0x40000000 250#define NEIGH_UPDATE_F_ISROUTER 0x40000000
250#define NEIGH_UPDATE_F_ADMIN 0x80000000 251#define NEIGH_UPDATE_F_ADMIN 0x80000000
251 252
@@ -526,5 +527,21 @@ static inline void neigh_ha_snapshot(char *dst, const struct neighbour *n,
526 } while (read_seqretry(&n->ha_lock, seq)); 527 } while (read_seqretry(&n->ha_lock, seq));
527} 528}
528 529
529 530static inline void neigh_update_ext_learned(struct neighbour *neigh, u32 flags,
531 int *notify)
532{
533 u8 ndm_flags = 0;
534
535 if (!(flags & NEIGH_UPDATE_F_ADMIN))
536 return;
537
538 ndm_flags |= (flags & NEIGH_UPDATE_F_EXT_LEARNED) ? NTF_EXT_LEARNED : 0;
539 if ((neigh->flags ^ ndm_flags) & NTF_EXT_LEARNED) {
540 if (ndm_flags & NTF_EXT_LEARNED)
541 neigh->flags |= NTF_EXT_LEARNED;
542 else
543 neigh->flags &= ~NTF_EXT_LEARNED;
544 *notify = 1;
545 }
546}
530#endif 547#endif
diff --git a/include/net/net_failover.h b/include/net/net_failover.h
new file mode 100644
index 000000000000..b12a1c469d1c
--- /dev/null
+++ b/include/net/net_failover.h
@@ -0,0 +1,40 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright (c) 2018, Intel Corporation. */
3
4#ifndef _NET_FAILOVER_H
5#define _NET_FAILOVER_H
6
7#include <net/failover.h>
8
9/* failover state */
10struct net_failover_info {
11 /* primary netdev with same MAC */
12 struct net_device __rcu *primary_dev;
13
14 /* standby netdev */
15 struct net_device __rcu *standby_dev;
16
17 /* primary netdev stats */
18 struct rtnl_link_stats64 primary_stats;
19
20 /* standby netdev stats */
21 struct rtnl_link_stats64 standby_stats;
22
23 /* aggregated stats */
24 struct rtnl_link_stats64 failover_stats;
25
26 /* spinlock while updating stats */
27 spinlock_t stats_lock;
28};
29
30struct failover *net_failover_create(struct net_device *standby_dev);
31void net_failover_destroy(struct failover *failover);
32
33#define FAILOVER_VLAN_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
34 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
35 NETIF_F_HIGHDMA | NETIF_F_LRO)
36
37#define FAILOVER_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
38 NETIF_F_RXCSUM | NETIF_F_ALL_TSO)
39
40#endif /* _NET_FAILOVER_H */
diff --git a/include/net/netfilter/ipv4/nf_nat_masquerade.h b/include/net/netfilter/ipv4/nf_nat_masquerade.h
index ebd869473603..cd24be4c4a99 100644
--- a/include/net/netfilter/ipv4/nf_nat_masquerade.h
+++ b/include/net/netfilter/ipv4/nf_nat_masquerade.h
@@ -6,7 +6,7 @@
6 6
7unsigned int 7unsigned int
8nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum, 8nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum,
9 const struct nf_nat_range *range, 9 const struct nf_nat_range2 *range,
10 const struct net_device *out); 10 const struct net_device *out);
11 11
12void nf_nat_masquerade_ipv4_register_notifier(void); 12void nf_nat_masquerade_ipv4_register_notifier(void);
diff --git a/include/net/netfilter/ipv6/nf_nat_masquerade.h b/include/net/netfilter/ipv6/nf_nat_masquerade.h
index 1ed4f2631ed6..0c3b5ebf0bb8 100644
--- a/include/net/netfilter/ipv6/nf_nat_masquerade.h
+++ b/include/net/netfilter/ipv6/nf_nat_masquerade.h
@@ -3,7 +3,7 @@
3#define _NF_NAT_MASQUERADE_IPV6_H_ 3#define _NF_NAT_MASQUERADE_IPV6_H_
4 4
5unsigned int 5unsigned int
6nf_nat_masquerade_ipv6(struct sk_buff *skb, const struct nf_nat_range *range, 6nf_nat_masquerade_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,
7 const struct net_device *out); 7 const struct net_device *out);
8void nf_nat_masquerade_ipv6_register_notifier(void); 8void nf_nat_masquerade_ipv6_register_notifier(void);
9void nf_nat_masquerade_ipv6_unregister_notifier(void); 9void nf_nat_masquerade_ipv6_unregister_notifier(void);
diff --git a/include/net/netfilter/nf_conntrack_count.h b/include/net/netfilter/nf_conntrack_count.h
index e61184fbfb71..1910b6572430 100644
--- a/include/net/netfilter/nf_conntrack_count.h
+++ b/include/net/netfilter/nf_conntrack_count.h
@@ -13,4 +13,15 @@ unsigned int nf_conncount_count(struct net *net,
13 const u32 *key, 13 const u32 *key,
14 const struct nf_conntrack_tuple *tuple, 14 const struct nf_conntrack_tuple *tuple,
15 const struct nf_conntrack_zone *zone); 15 const struct nf_conntrack_zone *zone);
16
17unsigned int nf_conncount_lookup(struct net *net, struct hlist_head *head,
18 const struct nf_conntrack_tuple *tuple,
19 const struct nf_conntrack_zone *zone,
20 bool *addit);
21
22bool nf_conncount_add(struct hlist_head *head,
23 const struct nf_conntrack_tuple *tuple);
24
25void nf_conncount_cache_free(struct hlist_head *hhead);
26
16#endif 27#endif
diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
index 833752dd0c58..ba9fa4592f2b 100644
--- a/include/net/netfilter/nf_flow_table.h
+++ b/include/net/netfilter/nf_flow_table.h
@@ -6,6 +6,7 @@
6#include <linux/netdevice.h> 6#include <linux/netdevice.h>
7#include <linux/rhashtable.h> 7#include <linux/rhashtable.h>
8#include <linux/rcupdate.h> 8#include <linux/rcupdate.h>
9#include <linux/netfilter/nf_conntrack_tuple_common.h>
9#include <net/dst.h> 10#include <net/dst.h>
10 11
11struct nf_flowtable; 12struct nf_flowtable;
@@ -13,25 +14,24 @@ struct nf_flowtable;
13struct nf_flowtable_type { 14struct nf_flowtable_type {
14 struct list_head list; 15 struct list_head list;
15 int family; 16 int family;
16 void (*gc)(struct work_struct *work); 17 int (*init)(struct nf_flowtable *ft);
17 void (*free)(struct nf_flowtable *ft); 18 void (*free)(struct nf_flowtable *ft);
18 const struct rhashtable_params *params;
19 nf_hookfn *hook; 19 nf_hookfn *hook;
20 struct module *owner; 20 struct module *owner;
21}; 21};
22 22
23struct nf_flowtable { 23struct nf_flowtable {
24 struct list_head list;
24 struct rhashtable rhashtable; 25 struct rhashtable rhashtable;
25 const struct nf_flowtable_type *type; 26 const struct nf_flowtable_type *type;
26 struct delayed_work gc_work; 27 struct delayed_work gc_work;
27}; 28};
28 29
29enum flow_offload_tuple_dir { 30enum flow_offload_tuple_dir {
30 FLOW_OFFLOAD_DIR_ORIGINAL, 31 FLOW_OFFLOAD_DIR_ORIGINAL = IP_CT_DIR_ORIGINAL,
31 FLOW_OFFLOAD_DIR_REPLY, 32 FLOW_OFFLOAD_DIR_REPLY = IP_CT_DIR_REPLY,
32 __FLOW_OFFLOAD_DIR_MAX = FLOW_OFFLOAD_DIR_REPLY, 33 FLOW_OFFLOAD_DIR_MAX = IP_CT_DIR_MAX
33}; 34};
34#define FLOW_OFFLOAD_DIR_MAX (__FLOW_OFFLOAD_DIR_MAX + 1)
35 35
36struct flow_offload_tuple { 36struct flow_offload_tuple {
37 union { 37 union {
@@ -55,6 +55,8 @@ struct flow_offload_tuple {
55 55
56 int oifidx; 56 int oifidx;
57 57
58 u16 mtu;
59
58 struct dst_entry *dst_cache; 60 struct dst_entry *dst_cache;
59}; 61};
60 62
@@ -66,6 +68,7 @@ struct flow_offload_tuple_rhash {
66#define FLOW_OFFLOAD_SNAT 0x1 68#define FLOW_OFFLOAD_SNAT 0x1
67#define FLOW_OFFLOAD_DNAT 0x2 69#define FLOW_OFFLOAD_DNAT 0x2
68#define FLOW_OFFLOAD_DYING 0x4 70#define FLOW_OFFLOAD_DYING 0x4
71#define FLOW_OFFLOAD_TEARDOWN 0x8
69 72
70struct flow_offload { 73struct flow_offload {
71 struct flow_offload_tuple_rhash tuplehash[FLOW_OFFLOAD_DIR_MAX]; 74 struct flow_offload_tuple_rhash tuplehash[FLOW_OFFLOAD_DIR_MAX];
@@ -98,11 +101,14 @@ int nf_flow_table_iterate(struct nf_flowtable *flow_table,
98 101
99void nf_flow_table_cleanup(struct net *net, struct net_device *dev); 102void nf_flow_table_cleanup(struct net *net, struct net_device *dev);
100 103
104int nf_flow_table_init(struct nf_flowtable *flow_table);
101void nf_flow_table_free(struct nf_flowtable *flow_table); 105void nf_flow_table_free(struct nf_flowtable *flow_table);
102void nf_flow_offload_work_gc(struct work_struct *work);
103extern const struct rhashtable_params nf_flow_offload_rhash_params;
104 106
105void flow_offload_dead(struct flow_offload *flow); 107void flow_offload_teardown(struct flow_offload *flow);
108static inline void flow_offload_dead(struct flow_offload *flow)
109{
110 flow->flags |= FLOW_OFFLOAD_DYING;
111}
106 112
107int nf_flow_snat_port(const struct flow_offload *flow, 113int nf_flow_snat_port(const struct flow_offload *flow,
108 struct sk_buff *skb, unsigned int thoff, 114 struct sk_buff *skb, unsigned int thoff,
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 207a467e7ca6..a17eb2f8d40e 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -39,7 +39,7 @@ struct nf_conn_nat {
39 39
40/* Set up the info structure to map into this range. */ 40/* Set up the info structure to map into this range. */
41unsigned int nf_nat_setup_info(struct nf_conn *ct, 41unsigned int nf_nat_setup_info(struct nf_conn *ct,
42 const struct nf_nat_range *range, 42 const struct nf_nat_range2 *range,
43 enum nf_nat_manip_type maniptype); 43 enum nf_nat_manip_type maniptype);
44 44
45extern unsigned int nf_nat_alloc_null_binding(struct nf_conn *ct, 45extern unsigned int nf_nat_alloc_null_binding(struct nf_conn *ct,
@@ -75,4 +75,8 @@ static inline bool nf_nat_oif_changed(unsigned int hooknum,
75#endif 75#endif
76} 76}
77 77
78int nf_nat_register_fn(struct net *net, const struct nf_hook_ops *ops,
79 const struct nf_hook_ops *nat_ops, unsigned int ops_count);
80void nf_nat_unregister_fn(struct net *net, const struct nf_hook_ops *ops,
81 unsigned int ops_count);
78#endif 82#endif
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index 235bd0e9a5aa..dc7cd0440229 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -11,6 +11,10 @@
11unsigned int nf_nat_packet(struct nf_conn *ct, enum ip_conntrack_info ctinfo, 11unsigned int nf_nat_packet(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
12 unsigned int hooknum, struct sk_buff *skb); 12 unsigned int hooknum, struct sk_buff *skb);
13 13
14unsigned int
15nf_nat_inet_fn(void *priv, struct sk_buff *skb,
16 const struct nf_hook_state *state);
17
14int nf_xfrm_me_harder(struct net *net, struct sk_buff *skb, unsigned int family); 18int nf_xfrm_me_harder(struct net *net, struct sk_buff *skb, unsigned int family);
15 19
16static inline int nf_nat_initialized(struct nf_conn *ct, 20static inline int nf_nat_initialized(struct nf_conn *ct,
@@ -22,11 +26,4 @@ static inline int nf_nat_initialized(struct nf_conn *ct,
22 return ct->status & IPS_DST_NAT_DONE; 26 return ct->status & IPS_DST_NAT_DONE;
23} 27}
24 28
25struct nlattr;
26
27extern int
28(*nfnetlink_parse_nat_setup_hook)(struct nf_conn *ct,
29 enum nf_nat_manip_type manip,
30 const struct nlattr *attr);
31
32#endif /* _NF_NAT_CORE_H */ 29#endif /* _NF_NAT_CORE_H */
diff --git a/include/net/netfilter/nf_nat_l3proto.h b/include/net/netfilter/nf_nat_l3proto.h
index ce7c2b4e64bb..d300b8f03972 100644
--- a/include/net/netfilter/nf_nat_l3proto.h
+++ b/include/net/netfilter/nf_nat_l3proto.h
@@ -7,7 +7,7 @@ struct nf_nat_l3proto {
7 u8 l3proto; 7 u8 l3proto;
8 8
9 bool (*in_range)(const struct nf_conntrack_tuple *t, 9 bool (*in_range)(const struct nf_conntrack_tuple *t,
10 const struct nf_nat_range *range); 10 const struct nf_nat_range2 *range);
11 11
12 u32 (*secure_port)(const struct nf_conntrack_tuple *t, __be16); 12 u32 (*secure_port)(const struct nf_conntrack_tuple *t, __be16);
13 13
@@ -33,7 +33,7 @@ struct nf_nat_l3proto {
33 struct flowi *fl); 33 struct flowi *fl);
34 34
35 int (*nlattr_to_range)(struct nlattr *tb[], 35 int (*nlattr_to_range)(struct nlattr *tb[],
36 struct nf_nat_range *range); 36 struct nf_nat_range2 *range);
37}; 37};
38 38
39int nf_nat_l3proto_register(const struct nf_nat_l3proto *); 39int nf_nat_l3proto_register(const struct nf_nat_l3proto *);
@@ -44,66 +44,14 @@ int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
44 enum ip_conntrack_info ctinfo, 44 enum ip_conntrack_info ctinfo,
45 unsigned int hooknum); 45 unsigned int hooknum);
46 46
47unsigned int nf_nat_ipv4_in(void *priv, struct sk_buff *skb,
48 const struct nf_hook_state *state,
49 unsigned int (*do_chain)(void *priv,
50 struct sk_buff *skb,
51 const struct nf_hook_state *state,
52 struct nf_conn *ct));
53
54unsigned int nf_nat_ipv4_out(void *priv, struct sk_buff *skb,
55 const struct nf_hook_state *state,
56 unsigned int (*do_chain)(void *priv,
57 struct sk_buff *skb,
58 const struct nf_hook_state *state,
59 struct nf_conn *ct));
60
61unsigned int nf_nat_ipv4_local_fn(void *priv,
62 struct sk_buff *skb,
63 const struct nf_hook_state *state,
64 unsigned int (*do_chain)(void *priv,
65 struct sk_buff *skb,
66 const struct nf_hook_state *state,
67 struct nf_conn *ct));
68
69unsigned int nf_nat_ipv4_fn(void *priv, struct sk_buff *skb,
70 const struct nf_hook_state *state,
71 unsigned int (*do_chain)(void *priv,
72 struct sk_buff *skb,
73 const struct nf_hook_state *state,
74 struct nf_conn *ct));
75
76int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct, 47int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
77 enum ip_conntrack_info ctinfo, 48 enum ip_conntrack_info ctinfo,
78 unsigned int hooknum, unsigned int hdrlen); 49 unsigned int hooknum, unsigned int hdrlen);
79 50
80unsigned int nf_nat_ipv6_in(void *priv, struct sk_buff *skb, 51int nf_nat_l3proto_ipv4_register_fn(struct net *net, const struct nf_hook_ops *ops);
81 const struct nf_hook_state *state, 52void nf_nat_l3proto_ipv4_unregister_fn(struct net *net, const struct nf_hook_ops *ops);
82 unsigned int (*do_chain)(void *priv,
83 struct sk_buff *skb,
84 const struct nf_hook_state *state,
85 struct nf_conn *ct));
86
87unsigned int nf_nat_ipv6_out(void *priv, struct sk_buff *skb,
88 const struct nf_hook_state *state,
89 unsigned int (*do_chain)(void *priv,
90 struct sk_buff *skb,
91 const struct nf_hook_state *state,
92 struct nf_conn *ct));
93
94unsigned int nf_nat_ipv6_local_fn(void *priv,
95 struct sk_buff *skb,
96 const struct nf_hook_state *state,
97 unsigned int (*do_chain)(void *priv,
98 struct sk_buff *skb,
99 const struct nf_hook_state *state,
100 struct nf_conn *ct));
101 53
102unsigned int nf_nat_ipv6_fn(void *priv, struct sk_buff *skb, 54int nf_nat_l3proto_ipv6_register_fn(struct net *net, const struct nf_hook_ops *ops);
103 const struct nf_hook_state *state, 55void nf_nat_l3proto_ipv6_unregister_fn(struct net *net, const struct nf_hook_ops *ops);
104 unsigned int (*do_chain)(void *priv,
105 struct sk_buff *skb,
106 const struct nf_hook_state *state,
107 struct nf_conn *ct));
108 56
109#endif /* _NF_NAT_L3PROTO_H */ 57#endif /* _NF_NAT_L3PROTO_H */
diff --git a/include/net/netfilter/nf_nat_l4proto.h b/include/net/netfilter/nf_nat_l4proto.h
index 67835ff8a2d9..b4d6b29bca62 100644
--- a/include/net/netfilter/nf_nat_l4proto.h
+++ b/include/net/netfilter/nf_nat_l4proto.h
@@ -34,12 +34,12 @@ struct nf_nat_l4proto {
34 */ 34 */
35 void (*unique_tuple)(const struct nf_nat_l3proto *l3proto, 35 void (*unique_tuple)(const struct nf_nat_l3proto *l3proto,
36 struct nf_conntrack_tuple *tuple, 36 struct nf_conntrack_tuple *tuple,
37 const struct nf_nat_range *range, 37 const struct nf_nat_range2 *range,
38 enum nf_nat_manip_type maniptype, 38 enum nf_nat_manip_type maniptype,
39 const struct nf_conn *ct); 39 const struct nf_conn *ct);
40 40
41 int (*nlattr_to_range)(struct nlattr *tb[], 41 int (*nlattr_to_range)(struct nlattr *tb[],
42 struct nf_nat_range *range); 42 struct nf_nat_range2 *range);
43}; 43};
44 44
45/* Protocol registration. */ 45/* Protocol registration. */
@@ -72,11 +72,11 @@ bool nf_nat_l4proto_in_range(const struct nf_conntrack_tuple *tuple,
72 72
73void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto, 73void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto,
74 struct nf_conntrack_tuple *tuple, 74 struct nf_conntrack_tuple *tuple,
75 const struct nf_nat_range *range, 75 const struct nf_nat_range2 *range,
76 enum nf_nat_manip_type maniptype, 76 enum nf_nat_manip_type maniptype,
77 const struct nf_conn *ct, u16 *rover); 77 const struct nf_conn *ct, u16 *rover);
78 78
79int nf_nat_l4proto_nlattr_to_range(struct nlattr *tb[], 79int nf_nat_l4proto_nlattr_to_range(struct nlattr *tb[],
80 struct nf_nat_range *range); 80 struct nf_nat_range2 *range);
81 81
82#endif /*_NF_NAT_L4PROTO_H*/ 82#endif /*_NF_NAT_L4PROTO_H*/
diff --git a/include/net/netfilter/nf_nat_redirect.h b/include/net/netfilter/nf_nat_redirect.h
index 5ddabb08c472..c129aacc8ae8 100644
--- a/include/net/netfilter/nf_nat_redirect.h
+++ b/include/net/netfilter/nf_nat_redirect.h
@@ -7,7 +7,7 @@ nf_nat_redirect_ipv4(struct sk_buff *skb,
7 const struct nf_nat_ipv4_multi_range_compat *mr, 7 const struct nf_nat_ipv4_multi_range_compat *mr,
8 unsigned int hooknum); 8 unsigned int hooknum);
9unsigned int 9unsigned int
10nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range *range, 10nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,
11 unsigned int hooknum); 11 unsigned int hooknum);
12 12
13#endif /* _NF_NAT_REDIRECT_H_ */ 13#endif /* _NF_NAT_REDIRECT_H_ */
diff --git a/include/net/netfilter/nf_socket.h b/include/net/netfilter/nf_socket.h
index 8230fefff9f5..f9d7bee9bd4e 100644
--- a/include/net/netfilter/nf_socket.h
+++ b/include/net/netfilter/nf_socket.h
@@ -2,22 +2,7 @@
2#ifndef _NF_SOCK_H_ 2#ifndef _NF_SOCK_H_
3#define _NF_SOCK_H_ 3#define _NF_SOCK_H_
4 4
5struct net_device; 5#include <net/sock.h>
6struct sk_buff;
7struct sock;
8struct net;
9
10static inline bool nf_sk_is_transparent(struct sock *sk)
11{
12 switch (sk->sk_state) {
13 case TCP_TIME_WAIT:
14 return inet_twsk(sk)->tw_transparent;
15 case TCP_NEW_SYN_RECV:
16 return inet_rsk(inet_reqsk(sk))->no_srccheck;
17 default:
18 return inet_sk(sk)->transparent;
19 }
20}
21 6
22struct sock *nf_sk_lookup_slow_v4(struct net *net, const struct sk_buff *skb, 7struct sock *nf_sk_lookup_slow_v4(struct net *net, const struct sk_buff *skb,
23 const struct net_device *indev); 8 const struct net_device *indev);
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index a1e28dd5d0bf..08c005ce56e9 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -9,6 +9,7 @@
9#include <linux/netfilter/x_tables.h> 9#include <linux/netfilter/x_tables.h>
10#include <linux/netfilter/nf_tables.h> 10#include <linux/netfilter/nf_tables.h>
11#include <linux/u64_stats_sync.h> 11#include <linux/u64_stats_sync.h>
12#include <linux/rhashtable.h>
12#include <net/netfilter/nf_flow_table.h> 13#include <net/netfilter/nf_flow_table.h>
13#include <net/netlink.h> 14#include <net/netlink.h>
14 15
@@ -276,23 +277,6 @@ struct nft_set_estimate {
276 enum nft_set_class space; 277 enum nft_set_class space;
277}; 278};
278 279
279/**
280 * struct nft_set_type - nf_tables set type
281 *
282 * @select_ops: function to select nft_set_ops
283 * @ops: default ops, used when no select_ops functions is present
284 * @list: used internally
285 * @owner: module reference
286 */
287struct nft_set_type {
288 const struct nft_set_ops *(*select_ops)(const struct nft_ctx *,
289 const struct nft_set_desc *desc,
290 u32 flags);
291 const struct nft_set_ops *ops;
292 struct list_head list;
293 struct module *owner;
294};
295
296struct nft_set_ext; 280struct nft_set_ext;
297struct nft_expr; 281struct nft_expr;
298 282
@@ -311,7 +295,6 @@ struct nft_expr;
311 * @init: initialize private data of new set instance 295 * @init: initialize private data of new set instance
312 * @destroy: destroy private data of set instance 296 * @destroy: destroy private data of set instance
313 * @elemsize: element private size 297 * @elemsize: element private size
314 * @features: features supported by the implementation
315 */ 298 */
316struct nft_set_ops { 299struct nft_set_ops {
317 bool (*lookup)(const struct net *net, 300 bool (*lookup)(const struct net *net,
@@ -360,11 +343,26 @@ struct nft_set_ops {
360 const struct nft_set_desc *desc, 343 const struct nft_set_desc *desc,
361 const struct nlattr * const nla[]); 344 const struct nlattr * const nla[]);
362 void (*destroy)(const struct nft_set *set); 345 void (*destroy)(const struct nft_set *set);
346 void (*gc_init)(const struct nft_set *set);
363 347
364 unsigned int elemsize; 348 unsigned int elemsize;
349};
350
351/**
352 * struct nft_set_type - nf_tables set type
353 *
354 * @ops: set ops for this type
355 * @list: used internally
356 * @owner: module reference
357 * @features: features supported by the implementation
358 */
359struct nft_set_type {
360 const struct nft_set_ops ops;
361 struct list_head list;
362 struct module *owner;
365 u32 features; 363 u32 features;
366 const struct nft_set_type *type;
367}; 364};
365#define to_set_type(o) container_of(o, struct nft_set_type, ops)
368 366
369int nft_register_set(struct nft_set_type *type); 367int nft_register_set(struct nft_set_type *type);
370void nft_unregister_set(struct nft_set_type *type); 368void nft_unregister_set(struct nft_set_type *type);
@@ -374,6 +372,8 @@ void nft_unregister_set(struct nft_set_type *type);
374 * 372 *
375 * @list: table set list node 373 * @list: table set list node
376 * @bindings: list of set bindings 374 * @bindings: list of set bindings
375 * @table: table this set belongs to
376 * @net: netnamespace this set belongs to
377 * @name: name of the set 377 * @name: name of the set
378 * @handle: unique handle of the set 378 * @handle: unique handle of the set
379 * @ktype: key type (numeric type defined by userspace, not used in the kernel) 379 * @ktype: key type (numeric type defined by userspace, not used in the kernel)
@@ -397,6 +397,8 @@ void nft_unregister_set(struct nft_set_type *type);
397struct nft_set { 397struct nft_set {
398 struct list_head list; 398 struct list_head list;
399 struct list_head bindings; 399 struct list_head bindings;
400 struct nft_table *table;
401 possible_net_t net;
400 char *name; 402 char *name;
401 u64 handle; 403 u64 handle;
402 u32 ktype; 404 u32 ktype;
@@ -590,7 +592,7 @@ static inline u64 *nft_set_ext_timeout(const struct nft_set_ext *ext)
590 return nft_set_ext(ext, NFT_SET_EXT_TIMEOUT); 592 return nft_set_ext(ext, NFT_SET_EXT_TIMEOUT);
591} 593}
592 594
593static inline unsigned long *nft_set_ext_expiration(const struct nft_set_ext *ext) 595static inline u64 *nft_set_ext_expiration(const struct nft_set_ext *ext)
594{ 596{
595 return nft_set_ext(ext, NFT_SET_EXT_EXPIRATION); 597 return nft_set_ext(ext, NFT_SET_EXT_EXPIRATION);
596} 598}
@@ -608,7 +610,7 @@ static inline struct nft_expr *nft_set_ext_expr(const struct nft_set_ext *ext)
608static inline bool nft_set_elem_expired(const struct nft_set_ext *ext) 610static inline bool nft_set_elem_expired(const struct nft_set_ext *ext)
609{ 611{
610 return nft_set_ext_exists(ext, NFT_SET_EXT_EXPIRATION) && 612 return nft_set_ext_exists(ext, NFT_SET_EXT_EXPIRATION) &&
611 time_is_before_eq_jiffies(*nft_set_ext_expiration(ext)); 613 time_is_before_eq_jiffies64(*nft_set_ext_expiration(ext));
612} 614}
613 615
614static inline struct nft_set_ext *nft_set_elem_ext(const struct nft_set *set, 616static inline struct nft_set_ext *nft_set_elem_ext(const struct nft_set *set,
@@ -712,6 +714,7 @@ struct nft_expr_type {
712}; 714};
713 715
714#define NFT_EXPR_STATEFUL 0x1 716#define NFT_EXPR_STATEFUL 0x1
717#define NFT_EXPR_GC 0x2
715 718
716/** 719/**
717 * struct nft_expr_ops - nf_tables expression operations 720 * struct nft_expr_ops - nf_tables expression operations
@@ -743,11 +746,15 @@ struct nft_expr_ops {
743 const struct nft_expr *expr); 746 const struct nft_expr *expr);
744 void (*destroy)(const struct nft_ctx *ctx, 747 void (*destroy)(const struct nft_ctx *ctx,
745 const struct nft_expr *expr); 748 const struct nft_expr *expr);
749 void (*destroy_clone)(const struct nft_ctx *ctx,
750 const struct nft_expr *expr);
746 int (*dump)(struct sk_buff *skb, 751 int (*dump)(struct sk_buff *skb,
747 const struct nft_expr *expr); 752 const struct nft_expr *expr);
748 int (*validate)(const struct nft_ctx *ctx, 753 int (*validate)(const struct nft_ctx *ctx,
749 const struct nft_expr *expr, 754 const struct nft_expr *expr,
750 const struct nft_data **data); 755 const struct nft_data **data);
756 bool (*gc)(struct net *net,
757 const struct nft_expr *expr);
751 const struct nft_expr_type *type; 758 const struct nft_expr_type *type;
752 void *data; 759 void *data;
753}; 760};
@@ -854,6 +861,7 @@ enum nft_chain_flags {
854 * 861 *
855 * @rules: list of rules in the chain 862 * @rules: list of rules in the chain
856 * @list: used internally 863 * @list: used internally
864 * @rhlhead: used internally
857 * @table: table that this chain belongs to 865 * @table: table that this chain belongs to
858 * @handle: chain handle 866 * @handle: chain handle
859 * @use: number of jump references to this chain 867 * @use: number of jump references to this chain
@@ -862,8 +870,11 @@ enum nft_chain_flags {
862 * @name: name of the chain 870 * @name: name of the chain
863 */ 871 */
864struct nft_chain { 872struct nft_chain {
873 struct nft_rule *__rcu *rules_gen_0;
874 struct nft_rule *__rcu *rules_gen_1;
865 struct list_head rules; 875 struct list_head rules;
866 struct list_head list; 876 struct list_head list;
877 struct rhlist_head rhlhead;
867 struct nft_table *table; 878 struct nft_table *table;
868 u64 handle; 879 u64 handle;
869 u32 use; 880 u32 use;
@@ -871,8 +882,13 @@ struct nft_chain {
871 u8 flags:6, 882 u8 flags:6,
872 genmask:2; 883 genmask:2;
873 char *name; 884 char *name;
885
886 /* Only used during control plane commit phase: */
887 struct nft_rule **rules_next;
874}; 888};
875 889
890int nft_chain_validate(const struct nft_ctx *ctx, const struct nft_chain *chain);
891
876enum nft_chain_types { 892enum nft_chain_types {
877 NFT_CHAIN_T_DEFAULT = 0, 893 NFT_CHAIN_T_DEFAULT = 0,
878 NFT_CHAIN_T_ROUTE, 894 NFT_CHAIN_T_ROUTE,
@@ -889,8 +905,8 @@ enum nft_chain_types {
889 * @owner: module owner 905 * @owner: module owner
890 * @hook_mask: mask of valid hooks 906 * @hook_mask: mask of valid hooks
891 * @hooks: array of hook functions 907 * @hooks: array of hook functions
892 * @init: chain initialization function 908 * @ops_register: base chain register function
893 * @free: chain release function 909 * @ops_unregister: base chain unregister function
894 */ 910 */
895struct nft_chain_type { 911struct nft_chain_type {
896 const char *name; 912 const char *name;
@@ -899,8 +915,8 @@ struct nft_chain_type {
899 struct module *owner; 915 struct module *owner;
900 unsigned int hook_mask; 916 unsigned int hook_mask;
901 nf_hookfn *hooks[NF_MAX_HOOKS]; 917 nf_hookfn *hooks[NF_MAX_HOOKS];
902 int (*init)(struct nft_ctx *ctx); 918 int (*ops_register)(struct net *net, const struct nf_hook_ops *ops);
903 void (*free)(struct nft_ctx *ctx); 919 void (*ops_unregister)(struct net *net, const struct nf_hook_ops *ops);
904}; 920};
905 921
906int nft_chain_validate_dependency(const struct nft_chain *chain, 922int nft_chain_validate_dependency(const struct nft_chain *chain,
@@ -952,7 +968,8 @@ unsigned int nft_do_chain(struct nft_pktinfo *pkt, void *priv);
952 * struct nft_table - nf_tables table 968 * struct nft_table - nf_tables table
953 * 969 *
954 * @list: used internally 970 * @list: used internally
955 * @chains: chains in the table 971 * @chains_ht: chains in the table
972 * @chains: same, for stable walks
956 * @sets: sets in the table 973 * @sets: sets in the table
957 * @objects: stateful objects in the table 974 * @objects: stateful objects in the table
958 * @flowtables: flow tables in the table 975 * @flowtables: flow tables in the table
@@ -966,6 +983,7 @@ unsigned int nft_do_chain(struct nft_pktinfo *pkt, void *priv);
966 */ 983 */
967struct nft_table { 984struct nft_table {
968 struct list_head list; 985 struct list_head list;
986 struct rhltable chains_ht;
969 struct list_head chains; 987 struct list_head chains;
970 struct list_head sets; 988 struct list_head sets;
971 struct list_head objects; 989 struct list_head objects;
@@ -1020,9 +1038,9 @@ static inline void *nft_obj_data(const struct nft_object *obj)
1020 1038
1021#define nft_expr_obj(expr) *((struct nft_object **)nft_expr_priv(expr)) 1039#define nft_expr_obj(expr) *((struct nft_object **)nft_expr_priv(expr))
1022 1040
1023struct nft_object *nf_tables_obj_lookup(const struct nft_table *table, 1041struct nft_object *nft_obj_lookup(const struct nft_table *table,
1024 const struct nlattr *nla, u32 objtype, 1042 const struct nlattr *nla, u32 objtype,
1025 u8 genmask); 1043 u8 genmask);
1026 1044
1027void nft_obj_notify(struct net *net, struct nft_table *table, 1045void nft_obj_notify(struct net *net, struct nft_table *table,
1028 struct nft_object *obj, u32 portid, u32 seq, 1046 struct nft_object *obj, u32 portid, u32 seq,
@@ -1067,7 +1085,8 @@ struct nft_object_ops {
1067 int (*init)(const struct nft_ctx *ctx, 1085 int (*init)(const struct nft_ctx *ctx,
1068 const struct nlattr *const tb[], 1086 const struct nlattr *const tb[],
1069 struct nft_object *obj); 1087 struct nft_object *obj);
1070 void (*destroy)(struct nft_object *obj); 1088 void (*destroy)(const struct nft_ctx *ctx,
1089 struct nft_object *obj);
1071 int (*dump)(struct sk_buff *skb, 1090 int (*dump)(struct sk_buff *skb,
1072 struct nft_object *obj, 1091 struct nft_object *obj,
1073 bool reset); 1092 bool reset);
@@ -1111,12 +1130,9 @@ struct nft_flowtable {
1111 struct nf_flowtable data; 1130 struct nf_flowtable data;
1112}; 1131};
1113 1132
1114struct nft_flowtable *nf_tables_flowtable_lookup(const struct nft_table *table, 1133struct nft_flowtable *nft_flowtable_lookup(const struct nft_table *table,
1115 const struct nlattr *nla, 1134 const struct nlattr *nla,
1116 u8 genmask); 1135 u8 genmask);
1117void nft_flow_table_iterate(struct net *net,
1118 void (*iter)(struct nf_flowtable *flowtable, void *data),
1119 void *data);
1120 1136
1121void nft_register_flowtable_type(struct nf_flowtable_type *type); 1137void nft_register_flowtable_type(struct nf_flowtable_type *type);
1122void nft_unregister_flowtable_type(struct nf_flowtable_type *type); 1138void nft_unregister_flowtable_type(struct nf_flowtable_type *type);
diff --git a/include/net/netfilter/nf_tables_core.h b/include/net/netfilter/nf_tables_core.h
index ea5aab568be8..e0c0c2558ec4 100644
--- a/include/net/netfilter/nf_tables_core.h
+++ b/include/net/netfilter/nf_tables_core.h
@@ -2,6 +2,8 @@
2#ifndef _NET_NF_TABLES_CORE_H 2#ifndef _NET_NF_TABLES_CORE_H
3#define _NET_NF_TABLES_CORE_H 3#define _NET_NF_TABLES_CORE_H
4 4
5#include <net/netfilter/nf_tables.h>
6
5extern struct nft_expr_type nft_imm_type; 7extern struct nft_expr_type nft_imm_type;
6extern struct nft_expr_type nft_cmp_type; 8extern struct nft_expr_type nft_cmp_type;
7extern struct nft_expr_type nft_lookup_type; 9extern struct nft_expr_type nft_lookup_type;
@@ -10,6 +12,9 @@ extern struct nft_expr_type nft_byteorder_type;
10extern struct nft_expr_type nft_payload_type; 12extern struct nft_expr_type nft_payload_type;
11extern struct nft_expr_type nft_dynset_type; 13extern struct nft_expr_type nft_dynset_type;
12extern struct nft_expr_type nft_range_type; 14extern struct nft_expr_type nft_range_type;
15extern struct nft_expr_type nft_meta_type;
16extern struct nft_expr_type nft_rt_type;
17extern struct nft_expr_type nft_exthdr_type;
13 18
14int nf_tables_core_module_init(void); 19int nf_tables_core_module_init(void);
15void nf_tables_core_module_exit(void); 20void nf_tables_core_module_exit(void);
@@ -20,6 +25,12 @@ struct nft_cmp_fast_expr {
20 u8 len; 25 u8 len;
21}; 26};
22 27
28struct nft_immediate_expr {
29 struct nft_data data;
30 enum nft_registers dreg:8;
31 u8 dlen;
32};
33
23/* Calculate the mask for the nft_cmp_fast expression. On big endian the 34/* Calculate the mask for the nft_cmp_fast expression. On big endian the
24 * mask needs to include the *upper* bytes when interpreting that data as 35 * mask needs to include the *upper* bytes when interpreting that data as
25 * something smaller than the full u32, therefore a cpu_to_le32 is done. 36 * something smaller than the full u32, therefore a cpu_to_le32 is done.
diff --git a/include/net/netfilter/nf_tproxy.h b/include/net/netfilter/nf_tproxy.h
new file mode 100644
index 000000000000..9754a50ecde9
--- /dev/null
+++ b/include/net/netfilter/nf_tproxy.h
@@ -0,0 +1,113 @@
1#ifndef _NF_TPROXY_H_
2#define _NF_TPROXY_H_
3
4#include <net/tcp.h>
5
6enum nf_tproxy_lookup_t {
7 NF_TPROXY_LOOKUP_LISTENER,
8 NF_TPROXY_LOOKUP_ESTABLISHED,
9};
10
11static inline bool nf_tproxy_sk_is_transparent(struct sock *sk)
12{
13 if (inet_sk_transparent(sk))
14 return true;
15
16 sock_gen_put(sk);
17 return false;
18}
19
20__be32 nf_tproxy_laddr4(struct sk_buff *skb, __be32 user_laddr, __be32 daddr);
21
22/**
23 * nf_tproxy_handle_time_wait4 - handle IPv4 TCP TIME_WAIT reopen redirections
24 * @skb: The skb being processed.
25 * @laddr: IPv4 address to redirect to or zero.
26 * @lport: TCP port to redirect to or zero.
27 * @sk: The TIME_WAIT TCP socket found by the lookup.
28 *
29 * We have to handle SYN packets arriving to TIME_WAIT sockets
30 * differently: instead of reopening the connection we should rather
31 * redirect the new connection to the proxy if there's a listener
32 * socket present.
33 *
34 * nf_tproxy_handle_time_wait4() consumes the socket reference passed in.
35 *
36 * Returns the listener socket if there's one, the TIME_WAIT socket if
37 * no such listener is found, or NULL if the TCP header is incomplete.
38 */
39struct sock *
40nf_tproxy_handle_time_wait4(struct net *net, struct sk_buff *skb,
41 __be32 laddr, __be16 lport, struct sock *sk);
42
43/*
44 * This is used when the user wants to intercept a connection matching
45 * an explicit iptables rule. In this case the sockets are assumed
46 * matching in preference order:
47 *
48 * - match: if there's a fully established connection matching the
49 * _packet_ tuple, it is returned, assuming the redirection
50 * already took place and we process a packet belonging to an
51 * established connection
52 *
53 * - match: if there's a listening socket matching the redirection
54 * (e.g. on-port & on-ip of the connection), it is returned,
55 * regardless if it was bound to 0.0.0.0 or an explicit
56 * address. The reasoning is that if there's an explicit rule, it
57 * does not really matter if the listener is bound to an interface
58 * or to 0. The user already stated that he wants redirection
59 * (since he added the rule).
60 *
61 * Please note that there's an overlap between what a TPROXY target
62 * and a socket match will match. Normally if you have both rules the
63 * "socket" match will be the first one, effectively all packets
64 * belonging to established connections going through that one.
65 */
66struct sock *
67nf_tproxy_get_sock_v4(struct net *net, struct sk_buff *skb, void *hp,
68 const u8 protocol,
69 const __be32 saddr, const __be32 daddr,
70 const __be16 sport, const __be16 dport,
71 const struct net_device *in,
72 const enum nf_tproxy_lookup_t lookup_type);
73
74const struct in6_addr *
75nf_tproxy_laddr6(struct sk_buff *skb, const struct in6_addr *user_laddr,
76 const struct in6_addr *daddr);
77
78/**
79 * nf_tproxy_handle_time_wait6 - handle IPv6 TCP TIME_WAIT reopen redirections
80 * @skb: The skb being processed.
81 * @tproto: Transport protocol.
82 * @thoff: Transport protocol header offset.
83 * @net: Network namespace.
84 * @laddr: IPv6 address to redirect to.
85 * @lport: TCP port to redirect to or zero.
86 * @sk: The TIME_WAIT TCP socket found by the lookup.
87 *
88 * We have to handle SYN packets arriving to TIME_WAIT sockets
89 * differently: instead of reopening the connection we should rather
90 * redirect the new connection to the proxy if there's a listener
91 * socket present.
92 *
93 * nf_tproxy_handle_time_wait6() consumes the socket reference passed in.
94 *
95 * Returns the listener socket if there's one, the TIME_WAIT socket if
96 * no such listener is found, or NULL if the TCP header is incomplete.
97 */
98struct sock *
99nf_tproxy_handle_time_wait6(struct sk_buff *skb, int tproto, int thoff,
100 struct net *net,
101 const struct in6_addr *laddr,
102 const __be16 lport,
103 struct sock *sk);
104
105struct sock *
106nf_tproxy_get_sock_v6(struct net *net, struct sk_buff *skb, int thoff, void *hp,
107 const u8 protocol,
108 const struct in6_addr *saddr, const struct in6_addr *daddr,
109 const __be16 sport, const __be16 dport,
110 const struct net_device *in,
111 const enum nf_tproxy_lookup_t lookup_type);
112
113#endif /* _NF_TPROXY_H_ */
diff --git a/include/net/netfilter/nfnetlink_log.h b/include/net/netfilter/nfnetlink_log.h
index 612cfb63ac68..ea32a7d3cf1b 100644
--- a/include/net/netfilter/nfnetlink_log.h
+++ b/include/net/netfilter/nfnetlink_log.h
@@ -1,18 +1 @@
1/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _KER_NFNETLINK_LOG_H
3#define _KER_NFNETLINK_LOG_H
4
5void
6nfulnl_log_packet(struct net *net,
7 u_int8_t pf,
8 unsigned int hooknum,
9 const struct sk_buff *skb,
10 const struct net_device *in,
11 const struct net_device *out,
12 const struct nf_loginfo *li_user,
13 const char *prefix);
14
15#define NFULNL_COPY_DISABLED 0xff
16
17#endif /* _KER_NFNETLINK_LOG_H */
18
diff --git a/include/net/netfilter/nft_meta.h b/include/net/netfilter/nft_meta.h
deleted file mode 100644
index 5c69e9b09388..000000000000
--- a/include/net/netfilter/nft_meta.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _NFT_META_H_
3#define _NFT_META_H_
4
5struct nft_meta {
6 enum nft_meta_keys key:8;
7 union {
8 enum nft_registers dreg:8;
9 enum nft_registers sreg:8;
10 };
11};
12
13extern const struct nla_policy nft_meta_policy[];
14
15int nft_meta_get_init(const struct nft_ctx *ctx,
16 const struct nft_expr *expr,
17 const struct nlattr * const tb[]);
18
19int nft_meta_set_init(const struct nft_ctx *ctx,
20 const struct nft_expr *expr,
21 const struct nlattr * const tb[]);
22
23int nft_meta_get_dump(struct sk_buff *skb,
24 const struct nft_expr *expr);
25
26int nft_meta_set_dump(struct sk_buff *skb,
27 const struct nft_expr *expr);
28
29void nft_meta_get_eval(const struct nft_expr *expr,
30 struct nft_regs *regs,
31 const struct nft_pktinfo *pkt);
32
33void nft_meta_set_eval(const struct nft_expr *expr,
34 struct nft_regs *regs,
35 const struct nft_pktinfo *pkt);
36
37void nft_meta_set_destroy(const struct nft_ctx *ctx,
38 const struct nft_expr *expr);
39
40int nft_meta_set_validate(const struct nft_ctx *ctx,
41 const struct nft_expr *expr,
42 const struct nft_data **data);
43
44#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 8491bc9c86b1..661348f23ea5 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -160,6 +160,8 @@ struct netns_ipv4 {
160 int sysctl_tcp_pacing_ca_ratio; 160 int sysctl_tcp_pacing_ca_ratio;
161 int sysctl_tcp_wmem[3]; 161 int sysctl_tcp_wmem[3];
162 int sysctl_tcp_rmem[3]; 162 int sysctl_tcp_rmem[3];
163 int sysctl_tcp_comp_sack_nr;
164 unsigned long sysctl_tcp_comp_sack_delay_ns;
163 struct inet_timewait_death_row tcp_death_row; 165 struct inet_timewait_death_row tcp_death_row;
164 int sysctl_max_syn_backlog; 166 int sysctl_max_syn_backlog;
165 int sysctl_tcp_fastopen; 167 int sysctl_tcp_fastopen;
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index c29f09cfc9d7..c978a31b0f84 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -43,6 +43,7 @@ struct netns_sysctl_ipv6 {
43 int max_hbh_opts_cnt; 43 int max_hbh_opts_cnt;
44 int max_dst_opts_len; 44 int max_dst_opts_len;
45 int max_hbh_opts_len; 45 int max_hbh_opts_len;
46 int seg6_flowlabel;
46}; 47};
47 48
48struct netns_ipv6 { 49struct netns_ipv6 {
@@ -60,7 +61,8 @@ struct netns_ipv6 {
60#endif 61#endif
61 struct xt_table *ip6table_nat; 62 struct xt_table *ip6table_nat;
62#endif 63#endif
63 struct rt6_info *ip6_null_entry; 64 struct fib6_info *fib6_null_entry;
65 struct rt6_info *ip6_null_entry;
64 struct rt6_statistics *rt6_stats; 66 struct rt6_statistics *rt6_stats;
65 struct timer_list ip6_fib_timer; 67 struct timer_list ip6_fib_timer;
66 struct hlist_head *fib_table_hash; 68 struct hlist_head *fib_table_hash;
diff --git a/include/net/netns/nftables.h b/include/net/netns/nftables.h
index 48134353411d..94767ea3a490 100644
--- a/include/net/netns/nftables.h
+++ b/include/net/netns/nftables.h
@@ -4,13 +4,12 @@
4 4
5#include <linux/list.h> 5#include <linux/list.h>
6 6
7struct nft_af_info;
8
9struct netns_nftables { 7struct netns_nftables {
10 struct list_head tables; 8 struct list_head tables;
11 struct list_head commit_list; 9 struct list_head commit_list;
12 unsigned int base_seq; 10 unsigned int base_seq;
13 u8 gencursor; 11 u8 gencursor;
12 u8 validate_state;
14}; 13};
15 14
16#endif 15#endif
diff --git a/include/net/page_pool.h b/include/net/page_pool.h
new file mode 100644
index 000000000000..694d055e01ef
--- /dev/null
+++ b/include/net/page_pool.h
@@ -0,0 +1,144 @@
1/* SPDX-License-Identifier: GPL-2.0
2 *
3 * page_pool.h
4 * Author: Jesper Dangaard Brouer <netoptimizer@brouer.com>
5 * Copyright (C) 2016 Red Hat, Inc.
6 */
7
8/**
9 * DOC: page_pool allocator
10 *
11 * This page_pool allocator is optimized for the XDP mode that
12 * uses one-frame-per-page, but have fallbacks that act like the
13 * regular page allocator APIs.
14 *
15 * Basic use involve replacing alloc_pages() calls with the
16 * page_pool_alloc_pages() call. Drivers should likely use
17 * page_pool_dev_alloc_pages() replacing dev_alloc_pages().
18 *
19 * If page_pool handles DMA mapping (use page->private), then API user
20 * is responsible for invoking page_pool_put_page() once. In-case of
21 * elevated refcnt, the DMA state is released, assuming other users of
22 * the page will eventually call put_page().
23 *
24 * If no DMA mapping is done, then it can act as shim-layer that
25 * fall-through to alloc_page. As no state is kept on the page, the
26 * regular put_page() call is sufficient.
27 */
28#ifndef _NET_PAGE_POOL_H
29#define _NET_PAGE_POOL_H
30
31#include <linux/mm.h> /* Needed by ptr_ring */
32#include <linux/ptr_ring.h>
33#include <linux/dma-direction.h>
34
35#define PP_FLAG_DMA_MAP 1 /* Should page_pool do the DMA map/unmap */
36#define PP_FLAG_ALL PP_FLAG_DMA_MAP
37
38/*
39 * Fast allocation side cache array/stack
40 *
41 * The cache size and refill watermark is related to the network
42 * use-case. The NAPI budget is 64 packets. After a NAPI poll the RX
43 * ring is usually refilled and the max consumed elements will be 64,
44 * thus a natural max size of objects needed in the cache.
45 *
46 * Keeping room for more objects, is due to XDP_DROP use-case. As
47 * XDP_DROP allows the opportunity to recycle objects directly into
48 * this array, as it shares the same softirq/NAPI protection. If
49 * cache is already full (or partly full) then the XDP_DROP recycles
50 * would have to take a slower code path.
51 */
52#define PP_ALLOC_CACHE_SIZE 128
53#define PP_ALLOC_CACHE_REFILL 64
54struct pp_alloc_cache {
55 u32 count;
56 void *cache[PP_ALLOC_CACHE_SIZE];
57};
58
59struct page_pool_params {
60 unsigned int flags;
61 unsigned int order;
62 unsigned int pool_size;
63 int nid; /* Numa node id to allocate from pages from */
64 struct device *dev; /* device, for DMA pre-mapping purposes */
65 enum dma_data_direction dma_dir; /* DMA mapping direction */
66};
67
68struct page_pool {
69 struct rcu_head rcu;
70 struct page_pool_params p;
71
72 /*
73 * Data structure for allocation side
74 *
75 * Drivers allocation side usually already perform some kind
76 * of resource protection. Piggyback on this protection, and
77 * require driver to protect allocation side.
78 *
79 * For NIC drivers this means, allocate a page_pool per
80 * RX-queue. As the RX-queue is already protected by
81 * Softirq/BH scheduling and napi_schedule. NAPI schedule
82 * guarantee that a single napi_struct will only be scheduled
83 * on a single CPU (see napi_schedule).
84 */
85 struct pp_alloc_cache alloc ____cacheline_aligned_in_smp;
86
87 /* Data structure for storing recycled pages.
88 *
89 * Returning/freeing pages is more complicated synchronization
90 * wise, because free's can happen on remote CPUs, with no
91 * association with allocation resource.
92 *
93 * Use ptr_ring, as it separates consumer and producer
94 * effeciently, it a way that doesn't bounce cache-lines.
95 *
96 * TODO: Implement bulk return pages into this structure.
97 */
98 struct ptr_ring ring;
99};
100
101struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp);
102
103static inline struct page *page_pool_dev_alloc_pages(struct page_pool *pool)
104{
105 gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN);
106
107 return page_pool_alloc_pages(pool, gfp);
108}
109
110struct page_pool *page_pool_create(const struct page_pool_params *params);
111
112void page_pool_destroy(struct page_pool *pool);
113
114/* Never call this directly, use helpers below */
115void __page_pool_put_page(struct page_pool *pool,
116 struct page *page, bool allow_direct);
117
118static inline void page_pool_put_page(struct page_pool *pool,
119 struct page *page, bool allow_direct)
120{
121 /* When page_pool isn't compiled-in, net/core/xdp.c doesn't
122 * allow registering MEM_TYPE_PAGE_POOL, but shield linker.
123 */
124#ifdef CONFIG_PAGE_POOL
125 __page_pool_put_page(pool, page, allow_direct);
126#endif
127}
128/* Very limited use-cases allow recycle direct */
129static inline void page_pool_recycle_direct(struct page_pool *pool,
130 struct page *page)
131{
132 __page_pool_put_page(pool, page, true);
133}
134
135static inline bool is_page_pool_compiled_in(void)
136{
137#ifdef CONFIG_PAGE_POOL
138 return true;
139#else
140 return false;
141#endif
142}
143
144#endif /* _NET_PAGE_POOL_H */
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index e828d31be5da..a3c1a2c47cd4 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -33,7 +33,7 @@ struct tcf_block_ext_info {
33}; 33};
34 34
35struct tcf_block_cb; 35struct tcf_block_cb;
36bool tcf_queue_work(struct work_struct *work); 36bool tcf_queue_work(struct rcu_work *rwork, work_func_t func);
37 37
38#ifdef CONFIG_NET_CLS 38#ifdef CONFIG_NET_CLS
39struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index, 39struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index,
@@ -683,9 +683,11 @@ static inline bool tc_skip_sw(u32 flags)
683/* SKIP_HW and SKIP_SW are mutually exclusive flags. */ 683/* SKIP_HW and SKIP_SW are mutually exclusive flags. */
684static inline bool tc_flags_valid(u32 flags) 684static inline bool tc_flags_valid(u32 flags)
685{ 685{
686 if (flags & ~(TCA_CLS_FLAGS_SKIP_HW | TCA_CLS_FLAGS_SKIP_SW)) 686 if (flags & ~(TCA_CLS_FLAGS_SKIP_HW | TCA_CLS_FLAGS_SKIP_SW |
687 TCA_CLS_FLAGS_VERBOSE))
687 return false; 688 return false;
688 689
690 flags &= TCA_CLS_FLAGS_SKIP_HW | TCA_CLS_FLAGS_SKIP_SW;
689 if (!(flags ^ (TCA_CLS_FLAGS_SKIP_HW | TCA_CLS_FLAGS_SKIP_SW))) 691 if (!(flags ^ (TCA_CLS_FLAGS_SKIP_HW | TCA_CLS_FLAGS_SKIP_SW)))
690 return false; 692 return false;
691 693
@@ -705,7 +707,7 @@ tc_cls_common_offload_init(struct tc_cls_common_offload *cls_common,
705 cls_common->chain_index = tp->chain->index; 707 cls_common->chain_index = tp->chain->index;
706 cls_common->protocol = tp->protocol; 708 cls_common->protocol = tp->protocol;
707 cls_common->prio = tp->prio; 709 cls_common->prio = tp->prio;
708 if (tc_skip_sw(flags)) 710 if (tc_skip_sw(flags) || flags & TCA_CLS_FLAGS_VERBOSE)
709 cls_common->extack = extack; 711 cls_common->extack = extack;
710} 712}
711 713
@@ -776,6 +778,18 @@ struct tc_qopt_offload_stats {
776 struct gnet_stats_queue *qstats; 778 struct gnet_stats_queue *qstats;
777}; 779};
778 780
781enum tc_mq_command {
782 TC_MQ_CREATE,
783 TC_MQ_DESTROY,
784 TC_MQ_STATS,
785};
786
787struct tc_mq_qopt_offload {
788 enum tc_mq_command command;
789 u32 handle;
790 struct tc_qopt_offload_stats stats;
791};
792
779enum tc_red_command { 793enum tc_red_command {
780 TC_RED_REPLACE, 794 TC_RED_REPLACE,
781 TC_RED_DESTROY, 795 TC_RED_DESTROY,
diff --git a/include/net/route.h b/include/net/route.h
index dbb032d5921b..bb53cdba38dc 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -225,6 +225,7 @@ struct rtable *rt_dst_alloc(struct net_device *dev,
225struct in_ifaddr; 225struct in_ifaddr;
226void fib_add_ifaddr(struct in_ifaddr *); 226void fib_add_ifaddr(struct in_ifaddr *);
227void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *); 227void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *);
228void fib_modify_prefix_metric(struct in_ifaddr *ifa, u32 new_metric);
228 229
229void rt_add_uncached_list(struct rtable *rt); 230void rt_add_uncached_list(struct rtable *rt);
230void rt_del_uncached_list(struct rtable *rt); 231void rt_del_uncached_list(struct rtable *rt);
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 14b6b3af8918..0bbaa5488423 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -64,7 +64,7 @@ struct rtnl_link_ops {
64 size_t priv_size; 64 size_t priv_size;
65 void (*setup)(struct net_device *dev); 65 void (*setup)(struct net_device *dev);
66 66
67 int maxtype; 67 unsigned int maxtype;
68 const struct nla_policy *policy; 68 const struct nla_policy *policy;
69 int (*validate)(struct nlattr *tb[], 69 int (*validate)(struct nlattr *tb[],
70 struct nlattr *data[], 70 struct nlattr *data[],
@@ -92,7 +92,7 @@ struct rtnl_link_ops {
92 unsigned int (*get_num_tx_queues)(void); 92 unsigned int (*get_num_tx_queues)(void);
93 unsigned int (*get_num_rx_queues)(void); 93 unsigned int (*get_num_rx_queues)(void);
94 94
95 int slave_maxtype; 95 unsigned int slave_maxtype;
96 const struct nla_policy *slave_policy; 96 const struct nla_policy *slave_policy;
97 int (*slave_changelink)(struct net_device *dev, 97 int (*slave_changelink)(struct net_device *dev,
98 struct net_device *slave_dev, 98 struct net_device *slave_dev,
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 5154c8300262..6488daa32f82 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -30,7 +30,6 @@ struct qdisc_rate_table {
30enum qdisc_state_t { 30enum qdisc_state_t {
31 __QDISC_STATE_SCHED, 31 __QDISC_STATE_SCHED,
32 __QDISC_STATE_DEACTIVATED, 32 __QDISC_STATE_DEACTIVATED,
33 __QDISC_STATE_RUNNING,
34}; 33};
35 34
36struct qdisc_size_table { 35struct qdisc_size_table {
@@ -86,6 +85,8 @@ struct Qdisc {
86 struct net_rate_estimator __rcu *rate_est; 85 struct net_rate_estimator __rcu *rate_est;
87 struct gnet_stats_basic_cpu __percpu *cpu_bstats; 86 struct gnet_stats_basic_cpu __percpu *cpu_bstats;
88 struct gnet_stats_queue __percpu *cpu_qstats; 87 struct gnet_stats_queue __percpu *cpu_qstats;
88 int padded;
89 refcount_t refcnt;
89 90
90 /* 91 /*
91 * For performance sake on SMP, we put highly modified fields at the end 92 * For performance sake on SMP, we put highly modified fields at the end
@@ -98,10 +99,9 @@ struct Qdisc {
98 unsigned long state; 99 unsigned long state;
99 struct Qdisc *next_sched; 100 struct Qdisc *next_sched;
100 struct sk_buff_head skb_bad_txq; 101 struct sk_buff_head skb_bad_txq;
101 int padded;
102 refcount_t refcnt;
103 102
104 spinlock_t busylock ____cacheline_aligned_in_smp; 103 spinlock_t busylock ____cacheline_aligned_in_smp;
104 spinlock_t seqlock;
105}; 105};
106 106
107static inline void qdisc_refcount_inc(struct Qdisc *qdisc) 107static inline void qdisc_refcount_inc(struct Qdisc *qdisc)
@@ -111,15 +111,21 @@ static inline void qdisc_refcount_inc(struct Qdisc *qdisc)
111 refcount_inc(&qdisc->refcnt); 111 refcount_inc(&qdisc->refcnt);
112} 112}
113 113
114static inline bool qdisc_is_running(const struct Qdisc *qdisc) 114static inline bool qdisc_is_running(struct Qdisc *qdisc)
115{ 115{
116 if (qdisc->flags & TCQ_F_NOLOCK)
117 return spin_is_locked(&qdisc->seqlock);
116 return (raw_read_seqcount(&qdisc->running) & 1) ? true : false; 118 return (raw_read_seqcount(&qdisc->running) & 1) ? true : false;
117} 119}
118 120
119static inline bool qdisc_run_begin(struct Qdisc *qdisc) 121static inline bool qdisc_run_begin(struct Qdisc *qdisc)
120{ 122{
121 if (qdisc_is_running(qdisc)) 123 if (qdisc->flags & TCQ_F_NOLOCK) {
124 if (!spin_trylock(&qdisc->seqlock))
125 return false;
126 } else if (qdisc_is_running(qdisc)) {
122 return false; 127 return false;
128 }
123 /* Variant of write_seqcount_begin() telling lockdep a trylock 129 /* Variant of write_seqcount_begin() telling lockdep a trylock
124 * was attempted. 130 * was attempted.
125 */ 131 */
@@ -131,6 +137,8 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
131static inline void qdisc_run_end(struct Qdisc *qdisc) 137static inline void qdisc_run_end(struct Qdisc *qdisc)
132{ 138{
133 write_seqcount_end(&qdisc->running); 139 write_seqcount_end(&qdisc->running);
140 if (qdisc->flags & TCQ_F_NOLOCK)
141 spin_unlock(&qdisc->seqlock);
134} 142}
135 143
136static inline bool qdisc_may_bulk(const struct Qdisc *qdisc) 144static inline bool qdisc_may_bulk(const struct Qdisc *qdisc)
@@ -342,14 +350,14 @@ static inline int qdisc_qlen(const struct Qdisc *q)
342 350
343static inline int qdisc_qlen_sum(const struct Qdisc *q) 351static inline int qdisc_qlen_sum(const struct Qdisc *q)
344{ 352{
345 __u32 qlen = 0; 353 __u32 qlen = q->qstats.qlen;
346 int i; 354 int i;
347 355
348 if (q->flags & TCQ_F_NOLOCK) { 356 if (q->flags & TCQ_F_NOLOCK) {
349 for_each_possible_cpu(i) 357 for_each_possible_cpu(i)
350 qlen += per_cpu_ptr(q->cpu_qstats, i)->qlen; 358 qlen += per_cpu_ptr(q->cpu_qstats, i)->qlen;
351 } else { 359 } else {
352 qlen = q->q.qlen; 360 qlen += q->q.qlen;
353 } 361 }
354 362
355 return qlen; 363 return qlen;
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 20ff237c5eb2..86f034b524d4 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -254,11 +254,10 @@ enum { SCTP_ARBITRARY_COOKIE_ECHO_LEN = 200 };
254#define SCTP_TSN_MAP_SIZE 4096 254#define SCTP_TSN_MAP_SIZE 4096
255 255
256/* We will not record more than this many duplicate TSNs between two 256/* We will not record more than this many duplicate TSNs between two
257 * SACKs. The minimum PMTU is 576. Remove all the headers and there 257 * SACKs. The minimum PMTU is 512. Remove all the headers and there
258 * is enough room for 131 duplicate reports. Round down to the 258 * is enough room for 117 duplicate reports. Round down to the
259 * nearest power of 2. 259 * nearest power of 2.
260 */ 260 */
261enum { SCTP_MIN_PMTU = 576 };
262enum { SCTP_MAX_DUP_TSNS = 16 }; 261enum { SCTP_MAX_DUP_TSNS = 16 };
263enum { SCTP_MAX_GABS = 16 }; 262enum { SCTP_MAX_GABS = 16 };
264 263
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index e6d349b2a791..30b3e2fe240a 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -429,32 +429,6 @@ static inline int sctp_list_single_entry(struct list_head *head)
429 return (head->next != head) && (head->next == head->prev); 429 return (head->next != head) && (head->next == head->prev);
430} 430}
431 431
432/* Break down data chunks at this point. */
433static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
434{
435 struct sctp_sock *sp = sctp_sk(asoc->base.sk);
436 struct sctp_af *af = sp->pf->af;
437 int frag = pmtu;
438
439 frag -= af->ip_options_len(asoc->base.sk);
440 frag -= af->net_header_len;
441 frag -= sizeof(struct sctphdr) + sctp_datachk_len(&asoc->stream);
442
443 if (asoc->user_frag)
444 frag = min_t(int, frag, asoc->user_frag);
445
446 frag = SCTP_TRUNC4(min_t(int, frag, SCTP_MAX_CHUNK_LEN -
447 sctp_datachk_len(&asoc->stream)));
448
449 return frag;
450}
451
452static inline void sctp_assoc_pending_pmtu(struct sctp_association *asoc)
453{
454 sctp_assoc_sync_pmtu(asoc);
455 asoc->pmtu_pending = 0;
456}
457
458static inline bool sctp_chunk_pending(const struct sctp_chunk *chunk) 432static inline bool sctp_chunk_pending(const struct sctp_chunk *chunk)
459{ 433{
460 return !list_empty(&chunk->list); 434 return !list_empty(&chunk->list);
@@ -608,17 +582,29 @@ static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *
608 return t->dst; 582 return t->dst;
609} 583}
610 584
611static inline bool sctp_transport_pmtu_check(struct sctp_transport *t) 585/* Calculate max payload size given a MTU, or the total overhead if
586 * given MTU is zero
587 */
588static inline __u32 sctp_mtu_payload(const struct sctp_sock *sp,
589 __u32 mtu, __u32 extra)
612{ 590{
613 __u32 pmtu = max_t(size_t, SCTP_TRUNC4(dst_mtu(t->dst)), 591 __u32 overhead = sizeof(struct sctphdr) + extra;
614 SCTP_DEFAULT_MINSEGMENT);
615 592
616 if (t->pathmtu == pmtu) 593 if (sp)
617 return true; 594 overhead += sp->pf->af->net_header_len;
595 else
596 overhead += sizeof(struct ipv6hdr);
618 597
619 t->pathmtu = pmtu; 598 if (WARN_ON_ONCE(mtu && mtu <= overhead))
599 mtu = overhead;
620 600
621 return false; 601 return mtu ? mtu - overhead : overhead;
602}
603
604static inline __u32 sctp_dst_mtu(const struct dst_entry *dst)
605{
606 return SCTP_TRUNC4(max_t(__u32, dst_mtu(dst),
607 SCTP_DEFAULT_MINSEGMENT));
622} 608}
623 609
624#endif /* __net_sctp_h__ */ 610#endif /* __net_sctp_h__ */
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 2d0e782c9055..5ef1bad81ef5 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -207,7 +207,7 @@ struct sctp_chunk *sctp_make_datafrag_empty(const struct sctp_association *asoc,
207 int len, __u8 flags, gfp_t gfp); 207 int len, __u8 flags, gfp_t gfp);
208struct sctp_chunk *sctp_make_ecne(const struct sctp_association *asoc, 208struct sctp_chunk *sctp_make_ecne(const struct sctp_association *asoc,
209 const __u32 lowest_tsn); 209 const __u32 lowest_tsn);
210struct sctp_chunk *sctp_make_sack(const struct sctp_association *asoc); 210struct sctp_chunk *sctp_make_sack(struct sctp_association *asoc);
211struct sctp_chunk *sctp_make_shutdown(const struct sctp_association *asoc, 211struct sctp_chunk *sctp_make_shutdown(const struct sctp_association *asoc,
212 const struct sctp_chunk *chunk); 212 const struct sctp_chunk *chunk);
213struct sctp_chunk *sctp_make_shutdown_ack(const struct sctp_association *asoc, 213struct sctp_chunk *sctp_make_shutdown_ack(const struct sctp_association *asoc,
@@ -215,7 +215,7 @@ struct sctp_chunk *sctp_make_shutdown_ack(const struct sctp_association *asoc,
215struct sctp_chunk *sctp_make_shutdown_complete( 215struct sctp_chunk *sctp_make_shutdown_complete(
216 const struct sctp_association *asoc, 216 const struct sctp_association *asoc,
217 const struct sctp_chunk *chunk); 217 const struct sctp_chunk *chunk);
218void sctp_init_cause(struct sctp_chunk *chunk, __be16 cause, size_t paylen); 218int sctp_init_cause(struct sctp_chunk *chunk, __be16 cause, size_t paylen);
219struct sctp_chunk *sctp_make_abort(const struct sctp_association *asoc, 219struct sctp_chunk *sctp_make_abort(const struct sctp_association *asoc,
220 const struct sctp_chunk *chunk, 220 const struct sctp_chunk *chunk,
221 const size_t hint); 221 const size_t hint);
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index a0ec462bc1a9..ebf809eed33a 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -2091,16 +2091,14 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
2091 enum sctp_transport_cmd command, 2091 enum sctp_transport_cmd command,
2092 sctp_sn_error_t error); 2092 sctp_sn_error_t error);
2093struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32); 2093struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32);
2094struct sctp_transport *sctp_assoc_is_match(struct sctp_association *,
2095 struct net *,
2096 const union sctp_addr *,
2097 const union sctp_addr *);
2098void sctp_assoc_migrate(struct sctp_association *, struct sock *); 2094void sctp_assoc_migrate(struct sctp_association *, struct sock *);
2099int sctp_assoc_update(struct sctp_association *old, 2095int sctp_assoc_update(struct sctp_association *old,
2100 struct sctp_association *new); 2096 struct sctp_association *new);
2101 2097
2102__u32 sctp_association_get_next_tsn(struct sctp_association *); 2098__u32 sctp_association_get_next_tsn(struct sctp_association *);
2103 2099
2100void sctp_assoc_update_frag_point(struct sctp_association *asoc);
2101void sctp_assoc_set_pmtu(struct sctp_association *asoc, __u32 pmtu);
2104void sctp_assoc_sync_pmtu(struct sctp_association *asoc); 2102void sctp_assoc_sync_pmtu(struct sctp_association *asoc);
2105void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int); 2103void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);
2106void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int); 2104void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);
diff --git a/include/net/seg6.h b/include/net/seg6.h
index 099bad59dc90..e029e301faa5 100644
--- a/include/net/seg6.h
+++ b/include/net/seg6.h
@@ -49,7 +49,11 @@ struct seg6_pernet_data {
49 49
50static inline struct seg6_pernet_data *seg6_pernet(struct net *net) 50static inline struct seg6_pernet_data *seg6_pernet(struct net *net)
51{ 51{
52#if IS_ENABLED(CONFIG_IPV6)
52 return net->ipv6.seg6_data; 53 return net->ipv6.seg6_data;
54#else
55 return NULL;
56#endif
53} 57}
54 58
55extern int seg6_init(void); 59extern int seg6_init(void);
@@ -63,5 +67,6 @@ extern bool seg6_validate_srh(struct ipv6_sr_hdr *srh, int len);
63extern int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh, 67extern int seg6_do_srh_encap(struct sk_buff *skb, struct ipv6_sr_hdr *osrh,
64 int proto); 68 int proto);
65extern int seg6_do_srh_inline(struct sk_buff *skb, struct ipv6_sr_hdr *osrh); 69extern int seg6_do_srh_inline(struct sk_buff *skb, struct ipv6_sr_hdr *osrh);
66 70extern int seg6_lookup_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr,
71 u32 tbl_id);
67#endif 72#endif
diff --git a/include/net/seg6_local.h b/include/net/seg6_local.h
new file mode 100644
index 000000000000..661fd5b4d3e0
--- /dev/null
+++ b/include/net/seg6_local.h
@@ -0,0 +1,32 @@
1/*
2 * SR-IPv6 implementation
3 *
4 * Authors:
5 * David Lebrun <david.lebrun@uclouvain.be>
6 * eBPF support: Mathieu Xhonneux <m.xhonneux@gmail.com>
7 *
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#ifndef _NET_SEG6_LOCAL_H
16#define _NET_SEG6_LOCAL_H
17
18#include <linux/percpu.h>
19#include <linux/net.h>
20#include <linux/ipv6.h>
21
22extern int seg6_lookup_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr,
23 u32 tbl_id);
24
25struct seg6_bpf_srh_state {
26 bool valid;
27 u16 hdrlen;
28};
29
30DECLARE_PER_CPU(struct seg6_bpf_srh_state, seg6_bpf_srh_states);
31
32#endif
diff --git a/include/net/sock.h b/include/net/sock.h
index 4d2e8ad98985..b3b75419eafe 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -481,6 +481,11 @@ struct sock {
481 void (*sk_error_report)(struct sock *sk); 481 void (*sk_error_report)(struct sock *sk);
482 int (*sk_backlog_rcv)(struct sock *sk, 482 int (*sk_backlog_rcv)(struct sock *sk,
483 struct sk_buff *skb); 483 struct sk_buff *skb);
484#ifdef CONFIG_SOCK_VALIDATE_XMIT
485 struct sk_buff* (*sk_validate_xmit_skb)(struct sock *sk,
486 struct net_device *dev,
487 struct sk_buff *skb);
488#endif
484 void (*sk_destruct)(struct sock *sk); 489 void (*sk_destruct)(struct sock *sk);
485 struct sock_reuseport __rcu *sk_reuseport_cb; 490 struct sock_reuseport __rcu *sk_reuseport_cb;
486 struct rcu_head sk_rcu; 491 struct rcu_head sk_rcu;
@@ -803,10 +808,10 @@ static inline bool sock_flag(const struct sock *sk, enum sock_flags flag)
803} 808}
804 809
805#ifdef CONFIG_NET 810#ifdef CONFIG_NET
806extern struct static_key memalloc_socks; 811DECLARE_STATIC_KEY_FALSE(memalloc_socks_key);
807static inline int sk_memalloc_socks(void) 812static inline int sk_memalloc_socks(void)
808{ 813{
809 return static_key_false(&memalloc_socks); 814 return static_branch_unlikely(&memalloc_socks_key);
810} 815}
811#else 816#else
812 817
@@ -2330,6 +2335,22 @@ static inline bool sk_fullsock(const struct sock *sk)
2330 return (1 << sk->sk_state) & ~(TCPF_TIME_WAIT | TCPF_NEW_SYN_RECV); 2335 return (1 << sk->sk_state) & ~(TCPF_TIME_WAIT | TCPF_NEW_SYN_RECV);
2331} 2336}
2332 2337
2338/* Checks if this SKB belongs to an HW offloaded socket
2339 * and whether any SW fallbacks are required based on dev.
2340 */
2341static inline struct sk_buff *sk_validate_xmit_skb(struct sk_buff *skb,
2342 struct net_device *dev)
2343{
2344#ifdef CONFIG_SOCK_VALIDATE_XMIT
2345 struct sock *sk = skb->sk;
2346
2347 if (sk && sk_fullsock(sk) && sk->sk_validate_xmit_skb)
2348 skb = sk->sk_validate_xmit_skb(sk, dev, skb);
2349#endif
2350
2351 return skb;
2352}
2353
2333/* This helper checks if a socket is a LISTEN or NEW_SYN_RECV 2354/* This helper checks if a socket is a LISTEN or NEW_SYN_RECV
2334 * SYNACK messages can be attached to either ones (depending on SYNCOOKIE) 2355 * SYNACK messages can be attached to either ones (depending on SYNCOOKIE)
2335 */ 2356 */
diff --git a/include/net/strparser.h b/include/net/strparser.h
index d96b59f45eba..f177c87ce38b 100644
--- a/include/net/strparser.h
+++ b/include/net/strparser.h
@@ -90,6 +90,8 @@ static inline void strp_pause(struct strparser *strp)
90 90
91/* May be called without holding lock for attached socket */ 91/* May be called without holding lock for attached socket */
92void strp_unpause(struct strparser *strp); 92void strp_unpause(struct strparser *strp);
93/* Must be called with process lock held (lock_sock) */
94void __strp_unpause(struct strparser *strp);
93 95
94static inline void save_strp_stats(struct strparser *strp, 96static inline void save_strp_stats(struct strparser *strp,
95 struct strp_aggr_stats *agg_stats) 97 struct strp_aggr_stats *agg_stats)
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 39bc855d7fee..d574ce63bf22 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -155,6 +155,7 @@ struct switchdev_notifier_fdb_info {
155 struct switchdev_notifier_info info; /* must be first */ 155 struct switchdev_notifier_info info; /* must be first */
156 const unsigned char *addr; 156 const unsigned char *addr;
157 u16 vid; 157 u16 vid;
158 bool added_by_user;
158}; 159};
159 160
160static inline struct net_device * 161static inline struct net_device *
diff --git a/include/net/tcp.h b/include/net/tcp.h
index f88f8a2cab0d..0448e7c5d2b4 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -245,6 +245,7 @@ extern long sysctl_tcp_mem[3];
245 245
246#define TCP_RACK_LOSS_DETECTION 0x1 /* Use RACK to detect losses */ 246#define TCP_RACK_LOSS_DETECTION 0x1 /* Use RACK to detect losses */
247#define TCP_RACK_STATIC_REO_WND 0x2 /* Use static RACK reo wnd */ 247#define TCP_RACK_STATIC_REO_WND 0x2 /* Use static RACK reo wnd */
248#define TCP_RACK_NO_DUPTHRESH 0x4 /* Do not use DUPACK threshold in RACK */
248 249
249extern atomic_long_t tcp_memory_allocated; 250extern atomic_long_t tcp_memory_allocated;
250extern struct percpu_counter tcp_sockets_allocated; 251extern struct percpu_counter tcp_sockets_allocated;
@@ -333,8 +334,7 @@ void tcp_write_timer_handler(struct sock *sk);
333void tcp_delack_timer_handler(struct sock *sk); 334void tcp_delack_timer_handler(struct sock *sk);
334int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); 335int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
335int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb); 336int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb);
336void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, 337void tcp_rcv_established(struct sock *sk, struct sk_buff *skb);
337 const struct tcphdr *th);
338void tcp_rcv_space_adjust(struct sock *sk); 338void tcp_rcv_space_adjust(struct sock *sk);
339int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); 339int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
340void tcp_twsk_destructor(struct sock *sk); 340void tcp_twsk_destructor(struct sock *sk);
@@ -401,6 +401,10 @@ void tcp_set_keepalive(struct sock *sk, int val);
401void tcp_syn_ack_timeout(const struct request_sock *req); 401void tcp_syn_ack_timeout(const struct request_sock *req);
402int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock, 402int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
403 int flags, int *addr_len); 403 int flags, int *addr_len);
404int tcp_set_rcvlowat(struct sock *sk, int val);
405void tcp_data_ready(struct sock *sk);
406int tcp_mmap(struct file *file, struct socket *sock,
407 struct vm_area_struct *vma);
404void tcp_parse_options(const struct net *net, const struct sk_buff *skb, 408void tcp_parse_options(const struct net *net, const struct sk_buff *skb,
405 struct tcp_options_received *opt_rx, 409 struct tcp_options_received *opt_rx,
406 int estab, struct tcp_fastopen_cookie *foc); 410 int estab, struct tcp_fastopen_cookie *foc);
@@ -552,7 +556,12 @@ void tcp_fin(struct sock *sk);
552void tcp_init_xmit_timers(struct sock *); 556void tcp_init_xmit_timers(struct sock *);
553static inline void tcp_clear_xmit_timers(struct sock *sk) 557static inline void tcp_clear_xmit_timers(struct sock *sk)
554{ 558{
555 hrtimer_cancel(&tcp_sk(sk)->pacing_timer); 559 if (hrtimer_try_to_cancel(&tcp_sk(sk)->pacing_timer) == 1)
560 __sock_put(sk);
561
562 if (hrtimer_try_to_cancel(&tcp_sk(sk)->compressed_ack_timer) == 1)
563 __sock_put(sk);
564
556 inet_csk_clear_xmit_timers(sk); 565 inet_csk_clear_xmit_timers(sk);
557} 566}
558 567
@@ -809,9 +818,8 @@ struct tcp_skb_cb {
809#endif 818#endif
810 } header; /* For incoming skbs */ 819 } header; /* For incoming skbs */
811 struct { 820 struct {
812 __u32 key;
813 __u32 flags; 821 __u32 flags;
814 struct bpf_map *map; 822 struct sock *sk_redir;
815 void *data_end; 823 void *data_end;
816 } bpf; 824 } bpf;
817 }; 825 };
@@ -1865,6 +1873,10 @@ void tcp_v4_init(void);
1865void tcp_init(void); 1873void tcp_init(void);
1866 1874
1867/* tcp_recovery.c */ 1875/* tcp_recovery.c */
1876void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb);
1877void tcp_newreno_mark_lost(struct sock *sk, bool snd_una_advanced);
1878extern s32 tcp_rack_skb_timeout(struct tcp_sock *tp, struct sk_buff *skb,
1879 u32 reo_wnd);
1868extern void tcp_rack_mark_lost(struct sock *sk); 1880extern void tcp_rack_mark_lost(struct sock *sk);
1869extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq, 1881extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq,
1870 u64 xmit_time); 1882 u64 xmit_time);
@@ -2095,4 +2107,12 @@ static inline bool tcp_bpf_ca_needs_ecn(struct sock *sk)
2095#if IS_ENABLED(CONFIG_SMC) 2107#if IS_ENABLED(CONFIG_SMC)
2096extern struct static_key_false tcp_have_smc; 2108extern struct static_key_false tcp_have_smc;
2097#endif 2109#endif
2110
2111#if IS_ENABLED(CONFIG_TLS_DEVICE)
2112void clean_acked_data_enable(struct inet_connection_sock *icsk,
2113 void (*cad)(struct sock *sk, u32 ack_seq));
2114void clean_acked_data_disable(struct inet_connection_sock *icsk);
2115
2116#endif
2117
2098#endif /* _TCP_H */ 2118#endif /* _TCP_H */
diff --git a/include/net/tipc.h b/include/net/tipc.h
index 07670ec022a7..f0e7e6bc1bef 100644
--- a/include/net/tipc.h
+++ b/include/net/tipc.h
@@ -44,11 +44,11 @@ struct tipc_basic_hdr {
44 __be32 w[4]; 44 __be32 w[4];
45}; 45};
46 46
47static inline u32 tipc_hdr_rps_key(struct tipc_basic_hdr *hdr) 47static inline __be32 tipc_hdr_rps_key(struct tipc_basic_hdr *hdr)
48{ 48{
49 u32 w0 = ntohl(hdr->w[0]); 49 u32 w0 = ntohl(hdr->w[0]);
50 bool keepalive_msg = (w0 & KEEPALIVE_MSG_MASK) == KEEPALIVE_MSG_MASK; 50 bool keepalive_msg = (w0 & KEEPALIVE_MSG_MASK) == KEEPALIVE_MSG_MASK;
51 int key; 51 __be32 key;
52 52
53 /* Return source node identity as key */ 53 /* Return source node identity as key */
54 if (likely(!keepalive_msg)) 54 if (likely(!keepalive_msg))
diff --git a/include/net/tls.h b/include/net/tls.h
index f5fb16da3860..70c273777fe9 100644
--- a/include/net/tls.h
+++ b/include/net/tls.h
@@ -83,24 +83,10 @@ struct tls_device {
83 void (*unhash)(struct tls_device *device, struct sock *sk); 83 void (*unhash)(struct tls_device *device, struct sock *sk);
84}; 84};
85 85
86struct tls_sw_context { 86struct tls_sw_context_tx {
87 struct crypto_aead *aead_send; 87 struct crypto_aead *aead_send;
88 struct crypto_aead *aead_recv;
89 struct crypto_wait async_wait; 88 struct crypto_wait async_wait;
90 89
91 /* Receive context */
92 struct strparser strp;
93 void (*saved_data_ready)(struct sock *sk);
94 unsigned int (*sk_poll)(struct file *file, struct socket *sock,
95 struct poll_table_struct *wait);
96 struct sk_buff *recv_pkt;
97 u8 control;
98 bool decrypted;
99
100 char rx_aad_ciphertext[TLS_AAD_SPACE_SIZE];
101 char rx_aad_plaintext[TLS_AAD_SPACE_SIZE];
102
103 /* Sending context */
104 char aad_space[TLS_AAD_SPACE_SIZE]; 90 char aad_space[TLS_AAD_SPACE_SIZE];
105 91
106 unsigned int sg_plaintext_size; 92 unsigned int sg_plaintext_size;
@@ -117,6 +103,54 @@ struct tls_sw_context {
117 struct scatterlist sg_aead_out[2]; 103 struct scatterlist sg_aead_out[2];
118}; 104};
119 105
106struct tls_sw_context_rx {
107 struct crypto_aead *aead_recv;
108 struct crypto_wait async_wait;
109
110 struct strparser strp;
111 void (*saved_data_ready)(struct sock *sk);
112 unsigned int (*sk_poll)(struct file *file, struct socket *sock,
113 struct poll_table_struct *wait);
114 struct sk_buff *recv_pkt;
115 u8 control;
116 bool decrypted;
117
118 char rx_aad_ciphertext[TLS_AAD_SPACE_SIZE];
119 char rx_aad_plaintext[TLS_AAD_SPACE_SIZE];
120
121};
122
123struct tls_record_info {
124 struct list_head list;
125 u32 end_seq;
126 int len;
127 int num_frags;
128 skb_frag_t frags[MAX_SKB_FRAGS];
129};
130
131struct tls_offload_context {
132 struct crypto_aead *aead_send;
133 spinlock_t lock; /* protects records list */
134 struct list_head records_list;
135 struct tls_record_info *open_record;
136 struct tls_record_info *retransmit_hint;
137 u64 hint_record_sn;
138 u64 unacked_record_sn;
139
140 struct scatterlist sg_tx_data[MAX_SKB_FRAGS];
141 void (*sk_destruct)(struct sock *sk);
142 u8 driver_state[];
143 /* The TLS layer reserves room for driver specific state
144 * Currently the belief is that there is not enough
145 * driver specific state to justify another layer of indirection
146 */
147#define TLS_DRIVER_STATE_SIZE (max_t(size_t, 8, sizeof(void *)))
148};
149
150#define TLS_OFFLOAD_CONTEXT_SIZE \
151 (ALIGN(sizeof(struct tls_offload_context), sizeof(void *)) + \
152 TLS_DRIVER_STATE_SIZE)
153
120enum { 154enum {
121 TLS_PENDING_CLOSED_RECORD 155 TLS_PENDING_CLOSED_RECORD
122}; 156};
@@ -141,9 +175,15 @@ struct tls_context {
141 struct tls12_crypto_info_aes_gcm_128 crypto_recv_aes_gcm_128; 175 struct tls12_crypto_info_aes_gcm_128 crypto_recv_aes_gcm_128;
142 }; 176 };
143 177
144 void *priv_ctx; 178 struct list_head list;
179 struct net_device *netdev;
180 refcount_t refcount;
181
182 void *priv_ctx_tx;
183 void *priv_ctx_rx;
145 184
146 u8 conf:3; 185 u8 tx_conf:3;
186 u8 rx_conf:3;
147 187
148 struct cipher_context tx; 188 struct cipher_context tx;
149 struct cipher_context rx; 189 struct cipher_context rx;
@@ -181,7 +221,8 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size);
181int tls_sw_sendpage(struct sock *sk, struct page *page, 221int tls_sw_sendpage(struct sock *sk, struct page *page,
182 int offset, size_t size, int flags); 222 int offset, size_t size, int flags);
183void tls_sw_close(struct sock *sk, long timeout); 223void tls_sw_close(struct sock *sk, long timeout);
184void tls_sw_free_resources(struct sock *sk); 224void tls_sw_free_resources_tx(struct sock *sk);
225void tls_sw_free_resources_rx(struct sock *sk);
185int tls_sw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, 226int tls_sw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
186 int nonblock, int flags, int *addr_len); 227 int nonblock, int flags, int *addr_len);
187unsigned int tls_sw_poll(struct file *file, struct socket *sock, 228unsigned int tls_sw_poll(struct file *file, struct socket *sock,
@@ -190,9 +231,28 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos,
190 struct pipe_inode_info *pipe, 231 struct pipe_inode_info *pipe,
191 size_t len, unsigned int flags); 232 size_t len, unsigned int flags);
192 233
193void tls_sk_destruct(struct sock *sk, struct tls_context *ctx); 234int tls_set_device_offload(struct sock *sk, struct tls_context *ctx);
194void tls_icsk_clean_acked(struct sock *sk); 235int tls_device_sendmsg(struct sock *sk, struct msghdr *msg, size_t size);
236int tls_device_sendpage(struct sock *sk, struct page *page,
237 int offset, size_t size, int flags);
238void tls_device_sk_destruct(struct sock *sk);
239void tls_device_init(void);
240void tls_device_cleanup(void);
241
242struct tls_record_info *tls_get_record(struct tls_offload_context *context,
243 u32 seq, u64 *p_record_sn);
244
245static inline bool tls_record_is_start_marker(struct tls_record_info *rec)
246{
247 return rec->len == 0;
248}
195 249
250static inline u32 tls_record_start_seq(struct tls_record_info *rec)
251{
252 return rec->end_seq - rec->len;
253}
254
255void tls_sk_destruct(struct sock *sk, struct tls_context *ctx);
196int tls_push_sg(struct sock *sk, struct tls_context *ctx, 256int tls_push_sg(struct sock *sk, struct tls_context *ctx,
197 struct scatterlist *sg, u16 first_offset, 257 struct scatterlist *sg, u16 first_offset,
198 int flags); 258 int flags);
@@ -229,6 +289,13 @@ static inline bool tls_is_pending_open_record(struct tls_context *tls_ctx)
229 return tls_ctx->pending_open_record_frags; 289 return tls_ctx->pending_open_record_frags;
230} 290}
231 291
292static inline bool tls_is_sk_tx_device_offloaded(struct sock *sk)
293{
294 return sk_fullsock(sk) &&
295 /* matches smp_store_release in tls_set_device_offload */
296 smp_load_acquire(&sk->sk_destruct) == &tls_device_sk_destruct;
297}
298
232static inline void tls_err_abort(struct sock *sk, int err) 299static inline void tls_err_abort(struct sock *sk, int err)
233{ 300{
234 sk->sk_err = err; 301 sk->sk_err = err;
@@ -301,16 +368,22 @@ static inline struct tls_context *tls_get_ctx(const struct sock *sk)
301 return icsk->icsk_ulp_data; 368 return icsk->icsk_ulp_data;
302} 369}
303 370
304static inline struct tls_sw_context *tls_sw_ctx( 371static inline struct tls_sw_context_rx *tls_sw_ctx_rx(
305 const struct tls_context *tls_ctx) 372 const struct tls_context *tls_ctx)
306{ 373{
307 return (struct tls_sw_context *)tls_ctx->priv_ctx; 374 return (struct tls_sw_context_rx *)tls_ctx->priv_ctx_rx;
375}
376
377static inline struct tls_sw_context_tx *tls_sw_ctx_tx(
378 const struct tls_context *tls_ctx)
379{
380 return (struct tls_sw_context_tx *)tls_ctx->priv_ctx_tx;
308} 381}
309 382
310static inline struct tls_offload_context *tls_offload_ctx( 383static inline struct tls_offload_context *tls_offload_ctx(
311 const struct tls_context *tls_ctx) 384 const struct tls_context *tls_ctx)
312{ 385{
313 return (struct tls_offload_context *)tls_ctx->priv_ctx; 386 return (struct tls_offload_context *)tls_ctx->priv_ctx_tx;
314} 387}
315 388
316int tls_proccess_cmsg(struct sock *sk, struct msghdr *msg, 389int tls_proccess_cmsg(struct sock *sk, struct msghdr *msg,
@@ -318,4 +391,12 @@ int tls_proccess_cmsg(struct sock *sk, struct msghdr *msg,
318void tls_register_device(struct tls_device *device); 391void tls_register_device(struct tls_device *device);
319void tls_unregister_device(struct tls_device *device); 392void tls_unregister_device(struct tls_device *device);
320 393
394struct sk_buff *tls_validate_xmit_skb(struct sock *sk,
395 struct net_device *dev,
396 struct sk_buff *skb);
397
398int tls_sw_fallback_init(struct sock *sk,
399 struct tls_offload_context *offload_ctx,
400 struct tls_crypto_info *crypto_info);
401
321#endif /* _TLS_OFFLOAD_H */ 402#endif /* _TLS_OFFLOAD_H */
diff --git a/include/net/udp.h b/include/net/udp.h
index d8ca3b26964d..7ba0ed252c52 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -174,6 +174,9 @@ struct sk_buff **udp_gro_receive(struct sk_buff **head, struct sk_buff *skb,
174 struct udphdr *uh, udp_lookup_t lookup); 174 struct udphdr *uh, udp_lookup_t lookup);
175int udp_gro_complete(struct sk_buff *skb, int nhoff, udp_lookup_t lookup); 175int udp_gro_complete(struct sk_buff *skb, int nhoff, udp_lookup_t lookup);
176 176
177struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
178 netdev_features_t features);
179
177static inline struct udphdr *udp_gro_udphdr(struct sk_buff *skb) 180static inline struct udphdr *udp_gro_udphdr(struct sk_buff *skb)
178{ 181{
179 struct udphdr *uh; 182 struct udphdr *uh;
@@ -269,6 +272,7 @@ int udp_abort(struct sock *sk, int err);
269int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len); 272int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len);
270int udp_push_pending_frames(struct sock *sk); 273int udp_push_pending_frames(struct sock *sk);
271void udp_flush_pending_frames(struct sock *sk); 274void udp_flush_pending_frames(struct sock *sk);
275int udp_cmsg_send(struct sock *sk, struct msghdr *msg, u16 *gso_size);
272void udp4_hwcsum(struct sk_buff *skb, __be32 src, __be32 dst); 276void udp4_hwcsum(struct sk_buff *skb, __be32 src, __be32 dst);
273int udp_rcv(struct sk_buff *skb); 277int udp_rcv(struct sk_buff *skb);
274int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); 278int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index ad73d8b3fcc2..b99a02ae3934 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -262,6 +262,7 @@ struct vxlan_dev {
262#define VXLAN_F_COLLECT_METADATA 0x2000 262#define VXLAN_F_COLLECT_METADATA 0x2000
263#define VXLAN_F_GPE 0x4000 263#define VXLAN_F_GPE 0x4000
264#define VXLAN_F_IPV6_LINKLOCAL 0x8000 264#define VXLAN_F_IPV6_LINKLOCAL 0x8000
265#define VXLAN_F_TTL_INHERIT 0x10000
265 266
266/* Flags that are used in the receive path. These flags must match in 267/* Flags that are used in the receive path. These flags must match in
267 * order for a socket to be shareable 268 * order for a socket to be shareable
diff --git a/include/net/xdp.h b/include/net/xdp.h
index b2362ddfa694..2deea7166a34 100644
--- a/include/net/xdp.h
+++ b/include/net/xdp.h
@@ -33,16 +33,115 @@
33 * also mandatory during RX-ring setup. 33 * also mandatory during RX-ring setup.
34 */ 34 */
35 35
36enum xdp_mem_type {
37 MEM_TYPE_PAGE_SHARED = 0, /* Split-page refcnt based model */
38 MEM_TYPE_PAGE_ORDER0, /* Orig XDP full page model */
39 MEM_TYPE_PAGE_POOL,
40 MEM_TYPE_ZERO_COPY,
41 MEM_TYPE_MAX,
42};
43
44/* XDP flags for ndo_xdp_xmit */
45#define XDP_XMIT_FLUSH (1U << 0) /* doorbell signal consumer */
46#define XDP_XMIT_FLAGS_MASK XDP_XMIT_FLUSH
47
48struct xdp_mem_info {
49 u32 type; /* enum xdp_mem_type, but known size type */
50 u32 id;
51};
52
53struct page_pool;
54
55struct zero_copy_allocator {
56 void (*free)(struct zero_copy_allocator *zca, unsigned long handle);
57};
58
36struct xdp_rxq_info { 59struct xdp_rxq_info {
37 struct net_device *dev; 60 struct net_device *dev;
38 u32 queue_index; 61 u32 queue_index;
39 u32 reg_state; 62 u32 reg_state;
63 struct xdp_mem_info mem;
40} ____cacheline_aligned; /* perf critical, avoid false-sharing */ 64} ____cacheline_aligned; /* perf critical, avoid false-sharing */
41 65
66struct xdp_buff {
67 void *data;
68 void *data_end;
69 void *data_meta;
70 void *data_hard_start;
71 unsigned long handle;
72 struct xdp_rxq_info *rxq;
73};
74
75struct xdp_frame {
76 void *data;
77 u16 len;
78 u16 headroom;
79 u16 metasize;
80 /* Lifetime of xdp_rxq_info is limited to NAPI/enqueue time,
81 * while mem info is valid on remote CPU.
82 */
83 struct xdp_mem_info mem;
84 struct net_device *dev_rx; /* used by cpumap */
85};
86
87/* Convert xdp_buff to xdp_frame */
88static inline
89struct xdp_frame *convert_to_xdp_frame(struct xdp_buff *xdp)
90{
91 struct xdp_frame *xdp_frame;
92 int metasize;
93 int headroom;
94
95 /* TODO: implement clone, copy, use "native" MEM_TYPE */
96 if (xdp->rxq->mem.type == MEM_TYPE_ZERO_COPY)
97 return NULL;
98
99 /* Assure headroom is available for storing info */
100 headroom = xdp->data - xdp->data_hard_start;
101 metasize = xdp->data - xdp->data_meta;
102 metasize = metasize > 0 ? metasize : 0;
103 if (unlikely((headroom - metasize) < sizeof(*xdp_frame)))
104 return NULL;
105
106 /* Store info in top of packet */
107 xdp_frame = xdp->data_hard_start;
108
109 xdp_frame->data = xdp->data;
110 xdp_frame->len = xdp->data_end - xdp->data;
111 xdp_frame->headroom = headroom - sizeof(*xdp_frame);
112 xdp_frame->metasize = metasize;
113
114 /* rxq only valid until napi_schedule ends, convert to xdp_mem_info */
115 xdp_frame->mem = xdp->rxq->mem;
116
117 return xdp_frame;
118}
119
120void xdp_return_frame(struct xdp_frame *xdpf);
121void xdp_return_frame_rx_napi(struct xdp_frame *xdpf);
122void xdp_return_buff(struct xdp_buff *xdp);
123
42int xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq, 124int xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq,
43 struct net_device *dev, u32 queue_index); 125 struct net_device *dev, u32 queue_index);
44void xdp_rxq_info_unreg(struct xdp_rxq_info *xdp_rxq); 126void xdp_rxq_info_unreg(struct xdp_rxq_info *xdp_rxq);
45void xdp_rxq_info_unused(struct xdp_rxq_info *xdp_rxq); 127void xdp_rxq_info_unused(struct xdp_rxq_info *xdp_rxq);
46bool xdp_rxq_info_is_reg(struct xdp_rxq_info *xdp_rxq); 128bool xdp_rxq_info_is_reg(struct xdp_rxq_info *xdp_rxq);
129int xdp_rxq_info_reg_mem_model(struct xdp_rxq_info *xdp_rxq,
130 enum xdp_mem_type type, void *allocator);
131
132/* Drivers not supporting XDP metadata can use this helper, which
133 * rejects any room expansion for metadata as a result.
134 */
135static __always_inline void
136xdp_set_data_meta_invalid(struct xdp_buff *xdp)
137{
138 xdp->data_meta = xdp->data + 1;
139}
140
141static __always_inline bool
142xdp_data_meta_unsupported(const struct xdp_buff *xdp)
143{
144 return unlikely(xdp->data_meta > xdp->data);
145}
47 146
48#endif /* __LINUX_NET_XDP_H__ */ 147#endif /* __LINUX_NET_XDP_H__ */
diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h
new file mode 100644
index 000000000000..9fe472f2ac95
--- /dev/null
+++ b/include/net/xdp_sock.h
@@ -0,0 +1,99 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/* AF_XDP internal functions
3 * Copyright(c) 2018 Intel Corporation.
4 */
5
6#ifndef _LINUX_XDP_SOCK_H
7#define _LINUX_XDP_SOCK_H
8
9#include <linux/workqueue.h>
10#include <linux/if_xdp.h>
11#include <linux/mutex.h>
12#include <linux/spinlock.h>
13#include <linux/mm.h>
14#include <net/sock.h>
15
16struct net_device;
17struct xsk_queue;
18
19struct xdp_umem_props {
20 u64 chunk_mask;
21 u64 size;
22};
23
24struct xdp_umem_page {
25 void *addr;
26 dma_addr_t dma;
27};
28
29struct xdp_umem {
30 struct xsk_queue *fq;
31 struct xsk_queue *cq;
32 struct xdp_umem_page *pages;
33 struct xdp_umem_props props;
34 u32 headroom;
35 u32 chunk_size_nohr;
36 struct user_struct *user;
37 struct pid *pid;
38 unsigned long address;
39 refcount_t users;
40 struct work_struct work;
41 struct page **pgs;
42 u32 npgs;
43 struct net_device *dev;
44 u16 queue_id;
45 bool zc;
46 spinlock_t xsk_list_lock;
47 struct list_head xsk_list;
48};
49
50struct xdp_sock {
51 /* struct sock must be the first member of struct xdp_sock */
52 struct sock sk;
53 struct xsk_queue *rx;
54 struct net_device *dev;
55 struct xdp_umem *umem;
56 struct list_head flush_node;
57 u16 queue_id;
58 struct xsk_queue *tx ____cacheline_aligned_in_smp;
59 struct list_head list;
60 bool zc;
61 /* Protects multiple processes in the control path */
62 struct mutex mutex;
63 u64 rx_dropped;
64};
65
66struct xdp_buff;
67#ifdef CONFIG_XDP_SOCKETS
68int xsk_generic_rcv(struct xdp_sock *xs, struct xdp_buff *xdp);
69int xsk_rcv(struct xdp_sock *xs, struct xdp_buff *xdp);
70void xsk_flush(struct xdp_sock *xs);
71bool xsk_is_setup_for_bpf_map(struct xdp_sock *xs);
72/* Used from netdev driver */
73u64 *xsk_umem_peek_addr(struct xdp_umem *umem, u64 *addr);
74void xsk_umem_discard_addr(struct xdp_umem *umem);
75void xsk_umem_complete_tx(struct xdp_umem *umem, u32 nb_entries);
76bool xsk_umem_consume_tx(struct xdp_umem *umem, dma_addr_t *dma, u32 *len);
77void xsk_umem_consume_tx_done(struct xdp_umem *umem);
78#else
79static inline int xsk_generic_rcv(struct xdp_sock *xs, struct xdp_buff *xdp)
80{
81 return -ENOTSUPP;
82}
83
84static inline int xsk_rcv(struct xdp_sock *xs, struct xdp_buff *xdp)
85{
86 return -ENOTSUPP;
87}
88
89static inline void xsk_flush(struct xdp_sock *xs)
90{
91}
92
93static inline bool xsk_is_setup_for_bpf_map(struct xdp_sock *xs)
94{
95 return false;
96}
97#endif /* CONFIG_XDP_SOCKETS */
98
99#endif /* _LINUX_XDP_SOCK_H */
diff --git a/include/trace/events/bpf.h b/include/trace/events/bpf.h
deleted file mode 100644
index 150185647e6b..000000000000
--- a/include/trace/events/bpf.h
+++ /dev/null
@@ -1,355 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM bpf
4
5#if !defined(_TRACE_BPF_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_BPF_H
7
8/* These are only used within the BPF_SYSCALL code */
9#ifdef CONFIG_BPF_SYSCALL
10
11#include <linux/filter.h>
12#include <linux/bpf.h>
13#include <linux/fs.h>
14#include <linux/tracepoint.h>
15
16#define __PROG_TYPE_MAP(FN) \
17 FN(SOCKET_FILTER) \
18 FN(KPROBE) \
19 FN(SCHED_CLS) \
20 FN(SCHED_ACT) \
21 FN(TRACEPOINT) \
22 FN(XDP) \
23 FN(PERF_EVENT) \
24 FN(CGROUP_SKB) \
25 FN(CGROUP_SOCK) \
26 FN(LWT_IN) \
27 FN(LWT_OUT) \
28 FN(LWT_XMIT)
29
30#define __MAP_TYPE_MAP(FN) \
31 FN(HASH) \
32 FN(ARRAY) \
33 FN(PROG_ARRAY) \
34 FN(PERF_EVENT_ARRAY) \
35 FN(PERCPU_HASH) \
36 FN(PERCPU_ARRAY) \
37 FN(STACK_TRACE) \
38 FN(CGROUP_ARRAY) \
39 FN(LRU_HASH) \
40 FN(LRU_PERCPU_HASH) \
41 FN(LPM_TRIE)
42
43#define __PROG_TYPE_TP_FN(x) \
44 TRACE_DEFINE_ENUM(BPF_PROG_TYPE_##x);
45#define __PROG_TYPE_SYM_FN(x) \
46 { BPF_PROG_TYPE_##x, #x },
47#define __PROG_TYPE_SYM_TAB \
48 __PROG_TYPE_MAP(__PROG_TYPE_SYM_FN) { -1, 0 }
49__PROG_TYPE_MAP(__PROG_TYPE_TP_FN)
50
51#define __MAP_TYPE_TP_FN(x) \
52 TRACE_DEFINE_ENUM(BPF_MAP_TYPE_##x);
53#define __MAP_TYPE_SYM_FN(x) \
54 { BPF_MAP_TYPE_##x, #x },
55#define __MAP_TYPE_SYM_TAB \
56 __MAP_TYPE_MAP(__MAP_TYPE_SYM_FN) { -1, 0 }
57__MAP_TYPE_MAP(__MAP_TYPE_TP_FN)
58
59DECLARE_EVENT_CLASS(bpf_prog_event,
60
61 TP_PROTO(const struct bpf_prog *prg),
62
63 TP_ARGS(prg),
64
65 TP_STRUCT__entry(
66 __array(u8, prog_tag, 8)
67 __field(u32, type)
68 ),
69
70 TP_fast_assign(
71 BUILD_BUG_ON(sizeof(__entry->prog_tag) != sizeof(prg->tag));
72 memcpy(__entry->prog_tag, prg->tag, sizeof(prg->tag));
73 __entry->type = prg->type;
74 ),
75
76 TP_printk("prog=%s type=%s",
77 __print_hex_str(__entry->prog_tag, 8),
78 __print_symbolic(__entry->type, __PROG_TYPE_SYM_TAB))
79);
80
81DEFINE_EVENT(bpf_prog_event, bpf_prog_get_type,
82
83 TP_PROTO(const struct bpf_prog *prg),
84
85 TP_ARGS(prg)
86);
87
88DEFINE_EVENT(bpf_prog_event, bpf_prog_put_rcu,
89
90 TP_PROTO(const struct bpf_prog *prg),
91
92 TP_ARGS(prg)
93);
94
95TRACE_EVENT(bpf_prog_load,
96
97 TP_PROTO(const struct bpf_prog *prg, int ufd),
98
99 TP_ARGS(prg, ufd),
100
101 TP_STRUCT__entry(
102 __array(u8, prog_tag, 8)
103 __field(u32, type)
104 __field(int, ufd)
105 ),
106
107 TP_fast_assign(
108 BUILD_BUG_ON(sizeof(__entry->prog_tag) != sizeof(prg->tag));
109 memcpy(__entry->prog_tag, prg->tag, sizeof(prg->tag));
110 __entry->type = prg->type;
111 __entry->ufd = ufd;
112 ),
113
114 TP_printk("prog=%s type=%s ufd=%d",
115 __print_hex_str(__entry->prog_tag, 8),
116 __print_symbolic(__entry->type, __PROG_TYPE_SYM_TAB),
117 __entry->ufd)
118);
119
120TRACE_EVENT(bpf_map_create,
121
122 TP_PROTO(const struct bpf_map *map, int ufd),
123
124 TP_ARGS(map, ufd),
125
126 TP_STRUCT__entry(
127 __field(u32, type)
128 __field(u32, size_key)
129 __field(u32, size_value)
130 __field(u32, max_entries)
131 __field(u32, flags)
132 __field(int, ufd)
133 ),
134
135 TP_fast_assign(
136 __entry->type = map->map_type;
137 __entry->size_key = map->key_size;
138 __entry->size_value = map->value_size;
139 __entry->max_entries = map->max_entries;
140 __entry->flags = map->map_flags;
141 __entry->ufd = ufd;
142 ),
143
144 TP_printk("map type=%s ufd=%d key=%u val=%u max=%u flags=%x",
145 __print_symbolic(__entry->type, __MAP_TYPE_SYM_TAB),
146 __entry->ufd, __entry->size_key, __entry->size_value,
147 __entry->max_entries, __entry->flags)
148);
149
150DECLARE_EVENT_CLASS(bpf_obj_prog,
151
152 TP_PROTO(const struct bpf_prog *prg, int ufd,
153 const struct filename *pname),
154
155 TP_ARGS(prg, ufd, pname),
156
157 TP_STRUCT__entry(
158 __array(u8, prog_tag, 8)
159 __field(int, ufd)
160 __string(path, pname->name)
161 ),
162
163 TP_fast_assign(
164 BUILD_BUG_ON(sizeof(__entry->prog_tag) != sizeof(prg->tag));
165 memcpy(__entry->prog_tag, prg->tag, sizeof(prg->tag));
166 __assign_str(path, pname->name);
167 __entry->ufd = ufd;
168 ),
169
170 TP_printk("prog=%s path=%s ufd=%d",
171 __print_hex_str(__entry->prog_tag, 8),
172 __get_str(path), __entry->ufd)
173);
174
175DEFINE_EVENT(bpf_obj_prog, bpf_obj_pin_prog,
176
177 TP_PROTO(const struct bpf_prog *prg, int ufd,
178 const struct filename *pname),
179
180 TP_ARGS(prg, ufd, pname)
181);
182
183DEFINE_EVENT(bpf_obj_prog, bpf_obj_get_prog,
184
185 TP_PROTO(const struct bpf_prog *prg, int ufd,
186 const struct filename *pname),
187
188 TP_ARGS(prg, ufd, pname)
189);
190
191DECLARE_EVENT_CLASS(bpf_obj_map,
192
193 TP_PROTO(const struct bpf_map *map, int ufd,
194 const struct filename *pname),
195
196 TP_ARGS(map, ufd, pname),
197
198 TP_STRUCT__entry(
199 __field(u32, type)
200 __field(int, ufd)
201 __string(path, pname->name)
202 ),
203
204 TP_fast_assign(
205 __assign_str(path, pname->name);
206 __entry->type = map->map_type;
207 __entry->ufd = ufd;
208 ),
209
210 TP_printk("map type=%s ufd=%d path=%s",
211 __print_symbolic(__entry->type, __MAP_TYPE_SYM_TAB),
212 __entry->ufd, __get_str(path))
213);
214
215DEFINE_EVENT(bpf_obj_map, bpf_obj_pin_map,
216
217 TP_PROTO(const struct bpf_map *map, int ufd,
218 const struct filename *pname),
219
220 TP_ARGS(map, ufd, pname)
221);
222
223DEFINE_EVENT(bpf_obj_map, bpf_obj_get_map,
224
225 TP_PROTO(const struct bpf_map *map, int ufd,
226 const struct filename *pname),
227
228 TP_ARGS(map, ufd, pname)
229);
230
231DECLARE_EVENT_CLASS(bpf_map_keyval,
232
233 TP_PROTO(const struct bpf_map *map, int ufd,
234 const void *key, const void *val),
235
236 TP_ARGS(map, ufd, key, val),
237
238 TP_STRUCT__entry(
239 __field(u32, type)
240 __field(u32, key_len)
241 __dynamic_array(u8, key, map->key_size)
242 __field(bool, key_trunc)
243 __field(u32, val_len)
244 __dynamic_array(u8, val, map->value_size)
245 __field(bool, val_trunc)
246 __field(int, ufd)
247 ),
248
249 TP_fast_assign(
250 memcpy(__get_dynamic_array(key), key, map->key_size);
251 memcpy(__get_dynamic_array(val), val, map->value_size);
252 __entry->type = map->map_type;
253 __entry->key_len = min(map->key_size, 16U);
254 __entry->key_trunc = map->key_size != __entry->key_len;
255 __entry->val_len = min(map->value_size, 16U);
256 __entry->val_trunc = map->value_size != __entry->val_len;
257 __entry->ufd = ufd;
258 ),
259
260 TP_printk("map type=%s ufd=%d key=[%s%s] val=[%s%s]",
261 __print_symbolic(__entry->type, __MAP_TYPE_SYM_TAB),
262 __entry->ufd,
263 __print_hex(__get_dynamic_array(key), __entry->key_len),
264 __entry->key_trunc ? " ..." : "",
265 __print_hex(__get_dynamic_array(val), __entry->val_len),
266 __entry->val_trunc ? " ..." : "")
267);
268
269DEFINE_EVENT(bpf_map_keyval, bpf_map_lookup_elem,
270
271 TP_PROTO(const struct bpf_map *map, int ufd,
272 const void *key, const void *val),
273
274 TP_ARGS(map, ufd, key, val)
275);
276
277DEFINE_EVENT(bpf_map_keyval, bpf_map_update_elem,
278
279 TP_PROTO(const struct bpf_map *map, int ufd,
280 const void *key, const void *val),
281
282 TP_ARGS(map, ufd, key, val)
283);
284
285TRACE_EVENT(bpf_map_delete_elem,
286
287 TP_PROTO(const struct bpf_map *map, int ufd,
288 const void *key),
289
290 TP_ARGS(map, ufd, key),
291
292 TP_STRUCT__entry(
293 __field(u32, type)
294 __field(u32, key_len)
295 __dynamic_array(u8, key, map->key_size)
296 __field(bool, key_trunc)
297 __field(int, ufd)
298 ),
299
300 TP_fast_assign(
301 memcpy(__get_dynamic_array(key), key, map->key_size);
302 __entry->type = map->map_type;
303 __entry->key_len = min(map->key_size, 16U);
304 __entry->key_trunc = map->key_size != __entry->key_len;
305 __entry->ufd = ufd;
306 ),
307
308 TP_printk("map type=%s ufd=%d key=[%s%s]",
309 __print_symbolic(__entry->type, __MAP_TYPE_SYM_TAB),
310 __entry->ufd,
311 __print_hex(__get_dynamic_array(key), __entry->key_len),
312 __entry->key_trunc ? " ..." : "")
313);
314
315TRACE_EVENT(bpf_map_next_key,
316
317 TP_PROTO(const struct bpf_map *map, int ufd,
318 const void *key, const void *key_next),
319
320 TP_ARGS(map, ufd, key, key_next),
321
322 TP_STRUCT__entry(
323 __field(u32, type)
324 __field(u32, key_len)
325 __dynamic_array(u8, key, map->key_size)
326 __dynamic_array(u8, nxt, map->key_size)
327 __field(bool, key_trunc)
328 __field(bool, key_null)
329 __field(int, ufd)
330 ),
331
332 TP_fast_assign(
333 if (key)
334 memcpy(__get_dynamic_array(key), key, map->key_size);
335 __entry->key_null = !key;
336 memcpy(__get_dynamic_array(nxt), key_next, map->key_size);
337 __entry->type = map->map_type;
338 __entry->key_len = min(map->key_size, 16U);
339 __entry->key_trunc = map->key_size != __entry->key_len;
340 __entry->ufd = ufd;
341 ),
342
343 TP_printk("map type=%s ufd=%d key=[%s%s] next=[%s%s]",
344 __print_symbolic(__entry->type, __MAP_TYPE_SYM_TAB),
345 __entry->ufd,
346 __entry->key_null ? "NULL" : __print_hex(__get_dynamic_array(key),
347 __entry->key_len),
348 __entry->key_trunc && !__entry->key_null ? " ..." : "",
349 __print_hex(__get_dynamic_array(nxt), __entry->key_len),
350 __entry->key_trunc ? " ..." : "")
351);
352#endif /* CONFIG_BPF_SYSCALL */
353#endif /* _TRACE_BPF_H */
354
355#include <trace/define_trace.h>
diff --git a/include/trace/events/fib.h b/include/trace/events/fib.h
index 81b7e985bb45..9763cddd0594 100644
--- a/include/trace/events/fib.h
+++ b/include/trace/events/fib.h
@@ -12,12 +12,14 @@
12 12
13TRACE_EVENT(fib_table_lookup, 13TRACE_EVENT(fib_table_lookup,
14 14
15 TP_PROTO(u32 tb_id, const struct flowi4 *flp), 15 TP_PROTO(u32 tb_id, const struct flowi4 *flp,
16 const struct fib_nh *nh, int err),
16 17
17 TP_ARGS(tb_id, flp), 18 TP_ARGS(tb_id, flp, nh, err),
18 19
19 TP_STRUCT__entry( 20 TP_STRUCT__entry(
20 __field( u32, tb_id ) 21 __field( u32, tb_id )
22 __field( int, err )
21 __field( int, oif ) 23 __field( int, oif )
22 __field( int, iif ) 24 __field( int, iif )
23 __field( __u8, tos ) 25 __field( __u8, tos )
@@ -25,12 +27,19 @@ TRACE_EVENT(fib_table_lookup,
25 __field( __u8, flags ) 27 __field( __u8, flags )
26 __array( __u8, src, 4 ) 28 __array( __u8, src, 4 )
27 __array( __u8, dst, 4 ) 29 __array( __u8, dst, 4 )
30 __array( __u8, gw, 4 )
31 __array( __u8, saddr, 4 )
32 __field( u16, sport )
33 __field( u16, dport )
34 __field( u8, proto )
35 __dynamic_array(char, name, IFNAMSIZ )
28 ), 36 ),
29 37
30 TP_fast_assign( 38 TP_fast_assign(
31 __be32 *p32; 39 __be32 *p32;
32 40
33 __entry->tb_id = tb_id; 41 __entry->tb_id = tb_id;
42 __entry->err = err;
34 __entry->oif = flp->flowi4_oif; 43 __entry->oif = flp->flowi4_oif;
35 __entry->iif = flp->flowi4_iif; 44 __entry->iif = flp->flowi4_iif;
36 __entry->tos = flp->flowi4_tos; 45 __entry->tos = flp->flowi4_tos;
@@ -42,71 +51,41 @@ TRACE_EVENT(fib_table_lookup,
42 51
43 p32 = (__be32 *) __entry->dst; 52 p32 = (__be32 *) __entry->dst;
44 *p32 = flp->daddr; 53 *p32 = flp->daddr;
45 ),
46
47 TP_printk("table %u oif %d iif %d src %pI4 dst %pI4 tos %d scope %d flags %x",
48 __entry->tb_id, __entry->oif, __entry->iif,
49 __entry->src, __entry->dst, __entry->tos, __entry->scope,
50 __entry->flags)
51);
52
53TRACE_EVENT(fib_table_lookup_nh,
54
55 TP_PROTO(const struct fib_nh *nh),
56
57 TP_ARGS(nh),
58
59 TP_STRUCT__entry(
60 __string( name, nh->nh_dev->name)
61 __field( int, oif )
62 __array( __u8, src, 4 )
63 ),
64
65 TP_fast_assign(
66 __be32 *p32 = (__be32 *) __entry->src;
67
68 __assign_str(name, nh->nh_dev ? nh->nh_dev->name : "not set");
69 __entry->oif = nh->nh_oif;
70 *p32 = nh->nh_saddr;
71 ),
72
73 TP_printk("nexthop dev %s oif %d src %pI4",
74 __get_str(name), __entry->oif, __entry->src)
75);
76
77TRACE_EVENT(fib_validate_source,
78
79 TP_PROTO(const struct net_device *dev, const struct flowi4 *flp),
80
81 TP_ARGS(dev, flp),
82 54
83 TP_STRUCT__entry( 55 __entry->proto = flp->flowi4_proto;
84 __string( name, dev->name ) 56 if (__entry->proto == IPPROTO_TCP ||
85 __field( int, oif ) 57 __entry->proto == IPPROTO_UDP) {
86 __field( int, iif ) 58 __entry->sport = ntohs(flp->fl4_sport);
87 __field( __u8, tos ) 59 __entry->dport = ntohs(flp->fl4_dport);
88 __array( __u8, src, 4 ) 60 } else {
89 __array( __u8, dst, 4 ) 61 __entry->sport = 0;
90 ), 62 __entry->dport = 0;
91 63 }
92 TP_fast_assign( 64
93 __be32 *p32; 65 if (nh) {
94 66 p32 = (__be32 *) __entry->saddr;
95 __assign_str(name, dev ? dev->name : "not set"); 67 *p32 = nh->nh_saddr;
96 __entry->oif = flp->flowi4_oif; 68
97 __entry->iif = flp->flowi4_iif; 69 p32 = (__be32 *) __entry->gw;
98 __entry->tos = flp->flowi4_tos; 70 *p32 = nh->nh_gw;
99 71
100 p32 = (__be32 *) __entry->src; 72 __assign_str(name, nh->nh_dev ? nh->nh_dev->name : "-");
101 *p32 = flp->saddr; 73 } else {
102 74 p32 = (__be32 *) __entry->saddr;
103 p32 = (__be32 *) __entry->dst; 75 *p32 = 0;
104 *p32 = flp->daddr; 76
77 p32 = (__be32 *) __entry->gw;
78 *p32 = 0;
79
80 __assign_str(name, "-");
81 }
105 ), 82 ),
106 83
107 TP_printk("dev %s oif %d iif %d tos %d src %pI4 dst %pI4", 84 TP_printk("table %u oif %d iif %d proto %u %pI4/%u -> %pI4/%u tos %d scope %d flags %x ==> dev %s gw %pI4 src %pI4 err %d",
108 __get_str(name), __entry->oif, __entry->iif, __entry->tos, 85 __entry->tb_id, __entry->oif, __entry->iif, __entry->proto,
109 __entry->src, __entry->dst) 86 __entry->src, __entry->sport, __entry->dst, __entry->dport,
87 __entry->tos, __entry->scope, __entry->flags,
88 __get_str(name), __entry->gw, __entry->saddr, __entry->err)
110); 89);
111#endif /* _TRACE_FIB_H */ 90#endif /* _TRACE_FIB_H */
112 91
diff --git a/include/trace/events/fib6.h b/include/trace/events/fib6.h
index 7e8d48a81b91..b088b54d699c 100644
--- a/include/trace/events/fib6.h
+++ b/include/trace/events/fib6.h
@@ -12,14 +12,14 @@
12 12
13TRACE_EVENT(fib6_table_lookup, 13TRACE_EVENT(fib6_table_lookup,
14 14
15 TP_PROTO(const struct net *net, const struct rt6_info *rt, 15 TP_PROTO(const struct net *net, const struct fib6_info *f6i,
16 struct fib6_table *table, const struct flowi6 *flp), 16 struct fib6_table *table, const struct flowi6 *flp),
17 17
18 TP_ARGS(net, rt, table, flp), 18 TP_ARGS(net, f6i, table, flp),
19 19
20 TP_STRUCT__entry( 20 TP_STRUCT__entry(
21 __field( u32, tb_id ) 21 __field( u32, tb_id )
22 22 __field( int, err )
23 __field( int, oif ) 23 __field( int, oif )
24 __field( int, iif ) 24 __field( int, iif )
25 __field( __u8, tos ) 25 __field( __u8, tos )
@@ -27,7 +27,10 @@ TRACE_EVENT(fib6_table_lookup,
27 __field( __u8, flags ) 27 __field( __u8, flags )
28 __array( __u8, src, 16 ) 28 __array( __u8, src, 16 )
29 __array( __u8, dst, 16 ) 29 __array( __u8, dst, 16 )
30 30 __field( u16, sport )
31 __field( u16, dport )
32 __field( u8, proto )
33 __field( u8, rt_type )
31 __dynamic_array( char, name, IFNAMSIZ ) 34 __dynamic_array( char, name, IFNAMSIZ )
32 __array( __u8, gw, 16 ) 35 __array( __u8, gw, 16 )
33 ), 36 ),
@@ -36,6 +39,7 @@ TRACE_EVENT(fib6_table_lookup,
36 struct in6_addr *in6; 39 struct in6_addr *in6;
37 40
38 __entry->tb_id = table->tb6_id; 41 __entry->tb_id = table->tb6_id;
42 __entry->err = ip6_rt_type_to_error(f6i->fib6_type);
39 __entry->oif = flp->flowi6_oif; 43 __entry->oif = flp->flowi6_oif;
40 __entry->iif = flp->flowi6_iif; 44 __entry->iif = flp->flowi6_iif;
41 __entry->tos = ip6_tclass(flp->flowlabel); 45 __entry->tos = ip6_tclass(flp->flowlabel);
@@ -48,27 +52,38 @@ TRACE_EVENT(fib6_table_lookup,
48 in6 = (struct in6_addr *)__entry->dst; 52 in6 = (struct in6_addr *)__entry->dst;
49 *in6 = flp->daddr; 53 *in6 = flp->daddr;
50 54
51 if (rt->rt6i_idev) { 55 __entry->proto = flp->flowi6_proto;
52 __assign_str(name, rt->rt6i_idev->dev->name); 56 if (__entry->proto == IPPROTO_TCP ||
57 __entry->proto == IPPROTO_UDP) {
58 __entry->sport = ntohs(flp->fl6_sport);
59 __entry->dport = ntohs(flp->fl6_dport);
60 } else {
61 __entry->sport = 0;
62 __entry->dport = 0;
63 }
64
65 if (f6i->fib6_nh.nh_dev) {
66 __assign_str(name, f6i->fib6_nh.nh_dev);
53 } else { 67 } else {
54 __assign_str(name, ""); 68 __assign_str(name, "-");
55 } 69 }
56 if (rt == net->ipv6.ip6_null_entry) { 70 if (f6i == net->ipv6.fib6_null_entry) {
57 struct in6_addr in6_zero = {}; 71 struct in6_addr in6_zero = {};
58 72
59 in6 = (struct in6_addr *)__entry->gw; 73 in6 = (struct in6_addr *)__entry->gw;
60 *in6 = in6_zero; 74 *in6 = in6_zero;
61 75
62 } else if (rt) { 76 } else if (f6i) {
63 in6 = (struct in6_addr *)__entry->gw; 77 in6 = (struct in6_addr *)__entry->gw;
64 *in6 = rt->rt6i_gateway; 78 *in6 = f6i->fib6_nh.nh_gw;
65 } 79 }
66 ), 80 ),
67 81
68 TP_printk("table %3u oif %d iif %d src %pI6c dst %pI6c tos %d scope %d flags %x ==> dev %s gw %pI6c", 82 TP_printk("table %3u oif %d iif %d proto %u %pI6c/%u -> %pI6c/%u tos %d scope %d flags %x ==> dev %s gw %pI6c err %d",
69 __entry->tb_id, __entry->oif, __entry->iif, 83 __entry->tb_id, __entry->oif, __entry->iif, __entry->proto,
70 __entry->src, __entry->dst, __entry->tos, __entry->scope, 84 __entry->src, __entry->sport, __entry->dst, __entry->dport,
71 __entry->flags, __get_str(name), __entry->gw) 85 __entry->tos, __entry->scope, __entry->flags,
86 __get_str(name), __entry->gw, __entry->err)
72); 87);
73 88
74#endif /* _TRACE_FIB6_H */ 89#endif /* _TRACE_FIB6_H */
diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h
index 077e664ac9a2..4fff00e9da8a 100644
--- a/include/trace/events/rxrpc.h
+++ b/include/trace/events/rxrpc.h
@@ -1459,6 +1459,38 @@ TRACE_EVENT(rxrpc_tx_fail,
1459 __print_symbolic(__entry->what, rxrpc_tx_fail_traces)) 1459 __print_symbolic(__entry->what, rxrpc_tx_fail_traces))
1460 ); 1460 );
1461 1461
1462TRACE_EVENT(rxrpc_call_reset,
1463 TP_PROTO(struct rxrpc_call *call),
1464
1465 TP_ARGS(call),
1466
1467 TP_STRUCT__entry(
1468 __field(unsigned int, debug_id )
1469 __field(u32, cid )
1470 __field(u32, call_id )
1471 __field(rxrpc_serial_t, call_serial )
1472 __field(rxrpc_serial_t, conn_serial )
1473 __field(rxrpc_seq_t, tx_seq )
1474 __field(rxrpc_seq_t, rx_seq )
1475 ),
1476
1477 TP_fast_assign(
1478 __entry->debug_id = call->debug_id;
1479 __entry->cid = call->cid;
1480 __entry->call_id = call->call_id;
1481 __entry->call_serial = call->rx_serial;
1482 __entry->conn_serial = call->conn->hi_serial;
1483 __entry->tx_seq = call->tx_hard_ack;
1484 __entry->rx_seq = call->ackr_seen;
1485 ),
1486
1487 TP_printk("c=%08x %08x:%08x r=%08x/%08x tx=%08x rx=%08x",
1488 __entry->debug_id,
1489 __entry->cid, __entry->call_id,
1490 __entry->call_serial, __entry->conn_serial,
1491 __entry->tx_seq, __entry->rx_seq)
1492 );
1493
1462#endif /* _TRACE_RXRPC_H */ 1494#endif /* _TRACE_RXRPC_H */
1463 1495
1464/* This part must be outside protection */ 1496/* This part must be outside protection */
diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h
index 878b2be7ce77..ac55b328d61b 100644
--- a/include/trace/events/tcp.h
+++ b/include/trace/events/tcp.h
@@ -10,6 +10,7 @@
10#include <linux/tracepoint.h> 10#include <linux/tracepoint.h>
11#include <net/ipv6.h> 11#include <net/ipv6.h>
12#include <net/tcp.h> 12#include <net/tcp.h>
13#include <linux/sock_diag.h>
13 14
14#define TP_STORE_V4MAPPED(__entry, saddr, daddr) \ 15#define TP_STORE_V4MAPPED(__entry, saddr, daddr) \
15 do { \ 16 do { \
@@ -113,7 +114,7 @@ DEFINE_EVENT(tcp_event_sk_skb, tcp_send_reset,
113 */ 114 */
114DECLARE_EVENT_CLASS(tcp_event_sk, 115DECLARE_EVENT_CLASS(tcp_event_sk,
115 116
116 TP_PROTO(const struct sock *sk), 117 TP_PROTO(struct sock *sk),
117 118
118 TP_ARGS(sk), 119 TP_ARGS(sk),
119 120
@@ -125,6 +126,7 @@ DECLARE_EVENT_CLASS(tcp_event_sk,
125 __array(__u8, daddr, 4) 126 __array(__u8, daddr, 4)
126 __array(__u8, saddr_v6, 16) 127 __array(__u8, saddr_v6, 16)
127 __array(__u8, daddr_v6, 16) 128 __array(__u8, daddr_v6, 16)
129 __field(__u64, sock_cookie)
128 ), 130 ),
129 131
130 TP_fast_assign( 132 TP_fast_assign(
@@ -144,73 +146,36 @@ DECLARE_EVENT_CLASS(tcp_event_sk,
144 146
145 TP_STORE_ADDRS(__entry, inet->inet_saddr, inet->inet_daddr, 147 TP_STORE_ADDRS(__entry, inet->inet_saddr, inet->inet_daddr,
146 sk->sk_v6_rcv_saddr, sk->sk_v6_daddr); 148 sk->sk_v6_rcv_saddr, sk->sk_v6_daddr);
149
150 __entry->sock_cookie = sock_gen_cookie(sk);
147 ), 151 ),
148 152
149 TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c", 153 TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c sock_cookie=%llx",
150 __entry->sport, __entry->dport, 154 __entry->sport, __entry->dport,
151 __entry->saddr, __entry->daddr, 155 __entry->saddr, __entry->daddr,
152 __entry->saddr_v6, __entry->daddr_v6) 156 __entry->saddr_v6, __entry->daddr_v6,
157 __entry->sock_cookie)
153); 158);
154 159
155DEFINE_EVENT(tcp_event_sk, tcp_receive_reset, 160DEFINE_EVENT(tcp_event_sk, tcp_receive_reset,
156 161
157 TP_PROTO(const struct sock *sk), 162 TP_PROTO(struct sock *sk),
158 163
159 TP_ARGS(sk) 164 TP_ARGS(sk)
160); 165);
161 166
162DEFINE_EVENT(tcp_event_sk, tcp_destroy_sock, 167DEFINE_EVENT(tcp_event_sk, tcp_destroy_sock,
163 168
164 TP_PROTO(const struct sock *sk), 169 TP_PROTO(struct sock *sk),
165 170
166 TP_ARGS(sk) 171 TP_ARGS(sk)
167); 172);
168 173
169TRACE_EVENT(tcp_set_state, 174DEFINE_EVENT(tcp_event_sk, tcp_rcv_space_adjust,
170
171 TP_PROTO(const struct sock *sk, const int oldstate, const int newstate),
172
173 TP_ARGS(sk, oldstate, newstate),
174
175 TP_STRUCT__entry(
176 __field(const void *, skaddr)
177 __field(int, oldstate)
178 __field(int, newstate)
179 __field(__u16, sport)
180 __field(__u16, dport)
181 __array(__u8, saddr, 4)
182 __array(__u8, daddr, 4)
183 __array(__u8, saddr_v6, 16)
184 __array(__u8, daddr_v6, 16)
185 ),
186
187 TP_fast_assign(
188 struct inet_sock *inet = inet_sk(sk);
189 __be32 *p32;
190
191 __entry->skaddr = sk;
192 __entry->oldstate = oldstate;
193 __entry->newstate = newstate;
194
195 __entry->sport = ntohs(inet->inet_sport);
196 __entry->dport = ntohs(inet->inet_dport);
197
198 p32 = (__be32 *) __entry->saddr;
199 *p32 = inet->inet_saddr;
200
201 p32 = (__be32 *) __entry->daddr;
202 *p32 = inet->inet_daddr;
203 175
204 TP_STORE_ADDRS(__entry, inet->inet_saddr, inet->inet_daddr, 176 TP_PROTO(struct sock *sk),
205 sk->sk_v6_rcv_saddr, sk->sk_v6_daddr);
206 ),
207 177
208 TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c oldstate=%s newstate=%s", 178 TP_ARGS(sk)
209 __entry->sport, __entry->dport,
210 __entry->saddr, __entry->daddr,
211 __entry->saddr_v6, __entry->daddr_v6,
212 show_tcp_state_name(__entry->oldstate),
213 show_tcp_state_name(__entry->newstate))
214); 179);
215 180
216TRACE_EVENT(tcp_retransmit_synack, 181TRACE_EVENT(tcp_retransmit_synack,
@@ -271,7 +236,7 @@ TRACE_EVENT(tcp_probe,
271 __field(__u16, sport) 236 __field(__u16, sport)
272 __field(__u16, dport) 237 __field(__u16, dport)
273 __field(__u32, mark) 238 __field(__u32, mark)
274 __field(__u16, length) 239 __field(__u16, data_len)
275 __field(__u32, snd_nxt) 240 __field(__u32, snd_nxt)
276 __field(__u32, snd_una) 241 __field(__u32, snd_una)
277 __field(__u32, snd_cwnd) 242 __field(__u32, snd_cwnd)
@@ -279,11 +244,13 @@ TRACE_EVENT(tcp_probe,
279 __field(__u32, snd_wnd) 244 __field(__u32, snd_wnd)
280 __field(__u32, srtt) 245 __field(__u32, srtt)
281 __field(__u32, rcv_wnd) 246 __field(__u32, rcv_wnd)
247 __field(__u64, sock_cookie)
282 ), 248 ),
283 249
284 TP_fast_assign( 250 TP_fast_assign(
285 const struct tcp_sock *tp = tcp_sk(sk); 251 const struct tcphdr *th = (const struct tcphdr *)skb->data;
286 const struct inet_sock *inet = inet_sk(sk); 252 const struct inet_sock *inet = inet_sk(sk);
253 const struct tcp_sock *tp = tcp_sk(sk);
287 254
288 memset(__entry->saddr, 0, sizeof(struct sockaddr_in6)); 255 memset(__entry->saddr, 0, sizeof(struct sockaddr_in6));
289 memset(__entry->daddr, 0, sizeof(struct sockaddr_in6)); 256 memset(__entry->daddr, 0, sizeof(struct sockaddr_in6));
@@ -295,7 +262,7 @@ TRACE_EVENT(tcp_probe,
295 __entry->dport = ntohs(inet->inet_dport); 262 __entry->dport = ntohs(inet->inet_dport);
296 __entry->mark = skb->mark; 263 __entry->mark = skb->mark;
297 264
298 __entry->length = skb->len; 265 __entry->data_len = skb->len - __tcp_hdrlen(th);
299 __entry->snd_nxt = tp->snd_nxt; 266 __entry->snd_nxt = tp->snd_nxt;
300 __entry->snd_una = tp->snd_una; 267 __entry->snd_una = tp->snd_una;
301 __entry->snd_cwnd = tp->snd_cwnd; 268 __entry->snd_cwnd = tp->snd_cwnd;
@@ -303,15 +270,14 @@ TRACE_EVENT(tcp_probe,
303 __entry->rcv_wnd = tp->rcv_wnd; 270 __entry->rcv_wnd = tp->rcv_wnd;
304 __entry->ssthresh = tcp_current_ssthresh(sk); 271 __entry->ssthresh = tcp_current_ssthresh(sk);
305 __entry->srtt = tp->srtt_us >> 3; 272 __entry->srtt = tp->srtt_us >> 3;
273 __entry->sock_cookie = sock_gen_cookie(sk);
306 ), 274 ),
307 275
308 TP_printk("src=%pISpc dest=%pISpc mark=%#x length=%d snd_nxt=%#x " 276 TP_printk("src=%pISpc dest=%pISpc mark=%#x data_len=%d snd_nxt=%#x snd_una=%#x snd_cwnd=%u ssthresh=%u snd_wnd=%u srtt=%u rcv_wnd=%u sock_cookie=%llx",
309 "snd_una=%#x snd_cwnd=%u ssthresh=%u snd_wnd=%u srtt=%u "
310 "rcv_wnd=%u",
311 __entry->saddr, __entry->daddr, __entry->mark, 277 __entry->saddr, __entry->daddr, __entry->mark,
312 __entry->length, __entry->snd_nxt, __entry->snd_una, 278 __entry->data_len, __entry->snd_nxt, __entry->snd_una,
313 __entry->snd_cwnd, __entry->ssthresh, __entry->snd_wnd, 279 __entry->snd_cwnd, __entry->ssthresh, __entry->snd_wnd,
314 __entry->srtt, __entry->rcv_wnd) 280 __entry->srtt, __entry->rcv_wnd, __entry->sock_cookie)
315); 281);
316 282
317#endif /* _TRACE_TCP_H */ 283#endif /* _TRACE_TCP_H */
diff --git a/include/trace/events/xdp.h b/include/trace/events/xdp.h
index 8989a92c571a..1ecf4c67fcf7 100644
--- a/include/trace/events/xdp.h
+++ b/include/trace/events/xdp.h
@@ -138,11 +138,18 @@ DEFINE_EVENT_PRINT(xdp_redirect_template, xdp_redirect_map_err,
138 __entry->map_id, __entry->map_index) 138 __entry->map_id, __entry->map_index)
139); 139);
140 140
141#ifndef __DEVMAP_OBJ_TYPE
142#define __DEVMAP_OBJ_TYPE
143struct _bpf_dtab_netdev {
144 struct net_device *dev;
145};
146#endif /* __DEVMAP_OBJ_TYPE */
147
141#define devmap_ifindex(fwd, map) \ 148#define devmap_ifindex(fwd, map) \
142 (!fwd ? 0 : \ 149 (!fwd ? 0 : \
143 (!map ? 0 : \ 150 (!map ? 0 : \
144 ((map->map_type == BPF_MAP_TYPE_DEVMAP) ? \ 151 ((map->map_type == BPF_MAP_TYPE_DEVMAP) ? \
145 ((struct net_device *)fwd)->ifindex : 0))) 152 ((struct _bpf_dtab_netdev *)fwd)->dev->ifindex : 0)))
146 153
147#define _trace_xdp_redirect_map(dev, xdp, fwd, map, idx) \ 154#define _trace_xdp_redirect_map(dev, xdp, fwd, map, idx) \
148 trace_xdp_redirect_map(dev, xdp, devmap_ifindex(fwd, map), \ 155 trace_xdp_redirect_map(dev, xdp, devmap_ifindex(fwd, map), \
@@ -222,6 +229,47 @@ TRACE_EVENT(xdp_cpumap_enqueue,
222 __entry->to_cpu) 229 __entry->to_cpu)
223); 230);
224 231
232TRACE_EVENT(xdp_devmap_xmit,
233
234 TP_PROTO(const struct bpf_map *map, u32 map_index,
235 int sent, int drops,
236 const struct net_device *from_dev,
237 const struct net_device *to_dev, int err),
238
239 TP_ARGS(map, map_index, sent, drops, from_dev, to_dev, err),
240
241 TP_STRUCT__entry(
242 __field(int, map_id)
243 __field(u32, act)
244 __field(u32, map_index)
245 __field(int, drops)
246 __field(int, sent)
247 __field(int, from_ifindex)
248 __field(int, to_ifindex)
249 __field(int, err)
250 ),
251
252 TP_fast_assign(
253 __entry->map_id = map->id;
254 __entry->act = XDP_REDIRECT;
255 __entry->map_index = map_index;
256 __entry->drops = drops;
257 __entry->sent = sent;
258 __entry->from_ifindex = from_dev->ifindex;
259 __entry->to_ifindex = to_dev->ifindex;
260 __entry->err = err;
261 ),
262
263 TP_printk("ndo_xdp_xmit"
264 " map_id=%d map_index=%d action=%s"
265 " sent=%d drops=%d"
266 " from_ifindex=%d to_ifindex=%d err=%d",
267 __entry->map_id, __entry->map_index,
268 __print_symbolic(__entry->act, __XDP_ACT_SYM_TAB),
269 __entry->sent, __entry->drops,
270 __entry->from_ifindex, __entry->to_ifindex, __entry->err)
271);
272
225#endif /* _TRACE_XDP_H */ 273#endif /* _TRACE_XDP_H */
226 274
227#include <trace/define_trace.h> 275#include <trace/define_trace.h>
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 8c317737ba3f..59b19b6a40d7 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -95,6 +95,9 @@ enum bpf_cmd {
95 BPF_OBJ_GET_INFO_BY_FD, 95 BPF_OBJ_GET_INFO_BY_FD,
96 BPF_PROG_QUERY, 96 BPF_PROG_QUERY,
97 BPF_RAW_TRACEPOINT_OPEN, 97 BPF_RAW_TRACEPOINT_OPEN,
98 BPF_BTF_LOAD,
99 BPF_BTF_GET_FD_BY_ID,
100 BPF_TASK_FD_QUERY,
98}; 101};
99 102
100enum bpf_map_type { 103enum bpf_map_type {
@@ -115,6 +118,8 @@ enum bpf_map_type {
115 BPF_MAP_TYPE_DEVMAP, 118 BPF_MAP_TYPE_DEVMAP,
116 BPF_MAP_TYPE_SOCKMAP, 119 BPF_MAP_TYPE_SOCKMAP,
117 BPF_MAP_TYPE_CPUMAP, 120 BPF_MAP_TYPE_CPUMAP,
121 BPF_MAP_TYPE_XSKMAP,
122 BPF_MAP_TYPE_SOCKHASH,
118}; 123};
119 124
120enum bpf_prog_type { 125enum bpf_prog_type {
@@ -137,6 +142,8 @@ enum bpf_prog_type {
137 BPF_PROG_TYPE_SK_MSG, 142 BPF_PROG_TYPE_SK_MSG,
138 BPF_PROG_TYPE_RAW_TRACEPOINT, 143 BPF_PROG_TYPE_RAW_TRACEPOINT,
139 BPF_PROG_TYPE_CGROUP_SOCK_ADDR, 144 BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
145 BPF_PROG_TYPE_LWT_SEG6LOCAL,
146 BPF_PROG_TYPE_LIRC_MODE2,
140}; 147};
141 148
142enum bpf_attach_type { 149enum bpf_attach_type {
@@ -154,6 +161,9 @@ enum bpf_attach_type {
154 BPF_CGROUP_INET6_CONNECT, 161 BPF_CGROUP_INET6_CONNECT,
155 BPF_CGROUP_INET4_POST_BIND, 162 BPF_CGROUP_INET4_POST_BIND,
156 BPF_CGROUP_INET6_POST_BIND, 163 BPF_CGROUP_INET6_POST_BIND,
164 BPF_CGROUP_UDP4_SENDMSG,
165 BPF_CGROUP_UDP6_SENDMSG,
166 BPF_LIRC_MODE2,
157 __MAX_BPF_ATTACH_TYPE 167 __MAX_BPF_ATTACH_TYPE
158}; 168};
159 169
@@ -279,6 +289,9 @@ union bpf_attr {
279 */ 289 */
280 char map_name[BPF_OBJ_NAME_LEN]; 290 char map_name[BPF_OBJ_NAME_LEN];
281 __u32 map_ifindex; /* ifindex of netdev to create on */ 291 __u32 map_ifindex; /* ifindex of netdev to create on */
292 __u32 btf_fd; /* fd pointing to a BTF type data */
293 __u32 btf_key_type_id; /* BTF type_id of the key */
294 __u32 btf_value_type_id; /* BTF type_id of the value */
282 }; 295 };
283 296
284 struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ 297 struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
@@ -339,6 +352,7 @@ union bpf_attr {
339 __u32 start_id; 352 __u32 start_id;
340 __u32 prog_id; 353 __u32 prog_id;
341 __u32 map_id; 354 __u32 map_id;
355 __u32 btf_id;
342 }; 356 };
343 __u32 next_id; 357 __u32 next_id;
344 __u32 open_flags; 358 __u32 open_flags;
@@ -363,398 +377,1704 @@ union bpf_attr {
363 __u64 name; 377 __u64 name;
364 __u32 prog_fd; 378 __u32 prog_fd;
365 } raw_tracepoint; 379 } raw_tracepoint;
380
381 struct { /* anonymous struct for BPF_BTF_LOAD */
382 __aligned_u64 btf;
383 __aligned_u64 btf_log_buf;
384 __u32 btf_size;
385 __u32 btf_log_size;
386 __u32 btf_log_level;
387 };
388
389 struct {
390 __u32 pid; /* input: pid */
391 __u32 fd; /* input: fd */
392 __u32 flags; /* input: flags */
393 __u32 buf_len; /* input/output: buf len */
394 __aligned_u64 buf; /* input/output:
395 * tp_name for tracepoint
396 * symbol for kprobe
397 * filename for uprobe
398 */
399 __u32 prog_id; /* output: prod_id */
400 __u32 fd_type; /* output: BPF_FD_TYPE_* */
401 __u64 probe_offset; /* output: probe_offset */
402 __u64 probe_addr; /* output: probe_addr */
403 } task_fd_query;
366} __attribute__((aligned(8))); 404} __attribute__((aligned(8)));
367 405
368/* BPF helper function descriptions: 406/* The description below is an attempt at providing documentation to eBPF
369 * 407 * developers about the multiple available eBPF helper functions. It can be
370 * void *bpf_map_lookup_elem(&map, &key) 408 * parsed and used to produce a manual page. The workflow is the following,
371 * Return: Map value or NULL 409 * and requires the rst2man utility:
372 * 410 *
373 * int bpf_map_update_elem(&map, &key, &value, flags) 411 * $ ./scripts/bpf_helpers_doc.py \
374 * Return: 0 on success or negative error 412 * --filename include/uapi/linux/bpf.h > /tmp/bpf-helpers.rst
375 * 413 * $ rst2man /tmp/bpf-helpers.rst > /tmp/bpf-helpers.7
376 * int bpf_map_delete_elem(&map, &key) 414 * $ man /tmp/bpf-helpers.7
377 * Return: 0 on success or negative error 415 *
378 * 416 * Note that in order to produce this external documentation, some RST
379 * int bpf_probe_read(void *dst, int size, void *src) 417 * formatting is used in the descriptions to get "bold" and "italics" in
380 * Return: 0 on success or negative error 418 * manual pages. Also note that the few trailing white spaces are
419 * intentional, removing them would break paragraphs for rst2man.
420 *
421 * Start of BPF helper function descriptions:
422 *
423 * void *bpf_map_lookup_elem(struct bpf_map *map, const void *key)
424 * Description
425 * Perform a lookup in *map* for an entry associated to *key*.
426 * Return
427 * Map value associated to *key*, or **NULL** if no entry was
428 * found.
429 *
430 * int bpf_map_update_elem(struct bpf_map *map, const void *key, const void *value, u64 flags)
431 * Description
432 * Add or update the value of the entry associated to *key* in
433 * *map* with *value*. *flags* is one of:
434 *
435 * **BPF_NOEXIST**
436 * The entry for *key* must not exist in the map.
437 * **BPF_EXIST**
438 * The entry for *key* must already exist in the map.
439 * **BPF_ANY**
440 * No condition on the existence of the entry for *key*.
441 *
442 * Flag value **BPF_NOEXIST** cannot be used for maps of types
443 * **BPF_MAP_TYPE_ARRAY** or **BPF_MAP_TYPE_PERCPU_ARRAY** (all
444 * elements always exist), the helper would return an error.
445 * Return
446 * 0 on success, or a negative error in case of failure.
447 *
448 * int bpf_map_delete_elem(struct bpf_map *map, const void *key)
449 * Description
450 * Delete entry with *key* from *map*.
451 * Return
452 * 0 on success, or a negative error in case of failure.
453 *
454 * int bpf_probe_read(void *dst, u32 size, const void *src)
455 * Description
456 * For tracing programs, safely attempt to read *size* bytes from
457 * address *src* and store the data in *dst*.
458 * Return
459 * 0 on success, or a negative error in case of failure.
381 * 460 *
382 * u64 bpf_ktime_get_ns(void) 461 * u64 bpf_ktime_get_ns(void)
383 * Return: current ktime 462 * Description
384 * 463 * Return the time elapsed since system boot, in nanoseconds.
385 * int bpf_trace_printk(const char *fmt, int fmt_size, ...) 464 * Return
386 * Return: length of buffer written or negative error 465 * Current *ktime*.
387 * 466 *
388 * u32 bpf_prandom_u32(void) 467 * int bpf_trace_printk(const char *fmt, u32 fmt_size, ...)
389 * Return: random value 468 * Description
390 * 469 * This helper is a "printk()-like" facility for debugging. It
391 * u32 bpf_raw_smp_processor_id(void) 470 * prints a message defined by format *fmt* (of size *fmt_size*)
392 * Return: SMP processor ID 471 * to file *\/sys/kernel/debug/tracing/trace* from DebugFS, if
393 * 472 * available. It can take up to three additional **u64**
394 * int bpf_skb_store_bytes(skb, offset, from, len, flags) 473 * arguments (as an eBPF helpers, the total number of arguments is
395 * store bytes into packet 474 * limited to five).
396 * @skb: pointer to skb 475 *
397 * @offset: offset within packet from skb->mac_header 476 * Each time the helper is called, it appends a line to the trace.
398 * @from: pointer where to copy bytes from 477 * The format of the trace is customizable, and the exact output
399 * @len: number of bytes to store into packet 478 * one will get depends on the options set in
400 * @flags: bit 0 - if true, recompute skb->csum 479 * *\/sys/kernel/debug/tracing/trace_options* (see also the
401 * other bits - reserved 480 * *README* file under the same directory). However, it usually
402 * Return: 0 on success or negative error 481 * defaults to something like:
403 * 482 *
404 * int bpf_l3_csum_replace(skb, offset, from, to, flags) 483 * ::
405 * recompute IP checksum 484 *
406 * @skb: pointer to skb 485 * telnet-470 [001] .N.. 419421.045894: 0x00000001: <formatted msg>
407 * @offset: offset within packet where IP checksum is located 486 *
408 * @from: old value of header field 487 * In the above:
409 * @to: new value of header field 488 *
410 * @flags: bits 0-3 - size of header field 489 * * ``telnet`` is the name of the current task.
411 * other bits - reserved 490 * * ``470`` is the PID of the current task.
412 * Return: 0 on success or negative error 491 * * ``001`` is the CPU number on which the task is
413 * 492 * running.
414 * int bpf_l4_csum_replace(skb, offset, from, to, flags) 493 * * In ``.N..``, each character refers to a set of
415 * recompute TCP/UDP checksum 494 * options (whether irqs are enabled, scheduling
416 * @skb: pointer to skb 495 * options, whether hard/softirqs are running, level of
417 * @offset: offset within packet where TCP/UDP checksum is located 496 * preempt_disabled respectively). **N** means that
418 * @from: old value of header field 497 * **TIF_NEED_RESCHED** and **PREEMPT_NEED_RESCHED**
419 * @to: new value of header field 498 * are set.
420 * @flags: bits 0-3 - size of header field 499 * * ``419421.045894`` is a timestamp.
421 * bit 4 - is pseudo header 500 * * ``0x00000001`` is a fake value used by BPF for the
422 * other bits - reserved 501 * instruction pointer register.
423 * Return: 0 on success or negative error 502 * * ``<formatted msg>`` is the message formatted with
424 * 503 * *fmt*.
425 * int bpf_tail_call(ctx, prog_array_map, index) 504 *
426 * jump into another BPF program 505 * The conversion specifiers supported by *fmt* are similar, but
427 * @ctx: context pointer passed to next program 506 * more limited than for printk(). They are **%d**, **%i**,
428 * @prog_array_map: pointer to map which type is BPF_MAP_TYPE_PROG_ARRAY 507 * **%u**, **%x**, **%ld**, **%li**, **%lu**, **%lx**, **%lld**,
429 * @index: 32-bit index inside array that selects specific program to run 508 * **%lli**, **%llu**, **%llx**, **%p**, **%s**. No modifier (size
430 * Return: 0 on success or negative error 509 * of field, padding with zeroes, etc.) is available, and the
431 * 510 * helper will return **-EINVAL** (but print nothing) if it
432 * int bpf_clone_redirect(skb, ifindex, flags) 511 * encounters an unknown specifier.
433 * redirect to another netdev 512 *
434 * @skb: pointer to skb 513 * Also, note that **bpf_trace_printk**\ () is slow, and should
435 * @ifindex: ifindex of the net device 514 * only be used for debugging purposes. For this reason, a notice
436 * @flags: bit 0 - if set, redirect to ingress instead of egress 515 * bloc (spanning several lines) is printed to kernel logs and
437 * other bits - reserved 516 * states that the helper should not be used "for production use"
438 * Return: 0 on success or negative error 517 * the first time this helper is used (or more precisely, when
518 * **trace_printk**\ () buffers are allocated). For passing values
519 * to user space, perf events should be preferred.
520 * Return
521 * The number of bytes written to the buffer, or a negative error
522 * in case of failure.
523 *
524 * u32 bpf_get_prandom_u32(void)
525 * Description
526 * Get a pseudo-random number.
527 *
528 * From a security point of view, this helper uses its own
529 * pseudo-random internal state, and cannot be used to infer the
530 * seed of other random functions in the kernel. However, it is
531 * essential to note that the generator used by the helper is not
532 * cryptographically secure.
533 * Return
534 * A random 32-bit unsigned value.
535 *
536 * u32 bpf_get_smp_processor_id(void)
537 * Description
538 * Get the SMP (symmetric multiprocessing) processor id. Note that
539 * all programs run with preemption disabled, which means that the
540 * SMP processor id is stable during all the execution of the
541 * program.
542 * Return
543 * The SMP id of the processor running the program.
544 *
545 * int bpf_skb_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len, u64 flags)
546 * Description
547 * Store *len* bytes from address *from* into the packet
548 * associated to *skb*, at *offset*. *flags* are a combination of
549 * **BPF_F_RECOMPUTE_CSUM** (automatically recompute the
550 * checksum for the packet after storing the bytes) and
551 * **BPF_F_INVALIDATE_HASH** (set *skb*\ **->hash**, *skb*\
552 * **->swhash** and *skb*\ **->l4hash** to 0).
553 *
554 * A call to this helper is susceptible to change the underlaying
555 * packet buffer. Therefore, at load time, all checks on pointers
556 * previously done by the verifier are invalidated and must be
557 * performed again, if the helper is used in combination with
558 * direct packet access.
559 * Return
560 * 0 on success, or a negative error in case of failure.
561 *
562 * int bpf_l3_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 size)
563 * Description
564 * Recompute the layer 3 (e.g. IP) checksum for the packet
565 * associated to *skb*. Computation is incremental, so the helper
566 * must know the former value of the header field that was
567 * modified (*from*), the new value of this field (*to*), and the
568 * number of bytes (2 or 4) for this field, stored in *size*.
569 * Alternatively, it is possible to store the difference between
570 * the previous and the new values of the header field in *to*, by
571 * setting *from* and *size* to 0. For both methods, *offset*
572 * indicates the location of the IP checksum within the packet.
573 *
574 * This helper works in combination with **bpf_csum_diff**\ (),
575 * which does not update the checksum in-place, but offers more
576 * flexibility and can handle sizes larger than 2 or 4 for the
577 * checksum to update.
578 *
579 * A call to this helper is susceptible to change the underlaying
580 * packet buffer. Therefore, at load time, all checks on pointers
581 * previously done by the verifier are invalidated and must be
582 * performed again, if the helper is used in combination with
583 * direct packet access.
584 * Return
585 * 0 on success, or a negative error in case of failure.
586 *
587 * int bpf_l4_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 flags)
588 * Description
589 * Recompute the layer 4 (e.g. TCP, UDP or ICMP) checksum for the
590 * packet associated to *skb*. Computation is incremental, so the
591 * helper must know the former value of the header field that was
592 * modified (*from*), the new value of this field (*to*), and the
593 * number of bytes (2 or 4) for this field, stored on the lowest
594 * four bits of *flags*. Alternatively, it is possible to store
595 * the difference between the previous and the new values of the
596 * header field in *to*, by setting *from* and the four lowest
597 * bits of *flags* to 0. For both methods, *offset* indicates the
598 * location of the IP checksum within the packet. In addition to
599 * the size of the field, *flags* can be added (bitwise OR) actual
600 * flags. With **BPF_F_MARK_MANGLED_0**, a null checksum is left
601 * untouched (unless **BPF_F_MARK_ENFORCE** is added as well), and
602 * for updates resulting in a null checksum the value is set to
603 * **CSUM_MANGLED_0** instead. Flag **BPF_F_PSEUDO_HDR** indicates
604 * the checksum is to be computed against a pseudo-header.
605 *
606 * This helper works in combination with **bpf_csum_diff**\ (),
607 * which does not update the checksum in-place, but offers more
608 * flexibility and can handle sizes larger than 2 or 4 for the
609 * checksum to update.
610 *
611 * A call to this helper is susceptible to change the underlaying
612 * packet buffer. Therefore, at load time, all checks on pointers
613 * previously done by the verifier are invalidated and must be
614 * performed again, if the helper is used in combination with
615 * direct packet access.
616 * Return
617 * 0 on success, or a negative error in case of failure.
618 *
619 * int bpf_tail_call(void *ctx, struct bpf_map *prog_array_map, u32 index)
620 * Description
621 * This special helper is used to trigger a "tail call", or in
622 * other words, to jump into another eBPF program. The same stack
623 * frame is used (but values on stack and in registers for the
624 * caller are not accessible to the callee). This mechanism allows
625 * for program chaining, either for raising the maximum number of
626 * available eBPF instructions, or to execute given programs in
627 * conditional blocks. For security reasons, there is an upper
628 * limit to the number of successive tail calls that can be
629 * performed.
630 *
631 * Upon call of this helper, the program attempts to jump into a
632 * program referenced at index *index* in *prog_array_map*, a
633 * special map of type **BPF_MAP_TYPE_PROG_ARRAY**, and passes
634 * *ctx*, a pointer to the context.
635 *
636 * If the call succeeds, the kernel immediately runs the first
637 * instruction of the new program. This is not a function call,
638 * and it never returns to the previous program. If the call
639 * fails, then the helper has no effect, and the caller continues
640 * to run its subsequent instructions. A call can fail if the
641 * destination program for the jump does not exist (i.e. *index*
642 * is superior to the number of entries in *prog_array_map*), or
643 * if the maximum number of tail calls has been reached for this
644 * chain of programs. This limit is defined in the kernel by the
645 * macro **MAX_TAIL_CALL_CNT** (not accessible to user space),
646 * which is currently set to 32.
647 * Return
648 * 0 on success, or a negative error in case of failure.
649 *
650 * int bpf_clone_redirect(struct sk_buff *skb, u32 ifindex, u64 flags)
651 * Description
652 * Clone and redirect the packet associated to *skb* to another
653 * net device of index *ifindex*. Both ingress and egress
654 * interfaces can be used for redirection. The **BPF_F_INGRESS**
655 * value in *flags* is used to make the distinction (ingress path
656 * is selected if the flag is present, egress path otherwise).
657 * This is the only flag supported for now.
658 *
659 * In comparison with **bpf_redirect**\ () helper,
660 * **bpf_clone_redirect**\ () has the associated cost of
661 * duplicating the packet buffer, but this can be executed out of
662 * the eBPF program. Conversely, **bpf_redirect**\ () is more
663 * efficient, but it is handled through an action code where the
664 * redirection happens only after the eBPF program has returned.
665 *
666 * A call to this helper is susceptible to change the underlaying
667 * packet buffer. Therefore, at load time, all checks on pointers
668 * previously done by the verifier are invalidated and must be
669 * performed again, if the helper is used in combination with
670 * direct packet access.
671 * Return
672 * 0 on success, or a negative error in case of failure.
439 * 673 *
440 * u64 bpf_get_current_pid_tgid(void) 674 * u64 bpf_get_current_pid_tgid(void)
441 * Return: current->tgid << 32 | current->pid 675 * Return
676 * A 64-bit integer containing the current tgid and pid, and
677 * created as such:
678 * *current_task*\ **->tgid << 32 \|**
679 * *current_task*\ **->pid**.
442 * 680 *
443 * u64 bpf_get_current_uid_gid(void) 681 * u64 bpf_get_current_uid_gid(void)
444 * Return: current_gid << 32 | current_uid 682 * Return
445 * 683 * A 64-bit integer containing the current GID and UID, and
446 * int bpf_get_current_comm(char *buf, int size_of_buf) 684 * created as such: *current_gid* **<< 32 \|** *current_uid*.
447 * stores current->comm into buf 685 *
448 * Return: 0 on success or negative error 686 * int bpf_get_current_comm(char *buf, u32 size_of_buf)
449 * 687 * Description
450 * u32 bpf_get_cgroup_classid(skb) 688 * Copy the **comm** attribute of the current task into *buf* of
451 * retrieve a proc's classid 689 * *size_of_buf*. The **comm** attribute contains the name of
452 * @skb: pointer to skb 690 * the executable (excluding the path) for the current task. The
453 * Return: classid if != 0 691 * *size_of_buf* must be strictly positive. On success, the
454 * 692 * helper makes sure that the *buf* is NUL-terminated. On failure,
455 * int bpf_skb_vlan_push(skb, vlan_proto, vlan_tci) 693 * it is filled with zeroes.
456 * Return: 0 on success or negative error 694 * Return
457 * 695 * 0 on success, or a negative error in case of failure.
458 * int bpf_skb_vlan_pop(skb) 696 *
459 * Return: 0 on success or negative error 697 * u32 bpf_get_cgroup_classid(struct sk_buff *skb)
460 * 698 * Description
461 * int bpf_skb_get_tunnel_key(skb, key, size, flags) 699 * Retrieve the classid for the current task, i.e. for the net_cls
462 * int bpf_skb_set_tunnel_key(skb, key, size, flags) 700 * cgroup to which *skb* belongs.
463 * retrieve or populate tunnel metadata 701 *
464 * @skb: pointer to skb 702 * This helper can be used on TC egress path, but not on ingress.
465 * @key: pointer to 'struct bpf_tunnel_key' 703 *
466 * @size: size of 'struct bpf_tunnel_key' 704 * The net_cls cgroup provides an interface to tag network packets
467 * @flags: room for future extensions 705 * based on a user-provided identifier for all traffic coming from
468 * Return: 0 on success or negative error 706 * the tasks belonging to the related cgroup. See also the related
469 * 707 * kernel documentation, available from the Linux sources in file
470 * u64 bpf_perf_event_read(map, flags) 708 * *Documentation/cgroup-v1/net_cls.txt*.
471 * read perf event counter value 709 *
472 * @map: pointer to perf_event_array map 710 * The Linux kernel has two versions for cgroups: there are
473 * @flags: index of event in the map or bitmask flags 711 * cgroups v1 and cgroups v2. Both are available to users, who can
474 * Return: value of perf event counter read or error code 712 * use a mixture of them, but note that the net_cls cgroup is for
475 * 713 * cgroup v1 only. This makes it incompatible with BPF programs
476 * int bpf_redirect(ifindex, flags) 714 * run on cgroups, which is a cgroup-v2-only feature (a socket can
477 * redirect to another netdev 715 * only hold data for one version of cgroups at a time).
478 * @ifindex: ifindex of the net device 716 *
479 * @flags: 717 * This helper is only available is the kernel was compiled with
480 * cls_bpf: 718 * the **CONFIG_CGROUP_NET_CLASSID** configuration option set to
481 * bit 0 - if set, redirect to ingress instead of egress 719 * "**y**" or to "**m**".
482 * other bits - reserved 720 * Return
483 * xdp_bpf: 721 * The classid, or 0 for the default unconfigured classid.
484 * all bits - reserved 722 *
485 * Return: cls_bpf: TC_ACT_REDIRECT on success or TC_ACT_SHOT on error 723 * int bpf_skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci)
486 * xdp_bfp: XDP_REDIRECT on success or XDP_ABORT on error 724 * Description
487 * int bpf_redirect_map(map, key, flags) 725 * Push a *vlan_tci* (VLAN tag control information) of protocol
488 * redirect to endpoint in map 726 * *vlan_proto* to the packet associated to *skb*, then update
489 * @map: pointer to dev map 727 * the checksum. Note that if *vlan_proto* is different from
490 * @key: index in map to lookup 728 * **ETH_P_8021Q** and **ETH_P_8021AD**, it is considered to
491 * @flags: -- 729 * be **ETH_P_8021Q**.
492 * Return: XDP_REDIRECT on success or XDP_ABORT on error 730 *
493 * 731 * A call to this helper is susceptible to change the underlaying
494 * u32 bpf_get_route_realm(skb) 732 * packet buffer. Therefore, at load time, all checks on pointers
495 * retrieve a dst's tclassid 733 * previously done by the verifier are invalidated and must be
496 * @skb: pointer to skb 734 * performed again, if the helper is used in combination with
497 * Return: realm if != 0 735 * direct packet access.
498 * 736 * Return
499 * int bpf_perf_event_output(ctx, map, flags, data, size) 737 * 0 on success, or a negative error in case of failure.
500 * output perf raw sample 738 *
501 * @ctx: struct pt_regs* 739 * int bpf_skb_vlan_pop(struct sk_buff *skb)
502 * @map: pointer to perf_event_array map 740 * Description
503 * @flags: index of event in the map or bitmask flags 741 * Pop a VLAN header from the packet associated to *skb*.
504 * @data: data on stack to be output as raw data 742 *
505 * @size: size of data 743 * A call to this helper is susceptible to change the underlaying
506 * Return: 0 on success or negative error 744 * packet buffer. Therefore, at load time, all checks on pointers
507 * 745 * previously done by the verifier are invalidated and must be
508 * int bpf_get_stackid(ctx, map, flags) 746 * performed again, if the helper is used in combination with
509 * walk user or kernel stack and return id 747 * direct packet access.
510 * @ctx: struct pt_regs* 748 * Return
511 * @map: pointer to stack_trace map 749 * 0 on success, or a negative error in case of failure.
512 * @flags: bits 0-7 - numer of stack frames to skip 750 *
513 * bit 8 - collect user stack instead of kernel 751 * int bpf_skb_get_tunnel_key(struct sk_buff *skb, struct bpf_tunnel_key *key, u32 size, u64 flags)
514 * bit 9 - compare stacks by hash only 752 * Description
515 * bit 10 - if two different stacks hash into the same stackid 753 * Get tunnel metadata. This helper takes a pointer *key* to an
516 * discard old 754 * empty **struct bpf_tunnel_key** of **size**, that will be
517 * other bits - reserved 755 * filled with tunnel metadata for the packet associated to *skb*.
518 * Return: >= 0 stackid on success or negative error 756 * The *flags* can be set to **BPF_F_TUNINFO_IPV6**, which
519 * 757 * indicates that the tunnel is based on IPv6 protocol instead of
520 * s64 bpf_csum_diff(from, from_size, to, to_size, seed) 758 * IPv4.
521 * calculate csum diff 759 *
522 * @from: raw from buffer 760 * The **struct bpf_tunnel_key** is an object that generalizes the
523 * @from_size: length of from buffer 761 * principal parameters used by various tunneling protocols into a
524 * @to: raw to buffer 762 * single struct. This way, it can be used to easily make a
525 * @to_size: length of to buffer 763 * decision based on the contents of the encapsulation header,
526 * @seed: optional seed 764 * "summarized" in this struct. In particular, it holds the IP
527 * Return: csum result or negative error code 765 * address of the remote end (IPv4 or IPv6, depending on the case)
528 * 766 * in *key*\ **->remote_ipv4** or *key*\ **->remote_ipv6**. Also,
529 * int bpf_skb_get_tunnel_opt(skb, opt, size) 767 * this struct exposes the *key*\ **->tunnel_id**, which is
530 * retrieve tunnel options metadata 768 * generally mapped to a VNI (Virtual Network Identifier), making
531 * @skb: pointer to skb 769 * it programmable together with the **bpf_skb_set_tunnel_key**\
532 * @opt: pointer to raw tunnel option data 770 * () helper.
533 * @size: size of @opt 771 *
534 * Return: option size 772 * Let's imagine that the following code is part of a program
535 * 773 * attached to the TC ingress interface, on one end of a GRE
536 * int bpf_skb_set_tunnel_opt(skb, opt, size) 774 * tunnel, and is supposed to filter out all messages coming from
537 * populate tunnel options metadata 775 * remote ends with IPv4 address other than 10.0.0.1:
538 * @skb: pointer to skb 776 *
539 * @opt: pointer to raw tunnel option data 777 * ::
540 * @size: size of @opt 778 *
541 * Return: 0 on success or negative error 779 * int ret;
542 * 780 * struct bpf_tunnel_key key = {};
543 * int bpf_skb_change_proto(skb, proto, flags) 781 *
544 * Change protocol of the skb. Currently supported is v4 -> v6, 782 * ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0);
545 * v6 -> v4 transitions. The helper will also resize the skb. eBPF 783 * if (ret < 0)
546 * program is expected to fill the new headers via skb_store_bytes 784 * return TC_ACT_SHOT; // drop packet
547 * and lX_csum_replace. 785 *
548 * @skb: pointer to skb 786 * if (key.remote_ipv4 != 0x0a000001)
549 * @proto: new skb->protocol type 787 * return TC_ACT_SHOT; // drop packet
550 * @flags: reserved 788 *
551 * Return: 0 on success or negative error 789 * return TC_ACT_OK; // accept packet
552 * 790 *
553 * int bpf_skb_change_type(skb, type) 791 * This interface can also be used with all encapsulation devices
554 * Change packet type of skb. 792 * that can operate in "collect metadata" mode: instead of having
555 * @skb: pointer to skb 793 * one network device per specific configuration, the "collect
556 * @type: new skb->pkt_type type 794 * metadata" mode only requires a single device where the
557 * Return: 0 on success or negative error 795 * configuration can be extracted from this helper.
558 * 796 *
559 * int bpf_skb_under_cgroup(skb, map, index) 797 * This can be used together with various tunnels such as VXLan,
560 * Check cgroup2 membership of skb 798 * Geneve, GRE or IP in IP (IPIP).
561 * @skb: pointer to skb 799 * Return
562 * @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type 800 * 0 on success, or a negative error in case of failure.
563 * @index: index of the cgroup in the bpf_map 801 *
564 * Return: 802 * int bpf_skb_set_tunnel_key(struct sk_buff *skb, struct bpf_tunnel_key *key, u32 size, u64 flags)
565 * == 0 skb failed the cgroup2 descendant test 803 * Description
566 * == 1 skb succeeded the cgroup2 descendant test 804 * Populate tunnel metadata for packet associated to *skb.* The
567 * < 0 error 805 * tunnel metadata is set to the contents of *key*, of *size*. The
568 * 806 * *flags* can be set to a combination of the following values:
569 * u32 bpf_get_hash_recalc(skb) 807 *
570 * Retrieve and possibly recalculate skb->hash. 808 * **BPF_F_TUNINFO_IPV6**
571 * @skb: pointer to skb 809 * Indicate that the tunnel is based on IPv6 protocol
572 * Return: hash 810 * instead of IPv4.
811 * **BPF_F_ZERO_CSUM_TX**
812 * For IPv4 packets, add a flag to tunnel metadata
813 * indicating that checksum computation should be skipped
814 * and checksum set to zeroes.
815 * **BPF_F_DONT_FRAGMENT**
816 * Add a flag to tunnel metadata indicating that the
817 * packet should not be fragmented.
818 * **BPF_F_SEQ_NUMBER**
819 * Add a flag to tunnel metadata indicating that a
820 * sequence number should be added to tunnel header before
821 * sending the packet. This flag was added for GRE
822 * encapsulation, but might be used with other protocols
823 * as well in the future.
824 *
825 * Here is a typical usage on the transmit path:
826 *
827 * ::
828 *
829 * struct bpf_tunnel_key key;
830 * populate key ...
831 * bpf_skb_set_tunnel_key(skb, &key, sizeof(key), 0);
832 * bpf_clone_redirect(skb, vxlan_dev_ifindex, 0);
833 *
834 * See also the description of the **bpf_skb_get_tunnel_key**\ ()
835 * helper for additional information.
836 * Return
837 * 0 on success, or a negative error in case of failure.
838 *
839 * u64 bpf_perf_event_read(struct bpf_map *map, u64 flags)
840 * Description
841 * Read the value of a perf event counter. This helper relies on a
842 * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. The nature of
843 * the perf event counter is selected when *map* is updated with
844 * perf event file descriptors. The *map* is an array whose size
845 * is the number of available CPUs, and each cell contains a value
846 * relative to one CPU. The value to retrieve is indicated by
847 * *flags*, that contains the index of the CPU to look up, masked
848 * with **BPF_F_INDEX_MASK**. Alternatively, *flags* can be set to
849 * **BPF_F_CURRENT_CPU** to indicate that the value for the
850 * current CPU should be retrieved.
851 *
852 * Note that before Linux 4.13, only hardware perf event can be
853 * retrieved.
854 *
855 * Also, be aware that the newer helper
856 * **bpf_perf_event_read_value**\ () is recommended over
857 * **bpf_perf_event_read**\ () in general. The latter has some ABI
858 * quirks where error and counter value are used as a return code
859 * (which is wrong to do since ranges may overlap). This issue is
860 * fixed with **bpf_perf_event_read_value**\ (), which at the same
861 * time provides more features over the **bpf_perf_event_read**\
862 * () interface. Please refer to the description of
863 * **bpf_perf_event_read_value**\ () for details.
864 * Return
865 * The value of the perf event counter read from the map, or a
866 * negative error code in case of failure.
867 *
868 * int bpf_redirect(u32 ifindex, u64 flags)
869 * Description
870 * Redirect the packet to another net device of index *ifindex*.
871 * This helper is somewhat similar to **bpf_clone_redirect**\
872 * (), except that the packet is not cloned, which provides
873 * increased performance.
874 *
875 * Except for XDP, both ingress and egress interfaces can be used
876 * for redirection. The **BPF_F_INGRESS** value in *flags* is used
877 * to make the distinction (ingress path is selected if the flag
878 * is present, egress path otherwise). Currently, XDP only
879 * supports redirection to the egress interface, and accepts no
880 * flag at all.
881 *
882 * The same effect can be attained with the more generic
883 * **bpf_redirect_map**\ (), which requires specific maps to be
884 * used but offers better performance.
885 * Return
886 * For XDP, the helper returns **XDP_REDIRECT** on success or
887 * **XDP_ABORTED** on error. For other program types, the values
888 * are **TC_ACT_REDIRECT** on success or **TC_ACT_SHOT** on
889 * error.
890 *
891 * u32 bpf_get_route_realm(struct sk_buff *skb)
892 * Description
893 * Retrieve the realm or the route, that is to say the
894 * **tclassid** field of the destination for the *skb*. The
895 * indentifier retrieved is a user-provided tag, similar to the
896 * one used with the net_cls cgroup (see description for
897 * **bpf_get_cgroup_classid**\ () helper), but here this tag is
898 * held by a route (a destination entry), not by a task.
899 *
900 * Retrieving this identifier works with the clsact TC egress hook
901 * (see also **tc-bpf(8)**), or alternatively on conventional
902 * classful egress qdiscs, but not on TC ingress path. In case of
903 * clsact TC egress hook, this has the advantage that, internally,
904 * the destination entry has not been dropped yet in the transmit
905 * path. Therefore, the destination entry does not need to be
906 * artificially held via **netif_keep_dst**\ () for a classful
907 * qdisc until the *skb* is freed.
908 *
909 * This helper is available only if the kernel was compiled with
910 * **CONFIG_IP_ROUTE_CLASSID** configuration option.
911 * Return
912 * The realm of the route for the packet associated to *skb*, or 0
913 * if none was found.
914 *
915 * int bpf_perf_event_output(struct pt_reg *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
916 * Description
917 * Write raw *data* blob into a special BPF perf event held by
918 * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf
919 * event must have the following attributes: **PERF_SAMPLE_RAW**
920 * as **sample_type**, **PERF_TYPE_SOFTWARE** as **type**, and
921 * **PERF_COUNT_SW_BPF_OUTPUT** as **config**.
922 *
923 * The *flags* are used to indicate the index in *map* for which
924 * the value must be put, masked with **BPF_F_INDEX_MASK**.
925 * Alternatively, *flags* can be set to **BPF_F_CURRENT_CPU**
926 * to indicate that the index of the current CPU core should be
927 * used.
928 *
929 * The value to write, of *size*, is passed through eBPF stack and
930 * pointed by *data*.
931 *
932 * The context of the program *ctx* needs also be passed to the
933 * helper.
934 *
935 * On user space, a program willing to read the values needs to
936 * call **perf_event_open**\ () on the perf event (either for
937 * one or for all CPUs) and to store the file descriptor into the
938 * *map*. This must be done before the eBPF program can send data
939 * into it. An example is available in file
940 * *samples/bpf/trace_output_user.c* in the Linux kernel source
941 * tree (the eBPF program counterpart is in
942 * *samples/bpf/trace_output_kern.c*).
943 *
944 * **bpf_perf_event_output**\ () achieves better performance
945 * than **bpf_trace_printk**\ () for sharing data with user
946 * space, and is much better suitable for streaming data from eBPF
947 * programs.
948 *
949 * Note that this helper is not restricted to tracing use cases
950 * and can be used with programs attached to TC or XDP as well,
951 * where it allows for passing data to user space listeners. Data
952 * can be:
953 *
954 * * Only custom structs,
955 * * Only the packet payload, or
956 * * A combination of both.
957 * Return
958 * 0 on success, or a negative error in case of failure.
959 *
960 * int bpf_skb_load_bytes(const struct sk_buff *skb, u32 offset, void *to, u32 len)
961 * Description
962 * This helper was provided as an easy way to load data from a
963 * packet. It can be used to load *len* bytes from *offset* from
964 * the packet associated to *skb*, into the buffer pointed by
965 * *to*.
966 *
967 * Since Linux 4.7, usage of this helper has mostly been replaced
968 * by "direct packet access", enabling packet data to be
969 * manipulated with *skb*\ **->data** and *skb*\ **->data_end**
970 * pointing respectively to the first byte of packet data and to
971 * the byte after the last byte of packet data. However, it
972 * remains useful if one wishes to read large quantities of data
973 * at once from a packet into the eBPF stack.
974 * Return
975 * 0 on success, or a negative error in case of failure.
976 *
977 * int bpf_get_stackid(struct pt_reg *ctx, struct bpf_map *map, u64 flags)
978 * Description
979 * Walk a user or a kernel stack and return its id. To achieve
980 * this, the helper needs *ctx*, which is a pointer to the context
981 * on which the tracing program is executed, and a pointer to a
982 * *map* of type **BPF_MAP_TYPE_STACK_TRACE**.
983 *
984 * The last argument, *flags*, holds the number of stack frames to
985 * skip (from 0 to 255), masked with
986 * **BPF_F_SKIP_FIELD_MASK**. The next bits can be used to set
987 * a combination of the following flags:
988 *
989 * **BPF_F_USER_STACK**
990 * Collect a user space stack instead of a kernel stack.
991 * **BPF_F_FAST_STACK_CMP**
992 * Compare stacks by hash only.
993 * **BPF_F_REUSE_STACKID**
994 * If two different stacks hash into the same *stackid*,
995 * discard the old one.
996 *
997 * The stack id retrieved is a 32 bit long integer handle which
998 * can be further combined with other data (including other stack
999 * ids) and used as a key into maps. This can be useful for
1000 * generating a variety of graphs (such as flame graphs or off-cpu
1001 * graphs).
1002 *
1003 * For walking a stack, this helper is an improvement over
1004 * **bpf_probe_read**\ (), which can be used with unrolled loops
1005 * but is not efficient and consumes a lot of eBPF instructions.
1006 * Instead, **bpf_get_stackid**\ () can collect up to
1007 * **PERF_MAX_STACK_DEPTH** both kernel and user frames. Note that
1008 * this limit can be controlled with the **sysctl** program, and
1009 * that it should be manually increased in order to profile long
1010 * user stacks (such as stacks for Java programs). To do so, use:
1011 *
1012 * ::
1013 *
1014 * # sysctl kernel.perf_event_max_stack=<new value>
1015 * Return
1016 * The positive or null stack id on success, or a negative error
1017 * in case of failure.
1018 *
1019 * s64 bpf_csum_diff(__be32 *from, u32 from_size, __be32 *to, u32 to_size, __wsum seed)
1020 * Description
1021 * Compute a checksum difference, from the raw buffer pointed by
1022 * *from*, of length *from_size* (that must be a multiple of 4),
1023 * towards the raw buffer pointed by *to*, of size *to_size*
1024 * (same remark). An optional *seed* can be added to the value
1025 * (this can be cascaded, the seed may come from a previous call
1026 * to the helper).
1027 *
1028 * This is flexible enough to be used in several ways:
1029 *
1030 * * With *from_size* == 0, *to_size* > 0 and *seed* set to
1031 * checksum, it can be used when pushing new data.
1032 * * With *from_size* > 0, *to_size* == 0 and *seed* set to
1033 * checksum, it can be used when removing data from a packet.
1034 * * With *from_size* > 0, *to_size* > 0 and *seed* set to 0, it
1035 * can be used to compute a diff. Note that *from_size* and
1036 * *to_size* do not need to be equal.
1037 *
1038 * This helper can be used in combination with
1039 * **bpf_l3_csum_replace**\ () and **bpf_l4_csum_replace**\ (), to
1040 * which one can feed in the difference computed with
1041 * **bpf_csum_diff**\ ().
1042 * Return
1043 * The checksum result, or a negative error code in case of
1044 * failure.
1045 *
1046 * int bpf_skb_get_tunnel_opt(struct sk_buff *skb, u8 *opt, u32 size)
1047 * Description
1048 * Retrieve tunnel options metadata for the packet associated to
1049 * *skb*, and store the raw tunnel option data to the buffer *opt*
1050 * of *size*.
1051 *
1052 * This helper can be used with encapsulation devices that can
1053 * operate in "collect metadata" mode (please refer to the related
1054 * note in the description of **bpf_skb_get_tunnel_key**\ () for
1055 * more details). A particular example where this can be used is
1056 * in combination with the Geneve encapsulation protocol, where it
1057 * allows for pushing (with **bpf_skb_get_tunnel_opt**\ () helper)
1058 * and retrieving arbitrary TLVs (Type-Length-Value headers) from
1059 * the eBPF program. This allows for full customization of these
1060 * headers.
1061 * Return
1062 * The size of the option data retrieved.
1063 *
1064 * int bpf_skb_set_tunnel_opt(struct sk_buff *skb, u8 *opt, u32 size)
1065 * Description
1066 * Set tunnel options metadata for the packet associated to *skb*
1067 * to the option data contained in the raw buffer *opt* of *size*.
1068 *
1069 * See also the description of the **bpf_skb_get_tunnel_opt**\ ()
1070 * helper for additional information.
1071 * Return
1072 * 0 on success, or a negative error in case of failure.
1073 *
1074 * int bpf_skb_change_proto(struct sk_buff *skb, __be16 proto, u64 flags)
1075 * Description
1076 * Change the protocol of the *skb* to *proto*. Currently
1077 * supported are transition from IPv4 to IPv6, and from IPv6 to
1078 * IPv4. The helper takes care of the groundwork for the
1079 * transition, including resizing the socket buffer. The eBPF
1080 * program is expected to fill the new headers, if any, via
1081 * **skb_store_bytes**\ () and to recompute the checksums with
1082 * **bpf_l3_csum_replace**\ () and **bpf_l4_csum_replace**\
1083 * (). The main case for this helper is to perform NAT64
1084 * operations out of an eBPF program.
1085 *
1086 * Internally, the GSO type is marked as dodgy so that headers are
1087 * checked and segments are recalculated by the GSO/GRO engine.
1088 * The size for GSO target is adapted as well.
1089 *
1090 * All values for *flags* are reserved for future usage, and must
1091 * be left at zero.
1092 *
1093 * A call to this helper is susceptible to change the underlaying
1094 * packet buffer. Therefore, at load time, all checks on pointers
1095 * previously done by the verifier are invalidated and must be
1096 * performed again, if the helper is used in combination with
1097 * direct packet access.
1098 * Return
1099 * 0 on success, or a negative error in case of failure.
1100 *
1101 * int bpf_skb_change_type(struct sk_buff *skb, u32 type)
1102 * Description
1103 * Change the packet type for the packet associated to *skb*. This
1104 * comes down to setting *skb*\ **->pkt_type** to *type*, except
1105 * the eBPF program does not have a write access to *skb*\
1106 * **->pkt_type** beside this helper. Using a helper here allows
1107 * for graceful handling of errors.
1108 *
1109 * The major use case is to change incoming *skb*s to
1110 * **PACKET_HOST** in a programmatic way instead of having to
1111 * recirculate via **redirect**\ (..., **BPF_F_INGRESS**), for
1112 * example.
1113 *
1114 * Note that *type* only allows certain values. At this time, they
1115 * are:
1116 *
1117 * **PACKET_HOST**
1118 * Packet is for us.
1119 * **PACKET_BROADCAST**
1120 * Send packet to all.
1121 * **PACKET_MULTICAST**
1122 * Send packet to group.
1123 * **PACKET_OTHERHOST**
1124 * Send packet to someone else.
1125 * Return
1126 * 0 on success, or a negative error in case of failure.
1127 *
1128 * int bpf_skb_under_cgroup(struct sk_buff *skb, struct bpf_map *map, u32 index)
1129 * Description
1130 * Check whether *skb* is a descendant of the cgroup2 held by
1131 * *map* of type **BPF_MAP_TYPE_CGROUP_ARRAY**, at *index*.
1132 * Return
1133 * The return value depends on the result of the test, and can be:
1134 *
1135 * * 0, if the *skb* failed the cgroup2 descendant test.
1136 * * 1, if the *skb* succeeded the cgroup2 descendant test.
1137 * * A negative error code, if an error occurred.
1138 *
1139 * u32 bpf_get_hash_recalc(struct sk_buff *skb)
1140 * Description
1141 * Retrieve the hash of the packet, *skb*\ **->hash**. If it is
1142 * not set, in particular if the hash was cleared due to mangling,
1143 * recompute this hash. Later accesses to the hash can be done
1144 * directly with *skb*\ **->hash**.
1145 *
1146 * Calling **bpf_set_hash_invalid**\ (), changing a packet
1147 * prototype with **bpf_skb_change_proto**\ (), or calling
1148 * **bpf_skb_store_bytes**\ () with the
1149 * **BPF_F_INVALIDATE_HASH** are actions susceptible to clear
1150 * the hash and to trigger a new computation for the next call to
1151 * **bpf_get_hash_recalc**\ ().
1152 * Return
1153 * The 32-bit hash.
573 * 1154 *
574 * u64 bpf_get_current_task(void) 1155 * u64 bpf_get_current_task(void)
575 * Returns current task_struct 1156 * Return
576 * Return: current 1157 * A pointer to the current task struct.
577 * 1158 *
578 * int bpf_probe_write_user(void *dst, void *src, int len) 1159 * int bpf_probe_write_user(void *dst, const void *src, u32 len)
579 * safely attempt to write to a location 1160 * Description
580 * @dst: destination address in userspace 1161 * Attempt in a safe way to write *len* bytes from the buffer
581 * @src: source address on stack 1162 * *src* to *dst* in memory. It only works for threads that are in
582 * @len: number of bytes to copy 1163 * user context, and *dst* must be a valid user space address.
583 * Return: 0 on success or negative error 1164 *
584 * 1165 * This helper should not be used to implement any kind of
585 * int bpf_current_task_under_cgroup(map, index) 1166 * security mechanism because of TOC-TOU attacks, but rather to
586 * Check cgroup2 membership of current task 1167 * debug, divert, and manipulate execution of semi-cooperative
587 * @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type 1168 * processes.
588 * @index: index of the cgroup in the bpf_map 1169 *
589 * Return: 1170 * Keep in mind that this feature is meant for experiments, and it
590 * == 0 current failed the cgroup2 descendant test 1171 * has a risk of crashing the system and running programs.
591 * == 1 current succeeded the cgroup2 descendant test 1172 * Therefore, when an eBPF program using this helper is attached,
592 * < 0 error 1173 * a warning including PID and process name is printed to kernel
593 * 1174 * logs.
594 * int bpf_skb_change_tail(skb, len, flags) 1175 * Return
595 * The helper will resize the skb to the given new size, to be used f.e. 1176 * 0 on success, or a negative error in case of failure.
596 * with control messages. 1177 *
597 * @skb: pointer to skb 1178 * int bpf_current_task_under_cgroup(struct bpf_map *map, u32 index)
598 * @len: new skb length 1179 * Description
599 * @flags: reserved 1180 * Check whether the probe is being run is the context of a given
600 * Return: 0 on success or negative error 1181 * subset of the cgroup2 hierarchy. The cgroup2 to test is held by
601 * 1182 * *map* of type **BPF_MAP_TYPE_CGROUP_ARRAY**, at *index*.
602 * int bpf_skb_pull_data(skb, len) 1183 * Return
603 * The helper will pull in non-linear data in case the skb is non-linear 1184 * The return value depends on the result of the test, and can be:
604 * and not all of len are part of the linear section. Only needed for 1185 *
605 * read/write with direct packet access. 1186 * * 0, if the *skb* task belongs to the cgroup2.
606 * @skb: pointer to skb 1187 * * 1, if the *skb* task does not belong to the cgroup2.
607 * @len: len to make read/writeable 1188 * * A negative error code, if an error occurred.
608 * Return: 0 on success or negative error 1189 *
609 * 1190 * int bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags)
610 * s64 bpf_csum_update(skb, csum) 1191 * Description
611 * Adds csum into skb->csum in case of CHECKSUM_COMPLETE. 1192 * Resize (trim or grow) the packet associated to *skb* to the
612 * @skb: pointer to skb 1193 * new *len*. The *flags* are reserved for future usage, and must
613 * @csum: csum to add 1194 * be left at zero.
614 * Return: csum on success or negative error 1195 *
615 * 1196 * The basic idea is that the helper performs the needed work to
616 * void bpf_set_hash_invalid(skb) 1197 * change the size of the packet, then the eBPF program rewrites
617 * Invalidate current skb->hash. 1198 * the rest via helpers like **bpf_skb_store_bytes**\ (),
618 * @skb: pointer to skb 1199 * **bpf_l3_csum_replace**\ (), **bpf_l3_csum_replace**\ ()
619 * 1200 * and others. This helper is a slow path utility intended for
620 * int bpf_get_numa_node_id() 1201 * replies with control messages. And because it is targeted for
621 * Return: Id of current NUMA node. 1202 * slow path, the helper itself can afford to be slow: it
622 * 1203 * implicitly linearizes, unclones and drops offloads from the
623 * int bpf_skb_change_head() 1204 * *skb*.
624 * Grows headroom of skb and adjusts MAC header offset accordingly. 1205 *
625 * Will extends/reallocae as required automatically. 1206 * A call to this helper is susceptible to change the underlaying
626 * May change skb data pointer and will thus invalidate any check 1207 * packet buffer. Therefore, at load time, all checks on pointers
627 * performed for direct packet access. 1208 * previously done by the verifier are invalidated and must be
628 * @skb: pointer to skb 1209 * performed again, if the helper is used in combination with
629 * @len: length of header to be pushed in front 1210 * direct packet access.
630 * @flags: Flags (unused for now) 1211 * Return
631 * Return: 0 on success or negative error 1212 * 0 on success, or a negative error in case of failure.
632 * 1213 *
633 * int bpf_xdp_adjust_head(xdp_md, delta) 1214 * int bpf_skb_pull_data(struct sk_buff *skb, u32 len)
634 * Adjust the xdp_md.data by delta 1215 * Description
635 * @xdp_md: pointer to xdp_md 1216 * Pull in non-linear data in case the *skb* is non-linear and not
636 * @delta: An positive/negative integer to be added to xdp_md.data 1217 * all of *len* are part of the linear section. Make *len* bytes
637 * Return: 0 on success or negative on error 1218 * from *skb* readable and writable. If a zero value is passed for
1219 * *len*, then the whole length of the *skb* is pulled.
1220 *
1221 * This helper is only needed for reading and writing with direct
1222 * packet access.
1223 *
1224 * For direct packet access, testing that offsets to access
1225 * are within packet boundaries (test on *skb*\ **->data_end**) is
1226 * susceptible to fail if offsets are invalid, or if the requested
1227 * data is in non-linear parts of the *skb*. On failure the
1228 * program can just bail out, or in the case of a non-linear
1229 * buffer, use a helper to make the data available. The
1230 * **bpf_skb_load_bytes**\ () helper is a first solution to access
1231 * the data. Another one consists in using **bpf_skb_pull_data**
1232 * to pull in once the non-linear parts, then retesting and
1233 * eventually access the data.
1234 *
1235 * At the same time, this also makes sure the *skb* is uncloned,
1236 * which is a necessary condition for direct write. As this needs
1237 * to be an invariant for the write part only, the verifier
1238 * detects writes and adds a prologue that is calling
1239 * **bpf_skb_pull_data()** to effectively unclone the *skb* from
1240 * the very beginning in case it is indeed cloned.
1241 *
1242 * A call to this helper is susceptible to change the underlaying
1243 * packet buffer. Therefore, at load time, all checks on pointers
1244 * previously done by the verifier are invalidated and must be
1245 * performed again, if the helper is used in combination with
1246 * direct packet access.
1247 * Return
1248 * 0 on success, or a negative error in case of failure.
1249 *
1250 * s64 bpf_csum_update(struct sk_buff *skb, __wsum csum)
1251 * Description
1252 * Add the checksum *csum* into *skb*\ **->csum** in case the
1253 * driver has supplied a checksum for the entire packet into that
1254 * field. Return an error otherwise. This helper is intended to be
1255 * used in combination with **bpf_csum_diff**\ (), in particular
1256 * when the checksum needs to be updated after data has been
1257 * written into the packet through direct packet access.
1258 * Return
1259 * The checksum on success, or a negative error code in case of
1260 * failure.
1261 *
1262 * void bpf_set_hash_invalid(struct sk_buff *skb)
1263 * Description
1264 * Invalidate the current *skb*\ **->hash**. It can be used after
1265 * mangling on headers through direct packet access, in order to
1266 * indicate that the hash is outdated and to trigger a
1267 * recalculation the next time the kernel tries to access this
1268 * hash or when the **bpf_get_hash_recalc**\ () helper is called.
1269 *
1270 * int bpf_get_numa_node_id(void)
1271 * Description
1272 * Return the id of the current NUMA node. The primary use case
1273 * for this helper is the selection of sockets for the local NUMA
1274 * node, when the program is attached to sockets using the
1275 * **SO_ATTACH_REUSEPORT_EBPF** option (see also **socket(7)**),
1276 * but the helper is also available to other eBPF program types,
1277 * similarly to **bpf_get_smp_processor_id**\ ().
1278 * Return
1279 * The id of current NUMA node.
1280 *
1281 * int bpf_skb_change_head(struct sk_buff *skb, u32 len, u64 flags)
1282 * Description
1283 * Grows headroom of packet associated to *skb* and adjusts the
1284 * offset of the MAC header accordingly, adding *len* bytes of
1285 * space. It automatically extends and reallocates memory as
1286 * required.
1287 *
1288 * This helper can be used on a layer 3 *skb* to push a MAC header
1289 * for redirection into a layer 2 device.
1290 *
1291 * All values for *flags* are reserved for future usage, and must
1292 * be left at zero.
1293 *
1294 * A call to this helper is susceptible to change the underlaying
1295 * packet buffer. Therefore, at load time, all checks on pointers
1296 * previously done by the verifier are invalidated and must be
1297 * performed again, if the helper is used in combination with
1298 * direct packet access.
1299 * Return
1300 * 0 on success, or a negative error in case of failure.
1301 *
1302 * int bpf_xdp_adjust_head(struct xdp_buff *xdp_md, int delta)
1303 * Description
1304 * Adjust (move) *xdp_md*\ **->data** by *delta* bytes. Note that
1305 * it is possible to use a negative value for *delta*. This helper
1306 * can be used to prepare the packet for pushing or popping
1307 * headers.
1308 *
1309 * A call to this helper is susceptible to change the underlaying
1310 * packet buffer. Therefore, at load time, all checks on pointers
1311 * previously done by the verifier are invalidated and must be
1312 * performed again, if the helper is used in combination with
1313 * direct packet access.
1314 * Return
1315 * 0 on success, or a negative error in case of failure.
638 * 1316 *
639 * int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr) 1317 * int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr)
640 * Copy a NUL terminated string from unsafe address. In case the string 1318 * Description
641 * length is smaller than size, the target is not padded with further NUL 1319 * Copy a NUL terminated string from an unsafe address
642 * bytes. In case the string length is larger than size, just count-1 1320 * *unsafe_ptr* to *dst*. The *size* should include the
643 * bytes are copied and the last byte is set to NUL. 1321 * terminating NUL byte. In case the string length is smaller than
644 * @dst: destination address 1322 * *size*, the target is not padded with further NUL bytes. If the
645 * @size: maximum number of bytes to copy, including the trailing NUL 1323 * string length is larger than *size*, just *size*-1 bytes are
646 * @unsafe_ptr: unsafe address 1324 * copied and the last byte is set to NUL.
647 * Return: 1325 *
648 * > 0 length of the string including the trailing NUL on success 1326 * On success, the length of the copied string is returned. This
649 * < 0 error 1327 * makes this helper useful in tracing programs for reading
650 * 1328 * strings, and more importantly to get its length at runtime. See
651 * u64 bpf_get_socket_cookie(skb) 1329 * the following snippet:
652 * Get the cookie for the socket stored inside sk_buff. 1330 *
653 * @skb: pointer to skb 1331 * ::
654 * Return: 8 Bytes non-decreasing number on success or 0 if the socket 1332 *
655 * field is missing inside sk_buff 1333 * SEC("kprobe/sys_open")
656 * 1334 * void bpf_sys_open(struct pt_regs *ctx)
657 * u32 bpf_get_socket_uid(skb) 1335 * {
658 * Get the owner uid of the socket stored inside sk_buff. 1336 * char buf[PATHLEN]; // PATHLEN is defined to 256
659 * @skb: pointer to skb 1337 * int res = bpf_probe_read_str(buf, sizeof(buf),
660 * Return: uid of the socket owner on success or overflowuid if failed. 1338 * ctx->di);
661 * 1339 *
662 * u32 bpf_set_hash(skb, hash) 1340 * // Consume buf, for example push it to
663 * Set full skb->hash. 1341 * // userspace via bpf_perf_event_output(); we
664 * @skb: pointer to skb 1342 * // can use res (the string length) as event
665 * @hash: hash to set 1343 * // size, after checking its boundaries.
666 * 1344 * }
667 * int bpf_setsockopt(bpf_socket, level, optname, optval, optlen) 1345 *
668 * Calls setsockopt. Not all opts are available, only those with 1346 * In comparison, using **bpf_probe_read()** helper here instead
669 * integer optvals plus TCP_CONGESTION. 1347 * to read the string would require to estimate the length at
670 * Supported levels: SOL_SOCKET and IPPROTO_TCP 1348 * compile time, and would often result in copying more memory
671 * @bpf_socket: pointer to bpf_socket 1349 * than necessary.
672 * @level: SOL_SOCKET or IPPROTO_TCP 1350 *
673 * @optname: option name 1351 * Another useful use case is when parsing individual process
674 * @optval: pointer to option value 1352 * arguments or individual environment variables navigating
675 * @optlen: length of optval in bytes 1353 * *current*\ **->mm->arg_start** and *current*\
676 * Return: 0 or negative error 1354 * **->mm->env_start**: using this helper and the return value,
677 * 1355 * one can quickly iterate at the right offset of the memory area.
678 * int bpf_getsockopt(bpf_socket, level, optname, optval, optlen) 1356 * Return
679 * Calls getsockopt. Not all opts are available. 1357 * On success, the strictly positive length of the string,
680 * Supported levels: IPPROTO_TCP 1358 * including the trailing NUL character. On error, a negative
681 * @bpf_socket: pointer to bpf_socket 1359 * value.
682 * @level: IPPROTO_TCP 1360 *
683 * @optname: option name 1361 * u64 bpf_get_socket_cookie(struct sk_buff *skb)
684 * @optval: pointer to option value 1362 * Description
685 * @optlen: length of optval in bytes 1363 * If the **struct sk_buff** pointed by *skb* has a known socket,
686 * Return: 0 or negative error 1364 * retrieve the cookie (generated by the kernel) of this socket.
687 * 1365 * If no cookie has been set yet, generate a new cookie. Once
688 * int bpf_sock_ops_cb_flags_set(bpf_sock_ops, flags) 1366 * generated, the socket cookie remains stable for the life of the
689 * Set callback flags for sock_ops 1367 * socket. This helper can be useful for monitoring per socket
690 * @bpf_sock_ops: pointer to bpf_sock_ops_kern struct 1368 * networking traffic statistics as it provides a unique socket
691 * @flags: flags value 1369 * identifier per namespace.
692 * Return: 0 for no error 1370 * Return
693 * -EINVAL if there is no full tcp socket 1371 * A 8-byte long non-decreasing number on success, or 0 if the
694 * bits in flags that are not supported by current kernel 1372 * socket field is missing inside *skb*.
695 * 1373 *
696 * int bpf_skb_adjust_room(skb, len_diff, mode, flags) 1374 * u32 bpf_get_socket_uid(struct sk_buff *skb)
697 * Grow or shrink room in sk_buff. 1375 * Return
698 * @skb: pointer to skb 1376 * The owner UID of the socket associated to *skb*. If the socket
699 * @len_diff: (signed) amount of room to grow/shrink 1377 * is **NULL**, or if it is not a full socket (i.e. if it is a
700 * @mode: operation mode (enum bpf_adj_room_mode) 1378 * time-wait or a request socket instead), **overflowuid** value
701 * @flags: reserved for future use 1379 * is returned (note that **overflowuid** might also be the actual
702 * Return: 0 on success or negative error code 1380 * UID value for the socket).
703 * 1381 *
704 * int bpf_sk_redirect_map(map, key, flags) 1382 * u32 bpf_set_hash(struct sk_buff *skb, u32 hash)
705 * Redirect skb to a sock in map using key as a lookup key for the 1383 * Description
706 * sock in map. 1384 * Set the full hash for *skb* (set the field *skb*\ **->hash**)
707 * @map: pointer to sockmap 1385 * to value *hash*.
708 * @key: key to lookup sock in map 1386 * Return
709 * @flags: reserved for future use 1387 * 0
710 * Return: SK_PASS 1388 *
711 * 1389 * int bpf_setsockopt(struct bpf_sock_ops *bpf_socket, int level, int optname, char *optval, int optlen)
712 * int bpf_sock_map_update(skops, map, key, flags) 1390 * Description
713 * @skops: pointer to bpf_sock_ops 1391 * Emulate a call to **setsockopt()** on the socket associated to
714 * @map: pointer to sockmap to update 1392 * *bpf_socket*, which must be a full socket. The *level* at
715 * @key: key to insert/update sock in map 1393 * which the option resides and the name *optname* of the option
716 * @flags: same flags as map update elem 1394 * must be specified, see **setsockopt(2)** for more information.
717 * 1395 * The option value of length *optlen* is pointed by *optval*.
718 * int bpf_xdp_adjust_meta(xdp_md, delta) 1396 *
719 * Adjust the xdp_md.data_meta by delta 1397 * This helper actually implements a subset of **setsockopt()**.
720 * @xdp_md: pointer to xdp_md 1398 * It supports the following *level*\ s:
721 * @delta: An positive/negative integer to be added to xdp_md.data_meta 1399 *
722 * Return: 0 on success or negative on error 1400 * * **SOL_SOCKET**, which supports the following *optname*\ s:
723 * 1401 * **SO_RCVBUF**, **SO_SNDBUF**, **SO_MAX_PACING_RATE**,
724 * int bpf_perf_event_read_value(map, flags, buf, buf_size) 1402 * **SO_PRIORITY**, **SO_RCVLOWAT**, **SO_MARK**.
725 * read perf event counter value and perf event enabled/running time 1403 * * **IPPROTO_TCP**, which supports the following *optname*\ s:
726 * @map: pointer to perf_event_array map 1404 * **TCP_CONGESTION**, **TCP_BPF_IW**,
727 * @flags: index of event in the map or bitmask flags 1405 * **TCP_BPF_SNDCWND_CLAMP**.
728 * @buf: buf to fill 1406 * * **IPPROTO_IP**, which supports *optname* **IP_TOS**.
729 * @buf_size: size of the buf 1407 * * **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
730 * Return: 0 on success or negative error code 1408 * Return
731 * 1409 * 0 on success, or a negative error in case of failure.
732 * int bpf_perf_prog_read_value(ctx, buf, buf_size) 1410 *
733 * read perf prog attached perf event counter and enabled/running time 1411 * int bpf_skb_adjust_room(struct sk_buff *skb, u32 len_diff, u32 mode, u64 flags)
734 * @ctx: pointer to ctx 1412 * Description
735 * @buf: buf to fill 1413 * Grow or shrink the room for data in the packet associated to
736 * @buf_size: size of the buf 1414 * *skb* by *len_diff*, and according to the selected *mode*.
737 * Return : 0 on success or negative error code 1415 *
738 * 1416 * There is a single supported mode at this time:
739 * int bpf_override_return(pt_regs, rc) 1417 *
740 * @pt_regs: pointer to struct pt_regs 1418 * * **BPF_ADJ_ROOM_NET**: Adjust room at the network layer
741 * @rc: the return value to set 1419 * (room space is added or removed below the layer 3 header).
742 * 1420 *
743 * int bpf_msg_redirect_map(map, key, flags) 1421 * All values for *flags* are reserved for future usage, and must
744 * Redirect msg to a sock in map using key as a lookup key for the 1422 * be left at zero.
745 * sock in map. 1423 *
746 * @map: pointer to sockmap 1424 * A call to this helper is susceptible to change the underlaying
747 * @key: key to lookup sock in map 1425 * packet buffer. Therefore, at load time, all checks on pointers
748 * @flags: reserved for future use 1426 * previously done by the verifier are invalidated and must be
749 * Return: SK_PASS 1427 * performed again, if the helper is used in combination with
750 * 1428 * direct packet access.
751 * int bpf_bind(ctx, addr, addr_len) 1429 * Return
752 * Bind socket to address. Only binding to IP is supported, no port can be 1430 * 0 on success, or a negative error in case of failure.
753 * set in addr. 1431 *
754 * @ctx: pointer to context of type bpf_sock_addr 1432 * int bpf_redirect_map(struct bpf_map *map, u32 key, u64 flags)
755 * @addr: pointer to struct sockaddr to bind socket to 1433 * Description
756 * @addr_len: length of sockaddr structure 1434 * Redirect the packet to the endpoint referenced by *map* at
757 * Return: 0 on success or negative error code 1435 * index *key*. Depending on its type, this *map* can contain
1436 * references to net devices (for forwarding packets through other
1437 * ports), or to CPUs (for redirecting XDP frames to another CPU;
1438 * but this is only implemented for native XDP (with driver
1439 * support) as of this writing).
1440 *
1441 * All values for *flags* are reserved for future usage, and must
1442 * be left at zero.
1443 *
1444 * When used to redirect packets to net devices, this helper
1445 * provides a high performance increase over **bpf_redirect**\ ().
1446 * This is due to various implementation details of the underlying
1447 * mechanisms, one of which is the fact that **bpf_redirect_map**\
1448 * () tries to send packet as a "bulk" to the device.
1449 * Return
1450 * **XDP_REDIRECT** on success, or **XDP_ABORTED** on error.
1451 *
1452 * int bpf_sk_redirect_map(struct bpf_map *map, u32 key, u64 flags)
1453 * Description
1454 * Redirect the packet to the socket referenced by *map* (of type
1455 * **BPF_MAP_TYPE_SOCKMAP**) at index *key*. Both ingress and
1456 * egress interfaces can be used for redirection. The
1457 * **BPF_F_INGRESS** value in *flags* is used to make the
1458 * distinction (ingress path is selected if the flag is present,
1459 * egress path otherwise). This is the only flag supported for now.
1460 * Return
1461 * **SK_PASS** on success, or **SK_DROP** on error.
1462 *
1463 * int bpf_sock_map_update(struct bpf_sock_ops *skops, struct bpf_map *map, void *key, u64 flags)
1464 * Description
1465 * Add an entry to, or update a *map* referencing sockets. The
1466 * *skops* is used as a new value for the entry associated to
1467 * *key*. *flags* is one of:
1468 *
1469 * **BPF_NOEXIST**
1470 * The entry for *key* must not exist in the map.
1471 * **BPF_EXIST**
1472 * The entry for *key* must already exist in the map.
1473 * **BPF_ANY**
1474 * No condition on the existence of the entry for *key*.
1475 *
1476 * If the *map* has eBPF programs (parser and verdict), those will
1477 * be inherited by the socket being added. If the socket is
1478 * already attached to eBPF programs, this results in an error.
1479 * Return
1480 * 0 on success, or a negative error in case of failure.
1481 *
1482 * int bpf_xdp_adjust_meta(struct xdp_buff *xdp_md, int delta)
1483 * Description
1484 * Adjust the address pointed by *xdp_md*\ **->data_meta** by
1485 * *delta* (which can be positive or negative). Note that this
1486 * operation modifies the address stored in *xdp_md*\ **->data**,
1487 * so the latter must be loaded only after the helper has been
1488 * called.
1489 *
1490 * The use of *xdp_md*\ **->data_meta** is optional and programs
1491 * are not required to use it. The rationale is that when the
1492 * packet is processed with XDP (e.g. as DoS filter), it is
1493 * possible to push further meta data along with it before passing
1494 * to the stack, and to give the guarantee that an ingress eBPF
1495 * program attached as a TC classifier on the same device can pick
1496 * this up for further post-processing. Since TC works with socket
1497 * buffers, it remains possible to set from XDP the **mark** or
1498 * **priority** pointers, or other pointers for the socket buffer.
1499 * Having this scratch space generic and programmable allows for
1500 * more flexibility as the user is free to store whatever meta
1501 * data they need.
1502 *
1503 * A call to this helper is susceptible to change the underlaying
1504 * packet buffer. Therefore, at load time, all checks on pointers
1505 * previously done by the verifier are invalidated and must be
1506 * performed again, if the helper is used in combination with
1507 * direct packet access.
1508 * Return
1509 * 0 on success, or a negative error in case of failure.
1510 *
1511 * int bpf_perf_event_read_value(struct bpf_map *map, u64 flags, struct bpf_perf_event_value *buf, u32 buf_size)
1512 * Description
1513 * Read the value of a perf event counter, and store it into *buf*
1514 * of size *buf_size*. This helper relies on a *map* of type
1515 * **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. The nature of the perf event
1516 * counter is selected when *map* is updated with perf event file
1517 * descriptors. The *map* is an array whose size is the number of
1518 * available CPUs, and each cell contains a value relative to one
1519 * CPU. The value to retrieve is indicated by *flags*, that
1520 * contains the index of the CPU to look up, masked with
1521 * **BPF_F_INDEX_MASK**. Alternatively, *flags* can be set to
1522 * **BPF_F_CURRENT_CPU** to indicate that the value for the
1523 * current CPU should be retrieved.
1524 *
1525 * This helper behaves in a way close to
1526 * **bpf_perf_event_read**\ () helper, save that instead of
1527 * just returning the value observed, it fills the *buf*
1528 * structure. This allows for additional data to be retrieved: in
1529 * particular, the enabled and running times (in *buf*\
1530 * **->enabled** and *buf*\ **->running**, respectively) are
1531 * copied. In general, **bpf_perf_event_read_value**\ () is
1532 * recommended over **bpf_perf_event_read**\ (), which has some
1533 * ABI issues and provides fewer functionalities.
1534 *
1535 * These values are interesting, because hardware PMU (Performance
1536 * Monitoring Unit) counters are limited resources. When there are
1537 * more PMU based perf events opened than available counters,
1538 * kernel will multiplex these events so each event gets certain
1539 * percentage (but not all) of the PMU time. In case that
1540 * multiplexing happens, the number of samples or counter value
1541 * will not reflect the case compared to when no multiplexing
1542 * occurs. This makes comparison between different runs difficult.
1543 * Typically, the counter value should be normalized before
1544 * comparing to other experiments. The usual normalization is done
1545 * as follows.
1546 *
1547 * ::
1548 *
1549 * normalized_counter = counter * t_enabled / t_running
1550 *
1551 * Where t_enabled is the time enabled for event and t_running is
1552 * the time running for event since last normalization. The
1553 * enabled and running times are accumulated since the perf event
1554 * open. To achieve scaling factor between two invocations of an
1555 * eBPF program, users can can use CPU id as the key (which is
1556 * typical for perf array usage model) to remember the previous
1557 * value and do the calculation inside the eBPF program.
1558 * Return
1559 * 0 on success, or a negative error in case of failure.
1560 *
1561 * int bpf_perf_prog_read_value(struct bpf_perf_event_data *ctx, struct bpf_perf_event_value *buf, u32 buf_size)
1562 * Description
1563 * For en eBPF program attached to a perf event, retrieve the
1564 * value of the event counter associated to *ctx* and store it in
1565 * the structure pointed by *buf* and of size *buf_size*. Enabled
1566 * and running times are also stored in the structure (see
1567 * description of helper **bpf_perf_event_read_value**\ () for
1568 * more details).
1569 * Return
1570 * 0 on success, or a negative error in case of failure.
1571 *
1572 * int bpf_getsockopt(struct bpf_sock_ops *bpf_socket, int level, int optname, char *optval, int optlen)
1573 * Description
1574 * Emulate a call to **getsockopt()** on the socket associated to
1575 * *bpf_socket*, which must be a full socket. The *level* at
1576 * which the option resides and the name *optname* of the option
1577 * must be specified, see **getsockopt(2)** for more information.
1578 * The retrieved value is stored in the structure pointed by
1579 * *opval* and of length *optlen*.
1580 *
1581 * This helper actually implements a subset of **getsockopt()**.
1582 * It supports the following *level*\ s:
1583 *
1584 * * **IPPROTO_TCP**, which supports *optname*
1585 * **TCP_CONGESTION**.
1586 * * **IPPROTO_IP**, which supports *optname* **IP_TOS**.
1587 * * **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
1588 * Return
1589 * 0 on success, or a negative error in case of failure.
1590 *
1591 * int bpf_override_return(struct pt_reg *regs, u64 rc)
1592 * Description
1593 * Used for error injection, this helper uses kprobes to override
1594 * the return value of the probed function, and to set it to *rc*.
1595 * The first argument is the context *regs* on which the kprobe
1596 * works.
1597 *
1598 * This helper works by setting setting the PC (program counter)
1599 * to an override function which is run in place of the original
1600 * probed function. This means the probed function is not run at
1601 * all. The replacement function just returns with the required
1602 * value.
1603 *
1604 * This helper has security implications, and thus is subject to
1605 * restrictions. It is only available if the kernel was compiled
1606 * with the **CONFIG_BPF_KPROBE_OVERRIDE** configuration
1607 * option, and in this case it only works on functions tagged with
1608 * **ALLOW_ERROR_INJECTION** in the kernel code.
1609 *
1610 * Also, the helper is only available for the architectures having
1611 * the CONFIG_FUNCTION_ERROR_INJECTION option. As of this writing,
1612 * x86 architecture is the only one to support this feature.
1613 * Return
1614 * 0
1615 *
1616 * int bpf_sock_ops_cb_flags_set(struct bpf_sock_ops *bpf_sock, int argval)
1617 * Description
1618 * Attempt to set the value of the **bpf_sock_ops_cb_flags** field
1619 * for the full TCP socket associated to *bpf_sock_ops* to
1620 * *argval*.
1621 *
1622 * The primary use of this field is to determine if there should
1623 * be calls to eBPF programs of type
1624 * **BPF_PROG_TYPE_SOCK_OPS** at various points in the TCP
1625 * code. A program of the same type can change its value, per
1626 * connection and as necessary, when the connection is
1627 * established. This field is directly accessible for reading, but
1628 * this helper must be used for updates in order to return an
1629 * error if an eBPF program tries to set a callback that is not
1630 * supported in the current kernel.
1631 *
1632 * The supported callback values that *argval* can combine are:
1633 *
1634 * * **BPF_SOCK_OPS_RTO_CB_FLAG** (retransmission time out)
1635 * * **BPF_SOCK_OPS_RETRANS_CB_FLAG** (retransmission)
1636 * * **BPF_SOCK_OPS_STATE_CB_FLAG** (TCP state change)
1637 *
1638 * Here are some examples of where one could call such eBPF
1639 * program:
1640 *
1641 * * When RTO fires.
1642 * * When a packet is retransmitted.
1643 * * When the connection terminates.
1644 * * When a packet is sent.
1645 * * When a packet is received.
1646 * Return
1647 * Code **-EINVAL** if the socket is not a full TCP socket;
1648 * otherwise, a positive number containing the bits that could not
1649 * be set is returned (which comes down to 0 if all bits were set
1650 * as required).
1651 *
1652 * int bpf_msg_redirect_map(struct sk_msg_buff *msg, struct bpf_map *map, u32 key, u64 flags)
1653 * Description
1654 * This helper is used in programs implementing policies at the
1655 * socket level. If the message *msg* is allowed to pass (i.e. if
1656 * the verdict eBPF program returns **SK_PASS**), redirect it to
1657 * the socket referenced by *map* (of type
1658 * **BPF_MAP_TYPE_SOCKMAP**) at index *key*. Both ingress and
1659 * egress interfaces can be used for redirection. The
1660 * **BPF_F_INGRESS** value in *flags* is used to make the
1661 * distinction (ingress path is selected if the flag is present,
1662 * egress path otherwise). This is the only flag supported for now.
1663 * Return
1664 * **SK_PASS** on success, or **SK_DROP** on error.
1665 *
1666 * int bpf_msg_apply_bytes(struct sk_msg_buff *msg, u32 bytes)
1667 * Description
1668 * For socket policies, apply the verdict of the eBPF program to
1669 * the next *bytes* (number of bytes) of message *msg*.
1670 *
1671 * For example, this helper can be used in the following cases:
1672 *
1673 * * A single **sendmsg**\ () or **sendfile**\ () system call
1674 * contains multiple logical messages that the eBPF program is
1675 * supposed to read and for which it should apply a verdict.
1676 * * An eBPF program only cares to read the first *bytes* of a
1677 * *msg*. If the message has a large payload, then setting up
1678 * and calling the eBPF program repeatedly for all bytes, even
1679 * though the verdict is already known, would create unnecessary
1680 * overhead.
1681 *
1682 * When called from within an eBPF program, the helper sets a
1683 * counter internal to the BPF infrastructure, that is used to
1684 * apply the last verdict to the next *bytes*. If *bytes* is
1685 * smaller than the current data being processed from a
1686 * **sendmsg**\ () or **sendfile**\ () system call, the first
1687 * *bytes* will be sent and the eBPF program will be re-run with
1688 * the pointer for start of data pointing to byte number *bytes*
1689 * **+ 1**. If *bytes* is larger than the current data being
1690 * processed, then the eBPF verdict will be applied to multiple
1691 * **sendmsg**\ () or **sendfile**\ () calls until *bytes* are
1692 * consumed.
1693 *
1694 * Note that if a socket closes with the internal counter holding
1695 * a non-zero value, this is not a problem because data is not
1696 * being buffered for *bytes* and is sent as it is received.
1697 * Return
1698 * 0
1699 *
1700 * int bpf_msg_cork_bytes(struct sk_msg_buff *msg, u32 bytes)
1701 * Description
1702 * For socket policies, prevent the execution of the verdict eBPF
1703 * program for message *msg* until *bytes* (byte number) have been
1704 * accumulated.
1705 *
1706 * This can be used when one needs a specific number of bytes
1707 * before a verdict can be assigned, even if the data spans
1708 * multiple **sendmsg**\ () or **sendfile**\ () calls. The extreme
1709 * case would be a user calling **sendmsg**\ () repeatedly with
1710 * 1-byte long message segments. Obviously, this is bad for
1711 * performance, but it is still valid. If the eBPF program needs
1712 * *bytes* bytes to validate a header, this helper can be used to
1713 * prevent the eBPF program to be called again until *bytes* have
1714 * been accumulated.
1715 * Return
1716 * 0
1717 *
1718 * int bpf_msg_pull_data(struct sk_msg_buff *msg, u32 start, u32 end, u64 flags)
1719 * Description
1720 * For socket policies, pull in non-linear data from user space
1721 * for *msg* and set pointers *msg*\ **->data** and *msg*\
1722 * **->data_end** to *start* and *end* bytes offsets into *msg*,
1723 * respectively.
1724 *
1725 * If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a
1726 * *msg* it can only parse data that the (**data**, **data_end**)
1727 * pointers have already consumed. For **sendmsg**\ () hooks this
1728 * is likely the first scatterlist element. But for calls relying
1729 * on the **sendpage** handler (e.g. **sendfile**\ ()) this will
1730 * be the range (**0**, **0**) because the data is shared with
1731 * user space and by default the objective is to avoid allowing
1732 * user space to modify data while (or after) eBPF verdict is
1733 * being decided. This helper can be used to pull in data and to
1734 * set the start and end pointer to given values. Data will be
1735 * copied if necessary (i.e. if data was not linear and if start
1736 * and end pointers do not point to the same chunk).
1737 *
1738 * A call to this helper is susceptible to change the underlaying
1739 * packet buffer. Therefore, at load time, all checks on pointers
1740 * previously done by the verifier are invalidated and must be
1741 * performed again, if the helper is used in combination with
1742 * direct packet access.
1743 *
1744 * All values for *flags* are reserved for future usage, and must
1745 * be left at zero.
1746 * Return
1747 * 0 on success, or a negative error in case of failure.
1748 *
1749 * int bpf_bind(struct bpf_sock_addr *ctx, struct sockaddr *addr, int addr_len)
1750 * Description
1751 * Bind the socket associated to *ctx* to the address pointed by
1752 * *addr*, of length *addr_len*. This allows for making outgoing
1753 * connection from the desired IP address, which can be useful for
1754 * example when all processes inside a cgroup should use one
1755 * single IP address on a host that has multiple IP configured.
1756 *
1757 * This helper works for IPv4 and IPv6, TCP and UDP sockets. The
1758 * domain (*addr*\ **->sa_family**) must be **AF_INET** (or
1759 * **AF_INET6**). Looking for a free port to bind to can be
1760 * expensive, therefore binding to port is not permitted by the
1761 * helper: *addr*\ **->sin_port** (or **sin6_port**, respectively)
1762 * must be set to zero.
1763 * Return
1764 * 0 on success, or a negative error in case of failure.
1765 *
1766 * int bpf_xdp_adjust_tail(struct xdp_buff *xdp_md, int delta)
1767 * Description
1768 * Adjust (move) *xdp_md*\ **->data_end** by *delta* bytes. It is
1769 * only possible to shrink the packet as of this writing,
1770 * therefore *delta* must be a negative integer.
1771 *
1772 * A call to this helper is susceptible to change the underlaying
1773 * packet buffer. Therefore, at load time, all checks on pointers
1774 * previously done by the verifier are invalidated and must be
1775 * performed again, if the helper is used in combination with
1776 * direct packet access.
1777 * Return
1778 * 0 on success, or a negative error in case of failure.
1779 *
1780 * int bpf_skb_get_xfrm_state(struct sk_buff *skb, u32 index, struct bpf_xfrm_state *xfrm_state, u32 size, u64 flags)
1781 * Description
1782 * Retrieve the XFRM state (IP transform framework, see also
1783 * **ip-xfrm(8)**) at *index* in XFRM "security path" for *skb*.
1784 *
1785 * The retrieved value is stored in the **struct bpf_xfrm_state**
1786 * pointed by *xfrm_state* and of length *size*.
1787 *
1788 * All values for *flags* are reserved for future usage, and must
1789 * be left at zero.
1790 *
1791 * This helper is available only if the kernel was compiled with
1792 * **CONFIG_XFRM** configuration option.
1793 * Return
1794 * 0 on success, or a negative error in case of failure.
1795 *
1796 * int bpf_get_stack(struct pt_regs *regs, void *buf, u32 size, u64 flags)
1797 * Description
1798 * Return a user or a kernel stack in bpf program provided buffer.
1799 * To achieve this, the helper needs *ctx*, which is a pointer
1800 * to the context on which the tracing program is executed.
1801 * To store the stacktrace, the bpf program provides *buf* with
1802 * a nonnegative *size*.
1803 *
1804 * The last argument, *flags*, holds the number of stack frames to
1805 * skip (from 0 to 255), masked with
1806 * **BPF_F_SKIP_FIELD_MASK**. The next bits can be used to set
1807 * the following flags:
1808 *
1809 * **BPF_F_USER_STACK**
1810 * Collect a user space stack instead of a kernel stack.
1811 * **BPF_F_USER_BUILD_ID**
1812 * Collect buildid+offset instead of ips for user stack,
1813 * only valid if **BPF_F_USER_STACK** is also specified.
1814 *
1815 * **bpf_get_stack**\ () can collect up to
1816 * **PERF_MAX_STACK_DEPTH** both kernel and user frames, subject
1817 * to sufficient large buffer size. Note that
1818 * this limit can be controlled with the **sysctl** program, and
1819 * that it should be manually increased in order to profile long
1820 * user stacks (such as stacks for Java programs). To do so, use:
1821 *
1822 * ::
1823 *
1824 * # sysctl kernel.perf_event_max_stack=<new value>
1825 * Return
1826 * A non-negative value equal to or less than *size* on success,
1827 * or a negative error in case of failure.
1828 *
1829 * int skb_load_bytes_relative(const struct sk_buff *skb, u32 offset, void *to, u32 len, u32 start_header)
1830 * Description
1831 * This helper is similar to **bpf_skb_load_bytes**\ () in that
1832 * it provides an easy way to load *len* bytes from *offset*
1833 * from the packet associated to *skb*, into the buffer pointed
1834 * by *to*. The difference to **bpf_skb_load_bytes**\ () is that
1835 * a fifth argument *start_header* exists in order to select a
1836 * base offset to start from. *start_header* can be one of:
1837 *
1838 * **BPF_HDR_START_MAC**
1839 * Base offset to load data from is *skb*'s mac header.
1840 * **BPF_HDR_START_NET**
1841 * Base offset to load data from is *skb*'s network header.
1842 *
1843 * In general, "direct packet access" is the preferred method to
1844 * access packet data, however, this helper is in particular useful
1845 * in socket filters where *skb*\ **->data** does not always point
1846 * to the start of the mac header and where "direct packet access"
1847 * is not available.
1848 * Return
1849 * 0 on success, or a negative error in case of failure.
1850 *
1851 * int bpf_fib_lookup(void *ctx, struct bpf_fib_lookup *params, int plen, u32 flags)
1852 * Description
1853 * Do FIB lookup in kernel tables using parameters in *params*.
1854 * If lookup is successful and result shows packet is to be
1855 * forwarded, the neighbor tables are searched for the nexthop.
1856 * If successful (ie., FIB lookup shows forwarding and nexthop
1857 * is resolved), the nexthop address is returned in ipv4_dst
1858 * or ipv6_dst based on family, smac is set to mac address of
1859 * egress device, dmac is set to nexthop mac address, rt_metric
1860 * is set to metric from route (IPv4/IPv6 only).
1861 *
1862 * *plen* argument is the size of the passed in struct.
1863 * *flags* argument can be a combination of one or more of the
1864 * following values:
1865 *
1866 * **BPF_FIB_LOOKUP_DIRECT**
1867 * Do a direct table lookup vs full lookup using FIB
1868 * rules.
1869 * **BPF_FIB_LOOKUP_OUTPUT**
1870 * Perform lookup from an egress perspective (default is
1871 * ingress).
1872 *
1873 * *ctx* is either **struct xdp_md** for XDP programs or
1874 * **struct sk_buff** tc cls_act programs.
1875 * Return
1876 * Egress device index on success, 0 if packet needs to continue
1877 * up the stack for further processing or a negative error in case
1878 * of failure.
1879 *
1880 * int bpf_sock_hash_update(struct bpf_sock_ops_kern *skops, struct bpf_map *map, void *key, u64 flags)
1881 * Description
1882 * Add an entry to, or update a sockhash *map* referencing sockets.
1883 * The *skops* is used as a new value for the entry associated to
1884 * *key*. *flags* is one of:
1885 *
1886 * **BPF_NOEXIST**
1887 * The entry for *key* must not exist in the map.
1888 * **BPF_EXIST**
1889 * The entry for *key* must already exist in the map.
1890 * **BPF_ANY**
1891 * No condition on the existence of the entry for *key*.
1892 *
1893 * If the *map* has eBPF programs (parser and verdict), those will
1894 * be inherited by the socket being added. If the socket is
1895 * already attached to eBPF programs, this results in an error.
1896 * Return
1897 * 0 on success, or a negative error in case of failure.
1898 *
1899 * int bpf_msg_redirect_hash(struct sk_msg_buff *msg, struct bpf_map *map, void *key, u64 flags)
1900 * Description
1901 * This helper is used in programs implementing policies at the
1902 * socket level. If the message *msg* is allowed to pass (i.e. if
1903 * the verdict eBPF program returns **SK_PASS**), redirect it to
1904 * the socket referenced by *map* (of type
1905 * **BPF_MAP_TYPE_SOCKHASH**) using hash *key*. Both ingress and
1906 * egress interfaces can be used for redirection. The
1907 * **BPF_F_INGRESS** value in *flags* is used to make the
1908 * distinction (ingress path is selected if the flag is present,
1909 * egress path otherwise). This is the only flag supported for now.
1910 * Return
1911 * **SK_PASS** on success, or **SK_DROP** on error.
1912 *
1913 * int bpf_sk_redirect_hash(struct sk_buff *skb, struct bpf_map *map, void *key, u64 flags)
1914 * Description
1915 * This helper is used in programs implementing policies at the
1916 * skb socket level. If the sk_buff *skb* is allowed to pass (i.e.
1917 * if the verdeict eBPF program returns **SK_PASS**), redirect it
1918 * to the socket referenced by *map* (of type
1919 * **BPF_MAP_TYPE_SOCKHASH**) using hash *key*. Both ingress and
1920 * egress interfaces can be used for redirection. The
1921 * **BPF_F_INGRESS** value in *flags* is used to make the
1922 * distinction (ingress path is selected if the flag is present,
1923 * egress otherwise). This is the only flag supported for now.
1924 * Return
1925 * **SK_PASS** on success, or **SK_DROP** on error.
1926 *
1927 * int bpf_lwt_push_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len)
1928 * Description
1929 * Encapsulate the packet associated to *skb* within a Layer 3
1930 * protocol header. This header is provided in the buffer at
1931 * address *hdr*, with *len* its size in bytes. *type* indicates
1932 * the protocol of the header and can be one of:
1933 *
1934 * **BPF_LWT_ENCAP_SEG6**
1935 * IPv6 encapsulation with Segment Routing Header
1936 * (**struct ipv6_sr_hdr**). *hdr* only contains the SRH,
1937 * the IPv6 header is computed by the kernel.
1938 * **BPF_LWT_ENCAP_SEG6_INLINE**
1939 * Only works if *skb* contains an IPv6 packet. Insert a
1940 * Segment Routing Header (**struct ipv6_sr_hdr**) inside
1941 * the IPv6 header.
1942 *
1943 * A call to this helper is susceptible to change the underlaying
1944 * packet buffer. Therefore, at load time, all checks on pointers
1945 * previously done by the verifier are invalidated and must be
1946 * performed again, if the helper is used in combination with
1947 * direct packet access.
1948 * Return
1949 * 0 on success, or a negative error in case of failure.
1950 *
1951 * int bpf_lwt_seg6_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len)
1952 * Description
1953 * Store *len* bytes from address *from* into the packet
1954 * associated to *skb*, at *offset*. Only the flags, tag and TLVs
1955 * inside the outermost IPv6 Segment Routing Header can be
1956 * modified through this helper.
1957 *
1958 * A call to this helper is susceptible to change the underlaying
1959 * packet buffer. Therefore, at load time, all checks on pointers
1960 * previously done by the verifier are invalidated and must be
1961 * performed again, if the helper is used in combination with
1962 * direct packet access.
1963 * Return
1964 * 0 on success, or a negative error in case of failure.
1965 *
1966 * int bpf_lwt_seg6_adjust_srh(struct sk_buff *skb, u32 offset, s32 delta)
1967 * Description
1968 * Adjust the size allocated to TLVs in the outermost IPv6
1969 * Segment Routing Header contained in the packet associated to
1970 * *skb*, at position *offset* by *delta* bytes. Only offsets
1971 * after the segments are accepted. *delta* can be as well
1972 * positive (growing) as negative (shrinking).
1973 *
1974 * A call to this helper is susceptible to change the underlaying
1975 * packet buffer. Therefore, at load time, all checks on pointers
1976 * previously done by the verifier are invalidated and must be
1977 * performed again, if the helper is used in combination with
1978 * direct packet access.
1979 * Return
1980 * 0 on success, or a negative error in case of failure.
1981 *
1982 * int bpf_lwt_seg6_action(struct sk_buff *skb, u32 action, void *param, u32 param_len)
1983 * Description
1984 * Apply an IPv6 Segment Routing action of type *action* to the
1985 * packet associated to *skb*. Each action takes a parameter
1986 * contained at address *param*, and of length *param_len* bytes.
1987 * *action* can be one of:
1988 *
1989 * **SEG6_LOCAL_ACTION_END_X**
1990 * End.X action: Endpoint with Layer-3 cross-connect.
1991 * Type of *param*: **struct in6_addr**.
1992 * **SEG6_LOCAL_ACTION_END_T**
1993 * End.T action: Endpoint with specific IPv6 table lookup.
1994 * Type of *param*: **int**.
1995 * **SEG6_LOCAL_ACTION_END_B6**
1996 * End.B6 action: Endpoint bound to an SRv6 policy.
1997 * Type of param: **struct ipv6_sr_hdr**.
1998 * **SEG6_LOCAL_ACTION_END_B6_ENCAP**
1999 * End.B6.Encap action: Endpoint bound to an SRv6
2000 * encapsulation policy.
2001 * Type of param: **struct ipv6_sr_hdr**.
2002 *
2003 * A call to this helper is susceptible to change the underlaying
2004 * packet buffer. Therefore, at load time, all checks on pointers
2005 * previously done by the verifier are invalidated and must be
2006 * performed again, if the helper is used in combination with
2007 * direct packet access.
2008 * Return
2009 * 0 on success, or a negative error in case of failure.
2010 *
2011 * int bpf_rc_keydown(void *ctx, u32 protocol, u64 scancode, u32 toggle)
2012 * Description
2013 * This helper is used in programs implementing IR decoding, to
2014 * report a successfully decoded key press with *scancode*,
2015 * *toggle* value in the given *protocol*. The scancode will be
2016 * translated to a keycode using the rc keymap, and reported as
2017 * an input key down event. After a period a key up event is
2018 * generated. This period can be extended by calling either
2019 * **bpf_rc_keydown** () again with the same values, or calling
2020 * **bpf_rc_repeat** ().
2021 *
2022 * Some protocols include a toggle bit, in case the button was
2023 * released and pressed again between consecutive scancodes.
2024 *
2025 * The *ctx* should point to the lirc sample as passed into
2026 * the program.
2027 *
2028 * The *protocol* is the decoded protocol number (see
2029 * **enum rc_proto** for some predefined values).
2030 *
2031 * This helper is only available is the kernel was compiled with
2032 * the **CONFIG_BPF_LIRC_MODE2** configuration option set to
2033 * "**y**".
2034 *
2035 * Return
2036 * 0
2037 *
2038 * int bpf_rc_repeat(void *ctx)
2039 * Description
2040 * This helper is used in programs implementing IR decoding, to
2041 * report a successfully decoded repeat key message. This delays
2042 * the generation of a key up event for previously generated
2043 * key down event.
2044 *
2045 * Some IR protocols like NEC have a special IR message for
2046 * repeating last button, for when a button is held down.
2047 *
2048 * The *ctx* should point to the lirc sample as passed into
2049 * the program.
2050 *
2051 * This helper is only available is the kernel was compiled with
2052 * the **CONFIG_BPF_LIRC_MODE2** configuration option set to
2053 * "**y**".
2054 *
2055 * Return
2056 * 0
2057 *
2058 * uint64_t bpf_skb_cgroup_id(struct sk_buff *skb)
2059 * Description
2060 * Return the cgroup v2 id of the socket associated with the *skb*.
2061 * This is roughly similar to the **bpf_get_cgroup_classid**\ ()
2062 * helper for cgroup v1 by providing a tag resp. identifier that
2063 * can be matched on or used for map lookups e.g. to implement
2064 * policy. The cgroup v2 id of a given path in the hierarchy is
2065 * exposed in user space through the f_handle API in order to get
2066 * to the same 64-bit id.
2067 *
2068 * This helper can be used on TC egress path, but not on ingress,
2069 * and is available only if the kernel was compiled with the
2070 * **CONFIG_SOCK_CGROUP_DATA** configuration option.
2071 * Return
2072 * The id is returned or 0 in case the id could not be retrieved.
2073 *
2074 * u64 bpf_get_current_cgroup_id(void)
2075 * Return
2076 * A 64-bit integer containing the current cgroup id based
2077 * on the cgroup within which the current task is running.
758 */ 2078 */
759#define __BPF_FUNC_MAPPER(FN) \ 2079#define __BPF_FUNC_MAPPER(FN) \
760 FN(unspec), \ 2080 FN(unspec), \
@@ -821,7 +2141,23 @@ union bpf_attr {
821 FN(msg_apply_bytes), \ 2141 FN(msg_apply_bytes), \
822 FN(msg_cork_bytes), \ 2142 FN(msg_cork_bytes), \
823 FN(msg_pull_data), \ 2143 FN(msg_pull_data), \
824 FN(bind), 2144 FN(bind), \
2145 FN(xdp_adjust_tail), \
2146 FN(skb_get_xfrm_state), \
2147 FN(get_stack), \
2148 FN(skb_load_bytes_relative), \
2149 FN(fib_lookup), \
2150 FN(sock_hash_update), \
2151 FN(msg_redirect_hash), \
2152 FN(sk_redirect_hash), \
2153 FN(lwt_push_encap), \
2154 FN(lwt_seg6_store_bytes), \
2155 FN(lwt_seg6_adjust_srh), \
2156 FN(lwt_seg6_action), \
2157 FN(rc_repeat), \
2158 FN(rc_keydown), \
2159 FN(skb_cgroup_id), \
2160 FN(get_current_cgroup_id),
825 2161
826/* integer value in 'imm' field of BPF_CALL instruction selects which helper 2162/* integer value in 'imm' field of BPF_CALL instruction selects which helper
827 * function eBPF program intends to call 2163 * function eBPF program intends to call
@@ -855,11 +2191,14 @@ enum bpf_func_id {
855/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */ 2191/* BPF_FUNC_skb_set_tunnel_key and BPF_FUNC_skb_get_tunnel_key flags. */
856#define BPF_F_TUNINFO_IPV6 (1ULL << 0) 2192#define BPF_F_TUNINFO_IPV6 (1ULL << 0)
857 2193
858/* BPF_FUNC_get_stackid flags. */ 2194/* flags for both BPF_FUNC_get_stackid and BPF_FUNC_get_stack. */
859#define BPF_F_SKIP_FIELD_MASK 0xffULL 2195#define BPF_F_SKIP_FIELD_MASK 0xffULL
860#define BPF_F_USER_STACK (1ULL << 8) 2196#define BPF_F_USER_STACK (1ULL << 8)
2197/* flags used by BPF_FUNC_get_stackid only. */
861#define BPF_F_FAST_STACK_CMP (1ULL << 9) 2198#define BPF_F_FAST_STACK_CMP (1ULL << 9)
862#define BPF_F_REUSE_STACKID (1ULL << 10) 2199#define BPF_F_REUSE_STACKID (1ULL << 10)
2200/* flags used by BPF_FUNC_get_stack only. */
2201#define BPF_F_USER_BUILD_ID (1ULL << 11)
863 2202
864/* BPF_FUNC_skb_set_tunnel_key flags. */ 2203/* BPF_FUNC_skb_set_tunnel_key flags. */
865#define BPF_F_ZERO_CSUM_TX (1ULL << 1) 2204#define BPF_F_ZERO_CSUM_TX (1ULL << 1)
@@ -879,6 +2218,18 @@ enum bpf_adj_room_mode {
879 BPF_ADJ_ROOM_NET, 2218 BPF_ADJ_ROOM_NET,
880}; 2219};
881 2220
2221/* Mode for BPF_FUNC_skb_load_bytes_relative helper. */
2222enum bpf_hdr_start_off {
2223 BPF_HDR_START_MAC,
2224 BPF_HDR_START_NET,
2225};
2226
2227/* Encapsulation type for BPF_FUNC_lwt_push_encap helper. */
2228enum bpf_lwt_encap_mode {
2229 BPF_LWT_ENCAP_SEG6,
2230 BPF_LWT_ENCAP_SEG6_INLINE
2231};
2232
882/* user accessible mirror of in-kernel sk_buff. 2233/* user accessible mirror of in-kernel sk_buff.
883 * new fields can only be added to the end of this structure 2234 * new fields can only be added to the end of this structure
884 */ 2235 */
@@ -923,10 +2274,24 @@ struct bpf_tunnel_key {
923 }; 2274 };
924 __u8 tunnel_tos; 2275 __u8 tunnel_tos;
925 __u8 tunnel_ttl; 2276 __u8 tunnel_ttl;
926 __u16 tunnel_ext; 2277 __u16 tunnel_ext; /* Padding, future use. */
927 __u32 tunnel_label; 2278 __u32 tunnel_label;
928}; 2279};
929 2280
2281/* user accessible mirror of in-kernel xfrm_state.
2282 * new fields can only be added to the end of this structure
2283 */
2284struct bpf_xfrm_state {
2285 __u32 reqid;
2286 __u32 spi; /* Stored in network byte order */
2287 __u16 family;
2288 __u16 ext; /* Padding, future use. */
2289 union {
2290 __u32 remote_ipv4; /* Stored in network byte order */
2291 __u32 remote_ipv6[4]; /* Stored in network byte order */
2292 };
2293};
2294
930/* Generic BPF return codes which all BPF program types may support. 2295/* Generic BPF return codes which all BPF program types may support.
931 * The values are binary compatible with their TC_ACT_* counter-part to 2296 * The values are binary compatible with their TC_ACT_* counter-part to
932 * provide backwards compatibility with existing SCHED_CLS and SCHED_ACT 2297 * provide backwards compatibility with existing SCHED_CLS and SCHED_ACT
@@ -999,6 +2364,14 @@ enum sk_action {
999struct sk_msg_md { 2364struct sk_msg_md {
1000 void *data; 2365 void *data;
1001 void *data_end; 2366 void *data_end;
2367
2368 __u32 family;
2369 __u32 remote_ip4; /* Stored in network byte order */
2370 __u32 local_ip4; /* Stored in network byte order */
2371 __u32 remote_ip6[4]; /* Stored in network byte order */
2372 __u32 local_ip6[4]; /* Stored in network byte order */
2373 __u32 remote_port; /* Stored in network byte order */
2374 __u32 local_port; /* stored in host byte order */
1002}; 2375};
1003 2376
1004#define BPF_TAG_SIZE 8 2377#define BPF_TAG_SIZE 8
@@ -1017,9 +2390,13 @@ struct bpf_prog_info {
1017 __aligned_u64 map_ids; 2390 __aligned_u64 map_ids;
1018 char name[BPF_OBJ_NAME_LEN]; 2391 char name[BPF_OBJ_NAME_LEN];
1019 __u32 ifindex; 2392 __u32 ifindex;
1020 __u32 :32; 2393 __u32 gpl_compatible:1;
1021 __u64 netns_dev; 2394 __u64 netns_dev;
1022 __u64 netns_ino; 2395 __u64 netns_ino;
2396 __u32 nr_jited_ksyms;
2397 __u32 nr_jited_func_lens;
2398 __aligned_u64 jited_ksyms;
2399 __aligned_u64 jited_func_lens;
1023} __attribute__((aligned(8))); 2400} __attribute__((aligned(8)));
1024 2401
1025struct bpf_map_info { 2402struct bpf_map_info {
@@ -1034,6 +2411,15 @@ struct bpf_map_info {
1034 __u32 :32; 2411 __u32 :32;
1035 __u64 netns_dev; 2412 __u64 netns_dev;
1036 __u64 netns_ino; 2413 __u64 netns_ino;
2414 __u32 btf_id;
2415 __u32 btf_key_type_id;
2416 __u32 btf_value_type_id;
2417} __attribute__((aligned(8)));
2418
2419struct bpf_btf_info {
2420 __aligned_u64 btf;
2421 __u32 btf_size;
2422 __u32 id;
1037} __attribute__((aligned(8))); 2423} __attribute__((aligned(8)));
1038 2424
1039/* User bpf_sock_addr struct to access socket fields and sockaddr struct passed 2425/* User bpf_sock_addr struct to access socket fields and sockaddr struct passed
@@ -1054,6 +2440,12 @@ struct bpf_sock_addr {
1054 __u32 family; /* Allows 4-byte read, but no write */ 2440 __u32 family; /* Allows 4-byte read, but no write */
1055 __u32 type; /* Allows 4-byte read, but no write */ 2441 __u32 type; /* Allows 4-byte read, but no write */
1056 __u32 protocol; /* Allows 4-byte read, but no write */ 2442 __u32 protocol; /* Allows 4-byte read, but no write */
2443 __u32 msg_src_ip4; /* Allows 1,2,4-byte read an 4-byte write.
2444 * Stored in network byte order.
2445 */
2446 __u32 msg_src_ip6[4]; /* Allows 1,2,4-byte read an 4-byte write.
2447 * Stored in network byte order.
2448 */
1057}; 2449};
1058 2450
1059/* User bpf_sock_ops struct to access socket values and specify request ops 2451/* User bpf_sock_ops struct to access socket values and specify request ops
@@ -1214,4 +2606,64 @@ struct bpf_raw_tracepoint_args {
1214 __u64 args[0]; 2606 __u64 args[0];
1215}; 2607};
1216 2608
2609/* DIRECT: Skip the FIB rules and go to FIB table associated with device
2610 * OUTPUT: Do lookup from egress perspective; default is ingress
2611 */
2612#define BPF_FIB_LOOKUP_DIRECT BIT(0)
2613#define BPF_FIB_LOOKUP_OUTPUT BIT(1)
2614
2615struct bpf_fib_lookup {
2616 /* input: network family for lookup (AF_INET, AF_INET6)
2617 * output: network family of egress nexthop
2618 */
2619 __u8 family;
2620
2621 /* set if lookup is to consider L4 data - e.g., FIB rules */
2622 __u8 l4_protocol;
2623 __be16 sport;
2624 __be16 dport;
2625
2626 /* total length of packet from network header - used for MTU check */
2627 __u16 tot_len;
2628 __u32 ifindex; /* L3 device index for lookup */
2629
2630 union {
2631 /* inputs to lookup */
2632 __u8 tos; /* AF_INET */
2633 __be32 flowinfo; /* AF_INET6, flow_label + priority */
2634
2635 /* output: metric of fib result (IPv4/IPv6 only) */
2636 __u32 rt_metric;
2637 };
2638
2639 union {
2640 __be32 ipv4_src;
2641 __u32 ipv6_src[4]; /* in6_addr; network order */
2642 };
2643
2644 /* input to bpf_fib_lookup, ipv{4,6}_dst is destination address in
2645 * network header. output: bpf_fib_lookup sets to gateway address
2646 * if FIB lookup returns gateway route
2647 */
2648 union {
2649 __be32 ipv4_dst;
2650 __u32 ipv6_dst[4]; /* in6_addr; network order */
2651 };
2652
2653 /* output */
2654 __be16 h_vlan_proto;
2655 __be16 h_vlan_TCI;
2656 __u8 smac[6]; /* ETH_ALEN */
2657 __u8 dmac[6]; /* ETH_ALEN */
2658};
2659
2660enum bpf_task_fd_type {
2661 BPF_FD_TYPE_RAW_TRACEPOINT, /* tp name */
2662 BPF_FD_TYPE_TRACEPOINT, /* tp name */
2663 BPF_FD_TYPE_KPROBE, /* (symbol + offset) or addr */
2664 BPF_FD_TYPE_KRETPROBE, /* (symbol + offset) or addr */
2665 BPF_FD_TYPE_UPROBE, /* filename + offset */
2666 BPF_FD_TYPE_URETPROBE, /* filename + offset */
2667};
2668
1217#endif /* _UAPI__LINUX_BPF_H__ */ 2669#endif /* _UAPI__LINUX_BPF_H__ */
diff --git a/include/uapi/linux/bpfilter.h b/include/uapi/linux/bpfilter.h
new file mode 100644
index 000000000000..2ec3cc99ea4c
--- /dev/null
+++ b/include/uapi/linux/bpfilter.h
@@ -0,0 +1,21 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _UAPI_LINUX_BPFILTER_H
3#define _UAPI_LINUX_BPFILTER_H
4
5#include <linux/if.h>
6
7enum {
8 BPFILTER_IPT_SO_SET_REPLACE = 64,
9 BPFILTER_IPT_SO_SET_ADD_COUNTERS = 65,
10 BPFILTER_IPT_SET_MAX,
11};
12
13enum {
14 BPFILTER_IPT_SO_GET_INFO = 64,
15 BPFILTER_IPT_SO_GET_ENTRIES = 65,
16 BPFILTER_IPT_SO_GET_REVISION_MATCH = 66,
17 BPFILTER_IPT_SO_GET_REVISION_TARGET = 67,
18 BPFILTER_IPT_GET_MAX,
19};
20
21#endif /* _UAPI_LINUX_BPFILTER_H */
diff --git a/include/uapi/linux/btf.h b/include/uapi/linux/btf.h
new file mode 100644
index 000000000000..0b5ddbe135a4
--- /dev/null
+++ b/include/uapi/linux/btf.h
@@ -0,0 +1,113 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/* Copyright (c) 2018 Facebook */
3#ifndef _UAPI__LINUX_BTF_H__
4#define _UAPI__LINUX_BTF_H__
5
6#include <linux/types.h>
7
8#define BTF_MAGIC 0xeB9F
9#define BTF_VERSION 1
10
11struct btf_header {
12 __u16 magic;
13 __u8 version;
14 __u8 flags;
15 __u32 hdr_len;
16
17 /* All offsets are in bytes relative to the end of this header */
18 __u32 type_off; /* offset of type section */
19 __u32 type_len; /* length of type section */
20 __u32 str_off; /* offset of string section */
21 __u32 str_len; /* length of string section */
22};
23
24/* Max # of type identifier */
25#define BTF_MAX_TYPE 0x0000ffff
26/* Max offset into the string section */
27#define BTF_MAX_NAME_OFFSET 0x0000ffff
28/* Max # of struct/union/enum members or func args */
29#define BTF_MAX_VLEN 0xffff
30
31struct btf_type {
32 __u32 name_off;
33 /* "info" bits arrangement
34 * bits 0-15: vlen (e.g. # of struct's members)
35 * bits 16-23: unused
36 * bits 24-27: kind (e.g. int, ptr, array...etc)
37 * bits 28-31: unused
38 */
39 __u32 info;
40 /* "size" is used by INT, ENUM, STRUCT and UNION.
41 * "size" tells the size of the type it is describing.
42 *
43 * "type" is used by PTR, TYPEDEF, VOLATILE, CONST and RESTRICT.
44 * "type" is a type_id referring to another type.
45 */
46 union {
47 __u32 size;
48 __u32 type;
49 };
50};
51
52#define BTF_INFO_KIND(info) (((info) >> 24) & 0x0f)
53#define BTF_INFO_VLEN(info) ((info) & 0xffff)
54
55#define BTF_KIND_UNKN 0 /* Unknown */
56#define BTF_KIND_INT 1 /* Integer */
57#define BTF_KIND_PTR 2 /* Pointer */
58#define BTF_KIND_ARRAY 3 /* Array */
59#define BTF_KIND_STRUCT 4 /* Struct */
60#define BTF_KIND_UNION 5 /* Union */
61#define BTF_KIND_ENUM 6 /* Enumeration */
62#define BTF_KIND_FWD 7 /* Forward */
63#define BTF_KIND_TYPEDEF 8 /* Typedef */
64#define BTF_KIND_VOLATILE 9 /* Volatile */
65#define BTF_KIND_CONST 10 /* Const */
66#define BTF_KIND_RESTRICT 11 /* Restrict */
67#define BTF_KIND_MAX 11
68#define NR_BTF_KINDS 12
69
70/* For some specific BTF_KIND, "struct btf_type" is immediately
71 * followed by extra data.
72 */
73
74/* BTF_KIND_INT is followed by a u32 and the following
75 * is the 32 bits arrangement:
76 */
77#define BTF_INT_ENCODING(VAL) (((VAL) & 0x0f000000) >> 24)
78#define BTF_INT_OFFSET(VAL) (((VAL & 0x00ff0000)) >> 16)
79#define BTF_INT_BITS(VAL) ((VAL) & 0x0000ffff)
80
81/* Attributes stored in the BTF_INT_ENCODING */
82#define BTF_INT_SIGNED (1 << 0)
83#define BTF_INT_CHAR (1 << 1)
84#define BTF_INT_BOOL (1 << 2)
85
86/* BTF_KIND_ENUM is followed by multiple "struct btf_enum".
87 * The exact number of btf_enum is stored in the vlen (of the
88 * info in "struct btf_type").
89 */
90struct btf_enum {
91 __u32 name_off;
92 __s32 val;
93};
94
95/* BTF_KIND_ARRAY is followed by one "struct btf_array" */
96struct btf_array {
97 __u32 type;
98 __u32 index_type;
99 __u32 nelems;
100};
101
102/* BTF_KIND_STRUCT and BTF_KIND_UNION are followed
103 * by multiple "struct btf_member". The exact number
104 * of btf_member is stored in the vlen (of the info in
105 * "struct btf_type").
106 */
107struct btf_member {
108 __u32 name_off;
109 __u32 type;
110 __u32 offset; /* offset in bits */
111};
112
113#endif /* _UAPI__LINUX_BTF_H__ */
diff --git a/include/uapi/linux/cn_proc.h b/include/uapi/linux/cn_proc.h
index 68ff25414700..db210625cee8 100644
--- a/include/uapi/linux/cn_proc.h
+++ b/include/uapi/linux/cn_proc.h
@@ -116,12 +116,16 @@ struct proc_event {
116 struct coredump_proc_event { 116 struct coredump_proc_event {
117 __kernel_pid_t process_pid; 117 __kernel_pid_t process_pid;
118 __kernel_pid_t process_tgid; 118 __kernel_pid_t process_tgid;
119 __kernel_pid_t parent_pid;
120 __kernel_pid_t parent_tgid;
119 } coredump; 121 } coredump;
120 122
121 struct exit_proc_event { 123 struct exit_proc_event {
122 __kernel_pid_t process_pid; 124 __kernel_pid_t process_pid;
123 __kernel_pid_t process_tgid; 125 __kernel_pid_t process_tgid;
124 __u32 exit_code, exit_signal; 126 __u32 exit_code, exit_signal;
127 __kernel_pid_t parent_pid;
128 __kernel_pid_t parent_tgid;
125 } exit; 129 } exit;
126 130
127 } event_data; 131 } event_data;
diff --git a/include/uapi/linux/dcbnl.h b/include/uapi/linux/dcbnl.h
index 2c0c6453c3f4..60aa2e446698 100644
--- a/include/uapi/linux/dcbnl.h
+++ b/include/uapi/linux/dcbnl.h
@@ -163,6 +163,16 @@ struct ieee_pfc {
163 __u64 indications[IEEE_8021QAZ_MAX_TCS]; 163 __u64 indications[IEEE_8021QAZ_MAX_TCS];
164}; 164};
165 165
166#define IEEE_8021Q_MAX_PRIORITIES 8
167#define DCBX_MAX_BUFFERS 8
168struct dcbnl_buffer {
169 /* priority to buffer mapping */
170 __u8 prio2buffer[IEEE_8021Q_MAX_PRIORITIES];
171 /* buffer size in Bytes */
172 __u32 buffer_size[DCBX_MAX_BUFFERS];
173 __u32 total_size;
174};
175
166/* CEE DCBX std supported values */ 176/* CEE DCBX std supported values */
167#define CEE_DCBX_MAX_PGS 8 177#define CEE_DCBX_MAX_PGS 8
168#define CEE_DCBX_MAX_PRIO 8 178#define CEE_DCBX_MAX_PRIO 8
@@ -406,6 +416,7 @@ enum ieee_attrs {
406 DCB_ATTR_IEEE_MAXRATE, 416 DCB_ATTR_IEEE_MAXRATE,
407 DCB_ATTR_IEEE_QCN, 417 DCB_ATTR_IEEE_QCN,
408 DCB_ATTR_IEEE_QCN_STATS, 418 DCB_ATTR_IEEE_QCN_STATS,
419 DCB_ATTR_DCB_BUFFER,
409 __DCB_ATTR_IEEE_MAX 420 __DCB_ATTR_IEEE_MAX
410}; 421};
411#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) 422#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 1df65a4c2044..75cb5450c851 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -132,6 +132,16 @@ enum devlink_eswitch_encap_mode {
132 DEVLINK_ESWITCH_ENCAP_MODE_BASIC, 132 DEVLINK_ESWITCH_ENCAP_MODE_BASIC,
133}; 133};
134 134
135enum devlink_port_flavour {
136 DEVLINK_PORT_FLAVOUR_PHYSICAL, /* Any kind of a port physically
137 * facing the user.
138 */
139 DEVLINK_PORT_FLAVOUR_CPU, /* CPU port */
140 DEVLINK_PORT_FLAVOUR_DSA, /* Distributed switch architecture
141 * interconnect port.
142 */
143};
144
135enum devlink_attr { 145enum devlink_attr {
136 /* don't change the order or add anything between, this is ABI! */ 146 /* don't change the order or add anything between, this is ABI! */
137 DEVLINK_ATTR_UNSPEC, 147 DEVLINK_ATTR_UNSPEC,
@@ -224,6 +234,10 @@ enum devlink_attr {
224 DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID, /* u64 */ 234 DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID, /* u64 */
225 DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS,/* u64 */ 235 DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS,/* u64 */
226 236
237 DEVLINK_ATTR_PORT_FLAVOUR, /* u16 */
238 DEVLINK_ATTR_PORT_NUMBER, /* u32 */
239 DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER, /* u32 */
240
227 /* add new attributes above here, update the policy in devlink.c */ 241 /* add new attributes above here, update the policy in devlink.c */
228 242
229 __DEVLINK_ATTR_MAX, 243 __DEVLINK_ATTR_MAX,
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index e2535d6dcec7..4e12c423b9fe 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -421,6 +421,7 @@ typedef struct elf64_shdr {
421#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */ 421#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
422#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */ 422#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */
423#define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */ 423#define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */
424#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */
424 425
425/* Note header in a PT_NOTE section */ 426/* Note header in a PT_NOTE section */
426typedef struct elf32_note { 427typedef struct elf32_note {
diff --git a/include/uapi/linux/if_addr.h b/include/uapi/linux/if_addr.h
index 2ef053d265de..ebaf5701c9db 100644
--- a/include/uapi/linux/if_addr.h
+++ b/include/uapi/linux/if_addr.h
@@ -33,6 +33,7 @@ enum {
33 IFA_CACHEINFO, 33 IFA_CACHEINFO,
34 IFA_MULTICAST, 34 IFA_MULTICAST,
35 IFA_FLAGS, 35 IFA_FLAGS,
36 IFA_RT_PRIORITY, /* u32, priority/metric for prefix route */
36 __IFA_MAX, 37 __IFA_MAX,
37}; 38};
38 39
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 68699f654118..cf01b6824244 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -333,6 +333,7 @@ enum {
333 IFLA_BRPORT_BCAST_FLOOD, 333 IFLA_BRPORT_BCAST_FLOOD,
334 IFLA_BRPORT_GROUP_FWD_MASK, 334 IFLA_BRPORT_GROUP_FWD_MASK,
335 IFLA_BRPORT_NEIGH_SUPPRESS, 335 IFLA_BRPORT_NEIGH_SUPPRESS,
336 IFLA_BRPORT_ISOLATED,
336 __IFLA_BRPORT_MAX 337 __IFLA_BRPORT_MAX
337}; 338};
338#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) 339#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
@@ -516,6 +517,7 @@ enum {
516 IFLA_VXLAN_COLLECT_METADATA, 517 IFLA_VXLAN_COLLECT_METADATA,
517 IFLA_VXLAN_LABEL, 518 IFLA_VXLAN_LABEL,
518 IFLA_VXLAN_GPE, 519 IFLA_VXLAN_GPE,
520 IFLA_VXLAN_TTL_INHERIT,
519 __IFLA_VXLAN_MAX 521 __IFLA_VXLAN_MAX
520}; 522};
521#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) 523#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
diff --git a/include/uapi/linux/if_xdp.h b/include/uapi/linux/if_xdp.h
new file mode 100644
index 000000000000..1fa0e977ea8d
--- /dev/null
+++ b/include/uapi/linux/if_xdp.h
@@ -0,0 +1,78 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * if_xdp: XDP socket user-space interface
4 * Copyright(c) 2018 Intel Corporation.
5 *
6 * Author(s): Björn Töpel <bjorn.topel@intel.com>
7 * Magnus Karlsson <magnus.karlsson@intel.com>
8 */
9
10#ifndef _LINUX_IF_XDP_H
11#define _LINUX_IF_XDP_H
12
13#include <linux/types.h>
14
15/* Options for the sxdp_flags field */
16#define XDP_SHARED_UMEM (1 << 0)
17#define XDP_COPY (1 << 1) /* Force copy-mode */
18#define XDP_ZEROCOPY (1 << 2) /* Force zero-copy mode */
19
20struct sockaddr_xdp {
21 __u16 sxdp_family;
22 __u16 sxdp_flags;
23 __u32 sxdp_ifindex;
24 __u32 sxdp_queue_id;
25 __u32 sxdp_shared_umem_fd;
26};
27
28struct xdp_ring_offset {
29 __u64 producer;
30 __u64 consumer;
31 __u64 desc;
32};
33
34struct xdp_mmap_offsets {
35 struct xdp_ring_offset rx;
36 struct xdp_ring_offset tx;
37 struct xdp_ring_offset fr; /* Fill */
38 struct xdp_ring_offset cr; /* Completion */
39};
40
41/* XDP socket options */
42#define XDP_MMAP_OFFSETS 1
43#define XDP_RX_RING 2
44#define XDP_TX_RING 3
45#define XDP_UMEM_REG 4
46#define XDP_UMEM_FILL_RING 5
47#define XDP_UMEM_COMPLETION_RING 6
48#define XDP_STATISTICS 7
49
50struct xdp_umem_reg {
51 __u64 addr; /* Start of packet data area */
52 __u64 len; /* Length of packet data area */
53 __u32 chunk_size;
54 __u32 headroom;
55};
56
57struct xdp_statistics {
58 __u64 rx_dropped; /* Dropped for reasons other than invalid desc */
59 __u64 rx_invalid_descs; /* Dropped due to invalid descriptor */
60 __u64 tx_invalid_descs; /* Dropped due to invalid descriptor */
61};
62
63/* Pgoff for mmaping the rings */
64#define XDP_PGOFF_RX_RING 0
65#define XDP_PGOFF_TX_RING 0x80000000
66#define XDP_UMEM_PGOFF_FILL_RING 0x100000000
67#define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000
68
69/* Rx/Tx descriptor */
70struct xdp_desc {
71 __u64 addr;
72 __u32 len;
73 __u32 options;
74};
75
76/* UMEM descriptor is __u64 */
77
78#endif /* _LINUX_IF_XDP_H */
diff --git a/include/uapi/linux/netfilter/nf_nat.h b/include/uapi/linux/netfilter/nf_nat.h
index a33000da7229..4a95c0db14d4 100644
--- a/include/uapi/linux/netfilter/nf_nat.h
+++ b/include/uapi/linux/netfilter/nf_nat.h
@@ -10,6 +10,7 @@
10#define NF_NAT_RANGE_PROTO_RANDOM (1 << 2) 10#define NF_NAT_RANGE_PROTO_RANDOM (1 << 2)
11#define NF_NAT_RANGE_PERSISTENT (1 << 3) 11#define NF_NAT_RANGE_PERSISTENT (1 << 3)
12#define NF_NAT_RANGE_PROTO_RANDOM_FULLY (1 << 4) 12#define NF_NAT_RANGE_PROTO_RANDOM_FULLY (1 << 4)
13#define NF_NAT_RANGE_PROTO_OFFSET (1 << 5)
13 14
14#define NF_NAT_RANGE_PROTO_RANDOM_ALL \ 15#define NF_NAT_RANGE_PROTO_RANDOM_ALL \
15 (NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY) 16 (NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY)
@@ -17,7 +18,7 @@
17#define NF_NAT_RANGE_MASK \ 18#define NF_NAT_RANGE_MASK \
18 (NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED | \ 19 (NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED | \
19 NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT | \ 20 NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PERSISTENT | \
20 NF_NAT_RANGE_PROTO_RANDOM_FULLY) 21 NF_NAT_RANGE_PROTO_RANDOM_FULLY | NF_NAT_RANGE_PROTO_OFFSET)
21 22
22struct nf_nat_ipv4_range { 23struct nf_nat_ipv4_range {
23 unsigned int flags; 24 unsigned int flags;
@@ -40,4 +41,13 @@ struct nf_nat_range {
40 union nf_conntrack_man_proto max_proto; 41 union nf_conntrack_man_proto max_proto;
41}; 42};
42 43
44struct nf_nat_range2 {
45 unsigned int flags;
46 union nf_inet_addr min_addr;
47 union nf_inet_addr max_addr;
48 union nf_conntrack_man_proto min_proto;
49 union nf_conntrack_man_proto max_proto;
50 union nf_conntrack_man_proto base_proto;
51};
52
43#endif /* _NETFILTER_NF_NAT_H */ 53#endif /* _NETFILTER_NF_NAT_H */
diff --git a/include/uapi/linux/netfilter/nf_osf.h b/include/uapi/linux/netfilter/nf_osf.h
new file mode 100644
index 000000000000..8f2f2f403183
--- /dev/null
+++ b/include/uapi/linux/netfilter/nf_osf.h
@@ -0,0 +1,86 @@
1#ifndef _NF_OSF_H
2#define _NF_OSF_H
3
4#include <linux/types.h>
5
6#define MAXGENRELEN 32
7
8#define NF_OSF_GENRE (1 << 0)
9#define NF_OSF_TTL (1 << 1)
10#define NF_OSF_LOG (1 << 2)
11#define NF_OSF_INVERT (1 << 3)
12
13#define NF_OSF_LOGLEVEL_ALL 0 /* log all matched fingerprints */
14#define NF_OSF_LOGLEVEL_FIRST 1 /* log only the first matced fingerprint */
15#define NF_OSF_LOGLEVEL_ALL_KNOWN 2 /* do not log unknown packets */
16
17#define NF_OSF_TTL_TRUE 0 /* True ip and fingerprint TTL comparison */
18
19/* Do not compare ip and fingerprint TTL at all */
20#define NF_OSF_TTL_NOCHECK 2
21
22/* Wildcard MSS (kind of).
23 * It is used to implement a state machine for the different wildcard values
24 * of the MSS and window sizes.
25 */
26struct nf_osf_wc {
27 __u32 wc;
28 __u32 val;
29};
30
31/* This struct represents IANA options
32 * http://www.iana.org/assignments/tcp-parameters
33 */
34struct nf_osf_opt {
35 __u16 kind, length;
36 struct nf_osf_wc wc;
37};
38
39struct nf_osf_info {
40 char genre[MAXGENRELEN];
41 __u32 len;
42 __u32 flags;
43 __u32 loglevel;
44 __u32 ttl;
45};
46
47struct nf_osf_user_finger {
48 struct nf_osf_wc wss;
49
50 __u8 ttl, df;
51 __u16 ss, mss;
52 __u16 opt_num;
53
54 char genre[MAXGENRELEN];
55 char version[MAXGENRELEN];
56 char subtype[MAXGENRELEN];
57
58 /* MAX_IPOPTLEN is maximum if all options are NOPs or EOLs */
59 struct nf_osf_opt opt[MAX_IPOPTLEN];
60};
61
62struct nf_osf_nlmsg {
63 struct nf_osf_user_finger f;
64 struct iphdr ip;
65 struct tcphdr tcp;
66};
67
68/* Defines for IANA option kinds */
69enum iana_options {
70 OSFOPT_EOL = 0, /* End of options */
71 OSFOPT_NOP, /* NOP */
72 OSFOPT_MSS, /* Maximum segment size */
73 OSFOPT_WSO, /* Window scale option */
74 OSFOPT_SACKP, /* SACK permitted */
75 OSFOPT_SACK, /* SACK */
76 OSFOPT_ECHO,
77 OSFOPT_ECHOREPLY,
78 OSFOPT_TS, /* Timestamp option */
79 OSFOPT_POCP, /* Partial Order Connection Permitted */
80 OSFOPT_POSP, /* Partial Order Service Profile */
81
82 /* Others are not used in the current OSF */
83 OSFOPT_EMPTY = 255,
84};
85
86#endif /* _NF_OSF_H */
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index 6a3d653d5b27..ae00a3c49b8a 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -831,7 +831,9 @@ enum nft_rt_keys {
831 NFT_RT_NEXTHOP4, 831 NFT_RT_NEXTHOP4,
832 NFT_RT_NEXTHOP6, 832 NFT_RT_NEXTHOP6,
833 NFT_RT_TCPMSS, 833 NFT_RT_TCPMSS,
834 __NFT_RT_MAX
834}; 835};
836#define NFT_RT_MAX (__NFT_RT_MAX - 1)
835 837
836/** 838/**
837 * enum nft_hash_types - nf_tables hash expression types 839 * enum nft_hash_types - nf_tables hash expression types
@@ -854,6 +856,8 @@ enum nft_hash_types {
854 * @NFTA_HASH_SEED: seed value (NLA_U32) 856 * @NFTA_HASH_SEED: seed value (NLA_U32)
855 * @NFTA_HASH_OFFSET: add this offset value to hash result (NLA_U32) 857 * @NFTA_HASH_OFFSET: add this offset value to hash result (NLA_U32)
856 * @NFTA_HASH_TYPE: hash operation (NLA_U32: nft_hash_types) 858 * @NFTA_HASH_TYPE: hash operation (NLA_U32: nft_hash_types)
859 * @NFTA_HASH_SET_NAME: name of the map to lookup (NLA_STRING)
860 * @NFTA_HASH_SET_ID: id of the map (NLA_U32)
857 */ 861 */
858enum nft_hash_attributes { 862enum nft_hash_attributes {
859 NFTA_HASH_UNSPEC, 863 NFTA_HASH_UNSPEC,
@@ -864,6 +868,8 @@ enum nft_hash_attributes {
864 NFTA_HASH_SEED, 868 NFTA_HASH_SEED,
865 NFTA_HASH_OFFSET, 869 NFTA_HASH_OFFSET,
866 NFTA_HASH_TYPE, 870 NFTA_HASH_TYPE,
871 NFTA_HASH_SET_NAME,
872 NFTA_HASH_SET_ID,
867 __NFTA_HASH_MAX, 873 __NFTA_HASH_MAX,
868}; 874};
869#define NFTA_HASH_MAX (__NFTA_HASH_MAX - 1) 875#define NFTA_HASH_MAX (__NFTA_HASH_MAX - 1)
@@ -899,6 +905,31 @@ enum nft_rt_attributes {
899#define NFTA_RT_MAX (__NFTA_RT_MAX - 1) 905#define NFTA_RT_MAX (__NFTA_RT_MAX - 1)
900 906
901/** 907/**
908 * enum nft_socket_attributes - nf_tables socket expression netlink attributes
909 *
910 * @NFTA_SOCKET_KEY: socket key to match
911 * @NFTA_SOCKET_DREG: destination register
912 */
913enum nft_socket_attributes {
914 NFTA_SOCKET_UNSPEC,
915 NFTA_SOCKET_KEY,
916 NFTA_SOCKET_DREG,
917 __NFTA_SOCKET_MAX
918};
919#define NFTA_SOCKET_MAX (__NFTA_SOCKET_MAX - 1)
920
921/*
922 * enum nft_socket_keys - nf_tables socket expression keys
923 *
924 * @NFT_SOCKET_TRANSPARENT: Value of the IP(V6)_TRANSPARENT socket option_
925 */
926enum nft_socket_keys {
927 NFT_SOCKET_TRANSPARENT,
928 __NFT_SOCKET_MAX
929};
930#define NFT_SOCKET_MAX (__NFT_SOCKET_MAX - 1)
931
932/**
902 * enum nft_ct_keys - nf_tables ct expression keys 933 * enum nft_ct_keys - nf_tables ct expression keys
903 * 934 *
904 * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info) 935 * @NFT_CT_STATE: conntrack state (bitmask of enum ip_conntrack_info)
@@ -949,7 +980,9 @@ enum nft_ct_keys {
949 NFT_CT_DST_IP, 980 NFT_CT_DST_IP,
950 NFT_CT_SRC_IP6, 981 NFT_CT_SRC_IP6,
951 NFT_CT_DST_IP6, 982 NFT_CT_DST_IP6,
983 __NFT_CT_MAX
952}; 984};
985#define NFT_CT_MAX (__NFT_CT_MAX - 1)
953 986
954/** 987/**
955 * enum nft_ct_attributes - nf_tables ct expression netlink attributes 988 * enum nft_ct_attributes - nf_tables ct expression netlink attributes
@@ -1010,6 +1043,24 @@ enum nft_limit_attributes {
1010}; 1043};
1011#define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1) 1044#define NFTA_LIMIT_MAX (__NFTA_LIMIT_MAX - 1)
1012 1045
1046enum nft_connlimit_flags {
1047 NFT_CONNLIMIT_F_INV = (1 << 0),
1048};
1049
1050/**
1051 * enum nft_connlimit_attributes - nf_tables connlimit expression netlink attributes
1052 *
1053 * @NFTA_CONNLIMIT_COUNT: number of connections (NLA_U32)
1054 * @NFTA_CONNLIMIT_FLAGS: flags (NLA_U32: enum nft_connlimit_flags)
1055 */
1056enum nft_connlimit_attributes {
1057 NFTA_CONNLIMIT_UNSPEC,
1058 NFTA_CONNLIMIT_COUNT,
1059 NFTA_CONNLIMIT_FLAGS,
1060 __NFTA_CONNLIMIT_MAX
1061};
1062#define NFTA_CONNLIMIT_MAX (__NFTA_CONNLIMIT_MAX - 1)
1063
1013/** 1064/**
1014 * enum nft_counter_attributes - nf_tables counter expression netlink attributes 1065 * enum nft_counter_attributes - nf_tables counter expression netlink attributes
1015 * 1066 *
@@ -1048,6 +1099,11 @@ enum nft_log_attributes {
1048#define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1) 1099#define NFTA_LOG_MAX (__NFTA_LOG_MAX - 1)
1049 1100
1050/** 1101/**
1102 * LOGLEVEL_AUDIT - a pseudo log level enabling audit logging
1103 */
1104#define LOGLEVEL_AUDIT 8
1105
1106/**
1051 * enum nft_queue_attributes - nf_tables queue expression netlink attributes 1107 * enum nft_queue_attributes - nf_tables queue expression netlink attributes
1052 * 1108 *
1053 * @NFTA_QUEUE_NUM: netlink queue to send messages to (NLA_U16) 1109 * @NFTA_QUEUE_NUM: netlink queue to send messages to (NLA_U16)
@@ -1222,10 +1278,14 @@ enum nft_dup_attributes {
1222 * enum nft_fwd_attributes - nf_tables fwd expression netlink attributes 1278 * enum nft_fwd_attributes - nf_tables fwd expression netlink attributes
1223 * 1279 *
1224 * @NFTA_FWD_SREG_DEV: source register of output interface (NLA_U32: nft_register) 1280 * @NFTA_FWD_SREG_DEV: source register of output interface (NLA_U32: nft_register)
1281 * @NFTA_FWD_SREG_ADDR: source register of destination address (NLA_U32: nft_register)
1282 * @NFTA_FWD_NFPROTO: layer 3 family of source register address (NLA_U32: enum nfproto)
1225 */ 1283 */
1226enum nft_fwd_attributes { 1284enum nft_fwd_attributes {
1227 NFTA_FWD_UNSPEC, 1285 NFTA_FWD_UNSPEC,
1228 NFTA_FWD_SREG_DEV, 1286 NFTA_FWD_SREG_DEV,
1287 NFTA_FWD_SREG_ADDR,
1288 NFTA_FWD_NFPROTO,
1229 __NFTA_FWD_MAX 1289 __NFTA_FWD_MAX
1230}; 1290};
1231#define NFTA_FWD_MAX (__NFTA_FWD_MAX - 1) 1291#define NFTA_FWD_MAX (__NFTA_FWD_MAX - 1)
@@ -1315,7 +1375,8 @@ enum nft_ct_helper_attributes {
1315#define NFT_OBJECT_QUOTA 2 1375#define NFT_OBJECT_QUOTA 2
1316#define NFT_OBJECT_CT_HELPER 3 1376#define NFT_OBJECT_CT_HELPER 3
1317#define NFT_OBJECT_LIMIT 4 1377#define NFT_OBJECT_LIMIT 4
1318#define __NFT_OBJECT_MAX 5 1378#define NFT_OBJECT_CONNLIMIT 5
1379#define __NFT_OBJECT_MAX 6
1319#define NFT_OBJECT_MAX (__NFT_OBJECT_MAX - 1) 1380#define NFT_OBJECT_MAX (__NFT_OBJECT_MAX - 1)
1320 1381
1321/** 1382/**
@@ -1450,6 +1511,8 @@ enum nft_trace_types {
1450 * @NFTA_NG_MODULUS: maximum counter value (NLA_U32) 1511 * @NFTA_NG_MODULUS: maximum counter value (NLA_U32)
1451 * @NFTA_NG_TYPE: operation type (NLA_U32) 1512 * @NFTA_NG_TYPE: operation type (NLA_U32)
1452 * @NFTA_NG_OFFSET: offset to be added to the counter (NLA_U32) 1513 * @NFTA_NG_OFFSET: offset to be added to the counter (NLA_U32)
1514 * @NFTA_NG_SET_NAME: name of the map to lookup (NLA_STRING)
1515 * @NFTA_NG_SET_ID: id of the map (NLA_U32)
1453 */ 1516 */
1454enum nft_ng_attributes { 1517enum nft_ng_attributes {
1455 NFTA_NG_UNSPEC, 1518 NFTA_NG_UNSPEC,
@@ -1457,6 +1520,8 @@ enum nft_ng_attributes {
1457 NFTA_NG_MODULUS, 1520 NFTA_NG_MODULUS,
1458 NFTA_NG_TYPE, 1521 NFTA_NG_TYPE,
1459 NFTA_NG_OFFSET, 1522 NFTA_NG_OFFSET,
1523 NFTA_NG_SET_NAME,
1524 NFTA_NG_SET_ID,
1460 __NFTA_NG_MAX 1525 __NFTA_NG_MAX
1461}; 1526};
1462#define NFTA_NG_MAX (__NFTA_NG_MAX - 1) 1527#define NFTA_NG_MAX (__NFTA_NG_MAX - 1)
diff --git a/include/uapi/linux/netfilter/nfnetlink_conntrack.h b/include/uapi/linux/netfilter/nfnetlink_conntrack.h
index 77987111cab0..1d41810d17e2 100644
--- a/include/uapi/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/uapi/linux/netfilter/nfnetlink_conntrack.h
@@ -262,6 +262,7 @@ enum ctattr_stats_cpu {
262enum ctattr_stats_global { 262enum ctattr_stats_global {
263 CTA_STATS_GLOBAL_UNSPEC, 263 CTA_STATS_GLOBAL_UNSPEC,
264 CTA_STATS_GLOBAL_ENTRIES, 264 CTA_STATS_GLOBAL_ENTRIES,
265 CTA_STATS_GLOBAL_MAX_ENTRIES,
265 __CTA_STATS_GLOBAL_MAX, 266 __CTA_STATS_GLOBAL_MAX,
266}; 267};
267#define CTA_STATS_GLOBAL_MAX (__CTA_STATS_GLOBAL_MAX - 1) 268#define CTA_STATS_GLOBAL_MAX (__CTA_STATS_GLOBAL_MAX - 1)
diff --git a/include/uapi/linux/netfilter/xt_osf.h b/include/uapi/linux/netfilter/xt_osf.h
index dad197e2ab99..72956eceeb09 100644
--- a/include/uapi/linux/netfilter/xt_osf.h
+++ b/include/uapi/linux/netfilter/xt_osf.h
@@ -23,101 +23,29 @@
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/ip.h> 24#include <linux/ip.h>
25#include <linux/tcp.h> 25#include <linux/tcp.h>
26#include <linux/netfilter/nf_osf.h>
26 27
27#define MAXGENRELEN 32 28#define XT_OSF_GENRE NF_OSF_GENRE
29#define XT_OSF_INVERT NF_OSF_INVERT
28 30
29#define XT_OSF_GENRE (1<<0) 31#define XT_OSF_TTL NF_OSF_TTL
30#define XT_OSF_TTL (1<<1) 32#define XT_OSF_LOG NF_OSF_LOG
31#define XT_OSF_LOG (1<<2)
32#define XT_OSF_INVERT (1<<3)
33 33
34#define XT_OSF_LOGLEVEL_ALL 0 /* log all matched fingerprints */ 34#define XT_OSF_LOGLEVEL_ALL NF_OSF_LOGLEVEL_ALL
35#define XT_OSF_LOGLEVEL_FIRST 1 /* log only the first matced fingerprint */ 35#define XT_OSF_LOGLEVEL_FIRST NF_OSF_LOGLEVEL_FIRST
36#define XT_OSF_LOGLEVEL_ALL_KNOWN 2 /* do not log unknown packets */ 36#define XT_OSF_LOGLEVEL_ALL_KNOWN NF_OSF_LOGLEVEL_ALL_KNOWN
37 37
38#define XT_OSF_TTL_TRUE 0 /* True ip and fingerprint TTL comparison */ 38#define XT_OSF_TTL_TRUE NF_OSF_TTL_TRUE
39#define XT_OSF_TTL_LESS 1 /* Check if ip TTL is less than fingerprint one */ 39#define XT_OSF_TTL_NOCHECK NF_OSF_TTL_NOCHECK
40#define XT_OSF_TTL_NOCHECK 2 /* Do not compare ip and fingerprint TTL at all */
41 40
42struct xt_osf_info { 41#define XT_OSF_TTL_LESS 1 /* Check if ip TTL is less than fingerprint one */
43 char genre[MAXGENRELEN];
44 __u32 len;
45 __u32 flags;
46 __u32 loglevel;
47 __u32 ttl;
48};
49
50/*
51 * Wildcard MSS (kind of).
52 * It is used to implement a state machine for the different wildcard values
53 * of the MSS and window sizes.
54 */
55struct xt_osf_wc {
56 __u32 wc;
57 __u32 val;
58};
59
60/*
61 * This struct represents IANA options
62 * http://www.iana.org/assignments/tcp-parameters
63 */
64struct xt_osf_opt {
65 __u16 kind, length;
66 struct xt_osf_wc wc;
67};
68
69struct xt_osf_user_finger {
70 struct xt_osf_wc wss;
71
72 __u8 ttl, df;
73 __u16 ss, mss;
74 __u16 opt_num;
75
76 char genre[MAXGENRELEN];
77 char version[MAXGENRELEN];
78 char subtype[MAXGENRELEN];
79 42
80 /* MAX_IPOPTLEN is maximum if all options are NOPs or EOLs */ 43#define xt_osf_wc nf_osf_wc
81 struct xt_osf_opt opt[MAX_IPOPTLEN]; 44#define xt_osf_opt nf_osf_opt
82}; 45#define xt_osf_info nf_osf_info
83 46#define xt_osf_user_finger nf_osf_user_finger
84struct xt_osf_nlmsg { 47#define xt_osf_finger nf_osf_finger
85 struct xt_osf_user_finger f; 48#define xt_osf_nlmsg nf_osf_nlmsg
86 struct iphdr ip;
87 struct tcphdr tcp;
88};
89
90/* Defines for IANA option kinds */
91
92enum iana_options {
93 OSFOPT_EOL = 0, /* End of options */
94 OSFOPT_NOP, /* NOP */
95 OSFOPT_MSS, /* Maximum segment size */
96 OSFOPT_WSO, /* Window scale option */
97 OSFOPT_SACKP, /* SACK permitted */
98 OSFOPT_SACK, /* SACK */
99 OSFOPT_ECHO,
100 OSFOPT_ECHOREPLY,
101 OSFOPT_TS, /* Timestamp option */
102 OSFOPT_POCP, /* Partial Order Connection Permitted */
103 OSFOPT_POSP, /* Partial Order Service Profile */
104
105 /* Others are not used in the current OSF */
106 OSFOPT_EMPTY = 255,
107};
108
109/*
110 * Initial window size option state machine: multiple of mss, mtu or
111 * plain numeric value. Can also be made as plain numeric value which
112 * is not a multiple of specified value.
113 */
114enum xt_osf_window_size_options {
115 OSF_WSS_PLAIN = 0,
116 OSF_WSS_MSS,
117 OSF_WSS_MTU,
118 OSF_WSS_MODULO,
119 OSF_WSS_MAX,
120};
121 49
122/* 50/*
123 * Add/remove fingerprint from the kernel. 51 * Add/remove fingerprint from the kernel.
diff --git a/include/uapi/linux/netfilter_bridge/ebtables.h b/include/uapi/linux/netfilter_bridge/ebtables.h
index 0c7dc8315013..3b86c14ea49d 100644
--- a/include/uapi/linux/netfilter_bridge/ebtables.h
+++ b/include/uapi/linux/netfilter_bridge/ebtables.h
@@ -191,6 +191,12 @@ struct ebt_entry {
191 unsigned char elems[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); 191 unsigned char elems[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
192}; 192};
193 193
194static __inline__ struct ebt_entry_target *
195ebt_get_target(struct ebt_entry *e)
196{
197 return (void *)e + e->target_offset;
198}
199
194/* {g,s}etsockopt numbers */ 200/* {g,s}etsockopt numbers */
195#define EBT_BASE_CTL 128 201#define EBT_BASE_CTL 128
196 202
diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_srh.h b/include/uapi/linux/netfilter_ipv6/ip6t_srh.h
index f3cc0ef514a7..54ed83360dac 100644
--- a/include/uapi/linux/netfilter_ipv6/ip6t_srh.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_srh.h
@@ -17,7 +17,10 @@
17#define IP6T_SRH_LAST_GT 0x0100 17#define IP6T_SRH_LAST_GT 0x0100
18#define IP6T_SRH_LAST_LT 0x0200 18#define IP6T_SRH_LAST_LT 0x0200
19#define IP6T_SRH_TAG 0x0400 19#define IP6T_SRH_TAG 0x0400
20#define IP6T_SRH_MASK 0x07FF 20#define IP6T_SRH_PSID 0x0800
21#define IP6T_SRH_NSID 0x1000
22#define IP6T_SRH_LSID 0x2000
23#define IP6T_SRH_MASK 0x3FFF
21 24
22/* Values for "mt_invflags" field in struct ip6t_srh */ 25/* Values for "mt_invflags" field in struct ip6t_srh */
23#define IP6T_SRH_INV_NEXTHDR 0x0001 26#define IP6T_SRH_INV_NEXTHDR 0x0001
@@ -31,7 +34,10 @@
31#define IP6T_SRH_INV_LAST_GT 0x0100 34#define IP6T_SRH_INV_LAST_GT 0x0100
32#define IP6T_SRH_INV_LAST_LT 0x0200 35#define IP6T_SRH_INV_LAST_LT 0x0200
33#define IP6T_SRH_INV_TAG 0x0400 36#define IP6T_SRH_INV_TAG 0x0400
34#define IP6T_SRH_INV_MASK 0x07FF 37#define IP6T_SRH_INV_PSID 0x0800
38#define IP6T_SRH_INV_NSID 0x1000
39#define IP6T_SRH_INV_LSID 0x2000
40#define IP6T_SRH_INV_MASK 0x3FFF
35 41
36/** 42/**
37 * struct ip6t_srh - SRH match options 43 * struct ip6t_srh - SRH match options
@@ -54,4 +60,37 @@ struct ip6t_srh {
54 __u16 mt_invflags; 60 __u16 mt_invflags;
55}; 61};
56 62
63/**
64 * struct ip6t_srh1 - SRH match options (revision 1)
65 * @ next_hdr: Next header field of SRH
66 * @ hdr_len: Extension header length field of SRH
67 * @ segs_left: Segments left field of SRH
68 * @ last_entry: Last entry field of SRH
69 * @ tag: Tag field of SRH
70 * @ psid_addr: Address of previous SID in SRH SID list
71 * @ nsid_addr: Address of NEXT SID in SRH SID list
72 * @ lsid_addr: Address of LAST SID in SRH SID list
73 * @ psid_msk: Mask of previous SID in SRH SID list
74 * @ nsid_msk: Mask of next SID in SRH SID list
75 * @ lsid_msk: MAsk of last SID in SRH SID list
76 * @ mt_flags: match options
77 * @ mt_invflags: Invert the sense of match options
78 */
79
80struct ip6t_srh1 {
81 __u8 next_hdr;
82 __u8 hdr_len;
83 __u8 segs_left;
84 __u8 last_entry;
85 __u16 tag;
86 struct in6_addr psid_addr;
87 struct in6_addr nsid_addr;
88 struct in6_addr lsid_addr;
89 struct in6_addr psid_msk;
90 struct in6_addr nsid_msk;
91 struct in6_addr lsid_msk;
92 __u16 mt_flags;
93 __u16 mt_invflags;
94};
95
57#endif /*_IP6T_SRH_H*/ 96#endif /*_IP6T_SRH_H*/
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 271b93783d28..28b36545de24 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -11,6 +11,7 @@
11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> 11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
12 * Copyright 2008 Colin McCabe <colin@cozybit.com> 12 * Copyright 2008 Colin McCabe <colin@cozybit.com>
13 * Copyright 2015-2017 Intel Deutschland GmbH 13 * Copyright 2015-2017 Intel Deutschland GmbH
14 * Copyright (C) 2018 Intel Corporation
14 * 15 *
15 * Permission to use, copy, modify, and/or distribute this software for any 16 * Permission to use, copy, modify, and/or distribute this software for any
16 * purpose with or without fee is hereby granted, provided that the above 17 * purpose with or without fee is hereby granted, provided that the above
@@ -203,7 +204,8 @@
203 * FILS shared key authentication offload should be able to construct the 204 * FILS shared key authentication offload should be able to construct the
204 * authentication and association frames for FILS shared key authentication and 205 * authentication and association frames for FILS shared key authentication and
205 * eventually do a key derivation as per IEEE 802.11ai. The below additional 206 * eventually do a key derivation as per IEEE 802.11ai. The below additional
206 * parameters should be given to driver in %NL80211_CMD_CONNECT. 207 * parameters should be given to driver in %NL80211_CMD_CONNECT and/or in
208 * %NL80211_CMD_UPDATE_CONNECT_PARAMS.
207 * %NL80211_ATTR_FILS_ERP_USERNAME - used to construct keyname_nai 209 * %NL80211_ATTR_FILS_ERP_USERNAME - used to construct keyname_nai
208 * %NL80211_ATTR_FILS_ERP_REALM - used to construct keyname_nai 210 * %NL80211_ATTR_FILS_ERP_REALM - used to construct keyname_nai
209 * %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used to construct erp message 211 * %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used to construct erp message
@@ -214,7 +216,8 @@
214 * as specified in IETF RFC 6696. 216 * as specified in IETF RFC 6696.
215 * 217 *
216 * When FILS shared key authentication is completed, driver needs to provide the 218 * When FILS shared key authentication is completed, driver needs to provide the
217 * below additional parameters to userspace. 219 * below additional parameters to userspace, which can be either after setting
220 * up a connection or after roaming.
218 * %NL80211_ATTR_FILS_KEK - used for key renewal 221 * %NL80211_ATTR_FILS_KEK - used for key renewal
219 * %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used in further EAP-RP exchanges 222 * %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used in further EAP-RP exchanges
220 * %NL80211_ATTR_PMKID - used to identify the PMKSA used/generated 223 * %NL80211_ATTR_PMKID - used to identify the PMKSA used/generated
@@ -2225,6 +2228,16 @@ enum nl80211_commands {
2225 * @NL80211_ATTR_NSS: Station's New/updated RX_NSS value notified using this 2228 * @NL80211_ATTR_NSS: Station's New/updated RX_NSS value notified using this
2226 * u8 attribute. This is used with %NL80211_CMD_STA_OPMODE_CHANGED. 2229 * u8 attribute. This is used with %NL80211_CMD_STA_OPMODE_CHANGED.
2227 * 2230 *
2231 * @NL80211_ATTR_TXQ_STATS: TXQ statistics (nested attribute, see &enum
2232 * nl80211_txq_stats)
2233 * @NL80211_ATTR_TXQ_LIMIT: Total packet limit for the TXQ queues for this phy.
2234 * The smaller of this and the memory limit is enforced.
2235 * @NL80211_ATTR_TXQ_MEMORY_LIMIT: Total memory memory limit (in bytes) for the
2236 * TXQ queues for this phy. The smaller of this and the packet limit is
2237 * enforced.
2238 * @NL80211_ATTR_TXQ_QUANTUM: TXQ scheduler quantum (bytes). Number of bytes
2239 * a flow is assigned on each round of the DRR scheduler.
2240 *
2228 * @NUM_NL80211_ATTR: total number of nl80211_attrs available 2241 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
2229 * @NL80211_ATTR_MAX: highest attribute number currently defined 2242 * @NL80211_ATTR_MAX: highest attribute number currently defined
2230 * @__NL80211_ATTR_AFTER_LAST: internal use 2243 * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2659,6 +2672,11 @@ enum nl80211_attrs {
2659 2672
2660 NL80211_ATTR_CONTROL_PORT_OVER_NL80211, 2673 NL80211_ATTR_CONTROL_PORT_OVER_NL80211,
2661 2674
2675 NL80211_ATTR_TXQ_STATS,
2676 NL80211_ATTR_TXQ_LIMIT,
2677 NL80211_ATTR_TXQ_MEMORY_LIMIT,
2678 NL80211_ATTR_TXQ_QUANTUM,
2679
2662 /* add attributes here, update the policy in nl80211.c */ 2680 /* add attributes here, update the policy in nl80211.c */
2663 2681
2664 __NL80211_ATTR_AFTER_LAST, 2682 __NL80211_ATTR_AFTER_LAST,
@@ -2982,6 +3000,8 @@ enum nl80211_sta_bss_param {
2982 * received from the station (u64, usec) 3000 * received from the station (u64, usec)
2983 * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment 3001 * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
2984 * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm) 3002 * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm)
3003 * @NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG: avg signal strength of (data)
3004 * ACK frame (s8, dBm)
2985 * @__NL80211_STA_INFO_AFTER_LAST: internal 3005 * @__NL80211_STA_INFO_AFTER_LAST: internal
2986 * @NL80211_STA_INFO_MAX: highest possible station info attribute 3006 * @NL80211_STA_INFO_MAX: highest possible station info attribute
2987 */ 3007 */
@@ -3021,6 +3041,7 @@ enum nl80211_sta_info {
3021 NL80211_STA_INFO_RX_DURATION, 3041 NL80211_STA_INFO_RX_DURATION,
3022 NL80211_STA_INFO_PAD, 3042 NL80211_STA_INFO_PAD,
3023 NL80211_STA_INFO_ACK_SIGNAL, 3043 NL80211_STA_INFO_ACK_SIGNAL,
3044 NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG,
3024 3045
3025 /* keep last */ 3046 /* keep last */
3026 __NL80211_STA_INFO_AFTER_LAST, 3047 __NL80211_STA_INFO_AFTER_LAST,
@@ -3038,6 +3059,7 @@ enum nl80211_sta_info {
3038 * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted 3059 * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted
3039 * MSDUs (u64) 3060 * MSDUs (u64)
3040 * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment 3061 * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment
3062 * @NL80211_TID_STATS_TXQ_STATS: TXQ stats (nested attribute)
3041 * @NUM_NL80211_TID_STATS: number of attributes here 3063 * @NUM_NL80211_TID_STATS: number of attributes here
3042 * @NL80211_TID_STATS_MAX: highest numbered attribute here 3064 * @NL80211_TID_STATS_MAX: highest numbered attribute here
3043 */ 3065 */
@@ -3048,6 +3070,7 @@ enum nl80211_tid_stats {
3048 NL80211_TID_STATS_TX_MSDU_RETRIES, 3070 NL80211_TID_STATS_TX_MSDU_RETRIES,
3049 NL80211_TID_STATS_TX_MSDU_FAILED, 3071 NL80211_TID_STATS_TX_MSDU_FAILED,
3050 NL80211_TID_STATS_PAD, 3072 NL80211_TID_STATS_PAD,
3073 NL80211_TID_STATS_TXQ_STATS,
3051 3074
3052 /* keep last */ 3075 /* keep last */
3053 NUM_NL80211_TID_STATS, 3076 NUM_NL80211_TID_STATS,
@@ -3055,6 +3078,44 @@ enum nl80211_tid_stats {
3055}; 3078};
3056 3079
3057/** 3080/**
3081 * enum nl80211_txq_stats - per TXQ statistics attributes
3082 * @__NL80211_TXQ_STATS_INVALID: attribute number 0 is reserved
3083 * @NUM_NL80211_TXQ_STATS: number of attributes here
3084 * @NL80211_TXQ_STATS_BACKLOG_BYTES: number of bytes currently backlogged
3085 * @NL80211_TXQ_STATS_BACKLOG_PACKETS: number of packets currently
3086 * backlogged
3087 * @NL80211_TXQ_STATS_FLOWS: total number of new flows seen
3088 * @NL80211_TXQ_STATS_DROPS: total number of packet drops
3089 * @NL80211_TXQ_STATS_ECN_MARKS: total number of packet ECN marks
3090 * @NL80211_TXQ_STATS_OVERLIMIT: number of drops due to queue space overflow
3091 * @NL80211_TXQ_STATS_OVERMEMORY: number of drops due to memory limit overflow
3092 * (only for per-phy stats)
3093 * @NL80211_TXQ_STATS_COLLISIONS: number of hash collisions
3094 * @NL80211_TXQ_STATS_TX_BYTES: total number of bytes dequeued from TXQ
3095 * @NL80211_TXQ_STATS_TX_PACKETS: total number of packets dequeued from TXQ
3096 * @NL80211_TXQ_STATS_MAX_FLOWS: number of flow buckets for PHY
3097 * @NL80211_TXQ_STATS_MAX: highest numbered attribute here
3098 */
3099enum nl80211_txq_stats {
3100 __NL80211_TXQ_STATS_INVALID,
3101 NL80211_TXQ_STATS_BACKLOG_BYTES,
3102 NL80211_TXQ_STATS_BACKLOG_PACKETS,
3103 NL80211_TXQ_STATS_FLOWS,
3104 NL80211_TXQ_STATS_DROPS,
3105 NL80211_TXQ_STATS_ECN_MARKS,
3106 NL80211_TXQ_STATS_OVERLIMIT,
3107 NL80211_TXQ_STATS_OVERMEMORY,
3108 NL80211_TXQ_STATS_COLLISIONS,
3109 NL80211_TXQ_STATS_TX_BYTES,
3110 NL80211_TXQ_STATS_TX_PACKETS,
3111 NL80211_TXQ_STATS_MAX_FLOWS,
3112
3113 /* keep last */
3114 NUM_NL80211_TXQ_STATS,
3115 NL80211_TXQ_STATS_MAX = NUM_NL80211_TXQ_STATS - 1
3116};
3117
3118/**
3058 * enum nl80211_mpath_flags - nl80211 mesh path flags 3119 * enum nl80211_mpath_flags - nl80211 mesh path flags
3059 * 3120 *
3060 * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active 3121 * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active
@@ -3144,6 +3205,29 @@ enum nl80211_band_attr {
3144#define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA 3205#define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA
3145 3206
3146/** 3207/**
3208 * enum nl80211_wmm_rule - regulatory wmm rule
3209 *
3210 * @__NL80211_WMMR_INVALID: attribute number 0 is reserved
3211 * @NL80211_WMMR_CW_MIN: Minimum contention window slot.
3212 * @NL80211_WMMR_CW_MAX: Maximum contention window slot.
3213 * @NL80211_WMMR_AIFSN: Arbitration Inter Frame Space.
3214 * @NL80211_WMMR_TXOP: Maximum allowed tx operation time.
3215 * @nl80211_WMMR_MAX: highest possible wmm rule.
3216 * @__NL80211_WMMR_LAST: Internal use.
3217 */
3218enum nl80211_wmm_rule {
3219 __NL80211_WMMR_INVALID,
3220 NL80211_WMMR_CW_MIN,
3221 NL80211_WMMR_CW_MAX,
3222 NL80211_WMMR_AIFSN,
3223 NL80211_WMMR_TXOP,
3224
3225 /* keep last */
3226 __NL80211_WMMR_LAST,
3227 NL80211_WMMR_MAX = __NL80211_WMMR_LAST - 1
3228};
3229
3230/**
3147 * enum nl80211_frequency_attr - frequency attributes 3231 * enum nl80211_frequency_attr - frequency attributes
3148 * @__NL80211_FREQUENCY_ATTR_INVALID: attribute number 0 is reserved 3232 * @__NL80211_FREQUENCY_ATTR_INVALID: attribute number 0 is reserved
3149 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz 3233 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
@@ -3192,6 +3276,9 @@ enum nl80211_band_attr {
3192 * on this channel in current regulatory domain. 3276 * on this channel in current regulatory domain.
3193 * @NL80211_FREQUENCY_ATTR_NO_10MHZ: 10 MHz operation is not allowed 3277 * @NL80211_FREQUENCY_ATTR_NO_10MHZ: 10 MHz operation is not allowed
3194 * on this channel in current regulatory domain. 3278 * on this channel in current regulatory domain.
3279 * @NL80211_FREQUENCY_ATTR_WMM: this channel has wmm limitations.
3280 * This is a nested attribute that contains the wmm limitation per AC.
3281 * (see &enum nl80211_wmm_rule)
3195 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number 3282 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
3196 * currently defined 3283 * currently defined
3197 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use 3284 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -3220,6 +3307,7 @@ enum nl80211_frequency_attr {
3220 NL80211_FREQUENCY_ATTR_IR_CONCURRENT, 3307 NL80211_FREQUENCY_ATTR_IR_CONCURRENT,
3221 NL80211_FREQUENCY_ATTR_NO_20MHZ, 3308 NL80211_FREQUENCY_ATTR_NO_20MHZ,
3222 NL80211_FREQUENCY_ATTR_NO_10MHZ, 3309 NL80211_FREQUENCY_ATTR_NO_10MHZ,
3310 NL80211_FREQUENCY_ATTR_WMM,
3223 3311
3224 /* keep last */ 3312 /* keep last */
3225 __NL80211_FREQUENCY_ATTR_AFTER_LAST, 3313 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -5040,6 +5128,11 @@ enum nl80211_feature_flags {
5040 * "radar detected" event. 5128 * "radar detected" event.
5041 * @NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211: Driver supports sending and 5129 * @NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211: Driver supports sending and
5042 * receiving control port frames over nl80211 instead of the netdevice. 5130 * receiving control port frames over nl80211 instead of the netdevice.
5131 * @NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT: This Driver support data ack
5132 * rssi if firmware support, this flag is to intimate about ack rssi
5133 * support to nl80211.
5134 * @NL80211_EXT_FEATURE_TXQS: Driver supports FQ-CoDel-enabled intermediate
5135 * TXQs.
5043 * 5136 *
5044 * @NUM_NL80211_EXT_FEATURES: number of extended features. 5137 * @NUM_NL80211_EXT_FEATURES: number of extended features.
5045 * @MAX_NL80211_EXT_FEATURES: highest extended feature index. 5138 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -5072,6 +5165,8 @@ enum nl80211_ext_feature_index {
5072 NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN, 5165 NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN,
5073 NL80211_EXT_FEATURE_DFS_OFFLOAD, 5166 NL80211_EXT_FEATURE_DFS_OFFLOAD,
5074 NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211, 5167 NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211,
5168 NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT,
5169 NL80211_EXT_FEATURE_TXQS,
5075 5170
5076 /* add new features before the definition below */ 5171 /* add new features before the definition below */
5077 NUM_NL80211_EXT_FEATURES, 5172 NUM_NL80211_EXT_FEATURES,
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 713e56ce681f..863aabaa5cc9 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -937,4 +937,32 @@ enum ovs_meter_band_type {
937 937
938#define OVS_METER_BAND_TYPE_MAX (__OVS_METER_BAND_TYPE_MAX - 1) 938#define OVS_METER_BAND_TYPE_MAX (__OVS_METER_BAND_TYPE_MAX - 1)
939 939
940/* Conntrack limit */
941#define OVS_CT_LIMIT_FAMILY "ovs_ct_limit"
942#define OVS_CT_LIMIT_MCGROUP "ovs_ct_limit"
943#define OVS_CT_LIMIT_VERSION 0x1
944
945enum ovs_ct_limit_cmd {
946 OVS_CT_LIMIT_CMD_UNSPEC,
947 OVS_CT_LIMIT_CMD_SET, /* Add or modify ct limit. */
948 OVS_CT_LIMIT_CMD_DEL, /* Delete ct limit. */
949 OVS_CT_LIMIT_CMD_GET /* Get ct limit. */
950};
951
952enum ovs_ct_limit_attr {
953 OVS_CT_LIMIT_ATTR_UNSPEC,
954 OVS_CT_LIMIT_ATTR_ZONE_LIMIT, /* Nested struct ovs_zone_limit. */
955 __OVS_CT_LIMIT_ATTR_MAX
956};
957
958#define OVS_CT_LIMIT_ATTR_MAX (__OVS_CT_LIMIT_ATTR_MAX - 1)
959
960#define OVS_ZONE_LIMIT_DEFAULT_ZONE -1
961
962struct ovs_zone_limit {
963 int zone_id;
964 __u32 limit;
965 __u32 count;
966};
967
940#endif /* _LINUX_OPENVSWITCH_H */ 968#endif /* _LINUX_OPENVSWITCH_H */
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 103ba797a8f3..83ade9b5cf95 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -506,6 +506,8 @@
506#define PCI_EXP_DEVCTL_READRQ_256B 0x1000 /* 256 Bytes */ 506#define PCI_EXP_DEVCTL_READRQ_256B 0x1000 /* 256 Bytes */
507#define PCI_EXP_DEVCTL_READRQ_512B 0x2000 /* 512 Bytes */ 507#define PCI_EXP_DEVCTL_READRQ_512B 0x2000 /* 512 Bytes */
508#define PCI_EXP_DEVCTL_READRQ_1024B 0x3000 /* 1024 Bytes */ 508#define PCI_EXP_DEVCTL_READRQ_1024B 0x3000 /* 1024 Bytes */
509#define PCI_EXP_DEVCTL_READRQ_2048B 0x4000 /* 2048 Bytes */
510#define PCI_EXP_DEVCTL_READRQ_4096B 0x5000 /* 4096 Bytes */
509#define PCI_EXP_DEVCTL_BCR_FLR 0x8000 /* Bridge Configuration Retry / FLR */ 511#define PCI_EXP_DEVCTL_BCR_FLR 0x8000 /* Bridge Configuration Retry / FLR */
510#define PCI_EXP_DEVSTA 10 /* Device Status */ 512#define PCI_EXP_DEVSTA 10 /* Device Status */
511#define PCI_EXP_DEVSTA_CED 0x0001 /* Correctable Error Detected */ 513#define PCI_EXP_DEVSTA_CED 0x0001 /* Correctable Error Detected */
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index be05e66c167b..84e4c1d0f874 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -129,6 +129,7 @@ enum {
129#define TCA_CLS_FLAGS_SKIP_SW (1 << 1) /* don't use filter in SW */ 129#define TCA_CLS_FLAGS_SKIP_SW (1 << 1) /* don't use filter in SW */
130#define TCA_CLS_FLAGS_IN_HW (1 << 2) /* filter is offloaded to HW */ 130#define TCA_CLS_FLAGS_IN_HW (1 << 2) /* filter is offloaded to HW */
131#define TCA_CLS_FLAGS_NOT_IN_HW (1 << 3) /* filter isn't offloaded to HW */ 131#define TCA_CLS_FLAGS_NOT_IN_HW (1 << 3) /* filter isn't offloaded to HW */
132#define TCA_CLS_FLAGS_VERBOSE (1 << 4) /* verbose logging */
132 133
133/* U32 filters */ 134/* U32 filters */
134 135
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
index 9b15005955fa..7d8502313c99 100644
--- a/include/uapi/linux/rtnetlink.h
+++ b/include/uapi/linux/rtnetlink.h
@@ -254,6 +254,11 @@ enum {
254#define RTPROT_DHCP 16 /* DHCP client */ 254#define RTPROT_DHCP 16 /* DHCP client */
255#define RTPROT_MROUTED 17 /* Multicast daemon */ 255#define RTPROT_MROUTED 17 /* Multicast daemon */
256#define RTPROT_BABEL 42 /* Babel daemon */ 256#define RTPROT_BABEL 42 /* Babel daemon */
257#define RTPROT_BGP 186 /* BGP Routes */
258#define RTPROT_ISIS 187 /* ISIS Routes */
259#define RTPROT_OSPF 188 /* OSPF Routes */
260#define RTPROT_RIP 189 /* RIP Routes */
261#define RTPROT_EIGRP 192 /* EIGRP Routes */
257 262
258/* rtm_scope 263/* rtm_scope
259 264
@@ -327,6 +332,9 @@ enum rtattr_type_t {
327 RTA_PAD, 332 RTA_PAD,
328 RTA_UID, 333 RTA_UID,
329 RTA_TTL_PROPAGATE, 334 RTA_TTL_PROPAGATE,
335 RTA_IP_PROTO,
336 RTA_SPORT,
337 RTA_DPORT,
330 __RTA_MAX 338 __RTA_MAX
331}; 339};
332 340
diff --git a/include/uapi/linux/seg6_local.h b/include/uapi/linux/seg6_local.h
index ef2d8c3e76c1..edc138bdc56d 100644
--- a/include/uapi/linux/seg6_local.h
+++ b/include/uapi/linux/seg6_local.h
@@ -25,6 +25,7 @@ enum {
25 SEG6_LOCAL_NH6, 25 SEG6_LOCAL_NH6,
26 SEG6_LOCAL_IIF, 26 SEG6_LOCAL_IIF,
27 SEG6_LOCAL_OIF, 27 SEG6_LOCAL_OIF,
28 SEG6_LOCAL_BPF,
28 __SEG6_LOCAL_MAX, 29 __SEG6_LOCAL_MAX,
29}; 30};
30#define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1) 31#define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1)
@@ -59,10 +60,21 @@ enum {
59 SEG6_LOCAL_ACTION_END_AS = 13, 60 SEG6_LOCAL_ACTION_END_AS = 13,
60 /* forward to SR-unaware VNF with masquerading */ 61 /* forward to SR-unaware VNF with masquerading */
61 SEG6_LOCAL_ACTION_END_AM = 14, 62 SEG6_LOCAL_ACTION_END_AM = 14,
63 /* custom BPF action */
64 SEG6_LOCAL_ACTION_END_BPF = 15,
62 65
63 __SEG6_LOCAL_ACTION_MAX, 66 __SEG6_LOCAL_ACTION_MAX,
64}; 67};
65 68
66#define SEG6_LOCAL_ACTION_MAX (__SEG6_LOCAL_ACTION_MAX - 1) 69#define SEG6_LOCAL_ACTION_MAX (__SEG6_LOCAL_ACTION_MAX - 1)
67 70
71enum {
72 SEG6_LOCAL_BPF_PROG_UNSPEC,
73 SEG6_LOCAL_BPF_PROG,
74 SEG6_LOCAL_BPF_PROG_NAME,
75 __SEG6_LOCAL_BPF_PROG_MAX,
76};
77
78#define SEG6_LOCAL_BPF_PROG_MAX (__SEG6_LOCAL_BPF_PROG_MAX - 1)
79
68#endif 80#endif
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h
index 33a70ece462f..750d89120335 100644
--- a/include/uapi/linux/snmp.h
+++ b/include/uapi/linux/snmp.h
@@ -276,6 +276,9 @@ enum
276 LINUX_MIB_TCPKEEPALIVE, /* TCPKeepAlive */ 276 LINUX_MIB_TCPKEEPALIVE, /* TCPKeepAlive */
277 LINUX_MIB_TCPMTUPFAIL, /* TCPMTUPFail */ 277 LINUX_MIB_TCPMTUPFAIL, /* TCPMTUPFail */
278 LINUX_MIB_TCPMTUPSUCCESS, /* TCPMTUPSuccess */ 278 LINUX_MIB_TCPMTUPSUCCESS, /* TCPMTUPSuccess */
279 LINUX_MIB_TCPDELIVERED, /* TCPDelivered */
280 LINUX_MIB_TCPDELIVEREDCE, /* TCPDeliveredCE */
281 LINUX_MIB_TCPACKCOMPRESSED, /* TCPAckCompressed */
279 __LINUX_MIB_MAX 282 __LINUX_MIB_MAX
280}; 283};
281 284
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index 560374c978f9..29eb659aa77a 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -122,6 +122,10 @@ enum {
122#define TCP_MD5SIG_EXT 32 /* TCP MD5 Signature with extensions */ 122#define TCP_MD5SIG_EXT 32 /* TCP MD5 Signature with extensions */
123#define TCP_FASTOPEN_KEY 33 /* Set the key for Fast Open (cookie) */ 123#define TCP_FASTOPEN_KEY 33 /* Set the key for Fast Open (cookie) */
124#define TCP_FASTOPEN_NO_COOKIE 34 /* Enable TFO without a TFO cookie */ 124#define TCP_FASTOPEN_NO_COOKIE 34 /* Enable TFO without a TFO cookie */
125#define TCP_ZEROCOPY_RECEIVE 35
126#define TCP_INQ 36 /* Notify bytes available to read as a cmsg on read */
127
128#define TCP_CM_INQ TCP_INQ
125 129
126struct tcp_repair_opt { 130struct tcp_repair_opt {
127 __u32 opt_code; 131 __u32 opt_code;
@@ -224,6 +228,9 @@ struct tcp_info {
224 __u64 tcpi_busy_time; /* Time (usec) busy sending data */ 228 __u64 tcpi_busy_time; /* Time (usec) busy sending data */
225 __u64 tcpi_rwnd_limited; /* Time (usec) limited by receive window */ 229 __u64 tcpi_rwnd_limited; /* Time (usec) limited by receive window */
226 __u64 tcpi_sndbuf_limited; /* Time (usec) limited by send buffer */ 230 __u64 tcpi_sndbuf_limited; /* Time (usec) limited by send buffer */
231
232 __u32 tcpi_delivered;
233 __u32 tcpi_delivered_ce;
227}; 234};
228 235
229/* netlink attributes types for SCM_TIMESTAMPING_OPT_STATS */ 236/* netlink attributes types for SCM_TIMESTAMPING_OPT_STATS */
@@ -244,6 +251,8 @@ enum {
244 TCP_NLA_SNDQ_SIZE, /* Data (bytes) pending in send queue */ 251 TCP_NLA_SNDQ_SIZE, /* Data (bytes) pending in send queue */
245 TCP_NLA_CA_STATE, /* ca_state of socket */ 252 TCP_NLA_CA_STATE, /* ca_state of socket */
246 TCP_NLA_SND_SSTHRESH, /* Slow start size threshold */ 253 TCP_NLA_SND_SSTHRESH, /* Slow start size threshold */
254 TCP_NLA_DELIVERED, /* Data pkts delivered incl. out-of-order */
255 TCP_NLA_DELIVERED_CE, /* Like above but only ones w/ CE marks */
247 256
248}; 257};
249 258
@@ -271,4 +280,11 @@ struct tcp_diag_md5sig {
271 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; 280 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN];
272}; 281};
273 282
283/* setsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE, ...) */
284
285struct tcp_zerocopy_receive {
286 __u64 address; /* in: address of mapping */
287 __u32 length; /* in/out: number of bytes to map/mapped */
288 __u32 recv_skip_hint; /* out: amount of bytes to skip */
289};
274#endif /* _UAPI_LINUX_TCP_H */ 290#endif /* _UAPI_LINUX_TCP_H */
diff --git a/include/uapi/linux/tipc.h b/include/uapi/linux/tipc.h
index bf6d28677cfe..6b2fd4d9655f 100644
--- a/include/uapi/linux/tipc.h
+++ b/include/uapi/linux/tipc.h
@@ -209,16 +209,16 @@ struct tipc_group_req {
209 * The string formatting for each name element is: 209 * The string formatting for each name element is:
210 * media: media 210 * media: media
211 * interface: media:interface name 211 * interface: media:interface name
212 * link: Z.C.N:interface-Z.C.N:interface 212 * link: node:interface-node:interface
213 *
214 */ 213 */
215 214#define TIPC_NODEID_LEN 16
216#define TIPC_MAX_MEDIA_NAME 16 215#define TIPC_MAX_MEDIA_NAME 16
217#define TIPC_MAX_IF_NAME 16 216#define TIPC_MAX_IF_NAME 16
218#define TIPC_MAX_BEARER_NAME 32 217#define TIPC_MAX_BEARER_NAME 32
219#define TIPC_MAX_LINK_NAME 68 218#define TIPC_MAX_LINK_NAME 68
220 219
221#define SIOCGETLINKNAME SIOCPROTOPRIVATE 220#define SIOCGETLINKNAME SIOCPROTOPRIVATE
221#define SIOCGETNODEID (SIOCPROTOPRIVATE + 1)
222 222
223struct tipc_sioc_ln_req { 223struct tipc_sioc_ln_req {
224 __u32 peer; 224 __u32 peer;
@@ -226,6 +226,10 @@ struct tipc_sioc_ln_req {
226 char linkname[TIPC_MAX_LINK_NAME]; 226 char linkname[TIPC_MAX_LINK_NAME];
227}; 227};
228 228
229struct tipc_sioc_nodeid_req {
230 __u32 peer;
231 char node_id[TIPC_NODEID_LEN];
232};
229 233
230/* The macros and functions below are deprecated: 234/* The macros and functions below are deprecated:
231 */ 235 */
diff --git a/include/uapi/linux/tipc_config.h b/include/uapi/linux/tipc_config.h
index 3f29e3c8ed06..4b2c93b1934c 100644
--- a/include/uapi/linux/tipc_config.h
+++ b/include/uapi/linux/tipc_config.h
@@ -185,6 +185,11 @@
185#define TIPC_DEF_LINK_WIN 50 185#define TIPC_DEF_LINK_WIN 50
186#define TIPC_MAX_LINK_WIN 8191 186#define TIPC_MAX_LINK_WIN 8191
187 187
188/*
189 * Default MTU for UDP media
190 */
191
192#define TIPC_DEF_LINK_UDP_MTU 14000
188 193
189struct tipc_node_info { 194struct tipc_node_info {
190 __be32 addr; /* network address of node */ 195 __be32 addr; /* network address of node */
diff --git a/include/uapi/linux/tipc_netlink.h b/include/uapi/linux/tipc_netlink.h
index 0affb682e5e3..85c11982c89b 100644
--- a/include/uapi/linux/tipc_netlink.h
+++ b/include/uapi/linux/tipc_netlink.h
@@ -266,6 +266,7 @@ enum {
266 TIPC_NLA_PROP_PRIO, /* u32 */ 266 TIPC_NLA_PROP_PRIO, /* u32 */
267 TIPC_NLA_PROP_TOL, /* u32 */ 267 TIPC_NLA_PROP_TOL, /* u32 */
268 TIPC_NLA_PROP_WIN, /* u32 */ 268 TIPC_NLA_PROP_WIN, /* u32 */
269 TIPC_NLA_PROP_MTU, /* u32 */
269 270
270 __TIPC_NLA_PROP_MAX, 271 __TIPC_NLA_PROP_MAX,
271 TIPC_NLA_PROP_MAX = __TIPC_NLA_PROP_MAX - 1 272 TIPC_NLA_PROP_MAX = __TIPC_NLA_PROP_MAX - 1
diff --git a/include/uapi/linux/udp.h b/include/uapi/linux/udp.h
index efb7b5991c2f..09d00f8c442b 100644
--- a/include/uapi/linux/udp.h
+++ b/include/uapi/linux/udp.h
@@ -32,6 +32,7 @@ struct udphdr {
32#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ 32#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
33#define UDP_NO_CHECK6_TX 101 /* Disable sending checksum for UDP6X */ 33#define UDP_NO_CHECK6_TX 101 /* Disable sending checksum for UDP6X */
34#define UDP_NO_CHECK6_RX 102 /* Disable accpeting checksum for UDP6 */ 34#define UDP_NO_CHECK6_RX 102 /* Disable accpeting checksum for UDP6 */
35#define UDP_SEGMENT 103 /* Set GSO segmentation size */
35 36
36/* UDP encapsulation types */ 37/* UDP encapsulation types */
37#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */ 38#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index 5de6ed37695b..a3715a3224c1 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -57,6 +57,9 @@
57 * Steering */ 57 * Steering */
58#define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */ 58#define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
59 59
60#define VIRTIO_NET_F_STANDBY 62 /* Act as standby for another device
61 * with the same MAC.
62 */
60#define VIRTIO_NET_F_SPEED_DUPLEX 63 /* Device set linkspeed and duplex */ 63#define VIRTIO_NET_F_SPEED_DUPLEX 63 /* Device set linkspeed and duplex */
61 64
62#ifndef VIRTIO_NET_NO_LEGACY 65#ifndef VIRTIO_NET_NO_LEGACY
diff --git a/include/uapi/linux/vmcore.h b/include/uapi/linux/vmcore.h
new file mode 100644
index 000000000000..022619668e0e
--- /dev/null
+++ b/include/uapi/linux/vmcore.h
@@ -0,0 +1,18 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _UAPI_VMCORE_H
3#define _UAPI_VMCORE_H
4
5#include <linux/types.h>
6
7#define VMCOREDD_NOTE_NAME "LINUX"
8#define VMCOREDD_MAX_NAME_BYTES 44
9
10struct vmcoredd_header {
11 __u32 n_namesz; /* Name size */
12 __u32 n_descsz; /* Content size */
13 __u32 n_type; /* NT_VMCOREDD */
14 __u8 name[8]; /* LINUX\0\0\0 */
15 __u8 dump_name[VMCOREDD_MAX_NAME_BYTES]; /* Device dump's name */
16};
17
18#endif /* _UAPI_VMCORE_H */