Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
commit
63675e8ce5
@ -1123,6 +1123,13 @@ config KERNEL_WEXT_PROC
|
||||
config KERNEL_WEXT_SPY
|
||||
def_bool KERNEL_WIRELESS_EXT
|
||||
|
||||
config KERNEL_PAGE_POOL
|
||||
def_bool n
|
||||
|
||||
config KERNEL_PAGE_POOL_STATS
|
||||
bool "Page pool stats support"
|
||||
depends on KERNEL_PAGE_POOL
|
||||
depends on !LINUX_5_10
|
||||
|
||||
#
|
||||
# NFS related symbols
|
||||
|
||||
@ -453,7 +453,11 @@ nand_do_platform_check() {
|
||||
|
||||
local gz="$(identify_if_gzip "$file")"
|
||||
local file_type="$(identify "$file" "" "$gz")"
|
||||
local control_length=$( (tar xO${gz}f "$file" "sysupgrade-$board_name/CONTROL" | wc -c) 2> /dev/null)
|
||||
local control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//,/_}/CONTROL" | wc -c) 2> /dev/null)
|
||||
|
||||
if [ "$control_length" = 0 ]; then
|
||||
control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//_/,}/CONTROL" | wc -c) 2> /dev/null)
|
||||
fi
|
||||
|
||||
if [ "$control_length" != 0 ]; then
|
||||
nand_verify_tar_file "$file" "$gz" || return 1
|
||||
|
||||
@ -38,6 +38,7 @@ engenius,ecb600|\
|
||||
engenius,enh202-v1|\
|
||||
engenius,ens202ext-v1|\
|
||||
engenius,enstationac-v1|\
|
||||
engenius,ews660ap|\
|
||||
etactica,eg200|\
|
||||
glinet,gl-ar750s-nor|\
|
||||
glinet,gl-ar750s-nor-nand|\
|
||||
|
||||
@ -13,18 +13,21 @@ board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
bananapi,bpi-r3)
|
||||
case "$(cmdline_get_var root)" in
|
||||
/dev/mmc*)
|
||||
rootdev="$(cmdline_get_var root)"
|
||||
rootdev="${rootdev##*/}"
|
||||
rootdev="${rootdev%%p[0-9]*}"
|
||||
case "$rootdev" in
|
||||
mmc*)
|
||||
local envdev=$(find_mmc_part "ubootenv" $rootdev)
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1"
|
||||
ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1"
|
||||
;;
|
||||
/dev/mtd*)
|
||||
mtd*)
|
||||
local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1"
|
||||
ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1"
|
||||
;;
|
||||
/dev/ubi*)
|
||||
ubi*)
|
||||
. /lib/upgrade/nand.sh
|
||||
local envubi=$(nand_find_ubi ubi)
|
||||
local envdev=/dev/$(nand_find_volume $envubi ubootenv)
|
||||
|
||||
@ -17,13 +17,16 @@ linksys,e8450-ubi)
|
||||
ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
|
||||
;;
|
||||
bananapi,bpi-r64)
|
||||
case "$(cmdline_get_var root)" in
|
||||
/dev/mmc*)
|
||||
rootdev="$(cmdline_get_var root)"
|
||||
rootdev="${rootdev##*/}"
|
||||
rootdev="${rootdev%%p[0-9]*}"
|
||||
case "$rootdev" in
|
||||
mmc*)
|
||||
local envdev=$(find_mmc_part "ubootenv" $rootdev)
|
||||
ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1"
|
||||
ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1"
|
||||
;;
|
||||
/dev/ubi*)
|
||||
ubi*)
|
||||
ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1"
|
||||
ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
|
||||
;;
|
||||
|
||||
@ -170,6 +170,28 @@ endef
|
||||
$(eval $(call KernelPackage,lib-lz4))
|
||||
|
||||
|
||||
define KernelPackage/lib-842
|
||||
SUBMENU:=$(LIB_MENU)
|
||||
TITLE:=842 support
|
||||
DEPENDS:=+kmod-crypto-acompress +kmod-crypto-crc32
|
||||
KCONFIG:= \
|
||||
CONFIG_CRYPTO_842 \
|
||||
CONFIG_842_COMPRESS \
|
||||
CONFIG_842_DECOMPRESS
|
||||
FILES:= \
|
||||
$(LINUX_DIR)/crypto/842.ko \
|
||||
$(LINUX_DIR)/lib/842/842_compress.ko \
|
||||
$(LINUX_DIR)/lib/842/842_decompress.ko
|
||||
AUTOLOAD:=$(call AutoProbe,842 842_compress 842_decompress)
|
||||
endef
|
||||
|
||||
define KernelPackage/lib-842/description
|
||||
Kernel module for 842 compression/decompression support
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,lib-842))
|
||||
|
||||
|
||||
define KernelPackage/lib-raid6
|
||||
SUBMENU:=$(LIB_MENU)
|
||||
TITLE:=RAID6 algorithm support
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
--- a/backport-include/linux/skbuff.h
|
||||
+++ b/backport-include/linux/skbuff.h
|
||||
@@ -140,4 +140,8 @@ static inline u64 skb_get_kcov_handle(st
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if LINUX_VERSION_IS_LESS(5,11,0)
|
||||
+#define napi_build_skb build_skb
|
||||
+#endif
|
||||
+
|
||||
#endif /* __BACKPORT_SKBUFF_H */
|
||||
@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=bridger
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=https://github.com/nbd168/bridger
|
||||
PKG_SOURCE_DATE:=2023-01-03
|
||||
PKG_SOURCE_VERSION:=978c1f9eed07504cc0b84f72ee7384aab722386a
|
||||
PKG_MIRROR_HASH:=2a019b188d8de2fdc95453529d1820b0a7a5576adf161bd19e182c9c1c2b2c85
|
||||
PKG_SOURCE_DATE:=2023-01-27
|
||||
PKG_SOURCE_VERSION:=8be8bb9df789b53a68f08298f610648ebded6063
|
||||
PKG_MIRROR_HASH:=d4f47009bb00c4f129d0959cb00ed90bc14bfe5dd0e67458ddb54176365e65f0
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
@ -12,9 +12,9 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/relayd.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2020-04-25
|
||||
PKG_SOURCE_VERSION:=f4d759be54ceb37714e9a6ca320d5b50c95e9ce9
|
||||
PKG_MIRROR_HASH:=b1ff6e99072867be0975ba0be52ba9da3a876c8b8da893d68301e8238243a51e
|
||||
PKG_SOURCE_DATE:=2023-01-28
|
||||
PKG_SOURCE_VERSION:=f646ba40489371e69f624f2dee2fc4e19ceec00e
|
||||
PKG_MIRROR_HASH:=672d3115728d40ee6897a9f633d269d127496699a7bd45eba11844aa771f2501
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
@ -12,15 +12,14 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git
|
||||
PKG_SOURCE_DATE:=2022-10-31
|
||||
PKG_SOURCE_VERSION:=23977554d9694d025eada50a5547e99ee1be7838
|
||||
PKG_MIRROR_HASH:=e546fd57d0d0be6a51e2aeb5797febe8c89d2bba61b26c930ecb0616d5f6ace9
|
||||
PKG_SOURCE_DATE:=2023-01-28
|
||||
PKG_SOURCE_VERSION:=47561aa13574068403d48f13ea310f8511057b2b
|
||||
PKG_MIRROR_HASH:=84500cf0c8224fe80b5717c9b6bad8ac13f44f286e3a88e8b12adfcf02e22c7c
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=ISC
|
||||
|
||||
PKG_ASLR_PIE_REGULAR:=1
|
||||
PKG_BUILD_DEPENDS = ustream-ssl
|
||||
PKG_CONFIG_DEPENDS:= CONFIG_uhttpd_lua CONFIG_uhttpd_ucode
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
@ -44,18 +43,6 @@ define Package/uhttpd/description
|
||||
HTTP daemon.
|
||||
endef
|
||||
|
||||
define Package/uhttpd/config
|
||||
config uhttpd_lua
|
||||
depends on PACKAGE_uhttpd-mod-lua
|
||||
bool "Enable Integrated Lua interpreter"
|
||||
default y
|
||||
|
||||
config uhttpd_ucode
|
||||
depends on PACKAGE_uhttpd-mod-ucode
|
||||
bool "Enable Integrated ucode interpreter"
|
||||
default y
|
||||
endef
|
||||
|
||||
define Package/uhttpd/conffiles
|
||||
/etc/config/uhttpd
|
||||
/etc/uhttpd.crt
|
||||
@ -101,17 +88,11 @@ ifneq ($(CONFIG_USE_GLIBC),)
|
||||
TARGET_CFLAGS += -D_DEFAULT_SOURCE
|
||||
endif
|
||||
|
||||
TARGET_LDFLAGS += -lcrypt
|
||||
|
||||
CMAKE_OPTIONS += -DTLS_SUPPORT=on
|
||||
|
||||
define Package/uhttpd/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config $(1)/usr/sbin
|
||||
$(INSTALL_BIN) ./files/uhttpd.init $(1)/etc/init.d/uhttpd
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/uhttpd.config $(1)/etc/config/uhttpd
|
||||
$(VERSION_SED_SCRIPT) $(1)/etc/config/uhttpd
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd $(1)/usr/sbin/uhttpd
|
||||
endef
|
||||
|
||||
|
||||
@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ethtool
|
||||
PKG_VERSION:=6.0
|
||||
PKG_VERSION:=6.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/software/network/ethtool
|
||||
PKG_HASH:=d5446c93de570ce68f3b1ea69dbfa12fcfd67fc19897f655d3f18231e2b818d6
|
||||
PKG_HASH:=c41fc881ffa5a40432d2dd829eb44c64a49dee482e716baacf9262c64daa8f90
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
@ -0,0 +1,465 @@
|
||||
From: Florian Fainelli <f.fainelli@gmail.com>
|
||||
To: netdev@vger.kernel.org
|
||||
Subject: [PATCH ethtool v2 1/3] uapi: Bring in if.h
|
||||
Date: Sat, 14 Jan 2023 08:34:09 -0800
|
||||
|
||||
Bring in if.h from commit eec517cdb481 ("net: Add IF_OPER_TESTING") as
|
||||
well as uapi/linux/hdlc/ioctl.h. Ensure that we define all of the
|
||||
necessary guards to provide updated definitions of ifmap, ifreq and
|
||||
IFNAMSIZ. This resolves build issues with kernel headers < 4.11 which
|
||||
lacked 2618be7dccf8739b89e1906b64bd8d551af351e6 ("uapi: fix linux/if.h
|
||||
userspace compilation errors").
|
||||
|
||||
Fixes: 1fa60003a8b8 ("misc: header includes cleanup")
|
||||
Reported-by: Markus Mayer <mmayer@broadcom.com>
|
||||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
---
|
||||
Makefile.am | 6 +-
|
||||
internal.h | 7 +-
|
||||
uapi/linux/hdlc/ioctl.h | 94 +++++++++++++
|
||||
uapi/linux/if.h | 296 ++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 397 insertions(+), 6 deletions(-)
|
||||
create mode 100644 uapi/linux/hdlc/ioctl.h
|
||||
create mode 100644 uapi/linux/if.h
|
||||
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -7,7 +7,8 @@ EXTRA_DIST = LICENSE ethtool.8 ethtool.s
|
||||
|
||||
sbin_PROGRAMS = ethtool
|
||||
ethtool_SOURCES = ethtool.c uapi/linux/ethtool.h internal.h \
|
||||
- uapi/linux/net_tstamp.h rxclass.c common.c common.h \
|
||||
+ uapi/linux/net_tstamp.h uapi/linux/if.h uapi/linux/hdlc/ioctl.h \
|
||||
+ rxclass.c common.c common.h \
|
||||
json_writer.c json_writer.h json_print.c json_print.h \
|
||||
list.h
|
||||
if ETHTOOL_ENABLE_PRETTY_DUMP
|
||||
@@ -43,7 +44,8 @@ ethtool_SOURCES += \
|
||||
netlink/desc-rtnl.c netlink/cable_test.c netlink/tunnels.c \
|
||||
uapi/linux/ethtool_netlink.h \
|
||||
uapi/linux/netlink.h uapi/linux/genetlink.h \
|
||||
- uapi/linux/rtnetlink.h uapi/linux/if_link.h
|
||||
+ uapi/linux/rtnetlink.h uapi/linux/if_link.h \
|
||||
+ uapi/linux/if.h uapi/linux/hdlc/ioctl.h
|
||||
AM_CPPFLAGS += @MNL_CFLAGS@
|
||||
LDADD += @MNL_LIBS@
|
||||
endif
|
||||
--- a/internal.h
|
||||
+++ b/internal.h
|
||||
@@ -21,6 +21,9 @@
|
||||
#include <unistd.h>
|
||||
#include <endian.h>
|
||||
#include <sys/ioctl.h>
|
||||
+#define __UAPI_DEF_IF_IFNAMSIZ 1
|
||||
+#define __UAPI_DEF_IF_IFMAP 1
|
||||
+#define __UAPI_DEF_IF_IFREQ 1
|
||||
#include <linux/if.h>
|
||||
|
||||
#include "json_writer.h"
|
||||
@@ -52,10 +55,6 @@ typedef int32_t s32;
|
||||
#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
|
||||
#endif
|
||||
|
||||
-#ifndef ALTIFNAMSIZ
|
||||
-#define ALTIFNAMSIZ 128
|
||||
-#endif
|
||||
-
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/net_tstamp.h>
|
||||
|
||||
--- /dev/null
|
||||
+++ b/uapi/linux/hdlc/ioctl.h
|
||||
@@ -0,0 +1,94 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
+#ifndef __HDLC_IOCTL_H__
|
||||
+#define __HDLC_IOCTL_H__
|
||||
+
|
||||
+
|
||||
+#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */
|
||||
+
|
||||
+#define CLOCK_DEFAULT 0 /* Default setting */
|
||||
+#define CLOCK_EXT 1 /* External TX and RX clock - DTE */
|
||||
+#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */
|
||||
+#define CLOCK_TXINT 3 /* Internal TX and external RX clock */
|
||||
+#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */
|
||||
+
|
||||
+
|
||||
+#define ENCODING_DEFAULT 0 /* Default setting */
|
||||
+#define ENCODING_NRZ 1
|
||||
+#define ENCODING_NRZI 2
|
||||
+#define ENCODING_FM_MARK 3
|
||||
+#define ENCODING_FM_SPACE 4
|
||||
+#define ENCODING_MANCHESTER 5
|
||||
+
|
||||
+
|
||||
+#define PARITY_DEFAULT 0 /* Default setting */
|
||||
+#define PARITY_NONE 1 /* No parity */
|
||||
+#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */
|
||||
+#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */
|
||||
+#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */
|
||||
+#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */
|
||||
+#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */
|
||||
+#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */
|
||||
+
|
||||
+#define LMI_DEFAULT 0 /* Default setting */
|
||||
+#define LMI_NONE 1 /* No LMI, all PVCs are static */
|
||||
+#define LMI_ANSI 2 /* ANSI Annex D */
|
||||
+#define LMI_CCITT 3 /* ITU-T Annex A */
|
||||
+#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */
|
||||
+
|
||||
+#ifndef __ASSEMBLY__
|
||||
+
|
||||
+typedef struct {
|
||||
+ unsigned int clock_rate; /* bits per second */
|
||||
+ unsigned int clock_type; /* internal, external, TX-internal etc. */
|
||||
+ unsigned short loopback;
|
||||
+} sync_serial_settings; /* V.35, V.24, X.21 */
|
||||
+
|
||||
+typedef struct {
|
||||
+ unsigned int clock_rate; /* bits per second */
|
||||
+ unsigned int clock_type; /* internal, external, TX-internal etc. */
|
||||
+ unsigned short loopback;
|
||||
+ unsigned int slot_map;
|
||||
+} te1_settings; /* T1, E1 */
|
||||
+
|
||||
+typedef struct {
|
||||
+ unsigned short encoding;
|
||||
+ unsigned short parity;
|
||||
+} raw_hdlc_proto;
|
||||
+
|
||||
+typedef struct {
|
||||
+ unsigned int t391;
|
||||
+ unsigned int t392;
|
||||
+ unsigned int n391;
|
||||
+ unsigned int n392;
|
||||
+ unsigned int n393;
|
||||
+ unsigned short lmi;
|
||||
+ unsigned short dce; /* 1 for DCE (network side) operation */
|
||||
+} fr_proto;
|
||||
+
|
||||
+typedef struct {
|
||||
+ unsigned int dlci;
|
||||
+} fr_proto_pvc; /* for creating/deleting FR PVCs */
|
||||
+
|
||||
+typedef struct {
|
||||
+ unsigned int dlci;
|
||||
+ char master[IFNAMSIZ]; /* Name of master FRAD device */
|
||||
+}fr_proto_pvc_info; /* for returning PVC information only */
|
||||
+
|
||||
+typedef struct {
|
||||
+ unsigned int interval;
|
||||
+ unsigned int timeout;
|
||||
+} cisco_proto;
|
||||
+
|
||||
+typedef struct {
|
||||
+ unsigned short dce; /* 1 for DCE (network side) operation */
|
||||
+ unsigned int modulo; /* modulo (8 = basic / 128 = extended) */
|
||||
+ unsigned int window; /* frame window size */
|
||||
+ unsigned int t1; /* timeout t1 */
|
||||
+ unsigned int t2; /* timeout t2 */
|
||||
+ unsigned int n2; /* frame retry counter */
|
||||
+} x25_hdlc_proto;
|
||||
+
|
||||
+/* PPP doesn't need any info now - supply length = 0 to ioctl */
|
||||
+
|
||||
+#endif /* __ASSEMBLY__ */
|
||||
+#endif /* __HDLC_IOCTL_H__ */
|
||||
--- /dev/null
|
||||
+++ b/uapi/linux/if.h
|
||||
@@ -0,0 +1,296 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
|
||||
+/*
|
||||
+ * INET An implementation of the TCP/IP protocol suite for the LINUX
|
||||
+ * operating system. INET is implemented using the BSD Socket
|
||||
+ * interface as the means of communication with the user level.
|
||||
+ *
|
||||
+ * Global definitions for the INET interface module.
|
||||
+ *
|
||||
+ * Version: @(#)if.h 1.0.2 04/18/93
|
||||
+ *
|
||||
+ * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988
|
||||
+ * Ross Biro
|
||||
+ * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
|
||||
+ *
|
||||
+ * 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.
|
||||
+ */
|
||||
+#ifndef _LINUX_IF_H
|
||||
+#define _LINUX_IF_H
|
||||
+
|
||||
+#include <linux/libc-compat.h> /* for compatibility with glibc */
|
||||
+#include <linux/types.h> /* for "__kernel_caddr_t" et al */
|
||||
+#include <linux/socket.h> /* for "struct sockaddr" et al */
|
||||
+ /* for "__user" et al */
|
||||
+
|
||||
+#include <sys/socket.h> /* for struct sockaddr. */
|
||||
+
|
||||
+#if __UAPI_DEF_IF_IFNAMSIZ
|
||||
+#define IFNAMSIZ 16
|
||||
+#endif /* __UAPI_DEF_IF_IFNAMSIZ */
|
||||
+#define IFALIASZ 256
|
||||
+#define ALTIFNAMSIZ 128
|
||||
+#include <linux/hdlc/ioctl.h>
|
||||
+
|
||||
+/* For glibc compatibility. An empty enum does not compile. */
|
||||
+#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || \
|
||||
+ __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0
|
||||
+/**
|
||||
+ * enum net_device_flags - &struct net_device flags
|
||||
+ *
|
||||
+ * These are the &struct net_device flags, they can be set by drivers, the
|
||||
+ * kernel and some can be triggered by userspace. Userspace can query and
|
||||
+ * set these flags using userspace utilities but there is also a sysfs
|
||||
+ * entry available for all dev flags which can be queried and set. These flags
|
||||
+ * are shared for all types of net_devices. The sysfs entries are available
|
||||
+ * via /sys/class/net/<dev>/flags. Flags which can be toggled through sysfs
|
||||
+ * are annotated below, note that only a few flags can be toggled and some
|
||||
+ * other flags are always preserved from the original net_device flags
|
||||
+ * even if you try to set them via sysfs. Flags which are always preserved
|
||||
+ * are kept under the flag grouping @IFF_VOLATILE. Flags which are __volatile__
|
||||
+ * are annotated below as such.
|
||||
+ *
|
||||
+ * You should have a pretty good reason to be extending these flags.
|
||||
+ *
|
||||
+ * @IFF_UP: interface is up. Can be toggled through sysfs.
|
||||
+ * @IFF_BROADCAST: broadcast address valid. Volatile.
|
||||
+ * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs.
|
||||
+ * @IFF_LOOPBACK: is a loopback net. Volatile.
|
||||
+ * @IFF_POINTOPOINT: interface is has p-p link. Volatile.
|
||||
+ * @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs.
|
||||
+ * Volatile.
|
||||
+ * @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile.
|
||||
+ * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile.
|
||||
+ * @IFF_PROMISC: receive all packets. Can be toggled through sysfs.
|
||||
+ * @IFF_ALLMULTI: receive all multicast packets. Can be toggled through
|
||||
+ * sysfs.
|
||||
+ * @IFF_MASTER: master of a load balancer. Volatile.
|
||||
+ * @IFF_SLAVE: slave of a load balancer. Volatile.
|
||||
+ * @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs.
|
||||
+ * @IFF_PORTSEL: can set media type. Can be toggled through sysfs.
|
||||
+ * @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs.
|
||||
+ * @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled
|
||||
+ * through sysfs.
|
||||
+ * @IFF_LOWER_UP: driver signals L1 up. Volatile.
|
||||
+ * @IFF_DORMANT: driver signals dormant. Volatile.
|
||||
+ * @IFF_ECHO: echo sent packets. Volatile.
|
||||
+ */
|
||||
+enum net_device_flags {
|
||||
+/* for compatibility with glibc net/if.h */
|
||||
+#if __UAPI_DEF_IF_NET_DEVICE_FLAGS
|
||||
+ IFF_UP = 1<<0, /* sysfs */
|
||||
+ IFF_BROADCAST = 1<<1, /* __volatile__ */
|
||||
+ IFF_DEBUG = 1<<2, /* sysfs */
|
||||
+ IFF_LOOPBACK = 1<<3, /* __volatile__ */
|
||||
+ IFF_POINTOPOINT = 1<<4, /* __volatile__ */
|
||||
+ IFF_NOTRAILERS = 1<<5, /* sysfs */
|
||||
+ IFF_RUNNING = 1<<6, /* __volatile__ */
|
||||
+ IFF_NOARP = 1<<7, /* sysfs */
|
||||
+ IFF_PROMISC = 1<<8, /* sysfs */
|
||||
+ IFF_ALLMULTI = 1<<9, /* sysfs */
|
||||
+ IFF_MASTER = 1<<10, /* __volatile__ */
|
||||
+ IFF_SLAVE = 1<<11, /* __volatile__ */
|
||||
+ IFF_MULTICAST = 1<<12, /* sysfs */
|
||||
+ IFF_PORTSEL = 1<<13, /* sysfs */
|
||||
+ IFF_AUTOMEDIA = 1<<14, /* sysfs */
|
||||
+ IFF_DYNAMIC = 1<<15, /* sysfs */
|
||||
+#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */
|
||||
+#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
|
||||
+ IFF_LOWER_UP = 1<<16, /* __volatile__ */
|
||||
+ IFF_DORMANT = 1<<17, /* __volatile__ */
|
||||
+ IFF_ECHO = 1<<18, /* __volatile__ */
|
||||
+#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
|
||||
+};
|
||||
+#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */
|
||||
+
|
||||
+/* for compatibility with glibc net/if.h */
|
||||
+#if __UAPI_DEF_IF_NET_DEVICE_FLAGS
|
||||
+#define IFF_UP IFF_UP
|
||||
+#define IFF_BROADCAST IFF_BROADCAST
|
||||
+#define IFF_DEBUG IFF_DEBUG
|
||||
+#define IFF_LOOPBACK IFF_LOOPBACK
|
||||
+#define IFF_POINTOPOINT IFF_POINTOPOINT
|
||||
+#define IFF_NOTRAILERS IFF_NOTRAILERS
|
||||
+#define IFF_RUNNING IFF_RUNNING
|
||||
+#define IFF_NOARP IFF_NOARP
|
||||
+#define IFF_PROMISC IFF_PROMISC
|
||||
+#define IFF_ALLMULTI IFF_ALLMULTI
|
||||
+#define IFF_MASTER IFF_MASTER
|
||||
+#define IFF_SLAVE IFF_SLAVE
|
||||
+#define IFF_MULTICAST IFF_MULTICAST
|
||||
+#define IFF_PORTSEL IFF_PORTSEL
|
||||
+#define IFF_AUTOMEDIA IFF_AUTOMEDIA
|
||||
+#define IFF_DYNAMIC IFF_DYNAMIC
|
||||
+#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */
|
||||
+
|
||||
+#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
|
||||
+#define IFF_LOWER_UP IFF_LOWER_UP
|
||||
+#define IFF_DORMANT IFF_DORMANT
|
||||
+#define IFF_ECHO IFF_ECHO
|
||||
+#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
|
||||
+
|
||||
+#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
|
||||
+ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
|
||||
+
|
||||
+#define IF_GET_IFACE 0x0001 /* for querying only */
|
||||
+#define IF_GET_PROTO 0x0002
|
||||
+
|
||||
+/* For definitions see hdlc.h */
|
||||
+#define IF_IFACE_V35 0x1000 /* V.35 serial interface */
|
||||
+#define IF_IFACE_V24 0x1001 /* V.24 serial interface */
|
||||
+#define IF_IFACE_X21 0x1002 /* X.21 serial interface */
|
||||
+#define IF_IFACE_T1 0x1003 /* T1 telco serial interface */
|
||||
+#define IF_IFACE_E1 0x1004 /* E1 telco serial interface */
|
||||
+#define IF_IFACE_SYNC_SERIAL 0x1005 /* can't be set by software */
|
||||
+#define IF_IFACE_X21D 0x1006 /* X.21 Dual Clocking (FarSite) */
|
||||
+
|
||||
+/* For definitions see hdlc.h */
|
||||
+#define IF_PROTO_HDLC 0x2000 /* raw HDLC protocol */
|
||||
+#define IF_PROTO_PPP 0x2001 /* PPP protocol */
|
||||
+#define IF_PROTO_CISCO 0x2002 /* Cisco HDLC protocol */
|
||||
+#define IF_PROTO_FR 0x2003 /* Frame Relay protocol */
|
||||
+#define IF_PROTO_FR_ADD_PVC 0x2004 /* Create FR PVC */
|
||||
+#define IF_PROTO_FR_DEL_PVC 0x2005 /* Delete FR PVC */
|
||||
+#define IF_PROTO_X25 0x2006 /* X.25 */
|
||||
+#define IF_PROTO_HDLC_ETH 0x2007 /* raw HDLC, Ethernet emulation */
|
||||
+#define IF_PROTO_FR_ADD_ETH_PVC 0x2008 /* Create FR Ethernet-bridged PVC */
|
||||
+#define IF_PROTO_FR_DEL_ETH_PVC 0x2009 /* Delete FR Ethernet-bridged PVC */
|
||||
+#define IF_PROTO_FR_PVC 0x200A /* for reading PVC status */
|
||||
+#define IF_PROTO_FR_ETH_PVC 0x200B
|
||||
+#define IF_PROTO_RAW 0x200C /* RAW Socket */
|
||||
+
|
||||
+/* RFC 2863 operational status */
|
||||
+enum {
|
||||
+ IF_OPER_UNKNOWN,
|
||||
+ IF_OPER_NOTPRESENT,
|
||||
+ IF_OPER_DOWN,
|
||||
+ IF_OPER_LOWERLAYERDOWN,
|
||||
+ IF_OPER_TESTING,
|
||||
+ IF_OPER_DORMANT,
|
||||
+ IF_OPER_UP,
|
||||
+};
|
||||
+
|
||||
+/* link modes */
|
||||
+enum {
|
||||
+ IF_LINK_MODE_DEFAULT,
|
||||
+ IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */
|
||||
+ IF_LINK_MODE_TESTING, /* limit upward transition to testing */
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * Device mapping structure. I'd just gone off and designed a
|
||||
+ * beautiful scheme using only loadable modules with arguments
|
||||
+ * for driver options and along come the PCMCIA people 8)
|
||||
+ *
|
||||
+ * Ah well. The get() side of this is good for WDSETUP, and it'll
|
||||
+ * be handy for debugging things. The set side is fine for now and
|
||||
+ * being very small might be worth keeping for clean configuration.
|
||||
+ */
|
||||
+
|
||||
+/* for compatibility with glibc net/if.h */
|
||||
+#if __UAPI_DEF_IF_IFMAP
|
||||
+struct ifmap {
|
||||
+ unsigned long mem_start;
|
||||
+ unsigned long mem_end;
|
||||
+ unsigned short base_addr;
|
||||
+ unsigned char irq;
|
||||
+ unsigned char dma;
|
||||
+ unsigned char port;
|
||||
+ /* 3 bytes spare */
|
||||
+};
|
||||
+#endif /* __UAPI_DEF_IF_IFMAP */
|
||||
+
|
||||
+struct if_settings {
|
||||
+ unsigned int type; /* Type of physical device or protocol */
|
||||
+ unsigned int size; /* Size of the data allocated by the caller */
|
||||
+ union {
|
||||
+ /* {atm/eth/dsl}_settings anyone ? */
|
||||
+ raw_hdlc_proto *raw_hdlc;
|
||||
+ cisco_proto *cisco;
|
||||
+ fr_proto *fr;
|
||||
+ fr_proto_pvc *fr_pvc;
|
||||
+ fr_proto_pvc_info *fr_pvc_info;
|
||||
+ x25_hdlc_proto *x25;
|
||||
+
|
||||
+ /* interface settings */
|
||||
+ sync_serial_settings *sync;
|
||||
+ te1_settings *te1;
|
||||
+ } ifs_ifsu;
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * Interface request structure used for socket
|
||||
+ * ioctl's. All interface ioctl's must have parameter
|
||||
+ * definitions which begin with ifr_name. The
|
||||
+ * remainder may be interface specific.
|
||||
+ */
|
||||
+
|
||||
+/* for compatibility with glibc net/if.h */
|
||||
+#if __UAPI_DEF_IF_IFREQ
|
||||
+struct ifreq {
|
||||
+#define IFHWADDRLEN 6
|
||||
+ union
|
||||
+ {
|
||||
+ char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
+ } ifr_ifrn;
|
||||
+
|
||||
+ union {
|
||||
+ struct sockaddr ifru_addr;
|
||||
+ struct sockaddr ifru_dstaddr;
|
||||
+ struct sockaddr ifru_broadaddr;
|
||||
+ struct sockaddr ifru_netmask;
|
||||
+ struct sockaddr ifru_hwaddr;
|
||||
+ short ifru_flags;
|
||||
+ int ifru_ivalue;
|
||||
+ int ifru_mtu;
|
||||
+ struct ifmap ifru_map;
|
||||
+ char ifru_slave[IFNAMSIZ]; /* Just fits the size */
|
||||
+ char ifru_newname[IFNAMSIZ];
|
||||
+ void * ifru_data;
|
||||
+ struct if_settings ifru_settings;
|
||||
+ } ifr_ifru;
|
||||
+};
|
||||
+#endif /* __UAPI_DEF_IF_IFREQ */
|
||||
+
|
||||
+#define ifr_name ifr_ifrn.ifrn_name /* interface name */
|
||||
+#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
|
||||
+#define ifr_addr ifr_ifru.ifru_addr /* address */
|
||||
+#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */
|
||||
+#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
|
||||
+#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */
|
||||
+#define ifr_flags ifr_ifru.ifru_flags /* flags */
|
||||
+#define ifr_metric ifr_ifru.ifru_ivalue /* metric */
|
||||
+#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
|
||||
+#define ifr_map ifr_ifru.ifru_map /* device map */
|
||||
+#define ifr_slave ifr_ifru.ifru_slave /* slave device */
|
||||
+#define ifr_data ifr_ifru.ifru_data /* for use by interface */
|
||||
+#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */
|
||||
+#define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */
|
||||
+#define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */
|
||||
+#define ifr_newname ifr_ifru.ifru_newname /* New name */
|
||||
+#define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/
|
||||
+
|
||||
+/*
|
||||
+ * Structure used in SIOCGIFCONF request.
|
||||
+ * Used to retrieve interface configuration
|
||||
+ * for machine (useful for programs which
|
||||
+ * must know all networks accessible).
|
||||
+ */
|
||||
+
|
||||
+/* for compatibility with glibc net/if.h */
|
||||
+#if __UAPI_DEF_IF_IFCONF
|
||||
+struct ifconf {
|
||||
+ int ifc_len; /* size of buffer */
|
||||
+ union {
|
||||
+ char *ifcu_buf;
|
||||
+ struct ifreq *ifcu_req;
|
||||
+ } ifc_ifcu;
|
||||
+};
|
||||
+#endif /* __UAPI_DEF_IF_IFCONF */
|
||||
+
|
||||
+#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
|
||||
+#define ifc_req ifc_ifcu.ifcu_req /* array of structures */
|
||||
+
|
||||
+#endif /* _LINUX_IF_H */
|
||||
@ -0,0 +1,25 @@
|
||||
From: Florian Fainelli <f.fainelli@gmail.com>
|
||||
To: netdev@vger.kernel.org
|
||||
Subject: [PATCH ethtool v2 2/3] netlink: Fix maybe uninitialized 'meters' variable
|
||||
Date: Sat, 14 Jan 2023 08:34:10 -0800
|
||||
|
||||
GCC12 warns that 'meters' may be uninitialized, initialize it
|
||||
accordingly.
|
||||
|
||||
Fixes: 9561db9b76f4 ("Add cable test TDR support")
|
||||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
---
|
||||
netlink/parser.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/netlink/parser.c
|
||||
+++ b/netlink/parser.c
|
||||
@@ -237,7 +237,7 @@ int nl_parse_direct_m2cm(struct nl_conte
|
||||
struct nl_msg_buff *msgbuff, void *dest)
|
||||
{
|
||||
const char *arg = *nlctx->argp;
|
||||
- float meters;
|
||||
+ float meters = 0.0;
|
||||
uint32_t cm;
|
||||
int ret;
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
From: Florian Fainelli <f.fainelli@gmail.com>
|
||||
To: netdev@vger.kernel.org
|
||||
Subject: [PATCH ethtool v2 3/3] marvell.c: Fix build with musl-libc
|
||||
Date: Sat, 14 Jan 2023 08:34:11 -0800
|
||||
|
||||
After commit 1fa60003a8b8 ("misc: header includes cleanup") we stopped
|
||||
including net/if.h which resolved the proper defines to pull in
|
||||
sys/types.h and provide a definition for u_int32_t. With musl-libc we
|
||||
would need to define _GNU_SOURCE to ensure that sys/types.h does provide a
|
||||
definition for u_int32_t.
|
||||
|
||||
Rather, just replace u_uint{16,32}_t with the more standard
|
||||
uint{16,32}_t types from stdint.h
|
||||
|
||||
Fixes: 1fa60003a8b8 ("misc: header includes cleanup")
|
||||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
---
|
||||
marvell.c | 34 +++++++++++++++++-----------------
|
||||
1 file changed, 17 insertions(+), 17 deletions(-)
|
||||
|
||||
--- a/marvell.c
|
||||
+++ b/marvell.c
|
||||
@@ -31,23 +31,23 @@ static void dump_timer(const char *name,
|
||||
static void dump_queue(const char *name, const void *a, int rx)
|
||||
{
|
||||
struct desc {
|
||||
- u_int32_t ctl;
|
||||
- u_int32_t next;
|
||||
- u_int32_t data_lo;
|
||||
- u_int32_t data_hi;
|
||||
- u_int32_t status;
|
||||
- u_int32_t timestamp;
|
||||
- u_int16_t csum2;
|
||||
- u_int16_t csum1;
|
||||
- u_int16_t csum2_start;
|
||||
- u_int16_t csum1_start;
|
||||
- u_int32_t addr_lo;
|
||||
- u_int32_t addr_hi;
|
||||
- u_int32_t count_lo;
|
||||
- u_int32_t count_hi;
|
||||
- u_int32_t byte_count;
|
||||
- u_int32_t csr;
|
||||
- u_int32_t flag;
|
||||
+ uint32_t ctl;
|
||||
+ uint32_t next;
|
||||
+ uint32_t data_lo;
|
||||
+ uint32_t data_hi;
|
||||
+ uint32_t status;
|
||||
+ uint32_t timestamp;
|
||||
+ uint16_t csum2;
|
||||
+ uint16_t csum1;
|
||||
+ uint16_t csum2_start;
|
||||
+ uint16_t csum1_start;
|
||||
+ uint32_t addr_lo;
|
||||
+ uint32_t addr_hi;
|
||||
+ uint32_t count_lo;
|
||||
+ uint32_t count_hi;
|
||||
+ uint32_t byte_count;
|
||||
+ uint32_t csr;
|
||||
+ uint32_t flag;
|
||||
};
|
||||
const struct desc *d = a;
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/random.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -31,6 +32,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <mbedtls/bignum.h>
|
||||
#include <mbedtls/entropy.h>
|
||||
#include <mbedtls/x509_crt.h>
|
||||
#include <mbedtls/ecp.h>
|
||||
#include <mbedtls/rsa.h>
|
||||
@ -40,12 +42,16 @@
|
||||
#define PX5G_COPY "Copyright (c) 2009 Steven Barth <steven@midlink.org>"
|
||||
#define PX5G_LICENSE "Licensed under the GNU Lesser General Public License v2.1"
|
||||
|
||||
static int urandom_fd;
|
||||
static char buf[16384];
|
||||
|
||||
static int _urandom(void *ctx, unsigned char *out, size_t len)
|
||||
{
|
||||
read(urandom_fd, out, len);
|
||||
ssize_t ret;
|
||||
|
||||
ret = getrandom(out, len, 0);
|
||||
if (ret < 0 || (size_t)ret != len)
|
||||
return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -306,8 +312,6 @@ int selfsigned(char **arg)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
urandom_fd = open("/dev/urandom", O_RDONLY);
|
||||
|
||||
if (!argv[1]) {
|
||||
//Usage
|
||||
} else if (!strcmp(argv[1], "eckey")) {
|
||||
|
||||
@ -12,9 +12,9 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=https://github.com/jow-/ucode.git
|
||||
PKG_SOURCE_DATE:=2023-01-09
|
||||
PKG_SOURCE_VERSION:=8dad974baa4696fcba85837fa70cde8b68dd7c12
|
||||
PKG_MIRROR_HASH:=91494352ac298ac2735d62355837a1f18e366999c9e940613e6fa3265edc0364
|
||||
PKG_SOURCE_DATE:=2023-01-23
|
||||
PKG_SOURCE_VERSION:=941d14837faf248eb2fa88dd0d5cfddeed044a15
|
||||
PKG_MIRROR_HASH:=19e8654bcb8a13a0a276a240a1da0f2815b0dd0d4f8bb8622e8de1040d5408a5
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
PKG_LICENSE:=ISC
|
||||
|
||||
@ -39,9 +39,10 @@ CMAKE_HOST_OPTIONS += \
|
||||
|
||||
|
||||
define Package/ucode/default
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=ucode - Tiny scripting and templating language
|
||||
SUBMENU:=ucode
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
TITLE:=Tiny scripting and templating language
|
||||
endef
|
||||
|
||||
define Package/ucode
|
||||
@ -57,7 +58,10 @@ endef
|
||||
|
||||
define Package/libucode
|
||||
$(Package/ucode/default)
|
||||
TITLE+= - runtime library
|
||||
SUBMENU:=
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE+= (library)
|
||||
ABI_VERSION:=$(PKG_ABI_VERSION)
|
||||
DEPENDS:=+libjson-c
|
||||
endef
|
||||
@ -92,7 +96,7 @@ endef
|
||||
define Package/ucode-mod-nl80211
|
||||
$(Package/ucode/default)
|
||||
TITLE+= (nl80211 module)
|
||||
DEPENDS:=ucode +libnl-tiny
|
||||
DEPENDS:=ucode +libnl-tiny +libubox
|
||||
endef
|
||||
|
||||
define Package/ucode-mod-nl80211/description
|
||||
@ -129,7 +133,7 @@ define Package/ucode-mod-struct
|
||||
endef
|
||||
|
||||
define Package/ucode-mod-struct/description
|
||||
The struct plugin implemnts Python 3 compatible struct.pack/unpack functionality.
|
||||
The struct plugin implements Python 3 compatible struct.pack/unpack functionality.
|
||||
endef
|
||||
|
||||
|
||||
|
||||
@ -29,6 +29,9 @@
|
||||
/* default for ar934x, except for 1000M */
|
||||
pll-data = <0x06000000 0x00000101 0x00001616>;
|
||||
|
||||
nvmem-cells = <&macaddr_lan>;
|
||||
nvmem-cell-names = "mac-address-ascii";
|
||||
|
||||
phy-mode = "rgmii";
|
||||
phy-handle = <&phy0>;
|
||||
};
|
||||
@ -55,7 +58,13 @@
|
||||
ath9k: wifi@0,0 {
|
||||
compatible = "pci168c,0030";
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
qca,no-eeprom;
|
||||
/* "mac-address-ascii" currently does not work for
|
||||
ath9k pci devices. these below are retained for future
|
||||
improvements. */
|
||||
/* nvmem-cells = <&macaddr_wan>, <&cal_art_5000>;
|
||||
nvmem-cell-names = "mac-address-ascii", "calibration";
|
||||
mac-address-increment = <1>; */
|
||||
qca,no-eeprom; /* remove this when "mac-address-ascii" works */
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
};
|
||||
@ -102,16 +111,40 @@
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@fe0000 {
|
||||
mac: partition@fe0000 {
|
||||
label = "mac";
|
||||
reg = <0xfe0000 0x010000>;
|
||||
read-only;
|
||||
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
macaddr_lan: macaddr@4 {
|
||||
reg = <0x4 0x11>;
|
||||
};
|
||||
|
||||
macaddr_wan: macaddr@18 {
|
||||
reg = <0x18 0x11>;
|
||||
};
|
||||
};
|
||||
|
||||
partition@ff0000 {
|
||||
art: partition@ff0000 {
|
||||
label = "art";
|
||||
reg = <0xff0000 0x010000>;
|
||||
read-only;
|
||||
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
cal_art_1000: cal@1000 {
|
||||
reg = <0x1000 0x440>;
|
||||
};
|
||||
|
||||
cal_art_5000: cal@5000 {
|
||||
reg = <0x5000 0x440>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -127,5 +160,6 @@
|
||||
|
||||
&wmac {
|
||||
status = "okay";
|
||||
qca,no-eeprom;
|
||||
nvmem-cells = <&macaddr_lan>, <&cal_art_1000>;
|
||||
nvmem-cell-names = "mac-address-ascii", "calibration";
|
||||
};
|
||||
|
||||
@ -9,6 +9,10 @@
|
||||
compatible = "glinet,gl-xe300", "qca,qca9531";
|
||||
model = "GL.iNet GL-XE300";
|
||||
|
||||
aliases {
|
||||
label-mac-device = ð0;
|
||||
};
|
||||
|
||||
gpio-export {
|
||||
compatible = "gpio-export";
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/leds/common.h>
|
||||
#include <dt-bindings/mtd/partitions/uimage.h>
|
||||
|
||||
/ {
|
||||
@ -11,11 +12,11 @@
|
||||
compatible = "letv,lba-047-ch", "qca,qca9531";
|
||||
|
||||
aliases {
|
||||
led-boot = &led_status_red;
|
||||
led-failsafe = &led_status_red;
|
||||
led-running = &led_status_blue;
|
||||
led-upgrade = &led_status_red;
|
||||
label-mac-device = ð0;
|
||||
led-boot = &led_status_red;
|
||||
led-failsafe = &led_status_blue;
|
||||
led-running = &led_status_green;
|
||||
led-upgrade = &led_status_blue;
|
||||
};
|
||||
|
||||
keys {
|
||||
@ -31,16 +32,24 @@
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&led_wan_pin>;
|
||||
|
||||
led_status_blue: status_blue {
|
||||
led_status_blue: led-0 {
|
||||
label = "blue:status";
|
||||
color = <LED_COLOR_ID_BLUE>;
|
||||
function = LED_FUNCTION_STATUS;
|
||||
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led_status_red: status_red {
|
||||
led_status_green: led-1 {
|
||||
label = "green:status";
|
||||
color = <LED_COLOR_ID_GREEN>;
|
||||
function = LED_FUNCTION_STATUS;
|
||||
gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led_status_red: led-2 {
|
||||
label = "red:status";
|
||||
color = <LED_COLOR_ID_RED>;
|
||||
function = LED_FUNCTION_STATUS;
|
||||
gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
@ -64,20 +73,13 @@
|
||||
};
|
||||
};
|
||||
|
||||
&pinmux {
|
||||
/* GPIO 4: LED_LINK_5 (WAN) */
|
||||
led_wan_pin: pinmux_led_wan_pin {
|
||||
pinctrl-single,bits = <0x04 0x0000002d 0x000000ff>;
|
||||
};
|
||||
};
|
||||
|
||||
&spi {
|
||||
status = "okay";
|
||||
|
||||
flash@0 {
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <50000000>;
|
||||
spi-max-frequency = <30000000>;
|
||||
m25p,fast-read;
|
||||
|
||||
partitions {
|
||||
@ -112,10 +114,26 @@
|
||||
reg = <0xe90000 0x160000>;
|
||||
};
|
||||
|
||||
art: partition@ff0000 {
|
||||
partition@ff0000 {
|
||||
label = "art";
|
||||
reg = <0xff0000 0x10000>;
|
||||
read-only;
|
||||
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
macaddr_art_0: macaddr@0 {
|
||||
reg = <0x0 0x6>;
|
||||
};
|
||||
|
||||
macaddr_art_6: macaddr@6 {
|
||||
reg = <0x6 0x6>;
|
||||
};
|
||||
|
||||
cal_art_1000: calibration@1000 {
|
||||
reg = <0x1000 0x440>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -140,19 +158,6 @@
|
||||
&wmac {
|
||||
status = "okay";
|
||||
|
||||
mtd-cal-data = <&art 0x1000>;
|
||||
};
|
||||
|
||||
&art {
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
macaddr_art_0: macaddr@0 {
|
||||
reg = <0x0 0x6>;
|
||||
};
|
||||
|
||||
macaddr_art_6: macaddr@6 {
|
||||
reg = <0x6 0x6>;
|
||||
};
|
||||
nvmem-cells = <&cal_art_1000>;
|
||||
nvmem-cell-names = "calibration";
|
||||
};
|
||||
|
||||
@ -94,6 +94,10 @@
|
||||
mac-address-increment = <1>;
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&art {
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
|
||||
@ -110,10 +110,14 @@
|
||||
mac-address-increment = <1>;
|
||||
};
|
||||
|
||||
&ath10k {
|
||||
&ath10k_0 {
|
||||
status = "okay";
|
||||
|
||||
nvmem-cells = <&macaddr_art_0>, <&calibration_art_5000>;
|
||||
nvmem-cell-names = "mac-address", "calibration";
|
||||
mac-address-increment = <2>;
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@ -111,6 +111,10 @@
|
||||
qca955x-sgmii-fixup;
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&art {
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
|
||||
@ -95,6 +95,10 @@
|
||||
mac-address-increment = <1>;
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&art {
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
|
||||
@ -93,6 +93,10 @@
|
||||
mac-address-increment = <1>;
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&art {
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
|
||||
@ -110,10 +110,14 @@
|
||||
mac-address-increment = <1>;
|
||||
};
|
||||
|
||||
&ath10k {
|
||||
&ath10k_0 {
|
||||
status = "okay";
|
||||
|
||||
nvmem-cells = <&macaddr_art_0>, <&calibration_art_5000>;
|
||||
nvmem-cell-names = "mac-address", "calibration";
|
||||
mac-address-increment = <2>;
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
132
target/linux/ath79/dts/qca9558_engenius_ews660ap.dts
Normal file
132
target/linux/ath79/dts/qca9558_engenius_ews660ap.dts
Normal file
@ -0,0 +1,132 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
#include "qca955x_senao_loader.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
|
||||
/ {
|
||||
compatible = "engenius,ews660ap", "qca,qca9558";
|
||||
model = "EnGenius EWS660AP";
|
||||
|
||||
aliases {
|
||||
label-mac-device = ð0;
|
||||
led-boot = &led_wifi5g;
|
||||
led-failsafe = &led_wifi5g;
|
||||
led-upgrade = &led_wifi5g;
|
||||
};
|
||||
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
reset {
|
||||
label = "reset";
|
||||
gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
|
||||
debounce-interval = <60>;
|
||||
linux,code = <KEY_RESTART>;
|
||||
};
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
wifi2g {
|
||||
label = "green:wifi2g";
|
||||
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
|
||||
linux,default-trigger = "phy1tpt";
|
||||
};
|
||||
|
||||
led_wifi5g: wifi5g {
|
||||
label = "green:wifi5g";
|
||||
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
|
||||
linux,default-trigger = "phy0tpt";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&partitions {
|
||||
partition@ff0000 {
|
||||
label = "art";
|
||||
reg = <0xff0000 0x010000>;
|
||||
read-only;
|
||||
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
macaddr_art_0: macaddr@0 {
|
||||
reg = <0x0 0x6>;
|
||||
};
|
||||
|
||||
calibration_art_1000: calibration@1000 {
|
||||
reg = <0x1000 0x440>;
|
||||
};
|
||||
|
||||
calibration_art_5000: calibration@5000 {
|
||||
reg = <0x5000 0x844>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&mdio0 {
|
||||
status = "okay";
|
||||
|
||||
phy1: ethernet-phy@1 {
|
||||
reg = <1>;
|
||||
eee-broken-100tx;
|
||||
eee-broken-1000t;
|
||||
};
|
||||
|
||||
phy2: ethernet-phy@2 {
|
||||
reg = <2>;
|
||||
eee-broken-100tx;
|
||||
eee-broken-1000t;
|
||||
at803x-override-sgmii-link-check;
|
||||
};
|
||||
};
|
||||
|
||||
ð0 {
|
||||
status = "okay";
|
||||
|
||||
nvmem-cells = <&macaddr_art_0>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
|
||||
phy-handle = <&phy1>;
|
||||
phy-mode = "rgmii-id";
|
||||
|
||||
pll-data = <0x82000000 0x80000101 0x80001313>;
|
||||
};
|
||||
|
||||
ð1 {
|
||||
status = "okay";
|
||||
|
||||
nvmem-cells = <&macaddr_art_0>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
mac-address-increment = <1>;
|
||||
|
||||
phy-handle = <&phy2>;
|
||||
|
||||
pll-data = <0x03000000 0x00000101 0x00001313>;
|
||||
|
||||
qca955x-sgmii-fixup;
|
||||
};
|
||||
|
||||
&wmac {
|
||||
status = "okay";
|
||||
|
||||
nvmem-cells = <&macaddr_art_0>, <&calibration_art_1000>;
|
||||
nvmem-cell-names = "mac-address", "calibration";
|
||||
mac-address-increment = <2>;
|
||||
};
|
||||
|
||||
&ath10k_1 {
|
||||
status = "okay";
|
||||
|
||||
nvmem-cells = <&macaddr_art_0>, <&calibration_art_5000>;
|
||||
nvmem-cell-names = "mac-address", "calibration";
|
||||
mac-address-increment = <3>;
|
||||
};
|
||||
|
||||
&pcie1 {
|
||||
status = "okay";
|
||||
};
|
||||
@ -121,6 +121,10 @@
|
||||
mac-address-increment = <1>;
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&art {
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
|
||||
@ -26,14 +26,19 @@
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
status = "okay";
|
||||
|
||||
ath10k: wifi@0,0,0 {
|
||||
ath10k_0: wifi@0,0,0 {
|
||||
compatible = "qcom,ath10k";
|
||||
reg = <0x0 0 0 0 0>;
|
||||
};
|
||||
};
|
||||
|
||||
&pcie1 {
|
||||
ath10k_1: wifi@0,1,0 {
|
||||
compatible = "qcom,ath10k";
|
||||
reg = <0x0 1 0 0 0>;
|
||||
};
|
||||
};
|
||||
|
||||
&spi {
|
||||
status = "okay";
|
||||
|
||||
|
||||
@ -136,6 +136,7 @@ ath79_setup_interfaces()
|
||||
devolo,dvl1750e|\
|
||||
engenius,enstationac-v1|\
|
||||
engenius,ews511ap|\
|
||||
engenius,ews660ap|\
|
||||
ocedo,ursus|\
|
||||
ruckus,zf7372|\
|
||||
ubnt,unifi-ap-outdoor-plus)
|
||||
@ -638,7 +639,6 @@ ath79_setup_macs()
|
||||
;;
|
||||
dlink,dir-825-c1|\
|
||||
dlink,dir-835-a1)
|
||||
lan_mac=$(mtd_get_mac_text "mac" 0x4)
|
||||
wan_mac=$(mtd_get_mac_text "mac" 0x18)
|
||||
;;
|
||||
dlink,dir-842-c1|\
|
||||
|
||||
@ -23,9 +23,7 @@ case "$FIRMWARE" in
|
||||
avm,fritzdvbc)
|
||||
caldata_extract_reverse "urlader" 0x1541 0x440
|
||||
;;
|
||||
dlink,dir-505|\
|
||||
dlink,dir-825-c1|\
|
||||
dlink,dir-835-a1)
|
||||
dlink,dir-505)
|
||||
caldata_extract "art" 0x1000 0x440
|
||||
ath9k_patch_mac $(mtd_get_mac_text "mac" 0x4)
|
||||
;;
|
||||
|
||||
@ -42,6 +42,7 @@ platform_do_upgrade() {
|
||||
engenius,ecb600|\
|
||||
engenius,ens202ext-v1|\
|
||||
engenius,enstationac-v1|\
|
||||
engenius,ews660ap|\
|
||||
watchguard,ap100|\
|
||||
watchguard,ap200|\
|
||||
watchguard,ap300)
|
||||
|
||||
@ -1309,6 +1309,18 @@ define Device/engenius_ews511ap
|
||||
endef
|
||||
TARGET_DEVICES += engenius_ews511ap
|
||||
|
||||
define Device/engenius_ews660ap
|
||||
$(Device/senao_loader_okli)
|
||||
SOC := qca9558
|
||||
DEVICE_VENDOR := EnGenius
|
||||
DEVICE_MODEL := EWS660AP
|
||||
DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct
|
||||
IMAGE_SIZE := 11584k
|
||||
LOADER_FLASH_OFFS := 0x220000
|
||||
SENAO_IMGNAME := ar71xx-generic-ews660ap
|
||||
endef
|
||||
TARGET_DEVICES += engenius_ews660ap
|
||||
|
||||
define Device/enterasys_ws-ap3705i
|
||||
SOC := ar9344
|
||||
DEVICE_VENDOR := Enterasys
|
||||
@ -1634,13 +1646,15 @@ define Device/letv_lba-047-ch
|
||||
SOC := qca9531
|
||||
DEVICE_VENDOR := Letv
|
||||
DEVICE_MODEL := LBA-047-CH
|
||||
DEVICE_PACKAGES := -uboot-envtools
|
||||
FACTORY_SIZE := 14528k
|
||||
IMAGE_SIZE := 15936k
|
||||
LOADER_FLASH_OFFS := 0x50000
|
||||
KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49
|
||||
IMAGES += factory.bin
|
||||
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
|
||||
append-rootfs | pad-rootfs | check-size | pad-to 14528k | \
|
||||
append-loader-okli-uimage $(1) | pad-to 64k
|
||||
IMAGES += kernel.bin rootfs.bin
|
||||
IMAGE/kernel.bin := append-loader-okli-uimage $(1) | pad-to 64k
|
||||
IMAGE/rootfs.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
|
||||
append-rootfs | pad-rootfs | check-size $$$$(FACTORY_SIZE)
|
||||
endef
|
||||
TARGET_DEVICES += letv_lba-047-ch
|
||||
|
||||
|
||||
@ -199,7 +199,8 @@ define Device/glinet_gl-xe300
|
||||
SOC := qca9531
|
||||
DEVICE_VENDOR := GL.iNet
|
||||
DEVICE_MODEL := GL-XE300
|
||||
DEVICE_PACKAGES := kmod-usb2 block-mount kmod-usb-serial-ch341
|
||||
DEVICE_PACKAGES := kmod-usb2 block-mount kmod-usb-serial-ch341 \
|
||||
kmod-usb-net-qmi-wwan uqmi
|
||||
KERNEL_SIZE := 4096k
|
||||
IMAGE_SIZE := 131072k
|
||||
PAGESIZE := 2048
|
||||
|
||||
@ -0,0 +1,798 @@
|
||||
--- a/include/net/page_pool.h
|
||||
+++ b/include/net/page_pool.h
|
||||
@@ -45,7 +45,10 @@
|
||||
* Please note DMA-sync-for-CPU is still
|
||||
* device driver responsibility
|
||||
*/
|
||||
-#define PP_FLAG_ALL (PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV)
|
||||
+#define PP_FLAG_PAGE_FRAG BIT(2) /* for page frag feature */
|
||||
+#define PP_FLAG_ALL (PP_FLAG_DMA_MAP |\
|
||||
+ PP_FLAG_DMA_SYNC_DEV |\
|
||||
+ PP_FLAG_PAGE_FRAG)
|
||||
|
||||
/*
|
||||
* Fast allocation side cache array/stack
|
||||
@@ -65,7 +68,7 @@
|
||||
#define PP_ALLOC_CACHE_REFILL 64
|
||||
struct pp_alloc_cache {
|
||||
u32 count;
|
||||
- void *cache[PP_ALLOC_CACHE_SIZE];
|
||||
+ struct page *cache[PP_ALLOC_CACHE_SIZE];
|
||||
};
|
||||
|
||||
struct page_pool_params {
|
||||
@@ -79,6 +82,22 @@ struct page_pool_params {
|
||||
unsigned int offset; /* DMA addr offset */
|
||||
};
|
||||
|
||||
+
|
||||
+static inline int page_pool_ethtool_stats_get_count(void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static inline u8 *page_pool_ethtool_stats_get_strings(u8 *data)
|
||||
+{
|
||||
+ return data;
|
||||
+}
|
||||
+
|
||||
+static inline u64 *page_pool_ethtool_stats_get(u64 *data, void *stats)
|
||||
+{
|
||||
+ return data;
|
||||
+}
|
||||
+
|
||||
struct page_pool {
|
||||
struct page_pool_params p;
|
||||
|
||||
@@ -88,6 +107,9 @@ struct page_pool {
|
||||
unsigned long defer_warn;
|
||||
|
||||
u32 pages_state_hold_cnt;
|
||||
+ unsigned int frag_offset;
|
||||
+ struct page *frag_page;
|
||||
+ long frag_users;
|
||||
|
||||
/*
|
||||
* Data structure for allocation side
|
||||
@@ -137,6 +159,18 @@ static inline struct page *page_pool_dev
|
||||
return page_pool_alloc_pages(pool, gfp);
|
||||
}
|
||||
|
||||
+struct page *page_pool_alloc_frag(struct page_pool *pool, unsigned int *offset,
|
||||
+ unsigned int size, gfp_t gfp);
|
||||
+
|
||||
+static inline struct page *page_pool_dev_alloc_frag(struct page_pool *pool,
|
||||
+ unsigned int *offset,
|
||||
+ unsigned int size)
|
||||
+{
|
||||
+ gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN);
|
||||
+
|
||||
+ return page_pool_alloc_frag(pool, offset, size, gfp);
|
||||
+}
|
||||
+
|
||||
/* get the stored dma direction. A driver might decide to treat this locally and
|
||||
* avoid the extra cache line from page_pool to determine the direction
|
||||
*/
|
||||
@@ -146,6 +180,8 @@ inline enum dma_data_direction page_pool
|
||||
return pool->p.dma_dir;
|
||||
}
|
||||
|
||||
+bool page_pool_return_skb_page(struct page *page);
|
||||
+
|
||||
struct page_pool *page_pool_create(const struct page_pool_params *params);
|
||||
|
||||
#ifdef CONFIG_PAGE_POOL
|
||||
@@ -165,6 +201,7 @@ static inline void page_pool_release_pag
|
||||
struct page *page)
|
||||
{
|
||||
}
|
||||
+
|
||||
#endif
|
||||
|
||||
void page_pool_put_page(struct page_pool *pool, struct page *page,
|
||||
@@ -189,19 +226,48 @@ static inline void page_pool_recycle_dir
|
||||
page_pool_put_full_page(pool, page, true);
|
||||
}
|
||||
|
||||
+#define PAGE_POOL_DMA_USE_PP_FRAG_COUNT \
|
||||
+ (sizeof(dma_addr_t) > sizeof(unsigned long))
|
||||
+
|
||||
static inline dma_addr_t page_pool_get_dma_addr(struct page *page)
|
||||
{
|
||||
- dma_addr_t ret = page->dma_addr[0];
|
||||
- if (sizeof(dma_addr_t) > sizeof(unsigned long))
|
||||
- ret |= (dma_addr_t)page->dma_addr[1] << 16 << 16;
|
||||
+ dma_addr_t ret = page->dma_addr;
|
||||
+
|
||||
+ if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT)
|
||||
+ ret |= (dma_addr_t)page->dma_addr_upper << 16 << 16;
|
||||
+
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void page_pool_set_dma_addr(struct page *page, dma_addr_t addr)
|
||||
{
|
||||
- page->dma_addr[0] = addr;
|
||||
- if (sizeof(dma_addr_t) > sizeof(unsigned long))
|
||||
- page->dma_addr[1] = upper_32_bits(addr);
|
||||
+ page->dma_addr = addr;
|
||||
+ if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT)
|
||||
+ page->dma_addr_upper = upper_32_bits(addr);
|
||||
+}
|
||||
+
|
||||
+static inline void page_pool_set_frag_count(struct page *page, long nr)
|
||||
+{
|
||||
+ atomic_long_set(&page->pp_frag_count, nr);
|
||||
+}
|
||||
+
|
||||
+static inline long page_pool_atomic_sub_frag_count_return(struct page *page,
|
||||
+ long nr)
|
||||
+{
|
||||
+ long ret;
|
||||
+
|
||||
+ /* As suggested by Alexander, atomic_long_read() may cover up the
|
||||
+ * reference count errors, so avoid calling atomic_long_read() in
|
||||
+ * the cases of freeing or draining the page_frags, where we would
|
||||
+ * not expect it to match or that are slowpath anyway.
|
||||
+ */
|
||||
+ if (__builtin_constant_p(nr) &&
|
||||
+ atomic_long_read(&page->pp_frag_count) == nr)
|
||||
+ return 0;
|
||||
+
|
||||
+ ret = atomic_long_sub_return(nr, &page->pp_frag_count);
|
||||
+ WARN_ON(ret < 0);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static inline bool is_page_pool_compiled_in(void)
|
||||
@@ -225,4 +291,23 @@ static inline void page_pool_nid_changed
|
||||
if (unlikely(pool->p.nid != new_nid))
|
||||
page_pool_update_nid(pool, new_nid);
|
||||
}
|
||||
+
|
||||
+static inline void page_pool_ring_lock(struct page_pool *pool)
|
||||
+ __acquires(&pool->ring.producer_lock)
|
||||
+{
|
||||
+ if (in_serving_softirq())
|
||||
+ spin_lock(&pool->ring.producer_lock);
|
||||
+ else
|
||||
+ spin_lock_bh(&pool->ring.producer_lock);
|
||||
+}
|
||||
+
|
||||
+static inline void page_pool_ring_unlock(struct page_pool *pool)
|
||||
+ __releases(&pool->ring.producer_lock)
|
||||
+{
|
||||
+ if (in_serving_softirq())
|
||||
+ spin_unlock(&pool->ring.producer_lock);
|
||||
+ else
|
||||
+ spin_unlock_bh(&pool->ring.producer_lock);
|
||||
+}
|
||||
+
|
||||
#endif /* _NET_PAGE_POOL_H */
|
||||
--- a/net/core/page_pool.c
|
||||
+++ b/net/core/page_pool.c
|
||||
@@ -11,16 +11,22 @@
|
||||
#include <linux/device.h>
|
||||
|
||||
#include <net/page_pool.h>
|
||||
+#include <net/xdp.h>
|
||||
+
|
||||
#include <linux/dma-direction.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/page-flags.h>
|
||||
#include <linux/mm.h> /* for __put_page() */
|
||||
+#include <linux/poison.h>
|
||||
+#include <linux/ethtool.h>
|
||||
|
||||
#include <trace/events/page_pool.h>
|
||||
|
||||
#define DEFER_TIME (msecs_to_jiffies(1000))
|
||||
#define DEFER_WARN_INTERVAL (60 * HZ)
|
||||
|
||||
+#define BIAS_MAX LONG_MAX
|
||||
+
|
||||
static int page_pool_init(struct page_pool *pool,
|
||||
const struct page_pool_params *params)
|
||||
{
|
||||
@@ -64,6 +70,10 @@ static int page_pool_init(struct page_po
|
||||
*/
|
||||
}
|
||||
|
||||
+ if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT &&
|
||||
+ pool->p.flags & PP_FLAG_PAGE_FRAG)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
if (ptr_ring_init(&pool->ring, ring_qsize, GFP_KERNEL) < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -180,40 +190,10 @@ static void page_pool_dma_sync_for_devic
|
||||
pool->p.dma_dir);
|
||||
}
|
||||
|
||||
-/* slow path */
|
||||
-noinline
|
||||
-static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool,
|
||||
- gfp_t _gfp)
|
||||
+static bool page_pool_dma_map(struct page_pool *pool, struct page *page)
|
||||
{
|
||||
- struct page *page;
|
||||
- gfp_t gfp = _gfp;
|
||||
dma_addr_t dma;
|
||||
|
||||
- /* We could always set __GFP_COMP, and avoid this branch, as
|
||||
- * prep_new_page() can handle order-0 with __GFP_COMP.
|
||||
- */
|
||||
- if (pool->p.order)
|
||||
- gfp |= __GFP_COMP;
|
||||
-
|
||||
- /* FUTURE development:
|
||||
- *
|
||||
- * Current slow-path essentially falls back to single page
|
||||
- * allocations, which doesn't improve performance. This code
|
||||
- * need bulk allocation support from the page allocator code.
|
||||
- */
|
||||
-
|
||||
- /* Cache was empty, do real allocation */
|
||||
-#ifdef CONFIG_NUMA
|
||||
- page = alloc_pages_node(pool->p.nid, gfp, pool->p.order);
|
||||
-#else
|
||||
- page = alloc_pages(gfp, pool->p.order);
|
||||
-#endif
|
||||
- if (!page)
|
||||
- return NULL;
|
||||
-
|
||||
- if (!(pool->p.flags & PP_FLAG_DMA_MAP))
|
||||
- goto skip_dma_map;
|
||||
-
|
||||
/* Setup DMA mapping: use 'struct page' area for storing DMA-addr
|
||||
* since dma_addr_t can be either 32 or 64 bits and does not always fit
|
||||
* into page private data (i.e 32bit cpu with 64bit DMA caps)
|
||||
@@ -222,22 +202,53 @@ static struct page *__page_pool_alloc_pa
|
||||
dma = dma_map_page_attrs(pool->p.dev, page, 0,
|
||||
(PAGE_SIZE << pool->p.order),
|
||||
pool->p.dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
|
||||
- if (dma_mapping_error(pool->p.dev, dma)) {
|
||||
- put_page(page);
|
||||
- return NULL;
|
||||
- }
|
||||
+ if (dma_mapping_error(pool->p.dev, dma))
|
||||
+ return false;
|
||||
+
|
||||
page_pool_set_dma_addr(page, dma);
|
||||
|
||||
if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV)
|
||||
page_pool_dma_sync_for_device(pool, page, pool->p.max_len);
|
||||
|
||||
-skip_dma_map:
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+static void page_pool_set_pp_info(struct page_pool *pool,
|
||||
+ struct page *page)
|
||||
+{
|
||||
+ page->pp = pool;
|
||||
+ page->pp_magic |= PP_SIGNATURE;
|
||||
+}
|
||||
+
|
||||
+static void page_pool_clear_pp_info(struct page *page)
|
||||
+{
|
||||
+ page->pp_magic = 0;
|
||||
+ page->pp = NULL;
|
||||
+}
|
||||
+
|
||||
+/* slow path */
|
||||
+noinline
|
||||
+static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool,
|
||||
+ gfp_t gfp)
|
||||
+{
|
||||
+ struct page *page;
|
||||
+
|
||||
+ gfp |= __GFP_COMP;
|
||||
+ page = alloc_pages_node(pool->p.nid, gfp, pool->p.order);
|
||||
+ if (unlikely(!page))
|
||||
+ return NULL;
|
||||
+
|
||||
+ if ((pool->p.flags & PP_FLAG_DMA_MAP) &&
|
||||
+ unlikely(!page_pool_dma_map(pool, page))) {
|
||||
+ put_page(page);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ page_pool_set_pp_info(pool, page);
|
||||
+
|
||||
/* Track how many pages are held 'in-flight' */
|
||||
pool->pages_state_hold_cnt++;
|
||||
-
|
||||
trace_page_pool_state_hold(pool, page, pool->pages_state_hold_cnt);
|
||||
-
|
||||
- /* When page just alloc'ed is should/must have refcnt 1. */
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -302,10 +313,12 @@ void page_pool_release_page(struct page_
|
||||
DMA_ATTR_SKIP_CPU_SYNC);
|
||||
page_pool_set_dma_addr(page, 0);
|
||||
skip_dma_unmap:
|
||||
+ page_pool_clear_pp_info(page);
|
||||
+
|
||||
/* This may be the last page returned, releasing the pool, so
|
||||
* it is not safe to reference pool afterwards.
|
||||
*/
|
||||
- count = atomic_inc_return(&pool->pages_state_release_cnt);
|
||||
+ count = atomic_inc_return_relaxed(&pool->pages_state_release_cnt);
|
||||
trace_page_pool_state_release(pool, page, count);
|
||||
}
|
||||
EXPORT_SYMBOL(page_pool_release_page);
|
||||
@@ -331,7 +344,10 @@ static bool page_pool_recycle_in_ring(st
|
||||
else
|
||||
ret = ptr_ring_produce_bh(&pool->ring, page);
|
||||
|
||||
- return (ret == 0) ? true : false;
|
||||
+ if (!ret)
|
||||
+ return true;
|
||||
+
|
||||
+ return false;
|
||||
}
|
||||
|
||||
/* Only allow direct recycling in special circumstances, into the
|
||||
@@ -350,46 +366,43 @@ static bool page_pool_recycle_in_cache(s
|
||||
return true;
|
||||
}
|
||||
|
||||
-/* page is NOT reusable when:
|
||||
- * 1) allocated when system is under some pressure. (page_is_pfmemalloc)
|
||||
- */
|
||||
-static bool pool_page_reusable(struct page_pool *pool, struct page *page)
|
||||
-{
|
||||
- return !page_is_pfmemalloc(page);
|
||||
-}
|
||||
-
|
||||
/* If the page refcnt == 1, this will try to recycle the page.
|
||||
* if PP_FLAG_DMA_SYNC_DEV is set, we'll try to sync the DMA area for
|
||||
* the configured size min(dma_sync_size, pool->max_len).
|
||||
* If the page refcnt != 1, then the page will be returned to memory
|
||||
* subsystem.
|
||||
*/
|
||||
-void page_pool_put_page(struct page_pool *pool, struct page *page,
|
||||
- unsigned int dma_sync_size, bool allow_direct)
|
||||
-{
|
||||
+static __always_inline struct page *
|
||||
+__page_pool_put_page(struct page_pool *pool, struct page *page,
|
||||
+ unsigned int dma_sync_size, bool allow_direct)
|
||||
+{
|
||||
+ /* It is not the last user for the page frag case */
|
||||
+ if (pool->p.flags & PP_FLAG_PAGE_FRAG &&
|
||||
+ page_pool_atomic_sub_frag_count_return(page, 1))
|
||||
+ return NULL;
|
||||
+
|
||||
/* This allocator is optimized for the XDP mode that uses
|
||||
* one-frame-per-page, but have fallbacks that act like the
|
||||
* regular page allocator APIs.
|
||||
*
|
||||
* refcnt == 1 means page_pool owns page, and can recycle it.
|
||||
+ *
|
||||
+ * page is NOT reusable when allocated when system is under
|
||||
+ * some pressure. (page_is_pfmemalloc)
|
||||
*/
|
||||
- if (likely(page_ref_count(page) == 1 &&
|
||||
- pool_page_reusable(pool, page))) {
|
||||
+ if (likely(page_ref_count(page) == 1 && !page_is_pfmemalloc(page))) {
|
||||
/* Read barrier done in page_ref_count / READ_ONCE */
|
||||
|
||||
if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV)
|
||||
page_pool_dma_sync_for_device(pool, page,
|
||||
dma_sync_size);
|
||||
|
||||
- if (allow_direct && in_serving_softirq())
|
||||
- if (page_pool_recycle_in_cache(page, pool))
|
||||
- return;
|
||||
+ if (allow_direct && in_serving_softirq() &&
|
||||
+ page_pool_recycle_in_cache(page, pool))
|
||||
+ return NULL;
|
||||
|
||||
- if (!page_pool_recycle_in_ring(pool, page)) {
|
||||
- /* Cache full, fallback to free pages */
|
||||
- page_pool_return_page(pool, page);
|
||||
- }
|
||||
- return;
|
||||
+ /* Page found as candidate for recycling */
|
||||
+ return page;
|
||||
}
|
||||
/* Fallback/non-XDP mode: API user have elevated refcnt.
|
||||
*
|
||||
@@ -407,9 +420,98 @@ void page_pool_put_page(struct page_pool
|
||||
/* Do not replace this with page_pool_return_page() */
|
||||
page_pool_release_page(pool, page);
|
||||
put_page(page);
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+void page_pool_put_page(struct page_pool *pool, struct page *page,
|
||||
+ unsigned int dma_sync_size, bool allow_direct)
|
||||
+{
|
||||
+ page = __page_pool_put_page(pool, page, dma_sync_size, allow_direct);
|
||||
+ if (page && !page_pool_recycle_in_ring(pool, page))
|
||||
+ /* Cache full, fallback to free pages */
|
||||
+ page_pool_return_page(pool, page);
|
||||
}
|
||||
EXPORT_SYMBOL(page_pool_put_page);
|
||||
|
||||
+static struct page *page_pool_drain_frag(struct page_pool *pool,
|
||||
+ struct page *page)
|
||||
+{
|
||||
+ long drain_count = BIAS_MAX - pool->frag_users;
|
||||
+
|
||||
+ /* Some user is still using the page frag */
|
||||
+ if (likely(page_pool_atomic_sub_frag_count_return(page,
|
||||
+ drain_count)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (page_ref_count(page) == 1 && !page_is_pfmemalloc(page)) {
|
||||
+ if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV)
|
||||
+ page_pool_dma_sync_for_device(pool, page, -1);
|
||||
+
|
||||
+ return page;
|
||||
+ }
|
||||
+
|
||||
+ page_pool_return_page(pool, page);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void page_pool_free_frag(struct page_pool *pool)
|
||||
+{
|
||||
+ long drain_count = BIAS_MAX - pool->frag_users;
|
||||
+ struct page *page = pool->frag_page;
|
||||
+
|
||||
+ pool->frag_page = NULL;
|
||||
+
|
||||
+ if (!page ||
|
||||
+ page_pool_atomic_sub_frag_count_return(page, drain_count))
|
||||
+ return;
|
||||
+
|
||||
+ page_pool_return_page(pool, page);
|
||||
+}
|
||||
+
|
||||
+struct page *page_pool_alloc_frag(struct page_pool *pool,
|
||||
+ unsigned int *offset,
|
||||
+ unsigned int size, gfp_t gfp)
|
||||
+{
|
||||
+ unsigned int max_size = PAGE_SIZE << pool->p.order;
|
||||
+ struct page *page = pool->frag_page;
|
||||
+
|
||||
+ if (WARN_ON(!(pool->p.flags & PP_FLAG_PAGE_FRAG) ||
|
||||
+ size > max_size))
|
||||
+ return NULL;
|
||||
+
|
||||
+ size = ALIGN(size, dma_get_cache_alignment());
|
||||
+ *offset = pool->frag_offset;
|
||||
+
|
||||
+ if (page && *offset + size > max_size) {
|
||||
+ page = page_pool_drain_frag(pool, page);
|
||||
+ if (page)
|
||||
+ goto frag_reset;
|
||||
+ }
|
||||
+
|
||||
+ if (!page) {
|
||||
+ page = page_pool_alloc_pages(pool, gfp);
|
||||
+ if (unlikely(!page)) {
|
||||
+ pool->frag_page = NULL;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ pool->frag_page = page;
|
||||
+
|
||||
+frag_reset:
|
||||
+ pool->frag_users = 1;
|
||||
+ *offset = 0;
|
||||
+ pool->frag_offset = size;
|
||||
+ page_pool_set_frag_count(page, BIAS_MAX);
|
||||
+ return page;
|
||||
+ }
|
||||
+
|
||||
+ pool->frag_users++;
|
||||
+ pool->frag_offset = *offset + size;
|
||||
+ return page;
|
||||
+}
|
||||
+EXPORT_SYMBOL(page_pool_alloc_frag);
|
||||
+
|
||||
static void page_pool_empty_ring(struct page_pool *pool)
|
||||
{
|
||||
struct page *page;
|
||||
@@ -515,6 +617,8 @@ void page_pool_destroy(struct page_pool
|
||||
if (!page_pool_put(pool))
|
||||
return;
|
||||
|
||||
+ page_pool_free_frag(pool);
|
||||
+
|
||||
if (!page_pool_release(pool))
|
||||
return;
|
||||
|
||||
@@ -541,3 +645,32 @@ void page_pool_update_nid(struct page_po
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(page_pool_update_nid);
|
||||
+
|
||||
+bool page_pool_return_skb_page(struct page *page)
|
||||
+{
|
||||
+ struct page_pool *pp;
|
||||
+
|
||||
+ page = compound_head(page);
|
||||
+
|
||||
+ /* page->pp_magic is OR'ed with PP_SIGNATURE after the allocation
|
||||
+ * in order to preserve any existing bits, such as bit 0 for the
|
||||
+ * head page of compound page and bit 1 for pfmemalloc page, so
|
||||
+ * mask those bits for freeing side when doing below checking,
|
||||
+ * and page_is_pfmemalloc() is checked in __page_pool_put_page()
|
||||
+ * to avoid recycling the pfmemalloc page.
|
||||
+ */
|
||||
+ if (unlikely((page->pp_magic & ~0x3UL) != PP_SIGNATURE))
|
||||
+ return false;
|
||||
+
|
||||
+ pp = page->pp;
|
||||
+
|
||||
+ /* Driver set this to memory recycling info. Reset it on recycle.
|
||||
+ * This will *not* work for NIC using a split-page memory model.
|
||||
+ * The page will be returned to the pool here regardless of the
|
||||
+ * 'flipped' fragment being in use or not.
|
||||
+ */
|
||||
+ page_pool_put_full_page(pp, page, false);
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+EXPORT_SYMBOL(page_pool_return_skb_page);
|
||||
--- a/include/linux/mm_types.h
|
||||
+++ b/include/linux/mm_types.h
|
||||
@@ -97,10 +97,25 @@ struct page {
|
||||
};
|
||||
struct { /* page_pool used by netstack */
|
||||
/**
|
||||
- * @dma_addr: might require a 64-bit value on
|
||||
- * 32-bit architectures.
|
||||
+ * @pp_magic: magic value to avoid recycling non
|
||||
+ * page_pool allocated pages.
|
||||
*/
|
||||
- unsigned long dma_addr[2];
|
||||
+ unsigned long pp_magic;
|
||||
+ struct page_pool *pp;
|
||||
+ unsigned long _pp_mapping_pad;
|
||||
+ unsigned long dma_addr;
|
||||
+ union {
|
||||
+ /**
|
||||
+ * dma_addr_upper: might require a 64-bit
|
||||
+ * value on 32-bit architectures.
|
||||
+ */
|
||||
+ unsigned long dma_addr_upper;
|
||||
+ /**
|
||||
+ * For frag page support, not supported in
|
||||
+ * 32-bit architectures with 64-bit DMA.
|
||||
+ */
|
||||
+ atomic_long_t pp_frag_count;
|
||||
+ };
|
||||
};
|
||||
struct { /* slab, slob and slub */
|
||||
union {
|
||||
--- a/net/core/skbuff.c
|
||||
+++ b/net/core/skbuff.c
|
||||
@@ -594,13 +594,22 @@ static void skb_clone_fraglist(struct sk
|
||||
skb_get(list);
|
||||
}
|
||||
|
||||
+static bool skb_pp_recycle(struct sk_buff *skb, void *data)
|
||||
+{
|
||||
+ if (!IS_ENABLED(CONFIG_PAGE_POOL) || !skb->pp_recycle)
|
||||
+ return false;
|
||||
+ return page_pool_return_skb_page(virt_to_page(data));
|
||||
+}
|
||||
+
|
||||
static void skb_free_head(struct sk_buff *skb)
|
||||
{
|
||||
unsigned char *head = skb->head;
|
||||
|
||||
- if (skb->head_frag)
|
||||
+ if (skb->head_frag) {
|
||||
+ if (skb_pp_recycle(skb, head))
|
||||
+ return;
|
||||
skb_free_frag(head);
|
||||
- else
|
||||
+ } else
|
||||
kfree(head);
|
||||
}
|
||||
|
||||
@@ -612,16 +621,27 @@ static void skb_release_data(struct sk_b
|
||||
if (skb->cloned &&
|
||||
atomic_sub_return(skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1,
|
||||
&shinfo->dataref))
|
||||
- return;
|
||||
+ goto exit;
|
||||
|
||||
for (i = 0; i < shinfo->nr_frags; i++)
|
||||
- __skb_frag_unref(&shinfo->frags[i]);
|
||||
+ __skb_frag_unref(&shinfo->frags[i], skb->pp_recycle);
|
||||
|
||||
if (shinfo->frag_list)
|
||||
kfree_skb_list(shinfo->frag_list);
|
||||
|
||||
skb_zcopy_clear(skb, true);
|
||||
skb_free_head(skb);
|
||||
+exit:
|
||||
+ /* When we clone an SKB we copy the reycling bit. The pp_recycle
|
||||
+ * bit is only set on the head though, so in order to avoid races
|
||||
+ * while trying to recycle fragments on __skb_frag_unref() we need
|
||||
+ * to make one SKB responsible for triggering the recycle path.
|
||||
+ * So disable the recycling bit if an SKB is cloned and we have
|
||||
+ * additional references to to the fragmented part of the SKB.
|
||||
+ * Eventually the last SKB will have the recycling bit set and it's
|
||||
+ * dataref set to 0, which will trigger the recycling
|
||||
+ */
|
||||
+ skb->pp_recycle = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1003,6 +1023,7 @@ static struct sk_buff *__skb_clone(struc
|
||||
n->nohdr = 0;
|
||||
n->peeked = 0;
|
||||
C(pfmemalloc);
|
||||
+ C(pp_recycle);
|
||||
n->destructor = NULL;
|
||||
C(tail);
|
||||
C(end);
|
||||
@@ -3421,7 +3442,7 @@ int skb_shift(struct sk_buff *tgt, struc
|
||||
fragto = &skb_shinfo(tgt)->frags[merge];
|
||||
|
||||
skb_frag_size_add(fragto, skb_frag_size(fragfrom));
|
||||
- __skb_frag_unref(fragfrom);
|
||||
+ __skb_frag_unref(fragfrom, skb->pp_recycle);
|
||||
}
|
||||
|
||||
/* Reposition in the original skb */
|
||||
@@ -5189,6 +5210,20 @@ bool skb_try_coalesce(struct sk_buff *to
|
||||
if (skb_cloned(to))
|
||||
return false;
|
||||
|
||||
+ /* In general, avoid mixing slab allocated and page_pool allocated
|
||||
+ * pages within the same SKB. However when @to is not pp_recycle and
|
||||
+ * @from is cloned, we can transition frag pages from page_pool to
|
||||
+ * reference counted.
|
||||
+ *
|
||||
+ * On the other hand, don't allow coalescing two pp_recycle SKBs if
|
||||
+ * @from is cloned, in case the SKB is using page_pool fragment
|
||||
+ * references (PP_FLAG_PAGE_FRAG). Since we only take full page
|
||||
+ * references for cloned SKBs at the moment that would result in
|
||||
+ * inconsistent reference counts.
|
||||
+ */
|
||||
+ if (to->pp_recycle != (from->pp_recycle && !skb_cloned(from)))
|
||||
+ return false;
|
||||
+
|
||||
if (len <= skb_tailroom(to)) {
|
||||
if (len)
|
||||
BUG_ON(skb_copy_bits(from, 0, skb_put(to, len), len));
|
||||
--- a/include/linux/skbuff.h
|
||||
+++ b/include/linux/skbuff.h
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <linux/in6.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <net/flow.h>
|
||||
+#include <net/page_pool.h>
|
||||
#if IS_ENABLED(CONFIG_NF_CONNTRACK)
|
||||
#include <linux/netfilter/nf_conntrack_common.h>
|
||||
#endif
|
||||
@@ -786,7 +787,8 @@ struct sk_buff {
|
||||
fclone:2,
|
||||
peeked:1,
|
||||
head_frag:1,
|
||||
- pfmemalloc:1;
|
||||
+ pfmemalloc:1,
|
||||
+ pp_recycle:1; /* page_pool recycle indicator */
|
||||
#ifdef CONFIG_SKB_EXTENSIONS
|
||||
__u8 active_extensions;
|
||||
#endif
|
||||
@@ -3029,9 +3031,15 @@ static inline void skb_frag_ref(struct s
|
||||
*
|
||||
* Releases a reference on the paged fragment @frag.
|
||||
*/
|
||||
-static inline void __skb_frag_unref(skb_frag_t *frag)
|
||||
+static inline void __skb_frag_unref(skb_frag_t *frag, bool recycle)
|
||||
{
|
||||
- put_page(skb_frag_page(frag));
|
||||
+ struct page *page = skb_frag_page(frag);
|
||||
+
|
||||
+#ifdef CONFIG_PAGE_POOL
|
||||
+ if (recycle && page_pool_return_skb_page(page))
|
||||
+ return;
|
||||
+#endif
|
||||
+ put_page(page);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3043,7 +3051,7 @@ static inline void __skb_frag_unref(skb_
|
||||
*/
|
||||
static inline void skb_frag_unref(struct sk_buff *skb, int f)
|
||||
{
|
||||
- __skb_frag_unref(&skb_shinfo(skb)->frags[f]);
|
||||
+ __skb_frag_unref(&skb_shinfo(skb)->frags[f], skb->pp_recycle);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4642,5 +4650,12 @@ static inline u64 skb_get_kcov_handle(st
|
||||
#endif
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_PAGE_POOL
|
||||
+static inline void skb_mark_for_recycle(struct sk_buff *skb)
|
||||
+{
|
||||
+ skb->pp_recycle = 1;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _LINUX_SKBUFF_H */
|
||||
--- a/drivers/net/ethernet/marvell/sky2.c
|
||||
+++ b/drivers/net/ethernet/marvell/sky2.c
|
||||
@@ -2501,7 +2501,7 @@ static void skb_put_frags(struct sk_buff
|
||||
|
||||
if (length == 0) {
|
||||
/* don't need this page */
|
||||
- __skb_frag_unref(frag);
|
||||
+ __skb_frag_unref(frag, false);
|
||||
--skb_shinfo(skb)->nr_frags;
|
||||
} else {
|
||||
size = min(length, (unsigned) PAGE_SIZE);
|
||||
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
|
||||
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
|
||||
@@ -526,7 +526,7 @@ static int mlx4_en_complete_rx_desc(stru
|
||||
fail:
|
||||
while (nr > 0) {
|
||||
nr--;
|
||||
- __skb_frag_unref(skb_shinfo(skb)->frags + nr);
|
||||
+ __skb_frag_unref(skb_shinfo(skb)->frags + nr, false);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
--- a/net/tls/tls_device.c
|
||||
+++ b/net/tls/tls_device.c
|
||||
@@ -131,7 +131,7 @@ static void destroy_record(struct tls_re
|
||||
int i;
|
||||
|
||||
for (i = 0; i < record->num_frags; i++)
|
||||
- __skb_frag_unref(&record->frags[i]);
|
||||
+ __skb_frag_unref(&record->frags[i], false);
|
||||
kfree(record);
|
||||
}
|
||||
|
||||
--- a/include/linux/poison.h
|
||||
+++ b/include/linux/poison.h
|
||||
@@ -82,4 +82,7 @@
|
||||
/********** security/ **********/
|
||||
#define KEY_DESTROY 0xbd
|
||||
|
||||
+/********** net/core/page_pool.c **********/
|
||||
+#define PP_SIGNATURE (0x40 + POISON_POINTER_DELTA)
|
||||
+
|
||||
#endif
|
||||
--- a/include/linux/mm.h
|
||||
+++ b/include/linux/mm.h
|
||||
@@ -1602,7 +1602,7 @@ static inline bool page_is_pfmemalloc(st
|
||||
* Page index cannot be this large so this must be
|
||||
* a pfmemalloc page.
|
||||
*/
|
||||
- return page->index == -1UL;
|
||||
+ return (uintptr_t)page->lru.next & BIT(1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1611,12 +1611,12 @@ static inline bool page_is_pfmemalloc(st
|
||||
*/
|
||||
static inline void set_page_pfmemalloc(struct page *page)
|
||||
{
|
||||
- page->index = -1UL;
|
||||
+ page->lru.next = (void *)BIT(1);
|
||||
}
|
||||
|
||||
static inline void clear_page_pfmemalloc(struct page *page)
|
||||
{
|
||||
- page->index = 0;
|
||||
+ page->lru.next = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -7578,6 +7578,7 @@ CONFIG_ZONE_DMA=y
|
||||
# CONFIG_ZPA2326 is not set
|
||||
# CONFIG_ZPOOL is not set
|
||||
# CONFIG_ZRAM is not set
|
||||
# CONFIG_ZRAM_DEF_COMP_842 is not set
|
||||
# CONFIG_ZRAM_DEF_COMP_LZ4 is not set
|
||||
# CONFIG_ZRAM_DEF_COMP_LZ4HC is not set
|
||||
# CONFIG_ZRAM_DEF_COMP_LZO is not set
|
||||
|
||||
@ -197,3 +197,14 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
|
||||
config SND_JACK
|
||||
bool
|
||||
--- a/net/Kconfig
|
||||
+++ b/net/Kconfig
|
||||
@@ -436,7 +436,7 @@ config NET_DEVLINK
|
||||
default n
|
||||
|
||||
config PAGE_POOL
|
||||
- bool
|
||||
+ bool "Page pool support"
|
||||
|
||||
config FAILOVER
|
||||
tristate "Generic failover module"
|
||||
|
||||
@ -60,7 +60,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
*/
|
||||
--- a/include/linux/skbuff.h
|
||||
+++ b/include/linux/skbuff.h
|
||||
@@ -2725,6 +2725,10 @@ static inline int pskb_trim(struct sk_bu
|
||||
@@ -2727,6 +2727,10 @@ static inline int pskb_trim(struct sk_bu
|
||||
return (len < skb->len) ? __pskb_trim(skb, len) : 0;
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
/**
|
||||
* pskb_trim_unique - remove end from a paged unique (not cloned) buffer
|
||||
* @skb: buffer to alter
|
||||
@@ -2856,16 +2860,6 @@ static inline struct sk_buff *dev_alloc_
|
||||
@@ -2858,16 +2862,6 @@ static inline struct sk_buff *dev_alloc_
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -197,3 +197,14 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||
|
||||
config SND_JACK
|
||||
bool
|
||||
--- a/net/Kconfig
|
||||
+++ b/net/Kconfig
|
||||
@@ -432,7 +432,7 @@ config NET_DEVLINK
|
||||
default n
|
||||
|
||||
config PAGE_POOL
|
||||
- bool
|
||||
+ bool "Page pool support"
|
||||
|
||||
config PAGE_POOL_STATS
|
||||
default n
|
||||
|
||||
@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
--- a/include/linux/skbuff.h
|
||||
+++ b/include/linux/skbuff.h
|
||||
@@ -2691,7 +2691,7 @@ static inline int pskb_network_may_pull(
|
||||
@@ -2693,7 +2693,7 @@ static inline int pskb_network_may_pull(
|
||||
* NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8)
|
||||
*/
|
||||
#ifndef NET_SKB_PAD
|
||||
|
||||
@ -22,7 +22,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
#endif
|
||||
--- a/include/linux/skbuff.h
|
||||
+++ b/include/linux/skbuff.h
|
||||
@@ -861,6 +861,7 @@ struct sk_buff {
|
||||
@@ -863,6 +863,7 @@ struct sk_buff {
|
||||
__u8 decrypted:1;
|
||||
#endif
|
||||
__u8 scm_io_uring:1;
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
From: Alexander Duyck <alexanderduyck@fb.com>
|
||||
Date: Thu, 26 Jan 2023 11:06:59 -0800
|
||||
Subject: [PATCH] skb: Do mix page pool and page referenced frags in GRO
|
||||
|
||||
GSO should not merge page pool recycled frames with standard reference
|
||||
counted frames. Traditionally this didn't occur, at least not often.
|
||||
However as we start looking at adding support for wireless adapters there
|
||||
becomes the potential to mix the two due to A-MSDU repartitioning frames in
|
||||
the receive path. There are possibly other places where this may have
|
||||
occurred however I suspect they must be few and far between as we have not
|
||||
seen this issue until now.
|
||||
|
||||
Fixes: 53e0961da1c7 ("page_pool: add frag page recycling support in page pool")
|
||||
Reported-by: Felix Fietkau <nbd@nbd.name>
|
||||
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
|
||||
---
|
||||
|
||||
--- a/net/core/skbuff.c
|
||||
+++ b/net/core/skbuff.c
|
||||
@@ -4166,6 +4166,15 @@ int skb_gro_receive(struct sk_buff *p, s
|
||||
if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush))
|
||||
return -E2BIG;
|
||||
|
||||
+ /* Do not splice page pool based packets w/ non-page pool
|
||||
+ * packets. This can result in reference count issues as page
|
||||
+ * pool pages will not decrement the reference count and will
|
||||
+ * instead be immediately returned to the pool or have frag
|
||||
+ * count decremented.
|
||||
+ */
|
||||
+ if (p->pp_recycle != skb->pp_recycle)
|
||||
+ return -ETOOMANYREFS;
|
||||
+
|
||||
lp = NAPI_GRO_CB(p)->last;
|
||||
pinfo = skb_shinfo(lp);
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
From: Alexander Duyck <alexanderduyck@fb.com>
|
||||
Date: Thu, 26 Jan 2023 11:06:59 -0800
|
||||
Subject: [PATCH] skb: Do mix page pool and page referenced frags in GRO
|
||||
|
||||
GSO should not merge page pool recycled frames with standard reference
|
||||
counted frames. Traditionally this didn't occur, at least not often.
|
||||
However as we start looking at adding support for wireless adapters there
|
||||
becomes the potential to mix the two due to A-MSDU repartitioning frames in
|
||||
the receive path. There are possibly other places where this may have
|
||||
occurred however I suspect they must be few and far between as we have not
|
||||
seen this issue until now.
|
||||
|
||||
Fixes: 53e0961da1c7 ("page_pool: add frag page recycling support in page pool")
|
||||
Reported-by: Felix Fietkau <nbd@nbd.name>
|
||||
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
|
||||
---
|
||||
|
||||
--- a/net/core/skbuff.c
|
||||
+++ b/net/core/skbuff.c
|
||||
@@ -4348,6 +4348,15 @@ int skb_gro_receive(struct sk_buff *p, s
|
||||
if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush))
|
||||
return -E2BIG;
|
||||
|
||||
+ /* Do not splice page pool based packets w/ non-page pool
|
||||
+ * packets. This can result in reference count issues as page
|
||||
+ * pool pages will not decrement the reference count and will
|
||||
+ * instead be immediately returned to the pool or have frag
|
||||
+ * count decremented.
|
||||
+ */
|
||||
+ if (p->pp_recycle != skb->pp_recycle)
|
||||
+ return -ETOOMANYREFS;
|
||||
+
|
||||
lp = NAPI_GRO_CB(p)->last;
|
||||
pinfo = skb_shinfo(lp);
|
||||
|
||||
@ -95,7 +95,7 @@ platform_check_image() {
|
||||
;;
|
||||
*)
|
||||
nand_do_platform_check "$board" "$1"
|
||||
return 0
|
||||
return $?
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@ -74,6 +74,7 @@ platform_check_image() {
|
||||
totolink,a8000ru|\
|
||||
xiaomi,redmi-router-ax6s)
|
||||
nand_do_platform_check "$board" "$1"
|
||||
return $?
|
||||
;;
|
||||
*)
|
||||
[ "$magic" != "d00dfeed" ] && {
|
||||
|
||||
@ -71,8 +71,6 @@ CONFIG_DMA_VIRTUAL_CHANNELS=y
|
||||
CONFIG_DTC=y
|
||||
CONFIG_DWMAC_GENERIC=y
|
||||
CONFIG_EXT4_FS=y
|
||||
CONFIG_EXT4_FS_POSIX_ACL=y
|
||||
CONFIG_EXT4_FS_SECURITY=y
|
||||
# CONFIG_FIT_IMAGE_FDT_BOSTON is not set
|
||||
# CONFIG_FIT_IMAGE_FDT_JAGUAR2 is not set
|
||||
# CONFIG_FIT_IMAGE_FDT_LUTON is not set
|
||||
@ -120,6 +118,7 @@ CONFIG_HAS_DMA=y
|
||||
CONFIG_HAS_IOMEM=y
|
||||
CONFIG_HAS_IOPORT_MAP=y
|
||||
CONFIG_HOTPLUG_CPU=y
|
||||
CONFIG_HZ_PERIODIC=y
|
||||
CONFIG_I2C=y
|
||||
CONFIG_I2C_BOARDINFO=y
|
||||
CONFIG_I2C_IMG=y
|
||||
@ -138,7 +137,6 @@ CONFIG_LEDS_PWM=y
|
||||
# CONFIG_LEGACY_BOARD_OCELOT is not set
|
||||
# CONFIG_LEGACY_BOARD_SEAD3 is not set
|
||||
CONFIG_LIBFDT=y
|
||||
CONFIG_LKDTM=y
|
||||
CONFIG_LOCK_DEBUGGING_SUPPORT=y
|
||||
CONFIG_LOG_BUF_SHIFT=18
|
||||
CONFIG_LZO_COMPRESS=y
|
||||
@ -201,17 +199,12 @@ CONFIG_MTD_UBI_BEB_LIMIT=20
|
||||
CONFIG_MTD_UBI_BLOCK=y
|
||||
CONFIG_MTD_UBI_FASTMAP=y
|
||||
CONFIG_MTD_UBI_WL_THRESHOLD=4096
|
||||
CONFIG_NAMESPACES=y
|
||||
CONFIG_NEED_DMA_MAP_STATE=y
|
||||
CONFIG_NET_FLOW_LIMIT=y
|
||||
CONFIG_NET_NS=y
|
||||
CONFIG_NET_PTP_CLASSIFY=y
|
||||
CONFIG_NET_SELFTESTS=y
|
||||
CONFIG_NLS=y
|
||||
CONFIG_NO_EXCEPT_FILL=y
|
||||
CONFIG_NO_HZ=y
|
||||
CONFIG_NO_HZ_COMMON=y
|
||||
CONFIG_NO_HZ_IDLE=y
|
||||
CONFIG_NR_CPUS=4
|
||||
CONFIG_OF=y
|
||||
CONFIG_OF_ADDRESS=y
|
||||
@ -234,11 +227,8 @@ CONFIG_PINCTRL=y
|
||||
CONFIG_PINCTRL_PISTACHIO=y
|
||||
CONFIG_POWER_SUPPLY=y
|
||||
CONFIG_PPS=y
|
||||
# CONFIG_PREEMPT_NONE is not set
|
||||
CONFIG_PREEMPT_VOLUNTARY=y
|
||||
CONFIG_PRINTK_TIME=y
|
||||
CONFIG_PROC_EVENTS=y
|
||||
CONFIG_PROFILING=y
|
||||
CONFIG_PTP_1588_CLOCK=y
|
||||
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
|
||||
CONFIG_PWM=y
|
||||
@ -329,7 +319,6 @@ CONFIG_USB_GADGET=y
|
||||
CONFIG_USB_ROLE_SWITCH=y
|
||||
CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_SUPPORT=y
|
||||
CONFIG_USER_NS=y
|
||||
CONFIG_USE_OF=y
|
||||
# CONFIG_VIRT_BOARD_RANCHU is not set
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
|
||||
@ -1,23 +1,12 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
#include "mt7621.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include "mt7621_xiaomi_mi-router-4a-common.dtsi"
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
led-boot = &led_status_yellow;
|
||||
led-failsafe = &led_status_yellow;
|
||||
led-running = &led_status_blue;
|
||||
led-upgrade = &led_status_yellow;
|
||||
label-mac-device = &gmac1;
|
||||
};
|
||||
|
||||
chosen {
|
||||
bootargs = "console=ttyS0,115200n8";
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
@ -31,108 +20,16 @@
|
||||
gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
reset {
|
||||
label = "reset";
|
||||
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_RESTART>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
status = "okay";
|
||||
|
||||
flash@0 {
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <50000000>;
|
||||
m25p,fast-read;
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "u-boot";
|
||||
reg = <0x0 0x30000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@30000 {
|
||||
label = "u-boot-env";
|
||||
reg = <0x30000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@40000 {
|
||||
label = "Bdata";
|
||||
reg = <0x40000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
factory: partition@50000 {
|
||||
label = "factory";
|
||||
reg = <0x50000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@60000 {
|
||||
label = "crash";
|
||||
reg = <0x60000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@70000 {
|
||||
label = "cfg_bak";
|
||||
reg = <0x70000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@80000 {
|
||||
label = "overlay";
|
||||
reg = <0x80000 0x100000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
firmware: partition@180000 {
|
||||
compatible = "denx,uimage";
|
||||
label = "firmware";
|
||||
reg = <0x180000 0xe80000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
&wifi0 {
|
||||
mediatek,mtd-eeprom = <&factory 0x8000>;
|
||||
ieee80211-freq-limit = <5000000 6000000>;
|
||||
};
|
||||
|
||||
&pcie {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
wifi@0,0 {
|
||||
compatible = "pci14c3,7662";
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
mediatek,mtd-eeprom = <&factory 0x8000>;
|
||||
ieee80211-freq-limit = <5000000 6000000>;
|
||||
};
|
||||
};
|
||||
|
||||
&pcie1 {
|
||||
wifi@0,0 {
|
||||
compatible = "pci14c3,7603";
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
mediatek,mtd-eeprom = <&factory 0x0000>;
|
||||
ieee80211-freq-limit = <2400000 2500000>;
|
||||
};
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
nvmem-cells = <&macaddr_factory_e000>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
&wifi1 {
|
||||
mediatek,mtd-eeprom = <&factory 0x0000>;
|
||||
ieee80211-freq-limit = <2400000 2500000>;
|
||||
};
|
||||
|
||||
&gmac1 {
|
||||
@ -163,24 +60,3 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&state_default {
|
||||
gpio {
|
||||
groups = "jtag", "uart2", "uart3", "wdt";
|
||||
function = "gpio";
|
||||
};
|
||||
};
|
||||
|
||||
&factory {
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
macaddr_factory_e000: macaddr@e000 {
|
||||
reg = <0xe000 0x6>;
|
||||
};
|
||||
|
||||
macaddr_factory_e006: macaddr@e006 {
|
||||
reg = <0xe006 0x6>;
|
||||
};
|
||||
};
|
||||
|
||||
138
target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi
Normal file
138
target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi
Normal file
@ -0,0 +1,138 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
#include "mt7621.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
|
||||
/ {
|
||||
aliases {
|
||||
led-boot = &led_status_yellow;
|
||||
led-failsafe = &led_status_yellow;
|
||||
led-running = &led_status_blue;
|
||||
led-upgrade = &led_status_yellow;
|
||||
};
|
||||
|
||||
chosen {
|
||||
bootargs = "console=ttyS0,115200n8";
|
||||
};
|
||||
|
||||
keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
reset {
|
||||
label = "reset";
|
||||
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
|
||||
linux,code = <KEY_RESTART>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
status = "okay";
|
||||
|
||||
flash@0 {
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <50000000>;
|
||||
m25p,fast-read;
|
||||
|
||||
partitions: partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "u-boot";
|
||||
reg = <0x0 0x30000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@30000 {
|
||||
label = "u-boot-env";
|
||||
reg = <0x30000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@40000 {
|
||||
label = "Bdata";
|
||||
reg = <0x40000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
factory: partition@50000 {
|
||||
label = "factory";
|
||||
reg = <0x50000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@60000 {
|
||||
label = "crash";
|
||||
reg = <0x60000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@70000 {
|
||||
label = "cfg_bak";
|
||||
reg = <0x70000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@80000 {
|
||||
label = "overlay";
|
||||
reg = <0x80000 0x100000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
firmware: partition@180000 {
|
||||
compatible = "denx,uimage";
|
||||
label = "firmware";
|
||||
reg = <0x180000 0xe80000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&pcie {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pcie0 {
|
||||
wifi0: wifi@0,0 {
|
||||
compatible = "mediatek,mt76";
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
};
|
||||
};
|
||||
|
||||
&pcie1 {
|
||||
wifi1: wifi@0,0 {
|
||||
compatible = "mediatek,mt76";
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
};
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
nvmem-cells = <&macaddr_factory_e000>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
&state_default {
|
||||
gpio {
|
||||
groups = "jtag", "uart2", "uart3", "wdt";
|
||||
function = "gpio";
|
||||
};
|
||||
};
|
||||
|
||||
&factory {
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
macaddr_factory_e000: macaddr@e000 {
|
||||
reg = <0xe000 0x6>;
|
||||
};
|
||||
|
||||
macaddr_factory_e006: macaddr@e006 {
|
||||
reg = <0xe006 0x6>;
|
||||
};
|
||||
};
|
||||
@ -0,0 +1,80 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
#include "mt7621_xiaomi_mi-router-4a-common.dtsi"
|
||||
|
||||
/ {
|
||||
compatible = "xiaomi,mi-router-4a-gigabit-v2", "mediatek,mt7621-soc";
|
||||
model = "Xiaomi Mi Router 4A Gigabit Edition v2";
|
||||
|
||||
aliases {
|
||||
label-mac-device = &wan;
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
led_status_blue: status_blue {
|
||||
label = "blue:status";
|
||||
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led_status_yellow: status_yellow {
|
||||
label = "yellow:status";
|
||||
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
wan_blue {
|
||||
label = "blue:wan";
|
||||
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
wan_yellow {
|
||||
label = "yellow:wan";
|
||||
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&partitions {
|
||||
partition@180000 {
|
||||
// size changed against to the common dtsi
|
||||
reg = <0x180000 0xe70000>;
|
||||
};
|
||||
|
||||
partition@ff0000 {
|
||||
label = "Config";
|
||||
reg = <0xff0000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
};
|
||||
|
||||
&wifi0 {
|
||||
mediatek,mtd-eeprom = <&factory 0x0000>;
|
||||
ieee80211-freq-limit = <2400000 2500000>;
|
||||
};
|
||||
|
||||
&wifi1 {
|
||||
mediatek,mtd-eeprom = <&factory 0x8000>;
|
||||
ieee80211-freq-limit = <5000000 6000000>;
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
ports {
|
||||
port@1 {
|
||||
status = "okay";
|
||||
label = "lan1";
|
||||
};
|
||||
|
||||
port@2 {
|
||||
status = "okay";
|
||||
label = "lan2";
|
||||
};
|
||||
|
||||
wan: port@3 {
|
||||
status = "okay";
|
||||
label = "wan";
|
||||
nvmem-cells = <&macaddr_factory_e006>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -46,7 +46,6 @@
|
||||
led_power: power {
|
||||
label = "green:power";
|
||||
gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
|
||||
default-state = "keep";
|
||||
};
|
||||
|
||||
internet {
|
||||
@ -77,6 +76,23 @@
|
||||
gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
virtual_flash {
|
||||
compatible = "mtd-concat";
|
||||
devices = <&firmware1 &firmware2>;
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
compatible = "denx,uimage";
|
||||
label = "firmware";
|
||||
reg = <0x0 0x1d20000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
@ -85,8 +101,7 @@
|
||||
flash@0 {
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <10000000>;
|
||||
broken-flash-reset;
|
||||
spi-max-frequency = <32000000>;
|
||||
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
@ -106,14 +121,13 @@
|
||||
};
|
||||
|
||||
factory: partition@40000 {
|
||||
label = "factory";
|
||||
label = "rf-eeprom";
|
||||
reg = <0x40000 0x10000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@50000 {
|
||||
compatible = "denx,uimage";
|
||||
label = "firmware";
|
||||
firmware1: partition@50000 {
|
||||
label = "firmware_1";
|
||||
reg = <0x50000 0xe90000>;
|
||||
};
|
||||
|
||||
@ -153,10 +167,9 @@
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@1050000 {
|
||||
firmware2: partition@1050000 {
|
||||
label = "firmware_2";
|
||||
reg = <0x1050000 0xe90000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@1ee0000 {
|
||||
@ -189,6 +202,7 @@
|
||||
|
||||
&pcie0 {
|
||||
mt76@0,0 {
|
||||
compatible = "mediatek,mt76";
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
mediatek,mtd-eeprom = <&factory 0x8000>;
|
||||
ieee80211-freq-limit = <5000000 6000000>;
|
||||
|
||||
@ -1306,7 +1306,7 @@ define Device/keenetic_kn-3010
|
||||
DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap
|
||||
IMAGES += factory.bin
|
||||
IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to $$$$(BLOCKSIZE) | \
|
||||
check-size | zyimage -d 8400912 -v "KN-3010"
|
||||
check-size | zyimage -d 0x803010 -v "KN-3010"
|
||||
endef
|
||||
TARGET_DEVICES += keenetic_kn-3010
|
||||
|
||||
@ -2429,6 +2429,17 @@ define Device/xiaomi_mi-router-4a-gigabit
|
||||
endef
|
||||
TARGET_DEVICES += xiaomi_mi-router-4a-gigabit
|
||||
|
||||
define Device/xiaomi_mi-router-4a-gigabit-v2
|
||||
$(Device/dsa-migration)
|
||||
$(Device/uimage-lzma-loader)
|
||||
IMAGE_SIZE := 14784k
|
||||
DEVICE_VENDOR := Xiaomi
|
||||
DEVICE_MODEL := Mi Router 4A
|
||||
DEVICE_VARIANT := Gigabit Edition v2
|
||||
DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap
|
||||
endef
|
||||
TARGET_DEVICES += xiaomi_mi-router-4a-gigabit-v2
|
||||
|
||||
define Device/xiaomi_mi-router-ac2100
|
||||
$(Device/xiaomi_nand_separate)
|
||||
DEVICE_MODEL := Mi Router AC2100
|
||||
|
||||
@ -1032,7 +1032,7 @@ endef
|
||||
TARGET_DEVICES += zbtlink_zbt-we1226
|
||||
|
||||
define Device/zyxel_keenetic-extra-ii
|
||||
IMAGE_SIZE := 14912k
|
||||
IMAGE_SIZE := 29824k
|
||||
BLOCKSIZE := 64k
|
||||
DEVICE_VENDOR := ZyXEL
|
||||
DEVICE_MODEL := Keenetic Extra II
|
||||
|
||||
@ -179,6 +179,9 @@ tplink,re650-v2)
|
||||
tplink,tl-wpa8631p-v3)
|
||||
ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan"
|
||||
;;
|
||||
xiaomi,mi-router-4a-gigabit-v2)
|
||||
ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link"
|
||||
;;
|
||||
xiaomi,mi-router-ac2100)
|
||||
ucidef_set_led_netdev "wan-blue" "WAN (blue)" "blue:wan" "wan"
|
||||
;;
|
||||
|
||||
@ -72,7 +72,8 @@ ramips_setup_interfaces()
|
||||
xiaomi,mi-router-3g|\
|
||||
xiaomi,mi-router-3g-v2|\
|
||||
xiaomi,mi-router-4|\
|
||||
xiaomi,mi-router-4a-gigabit)
|
||||
xiaomi,mi-router-4a-gigabit|\
|
||||
xiaomi,mi-router-4a-gigabit-v2)
|
||||
ucidef_set_interfaces_lan_wan "lan1 lan2" "wan"
|
||||
;;
|
||||
bolt,arion)
|
||||
|
||||
@ -228,8 +228,7 @@ ramips_setup_macs()
|
||||
netgear,r6080|\
|
||||
netgear,r6120|\
|
||||
wrtnode,wrtnode2p|\
|
||||
wrtnode,wrtnode2r|\
|
||||
zyxel,keenetic-extra-ii)
|
||||
wrtnode,wrtnode2r)
|
||||
wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1)
|
||||
;;
|
||||
hiwifi,hc5611|\
|
||||
@ -253,7 +252,8 @@ ramips_setup_macs()
|
||||
totolink,lr1200)
|
||||
wan_mac=$(mtd_get_mac_binary factory 0x2e)
|
||||
;;
|
||||
keenetic,kn-1613)
|
||||
keenetic,kn-1613|\
|
||||
zyxel,keenetic-extra-ii)
|
||||
wan_mac=$(mtd_get_mac_binary rf-eeprom 0x28)
|
||||
;;
|
||||
linksys,e5400)
|
||||
|
||||
@ -112,7 +112,7 @@
|
||||
port@24 {
|
||||
reg = <24>;
|
||||
label = "lan9";
|
||||
phy-handle = <14>;
|
||||
phy-handle = <&phy24>;
|
||||
phy-mode = "1000base-x";
|
||||
managed = "in-band-status";
|
||||
sfp = <&sfp0>;
|
||||
@ -121,7 +121,7 @@
|
||||
port@26 {
|
||||
reg = <26>;
|
||||
label = "lan10";
|
||||
phy-handle = <15>;
|
||||
phy-handle = <&phy26>;
|
||||
phy-mode = "1000base-x";
|
||||
managed = "in-band-status";
|
||||
sfp = <&sfp1>;
|
||||
|
||||
@ -112,7 +112,7 @@
|
||||
port@24 {
|
||||
reg = <24>;
|
||||
label = "lan9";
|
||||
phy-handle = <14>;
|
||||
phy-handle = <&phy24>;
|
||||
phy-mode = "1000base-x";
|
||||
managed = "in-band-status";
|
||||
sfp = <&sfp0>;
|
||||
@ -121,7 +121,7 @@
|
||||
port@26 {
|
||||
reg = <26>;
|
||||
label = "lan10";
|
||||
phy-handle = <15>;
|
||||
phy-handle = <&phy26>;
|
||||
phy-mode = "1000base-x";
|
||||
managed = "in-band-status";
|
||||
sfp = <&sfp1>;
|
||||
|
||||
@ -57,14 +57,6 @@
|
||||
interrupts = <2>, <3>, <4>, <5>, <6>, <7>;
|
||||
};
|
||||
|
||||
rtl9300clock: rtl9300clock@3200 {
|
||||
compatible = "realtek,rtl9300clock";
|
||||
reg = <0x3200 0x10>, <0x3210 0x10>;
|
||||
|
||||
interrupt-parent = <&intc>;
|
||||
interrupts = <7 5>, <8 5>;
|
||||
};
|
||||
|
||||
spi0: spi@1200 {
|
||||
compatible = "realtek,rtl8380-spi";
|
||||
reg = <0x1200 0x100>;
|
||||
@ -73,6 +65,16 @@
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
timer0: timer@3200 {
|
||||
compatible = "realtek,rtl930x-timer", "realtek,otto-timer";
|
||||
reg = <0x3200 0x10>, <0x3210 0x10>, <0x3220 0x10>,
|
||||
<0x3230 0x10>, <0x3240 0x10>;
|
||||
|
||||
interrupt-parent = <&intc>;
|
||||
interrupts = <7 4>, <8 4>, <9 4>, <10 4>, <11 4>;
|
||||
clocks = <&lx_clk>;
|
||||
};
|
||||
|
||||
uart0: uart@2000 {
|
||||
compatible = "ns16550a";
|
||||
reg = <0x2000 0x100>;
|
||||
|
||||
@ -229,7 +229,6 @@ struct rttm_cs rttm_cs = {
|
||||
.mask = CLOCKSOURCE_MASK(RTTM_BIT_COUNT),
|
||||
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
||||
.read = rttm_read_clocksource,
|
||||
.enable = rttm_enable_clocksource
|
||||
}
|
||||
};
|
||||
|
||||
@ -276,6 +275,7 @@ static int __init rttm_probe(struct device_node *np)
|
||||
to->of_base.index = clkidx;
|
||||
timer_of_init(np, to);
|
||||
if (rttm_cs.to.of_base.base && rttm_cs.to.of_clk.rate) {
|
||||
rttm_enable_clocksource(&rttm_cs.cs);
|
||||
clocksource_register_hz(&rttm_cs.cs, RTTM_TICKS_PER_SEC);
|
||||
sched_clock_register(rttm_read_clock, RTTM_BIT_COUNT, RTTM_TICKS_PER_SEC);
|
||||
} else
|
||||
|
||||
@ -1,204 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <linux/clockchips.h>
|
||||
#include <linux/init.h>
|
||||
#include <asm/time.h>
|
||||
#include <asm/idle.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/sched_clock.h>
|
||||
|
||||
#include <mach-rtl83xx.h>
|
||||
|
||||
/*
|
||||
* Timer registers
|
||||
* the RTL9300/9310 SoCs have 6 timers, each register block 0x10 apart
|
||||
*/
|
||||
#define RTL9300_TC_DATA 0x0
|
||||
#define RTL9300_TC_CNT 0x4
|
||||
#define RTL9300_TC_CTRL 0x8
|
||||
#define RTL9300_TC_CTRL_MODE BIT(24)
|
||||
#define RTL9300_TC_CTRL_EN BIT(28)
|
||||
#define RTL9300_TC_INT 0xc
|
||||
#define RTL9300_TC_INT_IP BIT(16)
|
||||
#define RTL9300_TC_INT_IE BIT(20)
|
||||
|
||||
/* Timer modes */
|
||||
#define TIMER_MODE_REPEAT 1
|
||||
#define TIMER_MODE_ONCE 0
|
||||
|
||||
/* Minimum divider is 2 */
|
||||
#define DIVISOR_RTL9300 2
|
||||
|
||||
#define N_BITS 28
|
||||
|
||||
#define RTL9300_CLOCK_RATE 87500000
|
||||
|
||||
struct rtl9300_clk_dev {
|
||||
struct clock_event_device clkdev;
|
||||
void __iomem *base;
|
||||
};
|
||||
|
||||
static void __iomem *rtl9300_tc_base(struct clock_event_device *clk)
|
||||
{
|
||||
struct rtl9300_clk_dev *rtl_clk = container_of(clk, struct rtl9300_clk_dev, clkdev);
|
||||
|
||||
return rtl_clk->base;
|
||||
}
|
||||
|
||||
static irqreturn_t rtl9300_timer_interrupt(int irq, void *dev_id)
|
||||
{
|
||||
struct rtl9300_clk_dev *rtl_clk = dev_id;
|
||||
struct clock_event_device *clk = &rtl_clk->clkdev;
|
||||
|
||||
u32 v = readl(rtl_clk->base + RTL9300_TC_INT);
|
||||
|
||||
/* Acknowledge the IRQ */
|
||||
v |= RTL9300_TC_INT_IP;
|
||||
writel(v, rtl_clk->base + RTL9300_TC_INT);
|
||||
|
||||
clk->event_handler(clk);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static void rtl9300_clock_stop(void __iomem *base)
|
||||
{
|
||||
u32 v;
|
||||
|
||||
writel(0, base + RTL9300_TC_CTRL);
|
||||
|
||||
/* Acknowledge possibly pending IRQ */
|
||||
v = readl(base + RTL9300_TC_INT);
|
||||
writel(v | RTL9300_TC_INT_IP, base + RTL9300_TC_INT);
|
||||
}
|
||||
|
||||
static void rtl9300_timer_start(void __iomem *base, bool periodic)
|
||||
{
|
||||
u32 v = (periodic ? RTL9300_TC_CTRL_MODE : 0) | RTL9300_TC_CTRL_EN | DIVISOR_RTL9300;
|
||||
|
||||
writel(0, base + RTL9300_TC_CNT);
|
||||
pr_debug("------------- starting timer base %08x\n", (u32)base);
|
||||
writel(v, base + RTL9300_TC_CTRL);
|
||||
}
|
||||
|
||||
static int rtl9300_next_event(unsigned long delta, struct clock_event_device *clk)
|
||||
{
|
||||
void __iomem *base = rtl9300_tc_base(clk);
|
||||
|
||||
rtl9300_clock_stop(base);
|
||||
writel(delta, base + RTL9300_TC_DATA);
|
||||
rtl9300_timer_start(base, TIMER_MODE_ONCE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl9300_state_periodic(struct clock_event_device *clk)
|
||||
{
|
||||
void __iomem *base = rtl9300_tc_base(clk);
|
||||
|
||||
pr_debug("------------- rtl9300_state_periodic %08x\n", (u32)base);
|
||||
rtl9300_clock_stop(base);
|
||||
writel(RTL9300_CLOCK_RATE / HZ, base + RTL9300_TC_DATA);
|
||||
rtl9300_timer_start(base, TIMER_MODE_REPEAT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl9300_state_oneshot(struct clock_event_device *clk)
|
||||
{
|
||||
void __iomem *base = rtl9300_tc_base(clk);
|
||||
|
||||
pr_debug("------------- rtl9300_state_oneshot %08x\n", (u32)base);
|
||||
rtl9300_clock_stop(base);
|
||||
writel(RTL9300_CLOCK_RATE / HZ, base + RTL9300_TC_DATA);
|
||||
rtl9300_timer_start(base, TIMER_MODE_ONCE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtl9300_shutdown(struct clock_event_device *clk)
|
||||
{
|
||||
void __iomem *base = rtl9300_tc_base(clk);
|
||||
|
||||
pr_debug("------------- rtl9300_shutdown %08x\n", (u32)base);
|
||||
rtl9300_clock_stop(base);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rtl9300_clock_setup(void __iomem *base)
|
||||
{
|
||||
u32 v;
|
||||
|
||||
/* Disable timer */
|
||||
writel(0, base + RTL9300_TC_CTRL);
|
||||
|
||||
/* Acknowledge possibly pending IRQ */
|
||||
v = readl(base + RTL9300_TC_INT);
|
||||
writel(v | RTL9300_TC_INT_IP, base + RTL9300_TC_INT);
|
||||
|
||||
/* Setup maximum period (for use as clock-source) */
|
||||
writel(0x0fffffff, base + RTL9300_TC_DATA);
|
||||
}
|
||||
|
||||
static DEFINE_PER_CPU(struct rtl9300_clk_dev, rtl9300_clockevent);
|
||||
static DEFINE_PER_CPU(char [18], rtl9300_clock_name);
|
||||
|
||||
void rtl9300_clockevent_init(void)
|
||||
{
|
||||
int cpu = smp_processor_id();
|
||||
int irq;
|
||||
struct rtl9300_clk_dev *rtl_clk = &per_cpu(rtl9300_clockevent, cpu);
|
||||
struct clock_event_device *cd = &rtl_clk->clkdev;
|
||||
unsigned char *name = per_cpu(rtl9300_clock_name, cpu);
|
||||
unsigned long flags = IRQF_PERCPU | IRQF_TIMER;
|
||||
struct device_node *node;
|
||||
|
||||
pr_info("%s called for cpu%d\n", __func__, cpu);
|
||||
BUG_ON(cpu > 3); /* Only have 4 general purpose timers */
|
||||
|
||||
node = of_find_compatible_node(NULL, NULL, "realtek,rtl9300clock");
|
||||
if (!node) {
|
||||
pr_err("No DT entry found for realtek,rtl9300clock\n");
|
||||
return;
|
||||
}
|
||||
|
||||
irq = irq_of_parse_and_map(node, cpu);
|
||||
pr_info("%s using IRQ %d\n", __func__, irq);
|
||||
|
||||
rtl_clk->base = of_iomap(node, cpu);
|
||||
if (!rtl_clk->base) {
|
||||
pr_err("cannot map timer for cpu %d", cpu);
|
||||
return;
|
||||
}
|
||||
|
||||
rtl9300_clock_setup(rtl_clk->base);
|
||||
|
||||
sprintf(name, "rtl9300-counter-%d", cpu);
|
||||
cd->name = name;
|
||||
cd->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
|
||||
|
||||
clockevent_set_clock(cd, RTL9300_CLOCK_RATE);
|
||||
|
||||
cd->max_delta_ns = clockevent_delta2ns(0x0fffffff, cd);
|
||||
cd->max_delta_ticks = 0x0fffffff;
|
||||
cd->min_delta_ns = clockevent_delta2ns(0x20, cd);
|
||||
cd->min_delta_ticks = 0x20;
|
||||
cd->rating = 300;
|
||||
cd->irq = irq;
|
||||
cd->cpumask = cpumask_of(cpu);
|
||||
cd->set_next_event = rtl9300_next_event;
|
||||
cd->set_state_shutdown = rtl9300_shutdown;
|
||||
cd->set_state_periodic = rtl9300_state_periodic;
|
||||
cd->set_state_oneshot = rtl9300_state_oneshot;
|
||||
clockevents_register_device(cd);
|
||||
|
||||
irq_set_affinity(irq, cd->cpumask);
|
||||
|
||||
if (request_irq(irq, rtl9300_timer_interrupt, flags, name, rtl_clk))
|
||||
pr_err("Failed to request irq %d (%s)\n", irq, name);
|
||||
|
||||
writel(RTL9300_TC_INT_IE, rtl_clk->base + RTL9300_TC_INT);
|
||||
}
|
||||
@ -27,7 +27,6 @@
|
||||
* the timer is in operating mode COUNTER it stops. In mode TIMER it will
|
||||
* continue to count up.
|
||||
*/
|
||||
|
||||
#define RTTM_CTRL_COUNTER 0
|
||||
#define RTTM_CTRL_TIMER BIT(24)
|
||||
|
||||
@ -43,7 +42,6 @@
|
||||
* MHz and 153.125 MHz. The greatest common divisor of all explained possible
|
||||
* speeds is 3125000. Pin the timers to this 3.125 MHz reference frequency.
|
||||
*/
|
||||
|
||||
#define RTTM_TICKS_PER_SEC 3125000
|
||||
|
||||
struct rttm_cs {
|
||||
@ -51,10 +49,7 @@ struct rttm_cs {
|
||||
struct clocksource cs;
|
||||
};
|
||||
|
||||
/*
|
||||
* Simple internal register functions
|
||||
*/
|
||||
|
||||
/* Simple internal register functions */
|
||||
static inline void rttm_set_counter(void __iomem *base, unsigned int counter)
|
||||
{
|
||||
iowrite32(counter, base + RTTM_CNT);
|
||||
@ -95,10 +90,7 @@ static inline void rttm_disable_irq(void __iomem *base)
|
||||
iowrite32(0, base + RTTM_INT);
|
||||
}
|
||||
|
||||
/*
|
||||
* Aggregated control functions for kernel clock framework
|
||||
*/
|
||||
|
||||
/* Aggregated control functions for kernel clock framework */
|
||||
#define RTTM_DEBUG(base) \
|
||||
pr_debug("------------- %s %d %08x\n", __func__, \
|
||||
smp_processor_id(), (u32)base)
|
||||
@ -187,10 +179,7 @@ static u64 rttm_read_clocksource(struct clocksource *cs)
|
||||
return (u64)rttm_get_counter(rcs->to.of_base.base);
|
||||
}
|
||||
|
||||
/*
|
||||
* Module initialization part.
|
||||
*/
|
||||
|
||||
/* Module initialization part. */
|
||||
static DEFINE_PER_CPU(struct timer_of, rttm_to) = {
|
||||
.flags = TIMER_OF_BASE | TIMER_OF_CLOCK | TIMER_OF_IRQ,
|
||||
.of_irq = {
|
||||
@ -229,7 +218,6 @@ struct rttm_cs rttm_cs = {
|
||||
.mask = CLOCKSOURCE_MASK(RTTM_BIT_COUNT),
|
||||
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
||||
.read = rttm_read_clocksource,
|
||||
.enable = rttm_enable_clocksource
|
||||
}
|
||||
};
|
||||
|
||||
@ -257,9 +245,8 @@ static int __init rttm_probe(struct device_node *np)
|
||||
int cpu, cpu_rollback;
|
||||
struct timer_of *to;
|
||||
int clkidx = num_possible_cpus();
|
||||
/*
|
||||
* Use the first n timers as per CPU clock event generators
|
||||
*/
|
||||
|
||||
/* Use the first n timers as per CPU clock event generators */
|
||||
for_each_possible_cpu(cpu) {
|
||||
to = per_cpu_ptr(&rttm_to, cpu);
|
||||
to->of_irq.index = to->of_base.index = cpu;
|
||||
@ -269,13 +256,13 @@ static int __init rttm_probe(struct device_node *np)
|
||||
}
|
||||
rttm_setup_timer(to->of_base.base);
|
||||
}
|
||||
/*
|
||||
* Activate the n'th+1 timer as a stable CPU clocksource.
|
||||
*/
|
||||
|
||||
/* Activate the n'th + 1 timer as a stable CPU clocksource. */
|
||||
to = &rttm_cs.to;
|
||||
to->of_base.index = clkidx;
|
||||
timer_of_init(np, to);
|
||||
if (rttm_cs.to.of_base.base && rttm_cs.to.of_clk.rate) {
|
||||
rttm_enable_clocksource(&rttm_cs.cs);
|
||||
clocksource_register_hz(&rttm_cs.cs, RTTM_TICKS_PER_SEC);
|
||||
sched_clock_register(rttm_read_clock, RTTM_BIT_COUNT, RTTM_TICKS_PER_SEC);
|
||||
} else
|
||||
|
||||
@ -85,7 +85,7 @@ Submitted-by: Birger Koblitz <git@birger-koblitz.de>
|
||||
source "arch/mips/alchemy/Kconfig"
|
||||
source "arch/mips/ath25/Kconfig"
|
||||
source "arch/mips/ath79/Kconfig"
|
||||
@@ -1097,6 +1147,9 @@ config CEVT_GT641XX
|
||||
@@ -1097,6 +1148,9 @@ config CEVT_GT641XX
|
||||
config CEVT_R4K
|
||||
bool
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ Submitted-by: Birger Koblitz <git@birger-koblitz.de>
|
||||
platform-$(CONFIG_SGI_IP28) += sgi-ip22/
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -1053,8 +1053,59 @@ config NLM_XLP_BOARD
|
||||
@@ -1053,8 +1053,58 @@ config NLM_XLP_BOARD
|
||||
This board is based on Netlogic XLP Processor.
|
||||
Say Y here if you have a XLP based board.
|
||||
|
||||
@ -68,8 +68,7 @@ Submitted-by: Birger Koblitz <git@birger-koblitz.de>
|
||||
+ bool "Realtek RTL930X based platforms"
|
||||
+ depends on RTL83XX
|
||||
+ select MIPS_CPU_SCACHE
|
||||
+ select CSRC_R4K
|
||||
+ select CEVT_RTL9300
|
||||
+ select MIPS_EXTERNAL_TIMER
|
||||
+ select SYS_SUPPORTS_MULTITHREADING
|
||||
+
|
||||
+config RTL931X
|
||||
@ -85,13 +84,3 @@ Submitted-by: Birger Koblitz <git@birger-koblitz.de>
|
||||
source "arch/mips/alchemy/Kconfig"
|
||||
source "arch/mips/ath25/Kconfig"
|
||||
source "arch/mips/ath79/Kconfig"
|
||||
@@ -1112,6 +1162,9 @@ config CEVT_GT641XX
|
||||
config CEVT_R4K
|
||||
bool
|
||||
|
||||
+config CEVT_RTL9300
|
||||
+ bool
|
||||
+
|
||||
config CEVT_SB1250
|
||||
bool
|
||||
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
From 775d903216a08c2a8009863d2f9c33f62657ba94 Mon Sep 17 00:00:00 2001
|
||||
From: Birger Koblitz <git@birger-koblitz.de>
|
||||
Date: Thu, 6 Jan 2022 20:27:01 +0100
|
||||
Subject: [PATCH] realtek: Replace the RTL9300 generic timer with a CEVT timer
|
||||
|
||||
The RTL9300 has a broken R4K MIPS timer interrupt, however, the
|
||||
R4K clocksource works. We replace the RTL9300 timer with a
|
||||
Clock Event Timer (CEVT), which is VSMP aware and can be instantiated
|
||||
as part of brining a VSMTP cpu up instead of the R4K CEVT source.
|
||||
For this we place the RTL9300 CEVT timer in arch/mips/kernel
|
||||
together with other MIPS CEVT timers, initialize the SoC IRQs
|
||||
from a modified smp-mt.c and instantiate each timer as part
|
||||
of the MIPS time setup in arch/mips/include/asm/time.h instead
|
||||
of the R4K CEVT, similarly as is done by other MIPS CEVT timers.
|
||||
|
||||
Submitted-by: Birger Koblitz <git@birger-koblitz.de>
|
||||
---
|
||||
arch/mips/kernel/Makefile | 1 +
|
||||
arch/mips/include/asm/time.h | 7 +++++++
|
||||
2 files changed, 8 insertions(+)
|
||||
|
||||
--- a/arch/mips/kernel/Makefile
|
||||
+++ b/arch/mips/kernel/Makefile
|
||||
@@ -27,6 +27,7 @@ obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm14
|
||||
obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o
|
||||
obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o
|
||||
obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o
|
||||
+obj-$(CONFIG_CEVT_RTL9300) += cevt-rtl9300.o
|
||||
obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o
|
||||
obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o
|
||||
obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o
|
||||
--- a/arch/mips/include/asm/time.h
|
||||
+++ b/arch/mips/include/asm/time.h
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <linux/clockchips.h>
|
||||
#include <linux/clocksource.h>
|
||||
|
||||
+extern void rtl9300_clockevent_init(void);
|
||||
+
|
||||
extern spinlock_t rtc_lock;
|
||||
|
||||
/*
|
||||
@@ -43,6 +45,11 @@ extern int r4k_clockevent_init(void);
|
||||
|
||||
static inline int mips_clockevent_init(void)
|
||||
{
|
||||
+#ifdef CONFIG_CEVT_RTL9300
|
||||
+ rtl9300_clockevent_init();
|
||||
+ return 0;
|
||||
+#endif
|
||||
+
|
||||
#ifdef CONFIG_CEVT_R4K
|
||||
return r4k_clockevent_init();
|
||||
#else
|
||||
@ -9,7 +9,6 @@ CONFIG_BLK_DEV_RAM=y
|
||||
CONFIG_BLK_DEV_RAM_COUNT=16
|
||||
CONFIG_BLK_DEV_RAM_SIZE=4096
|
||||
CONFIG_BOARD_SCACHE=y
|
||||
CONFIG_CEVT_RTL9300=y
|
||||
CONFIG_CLONE_BACKWARDS=y
|
||||
CONFIG_COMMON_CLK=y
|
||||
# CONFIG_COMMON_CLK_REALTEK is not set
|
||||
@ -33,7 +32,6 @@ CONFIG_CPU_SUPPORTS_MSA=y
|
||||
CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
|
||||
CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2
|
||||
CONFIG_CRYPTO_RNG2=y
|
||||
CONFIG_CSRC_R4K=y
|
||||
CONFIG_DEBUG_SECTION_MISMATCH=y
|
||||
CONFIG_DMA_NONCOHERENT=y
|
||||
CONFIG_DTC=y
|
||||
@ -113,11 +111,11 @@ CONFIG_MIGRATION=y
|
||||
CONFIG_MIPS=y
|
||||
CONFIG_MIPS_ASID_BITS=8
|
||||
CONFIG_MIPS_ASID_SHIFT=0
|
||||
CONFIG_MIPS_CLOCK_VSYSCALL=y
|
||||
# CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set
|
||||
CONFIG_MIPS_CMDLINE_FROM_DTB=y
|
||||
CONFIG_MIPS_CPU_SCACHE=y
|
||||
CONFIG_MIPS_EBPF_JIT=y
|
||||
CONFIG_MIPS_EXTERNAL_TIMER=y
|
||||
CONFIG_MIPS_L1_CACHE_SHIFT=5
|
||||
CONFIG_MIPS_LD_CAN_LINK_VDSO=y
|
||||
# CONFIG_MIPS_MT_SMP is not set
|
||||
@ -166,7 +164,7 @@ CONFIG_POWER_RESET_GPIO_RESTART=y
|
||||
CONFIG_POWER_RESET_SYSCON=y
|
||||
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
|
||||
CONFIG_RATIONAL=y
|
||||
# CONFIG_REALTEK_OTTO_TIMER is not set
|
||||
CONFIG_REALTEK_OTTO_TIMER=y
|
||||
CONFIG_REALTEK_OTTO_WDT=y
|
||||
CONFIG_REALTEK_PHY=y
|
||||
CONFIG_REALTEK_SOC_PHY=y
|
||||
@ -199,6 +197,8 @@ CONFIG_SYS_SUPPORTS_MIPS16=y
|
||||
CONFIG_SYS_SUPPORTS_MULTITHREADING=y
|
||||
CONFIG_TARGET_ISA_REV=2
|
||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||
CONFIG_TIMER_OF=y
|
||||
CONFIG_TIMER_PROBE=y
|
||||
CONFIG_TINY_SRCU=y
|
||||
CONFIG_USE_GENERIC_EARLY_PRINTK_8250=y
|
||||
CONFIG_USE_OF=y
|
||||
|
||||
Loading…
Reference in New Issue
Block a user