aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/include/uapi/asm/Kbuild2
-rw-r--r--arch/arc/include/uapi/asm/Kbuild1
-rw-r--r--arch/arm/include/uapi/asm/Kbuild1
-rw-r--r--arch/arm64/include/asm/perf_event.h2
-rw-r--r--arch/arm64/include/uapi/asm/bpf_perf_event.h9
-rw-r--r--arch/blackfin/include/uapi/asm/Kbuild1
-rw-r--r--arch/c6x/include/uapi/asm/Kbuild1
-rw-r--r--arch/cris/include/uapi/asm/Kbuild1
-rw-r--r--arch/frv/include/uapi/asm/Kbuild2
-rw-r--r--arch/h8300/include/uapi/asm/Kbuild1
-rw-r--r--arch/hexagon/include/uapi/asm/Kbuild1
-rw-r--r--arch/ia64/include/uapi/asm/Kbuild1
-rw-r--r--arch/m32r/include/uapi/asm/Kbuild1
-rw-r--r--arch/m68k/include/uapi/asm/Kbuild1
-rw-r--r--arch/metag/include/uapi/asm/Kbuild1
-rw-r--r--arch/microblaze/include/uapi/asm/Kbuild1
-rw-r--r--arch/mips/include/uapi/asm/Kbuild1
-rw-r--r--arch/mn10300/include/uapi/asm/Kbuild1
-rw-r--r--arch/nios2/include/uapi/asm/Kbuild1
-rw-r--r--arch/openrisc/include/uapi/asm/Kbuild1
-rw-r--r--arch/parisc/include/uapi/asm/Kbuild1
-rw-r--r--arch/powerpc/include/uapi/asm/Kbuild1
-rw-r--r--arch/riscv/include/uapi/asm/Kbuild1
-rw-r--r--arch/s390/include/asm/perf_event.h1
-rw-r--r--arch/s390/include/asm/ptrace.h11
-rw-r--r--arch/s390/include/uapi/asm/bpf_perf_event.h9
-rw-r--r--arch/s390/include/uapi/asm/ptrace.h125
-rw-r--r--arch/score/include/uapi/asm/Kbuild1
-rw-r--r--arch/sh/include/uapi/asm/Kbuild1
-rw-r--r--arch/sparc/include/uapi/asm/Kbuild1
-rw-r--r--arch/tile/include/uapi/asm/Kbuild1
-rw-r--r--arch/unicore32/include/uapi/asm/Kbuild1
-rw-r--r--arch/x86/include/uapi/asm/Kbuild1
-rw-r--r--arch/xtensa/include/uapi/asm/Kbuild1
-rw-r--r--drivers/net/can/peak_canfd/peak_canfd.c9
-rw-r--r--drivers/net/can/usb/ems_usb.c2
-rw-r--r--drivers/net/can/usb/esd_usb2.c2
-rw-r--r--drivers/net/can/usb/kvaser_usb.c2
-rw-r--r--drivers/net/can/usb/mcba_usb.c1
-rw-r--r--drivers/net/can/usb/usb_8dev.c2
-rw-r--r--drivers/net/dsa/bcm_sf2.c1
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c34
-rw-r--r--drivers/net/ethernet/arc/emac_rockchip.c7
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.c4
-rw-r--r--drivers/net/ethernet/cavium/thunder/nicvf_queues.c2
-rw-r--r--drivers/net/ethernet/freescale/gianfar.c11
-rw-r--r--drivers/net/ethernet/marvell/mvmdio.c3
-rw-r--r--drivers/net/ethernet/marvell/mvpp2.c2
-rw-r--r--drivers/net/ethernet/netronome/nfp/nfp_net_repr.c15
-rw-r--r--drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c1
-rw-r--r--drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c8
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c31
-rw-r--r--drivers/net/ethernet/sfc/tx.c5
-rw-r--r--drivers/net/usb/qmi_wwan.c2
-rw-r--r--drivers/net/usb/usbnet.c5
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c4
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/txq.h4
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/dbg.h2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-trans.h4
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mvm.h3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/ops.c1
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c18
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/sta.c53
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/time-event.c24
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/tx.c3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/utils.c13
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/drv.c2
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/trans.c10
-rw-r--r--drivers/net/xen-netback/interface.c2
-rw-r--r--drivers/staging/lustre/lnet/lnet/lib-socket.c8
-rw-r--r--include/linux/perf_event.h6
-rw-r--r--include/linux/rculist_nulls.h38
-rw-r--r--include/linux/tcp.h3
-rw-r--r--include/linux/usb/usbnet.h1
-rw-r--r--include/net/red.h13
-rw-r--r--include/net/sock.h6
-rw-r--r--include/net/tcp.h2
-rw-r--r--include/uapi/asm-generic/bpf_perf_event.h9
-rw-r--r--include/uapi/linux/bpf_perf_event.h5
-rw-r--r--kernel/events/core.c2
-rw-r--r--lib/nlattr.c22
-rw-r--r--net/9p/trans_fd.c1
-rw-r--r--net/core/dev.c2
-rw-r--r--net/dccp/proto.c5
-rw-r--r--net/ipv4/inet_timewait_sock.c6
-rw-r--r--net/ipv4/tcp.c1
-rw-r--r--net/ipv4/tcp_bbr.c12
-rw-r--r--net/ipv4/tcp_input.c12
-rw-r--r--net/ipv4/tcp_rate.c10
-rw-r--r--net/ipv4/tcp_recovery.c28
-rw-r--r--net/ipv6/ip6_tunnel.c2
-rw-r--r--net/kcm/kcmsock.c68
-rw-r--r--net/rds/rdma.c2
-rw-r--r--net/sched/sch_choke.c3
-rw-r--r--net/sched/sch_generic.c3
-rw-r--r--net/sched/sch_gred.c3
-rw-r--r--net/sched/sch_red.c2
-rw-r--r--net/sched/sch_sfq.c3
-rw-r--r--net/sctp/socket.c1
-rw-r--r--net/socket.c110
-rw-r--r--net/tipc/server.c3
-rw-r--r--net/vmw_vsock/hyperv_transport.c2
-rw-r--r--tools/arch/arm64/include/uapi/asm/bpf_perf_event.h9
-rw-r--r--tools/arch/s390/include/uapi/asm/bpf_perf_event.h9
-rw-r--r--tools/arch/s390/include/uapi/asm/ptrace.h457
-rw-r--r--tools/include/uapi/asm-generic/bpf_perf_event.h9
-rw-r--r--tools/include/uapi/linux/bpf_perf_event.h6
-rw-r--r--tools/perf/arch/s390/Makefile1
-rw-r--r--tools/perf/arch/s390/util/dwarf-regs.c32
-rwxr-xr-xtools/perf/check-headers.sh1
-rw-r--r--tools/testing/selftests/bpf/Makefile14
113 files changed, 1052 insertions, 367 deletions
diff --git a/arch/alpha/include/uapi/asm/Kbuild b/arch/alpha/include/uapi/asm/Kbuild
index b15bf6bc0e94..14a2e9af97e9 100644
--- a/arch/alpha/include/uapi/asm/Kbuild
+++ b/arch/alpha/include/uapi/asm/Kbuild
@@ -1,2 +1,4 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3
4generic-y += bpf_perf_event.h
diff --git a/arch/arc/include/uapi/asm/Kbuild b/arch/arc/include/uapi/asm/Kbuild
index fa6d0ff4ff89..170b5db64afe 100644
--- a/arch/arc/include/uapi/asm/Kbuild
+++ b/arch/arc/include/uapi/asm/Kbuild
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bitsperlong.h 5generic-y += bitsperlong.h
6generic-y += bpf_perf_event.h
6generic-y += errno.h 7generic-y += errno.h
7generic-y += fcntl.h 8generic-y += fcntl.h
8generic-y += ioctl.h 9generic-y += ioctl.h
diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild
index 4d53de308ee0..4d1cc1847edf 100644
--- a/arch/arm/include/uapi/asm/Kbuild
+++ b/arch/arm/include/uapi/asm/Kbuild
@@ -7,6 +7,7 @@ generated-y += unistd-oabi.h
7generated-y += unistd-eabi.h 7generated-y += unistd-eabi.h
8 8
9generic-y += bitsperlong.h 9generic-y += bitsperlong.h
10generic-y += bpf_perf_event.h
10generic-y += errno.h 11generic-y += errno.h
11generic-y += ioctl.h 12generic-y += ioctl.h
12generic-y += ipcbuf.h 13generic-y += ipcbuf.h
diff --git a/arch/arm64/include/asm/perf_event.h b/arch/arm64/include/asm/perf_event.h
index 8d5cbec17d80..f9ccc36d3dc3 100644
--- a/arch/arm64/include/asm/perf_event.h
+++ b/arch/arm64/include/asm/perf_event.h
@@ -18,6 +18,7 @@
18#define __ASM_PERF_EVENT_H 18#define __ASM_PERF_EVENT_H
19 19
20#include <asm/stack_pointer.h> 20#include <asm/stack_pointer.h>
21#include <asm/ptrace.h>
21 22
22#define ARMV8_PMU_MAX_COUNTERS 32 23#define ARMV8_PMU_MAX_COUNTERS 32
23#define ARMV8_PMU_COUNTER_MASK (ARMV8_PMU_MAX_COUNTERS - 1) 24#define ARMV8_PMU_COUNTER_MASK (ARMV8_PMU_MAX_COUNTERS - 1)
@@ -79,6 +80,7 @@ struct pt_regs;
79extern unsigned long perf_instruction_pointer(struct pt_regs *regs); 80extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
80extern unsigned long perf_misc_flags(struct pt_regs *regs); 81extern unsigned long perf_misc_flags(struct pt_regs *regs);
81#define perf_misc_flags(regs) perf_misc_flags(regs) 82#define perf_misc_flags(regs) perf_misc_flags(regs)
83#define perf_arch_bpf_user_pt_regs(regs) &regs->user_regs
82#endif 84#endif
83 85
84#define perf_arch_fetch_caller_regs(regs, __ip) { \ 86#define perf_arch_fetch_caller_regs(regs, __ip) { \
diff --git a/arch/arm64/include/uapi/asm/bpf_perf_event.h b/arch/arm64/include/uapi/asm/bpf_perf_event.h
new file mode 100644
index 000000000000..b551b741653d
--- /dev/null
+++ b/arch/arm64/include/uapi/asm/bpf_perf_event.h
@@ -0,0 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
3#define _UAPI__ASM_BPF_PERF_EVENT_H__
4
5#include <asm/ptrace.h>
6
7typedef struct user_pt_regs bpf_user_pt_regs_t;
8
9#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */
diff --git a/arch/blackfin/include/uapi/asm/Kbuild b/arch/blackfin/include/uapi/asm/Kbuild
index aa624b4ab655..2240b38c2915 100644
--- a/arch/blackfin/include/uapi/asm/Kbuild
+++ b/arch/blackfin/include/uapi/asm/Kbuild
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bitsperlong.h 5generic-y += bitsperlong.h
6generic-y += bpf_perf_event.h
6generic-y += errno.h 7generic-y += errno.h
7generic-y += ioctl.h 8generic-y += ioctl.h
8generic-y += ipcbuf.h 9generic-y += ipcbuf.h
diff --git a/arch/c6x/include/uapi/asm/Kbuild b/arch/c6x/include/uapi/asm/Kbuild
index 67ee896a76a7..26644e15d854 100644
--- a/arch/c6x/include/uapi/asm/Kbuild
+++ b/arch/c6x/include/uapi/asm/Kbuild
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bitsperlong.h 5generic-y += bitsperlong.h
6generic-y += bpf_perf_event.h
6generic-y += errno.h 7generic-y += errno.h
7generic-y += fcntl.h 8generic-y += fcntl.h
8generic-y += ioctl.h 9generic-y += ioctl.h
diff --git a/arch/cris/include/uapi/asm/Kbuild b/arch/cris/include/uapi/asm/Kbuild
index 3687b54bb18e..3470c6e9c7b9 100644
--- a/arch/cris/include/uapi/asm/Kbuild
+++ b/arch/cris/include/uapi/asm/Kbuild
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bitsperlong.h 5generic-y += bitsperlong.h
6generic-y += bpf_perf_event.h
6generic-y += errno.h 7generic-y += errno.h
7generic-y += fcntl.h 8generic-y += fcntl.h
8generic-y += ioctl.h 9generic-y += ioctl.h
diff --git a/arch/frv/include/uapi/asm/Kbuild b/arch/frv/include/uapi/asm/Kbuild
index b15bf6bc0e94..14a2e9af97e9 100644
--- a/arch/frv/include/uapi/asm/Kbuild
+++ b/arch/frv/include/uapi/asm/Kbuild
@@ -1,2 +1,4 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3
4generic-y += bpf_perf_event.h
diff --git a/arch/h8300/include/uapi/asm/Kbuild b/arch/h8300/include/uapi/asm/Kbuild
index 187aed820e71..2f65f78792cb 100644
--- a/arch/h8300/include/uapi/asm/Kbuild
+++ b/arch/h8300/include/uapi/asm/Kbuild
@@ -2,6 +2,7 @@
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bpf_perf_event.h
5generic-y += errno.h 6generic-y += errno.h
6generic-y += fcntl.h 7generic-y += fcntl.h
7generic-y += ioctl.h 8generic-y += ioctl.h
diff --git a/arch/hexagon/include/uapi/asm/Kbuild b/arch/hexagon/include/uapi/asm/Kbuild
index cb5df3aad3a8..41a176dbb53e 100644
--- a/arch/hexagon/include/uapi/asm/Kbuild
+++ b/arch/hexagon/include/uapi/asm/Kbuild
@@ -2,6 +2,7 @@
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bpf_perf_event.h
5generic-y += errno.h 6generic-y += errno.h
6generic-y += fcntl.h 7generic-y += fcntl.h
7generic-y += ioctl.h 8generic-y += ioctl.h
diff --git a/arch/ia64/include/uapi/asm/Kbuild b/arch/ia64/include/uapi/asm/Kbuild
index 13a97aa2285f..f5c6967a93bb 100644
--- a/arch/ia64/include/uapi/asm/Kbuild
+++ b/arch/ia64/include/uapi/asm/Kbuild
@@ -1,4 +1,5 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bpf_perf_event.h
4generic-y += kvm_para.h 5generic-y += kvm_para.h
diff --git a/arch/m32r/include/uapi/asm/Kbuild b/arch/m32r/include/uapi/asm/Kbuild
index 1c44d3b3eba0..451bf6071c6e 100644
--- a/arch/m32r/include/uapi/asm/Kbuild
+++ b/arch/m32r/include/uapi/asm/Kbuild
@@ -1,5 +1,6 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bpf_perf_event.h
4generic-y += kvm_para.h 5generic-y += kvm_para.h
5generic-y += siginfo.h 6generic-y += siginfo.h
diff --git a/arch/m68k/include/uapi/asm/Kbuild b/arch/m68k/include/uapi/asm/Kbuild
index 3717b64a620d..c2e26a44c482 100644
--- a/arch/m68k/include/uapi/asm/Kbuild
+++ b/arch/m68k/include/uapi/asm/Kbuild
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bitsperlong.h 5generic-y += bitsperlong.h
6generic-y += bpf_perf_event.h
6generic-y += errno.h 7generic-y += errno.h
7generic-y += ioctl.h 8generic-y += ioctl.h
8generic-y += ipcbuf.h 9generic-y += ipcbuf.h
diff --git a/arch/metag/include/uapi/asm/Kbuild b/arch/metag/include/uapi/asm/Kbuild
index 6ac763d9a3e3..f9eaf07d29f8 100644
--- a/arch/metag/include/uapi/asm/Kbuild
+++ b/arch/metag/include/uapi/asm/Kbuild
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bitsperlong.h 5generic-y += bitsperlong.h
6generic-y += bpf_perf_event.h
6generic-y += errno.h 7generic-y += errno.h
7generic-y += fcntl.h 8generic-y += fcntl.h
8generic-y += ioctl.h 9generic-y += ioctl.h
diff --git a/arch/microblaze/include/uapi/asm/Kbuild b/arch/microblaze/include/uapi/asm/Kbuild
index 06609ca36115..2c6a6bffea32 100644
--- a/arch/microblaze/include/uapi/asm/Kbuild
+++ b/arch/microblaze/include/uapi/asm/Kbuild
@@ -2,6 +2,7 @@
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bitsperlong.h 4generic-y += bitsperlong.h
5generic-y += bpf_perf_event.h
5generic-y += errno.h 6generic-y += errno.h
6generic-y += fcntl.h 7generic-y += fcntl.h
7generic-y += ioctl.h 8generic-y += ioctl.h
diff --git a/arch/mips/include/uapi/asm/Kbuild b/arch/mips/include/uapi/asm/Kbuild
index a0266feba9e6..7a4becd8963a 100644
--- a/arch/mips/include/uapi/asm/Kbuild
+++ b/arch/mips/include/uapi/asm/Kbuild
@@ -1,4 +1,5 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bpf_perf_event.h
4generic-y += ipcbuf.h 5generic-y += ipcbuf.h
diff --git a/arch/mn10300/include/uapi/asm/Kbuild b/arch/mn10300/include/uapi/asm/Kbuild
index c94ee54210bc..81271d3af47c 100644
--- a/arch/mn10300/include/uapi/asm/Kbuild
+++ b/arch/mn10300/include/uapi/asm/Kbuild
@@ -1,4 +1,5 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bpf_perf_event.h
4generic-y += siginfo.h 5generic-y += siginfo.h
diff --git a/arch/nios2/include/uapi/asm/Kbuild b/arch/nios2/include/uapi/asm/Kbuild
index ffca24da7647..13a3d77b4d7b 100644
--- a/arch/nios2/include/uapi/asm/Kbuild
+++ b/arch/nios2/include/uapi/asm/Kbuild
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bitsperlong.h 5generic-y += bitsperlong.h
6generic-y += bpf_perf_event.h
6generic-y += errno.h 7generic-y += errno.h
7generic-y += fcntl.h 8generic-y += fcntl.h
8generic-y += ioctl.h 9generic-y += ioctl.h
diff --git a/arch/openrisc/include/uapi/asm/Kbuild b/arch/openrisc/include/uapi/asm/Kbuild
index 62286dbeb904..130c16ccba0a 100644
--- a/arch/openrisc/include/uapi/asm/Kbuild
+++ b/arch/openrisc/include/uapi/asm/Kbuild
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bitsperlong.h 5generic-y += bitsperlong.h
6generic-y += bpf_perf_event.h
6generic-y += errno.h 7generic-y += errno.h
7generic-y += fcntl.h 8generic-y += fcntl.h
8generic-y += ioctl.h 9generic-y += ioctl.h
diff --git a/arch/parisc/include/uapi/asm/Kbuild b/arch/parisc/include/uapi/asm/Kbuild
index 196d2a4efb31..286ef5a5904b 100644
--- a/arch/parisc/include/uapi/asm/Kbuild
+++ b/arch/parisc/include/uapi/asm/Kbuild
@@ -2,6 +2,7 @@
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bpf_perf_event.h
5generic-y += kvm_para.h 6generic-y += kvm_para.h
6generic-y += param.h 7generic-y += param.h
7generic-y += poll.h 8generic-y += poll.h
diff --git a/arch/powerpc/include/uapi/asm/Kbuild b/arch/powerpc/include/uapi/asm/Kbuild
index 0d960ef78a9a..1a6ed5919ffd 100644
--- a/arch/powerpc/include/uapi/asm/Kbuild
+++ b/arch/powerpc/include/uapi/asm/Kbuild
@@ -1,6 +1,7 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bpf_perf_event.h
4generic-y += param.h 5generic-y += param.h
5generic-y += poll.h 6generic-y += poll.h
6generic-y += resource.h 7generic-y += resource.h
diff --git a/arch/riscv/include/uapi/asm/Kbuild b/arch/riscv/include/uapi/asm/Kbuild
index 5ded96b06352..7e91f4850475 100644
--- a/arch/riscv/include/uapi/asm/Kbuild
+++ b/arch/riscv/include/uapi/asm/Kbuild
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += setup.h 4generic-y += setup.h
5generic-y += unistd.h 5generic-y += unistd.h
6generic-y += bpf_perf_event.h
6generic-y += errno.h 7generic-y += errno.h
7generic-y += fcntl.h 8generic-y += fcntl.h
8generic-y += ioctl.h 9generic-y += ioctl.h
diff --git a/arch/s390/include/asm/perf_event.h b/arch/s390/include/asm/perf_event.h
index d6c9d1e0dc2d..b9c0e361748b 100644
--- a/arch/s390/include/asm/perf_event.h
+++ b/arch/s390/include/asm/perf_event.h
@@ -40,6 +40,7 @@ struct pt_regs;
40extern unsigned long perf_instruction_pointer(struct pt_regs *regs); 40extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
41extern unsigned long perf_misc_flags(struct pt_regs *regs); 41extern unsigned long perf_misc_flags(struct pt_regs *regs);
42#define perf_misc_flags(regs) perf_misc_flags(regs) 42#define perf_misc_flags(regs) perf_misc_flags(regs)
43#define perf_arch_bpf_user_pt_regs(regs) &regs->user_regs
43 44
44/* Perf pt_regs extension for sample-data-entry indicators */ 45/* Perf pt_regs extension for sample-data-entry indicators */
45struct perf_sf_sde_regs { 46struct perf_sf_sde_regs {
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
index a3788dafc0e1..6f70d81c40f2 100644
--- a/arch/s390/include/asm/ptrace.h
+++ b/arch/s390/include/asm/ptrace.h
@@ -74,9 +74,14 @@ enum {
74 */ 74 */
75struct pt_regs 75struct pt_regs
76{ 76{
77 unsigned long args[1]; 77 union {
78 psw_t psw; 78 user_pt_regs user_regs;
79 unsigned long gprs[NUM_GPRS]; 79 struct {
80 unsigned long args[1];
81 psw_t psw;
82 unsigned long gprs[NUM_GPRS];
83 };
84 };
80 unsigned long orig_gpr2; 85 unsigned long orig_gpr2;
81 unsigned int int_code; 86 unsigned int int_code;
82 unsigned int int_parm; 87 unsigned int int_parm;
diff --git a/arch/s390/include/uapi/asm/bpf_perf_event.h b/arch/s390/include/uapi/asm/bpf_perf_event.h
new file mode 100644
index 000000000000..cefe7c7cd4f6
--- /dev/null
+++ b/arch/s390/include/uapi/asm/bpf_perf_event.h
@@ -0,0 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
3#define _UAPI__ASM_BPF_PERF_EVENT_H__
4
5#include <asm/ptrace.h>
6
7typedef user_pt_regs bpf_user_pt_regs_t;
8
9#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */
diff --git a/arch/s390/include/uapi/asm/ptrace.h b/arch/s390/include/uapi/asm/ptrace.h
index 0d23c8ff2900..543dd70e12c8 100644
--- a/arch/s390/include/uapi/asm/ptrace.h
+++ b/arch/s390/include/uapi/asm/ptrace.h
@@ -162,7 +162,7 @@
162#define GPR_SIZE 8 162#define GPR_SIZE 8
163#define CR_SIZE 8 163#define CR_SIZE 8
164 164
165#define STACK_FRAME_OVERHEAD 160 /* size of minimum stack frame */ 165#define STACK_FRAME_OVERHEAD 160 /* size of minimum stack frame */
166 166
167#endif /* __s390x__ */ 167#endif /* __s390x__ */
168 168
@@ -179,17 +179,16 @@
179#define ACR_SIZE 4 179#define ACR_SIZE 4
180 180
181 181
182#define PTRACE_OLDSETOPTIONS 21 182#define PTRACE_OLDSETOPTIONS 21
183 183
184#ifndef __ASSEMBLY__ 184#ifndef __ASSEMBLY__
185#include <linux/stddef.h> 185#include <linux/stddef.h>
186#include <linux/types.h> 186#include <linux/types.h>
187 187
188typedef union 188typedef union {
189{ 189 float f;
190 float f; 190 double d;
191 double d; 191 __u64 ui;
192 __u64 ui;
193 struct 192 struct
194 { 193 {
195 __u32 hi; 194 __u32 hi;
@@ -197,23 +196,21 @@ typedef union
197 } fp; 196 } fp;
198} freg_t; 197} freg_t;
199 198
200typedef struct 199typedef struct {
201{ 200 __u32 fpc;
202 __u32 fpc;
203 __u32 pad; 201 __u32 pad;
204 freg_t fprs[NUM_FPRS]; 202 freg_t fprs[NUM_FPRS];
205} s390_fp_regs; 203} s390_fp_regs;
206 204
207#define FPC_EXCEPTION_MASK 0xF8000000 205#define FPC_EXCEPTION_MASK 0xF8000000
208#define FPC_FLAGS_MASK 0x00F80000 206#define FPC_FLAGS_MASK 0x00F80000
209#define FPC_DXC_MASK 0x0000FF00 207#define FPC_DXC_MASK 0x0000FF00
210#define FPC_RM_MASK 0x00000003 208#define FPC_RM_MASK 0x00000003
211 209
212/* this typedef defines how a Program Status Word looks like */ 210/* this typedef defines how a Program Status Word looks like */
213typedef struct 211typedef struct {
214{ 212 unsigned long mask;
215 unsigned long mask; 213 unsigned long addr;
216 unsigned long addr;
217} __attribute__ ((aligned(8))) psw_t; 214} __attribute__ ((aligned(8))) psw_t;
218 215
219#ifndef __s390x__ 216#ifndef __s390x__
@@ -282,8 +279,7 @@ typedef struct
282/* 279/*
283 * The s390_regs structure is used to define the elf_gregset_t. 280 * The s390_regs structure is used to define the elf_gregset_t.
284 */ 281 */
285typedef struct 282typedef struct {
286{
287 psw_t psw; 283 psw_t psw;
288 unsigned long gprs[NUM_GPRS]; 284 unsigned long gprs[NUM_GPRS];
289 unsigned int acrs[NUM_ACRS]; 285 unsigned int acrs[NUM_ACRS];
@@ -291,24 +287,32 @@ typedef struct
291} s390_regs; 287} s390_regs;
292 288
293/* 289/*
290 * The user_pt_regs structure exports the beginning of
291 * the in-kernel pt_regs structure to user space.
292 */
293typedef struct {
294 unsigned long args[1];
295 psw_t psw;
296 unsigned long gprs[NUM_GPRS];
297} user_pt_regs;
298
299/*
294 * Now for the user space program event recording (trace) definitions. 300 * Now for the user space program event recording (trace) definitions.
295 * The following structures are used only for the ptrace interface, don't 301 * The following structures are used only for the ptrace interface, don't
296 * touch or even look at it if you don't want to modify the user-space 302 * touch or even look at it if you don't want to modify the user-space
297 * ptrace interface. In particular stay away from it for in-kernel PER. 303 * ptrace interface. In particular stay away from it for in-kernel PER.
298 */ 304 */
299typedef struct 305typedef struct {
300{
301 unsigned long cr[NUM_CR_WORDS]; 306 unsigned long cr[NUM_CR_WORDS];
302} per_cr_words; 307} per_cr_words;
303 308
304#define PER_EM_MASK 0xE8000000UL 309#define PER_EM_MASK 0xE8000000UL
305 310
306typedef struct 311typedef struct {
307{
308#ifdef __s390x__ 312#ifdef __s390x__
309 unsigned : 32; 313 unsigned : 32;
310#endif /* __s390x__ */ 314#endif /* __s390x__ */
311 unsigned em_branching : 1; 315 unsigned em_branching : 1;
312 unsigned em_instruction_fetch : 1; 316 unsigned em_instruction_fetch : 1;
313 /* 317 /*
314 * Switching on storage alteration automatically fixes 318 * Switching on storage alteration automatically fixes
@@ -317,44 +321,41 @@ typedef struct
317 unsigned em_storage_alteration : 1; 321 unsigned em_storage_alteration : 1;
318 unsigned em_gpr_alt_unused : 1; 322 unsigned em_gpr_alt_unused : 1;
319 unsigned em_store_real_address : 1; 323 unsigned em_store_real_address : 1;
320 unsigned : 3; 324 unsigned : 3;
321 unsigned branch_addr_ctl : 1; 325 unsigned branch_addr_ctl : 1;
322 unsigned : 1; 326 unsigned : 1;
323 unsigned storage_alt_space_ctl : 1; 327 unsigned storage_alt_space_ctl : 1;
324 unsigned : 21; 328 unsigned : 21;
325 unsigned long starting_addr; 329 unsigned long starting_addr;
326 unsigned long ending_addr; 330 unsigned long ending_addr;
327} per_cr_bits; 331} per_cr_bits;
328 332
329typedef struct 333typedef struct {
330{
331 unsigned short perc_atmid; 334 unsigned short perc_atmid;
332 unsigned long address; 335 unsigned long address;
333 unsigned char access_id; 336 unsigned char access_id;
334} per_lowcore_words; 337} per_lowcore_words;
335 338
336typedef struct 339typedef struct {
337{ 340 unsigned perc_branching : 1;
338 unsigned perc_branching : 1;
339 unsigned perc_instruction_fetch : 1; 341 unsigned perc_instruction_fetch : 1;
340 unsigned perc_storage_alteration : 1; 342 unsigned perc_storage_alteration : 1;
341 unsigned perc_gpr_alt_unused : 1; 343 unsigned perc_gpr_alt_unused : 1;
342 unsigned perc_store_real_address : 1; 344 unsigned perc_store_real_address : 1;
343 unsigned : 3; 345 unsigned : 3;
344 unsigned atmid_psw_bit_31 : 1; 346 unsigned atmid_psw_bit_31 : 1;
345 unsigned atmid_validity_bit : 1; 347 unsigned atmid_validity_bit : 1;
346 unsigned atmid_psw_bit_32 : 1; 348 unsigned atmid_psw_bit_32 : 1;
347 unsigned atmid_psw_bit_5 : 1; 349 unsigned atmid_psw_bit_5 : 1;
348 unsigned atmid_psw_bit_16 : 1; 350 unsigned atmid_psw_bit_16 : 1;
349 unsigned atmid_psw_bit_17 : 1; 351 unsigned atmid_psw_bit_17 : 1;
350 unsigned si : 2; 352 unsigned si : 2;
351 unsigned long address; 353 unsigned long address;
352 unsigned : 4; 354 unsigned : 4;
353 unsigned access_id : 4; 355 unsigned access_id : 4;
354} per_lowcore_bits; 356} per_lowcore_bits;
355 357
356typedef struct 358typedef struct {
357{
358 union { 359 union {
359 per_cr_words words; 360 per_cr_words words;
360 per_cr_bits bits; 361 per_cr_bits bits;
@@ -364,9 +365,9 @@ typedef struct
364 * the kernel always sets them to zero. To enable single 365 * the kernel always sets them to zero. To enable single
365 * stepping use ptrace(PTRACE_SINGLESTEP) instead. 366 * stepping use ptrace(PTRACE_SINGLESTEP) instead.
366 */ 367 */
367 unsigned single_step : 1; 368 unsigned single_step : 1;
368 unsigned instruction_fetch : 1; 369 unsigned instruction_fetch : 1;
369 unsigned : 30; 370 unsigned : 30;
370 /* 371 /*
371 * These addresses are copied into cr10 & cr11 if single 372 * These addresses are copied into cr10 & cr11 if single
372 * stepping is switched off 373 * stepping is switched off
@@ -376,11 +377,10 @@ typedef struct
376 union { 377 union {
377 per_lowcore_words words; 378 per_lowcore_words words;
378 per_lowcore_bits bits; 379 per_lowcore_bits bits;
379 } lowcore; 380 } lowcore;
380} per_struct; 381} per_struct;
381 382
382typedef struct 383typedef struct {
383{
384 unsigned int len; 384 unsigned int len;
385 unsigned long kernel_addr; 385 unsigned long kernel_addr;
386 unsigned long process_addr; 386 unsigned long process_addr;
@@ -390,12 +390,12 @@ typedef struct
390 * S/390 specific non posix ptrace requests. I chose unusual values so 390 * S/390 specific non posix ptrace requests. I chose unusual values so
391 * they are unlikely to clash with future ptrace definitions. 391 * they are unlikely to clash with future ptrace definitions.
392 */ 392 */
393#define PTRACE_PEEKUSR_AREA 0x5000 393#define PTRACE_PEEKUSR_AREA 0x5000
394#define PTRACE_POKEUSR_AREA 0x5001 394#define PTRACE_POKEUSR_AREA 0x5001
395#define PTRACE_PEEKTEXT_AREA 0x5002 395#define PTRACE_PEEKTEXT_AREA 0x5002
396#define PTRACE_PEEKDATA_AREA 0x5003 396#define PTRACE_PEEKDATA_AREA 0x5003
397#define PTRACE_POKETEXT_AREA 0x5004 397#define PTRACE_POKETEXT_AREA 0x5004
398#define PTRACE_POKEDATA_AREA 0x5005 398#define PTRACE_POKEDATA_AREA 0x5005
399#define PTRACE_GET_LAST_BREAK 0x5006 399#define PTRACE_GET_LAST_BREAK 0x5006
400#define PTRACE_PEEK_SYSTEM_CALL 0x5007 400#define PTRACE_PEEK_SYSTEM_CALL 0x5007
401#define PTRACE_POKE_SYSTEM_CALL 0x5008 401#define PTRACE_POKE_SYSTEM_CALL 0x5008
@@ -413,21 +413,19 @@ typedef struct
413 * PT_PROT definition is loosely based on hppa bsd definition in 413 * PT_PROT definition is loosely based on hppa bsd definition in
414 * gdb/hppab-nat.c 414 * gdb/hppab-nat.c
415 */ 415 */
416#define PTRACE_PROT 21 416#define PTRACE_PROT 21
417 417
418typedef enum 418typedef enum {
419{
420 ptprot_set_access_watchpoint, 419 ptprot_set_access_watchpoint,
421 ptprot_set_write_watchpoint, 420 ptprot_set_write_watchpoint,
422 ptprot_disable_watchpoint 421 ptprot_disable_watchpoint
423} ptprot_flags; 422} ptprot_flags;
424 423
425typedef struct 424typedef struct {
426{
427 unsigned long lowaddr; 425 unsigned long lowaddr;
428 unsigned long hiaddr; 426 unsigned long hiaddr;
429 ptprot_flags prot; 427 ptprot_flags prot;
430} ptprot_area; 428} ptprot_area;
431 429
432/* Sequence of bytes for breakpoint illegal instruction. */ 430/* Sequence of bytes for breakpoint illegal instruction. */
433#define S390_BREAKPOINT {0x0,0x1} 431#define S390_BREAKPOINT {0x0,0x1}
@@ -439,8 +437,7 @@ typedef struct
439 * The user_regs_struct defines the way the user registers are 437 * The user_regs_struct defines the way the user registers are
440 * store on the stack for signal handling. 438 * store on the stack for signal handling.
441 */ 439 */
442struct user_regs_struct 440struct user_regs_struct {
443{
444 psw_t psw; 441 psw_t psw;
445 unsigned long gprs[NUM_GPRS]; 442 unsigned long gprs[NUM_GPRS];
446 unsigned int acrs[NUM_ACRS]; 443 unsigned int acrs[NUM_ACRS];
diff --git a/arch/score/include/uapi/asm/Kbuild b/arch/score/include/uapi/asm/Kbuild
index c94ee54210bc..81271d3af47c 100644
--- a/arch/score/include/uapi/asm/Kbuild
+++ b/arch/score/include/uapi/asm/Kbuild
@@ -1,4 +1,5 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bpf_perf_event.h
4generic-y += siginfo.h 5generic-y += siginfo.h
diff --git a/arch/sh/include/uapi/asm/Kbuild b/arch/sh/include/uapi/asm/Kbuild
index e28531333efa..ba4d39cb321d 100644
--- a/arch/sh/include/uapi/asm/Kbuild
+++ b/arch/sh/include/uapi/asm/Kbuild
@@ -2,6 +2,7 @@
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bitsperlong.h 4generic-y += bitsperlong.h
5generic-y += bpf_perf_event.h
5generic-y += errno.h 6generic-y += errno.h
6generic-y += fcntl.h 7generic-y += fcntl.h
7generic-y += ioctl.h 8generic-y += ioctl.h
diff --git a/arch/sparc/include/uapi/asm/Kbuild b/arch/sparc/include/uapi/asm/Kbuild
index 2178c78c7c1a..4680ba246b55 100644
--- a/arch/sparc/include/uapi/asm/Kbuild
+++ b/arch/sparc/include/uapi/asm/Kbuild
@@ -1,4 +1,5 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bpf_perf_event.h
4generic-y += types.h 5generic-y += types.h
diff --git a/arch/tile/include/uapi/asm/Kbuild b/arch/tile/include/uapi/asm/Kbuild
index 5711de0a1b5e..cc439612bcd5 100644
--- a/arch/tile/include/uapi/asm/Kbuild
+++ b/arch/tile/include/uapi/asm/Kbuild
@@ -1,6 +1,7 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bpf_perf_event.h
4generic-y += errno.h 5generic-y += errno.h
5generic-y += fcntl.h 6generic-y += fcntl.h
6generic-y += ioctl.h 7generic-y += ioctl.h
diff --git a/arch/unicore32/include/uapi/asm/Kbuild b/arch/unicore32/include/uapi/asm/Kbuild
index 759a71411169..8611ef980554 100644
--- a/arch/unicore32/include/uapi/asm/Kbuild
+++ b/arch/unicore32/include/uapi/asm/Kbuild
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += auxvec.h 4generic-y += auxvec.h
5generic-y += bitsperlong.h 5generic-y += bitsperlong.h
6generic-y += bpf_perf_event.h
6generic-y += errno.h 7generic-y += errno.h
7generic-y += fcntl.h 8generic-y += fcntl.h
8generic-y += ioctl.h 9generic-y += ioctl.h
diff --git a/arch/x86/include/uapi/asm/Kbuild b/arch/x86/include/uapi/asm/Kbuild
index da1489cb64dc..1e901e421f2d 100644
--- a/arch/x86/include/uapi/asm/Kbuild
+++ b/arch/x86/include/uapi/asm/Kbuild
@@ -1,6 +1,7 @@
1# UAPI Header export list 1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bpf_perf_event.h
4generated-y += unistd_32.h 5generated-y += unistd_32.h
5generated-y += unistd_64.h 6generated-y += unistd_64.h
6generated-y += unistd_x32.h 7generated-y += unistd_x32.h
diff --git a/arch/xtensa/include/uapi/asm/Kbuild b/arch/xtensa/include/uapi/asm/Kbuild
index a5bcdfb890f1..837d4dd76785 100644
--- a/arch/xtensa/include/uapi/asm/Kbuild
+++ b/arch/xtensa/include/uapi/asm/Kbuild
@@ -2,6 +2,7 @@
2include include/uapi/asm-generic/Kbuild.asm 2include include/uapi/asm-generic/Kbuild.asm
3 3
4generic-y += bitsperlong.h 4generic-y += bitsperlong.h
5generic-y += bpf_perf_event.h
5generic-y += errno.h 6generic-y += errno.h
6generic-y += fcntl.h 7generic-y += fcntl.h
7generic-y += ioctl.h 8generic-y += ioctl.h
diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c
index 85268be0c913..55513411a82e 100644
--- a/drivers/net/can/peak_canfd/peak_canfd.c
+++ b/drivers/net/can/peak_canfd/peak_canfd.c
@@ -258,21 +258,18 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv,
258 /* if this frame is an echo, */ 258 /* if this frame is an echo, */
259 if ((rx_msg_flags & PUCAN_MSG_LOOPED_BACK) && 259 if ((rx_msg_flags & PUCAN_MSG_LOOPED_BACK) &&
260 !(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) { 260 !(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) {
261 int n;
262 unsigned long flags; 261 unsigned long flags;
263 262
264 spin_lock_irqsave(&priv->echo_lock, flags); 263 spin_lock_irqsave(&priv->echo_lock, flags);
265 n = can_get_echo_skb(priv->ndev, msg->client); 264 can_get_echo_skb(priv->ndev, msg->client);
266 spin_unlock_irqrestore(&priv->echo_lock, flags); 265 spin_unlock_irqrestore(&priv->echo_lock, flags);
267 266
268 /* count bytes of the echo instead of skb */ 267 /* count bytes of the echo instead of skb */
269 stats->tx_bytes += cf_len; 268 stats->tx_bytes += cf_len;
270 stats->tx_packets++; 269 stats->tx_packets++;
271 270
272 if (n) { 271 /* restart tx queue (a slot is free) */
273 /* restart tx queue only if a slot is free */ 272 netif_wake_queue(priv->ndev);
274 netif_wake_queue(priv->ndev);
275 }
276 273
277 return 0; 274 return 0;
278 } 275 }
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index b3d02759c226..b00358297424 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -288,6 +288,8 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)
288 288
289 case -ECONNRESET: /* unlink */ 289 case -ECONNRESET: /* unlink */
290 case -ENOENT: 290 case -ENOENT:
291 case -EPIPE:
292 case -EPROTO:
291 case -ESHUTDOWN: 293 case -ESHUTDOWN:
292 return; 294 return;
293 295
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index 9fdb0f0bfa06..c6dcf93675c0 100644
--- a/drivers/net/can/usb/esd_usb2.c
+++ b/drivers/net/can/usb/esd_usb2.c
@@ -393,6 +393,8 @@ static void esd_usb2_read_bulk_callback(struct urb *urb)
393 break; 393 break;
394 394
395 case -ENOENT: 395 case -ENOENT:
396 case -EPIPE:
397 case -EPROTO:
396 case -ESHUTDOWN: 398 case -ESHUTDOWN:
397 return; 399 return;
398 400
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index f95945915d20..63587b8e6825 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -1326,6 +1326,8 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb)
1326 case 0: 1326 case 0:
1327 break; 1327 break;
1328 case -ENOENT: 1328 case -ENOENT:
1329 case -EPIPE:
1330 case -EPROTO:
1329 case -ESHUTDOWN: 1331 case -ESHUTDOWN:
1330 return; 1332 return;
1331 default: 1333 default:
diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c
index ef417dcddbf7..8d8c2086424d 100644
--- a/drivers/net/can/usb/mcba_usb.c
+++ b/drivers/net/can/usb/mcba_usb.c
@@ -593,6 +593,7 @@ static void mcba_usb_read_bulk_callback(struct urb *urb)
593 593
594 case -ENOENT: 594 case -ENOENT:
595 case -EPIPE: 595 case -EPIPE:
596 case -EPROTO:
596 case -ESHUTDOWN: 597 case -ESHUTDOWN:
597 return; 598 return;
598 599
diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c
index d000cb62d6ae..27861c417c94 100644
--- a/drivers/net/can/usb/usb_8dev.c
+++ b/drivers/net/can/usb/usb_8dev.c
@@ -524,6 +524,8 @@ static void usb_8dev_read_bulk_callback(struct urb *urb)
524 break; 524 break;
525 525
526 case -ENOENT: 526 case -ENOENT:
527 case -EPIPE:
528 case -EPROTO:
527 case -ESHUTDOWN: 529 case -ESHUTDOWN:
528 return; 530 return;
529 531
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index ea01f24f15e7..b62d47210db8 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -14,7 +14,6 @@
14#include <linux/netdevice.h> 14#include <linux/netdevice.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/of.h>
18#include <linux/phy.h> 17#include <linux/phy.h>
19#include <linux/phy_fixed.h> 18#include <linux/phy_fixed.h>
20#include <linux/mii.h> 19#include <linux/mii.h>
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 8171055fde7a..66d33e97cbc5 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -339,7 +339,7 @@ static void mv88e6xxx_g1_irq_free(struct mv88e6xxx_chip *chip)
339 u16 mask; 339 u16 mask;
340 340
341 mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &mask); 341 mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &mask);
342 mask |= GENMASK(chip->g1_irq.nirqs, 0); 342 mask &= ~GENMASK(chip->g1_irq.nirqs, 0);
343 mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask); 343 mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask);
344 344
345 free_irq(chip->irq, chip); 345 free_irq(chip->irq, chip);
@@ -395,7 +395,7 @@ static int mv88e6xxx_g1_irq_setup(struct mv88e6xxx_chip *chip)
395 return 0; 395 return 0;
396 396
397out_disable: 397out_disable:
398 mask |= GENMASK(chip->g1_irq.nirqs, 0); 398 mask &= ~GENMASK(chip->g1_irq.nirqs, 0);
399 mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask); 399 mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, mask);
400 400
401out_mapping: 401out_mapping:
@@ -2177,6 +2177,19 @@ static const struct of_device_id mv88e6xxx_mdio_external_match[] = {
2177 { }, 2177 { },
2178}; 2178};
2179 2179
2180static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip)
2181
2182{
2183 struct mv88e6xxx_mdio_bus *mdio_bus;
2184 struct mii_bus *bus;
2185
2186 list_for_each_entry(mdio_bus, &chip->mdios, list) {
2187 bus = mdio_bus->bus;
2188
2189 mdiobus_unregister(bus);
2190 }
2191}
2192
2180static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip, 2193static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip,
2181 struct device_node *np) 2194 struct device_node *np)
2182{ 2195{
@@ -2201,27 +2214,16 @@ static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip,
2201 match = of_match_node(mv88e6xxx_mdio_external_match, child); 2214 match = of_match_node(mv88e6xxx_mdio_external_match, child);
2202 if (match) { 2215 if (match) {
2203 err = mv88e6xxx_mdio_register(chip, child, true); 2216 err = mv88e6xxx_mdio_register(chip, child, true);
2204 if (err) 2217 if (err) {
2218 mv88e6xxx_mdios_unregister(chip);
2205 return err; 2219 return err;
2220 }
2206 } 2221 }
2207 } 2222 }
2208 2223
2209 return 0; 2224 return 0;
2210} 2225}
2211 2226
2212static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip)
2213
2214{
2215 struct mv88e6xxx_mdio_bus *mdio_bus;
2216 struct mii_bus *bus;
2217
2218 list_for_each_entry(mdio_bus, &chip->mdios, list) {
2219 bus = mdio_bus->bus;
2220
2221 mdiobus_unregister(bus);
2222 }
2223}
2224
2225static int mv88e6xxx_get_eeprom_len(struct dsa_switch *ds) 2227static int mv88e6xxx_get_eeprom_len(struct dsa_switch *ds)
2226{ 2228{
2227 struct mv88e6xxx_chip *chip = ds->priv; 2229 struct mv88e6xxx_chip *chip = ds->priv;
diff --git a/drivers/net/ethernet/arc/emac_rockchip.c b/drivers/net/ethernet/arc/emac_rockchip.c
index e278e3d96ee0..c6163874e4e7 100644
--- a/drivers/net/ethernet/arc/emac_rockchip.c
+++ b/drivers/net/ethernet/arc/emac_rockchip.c
@@ -220,9 +220,11 @@ static int emac_rockchip_probe(struct platform_device *pdev)
220 220
221 /* RMII TX/RX needs always a rate of 25MHz */ 221 /* RMII TX/RX needs always a rate of 25MHz */
222 err = clk_set_rate(priv->macclk, 25000000); 222 err = clk_set_rate(priv->macclk, 25000000);
223 if (err) 223 if (err) {
224 dev_err(dev, 224 dev_err(dev,
225 "failed to change mac clock rate (%d)\n", err); 225 "failed to change mac clock rate (%d)\n", err);
226 goto out_clk_disable_macclk;
227 }
226 } 228 }
227 229
228 err = arc_emac_probe(ndev, interface); 230 err = arc_emac_probe(ndev, interface);
@@ -232,7 +234,8 @@ static int emac_rockchip_probe(struct platform_device *pdev)
232 } 234 }
233 235
234 return 0; 236 return 0;
235 237out_clk_disable_macclk:
238 clk_disable_unprepare(priv->macclk);
236out_regulator_disable: 239out_regulator_disable:
237 if (priv->regulator) 240 if (priv->regulator)
238 regulator_disable(priv->regulator); 241 regulator_disable(priv->regulator);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 28f5e94274ee..61ca4eb7c6fa 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -1883,7 +1883,7 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
1883 * here forever if we consistently cannot allocate 1883 * here forever if we consistently cannot allocate
1884 * buffers. 1884 * buffers.
1885 */ 1885 */
1886 else if (rc == -ENOMEM) 1886 else if (rc == -ENOMEM && budget)
1887 rx_pkts++; 1887 rx_pkts++;
1888 else if (rc == -EBUSY) /* partial completion */ 1888 else if (rc == -EBUSY) /* partial completion */
1889 break; 1889 break;
@@ -1969,7 +1969,7 @@ static int bnxt_poll_nitroa0(struct napi_struct *napi, int budget)
1969 cpu_to_le32(RX_CMPL_ERRORS_CRC_ERROR); 1969 cpu_to_le32(RX_CMPL_ERRORS_CRC_ERROR);
1970 1970
1971 rc = bnxt_rx_pkt(bp, bnapi, &raw_cons, &event); 1971 rc = bnxt_rx_pkt(bp, bnapi, &raw_cons, &event);
1972 if (likely(rc == -EIO)) 1972 if (likely(rc == -EIO) && budget)
1973 rx_pkts++; 1973 rx_pkts++;
1974 else if (rc == -EBUSY) /* partial completion */ 1974 else if (rc == -EBUSY) /* partial completion */
1975 break; 1975 break;
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index 8b2c31e2a2b0..a3d12dbde95b 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -1355,6 +1355,8 @@ nicvf_sq_add_hdr_subdesc(struct nicvf *nic, struct snd_queue *sq, int qentry,
1355 1355
1356 /* Offload checksum calculation to HW */ 1356 /* Offload checksum calculation to HW */
1357 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1357 if (skb->ip_summed == CHECKSUM_PARTIAL) {
1358 if (ip.v4->version == 4)
1359 hdr->csum_l3 = 1; /* Enable IP csum calculation */
1358 hdr->l3_offset = skb_network_offset(skb); 1360 hdr->l3_offset = skb_network_offset(skb);
1359 hdr->l4_offset = skb_transport_offset(skb); 1361 hdr->l4_offset = skb_transport_offset(skb);
1360 1362
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 5be52d89b182..7f837006bb6a 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -1378,9 +1378,11 @@ static int gfar_probe(struct platform_device *ofdev)
1378 1378
1379 gfar_init_addr_hash_table(priv); 1379 gfar_init_addr_hash_table(priv);
1380 1380
1381 /* Insert receive time stamps into padding alignment bytes */ 1381 /* Insert receive time stamps into padding alignment bytes, and
1382 * plus 2 bytes padding to ensure the cpu alignment.
1383 */
1382 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) 1384 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
1383 priv->padding = 8; 1385 priv->padding = 8 + DEFAULT_PADDING;
1384 1386
1385 if (dev->features & NETIF_F_IP_CSUM || 1387 if (dev->features & NETIF_F_IP_CSUM ||
1386 priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) 1388 priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
@@ -1790,6 +1792,7 @@ static int init_phy(struct net_device *dev)
1790 GFAR_SUPPORTED_GBIT : 0; 1792 GFAR_SUPPORTED_GBIT : 0;
1791 phy_interface_t interface; 1793 phy_interface_t interface;
1792 struct phy_device *phydev; 1794 struct phy_device *phydev;
1795 struct ethtool_eee edata;
1793 1796
1794 priv->oldlink = 0; 1797 priv->oldlink = 0;
1795 priv->oldspeed = 0; 1798 priv->oldspeed = 0;
@@ -1814,6 +1817,10 @@ static int init_phy(struct net_device *dev)
1814 /* Add support for flow control, but don't advertise it by default */ 1817 /* Add support for flow control, but don't advertise it by default */
1815 phydev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause); 1818 phydev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
1816 1819
1820 /* disable EEE autoneg, EEE not supported by eTSEC */
1821 memset(&edata, 0, sizeof(struct ethtool_eee));
1822 phy_ethtool_set_eee(phydev, &edata);
1823
1817 return 0; 1824 return 0;
1818} 1825}
1819 1826
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index c9798210fa0f..0495487f7b42 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -344,7 +344,8 @@ static int orion_mdio_probe(struct platform_device *pdev)
344 dev->regs + MVMDIO_ERR_INT_MASK); 344 dev->regs + MVMDIO_ERR_INT_MASK);
345 345
346 } else if (dev->err_interrupt == -EPROBE_DEFER) { 346 } else if (dev->err_interrupt == -EPROBE_DEFER) {
347 return -EPROBE_DEFER; 347 ret = -EPROBE_DEFER;
348 goto out_mdio;
348 } 349 }
349 350
350 if (pdev->dev.of_node) 351 if (pdev->dev.of_node)
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index fed2b2f909fc..634b2f41cc9e 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -85,7 +85,7 @@
85 85
86/* RSS Registers */ 86/* RSS Registers */
87#define MVPP22_RSS_INDEX 0x1500 87#define MVPP22_RSS_INDEX 0x1500
88#define MVPP22_RSS_INDEX_TABLE_ENTRY(idx) ((idx) << 8) 88#define MVPP22_RSS_INDEX_TABLE_ENTRY(idx) (idx)
89#define MVPP22_RSS_INDEX_TABLE(idx) ((idx) << 8) 89#define MVPP22_RSS_INDEX_TABLE(idx) ((idx) << 8)
90#define MVPP22_RSS_INDEX_QUEUE(idx) ((idx) << 16) 90#define MVPP22_RSS_INDEX_QUEUE(idx) ((idx) << 16)
91#define MVPP22_RSS_TABLE_ENTRY 0x1508 91#define MVPP22_RSS_TABLE_ENTRY 0x1508
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
index 924a05e05da0..78b36c67c232 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
@@ -84,16 +84,13 @@ nfp_repr_phy_port_get_stats64(struct nfp_port *port,
84{ 84{
85 u8 __iomem *mem = port->eth_stats; 85 u8 __iomem *mem = port->eth_stats;
86 86
87 /* TX and RX stats are flipped as we are returning the stats as seen 87 stats->tx_packets = readq(mem + NFP_MAC_STATS_TX_FRAMES_TRANSMITTED_OK);
88 * at the switch port corresponding to the phys port. 88 stats->tx_bytes = readq(mem + NFP_MAC_STATS_TX_OUT_OCTETS);
89 */ 89 stats->tx_dropped = readq(mem + NFP_MAC_STATS_TX_OUT_ERRORS);
90 stats->tx_packets = readq(mem + NFP_MAC_STATS_RX_FRAMES_RECEIVED_OK);
91 stats->tx_bytes = readq(mem + NFP_MAC_STATS_RX_IN_OCTETS);
92 stats->tx_dropped = readq(mem + NFP_MAC_STATS_RX_IN_ERRORS);
93 90
94 stats->rx_packets = readq(mem + NFP_MAC_STATS_TX_FRAMES_TRANSMITTED_OK); 91 stats->rx_packets = readq(mem + NFP_MAC_STATS_RX_FRAMES_RECEIVED_OK);
95 stats->rx_bytes = readq(mem + NFP_MAC_STATS_TX_OUT_OCTETS); 92 stats->rx_bytes = readq(mem + NFP_MAC_STATS_RX_IN_OCTETS);
96 stats->rx_dropped = readq(mem + NFP_MAC_STATS_TX_OUT_ERRORS); 93 stats->rx_dropped = readq(mem + NFP_MAC_STATS_RX_IN_ERRORS);
97} 94}
98 95
99static void 96static void
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
index 71bee1af71ef..df21e900f874 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
@@ -195,6 +195,7 @@ err2:
195err1: 195err1:
196 rmnet_unregister_real_device(real_dev, port); 196 rmnet_unregister_real_device(real_dev, port);
197err0: 197err0:
198 kfree(ep);
198 return err; 199 return err;
199} 200}
200 201
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
index 29842ccc91a9..08e4afc0ab39 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
@@ -126,12 +126,12 @@ static int rmnet_map_egress_handler(struct sk_buff *skb,
126 126
127 if (skb_headroom(skb) < required_headroom) { 127 if (skb_headroom(skb) < required_headroom) {
128 if (pskb_expand_head(skb, required_headroom, 0, GFP_KERNEL)) 128 if (pskb_expand_head(skb, required_headroom, 0, GFP_KERNEL))
129 return RMNET_MAP_CONSUMED; 129 goto fail;
130 } 130 }
131 131
132 map_header = rmnet_map_add_map_header(skb, additional_header_len, 0); 132 map_header = rmnet_map_add_map_header(skb, additional_header_len, 0);
133 if (!map_header) 133 if (!map_header)
134 return RMNET_MAP_CONSUMED; 134 goto fail;
135 135
136 if (port->egress_data_format & RMNET_EGRESS_FORMAT_MUXING) { 136 if (port->egress_data_format & RMNET_EGRESS_FORMAT_MUXING) {
137 if (mux_id == 0xff) 137 if (mux_id == 0xff)
@@ -143,6 +143,10 @@ static int rmnet_map_egress_handler(struct sk_buff *skb,
143 skb->protocol = htons(ETH_P_MAP); 143 skb->protocol = htons(ETH_P_MAP);
144 144
145 return RMNET_MAP_SUCCESS; 145 return RMNET_MAP_SUCCESS;
146
147fail:
148 kfree_skb(skb);
149 return RMNET_MAP_CONSUMED;
146} 150}
147 151
148static void 152static void
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 7e060aa9fbed..db72d13cebb9 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1149,7 +1149,8 @@ static int sh_eth_tx_free(struct net_device *ndev, bool sent_only)
1149 entry, le32_to_cpu(txdesc->status)); 1149 entry, le32_to_cpu(txdesc->status));
1150 /* Free the original skb. */ 1150 /* Free the original skb. */
1151 if (mdp->tx_skbuff[entry]) { 1151 if (mdp->tx_skbuff[entry]) {
1152 dma_unmap_single(&ndev->dev, le32_to_cpu(txdesc->addr), 1152 dma_unmap_single(&mdp->pdev->dev,
1153 le32_to_cpu(txdesc->addr),
1153 le32_to_cpu(txdesc->len) >> 16, 1154 le32_to_cpu(txdesc->len) >> 16,
1154 DMA_TO_DEVICE); 1155 DMA_TO_DEVICE);
1155 dev_kfree_skb_irq(mdp->tx_skbuff[entry]); 1156 dev_kfree_skb_irq(mdp->tx_skbuff[entry]);
@@ -1179,14 +1180,14 @@ static void sh_eth_ring_free(struct net_device *ndev)
1179 if (mdp->rx_skbuff[i]) { 1180 if (mdp->rx_skbuff[i]) {
1180 struct sh_eth_rxdesc *rxdesc = &mdp->rx_ring[i]; 1181 struct sh_eth_rxdesc *rxdesc = &mdp->rx_ring[i];
1181 1182
1182 dma_unmap_single(&ndev->dev, 1183 dma_unmap_single(&mdp->pdev->dev,
1183 le32_to_cpu(rxdesc->addr), 1184 le32_to_cpu(rxdesc->addr),
1184 ALIGN(mdp->rx_buf_sz, 32), 1185 ALIGN(mdp->rx_buf_sz, 32),
1185 DMA_FROM_DEVICE); 1186 DMA_FROM_DEVICE);
1186 } 1187 }
1187 } 1188 }
1188 ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring; 1189 ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring;
1189 dma_free_coherent(NULL, ringsize, mdp->rx_ring, 1190 dma_free_coherent(&mdp->pdev->dev, ringsize, mdp->rx_ring,
1190 mdp->rx_desc_dma); 1191 mdp->rx_desc_dma);
1191 mdp->rx_ring = NULL; 1192 mdp->rx_ring = NULL;
1192 } 1193 }
@@ -1203,7 +1204,7 @@ static void sh_eth_ring_free(struct net_device *ndev)
1203 sh_eth_tx_free(ndev, false); 1204 sh_eth_tx_free(ndev, false);
1204 1205
1205 ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring; 1206 ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring;
1206 dma_free_coherent(NULL, ringsize, mdp->tx_ring, 1207 dma_free_coherent(&mdp->pdev->dev, ringsize, mdp->tx_ring,
1207 mdp->tx_desc_dma); 1208 mdp->tx_desc_dma);
1208 mdp->tx_ring = NULL; 1209 mdp->tx_ring = NULL;
1209 } 1210 }
@@ -1245,9 +1246,9 @@ static void sh_eth_ring_format(struct net_device *ndev)
1245 1246
1246 /* The size of the buffer is a multiple of 32 bytes. */ 1247 /* The size of the buffer is a multiple of 32 bytes. */
1247 buf_len = ALIGN(mdp->rx_buf_sz, 32); 1248 buf_len = ALIGN(mdp->rx_buf_sz, 32);
1248 dma_addr = dma_map_single(&ndev->dev, skb->data, buf_len, 1249 dma_addr = dma_map_single(&mdp->pdev->dev, skb->data, buf_len,
1249 DMA_FROM_DEVICE); 1250 DMA_FROM_DEVICE);
1250 if (dma_mapping_error(&ndev->dev, dma_addr)) { 1251 if (dma_mapping_error(&mdp->pdev->dev, dma_addr)) {
1251 kfree_skb(skb); 1252 kfree_skb(skb);
1252 break; 1253 break;
1253 } 1254 }
@@ -1323,8 +1324,8 @@ static int sh_eth_ring_init(struct net_device *ndev)
1323 1324
1324 /* Allocate all Rx descriptors. */ 1325 /* Allocate all Rx descriptors. */
1325 rx_ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring; 1326 rx_ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring;
1326 mdp->rx_ring = dma_alloc_coherent(NULL, rx_ringsize, &mdp->rx_desc_dma, 1327 mdp->rx_ring = dma_alloc_coherent(&mdp->pdev->dev, rx_ringsize,
1327 GFP_KERNEL); 1328 &mdp->rx_desc_dma, GFP_KERNEL);
1328 if (!mdp->rx_ring) 1329 if (!mdp->rx_ring)
1329 goto ring_free; 1330 goto ring_free;
1330 1331
@@ -1332,8 +1333,8 @@ static int sh_eth_ring_init(struct net_device *ndev)
1332 1333
1333 /* Allocate all Tx descriptors. */ 1334 /* Allocate all Tx descriptors. */
1334 tx_ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring; 1335 tx_ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring;
1335 mdp->tx_ring = dma_alloc_coherent(NULL, tx_ringsize, &mdp->tx_desc_dma, 1336 mdp->tx_ring = dma_alloc_coherent(&mdp->pdev->dev, tx_ringsize,
1336 GFP_KERNEL); 1337 &mdp->tx_desc_dma, GFP_KERNEL);
1337 if (!mdp->tx_ring) 1338 if (!mdp->tx_ring)
1338 goto ring_free; 1339 goto ring_free;
1339 return 0; 1340 return 0;
@@ -1527,7 +1528,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
1527 mdp->rx_skbuff[entry] = NULL; 1528 mdp->rx_skbuff[entry] = NULL;
1528 if (mdp->cd->rpadir) 1529 if (mdp->cd->rpadir)
1529 skb_reserve(skb, NET_IP_ALIGN); 1530 skb_reserve(skb, NET_IP_ALIGN);
1530 dma_unmap_single(&ndev->dev, dma_addr, 1531 dma_unmap_single(&mdp->pdev->dev, dma_addr,
1531 ALIGN(mdp->rx_buf_sz, 32), 1532 ALIGN(mdp->rx_buf_sz, 32),
1532 DMA_FROM_DEVICE); 1533 DMA_FROM_DEVICE);
1533 skb_put(skb, pkt_len); 1534 skb_put(skb, pkt_len);
@@ -1555,9 +1556,9 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
1555 if (skb == NULL) 1556 if (skb == NULL)
1556 break; /* Better luck next round. */ 1557 break; /* Better luck next round. */
1557 sh_eth_set_receive_align(skb); 1558 sh_eth_set_receive_align(skb);
1558 dma_addr = dma_map_single(&ndev->dev, skb->data, 1559 dma_addr = dma_map_single(&mdp->pdev->dev, skb->data,
1559 buf_len, DMA_FROM_DEVICE); 1560 buf_len, DMA_FROM_DEVICE);
1560 if (dma_mapping_error(&ndev->dev, dma_addr)) { 1561 if (dma_mapping_error(&mdp->pdev->dev, dma_addr)) {
1561 kfree_skb(skb); 1562 kfree_skb(skb);
1562 break; 1563 break;
1563 } 1564 }
@@ -2441,9 +2442,9 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
2441 /* soft swap. */ 2442 /* soft swap. */
2442 if (!mdp->cd->hw_swap) 2443 if (!mdp->cd->hw_swap)
2443 sh_eth_soft_swap(PTR_ALIGN(skb->data, 4), skb->len + 2); 2444 sh_eth_soft_swap(PTR_ALIGN(skb->data, 4), skb->len + 2);
2444 dma_addr = dma_map_single(&ndev->dev, skb->data, skb->len, 2445 dma_addr = dma_map_single(&mdp->pdev->dev, skb->data, skb->len,
2445 DMA_TO_DEVICE); 2446 DMA_TO_DEVICE);
2446 if (dma_mapping_error(&ndev->dev, dma_addr)) { 2447 if (dma_mapping_error(&mdp->pdev->dev, dma_addr)) {
2447 kfree_skb(skb); 2448 kfree_skb(skb);
2448 return NETDEV_TX_OK; 2449 return NETDEV_TX_OK;
2449 } 2450 }
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index 0ea7e16f2e6e..9937a2450e57 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -77,6 +77,7 @@ static void efx_dequeue_buffer(struct efx_tx_queue *tx_queue,
77 } 77 }
78 78
79 if (buffer->flags & EFX_TX_BUF_SKB) { 79 if (buffer->flags & EFX_TX_BUF_SKB) {
80 EFX_WARN_ON_PARANOID(!pkts_compl || !bytes_compl);
80 (*pkts_compl)++; 81 (*pkts_compl)++;
81 (*bytes_compl) += buffer->skb->len; 82 (*bytes_compl) += buffer->skb->len;
82 dev_consume_skb_any((struct sk_buff *)buffer->skb); 83 dev_consume_skb_any((struct sk_buff *)buffer->skb);
@@ -426,12 +427,14 @@ static int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb,
426static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue) 427static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue)
427{ 428{
428 struct efx_tx_buffer *buffer; 429 struct efx_tx_buffer *buffer;
430 unsigned int bytes_compl = 0;
431 unsigned int pkts_compl = 0;
429 432
430 /* Work backwards until we hit the original insert pointer value */ 433 /* Work backwards until we hit the original insert pointer value */
431 while (tx_queue->insert_count != tx_queue->write_count) { 434 while (tx_queue->insert_count != tx_queue->write_count) {
432 --tx_queue->insert_count; 435 --tx_queue->insert_count;
433 buffer = __efx_tx_queue_get_insert_buffer(tx_queue); 436 buffer = __efx_tx_queue_get_insert_buffer(tx_queue);
434 efx_dequeue_buffer(tx_queue, buffer, NULL, NULL); 437 efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl);
435 } 438 }
436} 439}
437 440
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index c750cf7c042b..304ec6555cd8 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -261,9 +261,11 @@ static void qmi_wwan_netdev_setup(struct net_device *net)
261 net->hard_header_len = 0; 261 net->hard_header_len = 0;
262 net->addr_len = 0; 262 net->addr_len = 0;
263 net->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; 263 net->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
264 set_bit(EVENT_NO_IP_ALIGN, &dev->flags);
264 netdev_dbg(net, "mode: raw IP\n"); 265 netdev_dbg(net, "mode: raw IP\n");
265 } else if (!net->header_ops) { /* don't bother if already set */ 266 } else if (!net->header_ops) { /* don't bother if already set */
266 ether_setup(net); 267 ether_setup(net);
268 clear_bit(EVENT_NO_IP_ALIGN, &dev->flags);
267 netdev_dbg(net, "mode: Ethernet\n"); 269 netdev_dbg(net, "mode: Ethernet\n");
268 } 270 }
269 271
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 80348b6a8646..d56fe32bf48d 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -484,7 +484,10 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
484 return -ENOLINK; 484 return -ENOLINK;
485 } 485 }
486 486
487 skb = __netdev_alloc_skb_ip_align(dev->net, size, flags); 487 if (test_bit(EVENT_NO_IP_ALIGN, &dev->flags))
488 skb = __netdev_alloc_skb(dev->net, size, flags);
489 else
490 skb = __netdev_alloc_skb_ip_align(dev->net, size, flags);
488 if (!skb) { 491 if (!skb) {
489 netif_dbg(dev, rx_err, dev->net, "no rx skb\n"); 492 netif_dbg(dev, rx_err, dev->net, "no rx skb\n");
490 usbnet_defer_kevent (dev, EVENT_RX_MEMORY); 493 usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index 310c4e2746aa..cdf9e4161592 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -2070,7 +2070,7 @@ static int brcmf_sdio_txpkt_hdalign(struct brcmf_sdio *bus, struct sk_buff *pkt)
2070 return head_pad; 2070 return head_pad;
2071} 2071}
2072 2072
2073/** 2073/*
2074 * struct brcmf_skbuff_cb reserves first two bytes in sk_buff::cb for 2074 * struct brcmf_skbuff_cb reserves first two bytes in sk_buff::cb for
2075 * bus layer usage. 2075 * bus layer usage.
2076 */ 2076 */
@@ -4121,8 +4121,8 @@ release:
4121 sdio_release_host(sdiodev->func[1]); 4121 sdio_release_host(sdiodev->func[1]);
4122fail: 4122fail:
4123 brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err); 4123 brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err);
4124 device_release_driver(dev);
4125 device_release_driver(&sdiodev->func[2]->dev); 4124 device_release_driver(&sdiodev->func[2]->dev);
4125 device_release_driver(dev);
4126} 4126}
4127 4127
4128struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) 4128struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h b/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h
index 87b4434224a1..dfa111bb411e 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h
@@ -68,6 +68,9 @@
68 * @IWL_MVM_DQA_CMD_QUEUE: a queue reserved for sending HCMDs to the FW 68 * @IWL_MVM_DQA_CMD_QUEUE: a queue reserved for sending HCMDs to the FW
69 * @IWL_MVM_DQA_AUX_QUEUE: a queue reserved for aux frames 69 * @IWL_MVM_DQA_AUX_QUEUE: a queue reserved for aux frames
70 * @IWL_MVM_DQA_P2P_DEVICE_QUEUE: a queue reserved for P2P device frames 70 * @IWL_MVM_DQA_P2P_DEVICE_QUEUE: a queue reserved for P2P device frames
71 * @IWL_MVM_DQA_INJECT_MONITOR_QUEUE: a queue reserved for injection using
72 * monitor mode. Note this queue is the same as the queue for P2P device
73 * but we can't have active monitor mode along with P2P device anyway.
71 * @IWL_MVM_DQA_GCAST_QUEUE: a queue reserved for P2P GO/SoftAP GCAST frames 74 * @IWL_MVM_DQA_GCAST_QUEUE: a queue reserved for P2P GO/SoftAP GCAST frames
72 * @IWL_MVM_DQA_BSS_CLIENT_QUEUE: a queue reserved for BSS activity, to ensure 75 * @IWL_MVM_DQA_BSS_CLIENT_QUEUE: a queue reserved for BSS activity, to ensure
73 * that we are never left without the possibility to connect to an AP. 76 * that we are never left without the possibility to connect to an AP.
@@ -87,6 +90,7 @@ enum iwl_mvm_dqa_txq {
87 IWL_MVM_DQA_CMD_QUEUE = 0, 90 IWL_MVM_DQA_CMD_QUEUE = 0,
88 IWL_MVM_DQA_AUX_QUEUE = 1, 91 IWL_MVM_DQA_AUX_QUEUE = 1,
89 IWL_MVM_DQA_P2P_DEVICE_QUEUE = 2, 92 IWL_MVM_DQA_P2P_DEVICE_QUEUE = 2,
93 IWL_MVM_DQA_INJECT_MONITOR_QUEUE = 2,
90 IWL_MVM_DQA_GCAST_QUEUE = 3, 94 IWL_MVM_DQA_GCAST_QUEUE = 3,
91 IWL_MVM_DQA_BSS_CLIENT_QUEUE = 4, 95 IWL_MVM_DQA_BSS_CLIENT_QUEUE = 4,
92 IWL_MVM_DQA_MIN_MGMT_QUEUE = 5, 96 IWL_MVM_DQA_MIN_MGMT_QUEUE = 5,
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
index 9c889a32fe24..223fb77a3aa9 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
@@ -209,8 +209,6 @@ static inline void iwl_fw_dbg_stop_recording(struct iwl_fw_runtime *fwrt)
209 209
210static inline void iwl_fw_dump_conf_clear(struct iwl_fw_runtime *fwrt) 210static inline void iwl_fw_dump_conf_clear(struct iwl_fw_runtime *fwrt)
211{ 211{
212 iwl_fw_dbg_stop_recording(fwrt);
213
214 fwrt->dump.conf = FW_DBG_INVALID; 212 fwrt->dump.conf = FW_DBG_INVALID;
215} 213}
216 214
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index ca0b5536a8a6..921cab9e2d73 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -117,6 +117,7 @@
117#define FH_RSCSR_FRAME_INVALID 0x55550000 117#define FH_RSCSR_FRAME_INVALID 0x55550000
118#define FH_RSCSR_FRAME_ALIGN 0x40 118#define FH_RSCSR_FRAME_ALIGN 0x40
119#define FH_RSCSR_RPA_EN BIT(25) 119#define FH_RSCSR_RPA_EN BIT(25)
120#define FH_RSCSR_RADA_EN BIT(26)
120#define FH_RSCSR_RXQ_POS 16 121#define FH_RSCSR_RXQ_POS 16
121#define FH_RSCSR_RXQ_MASK 0x3F0000 122#define FH_RSCSR_RXQ_MASK 0x3F0000
122 123
@@ -128,7 +129,8 @@ struct iwl_rx_packet {
128 * 31: flag flush RB request 129 * 31: flag flush RB request
129 * 30: flag ignore TC (terminal counter) request 130 * 30: flag ignore TC (terminal counter) request
130 * 29: flag fast IRQ request 131 * 29: flag fast IRQ request
131 * 28-26: Reserved 132 * 28-27: Reserved
133 * 26: RADA enabled
132 * 25: Offload enabled 134 * 25: Offload enabled
133 * 24: RPF enabled 135 * 24: RPF enabled
134 * 23: RSS enabled 136 * 23: RSS enabled
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index a2bf530eeae4..2f22e14e00fe 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -787,7 +787,7 @@ static int iwl_mvm_mac_ctxt_cmd_listener(struct iwl_mvm *mvm,
787 u32 action) 787 u32 action)
788{ 788{
789 struct iwl_mac_ctx_cmd cmd = {}; 789 struct iwl_mac_ctx_cmd cmd = {};
790 u32 tfd_queue_msk = 0; 790 u32 tfd_queue_msk = BIT(mvm->snif_queue);
791 int ret; 791 int ret;
792 792
793 WARN_ON(vif->type != NL80211_IFTYPE_MONITOR); 793 WARN_ON(vif->type != NL80211_IFTYPE_MONITOR);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 4575595ab022..55ab5349dd40 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -972,6 +972,7 @@ struct iwl_mvm {
972 972
973 /* Tx queues */ 973 /* Tx queues */
974 u16 aux_queue; 974 u16 aux_queue;
975 u16 snif_queue;
975 u16 probe_queue; 976 u16 probe_queue;
976 u16 p2p_dev_queue; 977 u16 p2p_dev_queue;
977 978
@@ -1060,6 +1061,7 @@ struct iwl_mvm {
1060 * @IWL_MVM_STATUS_ROC_AUX_RUNNING: AUX remain-on-channel is running 1061 * @IWL_MVM_STATUS_ROC_AUX_RUNNING: AUX remain-on-channel is running
1061 * @IWL_MVM_STATUS_D3_RECONFIG: D3 reconfiguration is being done 1062 * @IWL_MVM_STATUS_D3_RECONFIG: D3 reconfiguration is being done
1062 * @IWL_MVM_STATUS_FIRMWARE_RUNNING: firmware is running 1063 * @IWL_MVM_STATUS_FIRMWARE_RUNNING: firmware is running
1064 * @IWL_MVM_STATUS_NEED_FLUSH_P2P: need to flush P2P bcast STA
1063 */ 1065 */
1064enum iwl_mvm_status { 1066enum iwl_mvm_status {
1065 IWL_MVM_STATUS_HW_RFKILL, 1067 IWL_MVM_STATUS_HW_RFKILL,
@@ -1071,6 +1073,7 @@ enum iwl_mvm_status {
1071 IWL_MVM_STATUS_ROC_AUX_RUNNING, 1073 IWL_MVM_STATUS_ROC_AUX_RUNNING,
1072 IWL_MVM_STATUS_D3_RECONFIG, 1074 IWL_MVM_STATUS_D3_RECONFIG,
1073 IWL_MVM_STATUS_FIRMWARE_RUNNING, 1075 IWL_MVM_STATUS_FIRMWARE_RUNNING,
1076 IWL_MVM_STATUS_NEED_FLUSH_P2P,
1074}; 1077};
1075 1078
1076/* Keep track of completed init configuration */ 1079/* Keep track of completed init configuration */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 7078b7e458be..45470b6b351a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -624,6 +624,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
624 mvm->fw_restart = iwlwifi_mod_params.fw_restart ? -1 : 0; 624 mvm->fw_restart = iwlwifi_mod_params.fw_restart ? -1 : 0;
625 625
626 mvm->aux_queue = IWL_MVM_DQA_AUX_QUEUE; 626 mvm->aux_queue = IWL_MVM_DQA_AUX_QUEUE;
627 mvm->snif_queue = IWL_MVM_DQA_INJECT_MONITOR_QUEUE;
627 mvm->probe_queue = IWL_MVM_DQA_AP_PROBE_RESP_QUEUE; 628 mvm->probe_queue = IWL_MVM_DQA_AP_PROBE_RESP_QUEUE;
628 mvm->p2p_dev_queue = IWL_MVM_DQA_P2P_DEVICE_QUEUE; 629 mvm->p2p_dev_queue = IWL_MVM_DQA_P2P_DEVICE_QUEUE;
629 630
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
index 76dc58381e1c..3b8d44361380 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
@@ -213,6 +213,7 @@ static void iwl_mvm_get_signal_strength(struct iwl_mvm *mvm,
213 struct ieee80211_rx_status *rx_status) 213 struct ieee80211_rx_status *rx_status)
214{ 214{
215 int energy_a, energy_b, max_energy; 215 int energy_a, energy_b, max_energy;
216 u32 rate_flags = le32_to_cpu(desc->rate_n_flags);
216 217
217 energy_a = desc->energy_a; 218 energy_a = desc->energy_a;
218 energy_a = energy_a ? -energy_a : S8_MIN; 219 energy_a = energy_a ? -energy_a : S8_MIN;
@@ -224,7 +225,8 @@ static void iwl_mvm_get_signal_strength(struct iwl_mvm *mvm,
224 energy_a, energy_b, max_energy); 225 energy_a, energy_b, max_energy);
225 226
226 rx_status->signal = max_energy; 227 rx_status->signal = max_energy;
227 rx_status->chains = 0; /* TODO: phy info */ 228 rx_status->chains =
229 (rate_flags & RATE_MCS_ANT_AB_MSK) >> RATE_MCS_ANT_POS;
228 rx_status->chain_signal[0] = energy_a; 230 rx_status->chain_signal[0] = energy_a;
229 rx_status->chain_signal[1] = energy_b; 231 rx_status->chain_signal[1] = energy_b;
230 rx_status->chain_signal[2] = S8_MIN; 232 rx_status->chain_signal[2] = S8_MIN;
@@ -232,8 +234,8 @@ static void iwl_mvm_get_signal_strength(struct iwl_mvm *mvm,
232 234
233static int iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, 235static int iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
234 struct ieee80211_rx_status *stats, 236 struct ieee80211_rx_status *stats,
235 struct iwl_rx_mpdu_desc *desc, int queue, 237 struct iwl_rx_mpdu_desc *desc, u32 pkt_flags,
236 u8 *crypt_len) 238 int queue, u8 *crypt_len)
237{ 239{
238 u16 status = le16_to_cpu(desc->status); 240 u16 status = le16_to_cpu(desc->status);
239 241
@@ -253,6 +255,8 @@ static int iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
253 return -1; 255 return -1;
254 256
255 stats->flag |= RX_FLAG_DECRYPTED; 257 stats->flag |= RX_FLAG_DECRYPTED;
258 if (pkt_flags & FH_RSCSR_RADA_EN)
259 stats->flag |= RX_FLAG_MIC_STRIPPED;
256 *crypt_len = IEEE80211_CCMP_HDR_LEN; 260 *crypt_len = IEEE80211_CCMP_HDR_LEN;
257 return 0; 261 return 0;
258 case IWL_RX_MPDU_STATUS_SEC_TKIP: 262 case IWL_RX_MPDU_STATUS_SEC_TKIP:
@@ -270,6 +274,10 @@ static int iwl_mvm_rx_crypto(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
270 if ((status & IWL_RX_MPDU_STATUS_SEC_MASK) == 274 if ((status & IWL_RX_MPDU_STATUS_SEC_MASK) ==
271 IWL_RX_MPDU_STATUS_SEC_WEP) 275 IWL_RX_MPDU_STATUS_SEC_WEP)
272 *crypt_len = IEEE80211_WEP_IV_LEN; 276 *crypt_len = IEEE80211_WEP_IV_LEN;
277
278 if (pkt_flags & FH_RSCSR_RADA_EN)
279 stats->flag |= RX_FLAG_ICV_STRIPPED;
280
273 return 0; 281 return 0;
274 case IWL_RX_MPDU_STATUS_SEC_EXT_ENC: 282 case IWL_RX_MPDU_STATUS_SEC_EXT_ENC:
275 if (!(status & IWL_RX_MPDU_STATUS_MIC_OK)) 283 if (!(status & IWL_RX_MPDU_STATUS_MIC_OK))
@@ -848,7 +856,9 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
848 856
849 rx_status = IEEE80211_SKB_RXCB(skb); 857 rx_status = IEEE80211_SKB_RXCB(skb);
850 858
851 if (iwl_mvm_rx_crypto(mvm, hdr, rx_status, desc, queue, &crypt_len)) { 859 if (iwl_mvm_rx_crypto(mvm, hdr, rx_status, desc,
860 le32_to_cpu(pkt->len_n_flags), queue,
861 &crypt_len)) {
852 kfree_skb(skb); 862 kfree_skb(skb);
853 return; 863 return;
854 } 864 }
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index c19f98489d4e..1add5615fc3a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -1709,29 +1709,29 @@ void iwl_mvm_dealloc_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta)
1709 sta->sta_id = IWL_MVM_INVALID_STA; 1709 sta->sta_id = IWL_MVM_INVALID_STA;
1710} 1710}
1711 1711
1712static void iwl_mvm_enable_aux_queue(struct iwl_mvm *mvm) 1712static void iwl_mvm_enable_aux_snif_queue(struct iwl_mvm *mvm, u16 *queue,
1713 u8 sta_id, u8 fifo)
1713{ 1714{
1714 unsigned int wdg_timeout = iwlmvm_mod_params.tfd_q_hang_detect ? 1715 unsigned int wdg_timeout = iwlmvm_mod_params.tfd_q_hang_detect ?
1715 mvm->cfg->base_params->wd_timeout : 1716 mvm->cfg->base_params->wd_timeout :
1716 IWL_WATCHDOG_DISABLED; 1717 IWL_WATCHDOG_DISABLED;
1717 1718
1718 if (iwl_mvm_has_new_tx_api(mvm)) { 1719 if (iwl_mvm_has_new_tx_api(mvm)) {
1719 int queue = iwl_mvm_tvqm_enable_txq(mvm, mvm->aux_queue, 1720 int tvqm_queue =
1720 mvm->aux_sta.sta_id, 1721 iwl_mvm_tvqm_enable_txq(mvm, *queue, sta_id,
1721 IWL_MAX_TID_COUNT, 1722 IWL_MAX_TID_COUNT,
1722 wdg_timeout); 1723 wdg_timeout);
1723 mvm->aux_queue = queue; 1724 *queue = tvqm_queue;
1724 } else { 1725 } else {
1725 struct iwl_trans_txq_scd_cfg cfg = { 1726 struct iwl_trans_txq_scd_cfg cfg = {
1726 .fifo = IWL_MVM_TX_FIFO_MCAST, 1727 .fifo = fifo,
1727 .sta_id = mvm->aux_sta.sta_id, 1728 .sta_id = sta_id,
1728 .tid = IWL_MAX_TID_COUNT, 1729 .tid = IWL_MAX_TID_COUNT,
1729 .aggregate = false, 1730 .aggregate = false,
1730 .frame_limit = IWL_FRAME_LIMIT, 1731 .frame_limit = IWL_FRAME_LIMIT,
1731 }; 1732 };
1732 1733
1733 iwl_mvm_enable_txq(mvm, mvm->aux_queue, mvm->aux_queue, 0, &cfg, 1734 iwl_mvm_enable_txq(mvm, *queue, *queue, 0, &cfg, wdg_timeout);
1734 wdg_timeout);
1735 } 1735 }
1736} 1736}
1737 1737
@@ -1750,7 +1750,9 @@ int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm)
1750 1750
1751 /* Map Aux queue to fifo - needs to happen before adding Aux station */ 1751 /* Map Aux queue to fifo - needs to happen before adding Aux station */
1752 if (!iwl_mvm_has_new_tx_api(mvm)) 1752 if (!iwl_mvm_has_new_tx_api(mvm))
1753 iwl_mvm_enable_aux_queue(mvm); 1753 iwl_mvm_enable_aux_snif_queue(mvm, &mvm->aux_queue,
1754 mvm->aux_sta.sta_id,
1755 IWL_MVM_TX_FIFO_MCAST);
1754 1756
1755 ret = iwl_mvm_add_int_sta_common(mvm, &mvm->aux_sta, NULL, 1757 ret = iwl_mvm_add_int_sta_common(mvm, &mvm->aux_sta, NULL,
1756 MAC_INDEX_AUX, 0); 1758 MAC_INDEX_AUX, 0);
@@ -1764,7 +1766,9 @@ int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm)
1764 * to firmware so enable queue here - after the station was added 1766 * to firmware so enable queue here - after the station was added
1765 */ 1767 */
1766 if (iwl_mvm_has_new_tx_api(mvm)) 1768 if (iwl_mvm_has_new_tx_api(mvm))
1767 iwl_mvm_enable_aux_queue(mvm); 1769 iwl_mvm_enable_aux_snif_queue(mvm, &mvm->aux_queue,
1770 mvm->aux_sta.sta_id,
1771 IWL_MVM_TX_FIFO_MCAST);
1768 1772
1769 return 0; 1773 return 0;
1770} 1774}
@@ -1772,10 +1776,31 @@ int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm)
1772int iwl_mvm_add_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 1776int iwl_mvm_add_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
1773{ 1777{
1774 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 1778 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1779 int ret;
1775 1780
1776 lockdep_assert_held(&mvm->mutex); 1781 lockdep_assert_held(&mvm->mutex);
1777 return iwl_mvm_add_int_sta_common(mvm, &mvm->snif_sta, vif->addr, 1782
1783 /* Map snif queue to fifo - must happen before adding snif station */
1784 if (!iwl_mvm_has_new_tx_api(mvm))
1785 iwl_mvm_enable_aux_snif_queue(mvm, &mvm->snif_queue,
1786 mvm->snif_sta.sta_id,
1787 IWL_MVM_TX_FIFO_BE);
1788
1789 ret = iwl_mvm_add_int_sta_common(mvm, &mvm->snif_sta, vif->addr,
1778 mvmvif->id, 0); 1790 mvmvif->id, 0);
1791 if (ret)
1792 return ret;
1793
1794 /*
1795 * For 22000 firmware and on we cannot add queue to a station unknown
1796 * to firmware so enable queue here - after the station was added
1797 */
1798 if (iwl_mvm_has_new_tx_api(mvm))
1799 iwl_mvm_enable_aux_snif_queue(mvm, &mvm->snif_queue,
1800 mvm->snif_sta.sta_id,
1801 IWL_MVM_TX_FIFO_BE);
1802
1803 return 0;
1779} 1804}
1780 1805
1781int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 1806int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
@@ -1784,6 +1809,8 @@ int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
1784 1809
1785 lockdep_assert_held(&mvm->mutex); 1810 lockdep_assert_held(&mvm->mutex);
1786 1811
1812 iwl_mvm_disable_txq(mvm, mvm->snif_queue, mvm->snif_queue,
1813 IWL_MAX_TID_COUNT, 0);
1787 ret = iwl_mvm_rm_sta_common(mvm, mvm->snif_sta.sta_id); 1814 ret = iwl_mvm_rm_sta_common(mvm, mvm->snif_sta.sta_id);
1788 if (ret) 1815 if (ret)
1789 IWL_WARN(mvm, "Failed sending remove station\n"); 1816 IWL_WARN(mvm, "Failed sending remove station\n");
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
index 4d0314912e94..e25cda9fbf6c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
@@ -132,6 +132,24 @@ void iwl_mvm_roc_done_wk(struct work_struct *wk)
132 * executed, and a new time event means a new command. 132 * executed, and a new time event means a new command.
133 */ 133 */
134 iwl_mvm_flush_sta(mvm, &mvm->aux_sta, true, CMD_ASYNC); 134 iwl_mvm_flush_sta(mvm, &mvm->aux_sta, true, CMD_ASYNC);
135
136 /* Do the same for the P2P device queue (STA) */
137 if (test_and_clear_bit(IWL_MVM_STATUS_NEED_FLUSH_P2P, &mvm->status)) {
138 struct iwl_mvm_vif *mvmvif;
139
140 /*
141 * NB: access to this pointer would be racy, but the flush bit
142 * can only be set when we had a P2P-Device VIF, and we have a
143 * flush of this work in iwl_mvm_prepare_mac_removal() so it's
144 * not really racy.
145 */
146
147 if (!WARN_ON(!mvm->p2p_device_vif)) {
148 mvmvif = iwl_mvm_vif_from_mac80211(mvm->p2p_device_vif);
149 iwl_mvm_flush_sta(mvm, &mvmvif->bcast_sta, true,
150 CMD_ASYNC);
151 }
152 }
135} 153}
136 154
137static void iwl_mvm_roc_finished(struct iwl_mvm *mvm) 155static void iwl_mvm_roc_finished(struct iwl_mvm *mvm)
@@ -855,10 +873,12 @@ void iwl_mvm_stop_roc(struct iwl_mvm *mvm)
855 873
856 mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); 874 mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif);
857 875
858 if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) 876 if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) {
859 iwl_mvm_remove_time_event(mvm, mvmvif, te_data); 877 iwl_mvm_remove_time_event(mvm, mvmvif, te_data);
860 else 878 set_bit(IWL_MVM_STATUS_NEED_FLUSH_P2P, &mvm->status);
879 } else {
861 iwl_mvm_remove_aux_roc_te(mvm, mvmvif, te_data); 880 iwl_mvm_remove_aux_roc_te(mvm, mvmvif, te_data);
881 }
862 882
863 iwl_mvm_roc_finished(mvm); 883 iwl_mvm_roc_finished(mvm);
864} 884}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index 593b7f97b29c..333bcb75b8af 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -657,7 +657,8 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)
657 if (ap_sta_id != IWL_MVM_INVALID_STA) 657 if (ap_sta_id != IWL_MVM_INVALID_STA)
658 sta_id = ap_sta_id; 658 sta_id = ap_sta_id;
659 } else if (info.control.vif->type == NL80211_IFTYPE_MONITOR) { 659 } else if (info.control.vif->type == NL80211_IFTYPE_MONITOR) {
660 queue = mvm->aux_queue; 660 queue = mvm->snif_queue;
661 sta_id = mvm->snif_sta.sta_id;
661 } 662 }
662 } 663 }
663 664
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
index d46115e2d69e..03ffd84786ca 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
@@ -1134,9 +1134,18 @@ unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm,
1134 unsigned int default_timeout = 1134 unsigned int default_timeout =
1135 cmd_q ? IWL_DEF_WD_TIMEOUT : mvm->cfg->base_params->wd_timeout; 1135 cmd_q ? IWL_DEF_WD_TIMEOUT : mvm->cfg->base_params->wd_timeout;
1136 1136
1137 if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_TXQ_TIMERS)) 1137 if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_TXQ_TIMERS)) {
1138 /*
1139 * We can't know when the station is asleep or awake, so we
1140 * must disable the queue hang detection.
1141 */
1142 if (fw_has_capa(&mvm->fw->ucode_capa,
1143 IWL_UCODE_TLV_CAPA_STA_PM_NOTIF) &&
1144 vif && vif->type == NL80211_IFTYPE_AP)
1145 return IWL_WATCHDOG_DISABLED;
1138 return iwlmvm_mod_params.tfd_q_hang_detect ? 1146 return iwlmvm_mod_params.tfd_q_hang_detect ?
1139 default_timeout : IWL_WATCHDOG_DISABLED; 1147 default_timeout : IWL_WATCHDOG_DISABLED;
1148 }
1140 1149
1141 trigger = iwl_fw_dbg_get_trigger(mvm->fw, FW_DBG_TRIGGER_TXQ_TIMERS); 1150 trigger = iwl_fw_dbg_get_trigger(mvm->fw, FW_DBG_TRIGGER_TXQ_TIMERS);
1142 txq_timer = (void *)trigger->data; 1151 txq_timer = (void *)trigger->data;
@@ -1163,6 +1172,8 @@ unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm,
1163 return le32_to_cpu(txq_timer->p2p_go); 1172 return le32_to_cpu(txq_timer->p2p_go);
1164 case NL80211_IFTYPE_P2P_DEVICE: 1173 case NL80211_IFTYPE_P2P_DEVICE:
1165 return le32_to_cpu(txq_timer->p2p_device); 1174 return le32_to_cpu(txq_timer->p2p_device);
1175 case NL80211_IFTYPE_MONITOR:
1176 return default_timeout;
1166 default: 1177 default:
1167 WARN_ON(1); 1178 WARN_ON(1);
1168 return mvm->cfg->base_params->wd_timeout; 1179 return mvm->cfg->base_params->wd_timeout;
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index f21fe59faccf..ccd7c33c4c28 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -553,6 +553,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
553 {IWL_PCI_DEVICE(0x271B, 0x0014, iwl9160_2ac_cfg)}, 553 {IWL_PCI_DEVICE(0x271B, 0x0014, iwl9160_2ac_cfg)},
554 {IWL_PCI_DEVICE(0x271B, 0x0210, iwl9160_2ac_cfg)}, 554 {IWL_PCI_DEVICE(0x271B, 0x0210, iwl9160_2ac_cfg)},
555 {IWL_PCI_DEVICE(0x271B, 0x0214, iwl9260_2ac_cfg)}, 555 {IWL_PCI_DEVICE(0x271B, 0x0214, iwl9260_2ac_cfg)},
556 {IWL_PCI_DEVICE(0x271C, 0x0214, iwl9260_2ac_cfg)},
556 {IWL_PCI_DEVICE(0x2720, 0x0034, iwl9560_2ac_cfg)}, 557 {IWL_PCI_DEVICE(0x2720, 0x0034, iwl9560_2ac_cfg)},
557 {IWL_PCI_DEVICE(0x2720, 0x0038, iwl9560_2ac_cfg)}, 558 {IWL_PCI_DEVICE(0x2720, 0x0038, iwl9560_2ac_cfg)},
558 {IWL_PCI_DEVICE(0x2720, 0x003C, iwl9560_2ac_cfg)}, 559 {IWL_PCI_DEVICE(0x2720, 0x003C, iwl9560_2ac_cfg)},
@@ -664,6 +665,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
664 {IWL_PCI_DEVICE(0x2720, 0x0310, iwla000_2ac_cfg_hr_cdb)}, 665 {IWL_PCI_DEVICE(0x2720, 0x0310, iwla000_2ac_cfg_hr_cdb)},
665 {IWL_PCI_DEVICE(0x40C0, 0x0000, iwla000_2ax_cfg_hr)}, 666 {IWL_PCI_DEVICE(0x40C0, 0x0000, iwla000_2ax_cfg_hr)},
666 {IWL_PCI_DEVICE(0x40C0, 0x0A10, iwla000_2ax_cfg_hr)}, 667 {IWL_PCI_DEVICE(0x40C0, 0x0A10, iwla000_2ax_cfg_hr)},
668 {IWL_PCI_DEVICE(0xA0F0, 0x0000, iwla000_2ax_cfg_hr)},
667 669
668#endif /* CONFIG_IWLMVM */ 670#endif /* CONFIG_IWLMVM */
669 671
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
index c59f4581e972..ac05fd1e74c4 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
@@ -49,6 +49,7 @@
49 * 49 *
50 *****************************************************************************/ 50 *****************************************************************************/
51#include "iwl-trans.h" 51#include "iwl-trans.h"
52#include "iwl-prph.h"
52#include "iwl-context-info.h" 53#include "iwl-context-info.h"
53#include "internal.h" 54#include "internal.h"
54 55
@@ -156,6 +157,11 @@ void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans, bool low_power)
156 157
157 trans_pcie->is_down = true; 158 trans_pcie->is_down = true;
158 159
160 /* Stop dbgc before stopping device */
161 iwl_write_prph(trans, DBGC_IN_SAMPLE, 0);
162 udelay(100);
163 iwl_write_prph(trans, DBGC_OUT_CTRL, 0);
164
159 /* tell the device to stop sending interrupts */ 165 /* tell the device to stop sending interrupts */
160 iwl_disable_interrupts(trans); 166 iwl_disable_interrupts(trans);
161 167
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index b7a51603465b..4541c86881d6 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -166,6 +166,7 @@ static void iwl_trans_pcie_dump_regs(struct iwl_trans *trans)
166 print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, 32, 166 print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, 32,
167 4, buf, i, 0); 167 4, buf, i, 0);
168 } 168 }
169 goto out;
169 170
170err_read: 171err_read:
171 print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, 32, 4, buf, i, 0); 172 print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, 32, 4, buf, i, 0);
@@ -1226,6 +1227,15 @@ static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power)
1226 1227
1227 trans_pcie->is_down = true; 1228 trans_pcie->is_down = true;
1228 1229
1230 /* Stop dbgc before stopping device */
1231 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) {
1232 iwl_set_bits_prph(trans, MON_BUFF_SAMPLE_CTL, 0x100);
1233 } else {
1234 iwl_write_prph(trans, DBGC_IN_SAMPLE, 0);
1235 udelay(100);
1236 iwl_write_prph(trans, DBGC_OUT_CTRL, 0);
1237 }
1238
1229 /* tell the device to stop sending interrupts */ 1239 /* tell the device to stop sending interrupts */
1230 iwl_disable_interrupts(trans); 1240 iwl_disable_interrupts(trans);
1231 1241
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index d6dff347f896..78ebe494fef0 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -186,7 +186,7 @@ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
186 /* Obtain the queue to be used to transmit this packet */ 186 /* Obtain the queue to be used to transmit this packet */
187 index = skb_get_queue_mapping(skb); 187 index = skb_get_queue_mapping(skb);
188 if (index >= num_queues) { 188 if (index >= num_queues) {
189 pr_warn_ratelimited("Invalid queue %hu for packet on interface %s\n.", 189 pr_warn_ratelimited("Invalid queue %hu for packet on interface %s\n",
190 index, vif->dev->name); 190 index, vif->dev->name);
191 index %= num_queues; 191 index %= num_queues;
192 } 192 }
diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c
index 539a26444f31..7d49d4865298 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-socket.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c
@@ -71,16 +71,12 @@ lnet_sock_ioctl(int cmd, unsigned long arg)
71 } 71 }
72 72
73 sock_filp = sock_alloc_file(sock, 0, NULL); 73 sock_filp = sock_alloc_file(sock, 0, NULL);
74 if (IS_ERR(sock_filp)) { 74 if (IS_ERR(sock_filp))
75 sock_release(sock); 75 return PTR_ERR(sock_filp);
76 rc = PTR_ERR(sock_filp);
77 goto out;
78 }
79 76
80 rc = kernel_sock_unlocked_ioctl(sock_filp, cmd, arg); 77 rc = kernel_sock_unlocked_ioctl(sock_filp, cmd, arg);
81 78
82 fput(sock_filp); 79 fput(sock_filp);
83out:
84 return rc; 80 return rc;
85} 81}
86 82
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 2c9c87d8a0c1..7546822a1d74 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -15,6 +15,7 @@
15#define _LINUX_PERF_EVENT_H 15#define _LINUX_PERF_EVENT_H
16 16
17#include <uapi/linux/perf_event.h> 17#include <uapi/linux/perf_event.h>
18#include <uapi/linux/bpf_perf_event.h>
18 19
19/* 20/*
20 * Kernel-internal data types and definitions: 21 * Kernel-internal data types and definitions:
@@ -787,7 +788,7 @@ struct perf_output_handle {
787}; 788};
788 789
789struct bpf_perf_event_data_kern { 790struct bpf_perf_event_data_kern {
790 struct pt_regs *regs; 791 bpf_user_pt_regs_t *regs;
791 struct perf_sample_data *data; 792 struct perf_sample_data *data;
792 struct perf_event *event; 793 struct perf_event *event;
793}; 794};
@@ -1177,6 +1178,9 @@ extern void perf_bp_event(struct perf_event *event, void *data);
1177 (user_mode(regs) ? PERF_RECORD_MISC_USER : PERF_RECORD_MISC_KERNEL) 1178 (user_mode(regs) ? PERF_RECORD_MISC_USER : PERF_RECORD_MISC_KERNEL)
1178# define perf_instruction_pointer(regs) instruction_pointer(regs) 1179# define perf_instruction_pointer(regs) instruction_pointer(regs)
1179#endif 1180#endif
1181#ifndef perf_arch_bpf_user_pt_regs
1182# define perf_arch_bpf_user_pt_regs(regs) regs
1183#endif
1180 1184
1181static inline bool has_branch_stack(struct perf_event *event) 1185static inline bool has_branch_stack(struct perf_event *event)
1182{ 1186{
diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h
index a328e8181e49..e4b257ff881b 100644
--- a/include/linux/rculist_nulls.h
+++ b/include/linux/rculist_nulls.h
@@ -101,44 +101,6 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
101} 101}
102 102
103/** 103/**
104 * hlist_nulls_add_tail_rcu
105 * @n: the element to add to the hash list.
106 * @h: the list to add to.
107 *
108 * Description:
109 * Adds the specified element to the end of the specified hlist_nulls,
110 * while permitting racing traversals. NOTE: tail insertion requires
111 * list traversal.
112 *
113 * The caller must take whatever precautions are necessary
114 * (such as holding appropriate locks) to avoid racing
115 * with another list-mutation primitive, such as hlist_nulls_add_head_rcu()
116 * or hlist_nulls_del_rcu(), running on this same list.
117 * However, it is perfectly legal to run concurrently with
118 * the _rcu list-traversal primitives, such as
119 * hlist_nulls_for_each_entry_rcu(), used to prevent memory-consistency
120 * problems on Alpha CPUs. Regardless of the type of CPU, the
121 * list-traversal primitive must be guarded by rcu_read_lock().
122 */
123static inline void hlist_nulls_add_tail_rcu(struct hlist_nulls_node *n,
124 struct hlist_nulls_head *h)
125{
126 struct hlist_nulls_node *i, *last = NULL;
127
128 for (i = hlist_nulls_first_rcu(h); !is_a_nulls(i);
129 i = hlist_nulls_next_rcu(i))
130 last = i;
131
132 if (last) {
133 n->next = last->next;
134 n->pprev = &last->next;
135 rcu_assign_pointer(hlist_nulls_next_rcu(last), n);
136 } else {
137 hlist_nulls_add_head_rcu(n, h);
138 }
139}
140
141/**
142 * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type 104 * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type
143 * @tpos: the type * to use as a loop cursor. 105 * @tpos: the type * to use as a loop cursor.
144 * @pos: the &struct hlist_nulls_node to use as a loop cursor. 106 * @pos: the &struct hlist_nulls_node to use as a loop cursor.
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index df5d97a85e1a..ca4a6361389b 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -224,7 +224,8 @@ struct tcp_sock {
224 rate_app_limited:1, /* rate_{delivered,interval_us} limited? */ 224 rate_app_limited:1, /* rate_{delivered,interval_us} limited? */
225 fastopen_connect:1, /* FASTOPEN_CONNECT sockopt */ 225 fastopen_connect:1, /* FASTOPEN_CONNECT sockopt */
226 fastopen_no_cookie:1, /* Allow send/recv SYN+data without a cookie */ 226 fastopen_no_cookie:1, /* Allow send/recv SYN+data without a cookie */
227 unused:3; 227 is_sack_reneg:1, /* in recovery from loss with SACK reneg? */
228 unused:2;
228 u8 nonagle : 4,/* Disable Nagle algorithm? */ 229 u8 nonagle : 4,/* Disable Nagle algorithm? */
229 thin_lto : 1,/* Use linear timeouts for thin streams */ 230 thin_lto : 1,/* Use linear timeouts for thin streams */
230 unused1 : 1, 231 unused1 : 1,
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index a69877734c4e..e2ec3582e549 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -82,6 +82,7 @@ struct usbnet {
82# define EVENT_RX_KILL 10 82# define EVENT_RX_KILL 10
83# define EVENT_LINK_CHANGE 11 83# define EVENT_LINK_CHANGE 11
84# define EVENT_SET_RX_MODE 12 84# define EVENT_SET_RX_MODE 12
85# define EVENT_NO_IP_ALIGN 13
85}; 86};
86 87
87static inline struct usb_driver *driver_of(struct usb_interface *intf) 88static inline struct usb_driver *driver_of(struct usb_interface *intf)
diff --git a/include/net/red.h b/include/net/red.h
index 9a9347710701..9665582c4687 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -168,6 +168,17 @@ static inline void red_set_vars(struct red_vars *v)
168 v->qcount = -1; 168 v->qcount = -1;
169} 169}
170 170
171static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog)
172{
173 if (fls(qth_min) + Wlog > 32)
174 return false;
175 if (fls(qth_max) + Wlog > 32)
176 return false;
177 if (qth_max < qth_min)
178 return false;
179 return true;
180}
181
171static inline void red_set_parms(struct red_parms *p, 182static inline void red_set_parms(struct red_parms *p,
172 u32 qth_min, u32 qth_max, u8 Wlog, u8 Plog, 183 u32 qth_min, u32 qth_max, u8 Wlog, u8 Plog,
173 u8 Scell_log, u8 *stab, u32 max_P) 184 u8 Scell_log, u8 *stab, u32 max_P)
@@ -179,7 +190,7 @@ static inline void red_set_parms(struct red_parms *p,
179 p->qth_max = qth_max << Wlog; 190 p->qth_max = qth_max << Wlog;
180 p->Wlog = Wlog; 191 p->Wlog = Wlog;
181 p->Plog = Plog; 192 p->Plog = Plog;
182 if (delta < 0) 193 if (delta <= 0)
183 delta = 1; 194 delta = 1;
184 p->qth_delta = delta; 195 p->qth_delta = delta;
185 if (!max_P) { 196 if (!max_P) {
diff --git a/include/net/sock.h b/include/net/sock.h
index 79e1a2c7912c..9155da422692 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -685,11 +685,7 @@ static inline void sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
685 685
686static inline void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) 686static inline void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
687{ 687{
688 if (IS_ENABLED(CONFIG_IPV6) && sk->sk_reuseport && 688 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list);
689 sk->sk_family == AF_INET6)
690 hlist_nulls_add_tail_rcu(&sk->sk_nulls_node, list);
691 else
692 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list);
693} 689}
694 690
695static inline void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) 691static inline void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 6998707e81f3..6da880d2f022 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1055,7 +1055,7 @@ void tcp_rate_skb_sent(struct sock *sk, struct sk_buff *skb);
1055void tcp_rate_skb_delivered(struct sock *sk, struct sk_buff *skb, 1055void tcp_rate_skb_delivered(struct sock *sk, struct sk_buff *skb,
1056 struct rate_sample *rs); 1056 struct rate_sample *rs);
1057void tcp_rate_gen(struct sock *sk, u32 delivered, u32 lost, 1057void tcp_rate_gen(struct sock *sk, u32 delivered, u32 lost,
1058 struct rate_sample *rs); 1058 bool is_sack_reneg, struct rate_sample *rs);
1059void tcp_rate_check_app_limited(struct sock *sk); 1059void tcp_rate_check_app_limited(struct sock *sk);
1060 1060
1061/* These functions determine how the current flow behaves in respect of SACK 1061/* These functions determine how the current flow behaves in respect of SACK
diff --git a/include/uapi/asm-generic/bpf_perf_event.h b/include/uapi/asm-generic/bpf_perf_event.h
new file mode 100644
index 000000000000..53815d2cd047
--- /dev/null
+++ b/include/uapi/asm-generic/bpf_perf_event.h
@@ -0,0 +1,9 @@
1#ifndef _UAPI__ASM_GENERIC_BPF_PERF_EVENT_H__
2#define _UAPI__ASM_GENERIC_BPF_PERF_EVENT_H__
3
4#include <linux/ptrace.h>
5
6/* Export kernel pt_regs structure */
7typedef struct pt_regs bpf_user_pt_regs_t;
8
9#endif /* _UAPI__ASM_GENERIC_BPF_PERF_EVENT_H__ */
diff --git a/include/uapi/linux/bpf_perf_event.h b/include/uapi/linux/bpf_perf_event.h
index af549d4ecf1b..8f95303f9d80 100644
--- a/include/uapi/linux/bpf_perf_event.h
+++ b/include/uapi/linux/bpf_perf_event.h
@@ -8,11 +8,10 @@
8#ifndef _UAPI__LINUX_BPF_PERF_EVENT_H__ 8#ifndef _UAPI__LINUX_BPF_PERF_EVENT_H__
9#define _UAPI__LINUX_BPF_PERF_EVENT_H__ 9#define _UAPI__LINUX_BPF_PERF_EVENT_H__
10 10
11#include <linux/types.h> 11#include <asm/bpf_perf_event.h>
12#include <linux/ptrace.h>
13 12
14struct bpf_perf_event_data { 13struct bpf_perf_event_data {
15 struct pt_regs regs; 14 bpf_user_pt_regs_t regs;
16 __u64 sample_period; 15 __u64 sample_period;
17}; 16};
18 17
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 5961ef6dfd64..4df5b695bf0d 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7990,11 +7990,11 @@ static void bpf_overflow_handler(struct perf_event *event,
7990{ 7990{
7991 struct bpf_perf_event_data_kern ctx = { 7991 struct bpf_perf_event_data_kern ctx = {
7992 .data = data, 7992 .data = data,
7993 .regs = regs,
7994 .event = event, 7993 .event = event,
7995 }; 7994 };
7996 int ret = 0; 7995 int ret = 0;
7997 7996
7997 ctx.regs = perf_arch_bpf_user_pt_regs(regs);
7998 preempt_disable(); 7998 preempt_disable();
7999 if (unlikely(__this_cpu_inc_return(bpf_prog_active) != 1)) 7999 if (unlikely(__this_cpu_inc_return(bpf_prog_active) != 1))
8000 goto out; 8000 goto out;
diff --git a/lib/nlattr.c b/lib/nlattr.c
index 8bf78b4b78f0..dfa55c873c13 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -15,7 +15,11 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <net/netlink.h> 16#include <net/netlink.h>
17 17
18/* for these data types attribute length must be exactly given size */ 18/* For these data types, attribute length should be exactly the given
19 * size. However, to maintain compatibility with broken commands, if the
20 * attribute length does not match the expected size a warning is emitted
21 * to the user that the command is sending invalid data and needs to be fixed.
22 */
19static const u8 nla_attr_len[NLA_TYPE_MAX+1] = { 23static const u8 nla_attr_len[NLA_TYPE_MAX+1] = {
20 [NLA_U8] = sizeof(u8), 24 [NLA_U8] = sizeof(u8),
21 [NLA_U16] = sizeof(u16), 25 [NLA_U16] = sizeof(u16),
@@ -28,8 +32,16 @@ static const u8 nla_attr_len[NLA_TYPE_MAX+1] = {
28}; 32};
29 33
30static const u8 nla_attr_minlen[NLA_TYPE_MAX+1] = { 34static const u8 nla_attr_minlen[NLA_TYPE_MAX+1] = {
35 [NLA_U8] = sizeof(u8),
36 [NLA_U16] = sizeof(u16),
37 [NLA_U32] = sizeof(u32),
38 [NLA_U64] = sizeof(u64),
31 [NLA_MSECS] = sizeof(u64), 39 [NLA_MSECS] = sizeof(u64),
32 [NLA_NESTED] = NLA_HDRLEN, 40 [NLA_NESTED] = NLA_HDRLEN,
41 [NLA_S8] = sizeof(s8),
42 [NLA_S16] = sizeof(s16),
43 [NLA_S32] = sizeof(s32),
44 [NLA_S64] = sizeof(s64),
33}; 45};
34 46
35static int validate_nla_bitfield32(const struct nlattr *nla, 47static int validate_nla_bitfield32(const struct nlattr *nla,
@@ -69,11 +81,9 @@ static int validate_nla(const struct nlattr *nla, int maxtype,
69 81
70 BUG_ON(pt->type > NLA_TYPE_MAX); 82 BUG_ON(pt->type > NLA_TYPE_MAX);
71 83
72 /* for data types NLA_U* and NLA_S* require exact length */ 84 if (nla_attr_len[pt->type] && attrlen != nla_attr_len[pt->type]) {
73 if (nla_attr_len[pt->type]) { 85 pr_warn_ratelimited("netlink: '%s': attribute type %d has an invalid length.\n",
74 if (attrlen != nla_attr_len[pt->type]) 86 current->comm, type);
75 return -ERANGE;
76 return 0;
77 } 87 }
78 88
79 switch (pt->type) { 89 switch (pt->type) {
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 985046ae4231..80f5c79053a4 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -839,7 +839,6 @@ static int p9_socket_open(struct p9_client *client, struct socket *csocket)
839 if (IS_ERR(file)) { 839 if (IS_ERR(file)) {
840 pr_err("%s (%d): failed to map fd\n", 840 pr_err("%s (%d): failed to map fd\n",
841 __func__, task_pid_nr(current)); 841 __func__, task_pid_nr(current));
842 sock_release(csocket);
843 kfree(p); 842 kfree(p);
844 return PTR_ERR(file); 843 return PTR_ERR(file);
845 } 844 }
diff --git a/net/core/dev.c b/net/core/dev.c
index 07ed21d64f92..f47e96b62308 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1106,7 +1106,7 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)
1106 * when the name is long and there isn't enough space left 1106 * when the name is long and there isn't enough space left
1107 * for the digits, or if all bits are used. 1107 * for the digits, or if all bits are used.
1108 */ 1108 */
1109 return p ? -ENFILE : -EEXIST; 1109 return -ENFILE;
1110} 1110}
1111 1111
1112static int dev_alloc_name_ns(struct net *net, 1112static int dev_alloc_name_ns(struct net *net,
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index b68168fcc06a..9d43c1f40274 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -259,6 +259,7 @@ int dccp_disconnect(struct sock *sk, int flags)
259{ 259{
260 struct inet_connection_sock *icsk = inet_csk(sk); 260 struct inet_connection_sock *icsk = inet_csk(sk);
261 struct inet_sock *inet = inet_sk(sk); 261 struct inet_sock *inet = inet_sk(sk);
262 struct dccp_sock *dp = dccp_sk(sk);
262 int err = 0; 263 int err = 0;
263 const int old_state = sk->sk_state; 264 const int old_state = sk->sk_state;
264 265
@@ -278,6 +279,10 @@ int dccp_disconnect(struct sock *sk, int flags)
278 sk->sk_err = ECONNRESET; 279 sk->sk_err = ECONNRESET;
279 280
280 dccp_clear_xmit_timers(sk); 281 dccp_clear_xmit_timers(sk);
282 ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk);
283 ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk);
284 dp->dccps_hc_rx_ccid = NULL;
285 dp->dccps_hc_tx_ccid = NULL;
281 286
282 __skb_queue_purge(&sk->sk_receive_queue); 287 __skb_queue_purge(&sk->sk_receive_queue);
283 __skb_queue_purge(&sk->sk_write_queue); 288 __skb_queue_purge(&sk->sk_write_queue);
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index c690cd0d9b3f..b563e0c46bac 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -93,7 +93,7 @@ static void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
93} 93}
94 94
95/* 95/*
96 * Enter the time wait state. 96 * Enter the time wait state. This is called with locally disabled BH.
97 * Essentially we whip up a timewait bucket, copy the relevant info into it 97 * Essentially we whip up a timewait bucket, copy the relevant info into it
98 * from the SK, and mess with hash chains and list linkage. 98 * from the SK, and mess with hash chains and list linkage.
99 */ 99 */
@@ -111,7 +111,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
111 */ 111 */
112 bhead = &hashinfo->bhash[inet_bhashfn(twsk_net(tw), inet->inet_num, 112 bhead = &hashinfo->bhash[inet_bhashfn(twsk_net(tw), inet->inet_num,
113 hashinfo->bhash_size)]; 113 hashinfo->bhash_size)];
114 spin_lock_bh(&bhead->lock); 114 spin_lock(&bhead->lock);
115 tw->tw_tb = icsk->icsk_bind_hash; 115 tw->tw_tb = icsk->icsk_bind_hash;
116 WARN_ON(!icsk->icsk_bind_hash); 116 WARN_ON(!icsk->icsk_bind_hash);
117 inet_twsk_add_bind_node(tw, &tw->tw_tb->owners); 117 inet_twsk_add_bind_node(tw, &tw->tw_tb->owners);
@@ -137,7 +137,7 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
137 if (__sk_nulls_del_node_init_rcu(sk)) 137 if (__sk_nulls_del_node_init_rcu(sk))
138 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); 138 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
139 139
140 spin_unlock_bh(lock); 140 spin_unlock(lock);
141} 141}
142EXPORT_SYMBOL_GPL(__inet_twsk_hashdance); 142EXPORT_SYMBOL_GPL(__inet_twsk_hashdance);
143 143
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index bf97317e6c97..f08eebe60446 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2412,6 +2412,7 @@ int tcp_disconnect(struct sock *sk, int flags)
2412 tp->snd_cwnd_cnt = 0; 2412 tp->snd_cwnd_cnt = 0;
2413 tp->window_clamp = 0; 2413 tp->window_clamp = 0;
2414 tcp_set_ca_state(sk, TCP_CA_Open); 2414 tcp_set_ca_state(sk, TCP_CA_Open);
2415 tp->is_sack_reneg = 0;
2415 tcp_clear_retrans(tp); 2416 tcp_clear_retrans(tp);
2416 inet_csk_delack_init(sk); 2417 inet_csk_delack_init(sk);
2417 /* Initialize rcv_mss to TCP_MIN_MSS to avoid division by 0 2418 /* Initialize rcv_mss to TCP_MIN_MSS to avoid division by 0
diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c
index 69ee877574d0..8322f26e770e 100644
--- a/net/ipv4/tcp_bbr.c
+++ b/net/ipv4/tcp_bbr.c
@@ -110,7 +110,8 @@ struct bbr {
110 u32 lt_last_lost; /* LT intvl start: tp->lost */ 110 u32 lt_last_lost; /* LT intvl start: tp->lost */
111 u32 pacing_gain:10, /* current gain for setting pacing rate */ 111 u32 pacing_gain:10, /* current gain for setting pacing rate */
112 cwnd_gain:10, /* current gain for setting cwnd */ 112 cwnd_gain:10, /* current gain for setting cwnd */
113 full_bw_cnt:3, /* number of rounds without large bw gains */ 113 full_bw_reached:1, /* reached full bw in Startup? */
114 full_bw_cnt:2, /* number of rounds without large bw gains */
114 cycle_idx:3, /* current index in pacing_gain cycle array */ 115 cycle_idx:3, /* current index in pacing_gain cycle array */
115 has_seen_rtt:1, /* have we seen an RTT sample yet? */ 116 has_seen_rtt:1, /* have we seen an RTT sample yet? */
116 unused_b:5; 117 unused_b:5;
@@ -180,7 +181,7 @@ static bool bbr_full_bw_reached(const struct sock *sk)
180{ 181{
181 const struct bbr *bbr = inet_csk_ca(sk); 182 const struct bbr *bbr = inet_csk_ca(sk);
182 183
183 return bbr->full_bw_cnt >= bbr_full_bw_cnt; 184 return bbr->full_bw_reached;
184} 185}
185 186
186/* Return the windowed max recent bandwidth sample, in pkts/uS << BW_SCALE. */ 187/* Return the windowed max recent bandwidth sample, in pkts/uS << BW_SCALE. */
@@ -717,6 +718,7 @@ static void bbr_check_full_bw_reached(struct sock *sk,
717 return; 718 return;
718 } 719 }
719 ++bbr->full_bw_cnt; 720 ++bbr->full_bw_cnt;
721 bbr->full_bw_reached = bbr->full_bw_cnt >= bbr_full_bw_cnt;
720} 722}
721 723
722/* If pipe is probably full, drain the queue and then enter steady-state. */ 724/* If pipe is probably full, drain the queue and then enter steady-state. */
@@ -850,6 +852,7 @@ static void bbr_init(struct sock *sk)
850 bbr->restore_cwnd = 0; 852 bbr->restore_cwnd = 0;
851 bbr->round_start = 0; 853 bbr->round_start = 0;
852 bbr->idle_restart = 0; 854 bbr->idle_restart = 0;
855 bbr->full_bw_reached = 0;
853 bbr->full_bw = 0; 856 bbr->full_bw = 0;
854 bbr->full_bw_cnt = 0; 857 bbr->full_bw_cnt = 0;
855 bbr->cycle_mstamp = 0; 858 bbr->cycle_mstamp = 0;
@@ -871,6 +874,11 @@ static u32 bbr_sndbuf_expand(struct sock *sk)
871 */ 874 */
872static u32 bbr_undo_cwnd(struct sock *sk) 875static u32 bbr_undo_cwnd(struct sock *sk)
873{ 876{
877 struct bbr *bbr = inet_csk_ca(sk);
878
879 bbr->full_bw = 0; /* spurious slow-down; reset full pipe detection */
880 bbr->full_bw_cnt = 0;
881 bbr_reset_lt_bw_sampling(sk);
874 return tcp_sk(sk)->snd_cwnd; 882 return tcp_sk(sk)->snd_cwnd;
875} 883}
876 884
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 734cfc8ff76e..9550cc42de2d 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -579,6 +579,7 @@ void tcp_rcv_space_adjust(struct sock *sk)
579 int time; 579 int time;
580 int copied; 580 int copied;
581 581
582 tcp_mstamp_refresh(tp);
582 time = tcp_stamp_us_delta(tp->tcp_mstamp, tp->rcvq_space.time); 583 time = tcp_stamp_us_delta(tp->tcp_mstamp, tp->rcvq_space.time);
583 if (time < (tp->rcv_rtt_est.rtt_us >> 3) || tp->rcv_rtt_est.rtt_us == 0) 584 if (time < (tp->rcv_rtt_est.rtt_us >> 3) || tp->rcv_rtt_est.rtt_us == 0)
584 return; 585 return;
@@ -1941,6 +1942,8 @@ void tcp_enter_loss(struct sock *sk)
1941 if (is_reneg) { 1942 if (is_reneg) {
1942 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSACKRENEGING); 1943 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSACKRENEGING);
1943 tp->sacked_out = 0; 1944 tp->sacked_out = 0;
1945 /* Mark SACK reneging until we recover from this loss event. */
1946 tp->is_sack_reneg = 1;
1944 } 1947 }
1945 tcp_clear_all_retrans_hints(tp); 1948 tcp_clear_all_retrans_hints(tp);
1946 1949
@@ -2326,6 +2329,7 @@ static void tcp_undo_cwnd_reduction(struct sock *sk, bool unmark_loss)
2326 } 2329 }
2327 tp->snd_cwnd_stamp = tcp_jiffies32; 2330 tp->snd_cwnd_stamp = tcp_jiffies32;
2328 tp->undo_marker = 0; 2331 tp->undo_marker = 0;
2332 tp->rack.advanced = 1; /* Force RACK to re-exam losses */
2329} 2333}
2330 2334
2331static inline bool tcp_may_undo(const struct tcp_sock *tp) 2335static inline bool tcp_may_undo(const struct tcp_sock *tp)
@@ -2364,6 +2368,7 @@ static bool tcp_try_undo_recovery(struct sock *sk)
2364 return true; 2368 return true;
2365 } 2369 }
2366 tcp_set_ca_state(sk, TCP_CA_Open); 2370 tcp_set_ca_state(sk, TCP_CA_Open);
2371 tp->is_sack_reneg = 0;
2367 return false; 2372 return false;
2368} 2373}
2369 2374
@@ -2397,8 +2402,10 @@ static bool tcp_try_undo_loss(struct sock *sk, bool frto_undo)
2397 NET_INC_STATS(sock_net(sk), 2402 NET_INC_STATS(sock_net(sk),
2398 LINUX_MIB_TCPSPURIOUSRTOS); 2403 LINUX_MIB_TCPSPURIOUSRTOS);
2399 inet_csk(sk)->icsk_retransmits = 0; 2404 inet_csk(sk)->icsk_retransmits = 0;
2400 if (frto_undo || tcp_is_sack(tp)) 2405 if (frto_undo || tcp_is_sack(tp)) {
2401 tcp_set_ca_state(sk, TCP_CA_Open); 2406 tcp_set_ca_state(sk, TCP_CA_Open);
2407 tp->is_sack_reneg = 0;
2408 }
2402 return true; 2409 return true;
2403 } 2410 }
2404 return false; 2411 return false;
@@ -3495,6 +3502,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
3495 struct tcp_sacktag_state sack_state; 3502 struct tcp_sacktag_state sack_state;
3496 struct rate_sample rs = { .prior_delivered = 0 }; 3503 struct rate_sample rs = { .prior_delivered = 0 };
3497 u32 prior_snd_una = tp->snd_una; 3504 u32 prior_snd_una = tp->snd_una;
3505 bool is_sack_reneg = tp->is_sack_reneg;
3498 u32 ack_seq = TCP_SKB_CB(skb)->seq; 3506 u32 ack_seq = TCP_SKB_CB(skb)->seq;
3499 u32 ack = TCP_SKB_CB(skb)->ack_seq; 3507 u32 ack = TCP_SKB_CB(skb)->ack_seq;
3500 bool is_dupack = false; 3508 bool is_dupack = false;
@@ -3611,7 +3619,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
3611 3619
3612 delivered = tp->delivered - delivered; /* freshly ACKed or SACKed */ 3620 delivered = tp->delivered - delivered; /* freshly ACKed or SACKed */
3613 lost = tp->lost - lost; /* freshly marked lost */ 3621 lost = tp->lost - lost; /* freshly marked lost */
3614 tcp_rate_gen(sk, delivered, lost, sack_state.rate); 3622 tcp_rate_gen(sk, delivered, lost, is_sack_reneg, sack_state.rate);
3615 tcp_cong_control(sk, ack, delivered, flag, sack_state.rate); 3623 tcp_cong_control(sk, ack, delivered, flag, sack_state.rate);
3616 tcp_xmit_recovery(sk, rexmit); 3624 tcp_xmit_recovery(sk, rexmit);
3617 return 1; 3625 return 1;
diff --git a/net/ipv4/tcp_rate.c b/net/ipv4/tcp_rate.c
index 3330a370d306..c61240e43923 100644
--- a/net/ipv4/tcp_rate.c
+++ b/net/ipv4/tcp_rate.c
@@ -106,7 +106,7 @@ void tcp_rate_skb_delivered(struct sock *sk, struct sk_buff *skb,
106 106
107/* Update the connection delivery information and generate a rate sample. */ 107/* Update the connection delivery information and generate a rate sample. */
108void tcp_rate_gen(struct sock *sk, u32 delivered, u32 lost, 108void tcp_rate_gen(struct sock *sk, u32 delivered, u32 lost,
109 struct rate_sample *rs) 109 bool is_sack_reneg, struct rate_sample *rs)
110{ 110{
111 struct tcp_sock *tp = tcp_sk(sk); 111 struct tcp_sock *tp = tcp_sk(sk);
112 u32 snd_us, ack_us; 112 u32 snd_us, ack_us;
@@ -124,8 +124,12 @@ void tcp_rate_gen(struct sock *sk, u32 delivered, u32 lost,
124 124
125 rs->acked_sacked = delivered; /* freshly ACKed or SACKed */ 125 rs->acked_sacked = delivered; /* freshly ACKed or SACKed */
126 rs->losses = lost; /* freshly marked lost */ 126 rs->losses = lost; /* freshly marked lost */
127 /* Return an invalid sample if no timing information is available. */ 127 /* Return an invalid sample if no timing information is available or
128 if (!rs->prior_mstamp) { 128 * in recovery from loss with SACK reneging. Rate samples taken during
129 * a SACK reneging event may overestimate bw by including packets that
130 * were SACKed before the reneg.
131 */
132 if (!rs->prior_mstamp || is_sack_reneg) {
129 rs->delivered = -1; 133 rs->delivered = -1;
130 rs->interval_us = -1; 134 rs->interval_us = -1;
131 return; 135 return;
diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c
index d3ea89020c69..3a81720ac0c4 100644
--- a/net/ipv4/tcp_recovery.c
+++ b/net/ipv4/tcp_recovery.c
@@ -55,7 +55,8 @@ static void tcp_rack_detect_loss(struct sock *sk, u32 *reo_timeout)
55 * to queuing or delayed ACKs. 55 * to queuing or delayed ACKs.
56 */ 56 */
57 reo_wnd = 1000; 57 reo_wnd = 1000;
58 if ((tp->rack.reord || !tp->lost_out) && min_rtt != ~0U) { 58 if ((tp->rack.reord || inet_csk(sk)->icsk_ca_state < TCP_CA_Recovery) &&
59 min_rtt != ~0U) {
59 reo_wnd = max((min_rtt >> 2) * tp->rack.reo_wnd_steps, reo_wnd); 60 reo_wnd = max((min_rtt >> 2) * tp->rack.reo_wnd_steps, reo_wnd);
60 reo_wnd = min(reo_wnd, tp->srtt_us >> 3); 61 reo_wnd = min(reo_wnd, tp->srtt_us >> 3);
61 } 62 }
@@ -79,12 +80,12 @@ static void tcp_rack_detect_loss(struct sock *sk, u32 *reo_timeout)
79 */ 80 */
80 remaining = tp->rack.rtt_us + reo_wnd - 81 remaining = tp->rack.rtt_us + reo_wnd -
81 tcp_stamp_us_delta(tp->tcp_mstamp, skb->skb_mstamp); 82 tcp_stamp_us_delta(tp->tcp_mstamp, skb->skb_mstamp);
82 if (remaining < 0) { 83 if (remaining <= 0) {
83 tcp_rack_mark_skb_lost(sk, skb); 84 tcp_rack_mark_skb_lost(sk, skb);
84 list_del_init(&skb->tcp_tsorted_anchor); 85 list_del_init(&skb->tcp_tsorted_anchor);
85 } else { 86 } else {
86 /* Record maximum wait time (+1 to avoid 0) */ 87 /* Record maximum wait time */
87 *reo_timeout = max_t(u32, *reo_timeout, 1 + remaining); 88 *reo_timeout = max_t(u32, *reo_timeout, remaining);
88 } 89 }
89 } 90 }
90} 91}
@@ -116,13 +117,8 @@ void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq,
116{ 117{
117 u32 rtt_us; 118 u32 rtt_us;
118 119
119 if (tp->rack.mstamp &&
120 !tcp_rack_sent_after(xmit_time, tp->rack.mstamp,
121 end_seq, tp->rack.end_seq))
122 return;
123
124 rtt_us = tcp_stamp_us_delta(tp->tcp_mstamp, xmit_time); 120 rtt_us = tcp_stamp_us_delta(tp->tcp_mstamp, xmit_time);
125 if (sacked & TCPCB_RETRANS) { 121 if (rtt_us < tcp_min_rtt(tp) && (sacked & TCPCB_RETRANS)) {
126 /* If the sacked packet was retransmitted, it's ambiguous 122 /* If the sacked packet was retransmitted, it's ambiguous
127 * whether the retransmission or the original (or the prior 123 * whether the retransmission or the original (or the prior
128 * retransmission) was sacked. 124 * retransmission) was sacked.
@@ -133,13 +129,15 @@ void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq,
133 * so it's at least one RTT (i.e., retransmission is at least 129 * so it's at least one RTT (i.e., retransmission is at least
134 * an RTT later). 130 * an RTT later).
135 */ 131 */
136 if (rtt_us < tcp_min_rtt(tp)) 132 return;
137 return;
138 } 133 }
139 tp->rack.rtt_us = rtt_us;
140 tp->rack.mstamp = xmit_time;
141 tp->rack.end_seq = end_seq;
142 tp->rack.advanced = 1; 134 tp->rack.advanced = 1;
135 tp->rack.rtt_us = rtt_us;
136 if (tcp_rack_sent_after(xmit_time, tp->rack.mstamp,
137 end_seq, tp->rack.end_seq)) {
138 tp->rack.mstamp = xmit_time;
139 tp->rack.end_seq = end_seq;
140 }
143} 141}
144 142
145/* We have waited long enough to accommodate reordering. Mark the expired 143/* We have waited long enough to accommodate reordering. Mark the expired
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 3d3092adf1d2..db84f523656d 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -904,7 +904,7 @@ static int ipxip6_rcv(struct sk_buff *skb, u8 ipproto,
904 if (t->parms.collect_md) { 904 if (t->parms.collect_md) {
905 tun_dst = ipv6_tun_rx_dst(skb, 0, 0, 0); 905 tun_dst = ipv6_tun_rx_dst(skb, 0, 0, 0);
906 if (!tun_dst) 906 if (!tun_dst)
907 return 0; 907 goto drop;
908 } 908 }
909 ret = __ip6_tnl_rcv(t, skb, tpi, tun_dst, dscp_ecn_decapsulate, 909 ret = __ip6_tnl_rcv(t, skb, tpi, tun_dst, dscp_ecn_decapsulate,
910 log_ecn_error); 910 log_ecn_error);
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 0b750a22c4b9..d4e98f20fc2a 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -1625,60 +1625,30 @@ static struct proto kcm_proto = {
1625}; 1625};
1626 1626
1627/* Clone a kcm socket. */ 1627/* Clone a kcm socket. */
1628static int kcm_clone(struct socket *osock, struct kcm_clone *info, 1628static struct file *kcm_clone(struct socket *osock)
1629 struct socket **newsockp)
1630{ 1629{
1631 struct socket *newsock; 1630 struct socket *newsock;
1632 struct sock *newsk; 1631 struct sock *newsk;
1633 struct file *newfile;
1634 int err, newfd;
1635 1632
1636 err = -ENFILE;
1637 newsock = sock_alloc(); 1633 newsock = sock_alloc();
1638 if (!newsock) 1634 if (!newsock)
1639 goto out; 1635 return ERR_PTR(-ENFILE);
1640 1636
1641 newsock->type = osock->type; 1637 newsock->type = osock->type;
1642 newsock->ops = osock->ops; 1638 newsock->ops = osock->ops;
1643 1639
1644 __module_get(newsock->ops->owner); 1640 __module_get(newsock->ops->owner);
1645 1641
1646 newfd = get_unused_fd_flags(0);
1647 if (unlikely(newfd < 0)) {
1648 err = newfd;
1649 goto out_fd_fail;
1650 }
1651
1652 newfile = sock_alloc_file(newsock, 0, osock->sk->sk_prot_creator->name);
1653 if (IS_ERR(newfile)) {
1654 err = PTR_ERR(newfile);
1655 goto out_sock_alloc_fail;
1656 }
1657
1658 newsk = sk_alloc(sock_net(osock->sk), PF_KCM, GFP_KERNEL, 1642 newsk = sk_alloc(sock_net(osock->sk), PF_KCM, GFP_KERNEL,
1659 &kcm_proto, true); 1643 &kcm_proto, true);
1660 if (!newsk) { 1644 if (!newsk) {
1661 err = -ENOMEM; 1645 sock_release(newsock);
1662 goto out_sk_alloc_fail; 1646 return ERR_PTR(-ENOMEM);
1663 } 1647 }
1664
1665 sock_init_data(newsock, newsk); 1648 sock_init_data(newsock, newsk);
1666 init_kcm_sock(kcm_sk(newsk), kcm_sk(osock->sk)->mux); 1649 init_kcm_sock(kcm_sk(newsk), kcm_sk(osock->sk)->mux);
1667 1650
1668 fd_install(newfd, newfile); 1651 return sock_alloc_file(newsock, 0, osock->sk->sk_prot_creator->name);
1669 *newsockp = newsock;
1670 info->fd = newfd;
1671
1672 return 0;
1673
1674out_sk_alloc_fail:
1675 fput(newfile);
1676out_sock_alloc_fail:
1677 put_unused_fd(newfd);
1678out_fd_fail:
1679 sock_release(newsock);
1680out:
1681 return err;
1682} 1652}
1683 1653
1684static int kcm_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) 1654static int kcm_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
@@ -1708,17 +1678,25 @@ static int kcm_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1708 } 1678 }
1709 case SIOCKCMCLONE: { 1679 case SIOCKCMCLONE: {
1710 struct kcm_clone info; 1680 struct kcm_clone info;
1711 struct socket *newsock = NULL; 1681 struct file *file;
1712 1682
1713 err = kcm_clone(sock, &info, &newsock); 1683 info.fd = get_unused_fd_flags(0);
1714 if (!err) { 1684 if (unlikely(info.fd < 0))
1715 if (copy_to_user((void __user *)arg, &info, 1685 return info.fd;
1716 sizeof(info))) {
1717 err = -EFAULT;
1718 sys_close(info.fd);
1719 }
1720 }
1721 1686
1687 file = kcm_clone(sock);
1688 if (IS_ERR(file)) {
1689 put_unused_fd(info.fd);
1690 return PTR_ERR(file);
1691 }
1692 if (copy_to_user((void __user *)arg, &info,
1693 sizeof(info))) {
1694 put_unused_fd(info.fd);
1695 fput(file);
1696 return -EFAULT;
1697 }
1698 fd_install(info.fd, file);
1699 err = 0;
1722 break; 1700 break;
1723 } 1701 }
1724 default: 1702 default:
diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index 8886f15abe90..bc2f1e0977d6 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -183,7 +183,7 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,
183 long i; 183 long i;
184 int ret; 184 int ret;
185 185
186 if (rs->rs_bound_addr == 0) { 186 if (rs->rs_bound_addr == 0 || !rs->rs_transport) {
187 ret = -ENOTCONN; /* XXX not a great errno */ 187 ret = -ENOTCONN; /* XXX not a great errno */
188 goto out; 188 goto out;
189 } 189 }
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
index b30a2c70bd48..531250fceb9e 100644
--- a/net/sched/sch_choke.c
+++ b/net/sched/sch_choke.c
@@ -369,6 +369,9 @@ static int choke_change(struct Qdisc *sch, struct nlattr *opt)
369 369
370 ctl = nla_data(tb[TCA_CHOKE_PARMS]); 370 ctl = nla_data(tb[TCA_CHOKE_PARMS]);
371 371
372 if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog))
373 return -EINVAL;
374
372 if (ctl->limit > CHOKE_MAX_QUEUE) 375 if (ctl->limit > CHOKE_MAX_QUEUE)
373 return -EINVAL; 376 return -EINVAL;
374 377
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 3839cbbdc32b..cd1b200acae7 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -26,6 +26,7 @@
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/if_vlan.h> 28#include <linux/if_vlan.h>
29#include <linux/if_macvlan.h>
29#include <net/sch_generic.h> 30#include <net/sch_generic.h>
30#include <net/pkt_sched.h> 31#include <net/pkt_sched.h>
31#include <net/dst.h> 32#include <net/dst.h>
@@ -277,6 +278,8 @@ unsigned long dev_trans_start(struct net_device *dev)
277 278
278 if (is_vlan_dev(dev)) 279 if (is_vlan_dev(dev))
279 dev = vlan_dev_real_dev(dev); 280 dev = vlan_dev_real_dev(dev);
281 else if (netif_is_macvlan(dev))
282 dev = macvlan_dev_real_dev(dev);
280 res = netdev_get_tx_queue(dev, 0)->trans_start; 283 res = netdev_get_tx_queue(dev, 0)->trans_start;
281 for (i = 1; i < dev->num_tx_queues; i++) { 284 for (i = 1; i < dev->num_tx_queues; i++) {
282 val = netdev_get_tx_queue(dev, i)->trans_start; 285 val = netdev_get_tx_queue(dev, i)->trans_start;
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index 17c7130454bd..bc30f9186ac6 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -356,6 +356,9 @@ static inline int gred_change_vq(struct Qdisc *sch, int dp,
356 struct gred_sched *table = qdisc_priv(sch); 356 struct gred_sched *table = qdisc_priv(sch);
357 struct gred_sched_data *q = table->tab[dp]; 357 struct gred_sched_data *q = table->tab[dp];
358 358
359 if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog))
360 return -EINVAL;
361
359 if (!q) { 362 if (!q) {
360 table->tab[dp] = q = *prealloc; 363 table->tab[dp] = q = *prealloc;
361 *prealloc = NULL; 364 *prealloc = NULL;
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 7f8ea9e297c3..9d874e60e032 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -212,6 +212,8 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt)
212 max_P = tb[TCA_RED_MAX_P] ? nla_get_u32(tb[TCA_RED_MAX_P]) : 0; 212 max_P = tb[TCA_RED_MAX_P] ? nla_get_u32(tb[TCA_RED_MAX_P]) : 0;
213 213
214 ctl = nla_data(tb[TCA_RED_PARMS]); 214 ctl = nla_data(tb[TCA_RED_PARMS]);
215 if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog))
216 return -EINVAL;
215 217
216 if (ctl->limit > 0) { 218 if (ctl->limit > 0) {
217 child = fifo_create_dflt(sch, &bfifo_qdisc_ops, ctl->limit); 219 child = fifo_create_dflt(sch, &bfifo_qdisc_ops, ctl->limit);
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 09c1203c1711..930e5bd26d3d 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -639,6 +639,9 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt)
639 if (ctl->divisor && 639 if (ctl->divisor &&
640 (!is_power_of_2(ctl->divisor) || ctl->divisor > 65536)) 640 (!is_power_of_2(ctl->divisor) || ctl->divisor > 65536))
641 return -EINVAL; 641 return -EINVAL;
642 if (ctl_v1 && !red_check_params(ctl_v1->qth_min, ctl_v1->qth_max,
643 ctl_v1->Wlog))
644 return -EINVAL;
642 if (ctl_v1 && ctl_v1->qth_min) { 645 if (ctl_v1 && ctl_v1->qth_min) {
643 p = kmalloc(sizeof(*p), GFP_KERNEL); 646 p = kmalloc(sizeof(*p), GFP_KERNEL);
644 if (!p) 647 if (!p)
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 014847e25648..eb17a911aa29 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5080,7 +5080,6 @@ static int sctp_getsockopt_peeloff_common(struct sock *sk, sctp_peeloff_arg_t *p
5080 *newfile = sock_alloc_file(newsock, 0, NULL); 5080 *newfile = sock_alloc_file(newsock, 0, NULL);
5081 if (IS_ERR(*newfile)) { 5081 if (IS_ERR(*newfile)) {
5082 put_unused_fd(retval); 5082 put_unused_fd(retval);
5083 sock_release(newsock);
5084 retval = PTR_ERR(*newfile); 5083 retval = PTR_ERR(*newfile);
5085 *newfile = NULL; 5084 *newfile = NULL;
5086 return retval; 5085 return retval;
diff --git a/net/socket.c b/net/socket.c
index 42d8e9c9ccd5..05f361faec45 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -406,8 +406,10 @@ struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname)
406 name.len = strlen(name.name); 406 name.len = strlen(name.name);
407 } 407 }
408 path.dentry = d_alloc_pseudo(sock_mnt->mnt_sb, &name); 408 path.dentry = d_alloc_pseudo(sock_mnt->mnt_sb, &name);
409 if (unlikely(!path.dentry)) 409 if (unlikely(!path.dentry)) {
410 sock_release(sock);
410 return ERR_PTR(-ENOMEM); 411 return ERR_PTR(-ENOMEM);
412 }
411 path.mnt = mntget(sock_mnt); 413 path.mnt = mntget(sock_mnt);
412 414
413 d_instantiate(path.dentry, SOCK_INODE(sock)); 415 d_instantiate(path.dentry, SOCK_INODE(sock));
@@ -415,9 +417,11 @@ struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname)
415 file = alloc_file(&path, FMODE_READ | FMODE_WRITE, 417 file = alloc_file(&path, FMODE_READ | FMODE_WRITE,
416 &socket_file_ops); 418 &socket_file_ops);
417 if (IS_ERR(file)) { 419 if (IS_ERR(file)) {
418 /* drop dentry, keep inode */ 420 /* drop dentry, keep inode for a bit */
419 ihold(d_inode(path.dentry)); 421 ihold(d_inode(path.dentry));
420 path_put(&path); 422 path_put(&path);
423 /* ... and now kill it properly */
424 sock_release(sock);
421 return file; 425 return file;
422 } 426 }
423 427
@@ -1330,19 +1334,9 @@ SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
1330 1334
1331 retval = sock_create(family, type, protocol, &sock); 1335 retval = sock_create(family, type, protocol, &sock);
1332 if (retval < 0) 1336 if (retval < 0)
1333 goto out; 1337 return retval;
1334
1335 retval = sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK));
1336 if (retval < 0)
1337 goto out_release;
1338
1339out:
1340 /* It may be already another descriptor 8) Not kernel problem. */
1341 return retval;
1342 1338
1343out_release: 1339 return sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK));
1344 sock_release(sock);
1345 return retval;
1346} 1340}
1347 1341
1348/* 1342/*
@@ -1366,87 +1360,72 @@ SYSCALL_DEFINE4(socketpair, int, family, int, type, int, protocol,
1366 flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK; 1360 flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK;
1367 1361
1368 /* 1362 /*
1363 * reserve descriptors and make sure we won't fail
1364 * to return them to userland.
1365 */
1366 fd1 = get_unused_fd_flags(flags);
1367 if (unlikely(fd1 < 0))
1368 return fd1;
1369
1370 fd2 = get_unused_fd_flags(flags);
1371 if (unlikely(fd2 < 0)) {
1372 put_unused_fd(fd1);
1373 return fd2;
1374 }
1375
1376 err = put_user(fd1, &usockvec[0]);
1377 if (err)
1378 goto out;
1379
1380 err = put_user(fd2, &usockvec[1]);
1381 if (err)
1382 goto out;
1383
1384 /*
1369 * Obtain the first socket and check if the underlying protocol 1385 * Obtain the first socket and check if the underlying protocol
1370 * supports the socketpair call. 1386 * supports the socketpair call.
1371 */ 1387 */
1372 1388
1373 err = sock_create(family, type, protocol, &sock1); 1389 err = sock_create(family, type, protocol, &sock1);
1374 if (err < 0) 1390 if (unlikely(err < 0))
1375 goto out; 1391 goto out;
1376 1392
1377 err = sock_create(family, type, protocol, &sock2); 1393 err = sock_create(family, type, protocol, &sock2);
1378 if (err < 0) 1394 if (unlikely(err < 0)) {
1379 goto out_release_1; 1395 sock_release(sock1);
1380 1396 goto out;
1381 err = sock1->ops->socketpair(sock1, sock2);
1382 if (err < 0)
1383 goto out_release_both;
1384
1385 fd1 = get_unused_fd_flags(flags);
1386 if (unlikely(fd1 < 0)) {
1387 err = fd1;
1388 goto out_release_both;
1389 } 1397 }
1390 1398
1391 fd2 = get_unused_fd_flags(flags); 1399 err = sock1->ops->socketpair(sock1, sock2);
1392 if (unlikely(fd2 < 0)) { 1400 if (unlikely(err < 0)) {
1393 err = fd2; 1401 sock_release(sock2);
1394 goto out_put_unused_1; 1402 sock_release(sock1);
1403 goto out;
1395 } 1404 }
1396 1405
1397 newfile1 = sock_alloc_file(sock1, flags, NULL); 1406 newfile1 = sock_alloc_file(sock1, flags, NULL);
1398 if (IS_ERR(newfile1)) { 1407 if (IS_ERR(newfile1)) {
1399 err = PTR_ERR(newfile1); 1408 err = PTR_ERR(newfile1);
1400 goto out_put_unused_both; 1409 sock_release(sock2);
1410 goto out;
1401 } 1411 }
1402 1412
1403 newfile2 = sock_alloc_file(sock2, flags, NULL); 1413 newfile2 = sock_alloc_file(sock2, flags, NULL);
1404 if (IS_ERR(newfile2)) { 1414 if (IS_ERR(newfile2)) {
1405 err = PTR_ERR(newfile2); 1415 err = PTR_ERR(newfile2);
1406 goto out_fput_1; 1416 fput(newfile1);
1417 goto out;
1407 } 1418 }
1408 1419
1409 err = put_user(fd1, &usockvec[0]);
1410 if (err)
1411 goto out_fput_both;
1412
1413 err = put_user(fd2, &usockvec[1]);
1414 if (err)
1415 goto out_fput_both;
1416
1417 audit_fd_pair(fd1, fd2); 1420 audit_fd_pair(fd1, fd2);
1418 1421
1419 fd_install(fd1, newfile1); 1422 fd_install(fd1, newfile1);
1420 fd_install(fd2, newfile2); 1423 fd_install(fd2, newfile2);
1421 /* fd1 and fd2 may be already another descriptors.
1422 * Not kernel problem.
1423 */
1424
1425 return 0; 1424 return 0;
1426 1425
1427out_fput_both: 1426out:
1428 fput(newfile2);
1429 fput(newfile1);
1430 put_unused_fd(fd2);
1431 put_unused_fd(fd1);
1432 goto out;
1433
1434out_fput_1:
1435 fput(newfile1);
1436 put_unused_fd(fd2);
1437 put_unused_fd(fd1);
1438 sock_release(sock2);
1439 goto out;
1440
1441out_put_unused_both:
1442 put_unused_fd(fd2); 1427 put_unused_fd(fd2);
1443out_put_unused_1:
1444 put_unused_fd(fd1); 1428 put_unused_fd(fd1);
1445out_release_both:
1446 sock_release(sock2);
1447out_release_1:
1448 sock_release(sock1);
1449out:
1450 return err; 1429 return err;
1451} 1430}
1452 1431
@@ -1562,7 +1541,6 @@ SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr,
1562 if (IS_ERR(newfile)) { 1541 if (IS_ERR(newfile)) {
1563 err = PTR_ERR(newfile); 1542 err = PTR_ERR(newfile);
1564 put_unused_fd(newfd); 1543 put_unused_fd(newfd);
1565 sock_release(newsock);
1566 goto out_put; 1544 goto out_put;
1567 } 1545 }
1568 1546
diff --git a/net/tipc/server.c b/net/tipc/server.c
index acaef80fb88c..d60c30342327 100644
--- a/net/tipc/server.c
+++ b/net/tipc/server.c
@@ -314,6 +314,7 @@ static int tipc_accept_from_sock(struct tipc_conn *con)
314 newcon->usr_data = s->tipc_conn_new(newcon->conid); 314 newcon->usr_data = s->tipc_conn_new(newcon->conid);
315 if (!newcon->usr_data) { 315 if (!newcon->usr_data) {
316 sock_release(newsock); 316 sock_release(newsock);
317 conn_put(newcon);
317 return -ENOMEM; 318 return -ENOMEM;
318 } 319 }
319 320
@@ -511,7 +512,7 @@ bool tipc_topsrv_kern_subscr(struct net *net, u32 port, u32 type,
511 s = con->server; 512 s = con->server;
512 scbr = s->tipc_conn_new(*conid); 513 scbr = s->tipc_conn_new(*conid);
513 if (!scbr) { 514 if (!scbr) {
514 tipc_close_conn(con); 515 conn_put(con);
515 return false; 516 return false;
516 } 517 }
517 518
diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c
index 5583df708b8c..a827547aa102 100644
--- a/net/vmw_vsock/hyperv_transport.c
+++ b/net/vmw_vsock/hyperv_transport.c
@@ -487,7 +487,7 @@ static void hvs_release(struct vsock_sock *vsk)
487 487
488 lock_sock(sk); 488 lock_sock(sk);
489 489
490 sk->sk_state = SS_DISCONNECTING; 490 sk->sk_state = TCP_CLOSING;
491 vsock_remove_sock(vsk); 491 vsock_remove_sock(vsk);
492 492
493 release_sock(sk); 493 release_sock(sk);
diff --git a/tools/arch/arm64/include/uapi/asm/bpf_perf_event.h b/tools/arch/arm64/include/uapi/asm/bpf_perf_event.h
new file mode 100644
index 000000000000..b551b741653d
--- /dev/null
+++ b/tools/arch/arm64/include/uapi/asm/bpf_perf_event.h
@@ -0,0 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
3#define _UAPI__ASM_BPF_PERF_EVENT_H__
4
5#include <asm/ptrace.h>
6
7typedef struct user_pt_regs bpf_user_pt_regs_t;
8
9#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */
diff --git a/tools/arch/s390/include/uapi/asm/bpf_perf_event.h b/tools/arch/s390/include/uapi/asm/bpf_perf_event.h
new file mode 100644
index 000000000000..cefe7c7cd4f6
--- /dev/null
+++ b/tools/arch/s390/include/uapi/asm/bpf_perf_event.h
@@ -0,0 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
3#define _UAPI__ASM_BPF_PERF_EVENT_H__
4
5#include <asm/ptrace.h>
6
7typedef user_pt_regs bpf_user_pt_regs_t;
8
9#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */
diff --git a/tools/arch/s390/include/uapi/asm/ptrace.h b/tools/arch/s390/include/uapi/asm/ptrace.h
new file mode 100644
index 000000000000..543dd70e12c8
--- /dev/null
+++ b/tools/arch/s390/include/uapi/asm/ptrace.h
@@ -0,0 +1,457 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * S390 version
4 * Copyright IBM Corp. 1999, 2000
5 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
6 */
7
8#ifndef _UAPI_S390_PTRACE_H
9#define _UAPI_S390_PTRACE_H
10
11/*
12 * Offsets in the user_regs_struct. They are used for the ptrace
13 * system call and in entry.S
14 */
15#ifndef __s390x__
16
17#define PT_PSWMASK 0x00
18#define PT_PSWADDR 0x04
19#define PT_GPR0 0x08
20#define PT_GPR1 0x0C
21#define PT_GPR2 0x10
22#define PT_GPR3 0x14
23#define PT_GPR4 0x18
24#define PT_GPR5 0x1C
25#define PT_GPR6 0x20
26#define PT_GPR7 0x24
27#define PT_GPR8 0x28
28#define PT_GPR9 0x2C
29#define PT_GPR10 0x30
30#define PT_GPR11 0x34
31#define PT_GPR12 0x38
32#define PT_GPR13 0x3C
33#define PT_GPR14 0x40
34#define PT_GPR15 0x44
35#define PT_ACR0 0x48
36#define PT_ACR1 0x4C
37#define PT_ACR2 0x50
38#define PT_ACR3 0x54
39#define PT_ACR4 0x58
40#define PT_ACR5 0x5C
41#define PT_ACR6 0x60
42#define PT_ACR7 0x64
43#define PT_ACR8 0x68
44#define PT_ACR9 0x6C
45#define PT_ACR10 0x70
46#define PT_ACR11 0x74
47#define PT_ACR12 0x78
48#define PT_ACR13 0x7C
49#define PT_ACR14 0x80
50#define PT_ACR15 0x84
51#define PT_ORIGGPR2 0x88
52#define PT_FPC 0x90
53/*
54 * A nasty fact of life that the ptrace api
55 * only supports passing of longs.
56 */
57#define PT_FPR0_HI 0x98
58#define PT_FPR0_LO 0x9C
59#define PT_FPR1_HI 0xA0
60#define PT_FPR1_LO 0xA4
61#define PT_FPR2_HI 0xA8
62#define PT_FPR2_LO 0xAC
63#define PT_FPR3_HI 0xB0
64#define PT_FPR3_LO 0xB4
65#define PT_FPR4_HI 0xB8
66#define PT_FPR4_LO 0xBC
67#define PT_FPR5_HI 0xC0
68#define PT_FPR5_LO 0xC4
69#define PT_FPR6_HI 0xC8
70#define PT_FPR6_LO 0xCC
71#define PT_FPR7_HI 0xD0
72#define PT_FPR7_LO 0xD4
73#define PT_FPR8_HI 0xD8
74#define PT_FPR8_LO 0XDC
75#define PT_FPR9_HI 0xE0
76#define PT_FPR9_LO 0xE4
77#define PT_FPR10_HI 0xE8
78#define PT_FPR10_LO 0xEC
79#define PT_FPR11_HI 0xF0
80#define PT_FPR11_LO 0xF4
81#define PT_FPR12_HI 0xF8
82#define PT_FPR12_LO 0xFC
83#define PT_FPR13_HI 0x100
84#define PT_FPR13_LO 0x104
85#define PT_FPR14_HI 0x108
86#define PT_FPR14_LO 0x10C
87#define PT_FPR15_HI 0x110
88#define PT_FPR15_LO 0x114
89#define PT_CR_9 0x118
90#define PT_CR_10 0x11C
91#define PT_CR_11 0x120
92#define PT_IEEE_IP 0x13C
93#define PT_LASTOFF PT_IEEE_IP
94#define PT_ENDREGS 0x140-1
95
96#define GPR_SIZE 4
97#define CR_SIZE 4
98
99#define STACK_FRAME_OVERHEAD 96 /* size of minimum stack frame */
100
101#else /* __s390x__ */
102
103#define PT_PSWMASK 0x00
104#define PT_PSWADDR 0x08
105#define PT_GPR0 0x10
106#define PT_GPR1 0x18
107#define PT_GPR2 0x20
108#define PT_GPR3 0x28
109#define PT_GPR4 0x30
110#define PT_GPR5 0x38
111#define PT_GPR6 0x40
112#define PT_GPR7 0x48
113#define PT_GPR8 0x50
114#define PT_GPR9 0x58
115#define PT_GPR10 0x60
116#define PT_GPR11 0x68
117#define PT_GPR12 0x70
118#define PT_GPR13 0x78
119#define PT_GPR14 0x80
120#define PT_GPR15 0x88
121#define PT_ACR0 0x90
122#define PT_ACR1 0x94
123#define PT_ACR2 0x98
124#define PT_ACR3 0x9C
125#define PT_ACR4 0xA0
126#define PT_ACR5 0xA4
127#define PT_ACR6 0xA8
128#define PT_ACR7 0xAC
129#define PT_ACR8 0xB0
130#define PT_ACR9 0xB4
131#define PT_ACR10 0xB8
132#define PT_ACR11 0xBC
133#define PT_ACR12 0xC0
134#define PT_ACR13 0xC4
135#define PT_ACR14 0xC8
136#define PT_ACR15 0xCC
137#define PT_ORIGGPR2 0xD0
138#define PT_FPC 0xD8
139#define PT_FPR0 0xE0
140#define PT_FPR1 0xE8
141#define PT_FPR2 0xF0
142#define PT_FPR3 0xF8
143#define PT_FPR4 0x100
144#define PT_FPR5 0x108
145#define PT_FPR6 0x110
146#define PT_FPR7 0x118
147#define PT_FPR8 0x120
148#define PT_FPR9 0x128
149#define PT_FPR10 0x130
150#define PT_FPR11 0x138
151#define PT_FPR12 0x140
152#define PT_FPR13 0x148
153#define PT_FPR14 0x150
154#define PT_FPR15 0x158
155#define PT_CR_9 0x160
156#define PT_CR_10 0x168
157#define PT_CR_11 0x170
158#define PT_IEEE_IP 0x1A8
159#define PT_LASTOFF PT_IEEE_IP
160#define PT_ENDREGS 0x1B0-1
161
162#define GPR_SIZE 8
163#define CR_SIZE 8
164
165#define STACK_FRAME_OVERHEAD 160 /* size of minimum stack frame */
166
167#endif /* __s390x__ */
168
169#define NUM_GPRS 16
170#define NUM_FPRS 16
171#define NUM_CRS 16
172#define NUM_ACRS 16
173
174#define NUM_CR_WORDS 3
175
176#define FPR_SIZE 8
177#define FPC_SIZE 4
178#define FPC_PAD_SIZE 4 /* gcc insists on aligning the fpregs */
179#define ACR_SIZE 4
180
181
182#define PTRACE_OLDSETOPTIONS 21
183
184#ifndef __ASSEMBLY__
185#include <linux/stddef.h>
186#include <linux/types.h>
187
188typedef union {
189 float f;
190 double d;
191 __u64 ui;
192 struct
193 {
194 __u32 hi;
195 __u32 lo;
196 } fp;
197} freg_t;
198
199typedef struct {
200 __u32 fpc;
201 __u32 pad;
202 freg_t fprs[NUM_FPRS];
203} s390_fp_regs;
204
205#define FPC_EXCEPTION_MASK 0xF8000000
206#define FPC_FLAGS_MASK 0x00F80000
207#define FPC_DXC_MASK 0x0000FF00
208#define FPC_RM_MASK 0x00000003
209
210/* this typedef defines how a Program Status Word looks like */
211typedef struct {
212 unsigned long mask;
213 unsigned long addr;
214} __attribute__ ((aligned(8))) psw_t;
215
216#ifndef __s390x__
217
218#define PSW_MASK_PER 0x40000000UL
219#define PSW_MASK_DAT 0x04000000UL
220#define PSW_MASK_IO 0x02000000UL
221#define PSW_MASK_EXT 0x01000000UL
222#define PSW_MASK_KEY 0x00F00000UL
223#define PSW_MASK_BASE 0x00080000UL /* always one */
224#define PSW_MASK_MCHECK 0x00040000UL
225#define PSW_MASK_WAIT 0x00020000UL
226#define PSW_MASK_PSTATE 0x00010000UL
227#define PSW_MASK_ASC 0x0000C000UL
228#define PSW_MASK_CC 0x00003000UL
229#define PSW_MASK_PM 0x00000F00UL
230#define PSW_MASK_RI 0x00000000UL
231#define PSW_MASK_EA 0x00000000UL
232#define PSW_MASK_BA 0x00000000UL
233
234#define PSW_MASK_USER 0x0000FF00UL
235
236#define PSW_ADDR_AMODE 0x80000000UL
237#define PSW_ADDR_INSN 0x7FFFFFFFUL
238
239#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 20)
240
241#define PSW_ASC_PRIMARY 0x00000000UL
242#define PSW_ASC_ACCREG 0x00004000UL
243#define PSW_ASC_SECONDARY 0x00008000UL
244#define PSW_ASC_HOME 0x0000C000UL
245
246#else /* __s390x__ */
247
248#define PSW_MASK_PER 0x4000000000000000UL
249#define PSW_MASK_DAT 0x0400000000000000UL
250#define PSW_MASK_IO 0x0200000000000000UL
251#define PSW_MASK_EXT 0x0100000000000000UL
252#define PSW_MASK_BASE 0x0000000000000000UL
253#define PSW_MASK_KEY 0x00F0000000000000UL
254#define PSW_MASK_MCHECK 0x0004000000000000UL
255#define PSW_MASK_WAIT 0x0002000000000000UL
256#define PSW_MASK_PSTATE 0x0001000000000000UL
257#define PSW_MASK_ASC 0x0000C00000000000UL
258#define PSW_MASK_CC 0x0000300000000000UL
259#define PSW_MASK_PM 0x00000F0000000000UL
260#define PSW_MASK_RI 0x0000008000000000UL
261#define PSW_MASK_EA 0x0000000100000000UL
262#define PSW_MASK_BA 0x0000000080000000UL
263
264#define PSW_MASK_USER 0x0000FF0180000000UL
265
266#define PSW_ADDR_AMODE 0x0000000000000000UL
267#define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL
268
269#define PSW_DEFAULT_KEY (((unsigned long) PAGE_DEFAULT_ACC) << 52)
270
271#define PSW_ASC_PRIMARY 0x0000000000000000UL
272#define PSW_ASC_ACCREG 0x0000400000000000UL
273#define PSW_ASC_SECONDARY 0x0000800000000000UL
274#define PSW_ASC_HOME 0x0000C00000000000UL
275
276#endif /* __s390x__ */
277
278
279/*
280 * The s390_regs structure is used to define the elf_gregset_t.
281 */
282typedef struct {
283 psw_t psw;
284 unsigned long gprs[NUM_GPRS];
285 unsigned int acrs[NUM_ACRS];
286 unsigned long orig_gpr2;
287} s390_regs;
288
289/*
290 * The user_pt_regs structure exports the beginning of
291 * the in-kernel pt_regs structure to user space.
292 */
293typedef struct {
294 unsigned long args[1];
295 psw_t psw;
296 unsigned long gprs[NUM_GPRS];
297} user_pt_regs;
298
299/*
300 * Now for the user space program event recording (trace) definitions.
301 * The following structures are used only for the ptrace interface, don't
302 * touch or even look at it if you don't want to modify the user-space
303 * ptrace interface. In particular stay away from it for in-kernel PER.
304 */
305typedef struct {
306 unsigned long cr[NUM_CR_WORDS];
307} per_cr_words;
308
309#define PER_EM_MASK 0xE8000000UL
310
311typedef struct {
312#ifdef __s390x__
313 unsigned : 32;
314#endif /* __s390x__ */
315 unsigned em_branching : 1;
316 unsigned em_instruction_fetch : 1;
317 /*
318 * Switching on storage alteration automatically fixes
319 * the storage alteration event bit in the users std.
320 */
321 unsigned em_storage_alteration : 1;
322 unsigned em_gpr_alt_unused : 1;
323 unsigned em_store_real_address : 1;
324 unsigned : 3;
325 unsigned branch_addr_ctl : 1;
326 unsigned : 1;
327 unsigned storage_alt_space_ctl : 1;
328 unsigned : 21;
329 unsigned long starting_addr;
330 unsigned long ending_addr;
331} per_cr_bits;
332
333typedef struct {
334 unsigned short perc_atmid;
335 unsigned long address;
336 unsigned char access_id;
337} per_lowcore_words;
338
339typedef struct {
340 unsigned perc_branching : 1;
341 unsigned perc_instruction_fetch : 1;
342 unsigned perc_storage_alteration : 1;
343 unsigned perc_gpr_alt_unused : 1;
344 unsigned perc_store_real_address : 1;
345 unsigned : 3;
346 unsigned atmid_psw_bit_31 : 1;
347 unsigned atmid_validity_bit : 1;
348 unsigned atmid_psw_bit_32 : 1;
349 unsigned atmid_psw_bit_5 : 1;
350 unsigned atmid_psw_bit_16 : 1;
351 unsigned atmid_psw_bit_17 : 1;
352 unsigned si : 2;
353 unsigned long address;
354 unsigned : 4;
355 unsigned access_id : 4;
356} per_lowcore_bits;
357
358typedef struct {
359 union {
360 per_cr_words words;
361 per_cr_bits bits;
362 } control_regs;
363 /*
364 * The single_step and instruction_fetch bits are obsolete,
365 * the kernel always sets them to zero. To enable single
366 * stepping use ptrace(PTRACE_SINGLESTEP) instead.
367 */
368 unsigned single_step : 1;
369 unsigned instruction_fetch : 1;
370 unsigned : 30;
371 /*
372 * These addresses are copied into cr10 & cr11 if single
373 * stepping is switched off
374 */
375 unsigned long starting_addr;
376 unsigned long ending_addr;
377 union {
378 per_lowcore_words words;
379 per_lowcore_bits bits;
380 } lowcore;
381} per_struct;
382
383typedef struct {
384 unsigned int len;
385 unsigned long kernel_addr;
386 unsigned long process_addr;
387} ptrace_area;
388
389/*
390 * S/390 specific non posix ptrace requests. I chose unusual values so
391 * they are unlikely to clash with future ptrace definitions.
392 */
393#define PTRACE_PEEKUSR_AREA 0x5000
394#define PTRACE_POKEUSR_AREA 0x5001
395#define PTRACE_PEEKTEXT_AREA 0x5002
396#define PTRACE_PEEKDATA_AREA 0x5003
397#define PTRACE_POKETEXT_AREA 0x5004
398#define PTRACE_POKEDATA_AREA 0x5005
399#define PTRACE_GET_LAST_BREAK 0x5006
400#define PTRACE_PEEK_SYSTEM_CALL 0x5007
401#define PTRACE_POKE_SYSTEM_CALL 0x5008
402#define PTRACE_ENABLE_TE 0x5009
403#define PTRACE_DISABLE_TE 0x5010
404#define PTRACE_TE_ABORT_RAND 0x5011
405
406/*
407 * The numbers chosen here are somewhat arbitrary but absolutely MUST
408 * not overlap with any of the number assigned in <linux/ptrace.h>.
409 */
410#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
411
412/*
413 * PT_PROT definition is loosely based on hppa bsd definition in
414 * gdb/hppab-nat.c
415 */
416#define PTRACE_PROT 21
417
418typedef enum {
419 ptprot_set_access_watchpoint,
420 ptprot_set_write_watchpoint,
421 ptprot_disable_watchpoint
422} ptprot_flags;
423
424typedef struct {
425 unsigned long lowaddr;
426 unsigned long hiaddr;
427 ptprot_flags prot;
428} ptprot_area;
429
430/* Sequence of bytes for breakpoint illegal instruction. */
431#define S390_BREAKPOINT {0x0,0x1}
432#define S390_BREAKPOINT_U16 ((__u16)0x0001)
433#define S390_SYSCALL_OPCODE ((__u16)0x0a00)
434#define S390_SYSCALL_SIZE 2
435
436/*
437 * The user_regs_struct defines the way the user registers are
438 * store on the stack for signal handling.
439 */
440struct user_regs_struct {
441 psw_t psw;
442 unsigned long gprs[NUM_GPRS];
443 unsigned int acrs[NUM_ACRS];
444 unsigned long orig_gpr2;
445 s390_fp_regs fp_regs;
446 /*
447 * These per registers are in here so that gdb can modify them
448 * itself as there is no "official" ptrace interface for hardware
449 * watchpoints. This is the way intel does it.
450 */
451 per_struct per_info;
452 unsigned long ieee_instruction_pointer; /* obsolete, always 0 */
453};
454
455#endif /* __ASSEMBLY__ */
456
457#endif /* _UAPI_S390_PTRACE_H */
diff --git a/tools/include/uapi/asm-generic/bpf_perf_event.h b/tools/include/uapi/asm-generic/bpf_perf_event.h
new file mode 100644
index 000000000000..53815d2cd047
--- /dev/null
+++ b/tools/include/uapi/asm-generic/bpf_perf_event.h
@@ -0,0 +1,9 @@
1#ifndef _UAPI__ASM_GENERIC_BPF_PERF_EVENT_H__
2#define _UAPI__ASM_GENERIC_BPF_PERF_EVENT_H__
3
4#include <linux/ptrace.h>
5
6/* Export kernel pt_regs structure */
7typedef struct pt_regs bpf_user_pt_regs_t;
8
9#endif /* _UAPI__ASM_GENERIC_BPF_PERF_EVENT_H__ */
diff --git a/tools/include/uapi/linux/bpf_perf_event.h b/tools/include/uapi/linux/bpf_perf_event.h
index 067427259820..8f95303f9d80 100644
--- a/tools/include/uapi/linux/bpf_perf_event.h
+++ b/tools/include/uapi/linux/bpf_perf_event.h
@@ -1,3 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1/* Copyright (c) 2016 Facebook 2/* Copyright (c) 2016 Facebook
2 * 3 *
3 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
@@ -7,11 +8,10 @@
7#ifndef _UAPI__LINUX_BPF_PERF_EVENT_H__ 8#ifndef _UAPI__LINUX_BPF_PERF_EVENT_H__
8#define _UAPI__LINUX_BPF_PERF_EVENT_H__ 9#define _UAPI__LINUX_BPF_PERF_EVENT_H__
9 10
10#include <linux/types.h> 11#include <asm/bpf_perf_event.h>
11#include <linux/ptrace.h>
12 12
13struct bpf_perf_event_data { 13struct bpf_perf_event_data {
14 struct pt_regs regs; 14 bpf_user_pt_regs_t regs;
15 __u64 sample_period; 15 __u64 sample_period;
16}; 16};
17 17
diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
index 21322e0385b8..09ba923debe8 100644
--- a/tools/perf/arch/s390/Makefile
+++ b/tools/perf/arch/s390/Makefile
@@ -2,3 +2,4 @@ ifndef NO_DWARF
2PERF_HAVE_DWARF_REGS := 1 2PERF_HAVE_DWARF_REGS := 1
3endif 3endif
4HAVE_KVM_STAT_SUPPORT := 1 4HAVE_KVM_STAT_SUPPORT := 1
5PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
diff --git a/tools/perf/arch/s390/util/dwarf-regs.c b/tools/perf/arch/s390/util/dwarf-regs.c
index f47576ce13ea..a8ace5cc6301 100644
--- a/tools/perf/arch/s390/util/dwarf-regs.c
+++ b/tools/perf/arch/s390/util/dwarf-regs.c
@@ -2,17 +2,43 @@
2/* 2/*
3 * Mapping of DWARF debug register numbers into register names. 3 * Mapping of DWARF debug register numbers into register names.
4 * 4 *
5 * Copyright IBM Corp. 2010 5 * Copyright IBM Corp. 2010, 2017
6 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>, 6 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>,
7 * Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
7 * 8 *
8 */ 9 */
9 10
11#include <errno.h>
10#include <stddef.h> 12#include <stddef.h>
11#include <dwarf-regs.h> 13#include <stdlib.h>
12#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <asm/ptrace.h>
16#include <string.h>
17#include <dwarf-regs.h>
13#include "dwarf-regs-table.h" 18#include "dwarf-regs-table.h"
14 19
15const char *get_arch_regstr(unsigned int n) 20const char *get_arch_regstr(unsigned int n)
16{ 21{
17 return (n >= ARRAY_SIZE(s390_dwarf_regs)) ? NULL : s390_dwarf_regs[n]; 22 return (n >= ARRAY_SIZE(s390_dwarf_regs)) ? NULL : s390_dwarf_regs[n];
18} 23}
24
25/*
26 * Convert the register name into an offset to struct pt_regs (kernel).
27 * This is required by the BPF prologue generator. The BPF
28 * program is called in the BPF overflow handler in the perf
29 * core.
30 */
31int regs_query_register_offset(const char *name)
32{
33 unsigned long gpr;
34
35 if (!name || strncmp(name, "%r", 2))
36 return -EINVAL;
37
38 errno = 0;
39 gpr = strtoul(name + 2, NULL, 10);
40 if (errno || gpr >= 16)
41 return -EINVAL;
42
43 return offsetof(user_pt_regs, gprs) + 8 * gpr;
44}
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index 77406d25e521..6db9d809fe97 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -30,6 +30,7 @@ arch/x86/include/uapi/asm/vmx.h
30arch/powerpc/include/uapi/asm/kvm.h 30arch/powerpc/include/uapi/asm/kvm.h
31arch/s390/include/uapi/asm/kvm.h 31arch/s390/include/uapi/asm/kvm.h
32arch/s390/include/uapi/asm/kvm_perf.h 32arch/s390/include/uapi/asm/kvm_perf.h
33arch/s390/include/uapi/asm/ptrace.h
33arch/s390/include/uapi/asm/sie.h 34arch/s390/include/uapi/asm/sie.h
34arch/arm/include/uapi/asm/kvm.h 35arch/arm/include/uapi/asm/kvm.h
35arch/arm64/include/uapi/asm/kvm.h 36arch/arm64/include/uapi/asm/kvm.h
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 333a48655ee0..21a2d76b67dc 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -1,7 +1,19 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2
3ifeq ($(srctree),)
4srctree := $(patsubst %/,%,$(dir $(CURDIR)))
5srctree := $(patsubst %/,%,$(dir $(srctree)))
6srctree := $(patsubst %/,%,$(dir $(srctree)))
7srctree := $(patsubst %/,%,$(dir $(srctree)))
8endif
9include $(srctree)/tools/scripts/Makefile.arch
10
11$(call detected_var,SRCARCH)
12
2LIBDIR := ../../../lib 13LIBDIR := ../../../lib
3BPFDIR := $(LIBDIR)/bpf 14BPFDIR := $(LIBDIR)/bpf
4APIDIR := ../../../include/uapi 15APIDIR := ../../../include/uapi
16ASMDIR:= ../../../arch/$(ARCH)/include/uapi
5GENDIR := ../../../../include/generated 17GENDIR := ../../../../include/generated
6GENHDR := $(GENDIR)/autoconf.h 18GENHDR := $(GENDIR)/autoconf.h
7 19
@@ -9,7 +21,7 @@ ifneq ($(wildcard $(GENHDR)),)
9 GENFLAGS := -DHAVE_GENHDR 21 GENFLAGS := -DHAVE_GENHDR
10endif 22endif
11 23
12CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include 24CFLAGS += -Wall -O2 -I$(APIDIR) -I$(ASMDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
13LDLIBS += -lcap -lelf 25LDLIBS += -lcap -lelf
14 26
15TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \ 27TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \