Merge branch 'openwrt:master' into master
This commit is contained in:
commit
1210738dc3
97 changed files with 1322 additions and 438 deletions
|
@ -461,6 +461,7 @@ config KERNEL_BPF_EVENTS
|
||||||
config KERNEL_BPF_KPROBE_OVERRIDE
|
config KERNEL_BPF_KPROBE_OVERRIDE
|
||||||
bool
|
bool
|
||||||
depends on KERNEL_KPROBES
|
depends on KERNEL_KPROBES
|
||||||
|
default n
|
||||||
|
|
||||||
config KERNEL_AIO
|
config KERNEL_AIO
|
||||||
bool "Compile the kernel with asynchronous IO support"
|
bool "Compile the kernel with asynchronous IO support"
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
LINUX_VERSION-5.10 = .168
|
LINUX_VERSION-5.10 = .172
|
||||||
LINUX_KERNEL_HASH-5.10.168 = b67d2596ba8d30510f743f31899c94c43eaf006a254ff44d7fc6ea26e7ab359c
|
LINUX_KERNEL_HASH-5.10.172 = f20dbae344df1c33cad617f7670c5e061557f592f422c842d3b30155df2927b1
|
||||||
|
|
|
@ -16,6 +16,9 @@ ocedo,panda)
|
||||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
||||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000"
|
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000"
|
||||||
;;
|
;;
|
||||||
|
watchguard,firebox-t10)
|
||||||
|
ubootenv_add_uci_config "$(find_mtd_part 'u-boot-env')" "0x0" "0x2000" "0x10000"
|
||||||
|
;;
|
||||||
aerohive,hiveap-330)
|
aerohive,hiveap-330)
|
||||||
ubootenv_add_uci_config "$(find_mtd_part 'u-boot-env')" "0x0" "0x20000" "0x10000"
|
ubootenv_add_uci_config "$(find_mtd_part 'u-boot-env')" "0x0" "0x20000" "0x10000"
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -8,16 +8,16 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=binutils
|
PKG_NAME:=binutils
|
||||||
PKG_VERSION:=2.38
|
PKG_VERSION:=2.40
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE_URL:=@GNU/binutils
|
PKG_SOURCE_URL:=@GNU/binutils
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||||
PKG_VERSION:=$(PKG_VERSION)
|
PKG_VERSION:=$(PKG_VERSION)
|
||||||
PKG_HASH:=e316477a914f567eccc34d5d29785b8b0f5a10208d36bbacedcc39048ecfe024
|
PKG_HASH:=0f8a4c272d7f17f369ded10a4aca28b8e304828e95526da482b0ccc4dfc9d8e1
|
||||||
|
|
||||||
PKG_FIXUP:=patch-libtool
|
PKG_FIXUP:=patch-libtool
|
||||||
PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof binutils ld libiberty gold intl
|
PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof gprofng binutils ld libiberty gold intl libctf libsframe
|
||||||
PKG_REMOVE_FILES:=libtool.m4
|
PKG_REMOVE_FILES:=libtool.m4
|
||||||
PKG_INSTALL:=1
|
PKG_INSTALL:=1
|
||||||
|
|
||||||
|
@ -87,7 +87,10 @@ CONFIGURE_ARGS += \
|
||||||
--enable-shared \
|
--enable-shared \
|
||||||
--enable-install-libiberty \
|
--enable-install-libiberty \
|
||||||
--enable-install-libbfd \
|
--enable-install-libbfd \
|
||||||
--enable-install-libctf
|
--enable-install-libctf \
|
||||||
|
--with-system-zlib \
|
||||||
|
--without-zstd \
|
||||||
|
--disable-gprofng
|
||||||
|
|
||||||
define Build/Install
|
define Build/Install
|
||||||
$(call Build/Install/Default)
|
$(call Build/Install/Default)
|
||||||
|
@ -105,6 +108,7 @@ endef
|
||||||
define Package/libbfd/install
|
define Package/libbfd/install
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libbfd*.so* $(1)/usr/lib/
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libbfd*.so* $(1)/usr/lib/
|
||||||
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsframe*.so* $(1)/usr/lib/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libctf/install
|
define Package/libctf/install
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
Fix this compile error:
|
||||||
|
----------------------
|
||||||
|
./../common/cpuid.c:27:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__get_cpuid'
|
||||||
|
27 | __get_cpuid (unsigned int op ATTRIBUTE_UNUSED, unsigned int *eax,
|
||||||
|
| ^~~~~~~~~~~
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
and this error:
|
||||||
|
----------------------
|
||||||
|
unwind.c: In function '__collector_ext_return_address':
|
||||||
|
unwind.c:236:34: error: '__u64' undeclared (first use in this function)
|
||||||
|
236 | context->uc_mcontext.sp = (__u64) __builtin_frame_address(0); \
|
||||||
|
| ^~~~~
|
||||||
|
unwind.c:490:3: note: in expansion of macro 'FILL_CONTEXT'
|
||||||
|
490 | FILL_CONTEXT ((&context));
|
||||||
|
|
||||||
|
----------------------
|
||||||
|
--- a/gprofng/common/cpuid.c
|
||||||
|
+++ b/gprofng/common/cpuid.c
|
||||||
|
@@ -23,7 +23,7 @@
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
||||||
|
|
||||||
|
-static inline uint_t __attribute_const__
|
||||||
|
+static inline uint_t __attribute__((__const__))
|
||||||
|
__get_cpuid (unsigned int op ATTRIBUTE_UNUSED, unsigned int *eax,
|
||||||
|
unsigned int *ebx ATTRIBUTE_UNUSED,
|
||||||
|
unsigned int *ecx ATTRIBUTE_UNUSED, unsigned int *edx ATTRIBUTE_UNUSED)
|
||||||
|
--- a/gprofng/libcollector/unwind.c
|
||||||
|
+++ b/gprofng/libcollector/unwind.c
|
||||||
|
@@ -233,7 +233,7 @@ memory_error_func (int status ATTRIBUTE_
|
||||||
|
#elif ARCH(Aarch64)
|
||||||
|
#define FILL_CONTEXT(context) \
|
||||||
|
{ CALL_UTIL (getcontext) (context); \
|
||||||
|
- context->uc_mcontext.sp = (__u64) __builtin_frame_address(0); \
|
||||||
|
+ context->uc_mcontext.sp = (uint64_t) __builtin_frame_address(0); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ARCH() */
|
||||||
|
@@ -4579,11 +4579,11 @@ stack_unwind (char *buf, int size, void
|
||||||
|
if (buf && bptr && eptr && context && size + mode > 0)
|
||||||
|
getByteInstruction ((unsigned char *) eptr);
|
||||||
|
int ind = 0;
|
||||||
|
- __u64 *lbuf = (void *) buf;
|
||||||
|
- int lsize = size / sizeof (__u64);
|
||||||
|
- __u64 pc = context->uc_mcontext.pc;
|
||||||
|
- __u64 sp = context->uc_mcontext.sp;
|
||||||
|
- __u64 stack_base;
|
||||||
|
+ uint64_t *lbuf = (void *) buf;
|
||||||
|
+ int lsize = size / sizeof (uint64_t);
|
||||||
|
+ uint64_t pc = context->uc_mcontext.pc;
|
||||||
|
+ uint64_t sp = context->uc_mcontext.sp;
|
||||||
|
+ uint64_t stack_base;
|
||||||
|
unsigned long tbgn = 0;
|
||||||
|
unsigned long tend = 0;
|
||||||
|
|
||||||
|
@@ -4594,7 +4594,7 @@ stack_unwind (char *buf, int size, void
|
||||||
|
{
|
||||||
|
stack_base = sp + 0x100000;
|
||||||
|
if (stack_base < sp) // overflow
|
||||||
|
- stack_base = (__u64) -1;
|
||||||
|
+ stack_base = (uint64_t) -1;
|
||||||
|
}
|
||||||
|
DprintfT (SP_DUMP_UNWIND,
|
||||||
|
"unwind.c:%d stack_unwind %2d pc=0x%llx sp=0x%llx stack_base=0x%llx\n",
|
||||||
|
@@ -4625,17 +4625,17 @@ stack_unwind (char *buf, int size, void
|
||||||
|
__LINE__, (unsigned long) sp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
- pc = ((__u64 *) sp)[1];
|
||||||
|
- __u64 old_sp = sp;
|
||||||
|
- sp = ((__u64 *) sp)[0];
|
||||||
|
+ pc = ((uint64_t *) sp)[1];
|
||||||
|
+ uint64_t old_sp = sp;
|
||||||
|
+ sp = ((uint64_t *) sp)[0];
|
||||||
|
if (sp < old_sp)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ind >= lsize)
|
||||||
|
{
|
||||||
|
ind = lsize - 1;
|
||||||
|
- lbuf[ind++] = (__u64) SP_TRUNC_STACK_MARKER;
|
||||||
|
+ lbuf[ind++] = (uint64_t) SP_TRUNC_STACK_MARKER;
|
||||||
|
}
|
||||||
|
- return ind * sizeof (__u64);
|
||||||
|
+ return ind * sizeof (uint64_t);
|
||||||
|
}
|
||||||
|
#endif /* ARCH() */
|
|
@ -1,12 +1,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=ksmbd
|
PKG_NAME:=ksmbd
|
||||||
PKG_VERSION:=3.4.6
|
PKG_VERSION:=3.4.7
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://codeload.github.com/cifsd-team/cifsd/tar.gz/$(PKG_VERSION)?
|
PKG_SOURCE_URL:=https://github.com/cifsd-team/ksmbd/releases/download/$(PKG_VERSION)
|
||||||
PKG_HASH:=d742992692dbe164060d2a0ea668895ed2b86252f10427db3d3a002df44c445b
|
PKG_HASH:=ed9ecb2232046054bf0c1fef41690890f99d93b1d72b7e7d158746ac9be18c7f
|
||||||
|
|
||||||
PKG_LICENSE:=GPL-2.0-or-later
|
PKG_LICENSE:=GPL-2.0-or-later
|
||||||
PKG_LICENSE_FILES:=COPYING
|
PKG_LICENSE_FILES:=COPYING
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
From 8824b7af409f51f1316e92e9887c2fd48c0b26d6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: William Liu <will@willsroot.io>
|
|
||||||
Date: Fri, 30 Dec 2022 09:13:35 +0900
|
|
||||||
Subject: ksmbd: check nt_len to be at least CIFS_ENCPWD_SIZE in
|
|
||||||
ksmbd_decode_ntlmssp_auth_blob
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
"nt_len - CIFS_ENCPWD_SIZE" is passed directly from
|
|
||||||
ksmbd_decode_ntlmssp_auth_blob to ksmbd_auth_ntlmv2. Malicious requests
|
|
||||||
can set nt_len to less than CIFS_ENCPWD_SIZE, which results in a negative
|
|
||||||
number (or large unsigned value) used for a subsequent memcpy in
|
|
||||||
ksmbd_auth_ntlvm2 and can cause a panic.
|
|
||||||
|
|
||||||
Fixes: e2f3448 ("cifsd: add server-side procedures for SMB3")
|
|
||||||
Cc: stable@vger.kernel.org
|
|
||||||
Signed-off-by: William Liu <will@willsroot.io>
|
|
||||||
Signed-off-by: Hrvoje Mišetić <misetichrvoje@gmail.com>
|
|
||||||
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
|
|
||||||
---
|
|
||||||
auth.c | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
--- a/auth.c
|
|
||||||
+++ b/auth.c
|
|
||||||
@@ -583,7 +583,8 @@ int ksmbd_decode_ntlmssp_auth_blob(struc
|
|
||||||
dn_off = le32_to_cpu(authblob->DomainName.BufferOffset);
|
|
||||||
dn_len = le16_to_cpu(authblob->DomainName.Length);
|
|
||||||
|
|
||||||
- if (blob_len < (u64)dn_off + dn_len || blob_len < (u64)nt_off + nt_len)
|
|
||||||
+ if (blob_len < (u64)dn_off + dn_len || blob_len < (u64)nt_off + nt_len ||
|
|
||||||
+ nt_len < CIFS_ENCPWD_SIZE)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
#ifdef CONFIG_SMB_INSECURE_SERVER
|
|
|
@ -1,63 +0,0 @@
|
||||||
From cc4f3b5a6ab4693aba94a45cc073188df4d67175 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Namjae Jeon <linkinjeon@kernel.org>
|
|
||||||
Date: Mon, 26 Dec 2022 01:28:52 +0900
|
|
||||||
Subject: ksmbd: fix infinite loop in ksmbd_conn_handler_loop()
|
|
||||||
|
|
||||||
If kernel_recvmsg() return -EAGAIN in ksmbd_tcp_readv() and go round
|
|
||||||
again, It will cause infinite loop issue. And all threads from next
|
|
||||||
connections would be doing that. This patch add max retry count(2) to
|
|
||||||
avoid it. kernel_recvmsg() will wait during 7sec timeout and try to
|
|
||||||
retry two time if -EAGAIN is returned. And add flags of kvmalloc to
|
|
||||||
__GFP_NOWARN and __GFP_NORETRY to disconnect immediately without
|
|
||||||
retrying on memory alloation failure.
|
|
||||||
|
|
||||||
Fixes: 0626e66 ("cifsd: add server handler for central processing and tranport layers")
|
|
||||||
Cc: stable@vger.kernel.org
|
|
||||||
Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-18259
|
|
||||||
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
|
|
||||||
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
|
|
||||||
---
|
|
||||||
connection.c | 7 +++++--
|
|
||||||
transport_tcp.c | 5 ++++-
|
|
||||||
2 files changed, 9 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
--- a/connection.c
|
|
||||||
+++ b/connection.c
|
|
||||||
@@ -337,9 +337,12 @@ int ksmbd_conn_handler_loop(void *p)
|
|
||||||
|
|
||||||
/* 4 for rfc1002 length field */
|
|
||||||
size = pdu_size + 4;
|
|
||||||
- conn->request_buf = kvmalloc(size, GFP_KERNEL);
|
|
||||||
+ conn->request_buf = kvmalloc(size,
|
|
||||||
+ GFP_KERNEL |
|
|
||||||
+ __GFP_NOWARN |
|
|
||||||
+ __GFP_NORETRY);
|
|
||||||
if (!conn->request_buf)
|
|
||||||
- continue;
|
|
||||||
+ break;
|
|
||||||
|
|
||||||
memcpy(conn->request_buf, hdr_buf, sizeof(hdr_buf));
|
|
||||||
if (!ksmbd_smb_request(conn))
|
|
||||||
--- a/transport_tcp.c
|
|
||||||
+++ b/transport_tcp.c
|
|
||||||
@@ -323,6 +323,7 @@ static int ksmbd_tcp_readv(struct tcp_tr
|
|
||||||
struct msghdr ksmbd_msg;
|
|
||||||
struct kvec *iov;
|
|
||||||
struct ksmbd_conn *conn = KSMBD_TRANS(t)->conn;
|
|
||||||
+ int max_retry = 2;
|
|
||||||
|
|
||||||
iov = get_conn_iovec(t, nr_segs);
|
|
||||||
if (!iov)
|
|
||||||
@@ -349,9 +350,11 @@ static int ksmbd_tcp_readv(struct tcp_tr
|
|
||||||
} else if (conn->status == KSMBD_SESS_NEED_RECONNECT) {
|
|
||||||
total_read = -EAGAIN;
|
|
||||||
break;
|
|
||||||
- } else if (length == -ERESTARTSYS || length == -EAGAIN) {
|
|
||||||
+ } else if ((length == -ERESTARTSYS || length == -EAGAIN) &&
|
|
||||||
+ max_retry) {
|
|
||||||
usleep_range(1000, 2000);
|
|
||||||
length = 0;
|
|
||||||
+ max_retry--;
|
|
||||||
continue;
|
|
||||||
} else if (length <= 0) {
|
|
||||||
total_read = -EAGAIN;
|
|
|
@ -354,6 +354,21 @@ endef
|
||||||
$(eval $(call KernelPackage,hwmon-ltc4151))
|
$(eval $(call KernelPackage,hwmon-ltc4151))
|
||||||
|
|
||||||
|
|
||||||
|
define KernelPackage/hwmon-max6642
|
||||||
|
TITLE:=MAX6642 monitoring support
|
||||||
|
KCONFIG:=CONFIG_SENSORS_MAX6642
|
||||||
|
FILES:=$(LINUX_DIR)/drivers/hwmon/max6642.ko
|
||||||
|
AUTOLOAD:=$(call AutoLoad,60,max6642 max6642)
|
||||||
|
$(call AddDepends/hwmon,+kmod-i2c-core)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define KernelPackage/hwmon-max6642/description
|
||||||
|
Kernel module for Maxim MAX6642 temperature monitor
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call KernelPackage,hwmon-max6642))
|
||||||
|
|
||||||
|
|
||||||
define KernelPackage/hwmon-mcp3021
|
define KernelPackage/hwmon-mcp3021
|
||||||
TITLE:=MCP3021/3221 monitoring support
|
TITLE:=MCP3021/3221 monitoring support
|
||||||
KCONFIG:=CONFIG_SENSORS_MCP3021
|
KCONFIG:=CONFIG_SENSORS_MCP3021
|
||||||
|
|
|
@ -225,7 +225,7 @@ define KernelPackage/ath9k/config
|
||||||
bool "Add wireless noise as source of randomness to kernel entropy pool"
|
bool "Add wireless noise as source of randomness to kernel entropy pool"
|
||||||
depends on PACKAGE_kmod-ath9k
|
depends on PACKAGE_kmod-ath9k
|
||||||
select PACKAGE_kmod-random-core
|
select PACKAGE_kmod-random-core
|
||||||
default n
|
default y
|
||||||
|
|
||||||
config ATH9K_SUPPORT_PCOEM
|
config ATH9K_SUPPORT_PCOEM
|
||||||
bool "Support chips used in PC OEM cards"
|
bool "Support chips used in PC OEM cards"
|
||||||
|
@ -377,7 +377,7 @@ endef
|
||||||
define KernelPackage/ar5523
|
define KernelPackage/ar5523
|
||||||
$(call KernelPackage/mac80211/Default)
|
$(call KernelPackage/mac80211/Default)
|
||||||
TITLE:=Driver for Atheros AR5523 USB sticks
|
TITLE:=Driver for Atheros AR5523 USB sticks
|
||||||
DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core
|
DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core
|
||||||
FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ar5523/ar5523.ko
|
FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ar5523/ar5523.ko
|
||||||
AUTOLOAD:=$(call AutoProbe,ar5523)
|
AUTOLOAD:=$(call AutoProbe,ar5523)
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=openssl
|
PKG_NAME:=openssl
|
||||||
PKG_VERSION:=3.0.8
|
PKG_VERSION:=3.0.8
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=4
|
||||||
PKG_USE_MIPS16:=0
|
PKG_USE_MIPS16:=0
|
||||||
|
|
||||||
PKG_BUILD_PARALLEL:=1
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
@ -128,8 +128,8 @@ endef
|
||||||
|
|
||||||
define Package/libopenssl-conf/conffiles
|
define Package/libopenssl-conf/conffiles
|
||||||
/etc/ssl/openssl.cnf
|
/etc/ssl/openssl.cnf
|
||||||
$(if CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO,/etc/ssl/engines.cnf.d/devcrypto.cnf)
|
$(if $(CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO),/etc/ssl/engines.cnf.d/devcrypto.cnf)
|
||||||
$(if CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK,/etc/ssl/engines.cnf.d/padlock.cnf)
|
$(if $(CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK),/etc/ssl/engines.cnf.d/padlock.cnf)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libopenssl-conf/description
|
define Package/libopenssl-conf/description
|
||||||
|
|
|
@ -17,8 +17,9 @@ default_algorithms = ALL
|
||||||
# It is recommended to disable the ECB ciphers; in most cases, it will
|
# It is recommended to disable the ECB ciphers; in most cases, it will
|
||||||
# only be used for PRNG, in small blocks, where performance is poor,
|
# only be used for PRNG, in small blocks, where performance is poor,
|
||||||
# and there may be problems with apps forking with open crypto
|
# and there may be problems with apps forking with open crypto
|
||||||
# contexts, leading to failures. The CBC ciphers work well:
|
# contexts, leading to failures. The CBC ciphers work well.
|
||||||
#CIPHERS=DES-CBC, DES-EDE3-CBC, AES-128-CBC, AES-192-CBC, AES-256-CBC
|
CIPHERS=DES-CBC, DES-EDE3-CBC, AES-128-CBC, AES-192-CBC, AES-256-CBC, \
|
||||||
|
AES-128-CTR, AES-192-CTR, AES-256-CTR
|
||||||
|
|
||||||
# DIGESTS: either ALL, NONE, or a comma-separated list of digests to
|
# DIGESTS: either ALL, NONE, or a comma-separated list of digests to
|
||||||
# enable [default=NONE]
|
# enable [default=NONE]
|
||||||
|
@ -26,6 +27,8 @@ default_algorithms = ALL
|
||||||
# is poor, and there are many cases in which they will not work,
|
# is poor, and there are many cases in which they will not work,
|
||||||
# especially when calling fork with open crypto contexts. Openssh,
|
# especially when calling fork with open crypto contexts. Openssh,
|
||||||
# for example, does this, and you may not be able to login.
|
# for example, does this, and you may not be able to login.
|
||||||
#DIGESTS = NONE
|
# Sysupgrade will fail as well. If you're adventurous enough to change
|
||||||
|
# this, you should change it back to NONE, and reboot before running
|
||||||
|
# sysupgrade!
|
||||||
|
DIGESTS = NONE
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eneas U de Queiroz <cote2004-github@yahoo.com>
|
||||||
|
Date: Mon, 11 Mar 2019 09:29:13 -0300
|
||||||
|
Subject: e_devcrypto: default to not use digests in engine
|
||||||
|
|
||||||
|
Digests are almost always slower when using /dev/crypto because of the
|
||||||
|
cost of the context switches. Only for large blocks it is worth it.
|
||||||
|
|
||||||
|
Also, when forking, the open context structures are duplicated, but the
|
||||||
|
internal kernel sessions are still shared between forks, which means an
|
||||||
|
update/close operation in one fork affects all processes using that
|
||||||
|
session.
|
||||||
|
|
||||||
|
This affects digests, especially for HMAC, where the session with the
|
||||||
|
key hash is used as a source for subsequent operations. At least one
|
||||||
|
popular application does this across a fork. Disabling digests by
|
||||||
|
default will mitigate the problem, while still allowing the user to
|
||||||
|
turn them on if it is safe and fast enough.
|
||||||
|
|
||||||
|
Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
|
||||||
|
|
||||||
|
--- a/engines/e_devcrypto.c
|
||||||
|
+++ b/engines/e_devcrypto.c
|
||||||
|
@@ -905,7 +905,7 @@ static void prepare_digest_methods(void)
|
||||||
|
for (i = 0, known_digest_nids_amount = 0; i < OSSL_NELEM(digest_data);
|
||||||
|
i++) {
|
||||||
|
|
||||||
|
- selected_digests[i] = 1;
|
||||||
|
+ selected_digests[i] = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check that the digest is usable
|
||||||
|
@@ -1119,7 +1119,7 @@ static const ENGINE_CMD_DEFN devcrypto_c
|
||||||
|
#ifdef IMPLEMENT_DIGEST
|
||||||
|
{DEVCRYPTO_CMD_DIGESTS,
|
||||||
|
"DIGESTS",
|
||||||
|
- "either ALL, NONE, or a comma-separated list of digests to enable [default=ALL]",
|
||||||
|
+ "either ALL, NONE, or a comma-separated list of digests to enable [default=NONE]",
|
||||||
|
ENGINE_CMD_FLAG_STRING},
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eneas U de Queiroz <cote2004-github@yahoo.com>
|
||||||
|
Date: Mon, 11 Mar 2019 10:15:14 -0300
|
||||||
|
Subject: e_devcrypto: ignore error when closing session
|
||||||
|
|
||||||
|
In cipher_init, ignore an eventual error when closing the previous
|
||||||
|
session. It may have been closed by another process after a fork.
|
||||||
|
|
||||||
|
Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
|
||||||
|
|
||||||
|
--- a/engines/e_devcrypto.c
|
||||||
|
+++ b/engines/e_devcrypto.c
|
||||||
|
@@ -211,9 +211,8 @@ static int cipher_init(EVP_CIPHER_CTX *c
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* cleanup a previous session */
|
||||||
|
- if (cipher_ctx->sess.ses != 0 &&
|
||||||
|
- clean_devcrypto_session(&cipher_ctx->sess) == 0)
|
||||||
|
- return 0;
|
||||||
|
+ if (cipher_ctx->sess.ses != 0)
|
||||||
|
+ clean_devcrypto_session(&cipher_ctx->sess);
|
||||||
|
|
||||||
|
cipher_ctx->sess.cipher = cipher_d->devcryptoid;
|
||||||
|
cipher_ctx->sess.keylen = cipher_d->keylen;
|
|
@ -142,7 +142,7 @@ CONFIG_PKCS12=y
|
||||||
|
|
||||||
# RADIUS authentication server. This provides access to the integrated EAP
|
# RADIUS authentication server. This provides access to the integrated EAP
|
||||||
# server from external hosts using RADIUS.
|
# server from external hosts using RADIUS.
|
||||||
#CONFIG_RADIUS_SERVER=y
|
CONFIG_RADIUS_SERVER=y
|
||||||
|
|
||||||
# Build IPv6 support for RADIUS operations
|
# Build IPv6 support for RADIUS operations
|
||||||
CONFIG_IPV6=y
|
CONFIG_IPV6=y
|
||||||
|
|
|
@ -265,11 +265,11 @@ hostapd_common_add_bss_config() {
|
||||||
config_add_int ieee80211w
|
config_add_int ieee80211w
|
||||||
config_add_int eapol_version
|
config_add_int eapol_version
|
||||||
|
|
||||||
config_add_string 'auth_server:host' 'server:host'
|
config_add_array auth_server acct_server
|
||||||
|
config_add_string 'server:host'
|
||||||
config_add_string auth_secret key
|
config_add_string auth_secret key
|
||||||
config_add_int 'auth_port:port' 'port:port'
|
config_add_int 'auth_port:port' 'port:port'
|
||||||
|
|
||||||
config_add_string acct_server
|
|
||||||
config_add_string acct_secret
|
config_add_string acct_secret
|
||||||
config_add_int acct_port
|
config_add_int acct_port
|
||||||
config_add_int acct_interval
|
config_add_int acct_interval
|
||||||
|
@ -524,6 +524,20 @@ append_airtime_sta_weight() {
|
||||||
[ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N"
|
[ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
append_auth_server() {
|
||||||
|
[ -n "$1" ] || return
|
||||||
|
append bss_conf "auth_server_addr=$1" "$N"
|
||||||
|
append bss_conf "auth_server_port=$auth_port" "$N"
|
||||||
|
[ -n "$auth_secret" ] && append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
|
||||||
|
}
|
||||||
|
|
||||||
|
append_acct_server() {
|
||||||
|
[ -n "$1" ] || return
|
||||||
|
append bss_conf "acct_server_addr=$1" "$N"
|
||||||
|
append bss_conf "acct_server_port=$acct_port" "$N"
|
||||||
|
[ -n "$acct_secret" ] && append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
|
||||||
|
}
|
||||||
|
|
||||||
hostapd_set_bss_options() {
|
hostapd_set_bss_options() {
|
||||||
local var="$1"
|
local var="$1"
|
||||||
local phy="$2"
|
local phy="$2"
|
||||||
|
@ -542,7 +556,7 @@ hostapd_set_bss_options() {
|
||||||
wps_independent wps_device_type wps_device_name wps_manufacturer wps_pin \
|
wps_independent wps_device_type wps_device_name wps_manufacturer wps_pin \
|
||||||
macfilter ssid utf8_ssid wmm uapsd hidden short_preamble rsn_preauth \
|
macfilter ssid utf8_ssid wmm uapsd hidden short_preamble rsn_preauth \
|
||||||
iapp_interface eapol_version dynamic_vlan ieee80211w nasid \
|
iapp_interface eapol_version dynamic_vlan ieee80211w nasid \
|
||||||
acct_server acct_secret acct_port acct_interval \
|
acct_secret acct_port acct_interval \
|
||||||
bss_load_update_period chan_util_avg_period sae_require_mfp sae_pwe \
|
bss_load_update_period chan_util_avg_period sae_require_mfp sae_pwe \
|
||||||
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \
|
multi_ap multi_ap_backhaul_ssid multi_ap_backhaul_key skip_inactivity_poll \
|
||||||
ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \
|
ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \
|
||||||
|
@ -614,15 +628,10 @@ hostapd_set_bss_options() {
|
||||||
set_default nasid "${macaddr//\:}"
|
set_default nasid "${macaddr//\:}"
|
||||||
append bss_conf "nas_identifier=$nasid" "$N"
|
append bss_conf "nas_identifier=$nasid" "$N"
|
||||||
|
|
||||||
[ -n "$acct_server" ] && {
|
[ -n "$acct_interval" ] && \
|
||||||
append bss_conf "acct_server_addr=$acct_server" "$N"
|
append bss_conf "radius_acct_interim_interval=$acct_interval" "$N"
|
||||||
append bss_conf "acct_server_port=$acct_port" "$N"
|
json_for_each_item append_acct_server acct_server
|
||||||
[ -n "$acct_secret" ] && \
|
json_for_each_item append_radius_acct_req_attr radius_acct_req_attr
|
||||||
append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
|
|
||||||
[ -n "$acct_interval" ] && \
|
|
||||||
append bss_conf "radius_acct_interim_interval=$acct_interval" "$N"
|
|
||||||
json_for_each_item append_radius_acct_req_attr radius_acct_req_attr
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -n "$ocv" ] && append bss_conf "ocv=$ocv" "$N"
|
[ -n "$ocv" ] && append bss_conf "ocv=$ocv" "$N"
|
||||||
|
|
||||||
|
@ -659,11 +668,9 @@ hostapd_set_bss_options() {
|
||||||
psk|sae|psk-sae)
|
psk|sae|psk-sae)
|
||||||
json_get_vars key wpa_psk_file
|
json_get_vars key wpa_psk_file
|
||||||
if [ "$auth_type" = "psk" ] && [ "$ppsk" -ne 0 ] ; then
|
if [ "$auth_type" = "psk" ] && [ "$ppsk" -ne 0 ] ; then
|
||||||
json_get_vars auth_server auth_secret auth_port
|
json_get_vars auth_secret auth_port
|
||||||
set_default auth_port 1812
|
set_default auth_port 1812
|
||||||
append bss_conf "auth_server_addr=$auth_server" "$N"
|
json_for_each_item append_auth_server auth_server
|
||||||
append bss_conf "auth_server_port=$auth_port" "$N"
|
|
||||||
append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
|
|
||||||
append bss_conf "macaddr_acl=2" "$N"
|
append bss_conf "macaddr_acl=2" "$N"
|
||||||
append bss_conf "wpa_psk_radius=2" "$N"
|
append bss_conf "wpa_psk_radius=2" "$N"
|
||||||
elif [ ${#key} -eq 64 ]; then
|
elif [ ${#key} -eq 64 ]; then
|
||||||
|
@ -732,12 +739,7 @@ hostapd_set_bss_options() {
|
||||||
set_default dae_port 3799
|
set_default dae_port 3799
|
||||||
set_default request_cui 0
|
set_default request_cui 0
|
||||||
|
|
||||||
[ "$eap_server" -eq 0 ] && {
|
[ "$eap_server" -eq 0 ] && json_for_each_item append_auth_server auth_server
|
||||||
append bss_conf "auth_server_addr=$auth_server" "$N"
|
|
||||||
append bss_conf "auth_server_port=$auth_port" "$N"
|
|
||||||
append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
|
|
||||||
}
|
|
||||||
|
|
||||||
[ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N"
|
[ "$request_cui" -gt 0 ] && append bss_conf "radius_request_cui=$request_cui" "$N"
|
||||||
[ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
|
[ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
|
||||||
|
|
||||||
|
@ -777,9 +779,7 @@ hostapd_set_bss_options() {
|
||||||
[ -n "$auth_server" ] && {
|
[ -n "$auth_server" ] && {
|
||||||
set_default auth_port 1812
|
set_default auth_port 1812
|
||||||
|
|
||||||
append bss_conf "auth_server_addr=$auth_server" "$N"
|
json_for_each_item append_auth_server auth_server
|
||||||
append bss_conf "auth_server_port=$auth_port" "$N"
|
|
||||||
[ -n "$auth_secret" ] && append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
|
|
||||||
[ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N"
|
[ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N"
|
||||||
[ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N"
|
[ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N"
|
||||||
append bss_conf "macaddr_acl=2" "$N"
|
append bss_conf "macaddr_acl=2" "$N"
|
||||||
|
|
|
@ -1084,6 +1084,8 @@ hostapd_bss_mgmt_enable(struct ubus_context *ctx, struct ubus_object *obj,
|
||||||
}
|
}
|
||||||
|
|
||||||
__hostapd_bss_mgmt_enable(hapd, flags);
|
__hostapd_bss_mgmt_enable(hapd, flags);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE_URL:=https://github.com/libbpf/bpftool
|
PKG_SOURCE_URL:=https://github.com/libbpf/bpftool
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_DATE:=2022-03-08
|
PKG_SOURCE_DATE:=7.1.0
|
||||||
PKG_SOURCE_VERSION:=04c465fd1f561f67796dc68bbfe1aa7cfa956c3c
|
PKG_SOURCE_VERSION:=b01941c8f7890489f09713348a7d89567538504b
|
||||||
PKG_MIRROR_HASH:=e22a954cd186f43228a96586bbdc120b11e6c87360ab88ae96ba37afb9c7cb58
|
PKG_MIRROR_HASH:=641fb337342e25ae784a3efe72c71d8c88600a326300d8d5834e26be21547015
|
||||||
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
|
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
|
||||||
|
|
||||||
PKG_MAINTAINER:=Tony Ambardar <itugrok@yahoo.com>
|
PKG_MAINTAINER:=Tony Ambardar <itugrok@yahoo.com>
|
||||||
|
@ -82,7 +82,7 @@ endef
|
||||||
# LTO not compatible with DSO using PIC
|
# LTO not compatible with DSO using PIC
|
||||||
ifneq ($(BUILD_VARIANT),lib)
|
ifneq ($(BUILD_VARIANT),lib)
|
||||||
TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
|
TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
|
||||||
TARGET_LDFLAGS += -Wl,--gc-sections
|
TARGET_LDFLAGS += -Wl,--gc-sections -flto
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(BUILD_VARIANT),full)
|
ifeq ($(BUILD_VARIANT),full)
|
||||||
|
@ -102,11 +102,11 @@ MAKE_FLAGS += \
|
||||||
LIBSUBDIR=lib \
|
LIBSUBDIR=lib \
|
||||||
check_feat=0 \
|
check_feat=0 \
|
||||||
feature-clang-bpf-co-re=0 \
|
feature-clang-bpf-co-re=0 \
|
||||||
feature-reallocarray=1 \
|
|
||||||
feature-zlib=1 \
|
|
||||||
feature-libbfd=$(full) \
|
feature-libbfd=$(full) \
|
||||||
|
feature-llvm=0 \
|
||||||
feature-libcap=0 \
|
feature-libcap=0 \
|
||||||
feature-disassembler-four-args=$(full)
|
feature-disassembler-four-args=1 \
|
||||||
|
feature-disassembler-init-styled=1
|
||||||
|
|
||||||
ifeq ($(BUILD_VARIANT),lib)
|
ifeq ($(BUILD_VARIANT),lib)
|
||||||
MAKE_PATH = libbpf/src
|
MAKE_PATH = libbpf/src
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
--- a/libbpf/src/Makefile
|
--- a/libbpf/src/Makefile
|
||||||
+++ b/libbpf/src/Makefile
|
+++ b/libbpf/src/Makefile
|
||||||
@@ -25,6 +25,7 @@ ALL_CFLAGS := $(INCLUDES)
|
@@ -34,6 +34,7 @@ ALL_CFLAGS := $(INCLUDES)
|
||||||
|
|
||||||
SHARED_CFLAGS += -fPIC -fvisibility=hidden -DSHARED
|
SHARED_CFLAGS += -fPIC -fvisibility=hidden -DSHARED
|
||||||
|
|
||||||
+CFLAGS = $(EXTRA_CFLAGS)
|
+CFLAGS = $(EXTRA_CFLAGS)
|
||||||
CFLAGS ?= -g -O2 -Werror -Wall -std=gnu89
|
CFLAGS ?= -g -O2 -Werror -Wall -std=gnu89
|
||||||
ALL_CFLAGS += $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
ALL_CFLAGS += $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $(EXTRA_CFLAGS)
|
||||||
ALL_LDFLAGS += $(LDFLAGS)
|
ALL_LDFLAGS += $(LDFLAGS) $(EXTRA_LDFLAGS)
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
@@ -73,10 +73,10 @@ CFLAGS += -W -Wall -Wextra -Wno-unused-p
|
@@ -73,10 +73,10 @@ CFLAGS += -W -Wall -Wextra -Wno-unused-p
|
||||||
CFLAGS += $(filter-out -Wswitch-enum -Wnested-externs,$(EXTRA_WARNINGS))
|
CFLAGS += $(filter-out -Wswitch-enum -Wnested-externs,$(EXTRA_WARNINGS))
|
||||||
CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \
|
CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \
|
||||||
-I$(if $(OUTPUT),$(OUTPUT),.) \
|
-I$(or $(OUTPUT),.) \
|
||||||
- -I$(LIBBPF_INCLUDE) \
|
- -I$(LIBBPF_INCLUDE) \
|
||||||
-I$(srctree)/src/kernel/bpf/ \
|
-I$(srctree)/src/kernel/bpf/ \
|
||||||
-I$(srctree)/include \
|
-I$(srctree)/include \
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=uci
|
PKG_NAME:=uci
|
||||||
PKG_RELEASE:=6
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uci.git
|
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uci.git
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_DATE=2021-10-22
|
PKG_SOURCE_DATE=2023-03-05
|
||||||
PKG_SOURCE_VERSION:=f84f49f00fb70364f58b4cce72f1796a7190d370
|
PKG_SOURCE_VERSION:=04d0c46cfe30f557da0c603516636830cab4a08a
|
||||||
PKG_MIRROR_HASH:=9f4747a029976b43fcea9919643ce71e587e515edc21b280163f7262360d847f
|
PKG_MIRROR_HASH:=5402091db0645d19a60c3ec51850062138af8fb9eda6764091819637d84f1036
|
||||||
|
|
||||||
PKG_LICENSE:=LGPL-2.1
|
PKG_LICENSE:=LGPL-2.1
|
||||||
PKG_LICENSE_FILES:=
|
PKG_LICENSE_FILES:=
|
||||||
|
|
4
rules.mk
4
rules.mk
|
@ -283,8 +283,8 @@ export HOSTCC_NOCACHE
|
||||||
export HOSTCXX_NOCACHE
|
export HOSTCXX_NOCACHE
|
||||||
|
|
||||||
ifneq ($(CONFIG_CCACHE),)
|
ifneq ($(CONFIG_CCACHE),)
|
||||||
TARGET_CC:= ccache_cc
|
TARGET_CC:= ccache $(TARGET_CC)
|
||||||
TARGET_CXX:= ccache_cxx
|
TARGET_CXX:= ccache $(TARGET_CXX)
|
||||||
HOSTCC:= ccache $(HOSTCC)
|
HOSTCC:= ccache $(HOSTCC)
|
||||||
HOSTCXX:= ccache $(HOSTCXX)
|
HOSTCXX:= ccache $(HOSTCXX)
|
||||||
export CCACHE_BASEDIR:=$(TOPDIR)
|
export CCACHE_BASEDIR:=$(TOPDIR)
|
||||||
|
|
|
@ -10,8 +10,7 @@ BOARDNAME:=Microchip (Atmel AT91)
|
||||||
FEATURES:=ext4 squashfs targz usbgadget ubifs
|
FEATURES:=ext4 squashfs targz usbgadget ubifs
|
||||||
SUBTARGETS:=sama7 sama5 sam9x
|
SUBTARGETS:=sama7 sama5 sam9x
|
||||||
|
|
||||||
KERNEL_PATCHVER:=5.10
|
KERNEL_PATCHVER:=5.15
|
||||||
KERNEL_TESTING_PATCHVER:=5.15
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/target.mk
|
include $(INCLUDE_DIR)/target.mk
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ SVN-Revision: 35130
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/ipv6.h>
|
#include <linux/ipv6.h>
|
||||||
#include <linux/icmpv6.h>
|
#include <linux/icmpv6.h>
|
||||||
@@ -926,10 +927,10 @@ static void tcp_v6_send_response(const s
|
@@ -927,10 +928,10 @@ static void tcp_v6_send_response(const s
|
||||||
topt = (__be32 *)(t1 + 1);
|
topt = (__be32 *)(t1 + 1);
|
||||||
|
|
||||||
if (tsecr) {
|
if (tsecr) {
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
From d61615c366a489646a1bfe5b33455f916762d5f4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
|
||||||
Date: Wed, 8 Feb 2023 10:16:37 +0100
|
|
||||||
Subject: [PATCH] net: bgmac: fix BCM5358 support by setting correct flags
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Code blocks handling BCMA_CHIP_ID_BCM5357 and BCMA_CHIP_ID_BCM53572 were
|
|
||||||
incorrectly unified. Chip package values are not unique and cannot be
|
|
||||||
checked independently. They are meaningful only in a context of a given
|
|
||||||
chip.
|
|
||||||
|
|
||||||
Packages BCM5358 and BCM47188 share the same value but then belong to
|
|
||||||
different chips. Code unification resulted in treating BCM5358 as
|
|
||||||
BCM47188 and broke its initialization.
|
|
||||||
|
|
||||||
Link: https://github.com/openwrt/openwrt/issues/8278
|
|
||||||
Fixes: cb1b0f90acfe ("net: ethernet: bgmac: unify code of the same family")
|
|
||||||
Cc: Jon Mason <jdmason@kudzu.us>
|
|
||||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|
||||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
|
||||||
Link: https://lore.kernel.org/r/20230208091637.16291-1-zajec5@gmail.com
|
|
||||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
||||||
---
|
|
||||||
drivers/net/ethernet/broadcom/bgmac-bcma.c | 6 +++---
|
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
|
|
||||||
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
|
|
||||||
@@ -240,12 +240,12 @@ static int bgmac_probe(struct bcma_devic
|
|
||||||
bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
|
|
||||||
bgmac->feature_flags |= BGMAC_FEAT_FLW_CTRL1;
|
|
||||||
bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_PHY;
|
|
||||||
- if (ci->pkg == BCMA_PKG_ID_BCM47188 ||
|
|
||||||
- ci->pkg == BCMA_PKG_ID_BCM47186) {
|
|
||||||
+ if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM47186) ||
|
|
||||||
+ (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188)) {
|
|
||||||
bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_RGMII;
|
|
||||||
bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
|
|
||||||
}
|
|
||||||
- if (ci->pkg == BCMA_PKG_ID_BCM5358)
|
|
||||||
+ if (ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM5358)
|
|
||||||
bgmac->feature_flags |= BGMAC_FEAT_SW_TYPE_EPHYRMII;
|
|
||||||
break;
|
|
||||||
case BCMA_CHIP_ID_BCM53573:
|
|
|
@ -389,7 +389,7 @@
|
||||||
if (dc_lsize == 0)
|
if (dc_lsize == 0)
|
||||||
r4k_blast_dcache = (void *)cache_noop;
|
r4k_blast_dcache = (void *)cache_noop;
|
||||||
else if (dc_lsize == 16)
|
else if (dc_lsize == 16)
|
||||||
@@ -1818,6 +1830,17 @@ static void coherency_setup(void)
|
@@ -1827,6 +1839,17 @@ static void coherency_setup(void)
|
||||||
* silly idea of putting something else there ...
|
* silly idea of putting something else there ...
|
||||||
*/
|
*/
|
||||||
switch (current_cpu_type()) {
|
switch (current_cpu_type()) {
|
||||||
|
@ -407,7 +407,7 @@
|
||||||
case CPU_R4000PC:
|
case CPU_R4000PC:
|
||||||
case CPU_R4000SC:
|
case CPU_R4000SC:
|
||||||
case CPU_R4000MC:
|
case CPU_R4000MC:
|
||||||
@@ -1864,6 +1887,15 @@ void r4k_cache_init(void)
|
@@ -1873,6 +1896,15 @@ void r4k_cache_init(void)
|
||||||
extern void build_copy_page(void);
|
extern void build_copy_page(void);
|
||||||
struct cpuinfo_mips *c = ¤t_cpu_data;
|
struct cpuinfo_mips *c = ¤t_cpu_data;
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@
|
||||||
probe_pcache();
|
probe_pcache();
|
||||||
probe_vcache();
|
probe_vcache();
|
||||||
setup_scache();
|
setup_scache();
|
||||||
@@ -1940,7 +1972,15 @@ void r4k_cache_init(void)
|
@@ -1949,7 +1981,15 @@ void r4k_cache_init(void)
|
||||||
*/
|
*/
|
||||||
local_r4k___flush_cache_all(NULL);
|
local_r4k___flush_cache_all(NULL);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ This fixes OpenWrt ticket #1485: https://dev.openwrt.org/ticket/1485
|
||||||
#endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */
|
#endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */
|
||||||
--- a/arch/mips/mm/c-r4k.c
|
--- a/arch/mips/mm/c-r4k.c
|
||||||
+++ b/arch/mips/mm/c-r4k.c
|
+++ b/arch/mips/mm/c-r4k.c
|
||||||
@@ -699,7 +699,7 @@ static inline void local_r4k_flush_cache
|
@@ -702,7 +702,7 @@ static inline void local_r4k_flush_cache
|
||||||
map_coherent = (cpu_has_dc_aliases &&
|
map_coherent = (cpu_has_dc_aliases &&
|
||||||
page_mapcount(page) &&
|
page_mapcount(page) &&
|
||||||
!Page_dcache_dirty(page));
|
!Page_dcache_dirty(page));
|
||||||
|
@ -38,7 +38,7 @@ This fixes OpenWrt ticket #1485: https://dev.openwrt.org/ticket/1485
|
||||||
vaddr = kmap_coherent(page, addr);
|
vaddr = kmap_coherent(page, addr);
|
||||||
else
|
else
|
||||||
vaddr = kmap_atomic(page);
|
vaddr = kmap_atomic(page);
|
||||||
@@ -721,7 +721,7 @@ static inline void local_r4k_flush_cache
|
@@ -729,7 +729,7 @@ static inline void local_r4k_flush_cache
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vaddr) {
|
if (vaddr) {
|
||||||
|
|
|
@ -380,7 +380,7 @@
|
||||||
if (dc_lsize == 0)
|
if (dc_lsize == 0)
|
||||||
r4k_blast_dcache = (void *)cache_noop;
|
r4k_blast_dcache = (void *)cache_noop;
|
||||||
else if (dc_lsize == 16)
|
else if (dc_lsize == 16)
|
||||||
@@ -1817,6 +1829,17 @@ static void coherency_setup(void)
|
@@ -1826,6 +1838,17 @@ static void coherency_setup(void)
|
||||||
* silly idea of putting something else there ...
|
* silly idea of putting something else there ...
|
||||||
*/
|
*/
|
||||||
switch (current_cpu_type()) {
|
switch (current_cpu_type()) {
|
||||||
|
@ -398,7 +398,7 @@
|
||||||
case CPU_R4000PC:
|
case CPU_R4000PC:
|
||||||
case CPU_R4000SC:
|
case CPU_R4000SC:
|
||||||
case CPU_R4000MC:
|
case CPU_R4000MC:
|
||||||
@@ -1863,6 +1886,15 @@ void r4k_cache_init(void)
|
@@ -1872,6 +1895,15 @@ void r4k_cache_init(void)
|
||||||
extern void build_copy_page(void);
|
extern void build_copy_page(void);
|
||||||
struct cpuinfo_mips *c = ¤t_cpu_data;
|
struct cpuinfo_mips *c = ¤t_cpu_data;
|
||||||
|
|
||||||
|
@ -414,7 +414,7 @@
|
||||||
probe_pcache();
|
probe_pcache();
|
||||||
probe_vcache();
|
probe_vcache();
|
||||||
setup_scache();
|
setup_scache();
|
||||||
@@ -1935,7 +1967,15 @@ void r4k_cache_init(void)
|
@@ -1944,7 +1976,15 @@ void r4k_cache_init(void)
|
||||||
*/
|
*/
|
||||||
local_r4k___flush_cache_all(NULL);
|
local_r4k___flush_cache_all(NULL);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ This fixes OpenWrt ticket #1485: https://dev.openwrt.org/ticket/1485
|
||||||
#endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */
|
#endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */
|
||||||
--- a/arch/mips/mm/c-r4k.c
|
--- a/arch/mips/mm/c-r4k.c
|
||||||
+++ b/arch/mips/mm/c-r4k.c
|
+++ b/arch/mips/mm/c-r4k.c
|
||||||
@@ -699,7 +699,7 @@ static inline void local_r4k_flush_cache
|
@@ -702,7 +702,7 @@ static inline void local_r4k_flush_cache
|
||||||
map_coherent = (cpu_has_dc_aliases &&
|
map_coherent = (cpu_has_dc_aliases &&
|
||||||
page_mapcount(page) &&
|
page_mapcount(page) &&
|
||||||
!Page_dcache_dirty(page));
|
!Page_dcache_dirty(page));
|
||||||
|
@ -38,7 +38,7 @@ This fixes OpenWrt ticket #1485: https://dev.openwrt.org/ticket/1485
|
||||||
vaddr = kmap_coherent(page, addr);
|
vaddr = kmap_coherent(page, addr);
|
||||||
else
|
else
|
||||||
vaddr = kmap_atomic(page);
|
vaddr = kmap_atomic(page);
|
||||||
@@ -721,7 +721,7 @@ static inline void local_r4k_flush_cache
|
@@ -729,7 +729,7 @@ static inline void local_r4k_flush_cache
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vaddr) {
|
if (vaddr) {
|
||||||
|
|
|
@ -400,7 +400,6 @@
|
||||||
|
|
||||||
port@8 {
|
port@8 {
|
||||||
reg = <8>;
|
reg = <8>;
|
||||||
label = "cpu";
|
|
||||||
|
|
||||||
phy-mode = "internal";
|
phy-mode = "internal";
|
||||||
ethernet = <ðernet>;
|
ethernet = <ðernet>;
|
||||||
|
|
|
@ -521,7 +521,6 @@
|
||||||
|
|
||||||
port@8 {
|
port@8 {
|
||||||
reg = <8>;
|
reg = <8>;
|
||||||
label = "cpu";
|
|
||||||
|
|
||||||
phy-mode = "internal";
|
phy-mode = "internal";
|
||||||
ethernet = <ðernet>;
|
ethernet = <ðernet>;
|
||||||
|
|
|
@ -418,7 +418,6 @@
|
||||||
|
|
||||||
port@8 {
|
port@8 {
|
||||||
reg = <8>;
|
reg = <8>;
|
||||||
label = "cpu";
|
|
||||||
|
|
||||||
phy-mode = "internal";
|
phy-mode = "internal";
|
||||||
ethernet = <ðernet>;
|
ethernet = <ðernet>;
|
||||||
|
|
|
@ -515,7 +515,6 @@
|
||||||
|
|
||||||
port@8 {
|
port@8 {
|
||||||
reg = <8>;
|
reg = <8>;
|
||||||
label = "cpu";
|
|
||||||
|
|
||||||
phy-mode = "internal";
|
phy-mode = "internal";
|
||||||
ethernet = <ðernet>;
|
ethernet = <ðernet>;
|
||||||
|
|
|
@ -529,7 +529,6 @@
|
||||||
|
|
||||||
port@8 {
|
port@8 {
|
||||||
reg = <8>;
|
reg = <8>;
|
||||||
label = "cpu";
|
|
||||||
|
|
||||||
phy-mode = "internal";
|
phy-mode = "internal";
|
||||||
ethernet = <ðernet>;
|
ethernet = <ðernet>;
|
||||||
|
|
|
@ -1360,7 +1360,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
int irq;
|
int irq;
|
||||||
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
||||||
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
||||||
@@ -5013,7 +5013,7 @@ int stmmac_dvr_probe(struct device *devi
|
@@ -5014,7 +5014,7 @@ int stmmac_dvr_probe(struct device *devi
|
||||||
priv->wol_irq = res->wol_irq;
|
priv->wol_irq = res->wol_irq;
|
||||||
priv->lpi_irq = res->lpi_irq;
|
priv->lpi_irq = res->lpi_irq;
|
||||||
|
|
||||||
|
|
|
@ -212,9 +212,9 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
if (!config->no_of_node)
|
if (!config->no_of_node)
|
||||||
nvmem->dev.of_node = config->dev->of_node;
|
nvmem->dev.of_node = config->dev->of_node;
|
||||||
|
|
||||||
@@ -680,6 +819,12 @@ struct nvmem_device *nvmem_register(cons
|
@@ -703,6 +842,12 @@ struct nvmem_device *nvmem_register(cons
|
||||||
nvmem->dev.groups = nvmem_dev_groups;
|
if (rval)
|
||||||
#endif
|
goto err_remove_cells;
|
||||||
|
|
||||||
+ if (nvmem->nkeepout) {
|
+ if (nvmem->nkeepout) {
|
||||||
+ rval = nvmem_validate_keepouts(nvmem);
|
+ rval = nvmem_validate_keepouts(nvmem);
|
||||||
|
@ -224,7 +224,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
+
|
+
|
||||||
dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
|
dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
|
||||||
|
|
||||||
rval = device_register(&nvmem->dev);
|
rval = device_add(&nvmem->dev);
|
||||||
--- a/include/linux/nvmem-provider.h
|
--- a/include/linux/nvmem-provider.h
|
||||||
+++ b/include/linux/nvmem-provider.h
|
+++ b/include/linux/nvmem-provider.h
|
||||||
@@ -31,6 +31,19 @@ enum nvmem_type {
|
@@ -31,6 +31,19 @@ enum nvmem_type {
|
||||||
|
@ -256,8 +256,8 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
* @type: Type of the nvmem storage
|
* @type: Type of the nvmem storage
|
||||||
* @read_only: Device is read-only.
|
* @read_only: Device is read-only.
|
||||||
* @root_only: Device is accessibly to root only.
|
* @root_only: Device is accessibly to root only.
|
||||||
@@ -67,6 +82,8 @@ struct nvmem_config {
|
@@ -65,6 +80,8 @@ struct nvmem_config {
|
||||||
struct gpio_desc *wp_gpio;
|
struct module *owner;
|
||||||
const struct nvmem_cell_info *cells;
|
const struct nvmem_cell_info *cells;
|
||||||
int ncells;
|
int ncells;
|
||||||
+ const struct nvmem_keepout *keepout;
|
+ const struct nvmem_keepout *keepout;
|
||||||
|
|
|
@ -57,7 +57,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
--- a/drivers/nvmem/core.c
|
--- a/drivers/nvmem/core.c
|
||||||
+++ b/drivers/nvmem/core.c
|
+++ b/drivers/nvmem/core.c
|
||||||
@@ -1612,6 +1612,101 @@ int nvmem_cell_read_u64(struct device *d
|
@@ -1613,6 +1613,101 @@ int nvmem_cell_read_u64(struct device *d
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(nvmem_cell_read_u64);
|
EXPORT_SYMBOL_GPL(nvmem_cell_read_u64);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
--- a/drivers/nvmem/core.c
|
--- a/drivers/nvmem/core.c
|
||||||
+++ b/drivers/nvmem/core.c
|
+++ b/drivers/nvmem/core.c
|
||||||
@@ -1699,7 +1699,7 @@ int nvmem_cell_read_variable_le_u64(stru
|
@@ -1700,7 +1700,7 @@ int nvmem_cell_read_variable_le_u64(stru
|
||||||
/* Copy w/ implicit endian conversion */
|
/* Copy w/ implicit endian conversion */
|
||||||
*val = 0;
|
*val = 0;
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
|
|
|
@ -70,7 +70,7 @@ Link: https://lore.kernel.org/linux-mtd/20210424110608.15748-2-michael@walle.cc
|
||||||
* @no_of_node: Device should not use the parent's of_node even if it's !NULL.
|
* @no_of_node: Device should not use the parent's of_node even if it's !NULL.
|
||||||
* @reg_read: Callback to read data.
|
* @reg_read: Callback to read data.
|
||||||
* @reg_write: Callback to write data.
|
* @reg_write: Callback to write data.
|
||||||
@@ -87,6 +88,7 @@ struct nvmem_config {
|
@@ -85,6 +86,7 @@ struct nvmem_config {
|
||||||
enum nvmem_type type;
|
enum nvmem_type type;
|
||||||
bool read_only;
|
bool read_only;
|
||||||
bool root_only;
|
bool root_only;
|
||||||
|
|
|
@ -19,7 +19,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
--- a/drivers/nvmem/core.c
|
--- a/drivers/nvmem/core.c
|
||||||
+++ b/drivers/nvmem/core.c
|
+++ b/drivers/nvmem/core.c
|
||||||
@@ -1614,9 +1614,9 @@ int nvmem_cell_read_u64(struct device *d
|
@@ -1615,9 +1615,9 @@ int nvmem_cell_read_u64(struct device *d
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(nvmem_cell_read_u64);
|
EXPORT_SYMBOL_GPL(nvmem_cell_read_u64);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
{
|
{
|
||||||
struct nvmem_cell *cell;
|
struct nvmem_cell *cell;
|
||||||
int nbits;
|
int nbits;
|
||||||
@@ -1660,7 +1660,7 @@ int nvmem_cell_read_variable_le_u32(stru
|
@@ -1661,7 +1661,7 @@ int nvmem_cell_read_variable_le_u32(stru
|
||||||
u32 *val)
|
u32 *val)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -41,7 +41,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len);
|
buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len);
|
||||||
@@ -1691,7 +1691,7 @@ int nvmem_cell_read_variable_le_u64(stru
|
@@ -1692,7 +1692,7 @@ int nvmem_cell_read_variable_le_u64(stru
|
||||||
u64 *val)
|
u64 *val)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
|
@ -20,7 +20,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
--- a/drivers/nvmem/core.c
|
--- a/drivers/nvmem/core.c
|
||||||
+++ b/drivers/nvmem/core.c
|
+++ b/drivers/nvmem/core.c
|
||||||
@@ -827,8 +827,11 @@ struct nvmem_device *nvmem_register(cons
|
@@ -850,8 +850,11 @@ struct nvmem_device *nvmem_register(cons
|
||||||
|
|
||||||
if (nvmem->nkeepout) {
|
if (nvmem->nkeepout) {
|
||||||
rval = nvmem_validate_keepouts(nvmem);
|
rval = nvmem_validate_keepouts(nvmem);
|
||||||
|
|
|
@ -206,7 +206,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1144,9 +1146,33 @@ struct nvmem_device *devm_nvmem_device_g
|
@@ -1145,9 +1147,33 @@ struct nvmem_device *devm_nvmem_device_g
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(devm_nvmem_device_get);
|
EXPORT_SYMBOL_GPL(devm_nvmem_device_get);
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
struct nvmem_cell *cell = ERR_PTR(-ENOENT);
|
struct nvmem_cell *cell = ERR_PTR(-ENOENT);
|
||||||
struct nvmem_cell_lookup *lookup;
|
struct nvmem_cell_lookup *lookup;
|
||||||
struct nvmem_device *nvmem;
|
struct nvmem_device *nvmem;
|
||||||
@@ -1171,11 +1197,15 @@ nvmem_cell_get_from_lookup(struct device
|
@@ -1172,11 +1198,15 @@ nvmem_cell_get_from_lookup(struct device
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1186,10 +1216,10 @@ nvmem_cell_get_from_lookup(struct device
|
@@ -1187,10 +1217,10 @@ nvmem_cell_get_from_lookup(struct device
|
||||||
}
|
}
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_OF)
|
#if IS_ENABLED(CONFIG_OF)
|
||||||
|
@ -273,7 +273,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
mutex_lock(&nvmem_mutex);
|
mutex_lock(&nvmem_mutex);
|
||||||
list_for_each_entry(iter, &nvmem->cells, node) {
|
list_for_each_entry(iter, &nvmem->cells, node) {
|
||||||
@@ -1219,6 +1249,7 @@ struct nvmem_cell *of_nvmem_cell_get(str
|
@@ -1220,6 +1250,7 @@ struct nvmem_cell *of_nvmem_cell_get(str
|
||||||
{
|
{
|
||||||
struct device_node *cell_np, *nvmem_np;
|
struct device_node *cell_np, *nvmem_np;
|
||||||
struct nvmem_device *nvmem;
|
struct nvmem_device *nvmem;
|
||||||
|
@ -281,7 +281,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
struct nvmem_cell *cell;
|
struct nvmem_cell *cell;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
@@ -1239,12 +1270,16 @@ struct nvmem_cell *of_nvmem_cell_get(str
|
@@ -1240,12 +1271,16 @@ struct nvmem_cell *of_nvmem_cell_get(str
|
||||||
if (IS_ERR(nvmem))
|
if (IS_ERR(nvmem))
|
||||||
return ERR_CAST(nvmem);
|
return ERR_CAST(nvmem);
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(of_nvmem_cell_get);
|
EXPORT_SYMBOL_GPL(of_nvmem_cell_get);
|
||||||
@@ -1350,13 +1385,17 @@ EXPORT_SYMBOL(devm_nvmem_cell_put);
|
@@ -1351,13 +1386,17 @@ EXPORT_SYMBOL(devm_nvmem_cell_put);
|
||||||
*/
|
*/
|
||||||
void nvmem_cell_put(struct nvmem_cell *cell)
|
void nvmem_cell_put(struct nvmem_cell *cell)
|
||||||
{
|
{
|
||||||
|
@ -320,7 +320,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
{
|
{
|
||||||
u8 *p, *b;
|
u8 *p, *b;
|
||||||
int i, extra, bit_offset = cell->bit_offset;
|
int i, extra, bit_offset = cell->bit_offset;
|
||||||
@@ -1390,8 +1429,8 @@ static void nvmem_shift_read_buffer_in_p
|
@@ -1391,8 +1430,8 @@ static void nvmem_shift_read_buffer_in_p
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __nvmem_cell_read(struct nvmem_device *nvmem,
|
static int __nvmem_cell_read(struct nvmem_device *nvmem,
|
||||||
|
@ -331,7 +331,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@@ -1422,18 +1461,18 @@ static int __nvmem_cell_read(struct nvme
|
@@ -1423,18 +1462,18 @@ static int __nvmem_cell_read(struct nvme
|
||||||
*/
|
*/
|
||||||
void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
|
void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
|
||||||
{
|
{
|
||||||
|
@ -353,7 +353,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
if (rc) {
|
if (rc) {
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
return ERR_PTR(rc);
|
return ERR_PTR(rc);
|
||||||
@@ -1443,7 +1482,7 @@ void *nvmem_cell_read(struct nvmem_cell
|
@@ -1444,7 +1483,7 @@ void *nvmem_cell_read(struct nvmem_cell
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(nvmem_cell_read);
|
EXPORT_SYMBOL_GPL(nvmem_cell_read);
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
u8 *_buf, int len)
|
u8 *_buf, int len)
|
||||||
{
|
{
|
||||||
struct nvmem_device *nvmem = cell->nvmem;
|
struct nvmem_device *nvmem = cell->nvmem;
|
||||||
@@ -1496,16 +1535,7 @@ err:
|
@@ -1497,16 +1536,7 @@ err:
|
||||||
return ERR_PTR(rc);
|
return ERR_PTR(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
{
|
{
|
||||||
struct nvmem_device *nvmem = cell->nvmem;
|
struct nvmem_device *nvmem = cell->nvmem;
|
||||||
int rc;
|
int rc;
|
||||||
@@ -1531,6 +1561,21 @@ int nvmem_cell_write(struct nvmem_cell *
|
@@ -1532,6 +1562,21 @@ int nvmem_cell_write(struct nvmem_cell *
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
EXPORT_SYMBOL_GPL(nvmem_cell_write);
|
EXPORT_SYMBOL_GPL(nvmem_cell_write);
|
||||||
|
|
||||||
static int nvmem_cell_read_common(struct device *dev, const char *cell_id,
|
static int nvmem_cell_read_common(struct device *dev, const char *cell_id,
|
||||||
@@ -1633,7 +1678,7 @@ static const void *nvmem_cell_read_varia
|
@@ -1634,7 +1679,7 @@ static const void *nvmem_cell_read_varia
|
||||||
if (IS_ERR(cell))
|
if (IS_ERR(cell))
|
||||||
return cell;
|
return cell;
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
buf = nvmem_cell_read(cell, len);
|
buf = nvmem_cell_read(cell, len);
|
||||||
nvmem_cell_put(cell);
|
nvmem_cell_put(cell);
|
||||||
if (IS_ERR(buf))
|
if (IS_ERR(buf))
|
||||||
@@ -1729,18 +1774,18 @@ EXPORT_SYMBOL_GPL(nvmem_cell_read_variab
|
@@ -1730,18 +1775,18 @@ EXPORT_SYMBOL_GPL(nvmem_cell_read_variab
|
||||||
ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem,
|
ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem,
|
||||||
struct nvmem_cell_info *info, void *buf)
|
struct nvmem_cell_info *info, void *buf)
|
||||||
{
|
{
|
||||||
|
@ -433,7 +433,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
@@ -1760,17 +1805,17 @@ EXPORT_SYMBOL_GPL(nvmem_device_cell_read
|
@@ -1761,17 +1806,17 @@ EXPORT_SYMBOL_GPL(nvmem_device_cell_read
|
||||||
int nvmem_device_cell_write(struct nvmem_device *nvmem,
|
int nvmem_device_cell_write(struct nvmem_device *nvmem,
|
||||||
struct nvmem_cell_info *info, void *buf)
|
struct nvmem_cell_info *info, void *buf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
nvmem->keepout = config->keepout;
|
nvmem->keepout = config->keepout;
|
||||||
nvmem->nkeepout = config->nkeepout;
|
nvmem->nkeepout = config->nkeepout;
|
||||||
if (config->of_node)
|
if (config->of_node)
|
||||||
@@ -1443,6 +1445,13 @@ static int __nvmem_cell_read(struct nvme
|
@@ -1444,6 +1446,13 @@ static int __nvmem_cell_read(struct nvme
|
||||||
if (cell->bit_offset || cell->nbits)
|
if (cell->bit_offset || cell->nbits)
|
||||||
nvmem_shift_read_buffer_in_place(cell, buf);
|
nvmem_shift_read_buffer_in_place(cell, buf);
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
* @size: Device size.
|
* @size: Device size.
|
||||||
* @word_size: Minimum read/write access granularity.
|
* @word_size: Minimum read/write access granularity.
|
||||||
* @stride: Minimum read/write access stride.
|
* @stride: Minimum read/write access stride.
|
||||||
@@ -94,6 +98,7 @@ struct nvmem_config {
|
@@ -92,6 +96,7 @@ struct nvmem_config {
|
||||||
bool no_of_node;
|
bool no_of_node;
|
||||||
nvmem_reg_read_t reg_read;
|
nvmem_reg_read_t reg_read;
|
||||||
nvmem_reg_write_t reg_write;
|
nvmem_reg_write_t reg_write;
|
||||||
|
|
|
@ -17,7 +17,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
--- a/drivers/nvmem/core.c
|
--- a/drivers/nvmem/core.c
|
||||||
+++ b/drivers/nvmem/core.c
|
+++ b/drivers/nvmem/core.c
|
||||||
@@ -945,28 +945,6 @@ struct nvmem_device *devm_nvmem_register
|
@@ -946,28 +946,6 @@ struct nvmem_device *devm_nvmem_register
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(devm_nvmem_register);
|
EXPORT_SYMBOL_GPL(devm_nvmem_register);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
{
|
{
|
||||||
--- a/include/linux/nvmem-provider.h
|
--- a/include/linux/nvmem-provider.h
|
||||||
+++ b/include/linux/nvmem-provider.h
|
+++ b/include/linux/nvmem-provider.h
|
||||||
@@ -135,8 +135,6 @@ void nvmem_unregister(struct nvmem_devic
|
@@ -133,8 +133,6 @@ void nvmem_unregister(struct nvmem_devic
|
||||||
struct nvmem_device *devm_nvmem_register(struct device *dev,
|
struct nvmem_device *devm_nvmem_register(struct device *dev,
|
||||||
const struct nvmem_config *cfg);
|
const struct nvmem_config *cfg);
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
void nvmem_add_cell_table(struct nvmem_cell_table *table);
|
void nvmem_add_cell_table(struct nvmem_cell_table *table);
|
||||||
void nvmem_del_cell_table(struct nvmem_cell_table *table);
|
void nvmem_del_cell_table(struct nvmem_cell_table *table);
|
||||||
|
|
||||||
@@ -155,12 +153,6 @@ devm_nvmem_register(struct device *dev,
|
@@ -153,12 +151,6 @@ devm_nvmem_register(struct device *dev,
|
||||||
return nvmem_register(c);
|
return nvmem_register(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
--- a/drivers/nvmem/core.c
|
--- a/drivers/nvmem/core.c
|
||||||
+++ b/drivers/nvmem/core.c
|
+++ b/drivers/nvmem/core.c
|
||||||
@@ -907,9 +907,9 @@ void nvmem_unregister(struct nvmem_devic
|
@@ -908,9 +908,9 @@ void nvmem_unregister(struct nvmem_devic
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(nvmem_unregister);
|
EXPORT_SYMBOL_GPL(nvmem_unregister);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -926,20 +926,16 @@ static void devm_nvmem_release(struct de
|
@@ -927,20 +927,16 @@ static void devm_nvmem_release(struct de
|
||||||
struct nvmem_device *devm_nvmem_register(struct device *dev,
|
struct nvmem_device *devm_nvmem_register(struct device *dev,
|
||||||
const struct nvmem_config *config)
|
const struct nvmem_config *config)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
--- a/drivers/nvmem/core.c
|
--- a/drivers/nvmem/core.c
|
||||||
+++ b/drivers/nvmem/core.c
|
+++ b/drivers/nvmem/core.c
|
||||||
@@ -903,7 +903,8 @@ static void nvmem_device_release(struct
|
@@ -904,7 +904,8 @@ static void nvmem_device_release(struct
|
||||||
*/
|
*/
|
||||||
void nvmem_unregister(struct nvmem_device *nvmem)
|
void nvmem_unregister(struct nvmem_device *nvmem)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,10 +22,23 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
--- a/drivers/nvmem/core.c
|
--- a/drivers/nvmem/core.c
|
||||||
+++ b/drivers/nvmem/core.c
|
+++ b/drivers/nvmem/core.c
|
||||||
@@ -830,21 +830,18 @@ struct nvmem_device *nvmem_register(cons
|
@@ -833,6 +833,12 @@ struct nvmem_device *nvmem_register(cons
|
||||||
nvmem->dev.groups = nvmem_dev_groups;
|
nvmem->dev.groups = nvmem_dev_groups;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
+ if (nvmem->nkeepout) {
|
||||||
|
+ rval = nvmem_validate_keepouts(nvmem);
|
||||||
|
+ if (rval)
|
||||||
|
+ goto err_put_device;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (config->compat) {
|
||||||
|
rval = nvmem_sysfs_setup_compat(nvmem, config);
|
||||||
|
if (rval)
|
||||||
|
@@ -853,15 +859,6 @@ struct nvmem_device *nvmem_register(cons
|
||||||
|
if (rval)
|
||||||
|
goto err_remove_cells;
|
||||||
|
|
||||||
- if (nvmem->nkeepout) {
|
- if (nvmem->nkeepout) {
|
||||||
- rval = nvmem_validate_keepouts(nvmem);
|
- rval = nvmem_validate_keepouts(nvmem);
|
||||||
- if (rval) {
|
- if (rval) {
|
||||||
|
@ -37,16 +50,4 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
-
|
-
|
||||||
dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
|
dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
|
||||||
|
|
||||||
rval = device_register(&nvmem->dev);
|
rval = device_add(&nvmem->dev);
|
||||||
if (rval)
|
|
||||||
goto err_put_device;
|
|
||||||
|
|
||||||
+ if (nvmem->nkeepout) {
|
|
||||||
+ rval = nvmem_validate_keepouts(nvmem);
|
|
||||||
+ if (rval)
|
|
||||||
+ goto err_device_del;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (config->compat) {
|
|
||||||
rval = nvmem_sysfs_setup_compat(nvmem, config);
|
|
||||||
if (rval)
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
From 5544e90c81261e82e02bbf7c6015a4b9c8c825ef Mon Sep 17 00:00:00 2001
|
|
||||||
From: Gaosheng Cui <cuigaosheng1@huawei.com>
|
|
||||||
Date: Fri, 16 Sep 2022 13:20:50 +0100
|
|
||||||
Subject: [PATCH] nvmem: core: add error handling for dev_set_name
|
|
||||||
|
|
||||||
The type of return value of dev_set_name is int, which may return
|
|
||||||
wrong result, so we add error handling for it to reclaim memory
|
|
||||||
of nvmem resource, and return early when an error occurs.
|
|
||||||
|
|
||||||
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
|
|
||||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
|
||||||
Link: https://lore.kernel.org/r/20220916122100.170016-4-srinivas.kandagatla@linaro.org
|
|
||||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
||||||
---
|
|
||||||
drivers/nvmem/core.c | 12 +++++++++---
|
|
||||||
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
--- a/drivers/nvmem/core.c
|
|
||||||
+++ b/drivers/nvmem/core.c
|
|
||||||
@@ -811,18 +811,24 @@ struct nvmem_device *nvmem_register(cons
|
|
||||||
|
|
||||||
switch (config->id) {
|
|
||||||
case NVMEM_DEVID_NONE:
|
|
||||||
- dev_set_name(&nvmem->dev, "%s", config->name);
|
|
||||||
+ rval = dev_set_name(&nvmem->dev, "%s", config->name);
|
|
||||||
break;
|
|
||||||
case NVMEM_DEVID_AUTO:
|
|
||||||
- dev_set_name(&nvmem->dev, "%s%d", config->name, nvmem->id);
|
|
||||||
+ rval = dev_set_name(&nvmem->dev, "%s%d", config->name, nvmem->id);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
- dev_set_name(&nvmem->dev, "%s%d",
|
|
||||||
+ rval = dev_set_name(&nvmem->dev, "%s%d",
|
|
||||||
config->name ? : "nvmem",
|
|
||||||
config->name ? config->id : nvmem->id);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (rval) {
|
|
||||||
+ ida_free(&nvmem_ida, nvmem->id);
|
|
||||||
+ kfree(nvmem);
|
|
||||||
+ return ERR_PTR(rval);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
nvmem->read_only = device_property_present(config->dev, "read-only") ||
|
|
||||||
config->read_only || !nvmem->reg_write;
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
--- a/drivers/nvmem/core.c
|
--- a/drivers/nvmem/core.c
|
||||||
+++ b/drivers/nvmem/core.c
|
+++ b/drivers/nvmem/core.c
|
||||||
@@ -1242,16 +1242,21 @@ struct nvmem_cell *of_nvmem_cell_get(str
|
@@ -1237,16 +1237,21 @@ struct nvmem_cell *of_nvmem_cell_get(str
|
||||||
if (!cell_np)
|
if (!cell_np)
|
||||||
return ERR_PTR(-ENOENT);
|
return ERR_PTR(-ENOENT);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
};
|
};
|
||||||
|
|
||||||
static DEFINE_MUTEX(nvmem_mutex);
|
static DEFINE_MUTEX(nvmem_mutex);
|
||||||
@@ -1127,7 +1128,8 @@ struct nvmem_device *devm_nvmem_device_g
|
@@ -1122,7 +1123,8 @@ struct nvmem_device *devm_nvmem_device_g
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(devm_nvmem_device_get);
|
EXPORT_SYMBOL_GPL(devm_nvmem_device_get);
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
{
|
{
|
||||||
struct nvmem_cell *cell;
|
struct nvmem_cell *cell;
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
@@ -1146,6 +1148,7 @@ static struct nvmem_cell *nvmem_create_c
|
@@ -1141,6 +1143,7 @@ static struct nvmem_cell *nvmem_create_c
|
||||||
|
|
||||||
cell->id = name;
|
cell->id = name;
|
||||||
cell->entry = entry;
|
cell->entry = entry;
|
||||||
|
@ -65,7 +65,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
@@ -1184,7 +1187,7 @@ nvmem_cell_get_from_lookup(struct device
|
@@ -1179,7 +1182,7 @@ nvmem_cell_get_from_lookup(struct device
|
||||||
__nvmem_device_put(nvmem);
|
__nvmem_device_put(nvmem);
|
||||||
cell = ERR_PTR(-ENOENT);
|
cell = ERR_PTR(-ENOENT);
|
||||||
} else {
|
} else {
|
||||||
|
@ -74,7 +74,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
if (IS_ERR(cell))
|
if (IS_ERR(cell))
|
||||||
__nvmem_device_put(nvmem);
|
__nvmem_device_put(nvmem);
|
||||||
}
|
}
|
||||||
@@ -1232,15 +1235,27 @@ struct nvmem_cell *of_nvmem_cell_get(str
|
@@ -1227,15 +1230,27 @@ struct nvmem_cell *of_nvmem_cell_get(str
|
||||||
struct nvmem_device *nvmem;
|
struct nvmem_device *nvmem;
|
||||||
struct nvmem_cell_entry *cell_entry;
|
struct nvmem_cell_entry *cell_entry;
|
||||||
struct nvmem_cell *cell;
|
struct nvmem_cell *cell;
|
||||||
|
@ -105,7 +105,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
nvmem_np = of_get_parent(cell_np);
|
nvmem_np = of_get_parent(cell_np);
|
||||||
if (!nvmem_np) {
|
if (!nvmem_np) {
|
||||||
@@ -1262,7 +1277,7 @@ struct nvmem_cell *of_nvmem_cell_get(str
|
@@ -1257,7 +1272,7 @@ struct nvmem_cell *of_nvmem_cell_get(str
|
||||||
return ERR_PTR(-ENOENT);
|
return ERR_PTR(-ENOENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
if (IS_ERR(cell))
|
if (IS_ERR(cell))
|
||||||
__nvmem_device_put(nvmem);
|
__nvmem_device_put(nvmem);
|
||||||
|
|
||||||
@@ -1415,8 +1430,8 @@ static void nvmem_shift_read_buffer_in_p
|
@@ -1410,8 +1425,8 @@ static void nvmem_shift_read_buffer_in_p
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __nvmem_cell_read(struct nvmem_device *nvmem,
|
static int __nvmem_cell_read(struct nvmem_device *nvmem,
|
||||||
|
@ -125,7 +125,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@@ -1430,7 +1445,7 @@ static int __nvmem_cell_read(struct nvme
|
@@ -1425,7 +1440,7 @@ static int __nvmem_cell_read(struct nvme
|
||||||
nvmem_shift_read_buffer_in_place(cell, buf);
|
nvmem_shift_read_buffer_in_place(cell, buf);
|
||||||
|
|
||||||
if (nvmem->cell_post_process) {
|
if (nvmem->cell_post_process) {
|
||||||
|
@ -134,7 +134,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
cell->offset, buf, cell->bytes);
|
cell->offset, buf, cell->bytes);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
@@ -1465,7 +1480,7 @@ void *nvmem_cell_read(struct nvmem_cell
|
@@ -1460,7 +1475,7 @@ void *nvmem_cell_read(struct nvmem_cell
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
if (rc) {
|
if (rc) {
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
return ERR_PTR(rc);
|
return ERR_PTR(rc);
|
||||||
@@ -1778,7 +1793,7 @@ ssize_t nvmem_device_cell_read(struct nv
|
@@ -1773,7 +1788,7 @@ ssize_t nvmem_device_cell_read(struct nv
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
/**
|
/**
|
||||||
--- a/include/linux/nvmem-provider.h
|
--- a/include/linux/nvmem-provider.h
|
||||||
+++ b/include/linux/nvmem-provider.h
|
+++ b/include/linux/nvmem-provider.h
|
||||||
@@ -155,6 +155,9 @@ struct nvmem_device *devm_nvmem_register
|
@@ -153,6 +153,9 @@ struct nvmem_device *devm_nvmem_register
|
||||||
void nvmem_add_cell_table(struct nvmem_cell_table *table);
|
void nvmem_add_cell_table(struct nvmem_cell_table *table);
|
||||||
void nvmem_del_cell_table(struct nvmem_cell_table *table);
|
void nvmem_del_cell_table(struct nvmem_cell_table *table);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c)
|
static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c)
|
||||||
@@ -172,6 +175,11 @@ devm_nvmem_register(struct device *dev,
|
@@ -170,6 +173,11 @@ devm_nvmem_register(struct device *dev,
|
||||||
|
|
||||||
static inline void nvmem_add_cell_table(struct nvmem_cell_table *table) {}
|
static inline void nvmem_add_cell_table(struct nvmem_cell_table *table) {}
|
||||||
static inline void nvmem_del_cell_table(struct nvmem_cell_table *table) {}
|
static inline void nvmem_del_cell_table(struct nvmem_cell_table *table) {}
|
||||||
|
|
|
@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
@@ -4431,7 +4431,7 @@ static const struct mtk_soc_data mt7621_
|
@@ -4427,7 +4427,7 @@ static const struct mtk_soc_data mt7621_
|
||||||
.hw_features = MTK_HW_FEATURES,
|
.hw_features = MTK_HW_FEATURES,
|
||||||
.required_clks = MT7621_CLKS_BITMAP,
|
.required_clks = MT7621_CLKS_BITMAP,
|
||||||
.required_pctl = false,
|
.required_pctl = false,
|
||||||
|
@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
.hash_offset = 2,
|
.hash_offset = 2,
|
||||||
.foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
|
.foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
|
||||||
.txrx = {
|
.txrx = {
|
||||||
@@ -4471,7 +4471,7 @@ static const struct mtk_soc_data mt7623_
|
@@ -4466,7 +4466,7 @@ static const struct mtk_soc_data mt7623_
|
||||||
.hw_features = MTK_HW_FEATURES,
|
.hw_features = MTK_HW_FEATURES,
|
||||||
.required_clks = MT7623_CLKS_BITMAP,
|
.required_clks = MT7623_CLKS_BITMAP,
|
||||||
.required_pctl = true,
|
.required_pctl = true,
|
||||||
|
@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
.txrx = {
|
.txrx = {
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
|
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
|
||||||
@@ -215,6 +215,8 @@ int mtk_foe_entry_prepare(struct mtk_eth
|
@@ -175,6 +175,8 @@ int mtk_foe_entry_prepare(struct mtk_eth
|
||||||
val = FIELD_PREP(MTK_FOE_IB2_DEST_PORT_V2, pse_port) |
|
val = FIELD_PREP(MTK_FOE_IB2_DEST_PORT_V2, pse_port) |
|
||||||
FIELD_PREP(MTK_FOE_IB2_PORT_AG_V2, 0xf);
|
FIELD_PREP(MTK_FOE_IB2_PORT_AG_V2, 0xf);
|
||||||
} else {
|
} else {
|
||||||
|
@ -41,7 +41,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
val = FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_BIND) |
|
val = FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_BIND) |
|
||||||
FIELD_PREP(MTK_FOE_IB1_PACKET_TYPE, type) |
|
FIELD_PREP(MTK_FOE_IB1_PACKET_TYPE, type) |
|
||||||
FIELD_PREP(MTK_FOE_IB1_UDP, l4proto == IPPROTO_UDP) |
|
FIELD_PREP(MTK_FOE_IB1_UDP, l4proto == IPPROTO_UDP) |
|
||||||
@@ -222,7 +224,7 @@ int mtk_foe_entry_prepare(struct mtk_eth
|
@@ -182,7 +184,7 @@ int mtk_foe_entry_prepare(struct mtk_eth
|
||||||
entry->ib1 = val;
|
entry->ib1 = val;
|
||||||
|
|
||||||
val = FIELD_PREP(MTK_FOE_IB2_DEST_PORT, pse_port) |
|
val = FIELD_PREP(MTK_FOE_IB2_DEST_PORT, pse_port) |
|
|
@ -644,7 +644,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
} qdma;
|
} qdma;
|
||||||
u32 gdm1_cnt;
|
u32 gdm1_cnt;
|
||||||
u32 gdma_to_ppe0;
|
u32 gdma_to_ppe0;
|
||||||
@@ -1175,6 +1196,7 @@ struct mtk_mac {
|
@@ -1172,6 +1193,7 @@ struct mtk_mac {
|
||||||
__be32 hwlro_ip[MTK_MAX_LRO_IP_CNT];
|
__be32 hwlro_ip[MTK_MAX_LRO_IP_CNT];
|
||||||
int hwlro_ip_cnt;
|
int hwlro_ip_cnt;
|
||||||
unsigned int syscfg0;
|
unsigned int syscfg0;
|
|
@ -9,9 +9,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
||||||
--- a/net/dsa/tag_mtk.c
|
--- a/net/dsa/tag_mtk.c
|
||||||
+++ b/net/dsa/tag_mtk.c
|
+++ b/net/dsa/tag_mtk.c
|
||||||
@@ -32,6 +32,8 @@ static struct sk_buff *mtk_tag_xmit(stru
|
@@ -25,6 +25,8 @@ static struct sk_buff *mtk_tag_xmit(stru
|
||||||
*/
|
u8 xmit_tpid;
|
||||||
eth_skb_pad(skb);
|
u8 *mtk_tag;
|
||||||
|
|
||||||
+ skb_set_queue_mapping(skb, dp->index);
|
+ skb_set_queue_mapping(skb, dp->index);
|
||||||
+
|
+
|
|
@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
|
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
|
||||||
@@ -445,6 +445,24 @@ static inline bool mtk_foe_entry_usable(
|
@@ -405,6 +405,24 @@ static inline bool mtk_foe_entry_usable(
|
||||||
FIELD_GET(MTK_FOE_IB1_STATE, entry->ib1) != MTK_FOE_STATE_BIND;
|
FIELD_GET(MTK_FOE_IB1_STATE, entry->ib1) != MTK_FOE_STATE_BIND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
struct mtk_foe_entry *data)
|
struct mtk_foe_entry *data)
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_ppe.h
|
--- a/drivers/net/ethernet/mediatek/mtk_ppe.h
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
|
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
|
||||||
@@ -69,7 +69,9 @@ enum {
|
@@ -68,7 +68,9 @@ enum {
|
||||||
#define MTK_FOE_IB2_DSCP GENMASK(31, 24)
|
#define MTK_FOE_IB2_DSCP GENMASK(31, 24)
|
||||||
|
|
||||||
/* CONFIG_MEDIATEK_NETSYS_V2 */
|
/* CONFIG_MEDIATEK_NETSYS_V2 */
|
||||||
|
@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
#define MTK_FOE_IB2_DEST_PORT_V2 GENMASK(12, 9)
|
#define MTK_FOE_IB2_DEST_PORT_V2 GENMASK(12, 9)
|
||||||
#define MTK_FOE_IB2_MULTICAST_V2 BIT(13)
|
#define MTK_FOE_IB2_MULTICAST_V2 BIT(13)
|
||||||
#define MTK_FOE_IB2_WDMA_WINFO_V2 BIT(19)
|
#define MTK_FOE_IB2_WDMA_WINFO_V2 BIT(19)
|
||||||
@@ -369,6 +371,8 @@ int mtk_foe_entry_set_pppoe(struct mtk_e
|
@@ -351,6 +353,8 @@ int mtk_foe_entry_set_pppoe(struct mtk_e
|
||||||
int sid);
|
int sid);
|
||||||
int mtk_foe_entry_set_wdma(struct mtk_eth *eth, struct mtk_foe_entry *entry,
|
int mtk_foe_entry_set_wdma(struct mtk_eth *eth, struct mtk_foe_entry *entry,
|
||||||
int wdma_idx, int txq, int bss, int wcid);
|
int wdma_idx, int txq, int bss, int wcid);
|
|
@ -181,7 +181,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
/* CDMP Ingress Control Register */
|
/* CDMP Ingress Control Register */
|
||||||
#define MTK_CDMP_IG_CTRL 0x400
|
#define MTK_CDMP_IG_CTRL 0x400
|
||||||
#define MTK_CDMP_STAG_EN BIT(0)
|
#define MTK_CDMP_STAG_EN BIT(0)
|
||||||
@@ -1168,6 +1174,8 @@ struct mtk_eth {
|
@@ -1165,6 +1171,8 @@ struct mtk_eth {
|
||||||
|
|
||||||
int ip_align;
|
int ip_align;
|
||||||
|
|
|
@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
@@ -3745,9 +3745,12 @@ static int mtk_hw_init(struct mtk_eth *e
|
@@ -3711,9 +3711,12 @@ static int mtk_hw_init(struct mtk_eth *e
|
||||||
mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP);
|
mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP);
|
||||||
|
|
||||||
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
|
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
|
||||||
|
@ -27,7 +27,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||||
@@ -139,6 +139,7 @@
|
@@ -140,6 +140,7 @@
|
||||||
#define PSE_FQFC_CFG1 0x100
|
#define PSE_FQFC_CFG1 0x100
|
||||||
#define PSE_FQFC_CFG2 0x104
|
#define PSE_FQFC_CFG2 0x104
|
||||||
#define PSE_DROP_CFG 0x108
|
#define PSE_DROP_CFG 0x108
|
|
@ -13,7 +13,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
|
--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
|
||||||
@@ -561,6 +561,7 @@ mtk_eth_setup_tc_block(struct net_device
|
@@ -554,6 +554,7 @@ mtk_eth_setup_tc_block(struct net_device
|
||||||
struct mtk_eth *eth = mac->hw;
|
struct mtk_eth *eth = mac->hw;
|
||||||
static LIST_HEAD(block_cb_list);
|
static LIST_HEAD(block_cb_list);
|
||||||
struct flow_block_cb *block_cb;
|
struct flow_block_cb *block_cb;
|
||||||
|
@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
flow_setup_cb_t *cb;
|
flow_setup_cb_t *cb;
|
||||||
|
|
||||||
if (!eth->soc->offload_version)
|
if (!eth->soc->offload_version)
|
||||||
@@ -575,16 +576,20 @@ mtk_eth_setup_tc_block(struct net_device
|
@@ -568,16 +569,20 @@ mtk_eth_setup_tc_block(struct net_device
|
||||||
switch (f->command) {
|
switch (f->command) {
|
||||||
case FLOW_BLOCK_BIND:
|
case FLOW_BLOCK_BIND:
|
||||||
block_cb = flow_block_cb_lookup(f->block, cb, dev);
|
block_cb = flow_block_cb_lookup(f->block, cb, dev);
|
|
@ -0,0 +1,42 @@
|
||||||
|
From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <arinc.unal@arinc9.com>
|
||||||
|
Date: Sat, 28 Jan 2023 12:42:32 +0300
|
||||||
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: disable hardware DSA untagging
|
||||||
|
for second MAC
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
According to my tests on MT7621AT and MT7623NI SoCs, hardware DSA untagging
|
||||||
|
won't work on the second MAC. Therefore, disable this feature when the
|
||||||
|
second MAC of the MT7621 and MT7623 SoCs is being used.
|
||||||
|
|
||||||
|
Fixes: 2d7605a72906 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging")
|
||||||
|
Link: https://lore.kernel.org/netdev/6249fc14-b38a-c770-36b4-5af6d41c21d3@arinc9.com/
|
||||||
|
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||||||
|
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||||||
|
Link: https://lore.kernel.org/r/20230128094232.2451947-1-arinc.unal@arinc9.com
|
||||||
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||||
|
---
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
|
@@ -3142,7 +3142,8 @@ static int mtk_open(struct net_device *d
|
||||||
|
struct mtk_eth *eth = mac->hw;
|
||||||
|
int i, err;
|
||||||
|
|
||||||
|
- if (mtk_uses_dsa(dev) && !eth->prog) {
|
||||||
|
+ if ((mtk_uses_dsa(dev) && !eth->prog) &&
|
||||||
|
+ !(mac->id == 1 && MTK_HAS_CAPS(eth->soc->caps, MTK_GMAC1_TRGMII))) {
|
||||||
|
for (i = 0; i < ARRAY_SIZE(eth->dsa_meta); i++) {
|
||||||
|
struct metadata_dst *md_dst = eth->dsa_meta[i];
|
||||||
|
|
||||||
|
@@ -3159,7 +3160,8 @@ static int mtk_open(struct net_device *d
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Hardware special tag parsing needs to be disabled if at least
|
||||||
|
- * one MAC does not use DSA.
|
||||||
|
+ * one MAC does not use DSA, or the second MAC of the MT7621 and
|
||||||
|
+ * MT7623 SoCs is being used.
|
||||||
|
*/
|
||||||
|
u32 val = mtk_r32(eth, MTK_CDMP_IG_CTRL);
|
||||||
|
val &= ~MTK_CDMP_STAG_EN;
|
|
@ -0,0 +1,54 @@
|
||||||
|
From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <arinc.unal@arinc9.com>
|
||||||
|
Date: Sun, 5 Feb 2023 20:53:31 +0300
|
||||||
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: enable special tag when any MAC
|
||||||
|
uses DSA
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
The special tag is only enabled when the first MAC uses DSA. However, it
|
||||||
|
must be enabled when any MAC uses DSA. Change the check accordingly.
|
||||||
|
|
||||||
|
This fixes hardware DSA untagging not working on the second MAC of the
|
||||||
|
MT7621 and MT7623 SoCs, and likely other SoCs too. Therefore, remove the
|
||||||
|
check that disables hardware DSA untagging for the second MAC of the MT7621
|
||||||
|
and MT7623 SoCs.
|
||||||
|
|
||||||
|
Fixes: a1f47752fd62 ("net: ethernet: mtk_eth_soc: disable hardware DSA untagging for second MAC")
|
||||||
|
Co-developed-by: Richard van Schagen <richard@routerhints.com>
|
||||||
|
Signed-off-by: Richard van Schagen <richard@routerhints.com>
|
||||||
|
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
|
---
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
|
@@ -3077,7 +3077,7 @@ static void mtk_gdm_config(struct mtk_et
|
||||||
|
|
||||||
|
val |= config;
|
||||||
|
|
||||||
|
- if (!i && eth->netdev[0] && netdev_uses_dsa(eth->netdev[0]))
|
||||||
|
+ if (eth->netdev[i] && netdev_uses_dsa(eth->netdev[i]))
|
||||||
|
val |= MTK_GDMA_SPECIAL_TAG;
|
||||||
|
|
||||||
|
mtk_w32(eth, val, MTK_GDMA_FWD_CFG(i));
|
||||||
|
@@ -3142,8 +3142,7 @@ static int mtk_open(struct net_device *d
|
||||||
|
struct mtk_eth *eth = mac->hw;
|
||||||
|
int i, err;
|
||||||
|
|
||||||
|
- if ((mtk_uses_dsa(dev) && !eth->prog) &&
|
||||||
|
- !(mac->id == 1 && MTK_HAS_CAPS(eth->soc->caps, MTK_GMAC1_TRGMII))) {
|
||||||
|
+ if (mtk_uses_dsa(dev) && !eth->prog) {
|
||||||
|
for (i = 0; i < ARRAY_SIZE(eth->dsa_meta); i++) {
|
||||||
|
struct metadata_dst *md_dst = eth->dsa_meta[i];
|
||||||
|
|
||||||
|
@@ -3160,8 +3159,7 @@ static int mtk_open(struct net_device *d
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Hardware special tag parsing needs to be disabled if at least
|
||||||
|
- * one MAC does not use DSA, or the second MAC of the MT7621 and
|
||||||
|
- * MT7623 SoCs is being used.
|
||||||
|
+ * one MAC does not use DSA.
|
||||||
|
*/
|
||||||
|
u32 val = mtk_r32(eth, MTK_CDMP_IG_CTRL);
|
||||||
|
val &= ~MTK_CDMP_STAG_EN;
|
|
@ -0,0 +1,129 @@
|
||||||
|
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||||
|
Date: Tue, 7 Feb 2023 12:30:27 +0200
|
||||||
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: fix DSA TX tag hwaccel for switch
|
||||||
|
port 0
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Arınç reports that on his MT7621AT Unielec U7621-06 board and MT7623NI
|
||||||
|
Bananapi BPI-R2, packets received by the CPU over mt7530 switch port 0
|
||||||
|
(of which this driver acts as the DSA master) are not processed
|
||||||
|
correctly by software. More precisely, they arrive without a DSA tag
|
||||||
|
(in packet or in the hwaccel area - skb_metadata_dst()), so DSA cannot
|
||||||
|
demux them towards the switch's interface for port 0. Traffic from other
|
||||||
|
ports receives a skb_metadata_dst() with the correct port and is demuxed
|
||||||
|
properly.
|
||||||
|
|
||||||
|
Looking at mtk_poll_rx(), it becomes apparent that this driver uses the
|
||||||
|
skb vlan hwaccel area:
|
||||||
|
|
||||||
|
union {
|
||||||
|
u32 vlan_all;
|
||||||
|
struct {
|
||||||
|
__be16 vlan_proto;
|
||||||
|
__u16 vlan_tci;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
as a temporary storage for the VLAN hwaccel tag, or the DSA hwaccel tag.
|
||||||
|
If this is a DSA master it's a DSA hwaccel tag, and finally clears up
|
||||||
|
the skb VLAN hwaccel header.
|
||||||
|
|
||||||
|
I'm guessing that the problem is the (mis)use of API.
|
||||||
|
skb_vlan_tag_present() looks like this:
|
||||||
|
|
||||||
|
#define skb_vlan_tag_present(__skb) (!!(__skb)->vlan_all)
|
||||||
|
|
||||||
|
So if both vlan_proto and vlan_tci are zeroes, skb_vlan_tag_present()
|
||||||
|
returns precisely false. I don't know for sure what is the format of the
|
||||||
|
DSA hwaccel tag, but I surely know that lowermost 3 bits of vlan_proto
|
||||||
|
are 0 when receiving from port 0:
|
||||||
|
|
||||||
|
unsigned int port = vlan_proto & GENMASK(2, 0);
|
||||||
|
|
||||||
|
If the RX descriptor has no other bits set to non-zero values in
|
||||||
|
RX_DMA_VTAG, then the call to __vlan_hwaccel_put_tag() will not, in
|
||||||
|
fact, make the subsequent skb_vlan_tag_present() return true, because
|
||||||
|
it's implemented like this:
|
||||||
|
|
||||||
|
static inline void __vlan_hwaccel_put_tag(struct sk_buff *skb,
|
||||||
|
__be16 vlan_proto, u16 vlan_tci)
|
||||||
|
{
|
||||||
|
skb->vlan_proto = vlan_proto;
|
||||||
|
skb->vlan_tci = vlan_tci;
|
||||||
|
}
|
||||||
|
|
||||||
|
What we need to do to fix this problem (assuming this is the problem) is
|
||||||
|
to stop using skb->vlan_all as temporary storage for driver affairs, and
|
||||||
|
just create some local variables that serve the same purpose, but
|
||||||
|
hopefully better. Instead of calling skb_vlan_tag_present(), let's look
|
||||||
|
at a boolean has_hwaccel_tag which we set to true when the RX DMA
|
||||||
|
descriptors have something. Disambiguate based on netdev_uses_dsa()
|
||||||
|
whether this is a VLAN or DSA hwaccel tag, and only call
|
||||||
|
__vlan_hwaccel_put_tag() if we're certain it's a VLAN tag.
|
||||||
|
|
||||||
|
Arınç confirms that the treatment works, so this validates the
|
||||||
|
assumption.
|
||||||
|
|
||||||
|
Link: https://lore.kernel.org/netdev/704f3a72-fc9e-714a-db54-272e17612637@arinc9.com/
|
||||||
|
Fixes: 2d7605a72906 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging")
|
||||||
|
Reported-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||||||
|
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||||||
|
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||||
|
Reviewed-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
|
---
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
|
@@ -1829,7 +1829,9 @@ static int mtk_poll_rx(struct napi_struc
|
||||||
|
|
||||||
|
while (done < budget) {
|
||||||
|
unsigned int pktlen, *rxdcsum;
|
||||||
|
+ bool has_hwaccel_tag = false;
|
||||||
|
struct net_device *netdev;
|
||||||
|
+ u16 vlan_proto, vlan_tci;
|
||||||
|
dma_addr_t dma_addr;
|
||||||
|
u32 hash, reason;
|
||||||
|
int mac = 0;
|
||||||
|
@@ -1969,27 +1971,29 @@ static int mtk_poll_rx(struct napi_struc
|
||||||
|
|
||||||
|
if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
|
||||||
|
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
|
||||||
|
- if (trxd.rxd3 & RX_DMA_VTAG_V2)
|
||||||
|
- __vlan_hwaccel_put_tag(skb,
|
||||||
|
- htons(RX_DMA_VPID(trxd.rxd4)),
|
||||||
|
- RX_DMA_VID(trxd.rxd4));
|
||||||
|
+ if (trxd.rxd3 & RX_DMA_VTAG_V2) {
|
||||||
|
+ vlan_proto = RX_DMA_VPID(trxd.rxd4);
|
||||||
|
+ vlan_tci = RX_DMA_VID(trxd.rxd4);
|
||||||
|
+ has_hwaccel_tag = true;
|
||||||
|
+ }
|
||||||
|
} else if (trxd.rxd2 & RX_DMA_VTAG) {
|
||||||
|
- __vlan_hwaccel_put_tag(skb, htons(RX_DMA_VPID(trxd.rxd3)),
|
||||||
|
- RX_DMA_VID(trxd.rxd3));
|
||||||
|
+ vlan_proto = RX_DMA_VPID(trxd.rxd3);
|
||||||
|
+ vlan_tci = RX_DMA_VID(trxd.rxd3);
|
||||||
|
+ has_hwaccel_tag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* When using VLAN untagging in combination with DSA, the
|
||||||
|
* hardware treats the MTK special tag as a VLAN and untags it.
|
||||||
|
*/
|
||||||
|
- if (skb_vlan_tag_present(skb) && netdev_uses_dsa(netdev)) {
|
||||||
|
- unsigned int port = ntohs(skb->vlan_proto) & GENMASK(2, 0);
|
||||||
|
+ if (has_hwaccel_tag && netdev_uses_dsa(netdev)) {
|
||||||
|
+ unsigned int port = vlan_proto & GENMASK(2, 0);
|
||||||
|
|
||||||
|
if (port < ARRAY_SIZE(eth->dsa_meta) &&
|
||||||
|
eth->dsa_meta[port])
|
||||||
|
skb_dst_set_noref(skb, ð->dsa_meta[port]->dst);
|
||||||
|
-
|
||||||
|
- __vlan_hwaccel_clear_tag(skb);
|
||||||
|
+ } else if (has_hwaccel_tag) {
|
||||||
|
+ __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vlan_tci);
|
||||||
|
}
|
||||||
|
|
||||||
|
skb_record_rx_queue(skb, 0);
|
|
@ -0,0 +1,26 @@
|
||||||
|
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
|
||||||
|
Date: Sun, 12 Feb 2023 07:51:51 +0100
|
||||||
|
Subject: [PATCH] net: ethernet: mtk_wed: No need to clear memory after a
|
||||||
|
dma_alloc_coherent() call
|
||||||
|
|
||||||
|
dma_alloc_coherent() already clears the allocated memory, there is no need
|
||||||
|
to explicitly call memset().
|
||||||
|
|
||||||
|
Moreover, it is likely that the size in the memset() is incorrect and
|
||||||
|
should be "size * sizeof(*ring->desc)".
|
||||||
|
|
||||||
|
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
|
||||||
|
Link: https://lore.kernel.org/r/d5acce7dd108887832c9719f62c7201b4c83b3fb.1676184599.git.christophe.jaillet@wanadoo.fr
|
||||||
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||||
|
---
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||||
|
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||||
|
@@ -786,7 +786,6 @@ mtk_wed_rro_ring_alloc(struct mtk_wed_de
|
||||||
|
|
||||||
|
ring->desc_size = sizeof(*ring->desc);
|
||||||
|
ring->size = size;
|
||||||
|
- memset(ring->desc, 0, size);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||||
|
Date: Wed, 7 Dec 2022 15:04:54 +0100
|
||||||
|
Subject: [PATCH] net: ethernet: mtk_wed: fix some possible NULL pointer
|
||||||
|
dereferences
|
||||||
|
|
||||||
|
Fix possible NULL pointer dereference in mtk_wed_detach routine checking
|
||||||
|
wo pointer is properly allocated before running mtk_wed_wo_reset() and
|
||||||
|
mtk_wed_wo_deinit().
|
||||||
|
Even if it is just a theoretical issue at the moment check wo pointer is
|
||||||
|
not NULL in mtk_wed_mcu_msg_update.
|
||||||
|
Moreover, honor mtk_wed_mcu_send_msg return value in mtk_wed_wo_reset()
|
||||||
|
|
||||||
|
Fixes: 799684448e3e ("net: ethernet: mtk_wed: introduce wed wo support")
|
||||||
|
Fixes: 4c5de09eb0d0 ("net: ethernet: mtk_wed: add configure wed wo support")
|
||||||
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||||
|
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
|
||||||
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||||
|
---
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||||
|
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||||
|
@@ -174,9 +174,10 @@ mtk_wed_wo_reset(struct mtk_wed_device *
|
||||||
|
mtk_wdma_tx_reset(dev);
|
||||||
|
mtk_wed_reset(dev, MTK_WED_RESET_WED);
|
||||||
|
|
||||||
|
- mtk_wed_mcu_send_msg(wo, MTK_WED_MODULE_ID_WO,
|
||||||
|
- MTK_WED_WO_CMD_CHANGE_STATE, &state,
|
||||||
|
- sizeof(state), false);
|
||||||
|
+ if (mtk_wed_mcu_send_msg(wo, MTK_WED_MODULE_ID_WO,
|
||||||
|
+ MTK_WED_WO_CMD_CHANGE_STATE, &state,
|
||||||
|
+ sizeof(state), false))
|
||||||
|
+ return;
|
||||||
|
|
||||||
|
if (readx_poll_timeout(mtk_wed_wo_read_status, dev, val,
|
||||||
|
val == MTK_WED_WOIF_DISABLE_DONE,
|
||||||
|
@@ -632,9 +633,11 @@ mtk_wed_detach(struct mtk_wed_device *de
|
||||||
|
mtk_wed_free_tx_rings(dev);
|
||||||
|
|
||||||
|
if (mtk_wed_get_rx_capa(dev)) {
|
||||||
|
- mtk_wed_wo_reset(dev);
|
||||||
|
+ if (hw->wed_wo)
|
||||||
|
+ mtk_wed_wo_reset(dev);
|
||||||
|
mtk_wed_free_rx_rings(dev);
|
||||||
|
- mtk_wed_wo_deinit(hw);
|
||||||
|
+ if (hw->wed_wo)
|
||||||
|
+ mtk_wed_wo_deinit(hw);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dev->wlan.bus_type == MTK_WED_BUS_PCIE) {
|
||||||
|
--- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
|
||||||
|
+++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
|
||||||
|
@@ -207,6 +207,9 @@ int mtk_wed_mcu_msg_update(struct mtk_we
|
||||||
|
if (dev->hw->version == 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
+ if (WARN_ON(!wo))
|
||||||
|
+ return -ENODEV;
|
||||||
|
+
|
||||||
|
return mtk_wed_mcu_send_msg(wo, MTK_WED_MODULE_ID_WO, id, data, len,
|
||||||
|
true);
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||||
|
Date: Wed, 7 Dec 2022 15:04:55 +0100
|
||||||
|
Subject: [PATCH] net: ethernet: mtk_wed: fix possible deadlock if
|
||||||
|
mtk_wed_wo_init fails
|
||||||
|
|
||||||
|
Introduce __mtk_wed_detach() in order to avoid a deadlock in
|
||||||
|
mtk_wed_attach routine if mtk_wed_wo_init fails since both
|
||||||
|
mtk_wed_attach and mtk_wed_detach run holding hw_lock mutex.
|
||||||
|
|
||||||
|
Fixes: 4c5de09eb0d0 ("net: ethernet: mtk_wed: add configure wed wo support")
|
||||||
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||||
|
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
|
||||||
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||||
|
---
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||||
|
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||||
|
@@ -619,12 +619,10 @@ mtk_wed_deinit(struct mtk_wed_device *de
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
-mtk_wed_detach(struct mtk_wed_device *dev)
|
||||||
|
+__mtk_wed_detach(struct mtk_wed_device *dev)
|
||||||
|
{
|
||||||
|
struct mtk_wed_hw *hw = dev->hw;
|
||||||
|
|
||||||
|
- mutex_lock(&hw_lock);
|
||||||
|
-
|
||||||
|
mtk_wed_deinit(dev);
|
||||||
|
|
||||||
|
mtk_wdma_rx_reset(dev);
|
||||||
|
@@ -657,6 +655,13 @@ mtk_wed_detach(struct mtk_wed_device *de
|
||||||
|
module_put(THIS_MODULE);
|
||||||
|
|
||||||
|
hw->wed_dev = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+mtk_wed_detach(struct mtk_wed_device *dev)
|
||||||
|
+{
|
||||||
|
+ mutex_lock(&hw_lock);
|
||||||
|
+ __mtk_wed_detach(dev);
|
||||||
|
mutex_unlock(&hw_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1545,8 +1550,10 @@ mtk_wed_attach(struct mtk_wed_device *de
|
||||||
|
ret = mtk_wed_wo_init(hw);
|
||||||
|
}
|
||||||
|
out:
|
||||||
|
- if (ret)
|
||||||
|
- mtk_wed_detach(dev);
|
||||||
|
+ if (ret) {
|
||||||
|
+ dev_err(dev->hw->dev, "failed to attach wed device\n");
|
||||||
|
+ __mtk_wed_detach(dev);
|
||||||
|
+ }
|
||||||
|
unlock:
|
||||||
|
mutex_unlock(&hw_lock);
|
||||||
|
|
|
@ -38,7 +38,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
|
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
|
||||||
@@ -601,8 +601,7 @@ mtk_foe_entry_commit_subflow(struct mtk_
|
@@ -621,8 +621,7 @@ mtk_foe_entry_commit_subflow(struct mtk_
|
||||||
u32 ib1_mask = mtk_get_ib1_pkt_type_mask(ppe->eth) | MTK_FOE_IB1_UDP;
|
u32 ib1_mask = mtk_get_ib1_pkt_type_mask(ppe->eth) | MTK_FOE_IB1_UDP;
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_ppe.h
|
--- a/drivers/net/ethernet/mediatek/mtk_ppe.h
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
|
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
|
||||||
@@ -277,7 +277,6 @@ struct mtk_flow_entry {
|
@@ -279,7 +279,6 @@ struct mtk_flow_entry {
|
||||||
struct {
|
struct {
|
||||||
struct mtk_flow_entry *base_flow;
|
struct mtk_flow_entry *base_flow;
|
||||||
struct hlist_node list;
|
struct hlist_node list;
|
||||||
|
|
|
@ -34,7 +34,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||||
@@ -1027,11 +1027,13 @@ struct mtk_soc_data {
|
@@ -1062,11 +1062,13 @@ struct mtk_soc_data {
|
||||||
* @regmap: The register map pointing at the range used to setup
|
* @regmap: The register map pointing at the range used to setup
|
||||||
* SGMII modes
|
* SGMII modes
|
||||||
* @ana_rgc3: The offset refers to register ANA_RGC3 related to regmap
|
* @ana_rgc3: The offset refers to register ANA_RGC3 related to regmap
|
||||||
|
|
|
@ -24,7 +24,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||||
@@ -496,7 +496,7 @@
|
@@ -523,7 +523,7 @@
|
||||||
#define SGMII_SPEED_10 FIELD_PREP(SGMII_SPEED_MASK, 0)
|
#define SGMII_SPEED_10 FIELD_PREP(SGMII_SPEED_MASK, 0)
|
||||||
#define SGMII_SPEED_100 FIELD_PREP(SGMII_SPEED_MASK, 1)
|
#define SGMII_SPEED_100 FIELD_PREP(SGMII_SPEED_MASK, 1)
|
||||||
#define SGMII_SPEED_1000 FIELD_PREP(SGMII_SPEED_MASK, 2)
|
#define SGMII_SPEED_1000 FIELD_PREP(SGMII_SPEED_MASK, 2)
|
||||||
|
|
|
@ -33,7 +33,7 @@ Submitted-by: Daniel Golle <daniel@makrotopia.org>
|
||||||
|
|
||||||
#define QUECTEL_VENDOR_ID 0x2c7c
|
#define QUECTEL_VENDOR_ID 0x2c7c
|
||||||
/* These Quectel products use Quectel's vendor ID */
|
/* These Quectel products use Quectel's vendor ID */
|
||||||
@@ -1162,6 +1164,11 @@ static const struct usb_device_id option
|
@@ -1164,6 +1166,11 @@ static const struct usb_device_id option
|
||||||
.driver_info = ZLP },
|
.driver_info = ZLP },
|
||||||
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
|
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
|
||||||
.driver_info = RSVD(4) },
|
.driver_info = RSVD(4) },
|
||||||
|
|
|
@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
@@ -2823,8 +2823,8 @@ static irqreturn_t mtk_handle_irq_rx(int
|
@@ -2971,8 +2971,8 @@ static irqreturn_t mtk_handle_irq_rx(int
|
||||||
|
|
||||||
eth->rx_events++;
|
eth->rx_events++;
|
||||||
if (likely(napi_schedule_prep(ð->rx_napi))) {
|
if (likely(napi_schedule_prep(ð->rx_napi))) {
|
||||||
|
@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
}
|
}
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
@@ -2836,8 +2836,8 @@ static irqreturn_t mtk_handle_irq_tx(int
|
@@ -2984,8 +2984,8 @@ static irqreturn_t mtk_handle_irq_tx(int
|
||||||
|
|
||||||
eth->tx_events++;
|
eth->tx_events++;
|
||||||
if (likely(napi_schedule_prep(ð->tx_napi))) {
|
if (likely(napi_schedule_prep(ð->tx_napi))) {
|
||||||
|
@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
}
|
}
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
@@ -4350,6 +4350,8 @@ static int mtk_probe(struct platform_dev
|
@@ -4616,6 +4616,8 @@ static int mtk_probe(struct platform_dev
|
||||||
* for NAPI to work
|
* for NAPI to work
|
||||||
*/
|
*/
|
||||||
init_dummy_netdev(ð->dummy_dev);
|
init_dummy_netdev(ð->dummy_dev);
|
||||||
|
|
|
@ -12,9 +12,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
||||||
--- a/net/dsa/tag_mtk.c
|
--- a/net/dsa/tag_mtk.c
|
||||||
+++ b/net/dsa/tag_mtk.c
|
+++ b/net/dsa/tag_mtk.c
|
||||||
@@ -25,6 +25,13 @@ static struct sk_buff *mtk_tag_xmit(stru
|
@@ -27,6 +27,13 @@ static struct sk_buff *mtk_tag_xmit(stru
|
||||||
u8 xmit_tpid;
|
|
||||||
u8 *mtk_tag;
|
skb_set_queue_mapping(skb, dp->index);
|
||||||
|
|
||||||
+ /* The Ethernet switch we are interfaced with needs packets to be at
|
+ /* The Ethernet switch we are interfaced with needs packets to be at
|
||||||
+ * least 64 bytes (including FCS) otherwise their padding might be
|
+ * least 64 bytes (including FCS) otherwise their padding might be
|
||||||
|
|
|
@ -53,7 +53,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
@@ -4320,7 +4320,9 @@ static int mtk_probe(struct platform_dev
|
@@ -4586,7 +4586,9 @@ static int mtk_probe(struct platform_dev
|
||||||
u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400;
|
u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400;
|
||||||
|
|
||||||
eth->ppe[i] = mtk_ppe_init(eth, eth->base + ppe_addr,
|
eth->ppe[i] = mtk_ppe_init(eth, eth->base + ppe_addr,
|
||||||
|
@ -64,7 +64,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
if (!eth->ppe[i]) {
|
if (!eth->ppe[i]) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto err_free_dev;
|
goto err_free_dev;
|
||||||
@@ -4445,6 +4447,7 @@ static const struct mtk_soc_data mt7622_
|
@@ -4711,6 +4713,7 @@ static const struct mtk_soc_data mt7622_
|
||||||
.required_pctl = false,
|
.required_pctl = false,
|
||||||
.offload_version = 2,
|
.offload_version = 2,
|
||||||
.hash_offset = 2,
|
.hash_offset = 2,
|
||||||
|
@ -72,7 +72,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
.foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
|
.foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
|
||||||
.txrx = {
|
.txrx = {
|
||||||
.txd_size = sizeof(struct mtk_tx_dma),
|
.txd_size = sizeof(struct mtk_tx_dma),
|
||||||
@@ -4482,6 +4485,7 @@ static const struct mtk_soc_data mt7629_
|
@@ -4748,6 +4751,7 @@ static const struct mtk_soc_data mt7629_
|
||||||
.hw_features = MTK_HW_FEATURES,
|
.hw_features = MTK_HW_FEATURES,
|
||||||
.required_clks = MT7629_CLKS_BITMAP,
|
.required_clks = MT7629_CLKS_BITMAP,
|
||||||
.required_pctl = false,
|
.required_pctl = false,
|
||||||
|
@ -80,7 +80,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
.txrx = {
|
.txrx = {
|
||||||
.txd_size = sizeof(struct mtk_tx_dma),
|
.txd_size = sizeof(struct mtk_tx_dma),
|
||||||
.rxd_size = sizeof(struct mtk_rx_dma),
|
.rxd_size = sizeof(struct mtk_rx_dma),
|
||||||
@@ -4502,6 +4506,7 @@ static const struct mtk_soc_data mt7986_
|
@@ -4768,6 +4772,7 @@ static const struct mtk_soc_data mt7986_
|
||||||
.offload_version = 2,
|
.offload_version = 2,
|
||||||
.hash_offset = 4,
|
.hash_offset = 4,
|
||||||
.foe_entry_size = sizeof(struct mtk_foe_entry),
|
.foe_entry_size = sizeof(struct mtk_foe_entry),
|
||||||
|
@ -90,7 +90,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
.rxd_size = sizeof(struct mtk_rx_dma_v2),
|
.rxd_size = sizeof(struct mtk_rx_dma_v2),
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||||
@@ -1007,6 +1007,7 @@ struct mtk_soc_data {
|
@@ -1042,6 +1042,7 @@ struct mtk_soc_data {
|
||||||
u8 hash_offset;
|
u8 hash_offset;
|
||||||
u16 foe_entry_size;
|
u16 foe_entry_size;
|
||||||
netdev_features_t hw_features;
|
netdev_features_t hw_features;
|
||||||
|
@ -147,7 +147,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
static void mtk_ppe_cache_clear(struct mtk_ppe *ppe)
|
static void mtk_ppe_cache_clear(struct mtk_ppe *ppe)
|
||||||
{
|
{
|
||||||
ppe_set(ppe, MTK_PPE_CACHE_CTL, MTK_PPE_CACHE_CTL_CLEAR);
|
ppe_set(ppe, MTK_PPE_CACHE_CTL, MTK_PPE_CACHE_CTL_CLEAR);
|
||||||
@@ -444,6 +484,13 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp
|
@@ -464,6 +504,13 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp
|
||||||
hwe->ib1 &= ~MTK_FOE_IB1_STATE;
|
hwe->ib1 &= ~MTK_FOE_IB1_STATE;
|
||||||
hwe->ib1 |= FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_INVALID);
|
hwe->ib1 |= FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_INVALID);
|
||||||
dma_wmb();
|
dma_wmb();
|
||||||
|
@ -161,7 +161,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
}
|
}
|
||||||
entry->hash = 0xffff;
|
entry->hash = 0xffff;
|
||||||
|
|
||||||
@@ -551,6 +598,9 @@ __mtk_foe_entry_commit(struct mtk_ppe *p
|
@@ -571,6 +618,9 @@ __mtk_foe_entry_commit(struct mtk_ppe *p
|
||||||
wmb();
|
wmb();
|
||||||
hwe->ib1 = entry->ib1;
|
hwe->ib1 = entry->ib1;
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
dma_wmb();
|
dma_wmb();
|
||||||
|
|
||||||
mtk_ppe_cache_clear(ppe);
|
mtk_ppe_cache_clear(ppe);
|
||||||
@@ -742,14 +792,42 @@ int mtk_ppe_prepare_reset(struct mtk_ppe
|
@@ -762,14 +812,42 @@ int mtk_ppe_prepare_reset(struct mtk_ppe
|
||||||
return mtk_ppe_wait_busy(ppe);
|
return mtk_ppe_wait_busy(ppe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
|
|
||||||
ppe = devm_kzalloc(dev, sizeof(*ppe), GFP_KERNEL);
|
ppe = devm_kzalloc(dev, sizeof(*ppe), GFP_KERNEL);
|
||||||
if (!ppe)
|
if (!ppe)
|
||||||
@@ -764,6 +842,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_
|
@@ -784,6 +862,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_
|
||||||
ppe->eth = eth;
|
ppe->eth = eth;
|
||||||
ppe->dev = dev;
|
ppe->dev = dev;
|
||||||
ppe->version = version;
|
ppe->version = version;
|
||||||
|
@ -223,7 +223,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
|
|
||||||
foe = dmam_alloc_coherent(ppe->dev,
|
foe = dmam_alloc_coherent(ppe->dev,
|
||||||
MTK_PPE_ENTRIES * soc->foe_entry_size,
|
MTK_PPE_ENTRIES * soc->foe_entry_size,
|
||||||
@@ -779,6 +858,25 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_
|
@@ -799,6 +878,25 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_
|
||||||
if (!ppe->foe_flow)
|
if (!ppe->foe_flow)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
mtk_ppe_debugfs_init(ppe, index);
|
mtk_ppe_debugfs_init(ppe, index);
|
||||||
|
|
||||||
return ppe;
|
return ppe;
|
||||||
@@ -893,6 +991,16 @@ void mtk_ppe_start(struct mtk_ppe *ppe)
|
@@ -913,6 +1011,16 @@ void mtk_ppe_start(struct mtk_ppe *ppe)
|
||||||
ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT1, 0xcb777);
|
ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT1, 0xcb777);
|
||||||
ppe_w32(ppe, MTK_PPE_SBW_CTRL, 0x7f);
|
ppe_w32(ppe, MTK_PPE_SBW_CTRL, 0x7f);
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
#define MTK_FOE_IB2_WDMA_DEVIDX BIT(16)
|
#define MTK_FOE_IB2_WDMA_DEVIDX BIT(16)
|
||||||
#define MTK_FOE_IB2_WDMA_WINFO BIT(17)
|
#define MTK_FOE_IB2_WDMA_WINFO BIT(17)
|
||||||
|
|
||||||
@@ -283,16 +284,34 @@ struct mtk_flow_entry {
|
@@ -285,16 +286,34 @@ struct mtk_flow_entry {
|
||||||
unsigned long cookie;
|
unsigned long cookie;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
u16 foe_check_time[MTK_PPE_ENTRIES];
|
u16 foe_check_time[MTK_PPE_ENTRIES];
|
||||||
struct hlist_head *foe_flow;
|
struct hlist_head *foe_flow;
|
||||||
|
|
||||||
@@ -302,7 +321,7 @@ struct mtk_ppe {
|
@@ -304,7 +323,7 @@ struct mtk_ppe {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base,
|
struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base,
|
||||||
|
@ -320,7 +320,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
void mtk_ppe_start(struct mtk_ppe *ppe);
|
void mtk_ppe_start(struct mtk_ppe *ppe);
|
||||||
int mtk_ppe_stop(struct mtk_ppe *ppe);
|
int mtk_ppe_stop(struct mtk_ppe *ppe);
|
||||||
int mtk_ppe_prepare_reset(struct mtk_ppe *ppe);
|
int mtk_ppe_prepare_reset(struct mtk_ppe *ppe);
|
||||||
@@ -354,5 +373,7 @@ int mtk_foe_entry_commit(struct mtk_ppe
|
@@ -358,5 +377,7 @@ int mtk_foe_entry_commit(struct mtk_ppe
|
||||||
void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
|
void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
|
||||||
int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
|
int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
|
||||||
int mtk_ppe_debugfs_init(struct mtk_ppe *ppe, int index);
|
int mtk_ppe_debugfs_init(struct mtk_ppe *ppe, int index);
|
||||||
|
@ -363,7 +363,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
return 0;
|
return 0;
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
|
--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
|
||||||
@@ -491,6 +491,7 @@ static int
|
@@ -497,6 +497,7 @@ static int
|
||||||
mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f)
|
mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f)
|
||||||
{
|
{
|
||||||
struct mtk_flow_entry *entry;
|
struct mtk_flow_entry *entry;
|
||||||
|
@ -371,7 +371,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
|
||||||
u32 idle;
|
u32 idle;
|
||||||
|
|
||||||
entry = rhashtable_lookup(ð->flow_table, &f->cookie,
|
entry = rhashtable_lookup(ð->flow_table, &f->cookie,
|
||||||
@@ -501,6 +502,12 @@ mtk_flow_offload_stats(struct mtk_eth *e
|
@@ -507,6 +508,12 @@ mtk_flow_offload_stats(struct mtk_eth *e
|
||||||
idle = mtk_foe_entry_idle_time(eth->ppe[entry->ppe_index], entry);
|
idle = mtk_foe_entry_idle_time(eth->ppe[entry->ppe_index], entry);
|
||||||
f->stats.lastused = jiffies - idle * HZ;
|
f->stats.lastused = jiffies - idle * HZ;
|
||||||
|
|
||||||
|
|
|
@ -17,27 +17,42 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||||
@@ -2001,29 +2001,16 @@ static int mtk_poll_rx(struct napi_struc
|
@@ -1829,9 +1829,7 @@ static int mtk_poll_rx(struct napi_struc
|
||||||
if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
|
|
||||||
mtk_ppe_check_skb(eth->ppe[0], skb, hash);
|
|
||||||
|
|
||||||
|
while (done < budget) {
|
||||||
|
unsigned int pktlen, *rxdcsum;
|
||||||
|
- bool has_hwaccel_tag = false;
|
||||||
|
struct net_device *netdev;
|
||||||
|
- u16 vlan_proto, vlan_tci;
|
||||||
|
dma_addr_t dma_addr;
|
||||||
|
u32 hash, reason;
|
||||||
|
int mac = 0;
|
||||||
|
@@ -1966,36 +1964,21 @@ static int mtk_poll_rx(struct napi_struc
|
||||||
|
skb_checksum_none_assert(skb);
|
||||||
|
skb->protocol = eth_type_trans(skb, netdev);
|
||||||
|
|
||||||
|
- if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
|
||||||
|
- mtk_ppe_check_skb(eth->ppe[0], skb, hash);
|
||||||
|
-
|
||||||
- if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
|
- if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
|
||||||
- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
|
- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
|
||||||
- if (trxd.rxd3 & RX_DMA_VTAG_V2)
|
- if (trxd.rxd3 & RX_DMA_VTAG_V2) {
|
||||||
- __vlan_hwaccel_put_tag(skb,
|
- vlan_proto = RX_DMA_VPID(trxd.rxd4);
|
||||||
- htons(RX_DMA_VPID(trxd.rxd4)),
|
- vlan_tci = RX_DMA_VID(trxd.rxd4);
|
||||||
- RX_DMA_VID(trxd.rxd4));
|
- has_hwaccel_tag = true;
|
||||||
|
- }
|
||||||
- } else if (trxd.rxd2 & RX_DMA_VTAG) {
|
- } else if (trxd.rxd2 & RX_DMA_VTAG) {
|
||||||
- __vlan_hwaccel_put_tag(skb, htons(RX_DMA_VPID(trxd.rxd3)),
|
- vlan_proto = RX_DMA_VPID(trxd.rxd3);
|
||||||
- RX_DMA_VID(trxd.rxd3));
|
- vlan_tci = RX_DMA_VID(trxd.rxd3);
|
||||||
|
- has_hwaccel_tag = true;
|
||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
/* When using VLAN untagging in combination with DSA, the
|
/* When using VLAN untagging in combination with DSA, the
|
||||||
* hardware treats the MTK special tag as a VLAN and untags it.
|
* hardware treats the MTK special tag as a VLAN and untags it.
|
||||||
*/
|
*/
|
||||||
- if (skb_vlan_tag_present(skb) && netdev_uses_dsa(netdev)) {
|
- if (has_hwaccel_tag && netdev_uses_dsa(netdev)) {
|
||||||
- unsigned int port = ntohs(skb->vlan_proto) & GENMASK(2, 0);
|
- unsigned int port = vlan_proto & GENMASK(2, 0);
|
||||||
+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) &&
|
+ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) &&
|
||||||
+ (trxd.rxd2 & RX_DMA_VTAG) && netdev_uses_dsa(netdev)) {
|
+ (trxd.rxd2 & RX_DMA_VTAG) && netdev_uses_dsa(netdev)) {
|
||||||
+ unsigned int port = RX_DMA_VPID(trxd.rxd3) & GENMASK(2, 0);
|
+ unsigned int port = RX_DMA_VPID(trxd.rxd3) & GENMASK(2, 0);
|
||||||
|
@ -45,12 +60,17 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
if (port < ARRAY_SIZE(eth->dsa_meta) &&
|
if (port < ARRAY_SIZE(eth->dsa_meta) &&
|
||||||
eth->dsa_meta[port])
|
eth->dsa_meta[port])
|
||||||
skb_dst_set_noref(skb, ð->dsa_meta[port]->dst);
|
skb_dst_set_noref(skb, ð->dsa_meta[port]->dst);
|
||||||
-
|
- } else if (has_hwaccel_tag) {
|
||||||
- __vlan_hwaccel_clear_tag(skb);
|
- __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vlan_tci);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
|
||||||
|
+ mtk_ppe_check_skb(eth->ppe[0], skb, hash);
|
||||||
|
+
|
||||||
skb_record_rx_queue(skb, 0);
|
skb_record_rx_queue(skb, 0);
|
||||||
@@ -2840,29 +2827,11 @@ static netdev_features_t mtk_fix_feature
|
napi_gro_receive(napi, skb);
|
||||||
|
|
||||||
|
@@ -2810,29 +2793,11 @@ static netdev_features_t mtk_fix_feature
|
||||||
|
|
||||||
static int mtk_set_features(struct net_device *dev, netdev_features_t features)
|
static int mtk_set_features(struct net_device *dev, netdev_features_t features)
|
||||||
{
|
{
|
||||||
|
@ -80,7 +100,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3176,30 +3145,6 @@ static int mtk_open(struct net_device *d
|
@@ -3146,30 +3111,6 @@ static int mtk_open(struct net_device *d
|
||||||
struct mtk_eth *eth = mac->hw;
|
struct mtk_eth *eth = mac->hw;
|
||||||
int i, err;
|
int i, err;
|
||||||
|
|
||||||
|
@ -111,7 +131,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0);
|
err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
netdev_err(dev, "%s: could not attach PHY: %d\n", __func__,
|
netdev_err(dev, "%s: could not attach PHY: %d\n", __func__,
|
||||||
@@ -3240,6 +3185,35 @@ static int mtk_open(struct net_device *d
|
@@ -3210,6 +3151,35 @@ static int mtk_open(struct net_device *d
|
||||||
phylink_start(mac->phylink);
|
phylink_start(mac->phylink);
|
||||||
netif_tx_start_all_queues(dev);
|
netif_tx_start_all_queues(dev);
|
||||||
|
|
||||||
|
@ -147,7 +167,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3724,10 +3698,9 @@ static int mtk_hw_init(struct mtk_eth *e
|
@@ -3694,10 +3664,9 @@ static int mtk_hw_init(struct mtk_eth *e
|
||||||
if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
|
if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
|
||||||
val = mtk_r32(eth, MTK_CDMP_IG_CTRL);
|
val = mtk_r32(eth, MTK_CDMP_IG_CTRL);
|
||||||
mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL);
|
mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL);
|
||||||
|
@ -160,7 +180,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
||||||
/* set interrupt delays based on current Net DIM sample */
|
/* set interrupt delays based on current Net DIM sample */
|
||||||
mtk_dim_rx(ð->rx_dim.work);
|
mtk_dim_rx(ð->rx_dim.work);
|
||||||
@@ -4365,7 +4338,7 @@ static int mtk_add_mac(struct mtk_eth *e
|
@@ -4335,7 +4304,7 @@ static int mtk_add_mac(struct mtk_eth *e
|
||||||
eth->netdev[id]->hw_features |= NETIF_F_LRO;
|
eth->netdev[id]->hw_features |= NETIF_F_LRO;
|
||||||
|
|
||||||
eth->netdev[id]->vlan_features = eth->soc->hw_features &
|
eth->netdev[id]->vlan_features = eth->soc->hw_features &
|
||||||
|
@ -176,6 +196,6 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
NETIF_F_RXCSUM | \
|
NETIF_F_RXCSUM | \
|
||||||
NETIF_F_HW_VLAN_CTAG_TX | \
|
NETIF_F_HW_VLAN_CTAG_TX | \
|
||||||
- NETIF_F_HW_VLAN_CTAG_RX | \
|
- NETIF_F_HW_VLAN_CTAG_RX | \
|
||||||
NETIF_F_SG | NETIF_F_ALL_TSO | \
|
NETIF_F_SG | NETIF_F_TSO | \
|
||||||
|
NETIF_F_TSO6 | \
|
||||||
NETIF_F_IPV6_CSUM |\
|
NETIF_F_IPV6_CSUM |\
|
||||||
NETIF_F_HW_TC)
|
|
|
@ -9,10 +9,10 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
||||||
@@ -49,8 +49,7 @@
|
@@ -48,8 +48,7 @@
|
||||||
|
#define MTK_HW_FEATURES (NETIF_F_IP_CSUM | \
|
||||||
NETIF_F_RXCSUM | \
|
NETIF_F_RXCSUM | \
|
||||||
NETIF_F_HW_VLAN_CTAG_TX | \
|
NETIF_F_HW_VLAN_CTAG_TX | \
|
||||||
NETIF_F_HW_VLAN_CTAG_RX | \
|
|
||||||
- NETIF_F_SG | NETIF_F_TSO | \
|
- NETIF_F_SG | NETIF_F_TSO | \
|
||||||
- NETIF_F_TSO6 | \
|
- NETIF_F_TSO6 | \
|
||||||
+ NETIF_F_SG | NETIF_F_ALL_TSO | \
|
+ NETIF_F_SG | NETIF_F_ALL_TSO | \
|
|
@ -10,28 +10,6 @@ Fixes: 2d7605a72906 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging"
|
||||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||||
---
|
---
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
||||||
@@ -1998,9 +1998,6 @@ static int mtk_poll_rx(struct napi_struc
|
|
||||||
skb_checksum_none_assert(skb);
|
|
||||||
skb->protocol = eth_type_trans(skb, netdev);
|
|
||||||
|
|
||||||
- if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
|
|
||||||
- mtk_ppe_check_skb(eth->ppe[0], skb, hash);
|
|
||||||
-
|
|
||||||
/* When using VLAN untagging in combination with DSA, the
|
|
||||||
* hardware treats the MTK special tag as a VLAN and untags it.
|
|
||||||
*/
|
|
||||||
@@ -2013,6 +2010,9 @@ static int mtk_poll_rx(struct napi_struc
|
|
||||||
skb_dst_set_noref(skb, ð->dsa_meta[port]->dst);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
|
|
||||||
+ mtk_ppe_check_skb(eth->ppe[0], skb, hash);
|
|
||||||
+
|
|
||||||
skb_record_rx_queue(skb, 0);
|
|
||||||
napi_gro_receive(napi, skb);
|
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
|
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
|
||||||
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
|
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
|
||||||
@@ -8,6 +8,7 @@
|
@@ -8,6 +8,7 @@
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "qcom-ipq8064-smb208.dtsi"
|
#include "qcom-ipq8064-smb208.dtsi"
|
||||||
#include <dt-bindings/gpio/gpio.h>
|
#include <dt-bindings/gpio/gpio.h>
|
||||||
|
#include <dt-bindings/input/input.h>
|
||||||
#include <dt-bindings/soc/qcom,tcsr.h>
|
#include <dt-bindings/soc/qcom,tcsr.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
|
@ -30,6 +31,28 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
keys {
|
||||||
|
compatible = "gpio-keys";
|
||||||
|
pinctrl-0 = <&button_pins>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
|
||||||
|
reset {
|
||||||
|
label = "reset";
|
||||||
|
gpios = <&qcom_pinmux 16 GPIO_ACTIVE_LOW>;
|
||||||
|
linux,code = <KEY_RESTART>;
|
||||||
|
debounce-interval = <60>;
|
||||||
|
wakeup-source;
|
||||||
|
};
|
||||||
|
|
||||||
|
dev {
|
||||||
|
label = "dev";
|
||||||
|
gpios = <&qcom_pinmux 15 GPIO_ACTIVE_LOW>;
|
||||||
|
linux,code = <KEY_CONFIG>;
|
||||||
|
debounce-interval = <60>;
|
||||||
|
wakeup-source;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
mdio: mdio {
|
mdio: mdio {
|
||||||
compatible = "virtual,mdio-gpio";
|
compatible = "virtual,mdio-gpio";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
|
@ -227,12 +250,17 @@
|
||||||
pins = "gpio17";
|
pins = "gpio17";
|
||||||
output-low;
|
output-low;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
button_pins: button_pins {
|
||||||
recovery {
|
recovery {
|
||||||
pins = "gpio16";
|
pins = "gpio16";
|
||||||
|
function = "gpio";
|
||||||
bias-none;
|
bias-none;
|
||||||
};
|
};
|
||||||
developer {
|
developer {
|
||||||
pins = "gpio15";
|
pins = "gpio15";
|
||||||
|
function = "gpio";
|
||||||
bias-none;
|
bias-none;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,7 +29,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
|
|
||||||
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
||||||
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
||||||
@@ -5046,6 +5046,10 @@ int stmmac_dvr_probe(struct device *devi
|
@@ -5047,6 +5047,10 @@ int stmmac_dvr_probe(struct device *devi
|
||||||
reset_control_reset(priv->plat->stmmac_rst);
|
reset_control_reset(priv->plat->stmmac_rst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
/* Init MAC and get the capabilities */
|
/* Init MAC and get the capabilities */
|
||||||
ret = stmmac_hw_init(priv);
|
ret = stmmac_hw_init(priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -5260,6 +5264,7 @@ int stmmac_dvr_remove(struct device *dev
|
@@ -5261,6 +5265,7 @@ int stmmac_dvr_remove(struct device *dev
|
||||||
phylink_destroy(priv->phylink);
|
phylink_destroy(priv->phylink);
|
||||||
if (priv->plat->stmmac_rst)
|
if (priv->plat->stmmac_rst)
|
||||||
reset_control_assert(priv->plat->stmmac_rst);
|
reset_control_assert(priv->plat->stmmac_rst);
|
||||||
|
|
|
@ -86,6 +86,46 @@
|
||||||
no-map;
|
no-map;
|
||||||
reg = <0 0x4fc00000 0 0x00100000>;
|
reg = <0 0x4fc00000 0 0x00100000>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
wo_emi0: wo-emi@4fd00000 {
|
||||||
|
reg = <0 0x4fd00000 0 0x40000>;
|
||||||
|
no-map;
|
||||||
|
};
|
||||||
|
|
||||||
|
wo_emi1: wo-emi@4fd40000 {
|
||||||
|
reg = <0 0x4fd40000 0 0x40000>;
|
||||||
|
no-map;
|
||||||
|
};
|
||||||
|
|
||||||
|
wo_ilm0: wo-ilm@151e0000 {
|
||||||
|
reg = <0 0x151e0000 0 0x8000>;
|
||||||
|
no-map;
|
||||||
|
};
|
||||||
|
|
||||||
|
wo_ilm1: wo-ilm@151f0000 {
|
||||||
|
reg = <0 0x151f0000 0 0x8000>;
|
||||||
|
no-map;
|
||||||
|
};
|
||||||
|
|
||||||
|
wo_data: wo-data@4fd80000 {
|
||||||
|
reg = <0 0x4fd80000 0 0x240000>;
|
||||||
|
no-map;
|
||||||
|
};
|
||||||
|
|
||||||
|
wo_dlm0: wo-dlm@151e8000 {
|
||||||
|
reg = <0 0x151e8000 0 0x2000>;
|
||||||
|
no-map;
|
||||||
|
};
|
||||||
|
|
||||||
|
wo_dlm1: wo-dlm@151f8000 {
|
||||||
|
reg = <0 0x151f8000 0 0x2000>;
|
||||||
|
no-map;
|
||||||
|
};
|
||||||
|
|
||||||
|
wo_boot: wo-boot@15194000 {
|
||||||
|
reg = <0 0x15194000 0 0x1000>;
|
||||||
|
no-map;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
timer {
|
timer {
|
||||||
|
@ -577,12 +617,18 @@
|
||||||
reg = <0 0x10003000 0 0x10>;
|
reg = <0 0x10003000 0 0x10>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
wed0: wed@15010000 {
|
wed0: wed@15010000 {
|
||||||
compatible = "mediatek,mt7986-wed",
|
compatible = "mediatek,mt7986-wed",
|
||||||
"syscon";
|
"syscon";
|
||||||
reg = <0 0x15010000 0 0x1000>;
|
reg = <0 0x15010000 0 0x1000>;
|
||||||
interrupt-parent = <&gic>;
|
interrupt-parent = <&gic>;
|
||||||
interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
|
interrupts = <GIC_SPI 205 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
memory-region = <&wo_emi0>, <&wo_ilm0>, <&wo_dlm0>,
|
||||||
|
<&wo_data>, <&wo_boot>;
|
||||||
|
memory-region-names = "wo-emi", "wo-ilm", "wo-dlm",
|
||||||
|
"wo-data", "wo-boot";
|
||||||
|
mediatek,wo-ccif = <&wo_ccif0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
wed1: wed@15011000 {
|
wed1: wed@15011000 {
|
||||||
|
@ -591,6 +637,25 @@
|
||||||
reg = <0 0x15011000 0 0x1000>;
|
reg = <0 0x15011000 0 0x1000>;
|
||||||
interrupt-parent = <&gic>;
|
interrupt-parent = <&gic>;
|
||||||
interrupts = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
|
interrupts = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
memory-region = <&wo_emi1>, <&wo_ilm1>, <&wo_dlm1>,
|
||||||
|
<&wo_data>, <&wo_boot>;
|
||||||
|
memory-region-names = "wo-emi", "wo-ilm", "wo-dlm",
|
||||||
|
"wo-data", "wo-boot";
|
||||||
|
mediatek,wo-ccif = <&wo_ccif1>;
|
||||||
|
};
|
||||||
|
|
||||||
|
wo_ccif0: syscon@151a5000 {
|
||||||
|
compatible = "mediatek,mt7986-wo-ccif", "syscon";
|
||||||
|
reg = <0 0x151a5000 0 0x1000>;
|
||||||
|
interrupt-parent = <&gic>;
|
||||||
|
interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
};
|
||||||
|
|
||||||
|
wo_ccif1: syscon@151ad000 {
|
||||||
|
compatible = "mediatek,mt7986-wo-ccif", "syscon";
|
||||||
|
reg = <0 0x151ad000 0 0x1000>;
|
||||||
|
interrupt-parent = <&gic>;
|
||||||
|
interrupts = <GIC_SPI 212 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
};
|
};
|
||||||
|
|
||||||
eth: ethernet@15100000 {
|
eth: ethernet@15100000 {
|
||||||
|
|
|
@ -21,6 +21,9 @@ tplink,tl-wdr4900-v1)
|
||||||
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
|
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
|
||||||
ucidef_set_interface_macaddr "wan" "$(macaddr_add $(mtd_get_mac_binary u-boot 0x4fc00) 1)"
|
ucidef_set_interface_macaddr "wan" "$(macaddr_add $(mtd_get_mac_binary u-boot 0x4fc00) 1)"
|
||||||
;;
|
;;
|
||||||
|
watchguard,firebox-t10)
|
||||||
|
ucidef_set_interfaces_lan_wan "eth1 eth2" "eth0"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -6,6 +6,11 @@ preinit_set_mac_address() {
|
||||||
ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr)
|
ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr)
|
||||||
ip link set dev eth1 address $(mtd_get_mac_ascii cfg1 eth1addr)
|
ip link set dev eth1 address $(mtd_get_mac_ascii cfg1 eth1addr)
|
||||||
;;
|
;;
|
||||||
|
watchguard,firebox-t10)
|
||||||
|
ip link set dev eth0 address "$(mtd_get_mac_text "device_id" 0x1830)"
|
||||||
|
ip link set dev eth1 address "$(mtd_get_mac_text "device_id" 0x1844)"
|
||||||
|
ip link set dev eth2 address "$(mtd_get_mac_text "device_id" 0x1858)"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ platform_do_upgrade() {
|
||||||
|
|
||||||
case "$board" in
|
case "$board" in
|
||||||
ocedo,panda|\
|
ocedo,panda|\
|
||||||
sophos,red-15w-rev1)
|
sophos,red-15w-rev1|\
|
||||||
|
watchguard,firebox-t10)
|
||||||
nand_do_upgrade "$1"
|
nand_do_upgrade "$1"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
@ -247,6 +247,7 @@ CONFIG_THREAD_SHIFT=13
|
||||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||||
CONFIG_TINY_SRCU=y
|
CONFIG_TINY_SRCU=y
|
||||||
# CONFIG_TL_WDR4900_V1 is not set
|
# CONFIG_TL_WDR4900_V1 is not set
|
||||||
|
# CONFIG_FIREBOX_T10 is not set
|
||||||
# CONFIG_TOOLCHAIN_DEFAULT_CPU is not set
|
# CONFIG_TOOLCHAIN_DEFAULT_CPU is not set
|
||||||
# CONFIG_TQM8540 is not set
|
# CONFIG_TQM8540 is not set
|
||||||
# CONFIG_TQM8541 is not set
|
# CONFIG_TQM8541 is not set
|
||||||
|
|
|
@ -266,3 +266,4 @@ CONFIG_WATCHDOG_CORE=y
|
||||||
# CONFIG_XES_MPC85xx is not set
|
# CONFIG_XES_MPC85xx is not set
|
||||||
CONFIG_XZ_DEC_BCJ=y
|
CONFIG_XZ_DEC_BCJ=y
|
||||||
CONFIG_XZ_DEC_POWERPC=y
|
CONFIG_XZ_DEC_POWERPC=y
|
||||||
|
# CONFIG_FIREBOX_T10 is not set
|
||||||
|
|
268
target/linux/mpc85xx/files/arch/powerpc/boot/dts/firebox-t10.dts
Normal file
268
target/linux/mpc85xx/files/arch/powerpc/boot/dts/firebox-t10.dts
Normal file
|
@ -0,0 +1,268 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later or MIT
|
||||||
|
|
||||||
|
#include <dt-bindings/input/input.h>
|
||||||
|
#include <dt-bindings/gpio/gpio.h>
|
||||||
|
|
||||||
|
/include/ "fsl/p1010si-pre.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "Watchguard Firebox T10";
|
||||||
|
compatible = "watchguard,firebox-t10";
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
bootargs = "console=ttyS0,115200";
|
||||||
|
bootargs-override = "console=ttyS0,115200";
|
||||||
|
};
|
||||||
|
|
||||||
|
aliases {
|
||||||
|
spi0 = &spi0;
|
||||||
|
led-boot = &led_mode;
|
||||||
|
led-failsafe = &led_failover;
|
||||||
|
led-running = &led_mode;
|
||||||
|
led-upgrade = &led_attention;
|
||||||
|
};
|
||||||
|
|
||||||
|
memory {
|
||||||
|
device_type = "memory";
|
||||||
|
};
|
||||||
|
|
||||||
|
leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
|
||||||
|
led_attention: attention_orange {
|
||||||
|
gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
|
||||||
|
label = "orange:attention";
|
||||||
|
};
|
||||||
|
|
||||||
|
status_red {
|
||||||
|
gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
|
||||||
|
label = "red:status";
|
||||||
|
};
|
||||||
|
|
||||||
|
led_mode: mode_green {
|
||||||
|
gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
|
||||||
|
label = "green:mode";
|
||||||
|
};
|
||||||
|
|
||||||
|
led_failover: failover_green {
|
||||||
|
gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
|
||||||
|
label = "green:failover";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
buttons {
|
||||||
|
compatible = "gpio-keys";
|
||||||
|
|
||||||
|
reset {
|
||||||
|
label = "Reset button";
|
||||||
|
gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
|
||||||
|
linux,code = <KEY_RESTART>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
soc: soc@ffe00000 {
|
||||||
|
ranges = <0x0 0x0 0xffe00000 0x100000>;
|
||||||
|
|
||||||
|
i2c@3000 {
|
||||||
|
rtc@30 {
|
||||||
|
compatible = "sii,s35390a";
|
||||||
|
reg = <0x30>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
spi0: spi@7000 {
|
||||||
|
flash@0 {
|
||||||
|
compatible = "jedec,spi-nor";
|
||||||
|
reg = <0>;
|
||||||
|
spi-max-frequency = <25000000>;
|
||||||
|
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
uboot: partition@0 {
|
||||||
|
reg = <0x0 0x90000>;
|
||||||
|
label = "u-boot";
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@90000 {
|
||||||
|
reg = <0x90000 0x10000>;
|
||||||
|
label = "u-boot-env";
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@a0000 {
|
||||||
|
reg = <0xa0000 0x20000>;
|
||||||
|
label = "cfgxxx";
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@c0000 {
|
||||||
|
reg = <0xc0000 0x40000>;
|
||||||
|
label = "device_id";
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
gpio0: gpio-controller@fc00 {
|
||||||
|
};
|
||||||
|
|
||||||
|
usb@22000 {
|
||||||
|
phy_type = "utmi";
|
||||||
|
dr_mode = "host";
|
||||||
|
};
|
||||||
|
|
||||||
|
mdio@24000 {
|
||||||
|
phy1: ethernet-phy@1 {
|
||||||
|
reg = <0x1>;
|
||||||
|
};
|
||||||
|
|
||||||
|
phy2: ethernet-phy@2 {
|
||||||
|
reg = <0x2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
phy3: ethernet-phy@3 {
|
||||||
|
reg = <0x3>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
mdio@25000 {
|
||||||
|
tbi_phy1: tbi-phy@11 {
|
||||||
|
reg = <0x11>;
|
||||||
|
device_type = "tbi-phy";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
mdio@26000 {
|
||||||
|
tbi_phy2: tbi-phy@11 {
|
||||||
|
reg = <0x11>;
|
||||||
|
device_type = "tbi-phy";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
enet0: ethernet@b0000 {
|
||||||
|
phy-handle = <&phy1>;
|
||||||
|
phy-connection-type = "rgmii-id";
|
||||||
|
};
|
||||||
|
|
||||||
|
enet1: ethernet@b1000 {
|
||||||
|
tbi-handle = <&tbi_phy1>;
|
||||||
|
phy-handle = <&phy2>;
|
||||||
|
phy-connection-type = "sgmii";
|
||||||
|
};
|
||||||
|
|
||||||
|
enet2: ethernet@b2000 {
|
||||||
|
tbi-handle = <&tbi_phy2>;
|
||||||
|
phy-handle = <&phy3>;
|
||||||
|
phy-connection-type = "sgmii";
|
||||||
|
};
|
||||||
|
|
||||||
|
sdhc@2e000 {
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
serial1: serial@4600 {
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
can0: can@1c000 {
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
can1: can@1d000 {
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
pci0: pcie@ffe09000 {
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
pci1: pcie@ffe0a000 {
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
ifc: ifc@ffe1e000 {
|
||||||
|
reg = <0x0 0xffe1e000 0 0x2000>;
|
||||||
|
|
||||||
|
/* NOR, NAND Flashes and CPLD on board */
|
||||||
|
ranges = <0x0 0x0 0x0 0xee000000 0x02000000
|
||||||
|
0x1 0x0 0x0 0xff800000 0x00010000
|
||||||
|
0x3 0x0 0x0 0xffb00000 0x00000020>;
|
||||||
|
|
||||||
|
nand@1,0 {
|
||||||
|
compatible = "fsl,ifc-nand";
|
||||||
|
reg = <0x1 0x0 0x10000>;
|
||||||
|
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Original partition layout:
|
||||||
|
* 0x000000000000-0x000000020000 : "NAND (RW) WG DTB Image"
|
||||||
|
* 0x000000020000-0x000000520000 : "NAND (RW) WG SYSA Kernel"
|
||||||
|
* 0x000000520000-0x000007f00000 : "NAND (RW) WG SYSA_CODE"
|
||||||
|
* 0x000007f00000-0x000008400000 : "NAND (RW) WG SYSB Kernel"
|
||||||
|
* 0x000008400000-0x000009c00000 : "NAND (RW) WG SYSB_CODE"
|
||||||
|
* 0x000009c00000-0x00000a100000 : "NAND (RW) WG SYSA2 Kernel"
|
||||||
|
* 0x00000a100000-0x000011ae0000 : "NAND (RW) WG SYSA_CODE2"
|
||||||
|
* 0x000011ae0000-0x000020000000 : "NAND (RW) WG SYSA_DATA"
|
||||||
|
*/
|
||||||
|
|
||||||
|
partition@0 {
|
||||||
|
reg = <0x0 0x20000>;
|
||||||
|
label = "wg-dtb";
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@20000 {
|
||||||
|
reg = <0x20000 0x500000>;
|
||||||
|
label = "kernel";
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@520000 {
|
||||||
|
reg = <0x520000 0x79e0000>;
|
||||||
|
label = "wg-sysa-rootfs";
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@7f00000 {
|
||||||
|
reg = <0x7f00000 0x500000>;
|
||||||
|
label = "wg-sysb-kernel";
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@8400000 {
|
||||||
|
reg = <0x8400000 0x1800000>;
|
||||||
|
label = "wg-sysb-rootfs";
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@9c00000 {
|
||||||
|
reg = <0x9c00000 0x500000>;
|
||||||
|
label = "wg-sysa2-kernel";
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@a100000 {
|
||||||
|
reg = <0xa100000 0x79e0000>;
|
||||||
|
label = "wg-sysa2-rootfs";
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@11ae0000 {
|
||||||
|
reg = <0x11ae0000 0xe520000>;
|
||||||
|
label = "ubi";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/include/ "fsl/p1010si-post.dtsi"
|
|
@ -0,0 +1,87 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Watchguard Firebox T10 Board Setup
|
||||||
|
*
|
||||||
|
* Copyright (C) 2023 David Bauer <mail@david-bauer.net>
|
||||||
|
*
|
||||||
|
* Based on:
|
||||||
|
* p1010rdb.c:
|
||||||
|
* P1010 RDB Board Setup
|
||||||
|
* Copyright 2011 Freescale Semiconductor Inc.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/stddef.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/of_platform.h>
|
||||||
|
|
||||||
|
#include <asm/time.h>
|
||||||
|
#include <asm/machdep.h>
|
||||||
|
#include <asm/pci-bridge.h>
|
||||||
|
#include <mm/mmu_decl.h>
|
||||||
|
#include <asm/prom.h>
|
||||||
|
#include <asm/udbg.h>
|
||||||
|
#include <asm/mpic.h>
|
||||||
|
|
||||||
|
#include <sysdev/fsl_soc.h>
|
||||||
|
#include <sysdev/fsl_pci.h>
|
||||||
|
|
||||||
|
#include "mpc85xx.h"
|
||||||
|
|
||||||
|
void __init firebox_t10_pic_init(void)
|
||||||
|
{
|
||||||
|
struct mpic *mpic;
|
||||||
|
|
||||||
|
mpic = mpic_alloc(NULL, 0,
|
||||||
|
MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU,
|
||||||
|
0, 256, " OpenPIC ");
|
||||||
|
|
||||||
|
BUG_ON(mpic == NULL);
|
||||||
|
mpic_init(mpic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setup the architecture
|
||||||
|
*/
|
||||||
|
static void __init firebox_t10_setup_arch(void)
|
||||||
|
{
|
||||||
|
if (ppc_md.progress)
|
||||||
|
ppc_md.progress("firebox_t10_setup_arch()", 0);
|
||||||
|
|
||||||
|
fsl_pci_assign_primary();
|
||||||
|
|
||||||
|
pr_info("Firebox T10 from Watchguard\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
machine_arch_initcall(firebox_t10, mpc85xx_common_publish_devices);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called very early, device-tree isn't unflattened
|
||||||
|
*/
|
||||||
|
static int __init firebox_t10_probe(void)
|
||||||
|
{
|
||||||
|
if (of_machine_is_compatible("watchguard,firebox-t10"))
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
define_machine(firebox_t10) {
|
||||||
|
.name = "P1010 RDB",
|
||||||
|
.probe = firebox_t10_probe,
|
||||||
|
.setup_arch = firebox_t10_setup_arch,
|
||||||
|
.init_IRQ = firebox_t10_pic_init,
|
||||||
|
#ifdef CONFIG_PCI
|
||||||
|
.pcibios_fixup_bus = fsl_pcibios_fixup_bus,
|
||||||
|
.pcibios_fixup_phb = fsl_pcibios_fixup_phb,
|
||||||
|
#endif
|
||||||
|
.get_irq = mpic_get_irq,
|
||||||
|
.calibrate_decr = generic_calibrate_decr,
|
||||||
|
.progress = udbg_progress,
|
||||||
|
};
|
|
@ -40,6 +40,16 @@ define Device/tplink_tl-wdr4900-v1
|
||||||
endef
|
endef
|
||||||
TARGET_DEVICES += tplink_tl-wdr4900-v1
|
TARGET_DEVICES += tplink_tl-wdr4900-v1
|
||||||
|
|
||||||
|
define Device/watchguard_firebox-t10
|
||||||
|
DEVICE_VENDOR := Watchguard
|
||||||
|
DEVICE_MODEL := Firebox T10
|
||||||
|
DEVICE_PACKAGES := kmod-rtc-s35390a kmod-eeprom-at24
|
||||||
|
KERNEL = kernel-bin | gzip | fit gzip $(KDIR)/image-$$(DEVICE_DTS).dtb
|
||||||
|
IMAGES := sysupgrade.bin
|
||||||
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
||||||
|
endef
|
||||||
|
TARGET_DEVICES += watchguard_firebox-t10
|
||||||
|
|
||||||
define Device/sophos_red-15w-rev1
|
define Device/sophos_red-15w-rev1
|
||||||
DEVICE_VENDOR := Sophos
|
DEVICE_VENDOR := Sophos
|
||||||
DEVICE_MODEL := RED 15w
|
DEVICE_MODEL := RED 15w
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
CONFIG_AT803X_PHY=y
|
CONFIG_AT803X_PHY=y
|
||||||
|
CONFIG_CMDLINE_OVERRIDE=y
|
||||||
# CONFIG_FSL_CORENET_CF is not set
|
# CONFIG_FSL_CORENET_CF is not set
|
||||||
CONFIG_MTD_NAND_FSL_IFC=y
|
CONFIG_MTD_NAND_FSL_IFC=y
|
||||||
CONFIG_MTD_SPLIT_FIRMWARE=y
|
CONFIG_MTD_SPLIT_FIRMWARE=y
|
||||||
|
@ -19,3 +20,4 @@ CONFIG_REGMAP=y
|
||||||
CONFIG_REGULATOR=y
|
CONFIG_REGULATOR=y
|
||||||
CONFIG_TL_WDR4900_V1=y
|
CONFIG_TL_WDR4900_V1=y
|
||||||
CONFIG_UBIFS_FS=y
|
CONFIG_UBIFS_FS=y
|
||||||
|
CONFIG_FIREBOX_T10=y
|
|
@ -0,0 +1,29 @@
|
||||||
|
--- a/arch/powerpc/platforms/85xx/Kconfig
|
||||||
|
+++ b/arch/powerpc/platforms/85xx/Kconfig
|
||||||
|
@@ -92,6 +92,16 @@ config WS_AP3825I
|
||||||
|
This board is a Concurrent Dual-Band wireless access point with a
|
||||||
|
Freescale P1020 SoC.
|
||||||
|
|
||||||
|
+config FIREBOX_T10
|
||||||
|
+ bool "Watchguard Firebox T10"
|
||||||
|
+ select DEFAULT_UIMAGE
|
||||||
|
+ select ARCH_REQUIRE_GPIOLIB
|
||||||
|
+ select GPIO_MPC8XXX
|
||||||
|
+ help
|
||||||
|
+ This option enables support for the Watchguard Firebox T10 board.
|
||||||
|
+ This board is a VPN Gateway-Router with a
|
||||||
|
+ Freescale P1010 SoC.
|
||||||
|
+
|
||||||
|
config MPC8540_ADS
|
||||||
|
bool "Freescale MPC8540 ADS"
|
||||||
|
select DEFAULT_UIMAGE
|
||||||
|
--- a/arch/powerpc/platforms/85xx/Makefile
|
||||||
|
+++ b/arch/powerpc/platforms/85xx/Makefile
|
||||||
|
@@ -28,6 +28,7 @@ obj-$(CONFIG_PANDA) += panda.o
|
||||||
|
obj-$(CONFIG_TWR_P102x) += twr_p102x.o
|
||||||
|
obj-$(CONFIG_WS_AP3710I) += ws-ap3710i.o
|
||||||
|
obj-$(CONFIG_WS_AP3825I) += ws-ap3825i.o
|
||||||
|
+obj-$(CONFIG_FIREBOX_T10) += firebox_t10.o
|
||||||
|
obj-$(CONFIG_CORENET_GENERIC) += corenet_generic.o
|
||||||
|
obj-$(CONFIG_FB_FSL_DIU) += t1042rdb_diu.o
|
||||||
|
obj-$(CONFIG_RED_15W_REV1) += red15w_rev1.o
|
|
@ -0,0 +1,29 @@
|
||||||
|
--- a/arch/powerpc/platforms/85xx/Kconfig
|
||||||
|
+++ b/arch/powerpc/platforms/85xx/Kconfig
|
||||||
|
@@ -92,6 +92,16 @@ config WS_AP3825I
|
||||||
|
This board is a Concurrent Dual-Band wireless access point with a
|
||||||
|
Freescale P1020 SoC.
|
||||||
|
|
||||||
|
+config FIREBOX_T10
|
||||||
|
+ bool "Watchguard Firebox T10"
|
||||||
|
+ select DEFAULT_UIMAGE
|
||||||
|
+ select ARCH_REQUIRE_GPIOLIB
|
||||||
|
+ select GPIO_MPC8XXX
|
||||||
|
+ help
|
||||||
|
+ This option enables support for the Watchguard Firebox T10 board.
|
||||||
|
+ This board is a VPN Gateway-Router with a
|
||||||
|
+ Freescale P1010 SoC.
|
||||||
|
+
|
||||||
|
config MPC8540_ADS
|
||||||
|
bool "Freescale MPC8540 ADS"
|
||||||
|
select DEFAULT_UIMAGE
|
||||||
|
--- a/arch/powerpc/platforms/85xx/Makefile
|
||||||
|
+++ b/arch/powerpc/platforms/85xx/Makefile
|
||||||
|
@@ -28,6 +28,7 @@ obj-$(CONFIG_PANDA) += panda.o
|
||||||
|
obj-$(CONFIG_TWR_P102x) += twr_p102x.o
|
||||||
|
obj-$(CONFIG_WS_AP3710I) += ws-ap3710i.o
|
||||||
|
obj-$(CONFIG_WS_AP3825I) += ws-ap3825i.o
|
||||||
|
+obj-$(CONFIG_FIREBOX_T10) += firebox_t10.o
|
||||||
|
obj-$(CONFIG_CORENET_GENERIC) += corenet_generic.o
|
||||||
|
obj-$(CONFIG_FB_FSL_DIU) += t1042rdb_diu.o
|
||||||
|
obj-$(CONFIG_RED_15W_REV1) += red15w_rev1.o
|
|
@ -18,6 +18,23 @@ menu "Global build settings"
|
||||||
bool "Cryptographically sign package lists"
|
bool "Cryptographically sign package lists"
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
comment "General build options"
|
||||||
|
|
||||||
|
config BUILD_PATENTED
|
||||||
|
default n
|
||||||
|
bool "Compile with support for patented functionality"
|
||||||
|
help
|
||||||
|
When this option is disabled, software which provides patented functionality
|
||||||
|
will not be built. In case software provides optional support for patented
|
||||||
|
functionality, this optional support will get disabled for this package.
|
||||||
|
|
||||||
|
config BUILD_NLS
|
||||||
|
default n
|
||||||
|
bool "Compile with full language support"
|
||||||
|
help
|
||||||
|
When this option is enabled, packages are built with the full versions of
|
||||||
|
iconv and GNU gettext instead of the default OpenWrt stubs.
|
||||||
|
|
||||||
comment "Package build options"
|
comment "Package build options"
|
||||||
|
|
||||||
config DEBUG
|
config DEBUG
|
||||||
|
|
|
@ -28,14 +28,4 @@ ifneq (docs-$(CONFIG_BUILD_DOCUMENTATION),docs-y)
|
||||||
CMAKE_HOST_OPTIONS += -DENABLE_DOCUMENTATION=OFF
|
CMAKE_HOST_OPTIONS += -DENABLE_DOCUMENTATION=OFF
|
||||||
endif
|
endif
|
||||||
|
|
||||||
define Host/Install/ccache
|
|
||||||
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
|
|
||||||
$(CP) ./files/* $(STAGING_DIR_HOST)/bin/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Host/Install
|
|
||||||
$(call Host/Install/Default)
|
|
||||||
$(call Host/Install/ccache)
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call HostBuild))
|
$(eval $(call HostBuild))
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
exec ccache "${TARGET_CC_NOCACHE}" "$@"
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
exec ccache "${TARGET_CXX_NOCACHE}" "$@"
|
|
Loading…
Reference in a new issue