Merge branch 'openwrt:master' into master
This commit is contained in:
commit
52acbe6b14
48 changed files with 1168 additions and 97 deletions
|
@ -1,2 +1,2 @@
|
|||
LINUX_VERSION-6.1 = .29
|
||||
LINUX_KERNEL_HASH-6.1.29 = 1e736cc9bd6036379a1d915e518abd4c2c94ad0fd1ea0da961c3489308b8fcfb
|
||||
LINUX_VERSION-6.1 = .31
|
||||
LINUX_KERNEL_HASH-6.1.31 = e86917bba1990e967943645484182a64ba325f98b114a1906cc1d50992e073c1
|
|
@ -9,6 +9,7 @@ fs.protected_hardlinks=1
|
|||
fs.protected_symlinks=1
|
||||
|
||||
net.core.bpf_jit_enable=1
|
||||
net.core.bpf_jit_kallsyms=1
|
||||
|
||||
net.ipv4.conf.default.arp_ignore=1
|
||||
net.ipv4.conf.all.arp_ignore=1
|
||||
|
|
63
package/devel/kselftests-bpf/Makefile
Normal file
63
package/devel/kselftests-bpf/Makefile
Normal file
|
@ -0,0 +1,63 @@
|
|||
#
|
||||
# Copyright (C) 2021 Tony Ambardar <itugrok@yahoo.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=kselftests-bpf
|
||||
PKG_VERSION:=$(LINUX_VERSION)
|
||||
PKG_RELEASE:=1
|
||||
PKG_MAINTAINER:=Tony Ambardar <itugrok@yahoo.com>
|
||||
|
||||
PKG_BUILD_FLAGS:=gc-sections lto
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/kselftests-bpf
|
||||
SECTION:=devel
|
||||
CATEGORY:=Development
|
||||
DEPENDS:= +libelf +zlib +libpthread +librt @!IN_SDK \
|
||||
@KERNEL_DEBUG_FS @KERNEL_DEBUG_INFO_BTF @KERNEL_BPF_EVENTS
|
||||
TITLE:=Linux Kernel Selftests (BPF)
|
||||
URL:=http://www.kernel.org
|
||||
endef
|
||||
|
||||
define Package/kselftests-bpf/description
|
||||
kselftests-bpf is the Linux kernel BPF test suite
|
||||
endef
|
||||
|
||||
TEST_TARGET = test_verifier
|
||||
|
||||
MAKE_PATH:=tools/testing/selftests/bpf
|
||||
|
||||
MAKE_VARS = \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
SAN_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
|
||||
LDLIBS="$(TARGET_LDFLAGS)" \
|
||||
TOOLCHAIN_INCLUDE="$(TOOLCHAIN_DIR)/include" \
|
||||
VMLINUX_BTF="$(LINUX_DIR)/vmlinux"
|
||||
|
||||
MAKE_FLAGS = \
|
||||
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
|
||||
O=$(PKG_BUILD_DIR)
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE_VARS) \
|
||||
$(MAKE) $(PKG_JOBS) -C $(LINUX_DIR)/$(MAKE_PATH) \
|
||||
$(MAKE_FLAGS) $(TEST_TARGET) ;
|
||||
endef
|
||||
|
||||
define Package/kselftests-bpf/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(TEST_TARGET) $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,kselftests-bpf))
|
|
@ -8,12 +8,12 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=valgrind
|
||||
PKG_VERSION:=3.20.0
|
||||
PKG_VERSION:=3.21.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://sourceware.org/pub/valgrind/
|
||||
PKG_HASH:=8536c031dbe078d342f121fa881a9ecd205cb5a78e639005ad570011bdb9f3c6
|
||||
PKG_HASH:=10ce1618bb3e33fad16eb79552b0a3e1211762448a0d7fce11c8a6243b9ac971
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=GPL-2.0+
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
From 86ab9452bd10f08dbfa22d94e1155838f6f9f2e0 Mon Sep 17 00:00:00 2001
|
||||
From 82e935c564699456a766044faa39367b47cce793 Mon Sep 17 00:00:00 2001
|
||||
From: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Date: Sun, 31 Oct 2021 23:11:11 +0100
|
||||
Subject: [PATCH] mips: Fix new syscall numbers
|
||||
|
||||
The MIPS32 and MIPS64 O32 ABI are adding 4000 to all syscall numbers.
|
||||
The MIPS64 N64 ABI adds 5000 to each syscall and the MIPS64 N32 ABI adds
|
||||
6000 to each syscall number. We can not sue the shared file for MIPS and
|
||||
6000 to each syscall number. We can not use the shared file for MIPS and
|
||||
have to define this for each sycall separately.
|
||||
|
||||
Without this change valgrind is not able to detect new syscalls like
|
||||
|
@ -13,10 +13,10 @@ clock_gettime64 correctly.
|
|||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
---
|
||||
include/pub_tool_vkiscnums_asm.h | 3 ---
|
||||
include/vki/vki-scnums-mips32-linux.h | 36 +++++++++++++++++++++++++++
|
||||
include/vki/vki-scnums-mips64-linux.h | 32 ++++++++++++++++++++++++
|
||||
3 files changed, 68 insertions(+), 3 deletions(-)
|
||||
include/pub_tool_vkiscnums_asm.h | 3 --
|
||||
include/vki/vki-scnums-mips32-linux.h | 40 +++++++++++++++++++++++++++
|
||||
include/vki/vki-scnums-mips64-linux.h | 40 +++++++++++++++++++++++++++
|
||||
3 files changed, 80 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/include/pub_tool_vkiscnums_asm.h
|
||||
+++ b/include/pub_tool_vkiscnums_asm.h
|
||||
|
@ -38,7 +38,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||
#elif defined(VGP_x86_freebsd) || defined(VGP_amd64_freebsd)
|
||||
--- a/include/vki/vki-scnums-mips32-linux.h
|
||||
+++ b/include/vki/vki-scnums-mips32-linux.h
|
||||
@@ -401,6 +401,42 @@
|
||||
@@ -401,6 +401,46 @@
|
||||
#define __NR_pkey_free (__NR_Linux + 365)
|
||||
#define __NR_statx (__NR_Linux + 366)
|
||||
|
||||
|
@ -73,17 +73,21 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||
+#define __NR_fsmount (__NR_Linux + 432)
|
||||
+#define __NR_fspick (__NR_Linux + 433)
|
||||
+
|
||||
+#define __NR_pidfd_open (__NR_Linux + 434)
|
||||
+#define __NR_clone3 (__NR_Linux + 435)
|
||||
+#define __NR_close_range (__NR_Linux + 436)
|
||||
+#define __NR_openat2 (__NR_Linux + 437)
|
||||
+
|
||||
+#define __NR_faccessat2 (__NR_Linux + 439)
|
||||
+
|
||||
+#define __NR_epoll_pwait2 (__NR_Linux + 441)
|
||||
+
|
||||
/*
|
||||
* Offset of the last Linux o32 flavoured syscall
|
||||
*/
|
||||
--- a/include/vki/vki-scnums-mips64-linux.h
|
||||
+++ b/include/vki/vki-scnums-mips64-linux.h
|
||||
@@ -363,6 +363,22 @@
|
||||
@@ -363,6 +363,26 @@
|
||||
#define __NR_pkey_free (__NR_Linux + 325)
|
||||
#define __NR_statx (__NR_Linux + 326)
|
||||
|
||||
|
@ -98,15 +102,19 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||
+#define __NR_fsmount (__NR_Linux + 432)
|
||||
+#define __NR_fspick (__NR_Linux + 433)
|
||||
+
|
||||
+#define __NR_pidfd_open (__NR_Linux + 434)
|
||||
+#define __NR_clone3 (__NR_Linux + 435)
|
||||
+#define __NR_close_range (__NR_Linux + 436)
|
||||
+#define __NR_openat2 (__NR_Linux + 437)
|
||||
+
|
||||
+#define __NR_faccessat2 (__NR_Linux + 439)
|
||||
+
|
||||
+#define __NR_epoll_pwait2 (__NR_Linux + 441)
|
||||
+
|
||||
#elif defined(VGABI_N32)
|
||||
|
||||
/*
|
||||
@@ -702,6 +718,22 @@
|
||||
@@ -702,6 +722,26 @@
|
||||
#define __NR_pkey_free (__NR_Linux + 329)
|
||||
#define __NR_statx (__NR_Linux + 330)
|
||||
|
||||
|
@ -121,10 +129,14 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||
+#define __NR_fsmount (__NR_Linux + 432)
|
||||
+#define __NR_fspick (__NR_Linux + 433)
|
||||
+
|
||||
+#define __NR_pidfd_open (__NR_Linux + 434)
|
||||
+#define __NR_clone3 (__NR_Linux + 435)
|
||||
+#define __NR_close_range (__NR_Linux + 436)
|
||||
+#define __NR_openat2 (__NR_Linux + 437)
|
||||
+
|
||||
+#define __NR_faccessat2 (__NR_Linux + 439)
|
||||
+
|
||||
+#define __NR_epoll_pwait2 (__NR_Linux + 441)
|
||||
+
|
||||
#else
|
||||
#error unknown mips64 abi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -368,7 +368,7 @@ case "${host_os}" in
|
||||
@@ -364,7 +364,7 @@ case "${host_os}" in
|
||||
# Ok, this is linux. Check the kernel version
|
||||
AC_MSG_CHECKING([for the kernel version])
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ Last-Update: 2013-11-30
|
|||
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -275,7 +275,7 @@ case "${host_cpu}" in
|
||||
@@ -271,7 +271,7 @@ case "${host_cpu}" in
|
||||
ARCH_MAX="s390x"
|
||||
;;
|
||||
|
||||
|
|
|
@ -1149,7 +1149,7 @@ $(eval $(call KernelPackage,nft-bridge))
|
|||
|
||||
define KernelPackage/nft-dup-inet
|
||||
SUBMENU:=$(NF_MENU)
|
||||
TITLE:=Netfilter nf_tables dup in ip/ip6/inet familly support
|
||||
TITLE:=Netfilter nf_tables dup in ip/ip6/inet family support
|
||||
DEPENDS:=+kmod-nft-core +kmod-nf-conntrack +IPV6:kmod-nf-conntrack6
|
||||
KCONFIG:= \
|
||||
CONFIG_NF_DUP_IPV4 \
|
||||
|
|
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||
|
||||
PKG_NAME:=openssl
|
||||
PKG_VERSION:=3.0.8
|
||||
PKG_RELEASE:=9
|
||||
PKG_RELEASE:=10
|
||||
PKG_BUILD_FLAGS:=no-mips16 gc-sections
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
@ -141,7 +141,6 @@ endef
|
|||
ifneq ($(CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK)$(CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO),)
|
||||
define Package/libopenssl-conf/postinst
|
||||
#!/bin/sh
|
||||
OPENSSL_UCI="$${IPKG_INSTROOT}/etc/config/openssl"
|
||||
|
||||
add_engine_config() {
|
||||
if [ -z "$${IPKG_INSTROOT}" ] && uci -q get "openssl.$$1" >/dev/null; then
|
||||
|
@ -149,12 +148,6 @@ add_engine_config() {
|
|||
uci set "openssl.$$1.builtin=1" && uci commit openssl
|
||||
return
|
||||
fi
|
||||
{
|
||||
echo "engine '$$1'"
|
||||
echo " option enabled '1'"
|
||||
echo " option builtin '1'"
|
||||
echo
|
||||
} >>"$${OPENSSL_UCI}"
|
||||
}
|
||||
|
||||
$(if $(CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO),add_engine_config devcrypto)
|
||||
|
@ -424,10 +417,10 @@ define Package/libopenssl-conf/install
|
|||
touch $(1)/etc/config/openssl
|
||||
$(if $(CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO),
|
||||
$(CP) ./files/devcrypto.cnf $(1)/etc/ssl/modules.cnf.d/
|
||||
echo -e "config engine 'devcrypto'\n\toption enabled '1'" >> $(1)/etc/config/openssl)
|
||||
echo -e "config engine 'devcrypto'\n\toption enabled '1'\n\toption builtin '1'" >> $(1)/etc/config/openssl)
|
||||
$(if $(CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK),
|
||||
$(CP) ./files/padlock.cnf $(1)/etc/ssl/modules.cnf.d/
|
||||
echo -e "\nconfig engine 'padlock'\n\toption enabled '1'" >> $(1)/etc/config/openssl)
|
||||
echo -e "\nconfig engine 'padlock'\n\toption enabled '1'\n\toption builtin '1'" >> $(1)/etc/config/openssl)
|
||||
endef
|
||||
|
||||
define Package/openssl-util/install
|
||||
|
|
|
@ -7,7 +7,7 @@ PKG_SOURCE_PROTO:=git
|
|||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
|
||||
PKG_SOURCE_DATE:=2023-05-31
|
||||
PKG_SOURCE_VERSION:=38cbdc1c8cbbe2e30d62227d74565bd3fa21a36b
|
||||
PKG_MIRROR_HASH:=c275ef1f550726b045b3dd7bcee1d660bba9d56c4d53bf32f1eeb6f68bc4116c
|
||||
PKG_MIRROR_HASH:=5fbf325516a1bf1cc945019c061af280f5217267b20ae46fcfc71739616b3389
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
|
|
@ -50,7 +50,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
|||
+};
|
||||
--- a/drivers/irqchip/Kconfig
|
||||
+++ b/drivers/irqchip/Kconfig
|
||||
@@ -108,6 +108,10 @@ config I8259
|
||||
@@ -109,6 +109,10 @@ config I8259
|
||||
bool
|
||||
select IRQ_DOMAIN
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
|||
help
|
||||
Build a generic DT-based kernel image that boots on select
|
||||
BCM33xx cable modem chips, BCM63xx DSL chips, and BCM7xxx set-top
|
||||
--- a/drivers/irqchip/Kconfig 2023-05-30 19:59:04.671531242 +0200
|
||||
+++ b/drivers/irqchip/Kconfig 2023-05-30 19:59:55.203880697 +0200
|
||||
@@ -121,7 +121,6 @@ config BCM6345_L1_IRQ
|
||||
--- a/drivers/irqchip/Kconfig
|
||||
+++ b/drivers/irqchip/Kconfig
|
||||
@@ -122,7 +122,6 @@ config BCM6345_L1_IRQ
|
||||
config BCM7038_L1_IRQ
|
||||
tristate "Broadcom STB 7038-style L1/L2 interrupt controller driver"
|
||||
depends on ARCH_BRCMSTB || BMIPS_GENERIC
|
||||
|
@ -51,7 +51,7 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
|||
select GENERIC_IRQ_CHIP
|
||||
select IRQ_DOMAIN
|
||||
select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
|
||||
@@ -129,14 +128,12 @@ config BCM7038_L1_IRQ
|
||||
@@ -130,14 +129,12 @@ config BCM7038_L1_IRQ
|
||||
config BCM7120_L2_IRQ
|
||||
tristate "Broadcom STB 7120-style L2 interrupt controller driver"
|
||||
depends on ARCH_BRCMSTB || BMIPS_GENERIC
|
||||
|
@ -65,3 +65,4 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
|||
- default ARCH_BCM2835 || ARCH_BRCMSTB || BMIPS_GENERIC
|
||||
select GENERIC_IRQ_CHIP
|
||||
select IRQ_DOMAIN
|
||||
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
From 5287acc6f097c0c18e54401b611a877a3083b68c Mon Sep 17 00:00:00 2001
|
||||
From: Martin KaFai Lau <kafai@fb.com>
|
||||
Date: Wed, 16 Mar 2022 10:38:23 -0700
|
||||
Subject: [PATCH 1/3] bpf: selftests: Add helpers to directly use the capget
|
||||
and capset syscall
|
||||
|
||||
After upgrading to the newer libcap (>= 2.60),
|
||||
the libcap commit aca076443591 ("Make cap_t operations thread safe.")
|
||||
added a "__u8 mutex;" to the "struct _cap_struct". It caused a few byte
|
||||
shift that breaks the assumption made in the "struct libcap" definition
|
||||
in test_verifier.c.
|
||||
|
||||
The bpf selftest usage only needs to enable and disable the effective
|
||||
caps of the running task. It is easier to directly syscall the
|
||||
capget and capset instead. It can also remove the libcap
|
||||
library dependency.
|
||||
|
||||
The cap_helpers.{c,h} is added. One __u64 is used for all CAP_*
|
||||
bits instead of two __u32.
|
||||
|
||||
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
|
||||
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
||||
Acked-by: John Fastabend <john.fastabend@gmail.com>
|
||||
Link: https://lore.kernel.org/bpf/20220316173823.2036955-1-kafai@fb.com
|
||||
---
|
||||
tools/testing/selftests/bpf/cap_helpers.c | 67 +++++++++++++++++++++++
|
||||
tools/testing/selftests/bpf/cap_helpers.h | 19 +++++++
|
||||
2 files changed, 86 insertions(+)
|
||||
create mode 100644 tools/testing/selftests/bpf/cap_helpers.c
|
||||
create mode 100644 tools/testing/selftests/bpf/cap_helpers.h
|
||||
|
||||
--- /dev/null
|
||||
+++ b/tools/testing/selftests/bpf/cap_helpers.c
|
||||
@@ -0,0 +1,67 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+#include "cap_helpers.h"
|
||||
+
|
||||
+/* Avoid including <sys/capability.h> from the libcap-devel package,
|
||||
+ * so directly declare them here and use them from glibc.
|
||||
+ */
|
||||
+int capget(cap_user_header_t header, cap_user_data_t data);
|
||||
+int capset(cap_user_header_t header, const cap_user_data_t data);
|
||||
+
|
||||
+int cap_enable_effective(__u64 caps, __u64 *old_caps)
|
||||
+{
|
||||
+ struct __user_cap_data_struct data[_LINUX_CAPABILITY_U32S_3];
|
||||
+ struct __user_cap_header_struct hdr = {
|
||||
+ .version = _LINUX_CAPABILITY_VERSION_3,
|
||||
+ };
|
||||
+ __u32 cap0 = caps;
|
||||
+ __u32 cap1 = caps >> 32;
|
||||
+ int err;
|
||||
+
|
||||
+ err = capget(&hdr, data);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ if (old_caps)
|
||||
+ *old_caps = (__u64)(data[1].effective) << 32 | data[0].effective;
|
||||
+
|
||||
+ if ((data[0].effective & cap0) == cap0 &&
|
||||
+ (data[1].effective & cap1) == cap1)
|
||||
+ return 0;
|
||||
+
|
||||
+ data[0].effective |= cap0;
|
||||
+ data[1].effective |= cap1;
|
||||
+ err = capset(&hdr, data);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int cap_disable_effective(__u64 caps, __u64 *old_caps)
|
||||
+{
|
||||
+ struct __user_cap_data_struct data[_LINUX_CAPABILITY_U32S_3];
|
||||
+ struct __user_cap_header_struct hdr = {
|
||||
+ .version = _LINUX_CAPABILITY_VERSION_3,
|
||||
+ };
|
||||
+ __u32 cap0 = caps;
|
||||
+ __u32 cap1 = caps >> 32;
|
||||
+ int err;
|
||||
+
|
||||
+ err = capget(&hdr, data);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ if (old_caps)
|
||||
+ *old_caps = (__u64)(data[1].effective) << 32 | data[0].effective;
|
||||
+
|
||||
+ if (!(data[0].effective & cap0) && !(data[1].effective & cap1))
|
||||
+ return 0;
|
||||
+
|
||||
+ data[0].effective &= ~cap0;
|
||||
+ data[1].effective &= ~cap1;
|
||||
+ err = capset(&hdr, data);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/tools/testing/selftests/bpf/cap_helpers.h
|
||||
@@ -0,0 +1,19 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+#ifndef __CAP_HELPERS_H
|
||||
+#define __CAP_HELPERS_H
|
||||
+
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/capability.h>
|
||||
+
|
||||
+#ifndef CAP_PERFMON
|
||||
+#define CAP_PERFMON 38
|
||||
+#endif
|
||||
+
|
||||
+#ifndef CAP_BPF
|
||||
+#define CAP_BPF 39
|
||||
+#endif
|
||||
+
|
||||
+int cap_enable_effective(__u64 caps, __u64 *old_caps);
|
||||
+int cap_disable_effective(__u64 caps, __u64 *old_caps);
|
||||
+
|
||||
+#endif
|
|
@ -0,0 +1,188 @@
|
|||
From 847a6b7ee906be874f0cae279c8de902a7d3f092 Mon Sep 17 00:00:00 2001
|
||||
From: Martin KaFai Lau <kafai@fb.com>
|
||||
Date: Wed, 16 Mar 2022 10:38:29 -0700
|
||||
Subject: [PATCH 2/3] bpf: selftests: Remove libcap usage from test_verifier
|
||||
|
||||
This patch removes the libcap usage from test_verifier.
|
||||
The cap_*_effective() helpers added in the earlier patch are
|
||||
used instead.
|
||||
|
||||
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
|
||||
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
||||
Acked-by: John Fastabend <john.fastabend@gmail.com>
|
||||
Link: https://lore.kernel.org/bpf/20220316173829.2038682-1-kafai@fb.com
|
||||
---
|
||||
tools/testing/selftests/bpf/Makefile | 31 +++++---
|
||||
tools/testing/selftests/bpf/test_verifier.c | 88 ++++++---------------
|
||||
2 files changed, 46 insertions(+), 73 deletions(-)
|
||||
|
||||
--- a/tools/testing/selftests/bpf/Makefile
|
||||
+++ b/tools/testing/selftests/bpf/Makefile
|
||||
@@ -189,16 +189,27 @@ TEST_GEN_PROGS_EXTENDED += $(DEFAULT_BPF
|
||||
|
||||
$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ)
|
||||
|
||||
-$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c
|
||||
-$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c
|
||||
-$(OUTPUT)/test_sock: cgroup_helpers.c
|
||||
-$(OUTPUT)/test_sock_addr: cgroup_helpers.c
|
||||
-$(OUTPUT)/test_sockmap: cgroup_helpers.c
|
||||
-$(OUTPUT)/test_tcpnotify_user: cgroup_helpers.c trace_helpers.c
|
||||
-$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c
|
||||
-$(OUTPUT)/test_cgroup_storage: cgroup_helpers.c
|
||||
-$(OUTPUT)/test_sock_fields: cgroup_helpers.c
|
||||
-$(OUTPUT)/test_sysctl: cgroup_helpers.c
|
||||
+CGROUP_HELPERS := $(OUTPUT)/cgroup_helpers.o
|
||||
+TESTING_HELPERS := $(OUTPUT)/testing_helpers.o
|
||||
+TRACE_HELPERS := $(OUTPUT)/trace_helpers.o
|
||||
+CAP_HELPERS := $(OUTPUT)/cap_helpers.o
|
||||
+
|
||||
+$(OUTPUT)/test_dev_cgroup: $(CGROUP_HELPERS) $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/test_skb_cgroup_id_user: $(CGROUP_HELPERS) $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/test_sock: $(CGROUP_HELPERS) $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/test_sock_addr: $(CGROUP_HELPERS) $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/test_sockmap: $(CGROUP_HELPERS) $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/test_tcpnotify_user: $(CGROUP_HELPERS) $(TESTING_HELPERS) $(TRACE_HELPERS)
|
||||
+$(OUTPUT)/get_cgroup_id_user: $(CGROUP_HELPERS) $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/test_cgroup_storage: $(CGROUP_HELPERS) $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/test_sock_fields: $(CGROUP_HELPERS) $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/test_sysctl: $(CGROUP_HELPERS) $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/test_tag: $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/test_lirc_mode2_user: $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/xdping: $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/flow_dissector_load: $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/test_maps: $(TESTING_HELPERS)
|
||||
+$(OUTPUT)/test_verifier: $(TESTING_HELPERS) $(CAP_HELPERS)
|
||||
|
||||
BPFTOOL ?= $(DEFAULT_BPFTOOL)
|
||||
$(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) \
|
||||
--- a/tools/testing/selftests/bpf/test_verifier.c
|
||||
+++ b/tools/testing/selftests/bpf/test_verifier.c
|
||||
@@ -22,8 +22,6 @@
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
|
||||
-#include <sys/capability.h>
|
||||
-
|
||||
#include <linux/unistd.h>
|
||||
#include <linux/filter.h>
|
||||
#include <linux/bpf_perf_event.h>
|
||||
@@ -43,6 +41,7 @@
|
||||
# endif
|
||||
#endif
|
||||
#include "bpf_rlimit.h"
|
||||
+#include "cap_helpers.h"
|
||||
#include "bpf_rand.h"
|
||||
#include "bpf_util.h"
|
||||
#include "test_btf.h"
|
||||
@@ -59,6 +58,10 @@
|
||||
#define F_NEEDS_EFFICIENT_UNALIGNED_ACCESS (1 << 0)
|
||||
#define F_LOAD_WITH_STRICT_ALIGNMENT (1 << 1)
|
||||
|
||||
+/* need CAP_BPF, CAP_NET_ADMIN, CAP_PERFMON to load progs */
|
||||
+#define ADMIN_CAPS (1ULL << CAP_NET_ADMIN | \
|
||||
+ 1ULL << CAP_PERFMON | \
|
||||
+ 1ULL << CAP_BPF)
|
||||
#define UNPRIV_SYSCTL "kernel/unprivileged_bpf_disabled"
|
||||
static bool unpriv_disabled = false;
|
||||
static int skips;
|
||||
@@ -940,47 +943,19 @@ struct libcap {
|
||||
|
||||
static int set_admin(bool admin)
|
||||
{
|
||||
- cap_t caps;
|
||||
- /* need CAP_BPF, CAP_NET_ADMIN, CAP_PERFMON to load progs */
|
||||
- const cap_value_t cap_net_admin = CAP_NET_ADMIN;
|
||||
- const cap_value_t cap_sys_admin = CAP_SYS_ADMIN;
|
||||
- struct libcap *cap;
|
||||
- int ret = -1;
|
||||
-
|
||||
- caps = cap_get_proc();
|
||||
- if (!caps) {
|
||||
- perror("cap_get_proc");
|
||||
- return -1;
|
||||
- }
|
||||
- cap = (struct libcap *)caps;
|
||||
- if (cap_set_flag(caps, CAP_EFFECTIVE, 1, &cap_sys_admin, CAP_CLEAR)) {
|
||||
- perror("cap_set_flag clear admin");
|
||||
- goto out;
|
||||
- }
|
||||
- if (cap_set_flag(caps, CAP_EFFECTIVE, 1, &cap_net_admin,
|
||||
- admin ? CAP_SET : CAP_CLEAR)) {
|
||||
- perror("cap_set_flag set_or_clear net");
|
||||
- goto out;
|
||||
- }
|
||||
- /* libcap is likely old and simply ignores CAP_BPF and CAP_PERFMON,
|
||||
- * so update effective bits manually
|
||||
- */
|
||||
+ int err;
|
||||
+
|
||||
if (admin) {
|
||||
- cap->data[1].effective |= 1 << (38 /* CAP_PERFMON */ - 32);
|
||||
- cap->data[1].effective |= 1 << (39 /* CAP_BPF */ - 32);
|
||||
+ err = cap_enable_effective(ADMIN_CAPS, NULL);
|
||||
+ if (err)
|
||||
+ perror("cap_enable_effective(ADMIN_CAPS)");
|
||||
} else {
|
||||
- cap->data[1].effective &= ~(1 << (38 - 32));
|
||||
- cap->data[1].effective &= ~(1 << (39 - 32));
|
||||
+ err = cap_disable_effective(ADMIN_CAPS, NULL);
|
||||
+ if (err)
|
||||
+ perror("cap_disable_effective(ADMIN_CAPS)");
|
||||
}
|
||||
- if (cap_set_proc(caps)) {
|
||||
- perror("cap_set_proc");
|
||||
- goto out;
|
||||
- }
|
||||
- ret = 0;
|
||||
-out:
|
||||
- if (cap_free(caps))
|
||||
- perror("cap_free");
|
||||
- return ret;
|
||||
+
|
||||
+ return err;
|
||||
}
|
||||
|
||||
static int do_prog_test_run(int fd_prog, bool unpriv, uint32_t expected_val,
|
||||
@@ -1246,31 +1221,18 @@ fail_log:
|
||||
|
||||
static bool is_admin(void)
|
||||
{
|
||||
- cap_flag_value_t net_priv = CAP_CLEAR;
|
||||
- bool perfmon_priv = false;
|
||||
- bool bpf_priv = false;
|
||||
- struct libcap *cap;
|
||||
- cap_t caps;
|
||||
-
|
||||
-#ifdef CAP_IS_SUPPORTED
|
||||
- if (!CAP_IS_SUPPORTED(CAP_SETFCAP)) {
|
||||
- perror("cap_get_flag");
|
||||
- return false;
|
||||
- }
|
||||
-#endif
|
||||
- caps = cap_get_proc();
|
||||
- if (!caps) {
|
||||
- perror("cap_get_proc");
|
||||
+ __u64 caps;
|
||||
+
|
||||
+ /* The test checks for finer cap as CAP_NET_ADMIN,
|
||||
+ * CAP_PERFMON, and CAP_BPF instead of CAP_SYS_ADMIN.
|
||||
+ * Thus, disable CAP_SYS_ADMIN at the beginning.
|
||||
+ */
|
||||
+ if (cap_disable_effective(1ULL << CAP_SYS_ADMIN, &caps)) {
|
||||
+ perror("cap_disable_effective(CAP_SYS_ADMIN)");
|
||||
return false;
|
||||
}
|
||||
- cap = (struct libcap *)caps;
|
||||
- bpf_priv = cap->data[1].effective & (1 << (39/* CAP_BPF */ - 32));
|
||||
- perfmon_priv = cap->data[1].effective & (1 << (38/* CAP_PERFMON */ - 32));
|
||||
- if (cap_get_flag(caps, CAP_NET_ADMIN, CAP_EFFECTIVE, &net_priv))
|
||||
- perror("cap_get_flag NET");
|
||||
- if (cap_free(caps))
|
||||
- perror("cap_free");
|
||||
- return bpf_priv && perfmon_priv && net_priv == CAP_SET;
|
||||
+
|
||||
+ return (caps & ADMIN_CAPS) == ADMIN_CAPS;
|
||||
}
|
||||
|
||||
static void get_unpriv_disabled()
|
|
@ -0,0 +1,122 @@
|
|||
From 1ac00fea13c576e2b13dabf9a72ad3034e3bb804 Mon Sep 17 00:00:00 2001
|
||||
From: Martin KaFai Lau <kafai@fb.com>
|
||||
Date: Wed, 16 Mar 2022 10:38:35 -0700
|
||||
Subject: [PATCH 3/3] bpf: selftests: Remove libcap usage from test_progs
|
||||
|
||||
This patch removes the libcap usage from test_progs.
|
||||
bind_perm.c is the only user. cap_*_effective() helpers added in the
|
||||
earlier patch are directly used instead.
|
||||
|
||||
No other selftest binary is using libcap, so '-lcap' is also removed
|
||||
from the Makefile.
|
||||
|
||||
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
|
||||
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
||||
Reviewed-by: Stanislav Fomichev <sdf@google.com>
|
||||
Acked-by: John Fastabend <john.fastabend@gmail.com>
|
||||
Link: https://lore.kernel.org/bpf/20220316173835.2039334-1-kafai@fb.com
|
||||
---
|
||||
tools/testing/selftests/bpf/Makefile | 5 ++-
|
||||
.../selftests/bpf/prog_tests/bind_perm.c | 44 ++++---------------
|
||||
2 files changed, 11 insertions(+), 38 deletions(-)
|
||||
|
||||
--- a/tools/testing/selftests/bpf/Makefile
|
||||
+++ b/tools/testing/selftests/bpf/Makefile
|
||||
@@ -26,7 +26,7 @@ CFLAGS += -g -O0 -rdynamic -Wall $(GENFL
|
||||
-I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT) \
|
||||
-Dbpf_prog_load=bpf_prog_test_load \
|
||||
-Dbpf_load_program=bpf_test_load_program
|
||||
-LDLIBS += -lcap -lelf -lz -lrt -lpthread
|
||||
+LDLIBS += -lelf -lz -lrt -lpthread
|
||||
|
||||
# Silence some warnings when compiled with clang
|
||||
ifneq ($(LLVM),)
|
||||
@@ -471,7 +471,8 @@ TRUNNER_TESTS_DIR := prog_tests
|
||||
TRUNNER_BPF_PROGS_DIR := progs
|
||||
TRUNNER_EXTRA_SOURCES := test_progs.c cgroup_helpers.c trace_helpers.c \
|
||||
network_helpers.c testing_helpers.c \
|
||||
- btf_helpers.c flow_dissector_load.h
|
||||
+ btf_helpers.c flow_dissector_load.h \
|
||||
+ cap_helpers.c
|
||||
TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \
|
||||
ima_setup.sh \
|
||||
$(wildcard progs/btf_dump_test_case_*.c)
|
||||
--- a/tools/testing/selftests/bpf/prog_tests/bind_perm.c
|
||||
+++ b/tools/testing/selftests/bpf/prog_tests/bind_perm.c
|
||||
@@ -4,9 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
-#include <sys/capability.h>
|
||||
|
||||
#include "test_progs.h"
|
||||
+#include "cap_helpers.h"
|
||||
#include "bind_perm.skel.h"
|
||||
|
||||
static int duration;
|
||||
@@ -49,41 +49,11 @@ close_socket:
|
||||
close(fd);
|
||||
}
|
||||
|
||||
-bool cap_net_bind_service(cap_flag_value_t flag)
|
||||
-{
|
||||
- const cap_value_t cap_net_bind_service = CAP_NET_BIND_SERVICE;
|
||||
- cap_flag_value_t original_value;
|
||||
- bool was_effective = false;
|
||||
- cap_t caps;
|
||||
-
|
||||
- caps = cap_get_proc();
|
||||
- if (CHECK(!caps, "cap_get_proc", "errno %d", errno))
|
||||
- goto free_caps;
|
||||
-
|
||||
- if (CHECK(cap_get_flag(caps, CAP_NET_BIND_SERVICE, CAP_EFFECTIVE,
|
||||
- &original_value),
|
||||
- "cap_get_flag", "errno %d", errno))
|
||||
- goto free_caps;
|
||||
-
|
||||
- was_effective = (original_value == CAP_SET);
|
||||
-
|
||||
- if (CHECK(cap_set_flag(caps, CAP_EFFECTIVE, 1, &cap_net_bind_service,
|
||||
- flag),
|
||||
- "cap_set_flag", "errno %d", errno))
|
||||
- goto free_caps;
|
||||
-
|
||||
- if (CHECK(cap_set_proc(caps), "cap_set_proc", "errno %d", errno))
|
||||
- goto free_caps;
|
||||
-
|
||||
-free_caps:
|
||||
- CHECK(cap_free(caps), "cap_free", "errno %d", errno);
|
||||
- return was_effective;
|
||||
-}
|
||||
-
|
||||
void test_bind_perm(void)
|
||||
{
|
||||
- bool cap_was_effective;
|
||||
+ const __u64 net_bind_svc_cap = 1ULL << CAP_NET_BIND_SERVICE;
|
||||
struct bind_perm *skel;
|
||||
+ __u64 old_caps = 0;
|
||||
int cgroup_fd;
|
||||
|
||||
if (create_netns())
|
||||
@@ -105,7 +75,8 @@ void test_bind_perm(void)
|
||||
if (!ASSERT_OK_PTR(skel, "bind_v6_prog"))
|
||||
goto close_skeleton;
|
||||
|
||||
- cap_was_effective = cap_net_bind_service(CAP_CLEAR);
|
||||
+ ASSERT_OK(cap_disable_effective(net_bind_svc_cap, &old_caps),
|
||||
+ "cap_disable_effective");
|
||||
|
||||
try_bind(AF_INET, 110, EACCES);
|
||||
try_bind(AF_INET6, 110, EACCES);
|
||||
@@ -113,8 +84,9 @@ void test_bind_perm(void)
|
||||
try_bind(AF_INET, 111, 0);
|
||||
try_bind(AF_INET6, 111, 0);
|
||||
|
||||
- if (cap_was_effective)
|
||||
- cap_net_bind_service(CAP_SET);
|
||||
+ if (old_caps & net_bind_svc_cap)
|
||||
+ ASSERT_OK(cap_enable_effective(net_bind_svc_cap, NULL),
|
||||
+ "cap_enable_effective");
|
||||
|
||||
close_skeleton:
|
||||
bind_perm__destroy(skel);
|
|
@ -0,0 +1,62 @@
|
|||
From 43ed6fff01333868a1d0e19876f67c22d9939952 Mon Sep 17 00:00:00 2001
|
||||
From: Yuval Shaia <yshaia@marvell.com>
|
||||
Date: Wed, 13 Oct 2021 09:49:21 +0300
|
||||
Subject: [PATCH] net: mvneta: Delete unused variable
|
||||
|
||||
The variable pp is not in use - delete it.
|
||||
|
||||
Signed-off-by: Yuval Shaia <yshaia@marvell.com>
|
||||
Link: https://lore.kernel.org/r/20211013064921.26346-1-yshaia@marvell.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/ethernet/marvell/mvneta.c | 11 +++++------
|
||||
1 file changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/marvell/mvneta.c
|
||||
+++ b/drivers/net/ethernet/marvell/mvneta.c
|
||||
@@ -1914,7 +1914,7 @@ static int mvneta_rx_refill(struct mvnet
|
||||
}
|
||||
|
||||
/* Handle tx checksum */
|
||||
-static u32 mvneta_skb_tx_csum(struct mvneta_port *pp, struct sk_buff *skb)
|
||||
+static u32 mvneta_skb_tx_csum(struct sk_buff *skb)
|
||||
{
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL) {
|
||||
int ip_hdr_len = 0;
|
||||
@@ -2595,8 +2595,7 @@ err_drop_frame:
|
||||
}
|
||||
|
||||
static inline void
|
||||
-mvneta_tso_put_hdr(struct sk_buff *skb,
|
||||
- struct mvneta_port *pp, struct mvneta_tx_queue *txq)
|
||||
+mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq)
|
||||
{
|
||||
int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
|
||||
struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index];
|
||||
@@ -2604,7 +2603,7 @@ mvneta_tso_put_hdr(struct sk_buff *skb,
|
||||
|
||||
tx_desc = mvneta_txq_next_desc_get(txq);
|
||||
tx_desc->data_size = hdr_len;
|
||||
- tx_desc->command = mvneta_skb_tx_csum(pp, skb);
|
||||
+ tx_desc->command = mvneta_skb_tx_csum(skb);
|
||||
tx_desc->command |= MVNETA_TXD_F_DESC;
|
||||
tx_desc->buf_phys_addr = txq->tso_hdrs_phys +
|
||||
txq->txq_put_index * TSO_HEADER_SIZE;
|
||||
@@ -2681,7 +2680,7 @@ static int mvneta_tx_tso(struct sk_buff
|
||||
hdr = txq->tso_hdrs + txq->txq_put_index * TSO_HEADER_SIZE;
|
||||
tso_build_hdr(skb, hdr, &tso, data_left, total_len == 0);
|
||||
|
||||
- mvneta_tso_put_hdr(skb, pp, txq);
|
||||
+ mvneta_tso_put_hdr(skb, txq);
|
||||
|
||||
while (data_left > 0) {
|
||||
int size;
|
||||
@@ -2799,7 +2798,7 @@ static netdev_tx_t mvneta_tx(struct sk_b
|
||||
/* Get a descriptor for the first part of the packet */
|
||||
tx_desc = mvneta_txq_next_desc_get(txq);
|
||||
|
||||
- tx_cmd = mvneta_skb_tx_csum(pp, skb);
|
||||
+ tx_cmd = mvneta_skb_tx_csum(skb);
|
||||
|
||||
tx_desc->data_size = skb_headlen(skb);
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
From 0cf39c6543469aae4a30cba354243125514ed568 Mon Sep 17 00:00:00 2001
|
||||
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
|
||||
Date: Wed, 29 Mar 2023 13:11:17 +0100
|
||||
Subject: [PATCH] net: mvneta: fix potential double-frees in
|
||||
mvneta_txq_sw_deinit()
|
||||
|
||||
Reported on the Turris forum, mvneta provokes kernel warnings in the
|
||||
architecture DMA mapping code when mvneta_setup_txqs() fails to
|
||||
allocate memory. This happens because when mvneta_cleanup_txqs() is
|
||||
called in the mvneta_stop() path, we leave pointers in the structure
|
||||
that have been freed.
|
||||
|
||||
Then on mvneta_open(), we call mvneta_setup_txqs(), which starts
|
||||
allocating memory. On memory allocation failure, mvneta_cleanup_txqs()
|
||||
will walk all the queues freeing any non-NULL pointers - which includes
|
||||
pointers that were previously freed in mvneta_stop().
|
||||
|
||||
Fix this by setting these pointers to NULL to prevent double-freeing
|
||||
of the same memory.
|
||||
|
||||
Link: https://forum.turris.cz/t/random-kernel-exceptions-on-hbl-tos-7-0/18865/8
|
||||
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
---
|
||||
drivers/net/ethernet/marvell/mvneta.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/marvell/mvneta.c
|
||||
+++ b/drivers/net/ethernet/marvell/mvneta.c
|
||||
@@ -3481,6 +3481,8 @@ static void mvneta_txq_sw_deinit(struct
|
||||
|
||||
netdev_tx_reset_queue(nq);
|
||||
|
||||
+ txq->buf = NULL;
|
||||
+ txq->tso_hdrs = NULL;
|
||||
txq->descs = NULL;
|
||||
txq->last_desc = 0;
|
||||
txq->next_desc_to_proc = 0;
|
|
@ -1611,7 +1611,7 @@ static int b53_switch_init(struct b53_device *dev)
|
|||
return b53_switch_reset(dev);
|
||||
}
|
||||
|
||||
struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops,
|
||||
struct b53_device *b53_swconfig_switch_alloc(struct device *base, struct b53_io_ops *ops,
|
||||
void *priv)
|
||||
{
|
||||
struct b53_device *dev;
|
||||
|
@ -1627,9 +1627,9 @@ struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops,
|
|||
|
||||
return dev;
|
||||
}
|
||||
EXPORT_SYMBOL(b53_switch_alloc);
|
||||
EXPORT_SYMBOL(b53_swconfig_switch_alloc);
|
||||
|
||||
int b53_switch_detect(struct b53_device *dev)
|
||||
int b53_swconfig_switch_detect(struct b53_device *dev)
|
||||
{
|
||||
u32 id32;
|
||||
u16 tmp;
|
||||
|
@ -1694,9 +1694,9 @@ int b53_switch_detect(struct b53_device *dev)
|
|||
return b53_read8(dev, B53_MGMT_PAGE, B53_REV_ID,
|
||||
&dev->core_rev);
|
||||
}
|
||||
EXPORT_SYMBOL(b53_switch_detect);
|
||||
EXPORT_SYMBOL(b53_swconfig_switch_detect);
|
||||
|
||||
int b53_switch_register(struct b53_device *dev)
|
||||
int b53_swconfig_switch_register(struct b53_device *dev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -1706,7 +1706,7 @@ int b53_switch_register(struct b53_device *dev)
|
|||
dev->sw_dev.alias = dev->pdata->alias;
|
||||
}
|
||||
|
||||
if (!dev->chip_id && b53_switch_detect(dev))
|
||||
if (!dev->chip_id && b53_swconfig_switch_detect(dev))
|
||||
return -EINVAL;
|
||||
|
||||
ret = b53_switch_init(dev);
|
||||
|
@ -1717,7 +1717,7 @@ int b53_switch_register(struct b53_device *dev)
|
|||
|
||||
return register_switch(&dev->sw_dev, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL(b53_switch_register);
|
||||
EXPORT_SYMBOL(b53_swconfig_switch_register);
|
||||
|
||||
MODULE_AUTHOR("Jonas Gorski <jogo@openwrt.org>");
|
||||
MODULE_DESCRIPTION("B53 switch library");
|
||||
|
|
|
@ -280,7 +280,7 @@ static int b53_phy_probe(struct phy_device *phydev)
|
|||
if (phydev->mdio.addr != B53_PSEUDO_PHY && phydev->mdio.addr != 0)
|
||||
return -ENODEV;
|
||||
|
||||
dev = b53_switch_alloc(&phydev->mdio.dev, &b53_mdio_ops, phydev->mdio.bus);
|
||||
dev = b53_swconfig_switch_alloc(&phydev->mdio.dev, &b53_mdio_ops, phydev->mdio.bus);
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -290,7 +290,7 @@ static int b53_phy_probe(struct phy_device *phydev)
|
|||
dev->pdata = NULL;
|
||||
mutex_init(&dev->reg_mutex);
|
||||
|
||||
ret = b53_switch_detect(dev);
|
||||
ret = b53_swconfig_switch_detect(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -302,7 +302,7 @@ static int b53_phy_probe(struct phy_device *phydev)
|
|||
|
||||
linkmode_copy(phydev->advertising, phydev->supported);
|
||||
|
||||
ret = b53_switch_register(dev);
|
||||
ret = b53_swconfig_switch_register(dev);
|
||||
if (ret) {
|
||||
dev_err(dev->dev, "failed to register switch: %i\n", ret);
|
||||
return ret;
|
||||
|
|
|
@ -205,7 +205,7 @@ static int b53_mmap_probe(struct platform_device *pdev)
|
|||
if (!pdata)
|
||||
return -EINVAL;
|
||||
|
||||
dev = b53_switch_alloc(&pdev->dev, &b53_mmap_ops, pdata->regs);
|
||||
dev = b53_swconfig_switch_alloc(&pdev->dev, &b53_mmap_ops, pdata->regs);
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -214,7 +214,7 @@ static int b53_mmap_probe(struct platform_device *pdev)
|
|||
|
||||
platform_set_drvdata(pdev, dev);
|
||||
|
||||
return b53_switch_register(dev);
|
||||
return b53_swconfig_switch_register(dev);
|
||||
}
|
||||
|
||||
static int b53_mmap_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -183,12 +183,12 @@ static inline struct b53_device *sw_to_b53(struct switch_dev *sw)
|
|||
return container_of(sw, struct b53_device, sw_dev);
|
||||
}
|
||||
|
||||
struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops,
|
||||
struct b53_device *b53_swconfig_switch_alloc(struct device *base, struct b53_io_ops *ops,
|
||||
void *priv);
|
||||
|
||||
int b53_switch_detect(struct b53_device *dev);
|
||||
int b53_swconfig_switch_detect(struct b53_device *dev);
|
||||
|
||||
int b53_switch_register(struct b53_device *dev);
|
||||
int b53_swconfig_switch_register(struct b53_device *dev);
|
||||
|
||||
static inline void b53_switch_remove(struct b53_device *dev)
|
||||
{
|
||||
|
|
|
@ -288,14 +288,14 @@ static int b53_spi_probe(struct spi_device *spi)
|
|||
struct b53_device *dev;
|
||||
int ret;
|
||||
|
||||
dev = b53_switch_alloc(&spi->dev, &b53_spi_ops, spi);
|
||||
dev = b53_swconfig_switch_alloc(&spi->dev, &b53_spi_ops, spi);
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
if (spi->dev.platform_data)
|
||||
dev->pdata = spi->dev.platform_data;
|
||||
|
||||
ret = b53_switch_register(dev);
|
||||
ret = b53_swconfig_switch_register(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ static int b53_srab_probe(struct platform_device *pdev)
|
|||
if (!pdata)
|
||||
return -EINVAL;
|
||||
|
||||
dev = b53_switch_alloc(&pdev->dev, &b53_srab_ops, pdata->regs);
|
||||
dev = b53_swconfig_switch_alloc(&pdev->dev, &b53_srab_ops, pdata->regs);
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -351,7 +351,7 @@ static int b53_srab_probe(struct platform_device *pdev)
|
|||
|
||||
platform_set_drvdata(pdev, dev);
|
||||
|
||||
return b53_switch_register(dev);
|
||||
return b53_swconfig_switch_register(dev);
|
||||
}
|
||||
|
||||
static int b53_srab_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -105,7 +105,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
help
|
||||
--- a/net/core/dev.c
|
||||
+++ b/net/core/dev.c
|
||||
@@ -3588,6 +3588,11 @@ static int xmit_one(struct sk_buff *skb,
|
||||
@@ -3590,6 +3590,11 @@ static int xmit_one(struct sk_buff *skb,
|
||||
if (dev_nit_active(dev))
|
||||
dev_queue_xmit_nit(skb, dev);
|
||||
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
From d6d80269cf5c79f9dfe7d69f8b41a72015c89748 Mon Sep 17 00:00:00 2001
|
||||
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
|
||||
Date: Mon, 3 Apr 2023 19:30:20 +0100
|
||||
Subject: [PATCH 1/5] net: mvneta: fix transmit path dma-unmapping on error
|
||||
|
||||
The transmit code assumes that the transmit descriptors that are used
|
||||
begin with the first descriptor in the ring, but this may not be the
|
||||
case. Fix this by providing a new function that dma-unmaps a range of
|
||||
numbered descriptor entries, and use that to do the unmapping.
|
||||
|
||||
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
---
|
||||
drivers/net/ethernet/marvell/mvneta.c | 53 +++++++++++++++++----------
|
||||
1 file changed, 33 insertions(+), 20 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/marvell/mvneta.c
|
||||
+++ b/drivers/net/ethernet/marvell/mvneta.c
|
||||
@@ -2647,14 +2647,40 @@ mvneta_tso_put_data(struct net_device *d
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void mvneta_release_descs(struct mvneta_port *pp,
|
||||
+ struct mvneta_tx_queue *txq,
|
||||
+ int first, int num)
|
||||
+{
|
||||
+ int desc_idx, i;
|
||||
+
|
||||
+ desc_idx = first + num;
|
||||
+ if (desc_idx >= txq->size)
|
||||
+ desc_idx -= txq->size;
|
||||
+
|
||||
+ for (i = num; i >= 0; i--) {
|
||||
+ struct mvneta_tx_desc *tx_desc = txq->descs + desc_idx;
|
||||
+
|
||||
+ if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr))
|
||||
+ dma_unmap_single(pp->dev->dev.parent,
|
||||
+ tx_desc->buf_phys_addr,
|
||||
+ tx_desc->data_size,
|
||||
+ DMA_TO_DEVICE);
|
||||
+
|
||||
+ mvneta_txq_desc_put(txq);
|
||||
+
|
||||
+ if (desc_idx == 0)
|
||||
+ desc_idx = txq->size;
|
||||
+ desc_idx -= 1;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int mvneta_tx_tso(struct sk_buff *skb, struct net_device *dev,
|
||||
struct mvneta_tx_queue *txq)
|
||||
{
|
||||
int hdr_len, total_len, data_left;
|
||||
- int desc_count = 0;
|
||||
+ int first_desc, desc_count = 0;
|
||||
struct mvneta_port *pp = netdev_priv(dev);
|
||||
struct tso_t tso;
|
||||
- int i;
|
||||
|
||||
/* Count needed descriptors */
|
||||
if ((txq->count + tso_count_descs(skb)) >= txq->size)
|
||||
@@ -2665,6 +2691,8 @@ static int mvneta_tx_tso(struct sk_buff
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ first_desc = txq->txq_put_index;
|
||||
+
|
||||
/* Initialize the TSO handler, and prepare the first payload */
|
||||
hdr_len = tso_start(skb, &tso);
|
||||
|
||||
@@ -2705,15 +2733,7 @@ err_release:
|
||||
/* Release all used data descriptors; header descriptors must not
|
||||
* be DMA-unmapped.
|
||||
*/
|
||||
- for (i = desc_count - 1; i >= 0; i--) {
|
||||
- struct mvneta_tx_desc *tx_desc = txq->descs + i;
|
||||
- if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr))
|
||||
- dma_unmap_single(pp->dev->dev.parent,
|
||||
- tx_desc->buf_phys_addr,
|
||||
- tx_desc->data_size,
|
||||
- DMA_TO_DEVICE);
|
||||
- mvneta_txq_desc_put(txq);
|
||||
- }
|
||||
+ mvneta_release_descs(pp, txq, first_desc, desc_count - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2723,6 +2743,7 @@ static int mvneta_tx_frag_process(struct
|
||||
{
|
||||
struct mvneta_tx_desc *tx_desc;
|
||||
int i, nr_frags = skb_shinfo(skb)->nr_frags;
|
||||
+ int first_desc = txq->txq_put_index;
|
||||
|
||||
for (i = 0; i < nr_frags; i++) {
|
||||
struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index];
|
||||
@@ -2761,15 +2782,7 @@ error:
|
||||
/* Release all descriptors that were used to map fragments of
|
||||
* this packet, as well as the corresponding DMA mappings
|
||||
*/
|
||||
- for (i = i - 1; i >= 0; i--) {
|
||||
- tx_desc = txq->descs + i;
|
||||
- dma_unmap_single(pp->dev->dev.parent,
|
||||
- tx_desc->buf_phys_addr,
|
||||
- tx_desc->data_size,
|
||||
- DMA_TO_DEVICE);
|
||||
- mvneta_txq_desc_put(txq);
|
||||
- }
|
||||
-
|
||||
+ mvneta_release_descs(pp, txq, first_desc, i - 1);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
From e3c77d0a1b635d114c147fd2078afb57ed558b81 Mon Sep 17 00:00:00 2001
|
||||
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
|
||||
Date: Mon, 3 Apr 2023 19:30:25 +0100
|
||||
Subject: [PATCH 2/5] net: mvneta: mark mapped and tso buffers separately
|
||||
|
||||
Mark dma-mapped skbs and TSO buffers separately, so we can use
|
||||
buf->type to identify their differences.
|
||||
|
||||
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
---
|
||||
drivers/net/ethernet/marvell/mvneta.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/marvell/mvneta.c
|
||||
+++ b/drivers/net/ethernet/marvell/mvneta.c
|
||||
@@ -607,6 +607,7 @@ struct mvneta_rx_desc {
|
||||
#endif
|
||||
|
||||
enum mvneta_tx_buf_type {
|
||||
+ MVNETA_TYPE_TSO,
|
||||
MVNETA_TYPE_SKB,
|
||||
MVNETA_TYPE_XDP_TX,
|
||||
MVNETA_TYPE_XDP_NDO,
|
||||
@@ -1852,7 +1853,8 @@ static void mvneta_txq_bufs_free(struct
|
||||
dma_unmap_single(pp->dev->dev.parent,
|
||||
tx_desc->buf_phys_addr,
|
||||
tx_desc->data_size, DMA_TO_DEVICE);
|
||||
- if (buf->type == MVNETA_TYPE_SKB && buf->skb) {
|
||||
+ if ((buf->type == MVNETA_TYPE_TSO ||
|
||||
+ buf->type == MVNETA_TYPE_SKB) && buf->skb) {
|
||||
bytes_compl += buf->skb->len;
|
||||
pkts_compl++;
|
||||
dev_kfree_skb_any(buf->skb);
|
||||
@@ -2607,7 +2609,7 @@ mvneta_tso_put_hdr(struct sk_buff *skb,
|
||||
tx_desc->command |= MVNETA_TXD_F_DESC;
|
||||
tx_desc->buf_phys_addr = txq->tso_hdrs_phys +
|
||||
txq->txq_put_index * TSO_HEADER_SIZE;
|
||||
- buf->type = MVNETA_TYPE_SKB;
|
||||
+ buf->type = MVNETA_TYPE_TSO;
|
||||
buf->skb = NULL;
|
||||
|
||||
mvneta_txq_inc_put(txq);
|
|
@ -0,0 +1,59 @@
|
|||
From fe2abc1abc0dfc6c13fe8f189216f00dbbb33044 Mon Sep 17 00:00:00 2001
|
||||
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
|
||||
Date: Mon, 3 Apr 2023 19:30:30 +0100
|
||||
Subject: [PATCH 3/5] net: mvneta: use buf->type to determine whether to
|
||||
dma-unmap
|
||||
|
||||
Now that we use a different buffer type for TSO headers, we can use
|
||||
buf->type to determine whether the original buffer was DMA-mapped or
|
||||
not. The rules are:
|
||||
|
||||
MVNETA_TYPE_XDP_TX - from a DMA pool, no unmap is required
|
||||
MVNETA_TYPE_XDP_NDO - dma_map_single()'d
|
||||
MVNETA_TYPE_SKB - normal skbuff, dma_map_single()'d
|
||||
MVNETA_TYPE_TSO - from the TSO buffer area
|
||||
|
||||
This means we only need to call dma_unmap_single() on the XDP_NDO and
|
||||
SKB types of buffer, and we no longer need the private IS_TSO_HEADER()
|
||||
which relies on the TSO region being contiguously allocated.
|
||||
|
||||
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
---
|
||||
drivers/net/ethernet/marvell/mvneta.c | 11 ++++-------
|
||||
1 file changed, 4 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/marvell/mvneta.c
|
||||
+++ b/drivers/net/ethernet/marvell/mvneta.c
|
||||
@@ -334,10 +334,6 @@
|
||||
MVNETA_SKB_HEADROOM))
|
||||
#define MVNETA_MAX_RX_BUF_SIZE (PAGE_SIZE - MVNETA_SKB_PAD)
|
||||
|
||||
-#define IS_TSO_HEADER(txq, addr) \
|
||||
- ((addr >= txq->tso_hdrs_phys) && \
|
||||
- (addr < txq->tso_hdrs_phys + txq->size * TSO_HEADER_SIZE))
|
||||
-
|
||||
#define MVNETA_RX_GET_BM_POOL_ID(rxd) \
|
||||
(((rxd)->status & MVNETA_RXD_BM_POOL_MASK) >> MVNETA_RXD_BM_POOL_SHIFT)
|
||||
|
||||
@@ -1848,8 +1844,8 @@ static void mvneta_txq_bufs_free(struct
|
||||
|
||||
mvneta_txq_inc_get(txq);
|
||||
|
||||
- if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr) &&
|
||||
- buf->type != MVNETA_TYPE_XDP_TX)
|
||||
+ if (buf->type == MVNETA_TYPE_XDP_NDO ||
|
||||
+ buf->type == MVNETA_TYPE_SKB)
|
||||
dma_unmap_single(pp->dev->dev.parent,
|
||||
tx_desc->buf_phys_addr,
|
||||
tx_desc->data_size, DMA_TO_DEVICE);
|
||||
@@ -2661,8 +2657,9 @@ static void mvneta_release_descs(struct
|
||||
|
||||
for (i = num; i >= 0; i--) {
|
||||
struct mvneta_tx_desc *tx_desc = txq->descs + desc_idx;
|
||||
+ struct mvneta_tx_buf *buf = &txq->buf[desc_idx];
|
||||
|
||||
- if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr))
|
||||
+ if (buf->type == MVNETA_TYPE_SKB)
|
||||
dma_unmap_single(pp->dev->dev.parent,
|
||||
tx_desc->buf_phys_addr,
|
||||
tx_desc->data_size,
|
|
@ -0,0 +1,65 @@
|
|||
From 210ca75d4949f1ace8ea53a75148806cc28224a0 Mon Sep 17 00:00:00 2001
|
||||
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
|
||||
Date: Mon, 3 Apr 2023 19:30:35 +0100
|
||||
Subject: [PATCH 4/5] net: mvneta: move tso_build_hdr() into
|
||||
mvneta_tso_put_hdr()
|
||||
|
||||
Move tso_build_hdr() into mvneta_tso_put_hdr() so that all the TSO
|
||||
header building code is in one place.
|
||||
|
||||
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
---
|
||||
drivers/net/ethernet/marvell/mvneta.c | 22 +++++++++++-----------
|
||||
1 file changed, 11 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/marvell/mvneta.c
|
||||
+++ b/drivers/net/ethernet/marvell/mvneta.c
|
||||
@@ -2592,19 +2592,24 @@ err_drop_frame:
|
||||
return rx_done;
|
||||
}
|
||||
|
||||
-static inline void
|
||||
-mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq)
|
||||
+static void mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq,
|
||||
+ struct tso_t *tso, int size, bool is_last)
|
||||
{
|
||||
- int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
|
||||
+ int tso_offset, hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
|
||||
struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index];
|
||||
struct mvneta_tx_desc *tx_desc;
|
||||
+ char *hdr;
|
||||
+
|
||||
+ tso_offset = txq->txq_put_index * TSO_HEADER_SIZE;
|
||||
+
|
||||
+ hdr = txq->tso_hdrs + tso_offset;
|
||||
+ tso_build_hdr(skb, hdr, tso, size, is_last);
|
||||
|
||||
tx_desc = mvneta_txq_next_desc_get(txq);
|
||||
tx_desc->data_size = hdr_len;
|
||||
tx_desc->command = mvneta_skb_tx_csum(skb);
|
||||
tx_desc->command |= MVNETA_TXD_F_DESC;
|
||||
- tx_desc->buf_phys_addr = txq->tso_hdrs_phys +
|
||||
- txq->txq_put_index * TSO_HEADER_SIZE;
|
||||
+ tx_desc->buf_phys_addr = txq->tso_hdrs_phys + tso_offset;
|
||||
buf->type = MVNETA_TYPE_TSO;
|
||||
buf->skb = NULL;
|
||||
|
||||
@@ -2697,17 +2702,12 @@ static int mvneta_tx_tso(struct sk_buff
|
||||
|
||||
total_len = skb->len - hdr_len;
|
||||
while (total_len > 0) {
|
||||
- char *hdr;
|
||||
-
|
||||
data_left = min_t(int, skb_shinfo(skb)->gso_size, total_len);
|
||||
total_len -= data_left;
|
||||
desc_count++;
|
||||
|
||||
/* prepare packet headers: MAC + IP + TCP */
|
||||
- hdr = txq->tso_hdrs + txq->txq_put_index * TSO_HEADER_SIZE;
|
||||
- tso_build_hdr(skb, hdr, &tso, data_left, total_len == 0);
|
||||
-
|
||||
- mvneta_tso_put_hdr(skb, txq);
|
||||
+ mvneta_tso_put_hdr(skb, txq, &tso, data_left, total_len == 0);
|
||||
|
||||
while (data_left > 0) {
|
||||
int size;
|
|
@ -0,0 +1,179 @@
|
|||
From 58d50fb089da553023df5a05f5ae86feaacc7f24 Mon Sep 17 00:00:00 2001
|
||||
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
|
||||
Date: Mon, 3 Apr 2023 19:30:40 +0100
|
||||
Subject: [PATCH 5/5] net: mvneta: allocate TSO header DMA memory in chunks
|
||||
|
||||
Now that we no longer need to check whether the DMA address is within
|
||||
the TSO header DMA memory range for the queue, we can allocate the TSO
|
||||
header DMA memory in chunks rather than one contiguous order-6 chunk,
|
||||
which can stress the kernel's memory subsystems to allocate.
|
||||
|
||||
Instead, use order-1 (8k) allocations, which will result in 32 order-1
|
||||
pages containing 32 TSO headers.
|
||||
|
||||
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
---
|
||||
drivers/net/ethernet/marvell/mvneta.c | 88 +++++++++++++++++++++------
|
||||
1 file changed, 70 insertions(+), 18 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/marvell/mvneta.c
|
||||
+++ b/drivers/net/ethernet/marvell/mvneta.c
|
||||
@@ -314,6 +314,15 @@
|
||||
|
||||
#define MVNETA_MAX_SKB_DESCS (MVNETA_MAX_TSO_SEGS * 2 + MAX_SKB_FRAGS)
|
||||
|
||||
+/* The size of a TSO header page */
|
||||
+#define MVNETA_TSO_PAGE_SIZE (2 * PAGE_SIZE)
|
||||
+
|
||||
+/* Number of TSO headers per page. This should be a power of 2 */
|
||||
+#define MVNETA_TSO_PER_PAGE (MVNETA_TSO_PAGE_SIZE / TSO_HEADER_SIZE)
|
||||
+
|
||||
+/* Maximum number of TSO header pages */
|
||||
+#define MVNETA_MAX_TSO_PAGES (MVNETA_MAX_TXD / MVNETA_TSO_PER_PAGE)
|
||||
+
|
||||
/* descriptor aligned size */
|
||||
#define MVNETA_DESC_ALIGNED_SIZE 32
|
||||
|
||||
@@ -656,10 +665,10 @@ struct mvneta_tx_queue {
|
||||
int next_desc_to_proc;
|
||||
|
||||
/* DMA buffers for TSO headers */
|
||||
- char *tso_hdrs;
|
||||
+ char *tso_hdrs[MVNETA_MAX_TSO_PAGES];
|
||||
|
||||
/* DMA address of TSO headers */
|
||||
- dma_addr_t tso_hdrs_phys;
|
||||
+ dma_addr_t tso_hdrs_phys[MVNETA_MAX_TSO_PAGES];
|
||||
|
||||
/* Affinity mask for CPUs*/
|
||||
cpumask_t affinity_mask;
|
||||
@@ -2592,24 +2601,71 @@ err_drop_frame:
|
||||
return rx_done;
|
||||
}
|
||||
|
||||
+static void mvneta_free_tso_hdrs(struct mvneta_port *pp,
|
||||
+ struct mvneta_tx_queue *txq)
|
||||
+{
|
||||
+ struct device *dev = pp->dev->dev.parent;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < MVNETA_MAX_TSO_PAGES; i++) {
|
||||
+ if (txq->tso_hdrs[i]) {
|
||||
+ dma_free_coherent(dev, MVNETA_TSO_PAGE_SIZE,
|
||||
+ txq->tso_hdrs[i],
|
||||
+ txq->tso_hdrs_phys[i]);
|
||||
+ txq->tso_hdrs[i] = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int mvneta_alloc_tso_hdrs(struct mvneta_port *pp,
|
||||
+ struct mvneta_tx_queue *txq)
|
||||
+{
|
||||
+ struct device *dev = pp->dev->dev.parent;
|
||||
+ int i, num;
|
||||
+
|
||||
+ num = DIV_ROUND_UP(txq->size, MVNETA_TSO_PER_PAGE);
|
||||
+ for (i = 0; i < num; i++) {
|
||||
+ txq->tso_hdrs[i] = dma_alloc_coherent(dev, MVNETA_TSO_PAGE_SIZE,
|
||||
+ &txq->tso_hdrs_phys[i],
|
||||
+ GFP_KERNEL);
|
||||
+ if (!txq->tso_hdrs[i]) {
|
||||
+ mvneta_free_tso_hdrs(pp, txq);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static char *mvneta_get_tso_hdr(struct mvneta_tx_queue *txq, dma_addr_t *dma)
|
||||
+{
|
||||
+ int index, offset;
|
||||
+
|
||||
+ index = txq->txq_put_index / MVNETA_TSO_PER_PAGE;
|
||||
+ offset = (txq->txq_put_index % MVNETA_TSO_PER_PAGE) * TSO_HEADER_SIZE;
|
||||
+
|
||||
+ *dma = txq->tso_hdrs_phys[index] + offset;
|
||||
+
|
||||
+ return txq->tso_hdrs[index] + offset;
|
||||
+}
|
||||
+
|
||||
static void mvneta_tso_put_hdr(struct sk_buff *skb, struct mvneta_tx_queue *txq,
|
||||
struct tso_t *tso, int size, bool is_last)
|
||||
{
|
||||
- int tso_offset, hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
|
||||
+ int hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
|
||||
struct mvneta_tx_buf *buf = &txq->buf[txq->txq_put_index];
|
||||
struct mvneta_tx_desc *tx_desc;
|
||||
+ dma_addr_t hdr_phys;
|
||||
char *hdr;
|
||||
|
||||
- tso_offset = txq->txq_put_index * TSO_HEADER_SIZE;
|
||||
-
|
||||
- hdr = txq->tso_hdrs + tso_offset;
|
||||
+ hdr = mvneta_get_tso_hdr(txq, &hdr_phys);
|
||||
tso_build_hdr(skb, hdr, tso, size, is_last);
|
||||
|
||||
tx_desc = mvneta_txq_next_desc_get(txq);
|
||||
tx_desc->data_size = hdr_len;
|
||||
tx_desc->command = mvneta_skb_tx_csum(skb);
|
||||
tx_desc->command |= MVNETA_TXD_F_DESC;
|
||||
- tx_desc->buf_phys_addr = txq->tso_hdrs_phys + tso_offset;
|
||||
+ tx_desc->buf_phys_addr = hdr_phys;
|
||||
buf->type = MVNETA_TYPE_TSO;
|
||||
buf->skb = NULL;
|
||||
|
||||
@@ -3401,7 +3457,7 @@ static void mvneta_rxq_deinit(struct mvn
|
||||
static int mvneta_txq_sw_init(struct mvneta_port *pp,
|
||||
struct mvneta_tx_queue *txq)
|
||||
{
|
||||
- int cpu;
|
||||
+ int cpu, err;
|
||||
|
||||
txq->size = pp->tx_ring_size;
|
||||
|
||||
@@ -3426,11 +3482,9 @@ static int mvneta_txq_sw_init(struct mvn
|
||||
return -ENOMEM;
|
||||
|
||||
/* Allocate DMA buffers for TSO MAC/IP/TCP headers */
|
||||
- txq->tso_hdrs = dma_alloc_coherent(pp->dev->dev.parent,
|
||||
- txq->size * TSO_HEADER_SIZE,
|
||||
- &txq->tso_hdrs_phys, GFP_KERNEL);
|
||||
- if (!txq->tso_hdrs)
|
||||
- return -ENOMEM;
|
||||
+ err = mvneta_alloc_tso_hdrs(pp, txq);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
|
||||
/* Setup XPS mapping */
|
||||
if (pp->neta_armada3700)
|
||||
@@ -3482,10 +3536,7 @@ static void mvneta_txq_sw_deinit(struct
|
||||
|
||||
kfree(txq->buf);
|
||||
|
||||
- if (txq->tso_hdrs)
|
||||
- dma_free_coherent(pp->dev->dev.parent,
|
||||
- txq->size * TSO_HEADER_SIZE,
|
||||
- txq->tso_hdrs, txq->tso_hdrs_phys);
|
||||
+ mvneta_free_tso_hdrs(pp, txq);
|
||||
if (txq->descs)
|
||||
dma_free_coherent(pp->dev->dev.parent,
|
||||
txq->size * MVNETA_DESC_ALIGNED_SIZE,
|
||||
@@ -3494,7 +3545,6 @@ static void mvneta_txq_sw_deinit(struct
|
||||
netdev_tx_reset_queue(nq);
|
||||
|
||||
txq->buf = NULL;
|
||||
- txq->tso_hdrs = NULL;
|
||||
txq->descs = NULL;
|
||||
txq->last_desc = 0;
|
||||
txq->next_desc_to_proc = 0;
|
||||
@@ -5543,6 +5593,8 @@ static int __init mvneta_driver_init(voi
|
||||
{
|
||||
int ret;
|
||||
|
||||
+ BUILD_BUG_ON_NOT_POWER_OF_2(MVNETA_TSO_PER_PAGE);
|
||||
+
|
||||
ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "net/mvneta:online",
|
||||
mvneta_cpu_online,
|
||||
mvneta_cpu_down_prepare);
|
|
@ -55,7 +55,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
goto out;
|
||||
|
||||
if (!net_eq(dev_net(dev), sock_net(sk)))
|
||||
@@ -2129,12 +2131,12 @@ static int packet_rcv(struct sk_buff *sk
|
||||
@@ -2127,12 +2129,12 @@ static int packet_rcv(struct sk_buff *sk
|
||||
unsigned int snaplen, res;
|
||||
bool is_drop_n_account = false;
|
||||
|
||||
|
@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
if (!net_eq(dev_net(dev), sock_net(sk)))
|
||||
goto drop;
|
||||
|
||||
@@ -2261,12 +2263,12 @@ static int tpacket_rcv(struct sk_buff *s
|
||||
@@ -2259,12 +2261,12 @@ static int tpacket_rcv(struct sk_buff *s
|
||||
BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32);
|
||||
BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48);
|
||||
|
||||
|
@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
if (!net_eq(dev_net(dev), sock_net(sk)))
|
||||
goto drop;
|
||||
|
||||
@@ -3374,6 +3376,7 @@ static int packet_create(struct net *net
|
||||
@@ -3372,6 +3374,7 @@ static int packet_create(struct net *net
|
||||
mutex_init(&po->pg_vec_lock);
|
||||
po->rollover = NULL;
|
||||
po->prot_hook.func = packet_rcv;
|
||||
|
@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
|
||||
if (sock->type == SOCK_PACKET)
|
||||
po->prot_hook.func = packet_rcv_spkt;
|
||||
@@ -4009,6 +4012,16 @@ packet_setsockopt(struct socket *sock, i
|
||||
@@ -4007,6 +4010,16 @@ packet_setsockopt(struct socket *sock, i
|
||||
WRITE_ONCE(po->xmit, val ? packet_direct_xmit : dev_queue_xmit);
|
||||
return 0;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
default:
|
||||
return -ENOPROTOOPT;
|
||||
}
|
||||
@@ -4065,6 +4078,13 @@ static int packet_getsockopt(struct sock
|
||||
@@ -4063,6 +4076,13 @@ static int packet_getsockopt(struct sock
|
||||
case PACKET_VNET_HDR:
|
||||
val = po->has_vnet_hdr;
|
||||
break;
|
||||
|
|
|
@ -44,7 +44,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
|
||||
--- a/net/core/dev.c
|
||||
+++ b/net/core/dev.c
|
||||
@@ -7604,6 +7604,48 @@ static void __netdev_adjacent_dev_unlink
|
||||
@@ -7606,6 +7606,48 @@ static void __netdev_adjacent_dev_unlink
|
||||
&upper_dev->adj_list.lower);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
static int __netdev_upper_dev_link(struct net_device *dev,
|
||||
struct net_device *upper_dev, bool master,
|
||||
void *upper_priv, void *upper_info,
|
||||
@@ -7655,6 +7697,7 @@ static int __netdev_upper_dev_link(struc
|
||||
@@ -7657,6 +7699,7 @@ static int __netdev_upper_dev_link(struc
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -101,7 +101,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER,
|
||||
&changeupper_info.info);
|
||||
ret = notifier_to_errno(ret);
|
||||
@@ -7751,6 +7794,7 @@ static void __netdev_upper_dev_unlink(st
|
||||
@@ -7753,6 +7796,7 @@ static void __netdev_upper_dev_unlink(st
|
||||
|
||||
__netdev_adjacent_dev_unlink_neighbour(dev, upper_dev);
|
||||
|
||||
|
@ -109,7 +109,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
call_netdevice_notifiers_info(NETDEV_CHANGEUPPER,
|
||||
&changeupper_info.info);
|
||||
|
||||
@@ -8803,6 +8847,7 @@ int dev_set_mac_address(struct net_devic
|
||||
@@ -8805,6 +8849,7 @@ int dev_set_mac_address(struct net_devic
|
||||
if (err)
|
||||
return err;
|
||||
dev->addr_assign_type = NET_ADDR_SET;
|
||||
|
|
|
@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
|
||||
/**
|
||||
* napi_disable - prevent NAPI from scheduling
|
||||
@@ -3126,6 +3127,7 @@ struct softnet_data {
|
||||
@@ -3127,6 +3128,7 @@ struct softnet_data {
|
||||
unsigned int processed;
|
||||
unsigned int time_squeeze;
|
||||
unsigned int received_rps;
|
||||
|
@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
#endif
|
||||
--- a/net/core/dev.c
|
||||
+++ b/net/core/dev.c
|
||||
@@ -4604,7 +4604,7 @@ static int napi_schedule_rps(struct soft
|
||||
@@ -4606,7 +4606,7 @@ static int napi_schedule_rps(struct soft
|
||||
struct softnet_data *mysd = this_cpu_ptr(&softnet_data);
|
||||
|
||||
#ifdef CONFIG_RPS
|
||||
|
@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
sd->rps_ipi_next = mysd->rps_ipi_list;
|
||||
mysd->rps_ipi_list = sd;
|
||||
|
||||
@@ -5785,6 +5785,8 @@ static DEFINE_PER_CPU(struct work_struct
|
||||
@@ -5787,6 +5787,8 @@ static DEFINE_PER_CPU(struct work_struct
|
||||
/* Network device is going away, flush any packets still pending */
|
||||
static void flush_backlog(struct work_struct *work)
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
struct sk_buff *skb, *tmp;
|
||||
struct softnet_data *sd;
|
||||
|
||||
@@ -5799,8 +5801,17 @@ static void flush_backlog(struct work_st
|
||||
@@ -5801,8 +5803,17 @@ static void flush_backlog(struct work_st
|
||||
input_queue_head_incr(sd);
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
skb_queue_walk_safe(&sd->process_queue, skb, tmp) {
|
||||
if (skb->dev->reg_state == NETREG_UNREGISTERING) {
|
||||
__skb_unlink(skb, &sd->process_queue);
|
||||
@@ -5808,7 +5819,16 @@ static void flush_backlog(struct work_st
|
||||
@@ -5810,7 +5821,16 @@ static void flush_backlog(struct work_st
|
||||
input_queue_head_incr(sd);
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
}
|
||||
|
||||
static bool flush_required(int cpu)
|
||||
@@ -5940,6 +5960,7 @@ static int process_backlog(struct napi_s
|
||||
@@ -5942,6 +5962,7 @@ static int process_backlog(struct napi_s
|
||||
}
|
||||
|
||||
rps_lock_irq_disable(sd);
|
||||
|
@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
if (skb_queue_empty(&sd->input_pkt_queue)) {
|
||||
/*
|
||||
* Inline a custom version of __napi_complete().
|
||||
@@ -5949,7 +5970,8 @@ static int process_backlog(struct napi_s
|
||||
@@ -5951,7 +5972,8 @@ static int process_backlog(struct napi_s
|
||||
* We can use a plain write instead of clear_bit(),
|
||||
* and we dont need an smp_mb() memory barrier.
|
||||
*/
|
||||
|
@ -101,7 +101,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
again = false;
|
||||
} else {
|
||||
skb_queue_splice_tail_init(&sd->input_pkt_queue,
|
||||
@@ -6365,6 +6387,55 @@ int dev_set_threaded(struct net_device *
|
||||
@@ -6367,6 +6389,55 @@ int dev_set_threaded(struct net_device *
|
||||
}
|
||||
EXPORT_SYMBOL(dev_set_threaded);
|
||||
|
||||
|
@ -157,7 +157,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
void netif_napi_add_weight(struct net_device *dev, struct napi_struct *napi,
|
||||
int (*poll)(struct napi_struct *, int), int weight)
|
||||
{
|
||||
@@ -11137,6 +11208,9 @@ static int dev_cpu_dead(unsigned int old
|
||||
@@ -11139,6 +11210,9 @@ static int dev_cpu_dead(unsigned int old
|
||||
raise_softirq_irqoff(NET_TX_SOFTIRQ);
|
||||
local_irq_enable();
|
||||
|
||||
|
@ -167,7 +167,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
#ifdef CONFIG_RPS
|
||||
remsd = oldsd->rps_ipi_list;
|
||||
oldsd->rps_ipi_list = NULL;
|
||||
@@ -11440,6 +11514,7 @@ static int __init net_dev_init(void)
|
||||
@@ -11442,6 +11516,7 @@ static int __init net_dev_init(void)
|
||||
INIT_CSD(&sd->defer_csd, trigger_rx_softirq, sd);
|
||||
spin_lock_init(&sd->defer_lock);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
|
|||
|
||||
--- a/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
@@ -6971,6 +6971,7 @@ static int mv88e6xxx_register_switch(str
|
||||
@@ -6973,6 +6973,7 @@ static int mv88e6xxx_register_switch(str
|
||||
ds->ops = &mv88e6xxx_switch_ops;
|
||||
ds->ageing_time_min = chip->info->age_time_coeff;
|
||||
ds->ageing_time_max = chip->info->age_time_coeff * U8_MAX;
|
||||
|
|
|
@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
---
|
||||
--- a/drivers/net/ethernet/marvell/mvneta.c
|
||||
+++ b/drivers/net/ethernet/marvell/mvneta.c
|
||||
@@ -4943,6 +4943,16 @@ static int mvneta_setup_tc(struct net_de
|
||||
@@ -5006,6 +5006,16 @@ static int mvneta_setup_tc(struct net_de
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
static const struct net_device_ops mvneta_netdev_ops = {
|
||||
.ndo_open = mvneta_open,
|
||||
.ndo_stop = mvneta_stop,
|
||||
@@ -4953,6 +4963,9 @@ static const struct net_device_ops mvnet
|
||||
@@ -5016,6 +5026,9 @@ static const struct net_device_ops mvnet
|
||||
.ndo_fix_features = mvneta_fix_features,
|
||||
.ndo_get_stats64 = mvneta_get_stats64,
|
||||
.ndo_eth_ioctl = mvneta_ioctl,
|
||||
|
|
|
@ -26,7 +26,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
|||
#include <linux/bpf_trace.h>
|
||||
|
||||
/* Registers */
|
||||
@@ -4903,14 +4904,14 @@ static void mvneta_setup_rx_prio_map(str
|
||||
@@ -4966,14 +4967,14 @@ static void mvneta_setup_rx_prio_map(str
|
||||
}
|
||||
|
||||
static int mvneta_setup_mqprio(struct net_device *dev,
|
||||
|
@ -44,7 +44,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
|||
|
||||
if (num_tc > rxq_number)
|
||||
return -EINVAL;
|
||||
@@ -4921,13 +4922,15 @@ static int mvneta_setup_mqprio(struct ne
|
||||
@@ -4984,13 +4985,15 @@ static int mvneta_setup_mqprio(struct ne
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
|||
|
||||
--- a/drivers/net/ethernet/marvell/mvneta.c
|
||||
+++ b/drivers/net/ethernet/marvell/mvneta.c
|
||||
@@ -4910,7 +4910,9 @@ static int mvneta_setup_mqprio(struct ne
|
||||
@@ -4973,7 +4973,9 @@ static int mvneta_setup_mqprio(struct ne
|
||||
u8 num_tc;
|
||||
int i;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
|||
|
||||
--- a/drivers/net/ethernet/marvell/mvneta.c
|
||||
+++ b/drivers/net/ethernet/marvell/mvneta.c
|
||||
@@ -493,7 +493,6 @@ struct mvneta_port {
|
||||
@@ -498,7 +498,6 @@ struct mvneta_port {
|
||||
u8 mcast_count[256];
|
||||
u16 tx_ring_size;
|
||||
u16 rx_ring_size;
|
||||
|
@ -30,7 +30,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
|||
|
||||
phy_interface_t phy_interface;
|
||||
struct device_node *dn;
|
||||
@@ -4892,13 +4891,12 @@ static void mvneta_clear_rx_prio_map(str
|
||||
@@ -4955,13 +4954,12 @@ static void mvneta_clear_rx_prio_map(str
|
||||
mvreg_write(pp, MVNETA_VLAN_PRIO_TO_RXQ, 0);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
|||
|
||||
mvreg_write(pp, MVNETA_VLAN_PRIO_TO_RXQ, val);
|
||||
}
|
||||
@@ -4907,8 +4905,8 @@ static int mvneta_setup_mqprio(struct ne
|
||||
@@ -4970,8 +4968,8 @@ static int mvneta_setup_mqprio(struct ne
|
||||
struct tc_mqprio_qopt_offload *mqprio)
|
||||
{
|
||||
struct mvneta_port *pp = netdev_priv(dev);
|
||||
|
@ -58,7 +58,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
|||
|
||||
if (mqprio->qopt.hw != TC_MQPRIO_HW_OFFLOAD_TCS)
|
||||
return 0;
|
||||
@@ -4918,21 +4916,28 @@ static int mvneta_setup_mqprio(struct ne
|
||||
@@ -4981,21 +4979,28 @@ static int mvneta_setup_mqprio(struct ne
|
||||
if (num_tc > rxq_number)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
|||
#define MVNETA_LPI_CTRL_0 0x2cc0
|
||||
#define MVNETA_LPI_CTRL_1 0x2cc4
|
||||
#define MVNETA_LPI_REQUEST_ENABLE BIT(0)
|
||||
@@ -4901,11 +4928,74 @@ static void mvneta_map_vlan_prio_to_rxq(
|
||||
@@ -4964,11 +4991,74 @@ static void mvneta_map_vlan_prio_to_rxq(
|
||||
mvreg_write(pp, MVNETA_VLAN_PRIO_TO_RXQ, val);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
|||
u8 num_tc;
|
||||
|
||||
if (mqprio->qopt.hw != TC_MQPRIO_HW_OFFLOAD_TCS)
|
||||
@@ -4919,6 +5009,7 @@ static int mvneta_setup_mqprio(struct ne
|
||||
@@ -4982,6 +5072,7 @@ static int mvneta_setup_mqprio(struct ne
|
||||
mvneta_clear_rx_prio_map(pp);
|
||||
|
||||
if (!num_tc) {
|
||||
|
@ -146,7 +146,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
|||
netdev_reset_tc(dev);
|
||||
return 0;
|
||||
}
|
||||
@@ -4939,6 +5030,33 @@ static int mvneta_setup_mqprio(struct ne
|
||||
@@ -5002,6 +5093,33 @@ static int mvneta_setup_mqprio(struct ne
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2158,6 +2158,9 @@ define Device/tplink_mr600-v2-eu
|
|||
TPLINK_FLASHLAYOUT := 16Mltq
|
||||
DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \
|
||||
kmod-usb-net-qmi-wwan uqmi kmod-usb3 -uboot-envtools
|
||||
IMAGE/factory.bin := tplink-v2-image -e -a 0x10000
|
||||
IMAGE/sysupgrade.bin := tplink-v2-image -s -e -a 0x10000 | check-size | \
|
||||
append-metadata
|
||||
KERNEL := $(KERNEL_DTB) | uImage lzma
|
||||
KERNEL_INITRAMFS := $$(KERNEL) | tplink-v2-header
|
||||
TPLINK_BOARD_ID := MR600-V2-EU
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <net/nexthop.h>
|
||||
#include <net/neighbour.h>
|
||||
#include <net/netevent.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/inetdevice.h>
|
||||
#include <linux/rhashtable.h>
|
||||
#include <linux/of_net.h>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <net/dsa.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/if_bridge.h>
|
||||
#include <asm/mach-rtl838x/mach-rtl83xx.h>
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <asm/mach-rtl838x/mach-rtl83xx.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include <net/nexthop.h>
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <asm/mach-rtl838x/mach-rtl83xx.h>
|
||||
#include <linux/etherdevice.h>
|
||||
|
||||
#include "rtl83xx.h"
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <asm/mach-rtl838x/mach-rtl83xx.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/inetdevice.h>
|
||||
|
||||
#include "rtl83xx.h"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <asm/mach-rtl838x/mach-rtl83xx.h>
|
||||
#include <linux/etherdevice.h>
|
||||
|
||||
#include "rtl83xx.h"
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <net/dsa.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <net/flow_offload.h>
|
||||
#include <linux/rhashtable.h>
|
||||
|
|
|
@ -1557,7 +1557,7 @@ static int rtl838x_set_mac_address(struct net_device *dev, void *p)
|
|||
if (!is_valid_ether_addr(addr->sa_data))
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
|
||||
dev_addr_set(dev, addr->sa_data);
|
||||
rtl838x_set_mac_hw(dev, mac);
|
||||
|
||||
pr_info("Using MAC %08x%08x\n", sw_r32(priv->r->mac), sw_r32(priv->r->mac + 4));
|
||||
|
@ -2352,6 +2352,7 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
|
|||
struct resource *res, *mem;
|
||||
phy_interface_t phy_mode;
|
||||
struct phylink *phylink;
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
int err = 0, rxrings, rxringlen;
|
||||
struct ring_b *ring;
|
||||
|
||||
|
@ -2478,17 +2479,18 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
|
|||
* 1) from device tree data
|
||||
* 2) from internal registers set by bootloader
|
||||
*/
|
||||
of_get_mac_address(pdev->dev.of_node, dev->dev_addr);
|
||||
if (is_valid_ether_addr(dev->dev_addr)) {
|
||||
rtl838x_set_mac_hw(dev, (u8 *)dev->dev_addr);
|
||||
of_get_mac_address(pdev->dev.of_node, mac_addr);
|
||||
if (is_valid_ether_addr(mac_addr)) {
|
||||
rtl838x_set_mac_hw(dev, mac_addr);
|
||||
} else {
|
||||
dev->dev_addr[0] = (sw_r32(priv->r->mac) >> 8) & 0xff;
|
||||
dev->dev_addr[1] = sw_r32(priv->r->mac) & 0xff;
|
||||
dev->dev_addr[2] = (sw_r32(priv->r->mac + 4) >> 24) & 0xff;
|
||||
dev->dev_addr[3] = (sw_r32(priv->r->mac + 4) >> 16) & 0xff;
|
||||
dev->dev_addr[4] = (sw_r32(priv->r->mac + 4) >> 8) & 0xff;
|
||||
dev->dev_addr[5] = sw_r32(priv->r->mac + 4) & 0xff;
|
||||
mac_addr[0] = (sw_r32(priv->r->mac) >> 8) & 0xff;
|
||||
mac_addr[1] = sw_r32(priv->r->mac) & 0xff;
|
||||
mac_addr[2] = (sw_r32(priv->r->mac + 4) >> 24) & 0xff;
|
||||
mac_addr[3] = (sw_r32(priv->r->mac + 4) >> 16) & 0xff;
|
||||
mac_addr[4] = (sw_r32(priv->r->mac + 4) >> 8) & 0xff;
|
||||
mac_addr[5] = sw_r32(priv->r->mac + 4) & 0xff;
|
||||
}
|
||||
dev_addr_set(dev, mac_addr);
|
||||
/* if the address is invalid, use a random value */
|
||||
if (!is_valid_ether_addr(dev->dev_addr)) {
|
||||
struct sockaddr sa = { AF_UNSPEC };
|
||||
|
|
|
@ -42,7 +42,7 @@ CONFIG_AGP_INTEL=y
|
|||
# CONFIG_AGP_SIS is not set
|
||||
# CONFIG_AGP_VIA is not set
|
||||
CONFIG_AMD_IOMMU=y
|
||||
# CONFIG_AMD_IOMMU_V2 is not set
|
||||
CONFIG_AMD_IOMMU_V2=y
|
||||
# CONFIG_AMD_PMC is not set
|
||||
# CONFIG_AMD_PTDMA is not set
|
||||
# CONFIG_AMD_SFH_HID is not set
|
||||
|
|
Loading…
Reference in a new issue