From f35e2422b8774a2a70c8c3cd87c4289b17b7d4a3 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Wed, 1 Feb 2023 20:30:57 -0500 Subject: [PATCH 01/34] base-files: add support for retrieving IPv6 assignments In DHCPv6-PD enabled environments, addresses are assigned to interfaces. These new functions retrieve the IPv6 assigned prefix(es). Signed-off-by: Mark Baker --- package/base-files/files/lib/functions/network.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/package/base-files/files/lib/functions/network.sh b/package/base-files/files/lib/functions/network.sh index 055f18c11e0..4851a5817ad 100644 --- a/package/base-files/files/lib/functions/network.sh +++ b/package/base-files/files/lib/functions/network.sh @@ -90,6 +90,13 @@ network_get_prefix6() { __network_ifstatus "$1" "$2" "['ipv6-prefix'][0]['address','mask']" "/" } +# determine first IPv6 prefix assignment of given logical interface +# 1: destination variable +# 2: interface +network_get_prefix_assignment6() { + __network_ifstatus "$1" "$2" "['ipv6-prefix-assignment'][0]['address','mask']" "/" +} + # determine all IPv4 addresses of given logical interface # 1: destination variable # 2: interface @@ -187,6 +194,13 @@ network_get_prefixes6() { __network_ifstatus "$1" "$2" "['ipv6-prefix'][*]['address','mask']" "/ " } +# determine all IPv6 prefix assignments of given logical interface +# 1: destination variable +# 2: interface +network_get_prefix_assignments6() { + __network_ifstatus "$1" "$2" "['ipv6-prefix-assignment'][*]['address','mask']" "/ " +} + # determine IPv4 gateway of given logical interface # 1: destination variable # 2: interface From 530f5c2fda1893ee1e0ae8b1f5bea5eda0850a40 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 5 Feb 2023 21:38:19 +0100 Subject: [PATCH 02/34] libcap: update to 2.67 Release notes: https://sites.google.com/site/fullycapable/release-notes-for-libcap#h.o8papfkfh1x9 While working on it, remove $(AUTORELEASE). Tested-by: Linhui Liu liulinhui36@gmail.com # Xiaomi AX3600 Signed-off-by: Nick Hainke --- package/libs/libcap/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/libcap/Makefile b/package/libs/libcap/Makefile index afc66d7c097..a35b5e394fa 100644 --- a/package/libs/libcap/Makefile +++ b/package/libs/libcap/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libcap -PKG_VERSION:=2.66 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=2.67 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/libs/security/linux-privs/libcap2 -PKG_HASH:=15c40ededb3003d70a283fe587a36b7d19c8b3b554e33f86129c059a4bb466b2 +PKG_HASH:=ce9b22fdc271beb6dae7543da5f74cf24cb82e6848cfd088a5a069dec5ea5198 PKG_MAINTAINER:=Paul Wassi PKG_LICENSE:=GPL-2.0-only From c98a202446848f162ae59c85a7f3f08da88a35e0 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 22 Feb 2023 15:50:43 +0100 Subject: [PATCH 03/34] ethtool: update to 6.2 Release notes: - Feature: link down event statistics (no option) - Feature: JSON output for coalesce (-c) - Feature: new link modes (no option) - Feature: JSON output for ring (-g) - Feature: netlink handler for RSS get (-x) - Fix: fix boolean value output in JSON output - Fix: fix build errors and warnings Remove upstreamed patches: - 100-uapi-Bring-in-if-h.patch - 101-netlink-Fix-maybe-uninitialized-meters-variable.patch - 102-raw-marvell-c-Fix-build-with-musl-libc.patch Signed-off-by: Nick Hainke --- package/network/utils/ethtool/Makefile | 4 +- .../patches/100-uapi-Bring-in-if-h.patch | 465 ------------------ ...-maybe-uninitialized-meters-variable.patch | 25 - ...w-marvell-c-Fix-build-with-musl-libc.patch | 63 --- 4 files changed, 2 insertions(+), 555 deletions(-) delete mode 100644 package/network/utils/ethtool/patches/100-uapi-Bring-in-if-h.patch delete mode 100644 package/network/utils/ethtool/patches/101-netlink-Fix-maybe-uninitialized-meters-variable.patch delete mode 100644 package/network/utils/ethtool/patches/102-raw-marvell-c-Fix-build-with-musl-libc.patch diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index bec26cd3644..b18320bf05d 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ethtool -PKG_VERSION:=6.1 +PKG_VERSION:=6.2 PKG_RELEASE:=1 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=c41fc881ffa5a40432d2dd829eb44c64a49dee482e716baacf9262c64daa8f90 +PKG_HASH:=86df0114064d4d73f6bf72bf03e85c33964a519ee0c1d1ba65005ad2d0e570e1 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/network/utils/ethtool/patches/100-uapi-Bring-in-if-h.patch b/package/network/utils/ethtool/patches/100-uapi-Bring-in-if-h.patch deleted file mode 100644 index 09be05c1f62..00000000000 --- a/package/network/utils/ethtool/patches/100-uapi-Bring-in-if-h.patch +++ /dev/null @@ -1,465 +0,0 @@ -From: Florian Fainelli -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 -Signed-off-by: Florian Fainelli ---- - 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 - #include - #include -+#define __UAPI_DEF_IF_IFNAMSIZ 1 -+#define __UAPI_DEF_IF_IFMAP 1 -+#define __UAPI_DEF_IF_IFREQ 1 - #include - - #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 - #include - ---- /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, -+ * -+ * 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 /* for compatibility with glibc */ -+#include /* for "__kernel_caddr_t" et al */ -+#include /* for "struct sockaddr" et al */ -+ /* for "__user" et al */ -+ -+#include /* for struct sockaddr. */ -+ -+#if __UAPI_DEF_IF_IFNAMSIZ -+#define IFNAMSIZ 16 -+#endif /* __UAPI_DEF_IF_IFNAMSIZ */ -+#define IFALIASZ 256 -+#define ALTIFNAMSIZ 128 -+#include -+ -+/* 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//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 */ diff --git a/package/network/utils/ethtool/patches/101-netlink-Fix-maybe-uninitialized-meters-variable.patch b/package/network/utils/ethtool/patches/101-netlink-Fix-maybe-uninitialized-meters-variable.patch deleted file mode 100644 index 381b949edeb..00000000000 --- a/package/network/utils/ethtool/patches/101-netlink-Fix-maybe-uninitialized-meters-variable.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Florian Fainelli -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 ---- - 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; - diff --git a/package/network/utils/ethtool/patches/102-raw-marvell-c-Fix-build-with-musl-libc.patch b/package/network/utils/ethtool/patches/102-raw-marvell-c-Fix-build-with-musl-libc.patch deleted file mode 100644 index 33b1715967e..00000000000 --- a/package/network/utils/ethtool/patches/102-raw-marvell-c-Fix-build-with-musl-libc.patch +++ /dev/null @@ -1,63 +0,0 @@ -From: Florian Fainelli -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 ---- - 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; - From 638ebd306794397975bdf8035f6b23b61bc5c1c8 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 22 Feb 2023 15:56:25 +0100 Subject: [PATCH 04/34] iproute2: update to 6.2 Release Notes: https://lwn.net/Articles/923952/ Refresh patches: - 110-darwin_fixes.patch - 115-add-config-xtlibdir.patch - 140-allow_pfifo_fast.patch - 140-keep_libmnl_optional.patch - 145-keep_libelf_optional.patch - 150-keep_libcap_optional.patch - 155-keep_tirpc_optional.patch - 170-ip_tiny.patch - 175-reduce-dynamic-syms.patch - 180-drop_FAILED_POLICY.patch - 190-fix-nls-rpath-link.patch - 195-build_variant_ip_tc.patch - 200-drop_libbsd_dependency.patch - 300-selinux-configurable.patch Remove upstreamed: - 320-configure-Remove-include-sys-stat.h.patch While working on it remove AUTORELEASE. Signed-off-by: Nick Hainke --- package/network/utils/iproute2/Makefile | 6 +-- .../iproute2/patches/110-darwin_fixes.patch | 8 ++-- .../patches/115-add-config-xtlibdir.patch | 2 +- .../patches/140-allow_pfifo_fast.patch | 2 +- .../patches/140-keep_libmnl_optional.patch | 2 +- .../patches/145-keep_libelf_optional.patch | 2 +- .../patches/150-keep_libcap_optional.patch | 2 +- .../patches/155-keep_tirpc_optional.patch | 2 +- .../utils/iproute2/patches/170-ip_tiny.patch | 4 +- .../patches/175-reduce-dynamic-syms.patch | 8 ++-- .../patches/180-drop_FAILED_POLICY.patch | 4 +- .../patches/190-fix-nls-rpath-link.patch | 4 +- .../patches/195-build_variant_ip_tc.patch | 2 +- .../patches/200-drop_libbsd_dependency.patch | 2 +- .../patches/300-selinux-configurable.patch | 2 +- ...-configure-Remove-include-sys-stat.h.patch | 43 ------------------- 16 files changed, 26 insertions(+), 69 deletions(-) delete mode 100644 package/network/utils/iproute2/patches/320-configure-Remove-include-sys-stat.h.patch diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index 39c94bd6e20..302d57bf8b1 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=iproute2 -PKG_VERSION:=6.1.0 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=6.2.0 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2 -PKG_HASH:=5ce12a0fec6b212725ef218735941b2dab76244db7e72646a76021b0537b43ab +PKG_HASH:=4d72730200ec5b2aabaa1a2f20553c6748292f065d9a154c7d5e22559df9fd62 PKG_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=iptables PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/iproute2/patches/110-darwin_fixes.patch b/package/network/utils/iproute2/patches/110-darwin_fixes.patch index 1f3eb101ea4..06ae59f8b4d 100644 --- a/package/network/utils/iproute2/patches/110-darwin_fixes.patch +++ b/package/network/utils/iproute2/patches/110-darwin_fixes.patch @@ -1,6 +1,6 @@ --- a/netem/maketable.c +++ b/netem/maketable.c -@@ -10,7 +10,9 @@ +@@ -11,7 +11,9 @@ #include #include #include @@ -12,7 +12,7 @@ #include --- a/netem/normal.c +++ b/netem/normal.c -@@ -8,8 +8,12 @@ +@@ -9,8 +9,12 @@ #include #include @@ -27,7 +27,7 @@ #define TABLEFACTOR NETEM_DIST_SCALE --- a/netem/pareto.c +++ b/netem/pareto.c -@@ -7,8 +7,12 @@ +@@ -8,8 +8,12 @@ #include #include @@ -42,7 +42,7 @@ #define TABLESIZE 16384 --- a/netem/paretonormal.c +++ b/netem/paretonormal.c -@@ -14,10 +14,13 @@ +@@ -15,10 +15,13 @@ #include #include #include diff --git a/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch b/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch index 8702d5fd2d1..03df7809f7f 100644 --- a/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch +++ b/package/network/utils/iproute2/patches/115-add-config-xtlibdir.patch @@ -1,6 +1,6 @@ --- a/tc/Makefile +++ b/tc/Makefile -@@ -128,6 +128,9 @@ CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PR +@@ -127,6 +127,9 @@ CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PR ifneq ($(IPT_LIB_DIR),) CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\" endif diff --git a/package/network/utils/iproute2/patches/140-allow_pfifo_fast.patch b/package/network/utils/iproute2/patches/140-allow_pfifo_fast.patch index 13de48f4128..8f5a7d352e5 100644 --- a/package/network/utils/iproute2/patches/140-allow_pfifo_fast.patch +++ b/package/network/utils/iproute2/patches/140-allow_pfifo_fast.patch @@ -1,6 +1,6 @@ --- a/tc/q_fifo.c +++ b/tc/q_fifo.c -@@ -95,5 +95,6 @@ struct qdisc_util pfifo_head_drop_qdisc_ +@@ -90,5 +90,6 @@ struct qdisc_util pfifo_head_drop_qdisc_ struct qdisc_util pfifo_fast_qdisc_util = { .id = "pfifo_fast", diff --git a/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch b/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch index 7f68f436164..a8cdd103ba3 100644 --- a/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch +++ b/package/network/utils/iproute2/patches/140-keep_libmnl_optional.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -412,7 +412,7 @@ check_tirpc() +@@ -411,7 +411,7 @@ check_tirpc() check_mnl() { diff --git a/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch b/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch index 2eaae881985..0c5c3f59ed9 100644 --- a/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch +++ b/package/network/utils/iproute2/patches/145-keep_libelf_optional.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -267,7 +267,7 @@ EOF +@@ -266,7 +266,7 @@ EOF check_elf() { diff --git a/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch b/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch index c574840fa8f..4cce2c3ca68 100644 --- a/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch +++ b/package/network/utils/iproute2/patches/150-keep_libcap_optional.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -470,7 +470,7 @@ EOF +@@ -469,7 +469,7 @@ EOF check_cap() { diff --git a/package/network/utils/iproute2/patches/155-keep_tirpc_optional.patch b/package/network/utils/iproute2/patches/155-keep_tirpc_optional.patch index 4ee6245d3b0..28ba7e52176 100644 --- a/package/network/utils/iproute2/patches/155-keep_tirpc_optional.patch +++ b/package/network/utils/iproute2/patches/155-keep_tirpc_optional.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -399,7 +399,7 @@ check_selinux() +@@ -398,7 +398,7 @@ check_selinux() check_tirpc() { diff --git a/package/network/utils/iproute2/patches/170-ip_tiny.patch b/package/network/utils/iproute2/patches/170-ip_tiny.patch index eef5e38229b..71081c36bcc 100644 --- a/package/network/utils/iproute2/patches/170-ip_tiny.patch +++ b/package/network/utils/iproute2/patches/170-ip_tiny.patch @@ -25,7 +25,7 @@ sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ --- a/ip/ip.c +++ b/ip/ip.c -@@ -65,11 +65,17 @@ static void usage(void) +@@ -61,11 +61,17 @@ static void usage(void) fprintf(stderr, "Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n" " ip [ -force ] -batch filename\n" @@ -43,7 +43,7 @@ " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n" " -h[uman-readable] | -iec | -j[son] | -p[retty] |\n" " -f[amily] { inet | inet6 | mpls | bridge | link } |\n" -@@ -92,37 +98,49 @@ static const struct cmd { +@@ -88,37 +94,49 @@ static const struct cmd { int (*func)(int argc, char **argv); } cmds[] = { { "address", do_ipaddr }, diff --git a/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch b/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch index c3892e5a0e4..d0914848d59 100644 --- a/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch +++ b/package/network/utils/iproute2/patches/175-reduce-dynamic-syms.patch @@ -1,6 +1,6 @@ --- a/tc/Makefile +++ b/tc/Makefile -@@ -114,7 +114,7 @@ LDLIBS += -L. -lm +@@ -113,7 +113,7 @@ LDLIBS += -L. -lm ifeq ($(SHARED_LIBS),y) LDLIBS += -ldl @@ -9,7 +9,7 @@ endif TCLIB := tc_core.o -@@ -144,7 +144,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc +@@ -143,7 +143,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc all: tc $(TCSO) tc: $(TCOBJ) $(LIBNETLINK) libtc.a @@ -18,7 +18,7 @@ libtc.a: $(TCLIB) $(QUIET_AR)$(AR) rcs $@ $^ -@@ -166,6 +166,7 @@ install: all +@@ -165,6 +165,7 @@ install: all clean: rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.tab.h; \ rm -f emp_ematch.tab.* @@ -26,7 +26,7 @@ q_atm.so: q_atm.c $(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm -@@ -205,4 +206,16 @@ static-syms.h: $(wildcard *.c) +@@ -204,4 +205,16 @@ static-syms.h: $(wildcard *.c) sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ done > $@ diff --git a/package/network/utils/iproute2/patches/180-drop_FAILED_POLICY.patch b/package/network/utils/iproute2/patches/180-drop_FAILED_POLICY.patch index 094ff393a68..9ce7dd9a13e 100644 --- a/package/network/utils/iproute2/patches/180-drop_FAILED_POLICY.patch +++ b/package/network/utils/iproute2/patches/180-drop_FAILED_POLICY.patch @@ -11,7 +11,7 @@ Subject: [PATCH] add support for dropping with FAILED_POLICY --- a/ip/rtm_map.c +++ b/ip/rtm_map.c -@@ -54,6 +54,8 @@ char *rtnl_rtntype_n2a(int id, char *buf +@@ -49,6 +49,8 @@ char *rtnl_rtntype_n2a(int id, char *buf return "nat"; case RTN_XRESOLVE: return "xresolve"; @@ -20,7 +20,7 @@ Subject: [PATCH] add support for dropping with FAILED_POLICY default: snprintf(buf, len, "%d", id); return buf; -@@ -89,6 +91,8 @@ int rtnl_rtntype_a2n(int *id, char *arg) +@@ -84,6 +86,8 @@ int rtnl_rtntype_a2n(int *id, char *arg) res = RTN_UNICAST; else if (strcmp(arg, "throw") == 0) res = RTN_THROW; diff --git a/package/network/utils/iproute2/patches/190-fix-nls-rpath-link.patch b/package/network/utils/iproute2/patches/190-fix-nls-rpath-link.patch index 2f3f90fe1aa..c7fceb2e221 100644 --- a/package/network/utils/iproute2/patches/190-fix-nls-rpath-link.patch +++ b/package/network/utils/iproute2/patches/190-fix-nls-rpath-link.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -291,7 +291,7 @@ int main(int argc, char **argv) { +@@ -290,7 +290,7 @@ int main(int argc, char **argv) { } EOF @@ -9,7 +9,7 @@ local ret=$? rm -f $TMPDIR/libbpf_test.c $TMPDIR/libbpf_test -@@ -309,7 +309,7 @@ int main(int argc, char **argv) { +@@ -308,7 +308,7 @@ int main(int argc, char **argv) { } EOF diff --git a/package/network/utils/iproute2/patches/195-build_variant_ip_tc.patch b/package/network/utils/iproute2/patches/195-build_variant_ip_tc.patch index dc9c0b2969d..141763460da 100644 --- a/package/network/utils/iproute2/patches/195-build_variant_ip_tc.patch +++ b/package/network/utils/iproute2/patches/195-build_variant_ip_tc.patch @@ -11,7 +11,7 @@ --- a/tc/Makefile +++ b/tc/Makefile -@@ -141,7 +141,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc +@@ -140,7 +140,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc $(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic $< -o $@ diff --git a/package/network/utils/iproute2/patches/200-drop_libbsd_dependency.patch b/package/network/utils/iproute2/patches/200-drop_libbsd_dependency.patch index 052bdd84eb2..d1948860e86 100644 --- a/package/network/utils/iproute2/patches/200-drop_libbsd_dependency.patch +++ b/package/network/utils/iproute2/patches/200-drop_libbsd_dependency.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -456,14 +456,8 @@ EOF +@@ -455,14 +455,8 @@ EOF if $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1; then echo "no" else diff --git a/package/network/utils/iproute2/patches/300-selinux-configurable.patch b/package/network/utils/iproute2/patches/300-selinux-configurable.patch index adfa405c7fc..817abf7d17a 100644 --- a/package/network/utils/iproute2/patches/300-selinux-configurable.patch +++ b/package/network/utils/iproute2/patches/300-selinux-configurable.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -386,7 +386,7 @@ check_libbpf() +@@ -385,7 +385,7 @@ check_libbpf() check_selinux() # SELinux is a compile time option in the ss utility { diff --git a/package/network/utils/iproute2/patches/320-configure-Remove-include-sys-stat.h.patch b/package/network/utils/iproute2/patches/320-configure-Remove-include-sys-stat.h.patch deleted file mode 100644 index 02bb20297d3..00000000000 --- a/package/network/utils/iproute2/patches/320-configure-Remove-include-sys-stat.h.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 3a3a2f6be704c970938eb8dac4eb0118f1c2fb06 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Wed, 21 Dec 2022 23:26:28 +0100 -Subject: [PATCH iproute2 v2] configure: Remove include - -The check_name_to_handle_at() function in the configure script is -including sys/stat.h. This include fails with glibc 2.36 like this: -```` -In file included from /linux-5.15.84/include/uapi/linux/stat.h:5, - from /toolchain-x86_64_gcc-12.2.0_glibc/include/bits/statx.h:31, - from /toolchain-x86_64_gcc-12.2.0_glibc/include/sys/stat.h:465, - from config.YExfMc/name_to_handle_at_test.c:3: -/linux-5.15.84/include/uapi/linux/types.h:10:2: warning: #warning "Attempt to use kernel headers from user space, see https://kernelnewbies.org/KernelHeaders" [-Wcpp] - 10 | #warning "Attempt to use kernel headers from user space, see https://kernelnewbies.org/KernelHeaders" - | ^~~~~~~ -In file included from /linux-5.15.84/include/uapi/linux/posix_types.h:5, - from /linux-5.15.84/include/uapi/linux/types.h:14: -/linux-5.15.84/include/uapi/linux/stddef.h:5:10: fatal error: linux/compiler_types.h: No such file or directory - 5 | #include - | ^~~~~~~~~~~~~~~~~~~~~~~~ -compilation terminated. -```` - -Just removing the include works, the manpage of name_to_handle_at() says -only fcntl.h is needed. - -Fixes: c5b72cc56bf8 ("lib/fs: fix issue when {name,open}_to_handle_at() is not implemented") -Tested-by: Heiko Thiery -Signed-off-by: Hauke Mehrtens ---- - configure | 1 - - 1 file changed, 1 deletion(-) - ---- a/configure -+++ b/configure -@@ -215,7 +215,6 @@ check_name_to_handle_at() - cat >$TMPDIR/name_to_handle_at_test.c < --#include - #include - int main(int argc, char **argv) - { From 743c4ad6824a17a5ec102ef009684a70801bda62 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 9 Sep 2022 21:43:18 -0400 Subject: [PATCH 05/34] toolchain: fix stampfile dependency Use the gcc/final/install target stampfile as the prerequisite for the toolchain/compile target stampfile. The previous filename was also incorrect, the stampfile name format was changed (see reference) but was never updated here. The issue was never noticed because the usage of timestamp.pl was broken (fixed in previous commit) causing the extra prereq files passed to 'call stampfile' to never get checked at all. Fixes: 5149ed151 ("gcc: split up the build process into three distinct stages") Signed-off-by: Michael Pratt --- toolchain/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/Makefile b/toolchain/Makefile index 5dccf8f8290..19b144ee365 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -85,12 +85,12 @@ $(curdir)/ := .config prereq $(curdir)//compile = $(STAGING_DIR)/.prepared $(TOOLCHAIN_DIR)/info.mk $(tools/stamp-compile) ifndef DUMP_TARGET_DB -$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed: +$(TOOLCHAIN_DIR)/stamp/.gcc_final_installed: endif $(curdir)/install: $(curdir)/compile -$(eval $(call stampfile,$(curdir),toolchain,compile,$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed,,$(TOOLCHAIN_DIR))) +$(eval $(call stampfile,$(curdir),toolchain,compile,$(TOOLCHAIN_DIR)/stamp/.gcc_final_installed,,$(TOOLCHAIN_DIR))) $(eval $(call stampfile,$(curdir),toolchain,check,$(TMP_DIR)/.build)) $(eval $(call subdir,$(curdir))) From 6a7cde15000832ce0164dc27d85822b2e2dd9fe6 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 10 Aug 2022 17:56:41 -0400 Subject: [PATCH 06/34] toolchain: cleanup dependencies Reorganize dependencies between toolchain targets to save a line. This also puts them in a linear order which is easier to read. Signed-off-by: Michael Pratt --- toolchain/Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/toolchain/Makefile b/toolchain/Makefile index 19b144ee365..60e35072507 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -34,8 +34,8 @@ $(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_EXTERNAL_TOOLCHAIN) # builddir dependencies ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) ifdef CONFIG_USE_MUSL + $(curdir)/gcc/initial/compile:=$(curdir)/binutils/compile $(curdir)/kernel-headers/compile:=$(curdir)/gcc/initial/compile - $(curdir)/$(LIBC)/compile:=$(curdir)/kernel-headers/compile else $(curdir)/builddirs += $(LIBC)/headers gcc/minimal $(curdir)/gcc/minimal/compile:=$(curdir)/binutils/compile @@ -44,9 +44,8 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) $(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/headers/compile endif - $(curdir)/gcc/initial/compile+=$(curdir)/binutils/compile - $(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/compile - $(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/compile $(curdir)/kernel-headers/compile + $(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/compile $(curdir)/kernel-headers/compile + $(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/compile $(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/compile endif From b2d7cdaea9fdbd4a05c90c252ef0abdeaaea4381 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 21 Feb 2023 14:58:20 -0500 Subject: [PATCH 07/34] toolchain: remove references to $(LIBC)/utils subtarget The utils subtarget was used for uClibc and eglibc which are both obsolete and replaced in Openwrt by mainline musl and glibc, which do not have a utils Makefile target. Ref: 5d19a38d8 ("toolchain: sync eglibc headers/build split with uclibc changes") Fixes: 63fb17520 ("toolchain: remove uClibc-ng") Suggested-by: Andre Heider Signed-off-by: Michael Pratt --- toolchain/Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/toolchain/Makefile b/toolchain/Makefile index 60e35072507..c0046293c92 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -21,8 +21,6 @@ # build & install the final libc # 7) toolchain/gcc/final/compile # build & install the final gcc -# 8) toolchain/libc/utils/compile -# build & install libc utilities # # For musl, steps 2 and 4 are skipped, and step 3 is done after 5 @@ -46,7 +44,6 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) $(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/compile $(curdir)/kernel-headers/compile $(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/compile - $(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/compile endif ifndef DUMP_TARGET_DB From dd8a4a8c34c0b721000198ff01f2ff5158f32414 Mon Sep 17 00:00:00 2001 From: Xinfa Deng Date: Thu, 9 Feb 2023 15:37:30 +0800 Subject: [PATCH 08/34] ath79: add support for GL.iNet GL-X1200 This patch adds supports for GL-X1200. Specification: - SOC: QCA9563 (775MHz) - Flash: 16 MiB - RAM: 128 MiB DDR2 - Ethernet: 4x 1Gbps LAN + 1x 1Gbps WAN - Wireless: QCA9563(2.4GHz) and QCA9886(5GHz) - SIM: 2x SIM card slots - MicroSD: 1x microSD slot - Antenna: 2x external 5dBi antennas - USB: 1x USB 2.0 port - Button: 1x reset button - LED: 16x LEDs (3x GPIO controllable) - UART: 1x UART on PCB (JP1: 3.3V, RX, TX, GND) - OEM U-Boot supplies HTTP/GUI access Implementation Notes ==================== Both the NOR and NAND variants boot off a NOR-based kernel, consistent with the OEM's firmware. The mode LEDs are * Boot, Running system * Failsafe 2G * Upgrade 5G Installation ============ Using sysupgrade ---------------- sysupgrade may be used to install a NAND image on a device running a NAND image or a NOR image on a device running a NOR image. It is recommended to *not* preserve config when upgrading from OEM firmware or previous versions of OpenWrt. No supported sysupgrade path should require "force". Transitioning from NOR to NAND can be accomplished Using U-Boot ------------ The OEM U-Boot can be put into a graphical, firmware-upload mode by holding down the button on the side of the router while applying power and for a bit more than five seconds following with the current OEM U-Boot. The power LED will come on, then the 5G LED will flash five times, about once a second. When the 5G LED stops flashing and the 2G LED lights solid, the router's U-Boot will provide an upload page at http://192.168.1.1/ Either a browser may be used to upload an image, or a utility such as curl may be used: curl -X POST -F gl_firmware=\@*-nand-squashfs-factory.img \ http://192.168.1.1/index.html or curl -X POST -F gl_firmware=\@*-nor-squashfs-sysupgrade.bin \ http://192.168.1.1/index.html Note that NOR vs. NAND is based on the file name extension. Signed-off-by: Xinfa Deng --- .../dts/qca9563_glinet_gl-x1200-nor-nand.dts | 29 +++ .../ath79/dts/qca9563_glinet_gl-x1200-nor.dts | 16 ++ .../ath79/dts/qca9563_glinet_gl-x1200.dtsi | 209 ++++++++++++++++++ target/linux/ath79/image/nand.mk | 29 +++ .../nand/base-files/etc/board.d/02_network | 10 + .../nand/base-files/lib/upgrade/platform.sh | 4 +- 6 files changed, 296 insertions(+), 1 deletion(-) create mode 100644 target/linux/ath79/dts/qca9563_glinet_gl-x1200-nor-nand.dts create mode 100644 target/linux/ath79/dts/qca9563_glinet_gl-x1200-nor.dts create mode 100644 target/linux/ath79/dts/qca9563_glinet_gl-x1200.dtsi diff --git a/target/linux/ath79/dts/qca9563_glinet_gl-x1200-nor-nand.dts b/target/linux/ath79/dts/qca9563_glinet_gl-x1200-nor-nand.dts new file mode 100644 index 00000000000..2a26d959c99 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_glinet_gl-x1200-nor-nand.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9563_glinet_gl-x1200.dtsi" + +/ { + compatible = "glinet,gl-x1200-nor-nand", "qca,qca9563"; + model = "GL.iNet GL-X1200 (NOR/NAND)"; +}; + +&nor_partitions { + partition@60000 { + label = "kernel"; + reg = <0x060000 0x400000>; + + /* + * U-Boot bootcmd is "bootm 0x9f060000". + * So this might be possible to resize in the future. + */ + }; + + partition@460000 { + label = "nor_reserved"; + reg = <0x460000 0xba0000>; + }; +}; + +&nand_ubi { + label = "ubi"; +}; diff --git a/target/linux/ath79/dts/qca9563_glinet_gl-x1200-nor.dts b/target/linux/ath79/dts/qca9563_glinet_gl-x1200-nor.dts new file mode 100644 index 00000000000..dfce3818b0e --- /dev/null +++ b/target/linux/ath79/dts/qca9563_glinet_gl-x1200-nor.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9563_glinet_gl-x1200.dtsi" + +/ { + compatible = "glinet,gl-x1200-nor", "qca,qca9563"; + model = "GL.iNet GL-X1200 (NOR)"; +}; + +&nor_partitions { + partition@60000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x060000 0xfa0000>; + }; +}; diff --git a/target/linux/ath79/dts/qca9563_glinet_gl-x1200.dtsi b/target/linux/ath79/dts/qca9563_glinet_gl-x1200.dtsi new file mode 100644 index 00000000000..8980f772e74 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_glinet_gl-x1200.dtsi @@ -0,0 +1,209 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca956x.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + label-mac-device = ð0; + }; + + keys { + compatible = "gpio-keys"; + + pinctrl-names = "default"; + pinctrl-0 = <&jtag_disable_pins>; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_system: system { + label = "red:system"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + + wlan2g { + label = "green:wlan2g"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + wlan5g { + label = "green:wlan5g"; + gpios = <&gpio 20 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + gpio_modem1_power { + gpio-export,name = "gl-x1200:4g1:power"; + gpio-export,output = <0>; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + + gpio_modem2_power { + gpio-export,name = "gl-x1200:4g2:power"; + gpio-export,output = <0>; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + nor_partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + partition@50000 { + label = "art"; + reg = <0x050000 0x010000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + calibration_ath9k: calibration@1000 { + reg = <0x1000 0x440>; + }; + + calibration_ath10k: calibration@5000 { + reg = <0x5000 0x2f20>; + }; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_art_1002: macaddr@1002 { + reg = <0x1002 0x6>; + }; + + macaddr_art_5006: macaddr@5006 { + reg = <0x5006 0x6>; + }; + }; + + /* Firmware / Kernel flash type specific */ + }; + }; + + flash@1 { + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + nand_ubi: partition@0 { + label = "nand_ubi"; + reg = <0x000000 0x8000000>; + }; + }; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&phy0>; + + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; +}; + +&gpio { + usb_vbus { + gpio-hog; + gpios = <7 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "usb-vbus"; + }; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "sgmii"; + qca,ar8327-initvals = < + 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; + +&pcie { + status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0 0 0 0 0>; + + nvmem-cells = <&macaddr_art_5006>, <&calibration_ath10k>; + nvmem-cell-names = "mac-address", "pre-calibration"; + }; +}; + +&usb0 { + status = "okay"; +}; + +&usb1 { + status = "okay"; +}; + +&usb_phy0 { + status = "okay"; +}; + +&usb_phy1 { + status = "okay"; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&macaddr_art_1002>, <&calibration_ath9k>; + nvmem-cell-names = "mac-address", "calibration"; +}; diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index c83beef952d..40c57d8b06f 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -212,6 +212,35 @@ define Device/glinet_gl-xe300 endef TARGET_DEVICES += glinet_gl-xe300 +define Device/glinet_gl-x1200-common + SOC := qca9563 + DEVICE_VENDOR := GL.iNet + DEVICE_MODEL := GL-X1200 + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct-htt kmod-usb2 \ + kmod-usb-storage block-mount kmod-usb-net-qmi-wwan uqmi + IMAGE_SIZE := 16000k +endef + +define Device/glinet_gl-x1200-nor-nand + $(Device/glinet_gl-x1200-common) + DEVICE_VARIANT := NOR/NAND + KERNEL_SIZE := 4096k + IMAGE_SIZE := 131072k + PAGESIZE := 2048 + VID_HDR_OFFSET := 2048 + BLOCKSIZE := 128k + IMAGES += factory.img + IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += glinet_gl-x1200-nor-nand + +define Device/glinet_gl-x1200-nor + $(Device/glinet_gl-x1200-common) + DEVICE_VARIANT := NOR +endef +TARGET_DEVICES += glinet_gl-x1200-nor + define Device/linksys_ea4500-v3 SOC := qca9558 DEVICE_VENDOR := Linksys diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network b/target/linux/ath79/nand/base-files/etc/board.d/02_network index b163b29db1a..137f3aa11b3 100644 --- a/target/linux/ath79/nand/base-files/etc/board.d/02_network +++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network @@ -30,6 +30,11 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "4:lan" ;; + glinet,gl-x1200-nor|\ + glinet,gl-x1200-nor-nand) + ucidef_add_switch "switch0" \ + "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" + ;; linksys,ea4500-v3) ucidef_add_switch "switch0" \ "6@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0" @@ -88,6 +93,11 @@ ath79_setup_macs() wan_mac=$(mtd_get_mac_binary art 0x0) label_mac=$wan_mac ;; + glinet,gl-x1200-nor|\ + glinet,gl-x1200-nor-nand) + wan_mac=$(mtd_get_mac_binary art 0x0) + lan_mac=$(macaddr_add "$wan_mac" 1) + ;; netgear,wndr3700-v4|\ netgear,wndr4300|\ netgear,wndr4300sw|\ diff --git a/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh b/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh index ea77345b061..5a4f76ba516 100644 --- a/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh @@ -19,7 +19,9 @@ platform_do_upgrade() { glinet_nand_nor_do_upgrade "$1" ;; glinet,gl-ar750s-nor|\ - glinet,gl-ar750s-nor-nand) + glinet,gl-ar750s-nor-nand|\ + glinet,gl-x1200-nor|\ + glinet,gl-x1200-nor-nand) nand_nor_do_upgrade "$1" ;; *) From 32a9fdfc02c9146b108c39a2f21679b6c64cb3e2 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 25 Feb 2023 18:37:26 +0100 Subject: [PATCH 09/34] ustream-ssl: update to Git version 2023-02-25 498f6e2 ustream-mbedtls: Use getrandom() instead of /dev/urandom Signed-off-by: Hauke Mehrtens --- package/libs/ustream-ssl/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/libs/ustream-ssl/Makefile b/package/libs/ustream-ssl/Makefile index c94e9a97ca5..ae5c8026c20 100644 --- a/package/libs/ustream-ssl/Makefile +++ b/package/libs/ustream-ssl/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ustream-ssl -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ustream-ssl.git -PKG_SOURCE_DATE:=2022-12-08 -PKG_SOURCE_VERSION:=9217ab46536353c7c792951b57163063f5ec7a3b -PKG_MIRROR_HASH:=cd4dc6a6c18290348b1f8b1c01df3320e4954dc46d714c797bef066f7a91248d +PKG_SOURCE_DATE:=2023-02-25 +PKG_SOURCE_VERSION:=498f6e268d4d2b0ad33b430f4ba1abe397d31496 +PKG_MIRROR_HASH:=a201d065dd613e30886c9f13a0851cec79538192cfe591b6f8ecd88724d55fb1 CMAKE_INSTALL:=1 PKG_LICENSE:=ISC From 2a104365dc50e3df5d63809aee16497402278f02 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 25 Feb 2023 19:56:12 +0100 Subject: [PATCH 10/34] netifd: update to the latest version ed65a00 netifd: bridge: Fix format string position 19372d8 netifd: Fix multiple -Wsign-compare warnings 8ebf033 netifd: Do not return values in void function c77417a netifd: Explicitly zero initialize variables 463a120 netifd: Activate -Wextra compile warnings Signed-off-by: Hauke Mehrtens --- package/network/config/netifd/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile index f40a990b42d..d9d1bce26f0 100644 --- a/package/network/config/netifd/Makefile +++ b/package/network/config/netifd/Makefile @@ -1,13 +1,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=netifd -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git -PKG_SOURCE_DATE:=2022-12-30 -PKG_SOURCE_VERSION:=81c1fbcba2f27f687c2a471f341502d47679f401 -PKG_MIRROR_HASH:=41d19f2804759aa42708942e27116bec78b169abee639d97c2ec7f0f62fa7739 +PKG_SOURCE_DATE:=2023-02-25 +PKG_SOURCE_VERSION:=463a1207f0766417866e2c28316e58a96f84370b +PKG_MIRROR_HASH:=1d407847282637f6e069b482368f2f8fc0126e66f3b37e4258e1fc1d19dd1ce5 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From ea33a5def506b0ba647f779e60e6ccca03c29a17 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 25 Feb 2023 02:35:16 +0000 Subject: [PATCH 11/34] mvebu: puzzle: fix fan thermal cooling driver Several fixes for the Puzzle WT61P803 hwmon driver were needed to make it behave well as thermal cooling device: - wire-up cooling device with OF node in device tree - properly parse cooling-levels (u32 with range check vs. u8) - actually use cooling-levels - keep current state and only write to uC if state has changed (avoids flooding the uC with commands which will result in uC crashing) Signed-off-by: Daniel Golle --- ...d-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch | 78 +++++++++++++------ ...d-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch | 78 +++++++++++++------ 2 files changed, 110 insertions(+), 46 deletions(-) diff --git a/target/linux/mvebu/patches-5.10/903-drivers-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch b/target/linux/mvebu/patches-5.10/903-drivers-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch index 684f09c800d..d31709fd853 100644 --- a/target/linux/mvebu/patches-5.10/903-drivers-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch +++ b/target/linux/mvebu/patches-5.10/903-drivers-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch @@ -53,7 +53,7 @@ Cc: Robert Marko obj-$(CONFIG_SENSORS_IBMPOWERNV)+= ibmpowernv.o --- /dev/null +++ b/drivers/hwmon/iei-wt61p803-puzzle-hwmon.c -@@ -0,0 +1,413 @@ +@@ -0,0 +1,445 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* IEI WT61P803 PUZZLE MCU HWMON Driver + * @@ -84,13 +84,17 @@ Cc: Robert Marko + * @name: Thermal cooling device name + * @pwm_channel: Controlled PWM channel (0 or 1) + * @cooling_levels: Thermal cooling device cooling levels (DT) ++ * @cur_level: Current cooling level ++ * @num_levels: Number of cooling levels + */ +struct iei_wt61p803_puzzle_thermal_cooling_device { + struct iei_wt61p803_puzzle_hwmon *mcu_hwmon; + struct thermal_cooling_device *tcdev; + char name[THERMAL_NAME_LENGTH]; + int pwm_channel; -+ u8 *cooling_levels; ++ u32 *cooling_levels; ++ int cur_level; ++ u8 num_levels; +}; + +/** @@ -326,8 +330,12 @@ Cc: Robert Marko +static int iei_wt61p803_puzzle_get_max_state(struct thermal_cooling_device *tcdev, + unsigned long *state) +{ -+ *state = IEI_WT61P803_PUZZLE_HWMON_MAX_PWM_VAL; ++ struct iei_wt61p803_puzzle_thermal_cooling_device *cdev = tcdev->devdata; + ++ if (!cdev) ++ return -EINVAL; ++ ++ *state = cdev->num_levels - 1; + return 0; +} + @@ -335,14 +343,14 @@ Cc: Robert Marko + unsigned long *state) +{ + struct iei_wt61p803_puzzle_thermal_cooling_device *cdev = tcdev->devdata; -+ struct iei_wt61p803_puzzle_hwmon *mcu_hwmon = cdev->mcu_hwmon; -+ long value; -+ int ret; + -+ ret = iei_wt61p803_puzzle_read_pwm_channel(mcu_hwmon, cdev->pwm_channel, &value); -+ if (ret) -+ return ret; -+ *state = value; ++ if (!cdev) ++ return -EINVAL; ++ ++ if (cdev->cur_level < 0) ++ return -EAGAIN; ++ ++ *state = cdev->cur_level; + return 0; +} + @@ -350,9 +358,21 @@ Cc: Robert Marko + unsigned long state) +{ + struct iei_wt61p803_puzzle_thermal_cooling_device *cdev = tcdev->devdata; -+ struct iei_wt61p803_puzzle_hwmon *mcu_hwmon = cdev->mcu_hwmon; ++ u8 pwm_level; + -+ return iei_wt61p803_puzzle_write_pwm_channel(mcu_hwmon, cdev->pwm_channel, state); ++ if (!cdev) ++ return -EINVAL; ++ ++ if (state >= cdev->num_levels) ++ return -EINVAL; ++ ++ if (state == cdev->cur_level) ++ return 0; ++ ++ cdev->cur_level = state; ++ pwm_level = cdev->cooling_levels[state]; ++ ++ return iei_wt61p803_puzzle_write_pwm_channel(cdev->mcu_hwmon, cdev->pwm_channel, pwm_level); +} + +static const struct thermal_cooling_device_ops iei_wt61p803_puzzle_cooling_ops = { @@ -369,7 +389,7 @@ Cc: Robert Marko + struct iei_wt61p803_puzzle_thermal_cooling_device *cdev; + u32 pwm_channel; + u8 num_levels; -+ int ret; ++ int i, ret; + + ret = fwnode_property_read_u32(child, "reg", &pwm_channel); + if (ret) @@ -377,7 +397,7 @@ Cc: Robert Marko + + mcu_hwmon->thermal_cooling_dev_present[pwm_channel] = true; + -+ num_levels = fwnode_property_count_u8(child, "cooling-levels"); ++ num_levels = fwnode_property_count_u32(child, "cooling-levels"); + if (!num_levels) + return -EINVAL; + @@ -385,28 +405,40 @@ Cc: Robert Marko + if (!cdev) + return -ENOMEM; + -+ cdev->cooling_levels = devm_kmalloc_array(dev, num_levels, sizeof(u8), GFP_KERNEL); ++ cdev->cooling_levels = devm_kmalloc_array(dev, num_levels, sizeof(u32), GFP_KERNEL); + if (!cdev->cooling_levels) + return -ENOMEM; + -+ ret = fwnode_property_read_u8_array(child, "cooling-levels", -+ cdev->cooling_levels, -+ num_levels); ++ ret = fwnode_property_read_u32_array(child, "cooling-levels", ++ cdev->cooling_levels, ++ num_levels); + if (ret) { + dev_err(dev, "Couldn't read property 'cooling-levels'\n"); + return ret; + } + -+ snprintf(cdev->name, THERMAL_NAME_LENGTH, "wt61p803_puzzle_%d", pwm_channel); -+ cdev->tcdev = devm_thermal_of_cooling_device_register(dev, NULL, cdev->name, cdev, -+ &iei_wt61p803_puzzle_cooling_ops); -+ if (IS_ERR(cdev->tcdev)) -+ return PTR_ERR(cdev->tcdev); ++ for (i = 0; i < num_levels; i++) { ++ if (cdev->cooling_levels[i] > ++ IEI_WT61P803_PUZZLE_HWMON_MAX_PWM_VAL) { ++ dev_err(dev, "iei_wt61p803_fan state[%d]:%d > %d\n", i, ++ cdev->cooling_levels[i], ++ IEI_WT61P803_PUZZLE_HWMON_MAX_PWM_VAL); ++ return -EINVAL; ++ } ++ } + + cdev->mcu_hwmon = mcu_hwmon; + cdev->pwm_channel = pwm_channel; ++ cdev->num_levels = num_levels; ++ cdev->cur_level = -1; + mcu_hwmon->cdev[pwm_channel] = cdev; + ++ snprintf(cdev->name, THERMAL_NAME_LENGTH, "wt61p803_puzzle_%d", pwm_channel); ++ cdev->tcdev = devm_thermal_of_cooling_device_register(dev, to_of_node(child), cdev->name, ++ cdev, &iei_wt61p803_puzzle_cooling_ops); ++ if (IS_ERR(cdev->tcdev)) ++ return PTR_ERR(cdev->tcdev); ++ + return 0; +} + diff --git a/target/linux/mvebu/patches-5.15/903-drivers-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch b/target/linux/mvebu/patches-5.15/903-drivers-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch index c22314e41c5..023495373b8 100644 --- a/target/linux/mvebu/patches-5.15/903-drivers-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch +++ b/target/linux/mvebu/patches-5.15/903-drivers-hwmon-Add-the-IEI-WT61P803-PUZZLE-HWMON-driv.patch @@ -53,7 +53,7 @@ Cc: Robert Marko obj-$(CONFIG_SENSORS_IBMPOWERNV)+= ibmpowernv.o --- /dev/null +++ b/drivers/hwmon/iei-wt61p803-puzzle-hwmon.c -@@ -0,0 +1,413 @@ +@@ -0,0 +1,445 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* IEI WT61P803 PUZZLE MCU HWMON Driver + * @@ -84,13 +84,17 @@ Cc: Robert Marko + * @name: Thermal cooling device name + * @pwm_channel: Controlled PWM channel (0 or 1) + * @cooling_levels: Thermal cooling device cooling levels (DT) ++ * @cur_level: Current cooling level ++ * @num_levels: Number of cooling levels + */ +struct iei_wt61p803_puzzle_thermal_cooling_device { + struct iei_wt61p803_puzzle_hwmon *mcu_hwmon; + struct thermal_cooling_device *tcdev; + char name[THERMAL_NAME_LENGTH]; + int pwm_channel; -+ u8 *cooling_levels; ++ u32 *cooling_levels; ++ int cur_level; ++ u8 num_levels; +}; + +/** @@ -326,8 +330,12 @@ Cc: Robert Marko +static int iei_wt61p803_puzzle_get_max_state(struct thermal_cooling_device *tcdev, + unsigned long *state) +{ -+ *state = IEI_WT61P803_PUZZLE_HWMON_MAX_PWM_VAL; ++ struct iei_wt61p803_puzzle_thermal_cooling_device *cdev = tcdev->devdata; + ++ if (!cdev) ++ return -EINVAL; ++ ++ *state = cdev->num_levels - 1; + return 0; +} + @@ -335,14 +343,14 @@ Cc: Robert Marko + unsigned long *state) +{ + struct iei_wt61p803_puzzle_thermal_cooling_device *cdev = tcdev->devdata; -+ struct iei_wt61p803_puzzle_hwmon *mcu_hwmon = cdev->mcu_hwmon; -+ long value; -+ int ret; + -+ ret = iei_wt61p803_puzzle_read_pwm_channel(mcu_hwmon, cdev->pwm_channel, &value); -+ if (ret) -+ return ret; -+ *state = value; ++ if (!cdev) ++ return -EINVAL; ++ ++ if (cdev->cur_level < 0) ++ return -EAGAIN; ++ ++ *state = cdev->cur_level; + return 0; +} + @@ -350,9 +358,21 @@ Cc: Robert Marko + unsigned long state) +{ + struct iei_wt61p803_puzzle_thermal_cooling_device *cdev = tcdev->devdata; -+ struct iei_wt61p803_puzzle_hwmon *mcu_hwmon = cdev->mcu_hwmon; ++ u8 pwm_level; + -+ return iei_wt61p803_puzzle_write_pwm_channel(mcu_hwmon, cdev->pwm_channel, state); ++ if (!cdev) ++ return -EINVAL; ++ ++ if (state >= cdev->num_levels) ++ return -EINVAL; ++ ++ if (state == cdev->cur_level) ++ return 0; ++ ++ cdev->cur_level = state; ++ pwm_level = cdev->cooling_levels[state]; ++ ++ return iei_wt61p803_puzzle_write_pwm_channel(cdev->mcu_hwmon, cdev->pwm_channel, pwm_level); +} + +static const struct thermal_cooling_device_ops iei_wt61p803_puzzle_cooling_ops = { @@ -369,7 +389,7 @@ Cc: Robert Marko + struct iei_wt61p803_puzzle_thermal_cooling_device *cdev; + u32 pwm_channel; + u8 num_levels; -+ int ret; ++ int i, ret; + + ret = fwnode_property_read_u32(child, "reg", &pwm_channel); + if (ret) @@ -377,7 +397,7 @@ Cc: Robert Marko + + mcu_hwmon->thermal_cooling_dev_present[pwm_channel] = true; + -+ num_levels = fwnode_property_count_u8(child, "cooling-levels"); ++ num_levels = fwnode_property_count_u32(child, "cooling-levels"); + if (!num_levels) + return -EINVAL; + @@ -385,28 +405,40 @@ Cc: Robert Marko + if (!cdev) + return -ENOMEM; + -+ cdev->cooling_levels = devm_kmalloc_array(dev, num_levels, sizeof(u8), GFP_KERNEL); ++ cdev->cooling_levels = devm_kmalloc_array(dev, num_levels, sizeof(u32), GFP_KERNEL); + if (!cdev->cooling_levels) + return -ENOMEM; + -+ ret = fwnode_property_read_u8_array(child, "cooling-levels", -+ cdev->cooling_levels, -+ num_levels); ++ ret = fwnode_property_read_u32_array(child, "cooling-levels", ++ cdev->cooling_levels, ++ num_levels); + if (ret) { + dev_err(dev, "Couldn't read property 'cooling-levels'\n"); + return ret; + } + -+ snprintf(cdev->name, THERMAL_NAME_LENGTH, "wt61p803_puzzle_%d", pwm_channel); -+ cdev->tcdev = devm_thermal_of_cooling_device_register(dev, NULL, cdev->name, cdev, -+ &iei_wt61p803_puzzle_cooling_ops); -+ if (IS_ERR(cdev->tcdev)) -+ return PTR_ERR(cdev->tcdev); ++ for (i = 0; i < num_levels; i++) { ++ if (cdev->cooling_levels[i] > ++ IEI_WT61P803_PUZZLE_HWMON_MAX_PWM_VAL) { ++ dev_err(dev, "iei_wt61p803_fan state[%d]:%d > %d\n", i, ++ cdev->cooling_levels[i], ++ IEI_WT61P803_PUZZLE_HWMON_MAX_PWM_VAL); ++ return -EINVAL; ++ } ++ } + + cdev->mcu_hwmon = mcu_hwmon; + cdev->pwm_channel = pwm_channel; ++ cdev->num_levels = num_levels; ++ cdev->cur_level = -1; + mcu_hwmon->cdev[pwm_channel] = cdev; + ++ snprintf(cdev->name, THERMAL_NAME_LENGTH, "wt61p803_puzzle_%d", pwm_channel); ++ cdev->tcdev = devm_thermal_of_cooling_device_register(dev, to_of_node(child), cdev->name, ++ cdev, &iei_wt61p803_puzzle_cooling_ops); ++ if (IS_ERR(cdev->tcdev)) ++ return PTR_ERR(cdev->tcdev); ++ + return 0; +} + From aa41f4a395bda69cb6ef0ef423e2a4077284fbcd Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 25 Feb 2023 17:42:23 +0000 Subject: [PATCH 12/34] mvebu: setup effective thermal zones on Puzzle M901 and M902 Assign fan with 4 active cooling levels to be used for the main CPU as well as external SerDes units. Signed-off-by: Daniel Golle --- .../boot/dts/marvell/cn9131-puzzle-m901.dts | 27 ++++++------ .../boot/dts/marvell/cn9132-puzzle-m902.dts | 32 ++++++++------- .../boot/dts/marvell/puzzle-thermal.dtsi | 41 +++++++++++++++++++ 3 files changed, 70 insertions(+), 30 deletions(-) create mode 100644 target/linux/mvebu/files/arch/arm64/boot/dts/marvell/puzzle-thermal.dtsi diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts index 80d876b4ad6..0ad25fafbb8 100644 --- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9131-puzzle-m901.dts @@ -6,6 +6,7 @@ */ #include "cn9130.dtsi" +#include "puzzle-thermal.dtsi" #include #include @@ -109,26 +110,18 @@ chassis_fan_group0: fan-group@0 { #cooling-cells = <2>; reg = <0x00>; - cooling-levels = <64 102 170 230 250>; + cooling-levels = <80 102 170 230 255>; }; }; }; }; -&ap_thermal_cpu1 { - trips { - cpu_active: cpu-active { - temperature = <44000>; - hysteresis = <2000>; - type = "active"; - }; - }; - cooling-maps { - fan-map { - trip = <&cpu_active>; - cooling-device = <&chassis_fan_group0 64 THERMAL_NO_LIMIT>; - }; - }; +&ap_thermal_ic { + PUZZLE_FAN_THERMAL(ic, &chassis_fan_group0); +}; + +&cp0_thermal_ic { + PUZZLE_FAN_THERMAL(cp0, &chassis_fan_group0); }; /* on-board eMMC - U9 */ @@ -396,6 +389,10 @@ }; }; +&cp1_thermal_ic { + PUZZLE_FAN_THERMAL(cp1, &chassis_fan_group0); +}; + &cp1_usb3_1 { status = "okay"; phys = <&cp1_comphy3 1>; diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts index fd99eb2d130..398e53a5f9a 100644 --- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/cn9132-puzzle-m902.dts @@ -6,6 +6,7 @@ */ #include "cn9130.dtsi" +#include "puzzle-thermal.dtsi" #include #include @@ -154,28 +155,21 @@ chassis_fan_group0: fan-group@0 { #cooling-cells = <2>; reg = <0x00>; - cooling-levels = <64 102 170 230 250>; + cooling-levels = <80 102 170 230 255>; }; }; }; }; -&ap_thermal_cpu1 { - trips { - cpu_active: cpu-active { - temperature = <44000>; - hysteresis = <2000>; - type = "active"; - }; - }; - cooling-maps { - fan-map { - trip = <&cpu_active>; - cooling-device = <&chassis_fan_group0 64 THERMAL_NO_LIMIT>; - }; - }; +&ap_thermal_ic { + PUZZLE_FAN_THERMAL(ic, &chassis_fan_group0); }; +&cp0_thermal_ic { + PUZZLE_FAN_THERMAL(cp0, &chassis_fan_group0); +}; + + /* on-board eMMC - U9 */ &ap_sdhci0 { pinctrl-names = "default"; @@ -447,6 +441,10 @@ }; }; +&cp1_thermal_ic { + PUZZLE_FAN_THERMAL(cp1, &chassis_fan_group0); +}; + /* * Instantiate the second connected CP115 */ @@ -562,3 +560,7 @@ }; }; }; + +&cp2_thermal_ic { + PUZZLE_FAN_THERMAL(cp2, &chassis_fan_group0); +}; diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/puzzle-thermal.dtsi b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/puzzle-thermal.dtsi new file mode 100644 index 00000000000..94677532f2d --- /dev/null +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/puzzle-thermal.dtsi @@ -0,0 +1,41 @@ +#define PUZZLE_FAN_THERMAL(_cname, _fan) \ + trips { \ + _cname##_active_high: cpu-active-high { \ + temperature = <80000>; \ + hysteresis = <2000>; \ + type = "active"; \ + }; \ + _cname##_active_med: cpu-active-med { \ + temperature = <72000>; \ + hysteresis = <2000>; \ + type = "active"; \ + }; \ + _cname##_active_low: cpu-active-low { \ + temperature = <65000>; \ + hysteresis = <2000>; \ + type = "active"; \ + }; \ + _cname##_active_idle: cpu-active-idle { \ + temperature = <60000>; \ + hysteresis = <2000>; \ + type = "active"; \ + }; \ + }; \ + cooling-maps { \ + cpu-active-high { \ + trip = <&_cname##_active_high>; \ + cooling-device = <_fan 3 THERMAL_NO_LIMIT>; \ + }; \ + cpu-active-med { \ + trip = <&_cname##_active_med>; \ + cooling-device = <_fan 2 THERMAL_NO_LIMIT>; \ + }; \ + cpu-active-low { \ + trip = <&_cname##_active_low>; \ + cooling-device = <_fan 1 THERMAL_NO_LIMIT>; \ + }; \ + cpu-active-idle { \ + trip = <&_cname##_active_idle>; \ + cooling-device = <_fan 0 THERMAL_NO_LIMIT>; \ + }; \ + } From af5e230c2036af07ef0fca6795ee259849b51e59 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 25 Feb 2023 17:49:10 +0000 Subject: [PATCH 13/34] tools/squashfs4: fix PKG_MIRROR_HASH The hash currently matches neither the SHA256 of the Github download nor the hash of the archive generated by the OpenWrt build system. (and yes, they differ...) Set hash of Github-generated tarball. Fixes: 30f2d516ba ("tools/squashfs4: add new tool for squashfs4 images") Signed-off-by: Daniel Golle --- tools/squashfs4/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/squashfs4/Makefile b/tools/squashfs4/Makefile index 9d4f6babfcb..7c8bcf1a72e 100644 --- a/tools/squashfs4/Makefile +++ b/tools/squashfs4/Makefile @@ -15,7 +15,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/plougher/squashfs-tools PKG_SOURCE_DATE:=2022-03-17 PKG_SOURCE_VERSION:=afdd63fc386919b4aa40d573b0a6069414d14317 -PKG_MIRROR_HASH:=caedb66cf6dcbdcee0d1525923e203d003ef15f34a13a328686794666f16171f +PKG_MIRROR_HASH:=59c294e00ddfc1f4bda658c7567584ce35fdd479c413ebdb1376981b27737be1 include $(INCLUDE_DIR)/host-build.mk From 688697889c9ceb9d2d8d413d1abcc5fa7edb402b Mon Sep 17 00:00:00 2001 From: Felix Baumann Date: Mon, 20 Feb 2023 03:40:20 +0100 Subject: [PATCH 14/34] ramips: correct the PCIe port number for some mt7621 devices MT7621 uses a new PCIe driver in the 5.15+ kernel. Allocating wrong PCIe port will cause the PCIe NIC to not work properly. This commit fixes the wrong port numbers on Netgear R6220, WAC104 and WNDR3700 v5. According to bootlog, MT7612E (5GHz) is connected to pcie0, and MT7603E (2GHz) is connected to pcie2: [2.758986] mt7621-pci 1e140000.pcie: pcie1 no card, disable it (RST & CLK) [2.772862] mt7621-pci 1e140000.pcie: PCIE0 enabled [2.782579] mt7621-pci 1e140000.pcie: PCIE2 enabled ... [3.009151] pci 0000:01:00.0: [14c3:7662] type 00 class 0x028000 [3.125715] pci 0000:02:00.0: [14c3:7603] type 00 class 0x028000 Tested-by: Maximilian Baumgartner Signed-off-by: Shiji Yang [felix.bau@gmx.de: adjust commit message for Netgear devices] Signed-off-by: Felix Baumann --- target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi | 2 +- target/linux/ramips/dts/mt7621_netgear_wac104.dts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi b/target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi index 0ae6ab46f7a..691aba10634 100644 --- a/target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi +++ b/target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi @@ -96,7 +96,7 @@ }; }; -&pcie1 { +&pcie2 { wifi@0,0 { compatible = "mediatek,mt76"; reg = <0x0 0 0 0 0>; diff --git a/target/linux/ramips/dts/mt7621_netgear_wac104.dts b/target/linux/ramips/dts/mt7621_netgear_wac104.dts index 3b5d6ae2d99..97aa4a90d1b 100644 --- a/target/linux/ramips/dts/mt7621_netgear_wac104.dts +++ b/target/linux/ramips/dts/mt7621_netgear_wac104.dts @@ -122,7 +122,7 @@ }; }; -&pcie1 { +&pcie2 { wifi@0,0 { compatible = "mediatek,mt76"; reg = <0x0 0 0 0 0>; From ed64c3323590e3c9fa8b423bf37689023a7a101f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Thu, 16 Feb 2023 23:04:20 +0100 Subject: [PATCH 15/34] ipq40xx: Linksys MR8300: fix the USB port power MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The USB port on the MR8300 randomly fails to feed bus-powered devices. This is caused by a misconfigured pinmux. The GPIO68 should be used to enable the USB power (active low), but it's inside the NAND pinmux. This GPIO pin was found in the original firmware at a startup script in both MR8300 and EA8300. Therefore apply the fix for both boards. Signed-off-by: Daniel González Cabanelas Reviewed-by: Robert Marko --- .../files/arch/arm/boot/dts/qcom-ipq4019-xx8300.dtsi | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-xx8300.dtsi b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-xx8300.dtsi index db9ca1e7250..141ea604425 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-xx8300.dtsi +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-xx8300.dtsi @@ -100,6 +100,16 @@ status = "okay"; }; }; + + regulator-usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "USB_VBUS"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + regulator-boot-on; + gpio = <&tlmm 68 GPIO_ACTIVE_LOW>; + }; }; @@ -268,7 +278,7 @@ pins = "gpio55", "gpio56", "gpio57", "gpio60", "gpio62", "gpio63", "gpio64", "gpio65", "gpio66", - "gpio67", "gpio68", "gpio69"; + "gpio67", "gpio69"; function = "qpic"; bias-pull-down; }; From c9df2d5c640a056a7b2443f5155b275d74117cbe Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Wed, 18 Jan 2023 09:39:18 +0000 Subject: [PATCH 16/34] dnsmasq: bump to v2.89 Signed-off-by: Kevin Darbyshire-Bryant --- package/network/services/dnsmasq/Makefile | 4 ++-- .../patches/100-remove-old-runtime-kernel-support.patch | 4 ++-- package/network/services/dnsmasq/patches/200-ubus_dns.patch | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index 65ef9da3a9a..f555712a7f2 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq -PKG_UPSTREAM_VERSION:=2.88 +PKG_UPSTREAM_VERSION:=2.89 PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION))) PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz PKG_SOURCE_URL:=https://thekelleys.org.uk/dnsmasq/ -PKG_HASH:=23544deda10340c053bea6f15a93fed6ea7f5aaa85316bfc671ffa6d22fbc1b3 +PKG_HASH:=02bd230346cf0b9d5909f5e151df168b2707103785eb616b56685855adebb609 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/network/services/dnsmasq/patches/100-remove-old-runtime-kernel-support.patch b/package/network/services/dnsmasq/patches/100-remove-old-runtime-kernel-support.patch index 76065375bde..59b8d02c0e1 100644 --- a/package/network/services/dnsmasq/patches/100-remove-old-runtime-kernel-support.patch +++ b/package/network/services/dnsmasq/patches/100-remove-old-runtime-kernel-support.patch @@ -26,7 +26,7 @@ Signed-off-by: Kevin Darbyshire-Bryant --- a/src/dnsmasq.h +++ b/src/dnsmasq.h -@@ -1247,7 +1247,7 @@ extern struct daemon { +@@ -1248,7 +1248,7 @@ extern struct daemon { int inotifyfd; #endif #if defined(HAVE_LINUX_NETWORK) @@ -35,7 +35,7 @@ Signed-off-by: Kevin Darbyshire-Bryant #elif defined(HAVE_BSD_NETWORK) int dhcp_raw_fd, dhcp_icmp_fd, routefd; #endif -@@ -1452,9 +1452,6 @@ int read_write(int fd, unsigned char *pa +@@ -1453,9 +1453,6 @@ int read_write(int fd, unsigned char *pa void close_fds(long max_fd, int spare1, int spare2, int spare3); int wildcard_match(const char* wildcard, const char* match); int wildcard_matchn(const char* wildcard, const char* match, int num); diff --git a/package/network/services/dnsmasq/patches/200-ubus_dns.patch b/package/network/services/dnsmasq/patches/200-ubus_dns.patch index f88763f94a0..8a70bb8bdf1 100644 --- a/package/network/services/dnsmasq/patches/200-ubus_dns.patch +++ b/package/network/services/dnsmasq/patches/200-ubus_dns.patch @@ -1,6 +1,6 @@ --- a/src/dnsmasq.h +++ b/src/dnsmasq.h -@@ -1630,14 +1630,26 @@ void emit_dbus_signal(int action, struct +@@ -1631,14 +1631,26 @@ void emit_dbus_signal(int action, struct /* ubus.c */ #ifdef HAVE_UBUS From 888b207f1a6cde4c954e1b3b34f8c2ba60b14cd1 Mon Sep 17 00:00:00 2001 From: Tobias Hilbig Date: Sat, 25 Feb 2023 11:40:37 +0100 Subject: [PATCH 17/34] ncurses: add alacritty terminfo Add terminfo file for the terminal emulator alacritty. https://github.com/alacritty/alacritty Signed-off-by: Tobias Hilbig --- package/libs/ncurses/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/libs/ncurses/Makefile b/package/libs/ncurses/Makefile index 29261a4cd09..4d8e685f35d 100644 --- a/package/libs/ncurses/Makefile +++ b/package/libs/ncurses/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ncurses PKG_CPE_ID:=cpe:/a:gnu:ncurses PKG_VERSION:=6.4 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) @@ -123,6 +123,7 @@ ifneq ($(HOST_OS),FreeBSD) ) for file in \ a/ansi \ + a/alacritty \ d/dumb \ l/linux \ r/rxvt \ From 1d82a47b497e11e2474703ab8e3ef6994d33809d Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 23 Feb 2023 15:06:14 +0100 Subject: [PATCH 18/34] mac80211: fix mesh fast xmit header cache flush split into multiple functions depending on sta, mpath or mpp Signed-off-by: Felix Fietkau --- ...wifi-mac80211-mesh-fast-xmit-support.patch | 234 ++++++++++++------ 1 file changed, 161 insertions(+), 73 deletions(-) diff --git a/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch b/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch index 4bd3d4c092a..f18e1bb377b 100644 --- a/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch +++ b/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch @@ -132,7 +132,7 @@ Signed-off-by: Felix Fietkau + u16 hdrlen; + u8 pn_offs; + u8 band; -+ struct ieee80211_key __rcu *key; ++ struct ieee80211_key *key; + struct hlist_node walk_list; + struct rhash_head rhash; + struct mesh_path *mpath, *mppath; @@ -143,7 +143,7 @@ Signed-off-by: Felix Fietkau /* Recent multicast cache */ /* RMC_BUCKETS must be a power of 2, maximum 256 */ #define RMC_BUCKETS 256 -@@ -298,6 +336,15 @@ void mesh_path_discard_frame(struct ieee +@@ -298,6 +336,18 @@ void mesh_path_discard_frame(struct ieee void mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata); bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt); @@ -152,8 +152,11 @@ Signed-off-by: Felix Fietkau +void mesh_cache_hdr(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb, struct mesh_path *mpath); +void mesh_hdr_cache_gc(struct ieee80211_sub_if_data *sdata); -+void mesh_hdr_cache_flush(struct ieee80211_sub_if_data *sdata, const u8 *addr, -+ bool is_mpp); ++void mesh_hdr_cache_flush_mpp(struct ieee80211_sub_if_data *sdata, ++ const u8 *addr); ++void mesh_hdr_cache_flush_mpath(struct mesh_path *mpath); ++void mesh_hdr_cache_flush_sta(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta); +void mesh_refresh_path(struct ieee80211_sub_if_data *sdata, + struct mesh_path *mpath, const u8 *addr); @@ -161,33 +164,57 @@ Signed-off-by: Felix Fietkau static inline --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c -@@ -491,8 +491,11 @@ static u32 hwmp_route_info_get(struct ie +@@ -394,6 +394,7 @@ static u32 hwmp_route_info_get(struct ie + u32 orig_sn, orig_metric; + unsigned long orig_lifetime, exp_time; + u32 last_hop_metric, new_metric; ++ bool flush_mpath = false; + bool process = true; + u8 hopcount; + +@@ -491,8 +492,10 @@ static u32 hwmp_route_info_get(struct ie } if (fresh_info) { - if (rcu_access_pointer(mpath->next_hop) != sta) + if (rcu_access_pointer(mpath->next_hop) != sta) { mpath->path_change_count++; -+ mesh_hdr_cache_flush(mpath->sdata, mpath->dst, -+ false); ++ flush_mpath = true; + } mesh_path_assign_nexthop(mpath, sta); mpath->flags |= MESH_PATH_SN_VALID; mpath->metric = new_metric; -@@ -539,8 +542,11 @@ static u32 hwmp_route_info_get(struct ie +@@ -502,6 +505,8 @@ static u32 hwmp_route_info_get(struct ie + mpath->hop_count = hopcount; + mesh_path_activate(mpath); + spin_unlock_bh(&mpath->state_lock); ++ if (flush_mpath) ++ mesh_hdr_cache_flush_mpath(mpath); + ewma_mesh_fail_avg_init(&sta->mesh->fail_avg); + /* init it at a low value - 0 start is tricky */ + ewma_mesh_fail_avg_add(&sta->mesh->fail_avg, 1); +@@ -539,8 +544,10 @@ static u32 hwmp_route_info_get(struct ie } if (fresh_info) { - if (rcu_access_pointer(mpath->next_hop) != sta) + if (rcu_access_pointer(mpath->next_hop) != sta) { mpath->path_change_count++; -+ mesh_hdr_cache_flush(mpath->sdata, mpath->dst, -+ false); ++ flush_mpath = true; + } mesh_path_assign_nexthop(mpath, sta); mpath->metric = last_hop_metric; mpath->exp_time = time_after(mpath->exp_time, exp_time) -@@ -977,7 +983,7 @@ free: +@@ -548,6 +555,8 @@ static u32 hwmp_route_info_get(struct ie + mpath->hop_count = 1; + mesh_path_activate(mpath); + spin_unlock_bh(&mpath->state_lock); ++ if (flush_mpath) ++ mesh_hdr_cache_flush_mpath(mpath); + ewma_mesh_fail_avg_init(&sta->mesh->fail_avg); + /* init it at a low value - 0 start is tricky */ + ewma_mesh_fail_avg_add(&sta->mesh->fail_avg, 1); +@@ -977,7 +986,7 @@ free: * Locking: the function must be called from within a rcu read lock block. * */ @@ -196,7 +223,7 @@ Signed-off-by: Felix Fietkau { struct ieee80211_sub_if_data *sdata = mpath->sdata; struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; -@@ -1215,6 +1221,20 @@ static int mesh_nexthop_lookup_nolearn(s +@@ -1215,6 +1224,20 @@ static int mesh_nexthop_lookup_nolearn(s return 0; } @@ -217,7 +244,7 @@ Signed-off-by: Felix Fietkau /** * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame. Calling * this function is considered "using" the associated mpath, so preempt a path -@@ -1242,19 +1262,18 @@ int mesh_nexthop_lookup(struct ieee80211 +@@ -1242,19 +1265,18 @@ int mesh_nexthop_lookup(struct ieee80211 if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE)) return -ENOENT; @@ -295,14 +322,21 @@ Signed-off-by: Felix Fietkau static inline bool mpath_expired(struct mesh_path *mpath) { return (mpath->flags & MESH_PATH_ACTIVE) && -@@ -381,6 +417,211 @@ struct mesh_path *mesh_path_new(struct i +@@ -381,6 +417,254 @@ struct mesh_path *mesh_path_new(struct i return new_mpath; } ++static void mesh_hdr_cache_entry_free(struct mesh_hdr_cache *cache, ++ struct mhdr_cache_entry *entry) ++{ ++ hlist_del_rcu(&entry->walk_list); ++ rhashtable_remove_fast(&cache->rhead, &entry->rhash, mesh_hdr_rht_params); ++ kfree_rcu(entry, rcu); ++} ++ +struct mhdr_cache_entry * +mesh_get_cached_hdr(struct ieee80211_sub_if_data *sdata, const u8 *addr) +{ -+ struct mesh_path *mpath, *mppath; + struct mhdr_cache_entry *entry; + struct mesh_hdr_cache *cache; + @@ -311,14 +345,19 @@ Signed-off-by: Felix Fietkau + if (!entry) + return NULL; + -+ mpath = rcu_dereference(entry->mpath); -+ mppath = rcu_dereference(entry->mppath); -+ if (!(mpath->flags & MESH_PATH_ACTIVE) || mpath_expired(mpath)) ++ if (!(entry->mpath->flags & MESH_PATH_ACTIVE) || ++ mpath_expired(entry->mpath)) { ++ spin_lock_bh(&cache->walk_lock); ++ entry = rhashtable_lookup(&cache->rhead, addr, mesh_hdr_rht_params); ++ if (entry) ++ mesh_hdr_cache_entry_free(cache, entry); ++ spin_unlock_bh(&cache->walk_lock); + return NULL; ++ } + -+ mesh_refresh_path(sdata, mpath, NULL); -+ if (mppath) -+ mppath->exp_time = jiffies; ++ mesh_refresh_path(sdata, entry->mpath, NULL); ++ if (entry->mppath) ++ entry->mppath->exp_time = jiffies; + entry->timestamp = jiffies; + + return entry; @@ -332,7 +371,7 @@ Signed-off-by: Felix Fietkau + struct mesh_hdr_cache *cache; + struct mhdr_cache_entry *mhdr, *old_mhdr; + struct ieee80211s_hdr *meshhdr; -+ struct sta_info *next_hop; ++ struct sta_info *sta; + struct ieee80211_key *key; + struct mesh_path *mppath; + u16 meshhdr_len; @@ -353,8 +392,8 @@ Signed-off-by: Felix Fietkau + if (atomic_read(&cache->rhead.nelems) >= MESH_HEADER_CACHE_MAX_SIZE) + return; + -+ next_hop = rcu_dereference(mpath->next_hop); -+ if (!next_hop) ++ sta = rcu_dereference(mpath->next_hop); ++ if (!sta) + return; + + if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) { @@ -374,7 +413,12 @@ Signed-off-by: Felix Fietkau + + mppath->fast_xmit_check = jiffies; + -+ key = rcu_access_pointer(next_hop->ptk[next_hop->ptk_idx]); ++ /* ++ * Same use of the sta lock as in ieee80211_check_fast_xmit, in order ++ * to protect against concurrent sta key updates. ++ */ ++ spin_lock_bh(&sta->lock); ++ key = rcu_access_pointer(sta->ptk[sta->ptk_idx]); + if (!key) + key = rcu_access_pointer(sdata->default_unicast_key); + @@ -386,7 +430,7 @@ Signed-off-by: Felix Fietkau + + if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) || + (key->flags & KEY_FLAG_TAINTED)) -+ return; ++ goto unlock_sta; + + switch (key->conf.cipher) { + case WLAN_CIPHER_SUITE_CCMP: @@ -404,25 +448,25 @@ Signed-off-by: Felix Fietkau + hdrlen += IEEE80211_GCMP_HDR_LEN; + break; + default: -+ return; ++ goto unlock_sta; + } + } + + if (WARN_ON_ONCE(hdrlen + meshhdr_len + sizeof(rfc1042_header) > + MESH_HEADER_MAX_LEN)) -+ return; ++ goto unlock_sta; + + mhdr = kzalloc(sizeof(*mhdr), GFP_ATOMIC); + if (!mhdr) -+ return; ++ goto unlock_sta; + + memcpy(mhdr->addr_key, mppath->dst, ETH_ALEN); + mhdr->machdr_len = hdrlen; + mhdr->hdrlen = mhdr->machdr_len + meshhdr_len + sizeof(rfc1042_header); -+ rcu_assign_pointer(mhdr->mpath, mpath); ++ mhdr->mpath = mpath; + if (meshhdr->flags & MESH_FLAGS_AE) -+ rcu_assign_pointer(mhdr->mppath, mppath); -+ rcu_assign_pointer(mhdr->key, key); ++ mhdr->mppath = mppath; ++ mhdr->key = key; + mhdr->timestamp = jiffies; + mhdr->band = info->band; + mhdr->pn_offs = pn_offs; @@ -444,19 +488,28 @@ Signed-off-by: Felix Fietkau + old_mhdr = rhashtable_lookup_get_insert_fast(&cache->rhead, + &mhdr->rhash, + mesh_hdr_rht_params); -+ if (likely(!old_mhdr)) -+ hlist_add_head(&mhdr->walk_list, &cache->walk_head); -+ else ++ if (unlikely(IS_ERR(old_mhdr))) { + kfree(mhdr); -+ spin_unlock_bh(&cache->walk_lock); -+} ++ goto unlock_cache; ++ } + -+static void mesh_hdr_cache_entry_free(struct mesh_hdr_cache *cache, -+ struct mhdr_cache_entry *entry) -+{ -+ hlist_del_rcu(&entry->walk_list); -+ rhashtable_remove_fast(&cache->rhead, &entry->rhash, mesh_hdr_rht_params); -+ kfree_rcu(entry, rcu); ++ /* ++ * replace any previous entry in the hash table, in case we're ++ * replacing it with a different type (e.g. mpath -> mpp) ++ */ ++ if (unlikely(old_mhdr)) { ++ rhashtable_replace_fast(&cache->rhead, &old_mhdr->rhash, ++ &mhdr->rhash, mesh_hdr_rht_params); ++ hlist_del_rcu(&old_mhdr->walk_list); ++ kfree_rcu(old_mhdr, rcu); ++ } ++ ++ hlist_add_head(&mhdr->walk_list, &cache->walk_head); ++ ++unlock_cache: ++ spin_unlock_bh(&cache->walk_lock); ++unlock_sta: ++ spin_unlock_bh(&sta->lock); +} + +void mesh_hdr_cache_gc(struct ieee80211_sub_if_data *sdata) @@ -477,8 +530,23 @@ Signed-off-by: Felix Fietkau + spin_unlock_bh(&cache->walk_lock); +} + -+void mesh_hdr_cache_flush(struct ieee80211_sub_if_data *sdata, const u8 *addr, -+ bool is_mpp) ++void mesh_hdr_cache_flush_mpath(struct mesh_path *mpath) ++{ ++ struct ieee80211_sub_if_data *sdata = mpath->sdata; ++ struct mesh_hdr_cache *cache = &sdata->u.mesh.hdr_cache; ++ struct mhdr_cache_entry *entry; ++ struct hlist_node *n; ++ ++ cache = &sdata->u.mesh.hdr_cache; ++ spin_lock_bh(&cache->walk_lock); ++ hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) ++ if (entry->mpath == mpath) ++ mesh_hdr_cache_entry_free(cache, entry); ++ spin_unlock_bh(&cache->walk_lock); ++} ++ ++void mesh_hdr_cache_flush_sta(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta) +{ + struct mesh_hdr_cache *cache = &sdata->u.mesh.hdr_cache; + struct mhdr_cache_entry *entry; @@ -486,45 +554,58 @@ Signed-off-by: Felix Fietkau + + cache = &sdata->u.mesh.hdr_cache; + spin_lock_bh(&cache->walk_lock); -+ -+ /* Only one header per mpp address is expected in the header cache */ -+ if (is_mpp) { -+ entry = rhashtable_lookup(&cache->rhead, addr, -+ mesh_hdr_rht_params); -+ if (entry) -+ mesh_hdr_cache_entry_free(cache, entry); -+ goto out; -+ } -+ + hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) -+ if (ether_addr_equal(entry->mpath->dst, addr)) ++ if (rcu_access_pointer(entry->mpath->next_hop) == sta) + mesh_hdr_cache_entry_free(cache, entry); ++ spin_unlock_bh(&cache->walk_lock); ++} + -+out: ++void mesh_hdr_cache_flush_mpp(struct ieee80211_sub_if_data *sdata, ++ const u8 *addr) ++{ ++ struct mesh_hdr_cache *cache = &sdata->u.mesh.hdr_cache; ++ struct mhdr_cache_entry *entry; ++ ++ cache = &sdata->u.mesh.hdr_cache; ++ spin_lock_bh(&cache->walk_lock); ++ entry = rhashtable_lookup(&cache->rhead, addr, mesh_hdr_rht_params); ++ if (entry) ++ mesh_hdr_cache_entry_free(cache, entry); + spin_unlock_bh(&cache->walk_lock); +} + /** * mesh_path_add - allocate and add a new path to the mesh path table * @dst: destination address of the path (ETH_ALEN length) -@@ -521,6 +762,8 @@ static void mesh_path_free_rcu(struct me +@@ -464,6 +748,8 @@ int mpp_path_add(struct ieee80211_sub_if - static void __mesh_path_del(struct mesh_table *tbl, struct mesh_path *mpath) + if (ret) + kfree(new_mpath); ++ else ++ mesh_hdr_cache_flush_mpp(sdata, dst); + + sdata->u.mesh.mpp_paths_generation++; + return ret; +@@ -523,6 +809,10 @@ static void __mesh_path_del(struct mesh_ { -+ mesh_hdr_cache_flush(mpath->sdata, mpath->dst, -+ tbl == &mpath->sdata->u.mesh.mpp_paths); hlist_del_rcu(&mpath->walk_list); rhashtable_remove_fast(&tbl->rhead, &mpath->rhash, mesh_rht_params); ++ if (tbl == &mpath->sdata->u.mesh.mpp_paths) ++ mesh_hdr_cache_flush_mpp(mpath->sdata, mpath->dst); ++ else ++ mesh_hdr_cache_flush_mpath(mpath); mesh_path_free_rcu(tbl, mpath); -@@ -747,6 +990,7 @@ void mesh_path_fix_nexthop(struct mesh_p + } + +@@ -747,6 +1037,7 @@ void mesh_path_fix_nexthop(struct mesh_p mpath->exp_time = 0; mpath->flags = MESH_PATH_FIXED | MESH_PATH_SN_VALID; mesh_path_activate(mpath); -+ mesh_hdr_cache_flush(mpath->sdata, mpath->dst, false); ++ mesh_hdr_cache_flush_mpath(mpath); spin_unlock_bh(&mpath->state_lock); ewma_mesh_fail_avg_init(&next_hop->mesh->fail_avg); /* init it at a low value - 0 start is tricky */ -@@ -758,6 +1002,7 @@ void mesh_pathtbl_init(struct ieee80211_ +@@ -758,6 +1049,7 @@ void mesh_pathtbl_init(struct ieee80211_ { mesh_table_init(&sdata->u.mesh.mesh_paths); mesh_table_init(&sdata->u.mesh.mpp_paths); @@ -532,7 +613,7 @@ Signed-off-by: Felix Fietkau } static -@@ -785,6 +1030,7 @@ void mesh_path_expire(struct ieee80211_s +@@ -785,6 +1077,7 @@ void mesh_path_expire(struct ieee80211_s void mesh_pathtbl_unregister(struct ieee80211_sub_if_data *sdata) { @@ -565,7 +646,7 @@ Signed-off-by: Felix Fietkau + + /* flush fast xmit cache if the address path changed */ + if (update) -+ mesh_hdr_cache_flush(sdata, proxied_addr, true); ++ mesh_hdr_cache_flush_mpp(sdata, proxied_addr); + rcu_read_unlock(); } @@ -577,12 +658,12 @@ Signed-off-by: Felix Fietkau return; + if (ieee80211_vif_is_mesh(&sdata->vif)) -+ mesh_hdr_cache_flush(sdata, sta->addr, false); ++ mesh_hdr_cache_flush_sta(sdata, sta); + /* Locking here protects both the pointer itself, and against concurrent * invocations winning data access races to, e.g., the key pointer that * is used. -@@ -3723,6 +3726,155 @@ free: +@@ -3723,6 +3726,162 @@ free: kfree_skb(skb); } @@ -593,6 +674,7 @@ Signed-off-by: Felix Fietkau + struct ieee80211_local *local = sdata->local; + struct ieee80211_tx_data tx = {}; + struct ieee80211_tx_info *info; ++ struct tid_ampdu_tx *tid_tx; + struct ieee80211_key *key; + struct ieee80211_hdr *hdr; + struct mesh_path *mpath; @@ -633,6 +715,12 @@ Signed-off-by: Felix Fietkau + hdr = (struct ieee80211_hdr *)skb->data; + tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; + *ieee80211_get_qos_ctl(hdr) = tid; ++ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); ++ if (tid_tx) { ++ if (tid_tx->timeout) ++ tid_tx->last_tx = jiffies; ++ info->flags |= IEEE80211_TX_CTL_AMPDU; ++ } + + ieee80211_aggr_check(sdata, sta, skb); + @@ -662,15 +750,15 @@ Signed-off-by: Felix Fietkau + bool copy_sa = false; + u16 ethertype; + ++ if (!ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT)) ++ return false; ++ + if (ctrl_flags & IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP) + return false; + + if (ifmsh->mshcfg.dot11MeshNolearn) + return false; + -+ if (!ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT)) -+ return false; -+ + /* Add support for these cases later */ + if (ifmsh->ps_peers_light_sleep || ifmsh->ps_peers_deep_sleep) + return false; @@ -738,7 +826,7 @@ Signed-off-by: Felix Fietkau static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, struct sta_info *sta, struct ieee80211_fast_tx *fast_tx, -@@ -4244,8 +4396,14 @@ void __ieee80211_subif_start_xmit(struct +@@ -4244,8 +4403,14 @@ void __ieee80211_subif_start_xmit(struct return; } @@ -753,7 +841,7 @@ Signed-off-by: Felix Fietkau if (ieee80211_lookup_ra_sta(sdata, skb, &sta)) goto out_free; -@@ -4255,8 +4413,6 @@ void __ieee80211_subif_start_xmit(struct +@@ -4255,8 +4420,6 @@ void __ieee80211_subif_start_xmit(struct skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); ieee80211_aggr_check(sdata, sta, skb); From 5c04c3943e748fb497c12fdf9809f0da437a2ae4 Mon Sep 17 00:00:00 2001 From: Karl Chan Date: Thu, 16 Feb 2023 18:47:21 +0800 Subject: [PATCH 19/34] ramips: Alternative name Asus RT-AC750L for Asus RT-AC1200V2 The Asus RT-AC750L is identical to the already supported Asus RT-AC1200V2. Use the ALT0 buildroot tags to show both devices. Reference : https://forum.openwrt.org/t/asus-rt-ac750l-is-the-same-as-rt-ac1200-v2/151783 Signed-off-by: Karl Chan --- target/linux/ramips/image/mt76x8.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 156aa634be7..296b80d03fe 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -55,6 +55,8 @@ define Device/asus_rt-ac1200-v2 DEVICE_VENDOR := ASUS DEVICE_MODEL := RT-AC1200 DEVICE_VARIANT := V2 + DEVICE_ALT0_VENDOR := ASUS + DEVICE_ALT0_MODEL := RT-AC750L IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ append-rootfs | pad-rootfs From 107f7374c9ef3e3ea6d589b187671cd3e138e63c Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Tue, 21 Feb 2023 12:35:05 -0800 Subject: [PATCH 20/34] octeontx: switch to Kernel 5.15 Switch over from testing version. Signed-off-by: Tim Harvey --- target/linux/octeontx/Makefile | 3 +- target/linux/octeontx/config-5.10 | 413 ------------------ ...r-Gateworks-PLX-PEX860x-switch-with-.patch | 59 --- 3 files changed, 1 insertion(+), 474 deletions(-) delete mode 100644 target/linux/octeontx/config-5.10 delete mode 100644 target/linux/octeontx/patches-5.10/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch diff --git a/target/linux/octeontx/Makefile b/target/linux/octeontx/Makefile index 50c5cd6d217..5260291d050 100644 --- a/target/linux/octeontx/Makefile +++ b/target/linux/octeontx/Makefile @@ -10,8 +10,7 @@ BOARDNAME:=Octeon-TX FEATURES:=squashfs ramdisk targz pcie gpio rtc usb fpu SUBTARGETS:=generic -KERNEL_PATCHVER:=5.10 -KERNEL_TESTING_PATCHVER:=5.15 +KERNEL_PATCHVER:=5.15 define Target/Description Build images for Octeon-TX CN80XX/CN81XX based boards diff --git a/target/linux/octeontx/config-5.10 b/target/linux/octeontx/config-5.10 deleted file mode 100644 index 19a8c258d9a..00000000000 --- a/target/linux/octeontx/config-5.10 +++ /dev/null @@ -1,413 +0,0 @@ -CONFIG_64BIT=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_HIBERNATION_HEADER=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_KEEP_MEMBLOCK=y -CONFIG_ARCH_MMAP_RND_BITS=18 -CONFIG_ARCH_MMAP_RND_BITS_MAX=33 -CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -CONFIG_ARCH_PROC_KCORE_TEXT=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_SPARSEMEM_DEFAULT=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_STACKWALK=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_THUNDER=y -CONFIG_ARM64=y -CONFIG_ARM64_4K_PAGES=y -CONFIG_ARM64_CNP=y -CONFIG_ARM64_CRYPTO=y -CONFIG_ARM64_ERRATUM_819472=y -CONFIG_ARM64_ERRATUM_824069=y -CONFIG_ARM64_ERRATUM_826319=y -CONFIG_ARM64_ERRATUM_827319=y -CONFIG_ARM64_ERRATUM_843419=y -CONFIG_ARM64_HW_AFDBM=y -CONFIG_ARM64_MODULE_PLTS=y -CONFIG_ARM64_PAGE_SHIFT=12 -CONFIG_ARM64_PAN=y -CONFIG_ARM64_PA_BITS=48 -CONFIG_ARM64_PA_BITS_48=y -CONFIG_ARM64_PTR_AUTH=y -CONFIG_ARM64_SVE=y -CONFIG_ARM64_TAGGED_ADDR_ABI=y -CONFIG_ARM64_UAO=y -CONFIG_ARM64_VA_BITS=48 -# CONFIG_ARM64_VA_BITS_39 is not set -CONFIG_ARM64_VA_BITS_48=y -CONFIG_ARM64_VHE=y -CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y -CONFIG_ARM_AMBA=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -CONFIG_ARM_CPUIDLE=y -CONFIG_ARM_GIC=y -CONFIG_ARM_GIC_V2M=y -CONFIG_ARM_GIC_V3=y -CONFIG_ARM_GIC_V3_ITS=y -CONFIG_ARM_GIC_V3_ITS_PCI=y -CONFIG_ARM_PSCI_FW=y -CONFIG_ARM_SBSA_WATCHDOG=y -CONFIG_ATA=y -# CONFIG_ATA_SFF is not set -CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y -CONFIG_BALLOON_COMPACTION=y -CONFIG_BLK_DEV_BSG=y -CONFIG_BLK_DEV_BSGLIB=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_MQ_PCI=y -CONFIG_BLK_MQ_VIRTIO=y -CONFIG_BLK_PM=y -CONFIG_BLK_SCSI_REQUEST=y -CONFIG_CAVIUM_ERRATUM_22375=y -CONFIG_CAVIUM_ERRATUM_23144=y -CONFIG_CAVIUM_ERRATUM_23154=y -CONFIG_CAVIUM_ERRATUM_27456=y -CONFIG_CAVIUM_ERRATUM_30115=y -CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMA=y -CONFIG_CMA_ALIGNMENT=8 -CONFIG_CMA_AREAS=7 -# CONFIG_CMA_DEBUG is not set -# CONFIG_CMA_DEBUGFS is not set -CONFIG_CMA_SIZE_MBYTES=16 -# CONFIG_CMA_SIZE_SEL_MAX is not set -CONFIG_CMA_SIZE_SEL_MBYTES=y -# CONFIG_CMA_SIZE_SEL_MIN is not set -# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set -CONFIG_COMMON_CLK=y -CONFIG_COMMON_CLK_CS2000_CP=y -# CONFIG_COMPAT_32BIT_TIME is not set -CONFIG_CONFIGFS_FS=y -CONFIG_CONTIG_ALLOC=y -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_MENU=y -CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y -CONFIG_CPU_LITTLE_ENDIAN=y -CONFIG_CPU_PM=y -CONFIG_CPU_RMAP=y -CONFIG_CRASH_CORE=y -CONFIG_CRASH_DUMP=y -CONFIG_CRC16=y -CONFIG_CRC7=y -CONFIG_CRC_ITU_T=y -CONFIG_CRC_T10DIF=y -CONFIG_CRYPTO_AES_ARM64=y -CONFIG_CRYPTO_AES_ARM64_CE=y -CONFIG_CRYPTO_AES_ARM64_CE_BLK=y -CONFIG_CRYPTO_AES_ARM64_CE_CCM=y -CONFIG_CRYPTO_ANSI_CPRNG=y -CONFIG_CRYPTO_BLAKE2S=y -CONFIG_CRYPTO_CRC32=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_CRCT10DIF=y -CONFIG_CRYPTO_CRCT10DIF_ARM64_CE=y -CONFIG_CRYPTO_CRYPTD=y -CONFIG_CRYPTO_DRBG=y -CONFIG_CRYPTO_DRBG_HMAC=y -CONFIG_CRYPTO_DRBG_MENU=y -CONFIG_CRYPTO_ECHAINIV=y -CONFIG_CRYPTO_GHASH_ARM64_CE=y -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_JITTERENTROPY=y -CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y -CONFIG_CRYPTO_LIB_SHA256=y -CONFIG_CRYPTO_RNG=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_RNG_DEFAULT=y -CONFIG_CRYPTO_SHA1=y -CONFIG_CRYPTO_SHA1_ARM64_CE=y -CONFIG_CRYPTO_SHA256=y -CONFIG_CRYPTO_SHA256_ARM64=y -CONFIG_CRYPTO_SHA2_ARM64_CE=y -CONFIG_CRYPTO_SIMD=y -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_DMADEVICES=y -CONFIG_DMA_CMA=y -CONFIG_DMA_DIRECT_REMAP=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y -CONFIG_DMA_PERNUMA_CMA=y -CONFIG_DMA_REMAP=y -CONFIG_DMA_SHARED_BUFFER=y -CONFIG_DTC=y -CONFIG_DT_IDLE_STATES=y -CONFIG_EDAC=y -# CONFIG_EDAC_DEBUG is not set -# CONFIG_EDAC_DMC520 is not set -CONFIG_EDAC_LEGACY_SYSFS=y -CONFIG_EDAC_SUPPORT=y -CONFIG_EDAC_THUNDERX=y -# CONFIG_EDAC_XGENE is not set -CONFIG_EEPROM_AT24=y -CONFIG_FAT_FS=y -CONFIG_FIXED_PHY=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_FRAME_POINTER=y -CONFIG_FREEZER=y -CONFIG_FW_CACHE=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_ARCH_TOPOLOGY=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_CPU_VULNERABILITIES=y -CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_GENERIC_GETTIMEOFDAY=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y -CONFIG_GENERIC_IRQ_MIGRATION=y -CONFIG_GENERIC_IRQ_MULTI_HANDLER=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_PHY=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GLOB=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_PCA953X=y -CONFIG_GPIO_PCA953X_IRQ=y -CONFIG_GPIO_THUNDERX=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HIBERNATE_CALLBACKS=y -CONFIG_HIBERNATION=y -CONFIG_HIBERNATION_SNAPSHOT_DEV=y -CONFIG_HOLES_IN_ZONE=y -CONFIG_HOTPLUG_CPU=y -CONFIG_HUGETLBFS=y -CONFIG_HUGETLB_PAGE=y -CONFIG_HWSPINLOCK=y -CONFIG_HW_RANDOM=y -CONFIG_HW_RANDOM_CAVIUM=y -CONFIG_HW_RANDOM_OPTEE=y -CONFIG_I2C=y -CONFIG_I2C_ALGOBIT=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_MUX=y -CONFIG_I2C_SMBUS=y -CONFIG_I2C_THUNDERX=y -CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_IRQ_FASTEOI_HIERARCHY_HANDLERS=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_TIME_ACCOUNTING=y -CONFIG_IRQ_WORK=y -# CONFIG_ISDN is not set -CONFIG_JUMP_LABEL=y -CONFIG_KEXEC=y -CONFIG_KEXEC_CORE=y -CONFIG_KSM=y -CONFIG_LIBFDT=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MAGIC_SYSRQ=y -CONFIG_MAILBOX=y -# CONFIG_MAILBOX_TEST is not set -CONFIG_MDIO_BUS=y -CONFIG_MDIO_CAVIUM=y -CONFIG_MDIO_DEVICE=y -CONFIG_MDIO_DEVRES=y -CONFIG_MDIO_THUNDER=y -CONFIG_MEMFD_CREATE=y -CONFIG_MEMORY_BALLOON=y -CONFIG_MEMORY_ISOLATION=y -CONFIG_MEMTEST=y -CONFIG_MFD_SYSCON=y -CONFIG_MIGRATION=y -CONFIG_MMC=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_CAVIUM_THUNDERX=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_MSDOS_FS=y -# CONFIG_MTD is not set -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_MULTIPLE_NODES=y -CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_NET_FLOW_LIMIT=y -CONFIG_NLS=y -CONFIG_NLS_CODEPAGE_437=y -CONFIG_NLS_ISO8859_1=y -CONFIG_NODES_SHIFT=2 -CONFIG_NO_HZ_COMMON=y -CONFIG_NO_HZ_IDLE=y -CONFIG_NR_CPUS=64 -CONFIG_NUMA=y -CONFIG_NUMA_BALANCING=y -CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y -CONFIG_NVMEM=y -CONFIG_NVMEM_SYSFS=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_KOBJ=y -CONFIG_OF_MDIO=y -CONFIG_OF_NET=y -CONFIG_OF_NUMA=y -CONFIG_OPTEE=y -CONFIG_OPTEE_SHM_NUM_PRIV_PAGES=1 -CONFIG_PADATA=y -CONFIG_PAGE_REPORTING=y -CONFIG_PARAVIRT=y -CONFIG_PARTITION_PERCPU=y -CONFIG_PCI=y -CONFIG_PCIEAER=y -CONFIG_PCIEPORTBUS=y -CONFIG_PCIE_PME=y -CONFIG_PCI_ATS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DOMAINS_GENERIC=y -CONFIG_PCI_ECAM=y -CONFIG_PCI_HOST_COMMON=y -CONFIG_PCI_HOST_GENERIC=y -CONFIG_PCI_HOST_THUNDER_ECAM=y -CONFIG_PCI_HOST_THUNDER_PEM=y -CONFIG_PCI_IOV=y -CONFIG_PCI_MSI=y -CONFIG_PCI_MSI_IRQ_DOMAIN=y -CONFIG_PGTABLE_LEVELS=4 -CONFIG_PHYLIB=y -CONFIG_PHYS_ADDR_T_64BIT=y -CONFIG_PM=y -CONFIG_PM_CLK=y -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -CONFIG_PM_STD_PARTITION="" -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_SYSCON=y -CONFIG_POWER_RESET_XGENE=y -CONFIG_POWER_SUPPLY=y -CONFIG_PROC_VMCORE=y -CONFIG_QUEUED_RWLOCKS=y -CONFIG_QUEUED_SPINLOCKS=y -CONFIG_RAS=y -CONFIG_RATIONAL=y -# CONFIG_RAVE_SP_CORE is not set -CONFIG_REBOOT_MODE=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_MMIO=y -CONFIG_RESET_CONTROLLER=y -CONFIG_RFS_ACCEL=y -CONFIG_RODATA_FULL_DEFAULT_ENABLED=y -CONFIG_RPS=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_DRV_DS1672=y -CONFIG_RTC_I2C_AND_SPI=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_SATA_AHCI=y -CONFIG_SATA_AHCI_PLATFORM=y -CONFIG_SATA_HOST=y -CONFIG_SCHED_INFO=y -CONFIG_SCHED_MC=y -CONFIG_SCSI=y -# CONFIG_SCSI_LOWLEVEL is not set -# CONFIG_SCSI_PROC_FS is not set -CONFIG_SCSI_SAS_ATA=y -CONFIG_SCSI_SAS_ATTRS=y -CONFIG_SCSI_SAS_HOST_SMP=y -CONFIG_SCSI_SAS_LIBSAS=y -CONFIG_SECCOMP=y -CONFIG_SECCOMP_FILTER=y -CONFIG_SERIAL_8250_DW=y -CONFIG_SERIAL_8250_DWLIB=y -CONFIG_SERIAL_8250_EXTENDED=y -CONFIG_SERIAL_8250_FSL=y -CONFIG_SERIAL_8250_SHARE_IRQ=y -CONFIG_SERIAL_AMBA_PL011=y -CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -CONFIG_SERIAL_DEV_BUS=y -CONFIG_SERIAL_DEV_CTRL_TTYPORT=y -CONFIG_SERIAL_MCTRL_GPIO=y -CONFIG_SERIAL_OF_PLATFORM=y -CONFIG_SERIAL_XILINX_PS_UART=y -CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y -CONFIG_SG_POOL=y -CONFIG_SMP=y -CONFIG_SPARSEMEM=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_MANUAL=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSE_IRQ=y -CONFIG_SPI=y -CONFIG_SPI_MASTER=y -CONFIG_SPI_THUNDERX=y -CONFIG_SRAM=y -CONFIG_SRCU=y -CONFIG_SWIOTLB=y -CONFIG_SWPHY=y -CONFIG_SYNC_FILE=y -CONFIG_SYSCON_REBOOT_MODE=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_SYS_SUPPORTS_HUGETLBFS=y -CONFIG_TASKSTATS=y -CONFIG_TASK_DELAY_ACCT=y -CONFIG_TASK_IO_ACCOUNTING=y -CONFIG_TASK_XACCT=y -CONFIG_TEE=y -CONFIG_THREAD_INFO_IN_TASK=y -CONFIG_THUNDER_NIC_BGX=y -CONFIG_THUNDER_NIC_PF=y -CONFIG_THUNDER_NIC_RGX=y -CONFIG_THUNDER_NIC_VF=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y -CONFIG_TRANSPARENT_HUGEPAGE=y -CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y -# CONFIG_TRANSPARENT_HUGEPAGE_MADVISE is not set -CONFIG_TREE_RCU=y -CONFIG_TREE_SRCU=y -CONFIG_UNMAP_KERNEL_AT_EL0=y -CONFIG_USB=y -CONFIG_USB_COMMON=y -CONFIG_USB_PCI=y -CONFIG_USB_SUPPORT=y -# CONFIG_USB_UHCI_HCD is not set -CONFIG_USB_XHCI_HCD=y -CONFIG_USB_XHCI_PCI=y -CONFIG_USB_XHCI_PLATFORM=y -CONFIG_USE_PERCPU_NUMA_NODE_ID=y -CONFIG_VIRTIO=y -CONFIG_VIRTIO_BALLOON=y -# CONFIG_VIRTIO_BLK is not set -CONFIG_VIRTIO_MMIO=y -# CONFIG_VIRTIO_NET is not set -CONFIG_VIRTIO_PCI=y -CONFIG_VIRTIO_PCI_LEGACY=y -CONFIG_VMAP_STACK=y -CONFIG_WATCHDOG_CORE=y -CONFIG_XARRAY_MULTI=y -CONFIG_XPS=y -CONFIG_XXHASH=y -CONFIG_ZONE_DMA32=y diff --git a/target/linux/octeontx/patches-5.10/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch b/target/linux/octeontx/patches-5.10/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch deleted file mode 100644 index 28502d393fb..00000000000 --- a/target/linux/octeontx/patches-5.10/0004-PCI-add-quirk-for-Gateworks-PLX-PEX860x-switch-with-.patch +++ /dev/null @@ -1,59 +0,0 @@ -From d0ff7a1bcfe886cab1a237895b08ac51ecfe10e7 Mon Sep 17 00:00:00 2001 -From: Tim Harvey -Date: Wed, 10 Apr 2019 08:00:47 -0700 -Subject: [PATCH 04/12] PCI: add quirk for Gateworks PLX PEX860x switch with - GPIO PERST# - -Gateworks boards use PLX PEX860x switches where downstream ports -have their PERST# driven from the PEX GPIO. - -Signed-off-by: Tim Harvey ---- - drivers/pci/quirks.c | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -5787,3 +5788,34 @@ static void nvidia_ion_ahci_fixup(struct - pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING; - } - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup); -+ -+#ifdef CONFIG_PCI_HOST_THUNDER_PEM -+/* -+ * fixup for PLX PEX8909 bridge to configure GPIO1-7 as output High -+ * as they are used for slots1-7 PERST# -+ */ -+static void newport_pciesw_early_fixup(struct pci_dev *dev) -+{ -+ u32 dw; -+ -+ if (!of_machine_is_compatible("gw,newport")) -+ return; -+ -+ if (dev->devfn != 0) -+ return; -+ -+ dev_info(&dev->dev, "de-asserting PERST#\n"); -+ pci_read_config_dword(dev, 0x62c, &dw); -+ dw |= 0xaaa8; /* GPIO1-7 outputs */ -+ pci_write_config_dword(dev, 0x62c, dw); -+ -+ pci_read_config_dword(dev, 0x644, &dw); -+ dw |= 0xfe; /* GPIO1-7 output high */ -+ pci_write_config_dword(dev, 0x644, dw); -+ -+ msleep(100); -+} -+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8609, newport_pciesw_early_fixup); -+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8606, newport_pciesw_early_fixup); -+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8604, newport_pciesw_early_fixup); -+#endif /* CONFIG_PCI_HOST_THUNDER_PEM */ From be0f1c1b268a99ea25c9797a4ed725835ca79fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Tue, 21 Feb 2023 00:43:55 +0100 Subject: [PATCH 21/34] mvebu: add support for Buffalo LinkStation LS220DE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Buffalo LinkStation LS220DE is a dual bay NAS, based on Marvell Armada 370 Hardware: SoC: Marvell Armada 88F6707 CPU: Cortex-A9 800 MHz, 1 core Flash 1: SPI-NOR 1 MiB (U-Boot) Flash 2: NAND 512 MiB (OS) RAM: DDR3 256 MiB Ethernet: 1x 1GbE USB: 1x 2.0 SATA: 2x 3Gb/s LEDs/Input: 5x / 2x (1x button, 1x slide-switch) Fan: 1x casing Flash instructions, from hard drive: 1. Get access to the "boot" partition at the hard drive where the stock firmware is installed. It can be done with acp-commander or by plugging the hard drive to a computer. 2. Backup the stock uImage: mv /boot/uImage.buffalo /boot/uImage.buffalo.bak 3. Move and rename the Openwrt initramfs image to the boot partition: mv openwrt-initramfs-kernel.bin /boot/uImage.buffalo 4. Power on the Linkstation with the hardrive inside. Now Openwrt will boot, but still not installed. 5. Connect via ssh to OpenWrt: ssh root@192.168.1.1 6. Rename boot files inside boot partition mount -t ext3 /dev/sda1 /mnt mv /mnt/uImage.buffalo /mnt/uImage.buffalo.openwrt.bak mv /mnt/initrd.buffalo /mnt/initrd.buffalo.bak 7. Format ubi partitions at the NAND flash ("kernel_ubi" and "ubi"): ubiformat /dev/mtd0 -y ubidetach -p /dev/mtd1 ubiformat /dev/mtd1 -y 8. Flash the sysupgrade image: sysupgrade -n openwrt-squashfs-sysupgrade.bin 9. Wait until it finish, the device will reboot with OpenWrt installed on the NAND flash. Restore the stock firmware: 1. Take the hard drive used for the installation and restore boot backup files to their original names: mount -t ext3 /dev/sda1 /mnt mv /mnt/uImage.buffalo.bak /mnt/uImage.buffalo mv /mnt/initrd.buffalo.bak /mnt/initrd.buffalo 2. Boot from the hard drive and perform a stock firmware update using the Buffalo utility. The NAND will be restored to the original state. Signed-off-by: Daniel González Cabanelas --- package/boot/uboot-envtools/files/mvebu | 1 + .../base-files/etc/board.d/02_network | 1 + .../base-files/lib/upgrade/platform.sh | 7 + .../boot/dts/armada-370-buffalo-ls220de.dts | 380 ++++++++++++++++++ target/linux/mvebu/image/Makefile | 10 + target/linux/mvebu/image/cortexa9.mk | 15 + ...set-linkstation-poweroff-add-ls220de.patch | 15 + 7 files changed, 429 insertions(+) create mode 100644 target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls220de.dts create mode 100644 target/linux/mvebu/patches-5.15/105-power-reset-linkstation-poweroff-add-ls220de.patch diff --git a/package/boot/uboot-envtools/files/mvebu b/package/boot/uboot-envtools/files/mvebu index cc1c648f246..63b5132608a 100644 --- a/package/boot/uboot-envtools/files/mvebu +++ b/package/boot/uboot-envtools/files/mvebu @@ -13,6 +13,7 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in +buffalo,ls220de|\ buffalo,ls421de) ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" ;; diff --git a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network index c613a3cd603..d2229fe6bfb 100644 --- a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network @@ -61,6 +61,7 @@ mvebu_setup_macs() local label_mac="" case "$board" in + buffalo,ls220de|\ buffalo,ls421de) lan_mac=$(mtd_get_mac_ascii u-boot-env eth1addr) ;; diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh index 18b978d4370..9019c1aeff5 100755 --- a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh +++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh @@ -25,6 +25,13 @@ platform_check_image() { platform_do_upgrade() { case "$(board_name)" in + buffalo,ls220de) + # Kernel UBI volume name must be "boot" + CI_KERNPART=boot + CI_KERN_UBIPART=ubi_kernel + CI_ROOT_UBIPART=ubi + nand_do_upgrade "$1" + ;; buffalo,ls421de) nand_do_upgrade "$1" ;; diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls220de.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls220de.dts new file mode 100644 index 00000000000..3de9ac5473e --- /dev/null +++ b/target/linux/mvebu/files/arch/arm/boot/dts/armada-370-buffalo-ls220de.dts @@ -0,0 +1,380 @@ +// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT) +/* + * Device Tree file for Buffalo LinkStation LS220DE + * + * Copyright (C) 2023 Daniel González Cabanelas + */ + +/dts-v1/; + +#include "armada-370.dtsi" +#include "mvebu-linkstation-fan.dtsi" +#include +#include +#include +#include + +/ { + model = "Buffalo LinkStation LS220DE"; + compatible = "buffalo,ls220de", "marvell,armada370", "marvell,armada-370-xp"; + + aliases { + led-boot = &led_boot; + led-failsafe = &led_failsafe; + led-running = &led_power; + led-upgrade = &led_upgrade; + }; + + chosen { + bootargs = "earlycon"; + stdout-path = "serial0:115200n8"; + append-rootblock = "nullparameter="; /* override the bootloader args */ + }; + + memory { + device_type = "memory"; + reg = <0x00000000 0x10000000>; /* 256 MB */ + }; + + soc { + ranges = ; + }; + + system_fan: gpio_fan { + gpios = <&gpio0 13 GPIO_ACTIVE_HIGH + &gpio0 14 GPIO_ACTIVE_HIGH>; + alarm-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; + + #cooling-cells = <2>; + }; + + thermal-zones { + hdd-thermal { + polling-delay = <20000>; + polling-delay-passive = <2000>; + + thermal-sensors = <&hdd0_temp>; /* only one drivetemp sensor is supported */ + + trips { + hdd_alert1: trip1 { + temperature = <34000>; + hysteresis = <2000>; + type = "active"; + }; + hdd_alert2: trip2 { + temperature = <40000>; + hysteresis = <2000>; + type = "active"; + }; + hdd_alert3: trip3 { + temperature = <45000>; + hysteresis = <2000>; + type = "passive"; + }; + hdd_hot { + temperature = <50000>; + hysteresis = <2000>; + type = "hot"; + }; + hdd_crit { + temperature = <60000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + + cooling-maps { + map1 { + trip = <&hdd_alert1>; + cooling-device = <&system_fan THERMAL_NO_LIMIT 1>; + }; + map2 { + trip = <&hdd_alert2>; + cooling-device = <&system_fan 2 2>; + }; + map3 { + trip = <&hdd_alert3>; + cooling-device = <&system_fan 3 THERMAL_NO_LIMIT>; + }; + }; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + pinctrl-0 = <&pmx_buttons>; + pinctrl-names = "default"; + + power { + label = "Power Switch"; + linux,code = ; + linux,input-type = ; + gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; + }; + + function { + label = "Function Button"; + linux,code = ; + gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; + }; + }; + + gpio_leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&pmx_leds1 &pmx_leds2>; + + indicator_red { + function = LED_FUNCTION_INDICATOR; + color = ; + gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + + led_power: power_white { + label = "white:power"; + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led_failsafe: power_red { + label = "red:power"; + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; + }; + + led_upgrade: power_orange { + label = "amber:power"; + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio1 25 GPIO_ACTIVE_HIGH>; + }; + + led_boot: indicator_white { + label = "white:indicator"; + function = LED_FUNCTION_INDICATOR; + color = ; + gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>; + }; + + hdd1_red { + function = LED_FUNCTION_DISK; + color = ; + gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "ata1"; + function-enumerator = <1>; + }; + + hdd2_red { + function = LED_FUNCTION_DISK; + color = ; + gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "ata2"; + function-enumerator = <2>; + }; + }; + + regulators { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&pmx_power_hdd1 &pmx_power_hdd2>; + pinctrl-names = "default"; + + sata1_power: regulator@1 { + compatible = "regulator-fixed"; + reg = <1>; + regulator-name = "HDD1"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + startup-delay-us = <2000000>; + enable-active-high; + regulator-always-on; + regulator-boot-on; + gpio = <&gpio0 8 GPIO_ACTIVE_HIGH>; + }; + + sata2_power: regulator@2 { + compatible = "regulator-fixed"; + reg = <2>; + regulator-name = "HDD2"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + startup-delay-us = <4000000>; + enable-active-high; + regulator-always-on; + regulator-boot-on; + gpio = <&gpio0 2 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&coherencyfab { + broken-idle; +}; + +ð1 { + pinctrl-0 = <&ge1_rgmii_pins>; + pinctrl-names = "default"; + status = "okay"; + phy-handle = <ðphy0>; + phy-connection-type = "rgmii-id"; +}; + +&mdio { + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + + ethphy0: ethernet-phy@0 { /* Marvell 88E1318 */ + reg = <0>; + marvell,reg-init = <0x3 0x10 0xf000 0x091A>, /* LED function */ + <0x3 0x11 0x0000 0x4401>, /* LED polarity */ + <0x3 0x12 0x0000 0x4905>; /* LED timer */ + #thermal-sensor-cells = <0>; + }; +}; + +&nand_controller { + status = "okay"; + + nand@0 { + reg = <0>; + label = "pxa3xx_nand-0"; + nand-rb = <0>; + marvell,nand-keep-config; + nand-on-flash-bbt; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi_kernel"; + reg = <0x00000000 0x02000000>; /* 32 MiB */ + }; + + partition@2000000 { + label = "ubi"; + reg = <0x02000000 0x1df00000>; /* 479 MiB */ + }; + }; + }; +}; + +&sata { + nr-ports = <2>; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + hdd0_temp: sata-port@0 { + reg = <0>; + #thermal-sensor-cells = <0>; + }; + + hdd1_temp: sata-port@1 { + reg = <1>; + #thermal-sensor-cells = <0>; + }; +}; + +&spi0 { + status = "okay"; + pinctrl-0 = <&spi0_pins2>; + pinctrl-names = "default"; + + spi-flash@0 { + compatible = "mxicy,mx25l8005", "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x00000 0xf0000>; /* 960 KiB*/ + label = "u-boot"; + read-only; + }; + partition@f0000 { + reg = <0xf0000 0x10000>; /* 64 KiB */ + label = "u-boot-env"; + }; + }; + }; +}; + +&pmsu { + pinctrl-0 = <&pmx_power_cpu>; + pinctrl-names = "default"; +}; + +&uart0 { + status = "okay"; +}; + +&usb0 { + status = "okay"; +}; + +&pinctrl { + pmx_power_hdd2: pmx-power-hdd2 { + marvell,pins = "mpp2"; + marvell,function = "gpio"; + }; + + pmx_power_cpu: pmx-power-cpu { + marvell,pins = "mpp4"; + marvell,function = "vdd"; + }; + + pmx_power_hdd1: pmx-power-hdd1 { + marvell,pins = "mpp8"; + marvell,function = "gpio"; + }; + + pmx_fan_lock: pmx-fan-lock { + marvell,pins = "mpp10"; + marvell,function = "gpio"; + }; + + pmx_hdd_present: pmx-hdd-present { + marvell,pins = "mpp11", "mpp12"; + marvell,function = "gpio"; + }; + + pmx_fan_high: pmx-fan-high { + marvell,pins = "mpp13"; + marvell,function = "gpio"; + }; + + pmx_fan_low: pmx-fan-low { + marvell,pins = "mpp14"; + marvell,function = "gpio"; + }; + + pmx_buttons: pmx-buttons { + marvell,pins = "mpp15", "mpp16"; + marvell,function = "gpio"; + }; + + pmx_leds1: pmx-leds { + marvell,pins = "mpp7", "mpp54", "mpp59", "mpp61"; + marvell,function = "gpo"; + }; + + pmx_leds2: pmx-leds { + marvell,pins = "mpp55", "mpp57", "mpp62"; + marvell,function = "gpio"; + }; +}; diff --git a/target/linux/mvebu/image/Makefile b/target/linux/mvebu/image/Makefile index b0498d34c93..57129d2dcb8 100644 --- a/target/linux/mvebu/image/Makefile +++ b/target/linux/mvebu/image/Makefile @@ -53,6 +53,16 @@ define Build/buffalo-kernel-jffs2 rm -rf $(KDIR)/kernel_jffs2 $@.fakerd endef +define Build/buffalo-kernel-ubifs + rm -rf $@-ubidir + mkdir -p $@-ubidir + mv $@ $@-ubidir/uImage.buffalo + touch $@ + $(call Build/append-uImage-fakehdr, ramdisk) + mv $@ $@-ubidir/initrd.buffalo + $(STAGING_DIR_HOST)/bin/mkfs.ubifs $(KERNEL_UBIFS_OPTS) -r $@-ubidir $@ +endef + # Some info about Ctera firmware: # 1. It's simple tar file (GNU standard), but it must have ".firm" suffix. # 2. It contains two images: kernel and romdisk. Both are required. diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index aed1d476464..56381ab5f85 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -14,6 +14,21 @@ define Device/kernel-size-migration Upgrade via sysupgrade mechanism is not possible, so new installation via factory style image is required. endef +define Device/buffalo_ls220de + $(Device/NAND-128K) + DEVICE_VENDOR := Buffalo + DEVICE_MODEL := LinkStation LS220DE + KERNEL_UBIFS_OPTS = -m $$(PAGESIZE) -e 124KiB -c 172 -x none + KERNEL := kernel-bin | append-dtb | uImage none | buffalo-kernel-ubifs + KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none + DEVICE_DTS := armada-370-buffalo-ls220de + DEVICE_PACKAGES := \ + kmod-hwmon-gpiofan kmod-hwmon-drivetemp kmod-linkstation-poweroff \ + kmod-md-mod kmod-md-raid0 kmod-md-raid1 kmod-md-raid10 kmod-fs-xfs \ + mdadm mkf2fs e2fsprogs partx-utils +endef +TARGET_DEVICES += buffalo_ls220de + define Device/buffalo_ls421de $(Device/NAND-128K) DEVICE_VENDOR := Buffalo diff --git a/target/linux/mvebu/patches-5.15/105-power-reset-linkstation-poweroff-add-ls220de.patch b/target/linux/mvebu/patches-5.15/105-power-reset-linkstation-poweroff-add-ls220de.patch new file mode 100644 index 00000000000..32238612344 --- /dev/null +++ b/target/linux/mvebu/patches-5.15/105-power-reset-linkstation-poweroff-add-ls220de.patch @@ -0,0 +1,15 @@ +--- a/drivers/power/reset/linkstation-poweroff.c ++++ b/drivers/power/reset/linkstation-poweroff.c +@@ -142,6 +142,12 @@ static void linkstation_poweroff(void) + } + + static const struct of_device_id ls_poweroff_of_match[] = { ++ { .compatible = "buffalo,ls220d", ++ .data = &linkstation_power_off_cfg, ++ }, ++ { .compatible = "buffalo,ls220de", ++ .data = &linkstation_power_off_cfg, ++ }, + { .compatible = "buffalo,ls421d", + .data = &linkstation_power_off_cfg, + }, From 909cc6ef5f38fdb65dbbbf67318fbfbe566848c7 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Mon, 23 Jan 2023 14:44:49 +0100 Subject: [PATCH 22/34] x86: remove bootloader upgrade from preinit This hack was to bring all existing installations to the newest GRUB version as fast as possible. Since 19.07.x is EoL we can assume this task is completed. Now sysupgrade will solely be responsible for bootloader upgrade. Signed-off-by: Tomasz Maciej Nowak --- .../lib/preinit/81_upgrade_bootloader | 18 ------------------ .../x86/base-files/lib/upgrade/platform.sh | 3 +-- 2 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader diff --git a/target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader b/target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader deleted file mode 100644 index 42f04d76a7e..00000000000 --- a/target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader +++ /dev/null @@ -1,18 +0,0 @@ -upgrade_bootloader() { - local diskdev - - . /lib/upgrade/common.sh - - if [ ! -f /boot/grub/upgraded ] && export_bootdevice && export_partdevice diskdev 0; then - part_magic_efi "/dev/$diskdev" && return 0 - echo "(hd0) /dev/$diskdev" > /tmp/device.map - /usr/sbin/grub-bios-setup \ - -m "/tmp/device.map" \ - -d "/boot/grub" \ - -r "hd0,msdos1" \ - "/dev/$diskdev" \ - && touch /boot/grub/upgraded - fi -} - -[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main upgrade_bootloader diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh index d8f2eba97ec..5dad7a538a5 100644 --- a/target/linux/x86/base-files/lib/upgrade/platform.sh +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -62,8 +62,7 @@ platform_do_bootloader_upgrade() { -m "/tmp/device.map" \ -d "/tmp/boot/boot/grub" \ -r "hd0,${parttable}1" \ - "/dev/$diskdev" \ - && touch /tmp/boot/boot/grub/upgraded + "/dev/$diskdev" umount /tmp/boot fi From bdd78897c33b25a4954f6e41e26f57bab5284129 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Mon, 23 Jan 2023 14:44:50 +0100 Subject: [PATCH 23/34] grub2: re-add test module It seems more hardware needs early load of firmware when initialised to work properly (at least Intel hardware). One of previous case is CPU microcode, which this series[1] tried to change. The second one is Intel graphics IC, which needs firmware for controlling DMC circuit (switch conncted display to DC6 power state). As it stands, the i915 module is built-in and it seems the hardware can't cope with firmware loaded later from rootfs, it needs to be supplied when the module is loaded. Unfortunately we need bootloader to handle the load of firmware in this case, but as previously mentioned series[1], there was an error when initrd was hardcoded, instead of testing existence for it and then loading. To remedy this in later the 55b808e0c4be ('x86: image: add test module to bootloader') was commited. Which was later accidentally dropped when grub2 image creation was moved to packages. Therefore bring back test module, so we can test for cases of existing firmware in grub.cfg. 1. https://patchwork.ozlabs.org/project/openwrt/cover/20181120162044.16371-1-tomek_n@o2.pl Fixes: 5a5df62d95f5 ("x86/grub2: move grub2 image creation to package") Signed-off-by: Tomasz Maciej Nowak --- package/boot/grub2/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/boot/grub2/Makefile b/package/boot/grub2/Makefile index c4cc43de2e6..7d6cfd53959 100644 --- a/package/boot/grub2/Makefile +++ b/package/boot/grub2/Makefile @@ -122,14 +122,14 @@ define Package/grub2/install -O i386-pc \ -c $(PKG_BUILD_DIR)/grub-early.cfg \ -o $(STAGING_DIR_IMAGE)/grub2/gpt-core.img \ - at_keyboard biosdisk boot chain configfile fat linux ls part_gpt reboot search serial vga + at_keyboard biosdisk boot chain configfile fat linux ls part_gpt reboot search serial test vga $(STAGING_DIR_HOST)/bin/grub-mkimage \ -d $(PKG_BUILD_DIR)/grub-core \ -p /boot/grub \ -O i386-pc \ -c ./files/grub-early.cfg \ -o $(STAGING_DIR_IMAGE)/grub2/generic-core.img \ - at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial vga + at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial test vga $(STAGING_DIR_HOST)/bin/grub-mkimage \ -d $(PKG_BUILD_DIR)/grub-core \ -p /boot/grub \ @@ -154,7 +154,7 @@ define Package/grub2-efi/install -O $(CONFIG_ARCH)-efi \ -c $(PKG_BUILD_DIR)/grub-early.cfg \ -o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_x86_64),x64,ia32).efi \ - at_keyboard boot chain configfile fat linux ls part_gpt reboot serial efi_gop efi_uga + at_keyboard boot chain configfile fat linux ls part_gpt reboot serial test efi_gop efi_uga $(STAGING_DIR_HOST)/bin/grub-mkimage \ -d $(PKG_BUILD_DIR)/grub-core \ -p /boot/grub \ From 1e138ca70381c71915b7fb918d4294dcb7ba0cb2 Mon Sep 17 00:00:00 2001 From: Jan-Niklas Burfeind Date: Fri, 30 Dec 2022 03:41:17 +0100 Subject: [PATCH 24/34] sunxi: enable CONFIG_NVMEM_SYSFS in both the stable and the testing kernel h2+/h3/h5 devices have a Secure ID that can be read from `/sys/bus/nvmem/devices/sunxi-sid0/nvmem`. Enabling CONFIG_NVMEM_SYSFS grants sysfs access from userspace. Signed-off-by: Jan-Niklas Burfeind --- target/linux/sunxi/config-5.15 | 1 + target/linux/sunxi/cortexa53/config-5.15 | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/sunxi/config-5.15 b/target/linux/sunxi/config-5.15 index c7dbc5a9f1e..17c4d910c8e 100644 --- a/target/linux/sunxi/config-5.15 +++ b/target/linux/sunxi/config-5.15 @@ -307,6 +307,7 @@ CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=8 CONFIG_NVMEM=y CONFIG_NVMEM_SUNXI_SID=y +CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y diff --git a/target/linux/sunxi/cortexa53/config-5.15 b/target/linux/sunxi/cortexa53/config-5.15 index b93abf0765b..85ace5d9288 100644 --- a/target/linux/sunxi/cortexa53/config-5.15 +++ b/target/linux/sunxi/cortexa53/config-5.15 @@ -52,7 +52,6 @@ CONFIG_MUSB_PIO_ONLY=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NOP_USB_XCEIV=y CONFIG_NO_IOPORT_MAP=y -CONFIG_NVMEM_SYSFS=y CONFIG_PARTITION_PERCPU=y CONFIG_PHY_SUN50I_USB3=y CONFIG_PINCTRL_SUN50I_A100=y From 4d903a50099b5c35063b92b39d196e34e1a14ec6 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Fri, 16 Dec 2022 21:52:27 +0100 Subject: [PATCH 25/34] bcm53xx: Add support for D-Link DWL-8610AP The D-Link DWL-8610AP is a pretty straight-forward BC53016 device, D-Link has invented a firmware package format which is a tar file, and we implement this for the factory image. Signed-off-by: Linus Walleij --- target/linux/bcm53xx/image/Makefile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile index ed2e9c68212..1cb08effce2 100644 --- a/target/linux/bcm53xx/image/Makefile +++ b/target/linux/bcm53xx/image/Makefile @@ -105,6 +105,22 @@ define Build/seama-nand -i $@.entity endef +define Build/dwl8610ap-image + mkdir -p $@.tmptar + # The DWL8610AP pretends to be a Broadcom reference design + echo "bcm953012er" > $@.tmptar/board + echo "LVL7" > $@.tmptar/model + # Something high beyond what D-Link has put out + echo "5.0.0.0" > $@.tmptar/version + # Create rootfs.bin, this is just a NAND image including everything + cp $@ $@.tmptar/rootfs.bin + # Hash the rootfs.bin + cat $@.tmptar/rootfs.bin | md5sum > $@.tmptar/rootfs.md5 + cd $@.tmptar && tar -c -f $@.new * + rm -rf $@.tmptar + mv $@.new $@ +endef + DEVICE_VARS += ASUS_PRODUCTID DEVICE_VARS += BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR DEVICE_VARS += SIGNATURE @@ -250,6 +266,15 @@ define Device/dlink_dir-885l endef TARGET_DEVICES += dlink_dir-885l +define Device/dlink_dwl-8610ap + DEVICE_VENDOR := D-Link + DEVICE_MODEL := DWL-8610AP + DEVICE_PACKAGES := $(B43) + IMAGES := factory.tar + IMAGE/factory.tar := append-ubi | trx-nand | dwl8610ap-image +endef +TARGET_DEVICES += dlink_dwl-8610ap + define Device/linksys_ea6300-v1 DEVICE_VENDOR := Linksys DEVICE_MODEL := EA6300 From d51c44a3ba34940ffd4ff0592875bffa23b7cec7 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Fri, 16 Dec 2022 21:52:44 +0100 Subject: [PATCH 26/34] bcm53xx: Add D-Link DWL-8610AP board settings The D-Link DWL-8610AP does not make use of the B53 switch like most equipment. It lies dormant and the machine is using eth0 and eth1 directly. Signed-off-by: Linus Walleij --- target/linux/bcm53xx/base-files/etc/board.d/02_network | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/bcm53xx/base-files/etc/board.d/02_network b/target/linux/bcm53xx/base-files/etc/board.d/02_network index c2e5afc5ed8..6bec600540e 100644 --- a/target/linux/bcm53xx/base-files/etc/board.d/02_network +++ b/target/linux/bcm53xx/base-files/etc/board.d/02_network @@ -16,6 +16,9 @@ bcm53xx_setup_interfaces() asus,rt-ac88u) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 extsw" "wan" ;; + dlink,dwl-8610ap) + ucidef_set_interface_lan "eth0 eth1" "dhcp" + ;; linksys,panamera) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8 extsw" "wan" ;; From 9df035b3ea674279bdf1d1c6bfeffe7eb52bb69f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= Date: Wed, 30 Nov 2022 21:00:13 +0300 Subject: [PATCH 27/34] treewide: remove label = "cpu" from DSA dt-binding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is not used by the DSA dt-binding, so remove it from all devicetrees. Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9cc115d8d6f73dd260de1609182f3645844d6907 Signed-off-by: Arınç ÜNAL --- target/linux/ath79/dts/ar7242_ubnt_edgeswitch-8xp.dts | 1 - target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts | 1 - target/linux/bmips/dts/bcm6318.dtsi | 1 - target/linux/bmips/dts/bcm63268.dtsi | 1 - target/linux/bmips/dts/bcm6328.dtsi | 1 - target/linux/bmips/dts/bcm6362.dtsi | 1 - target/linux/bmips/dts/bcm6368.dtsi | 1 - .../kirkwood/files/arch/arm/boot/dts/kirkwood-4i-edge-200.dts | 1 - .../linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ea3500.dts | 1 - target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi | 1 - target/linux/mediatek/dts/mt7622-elecom-wrc-x3200gst3.dts | 1 - target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi | 1 - target/linux/mediatek/dts/mt7622-netgear-wax206.dts | 1 - target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi | 1 - target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts | 1 - target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dtsi | 1 - target/linux/mediatek/dts/mt7629-iptime-a6004mx.dts | 1 - target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3.dts | 1 - .../linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi | 1 - .../files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi | 1 - .../files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts | 1 - .../arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts | 1 - .../files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts | 1 - .../files/arch/arm64/boot/dts/marvell/armada-7040-mochabin.dts | 1 - .../files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts | 2 -- target/linux/ramips/dts/mt7621.dtsi | 1 - 26 files changed, 27 deletions(-) diff --git a/target/linux/ath79/dts/ar7242_ubnt_edgeswitch-8xp.dts b/target/linux/ath79/dts/ar7242_ubnt_edgeswitch-8xp.dts index 915b4414dd0..2ee7ab56c5a 100644 --- a/target/linux/ath79/dts/ar7242_ubnt_edgeswitch-8xp.dts +++ b/target/linux/ath79/dts/ar7242_ubnt_edgeswitch-8xp.dts @@ -160,7 +160,6 @@ phy0: port8@8 { reg = <8>; - label = "cpu"; ethernet = <ð0>; fixed-link { diff --git a/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts b/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts index 58586eb0361..106ca56e7ed 100644 --- a/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts +++ b/target/linux/ath79/dts/ar9132_tplink_tl-wr941-v2.dts @@ -99,7 +99,6 @@ port@5 { reg = <5>; - label = "cpu"; ethernet = <ð0>; }; }; diff --git a/target/linux/bmips/dts/bcm6318.dtsi b/target/linux/bmips/dts/bcm6318.dtsi index 9f613ad47ac..13e1bf11441 100644 --- a/target/linux/bmips/dts/bcm6318.dtsi +++ b/target/linux/bmips/dts/bcm6318.dtsi @@ -400,7 +400,6 @@ port@8 { reg = <8>; - label = "cpu"; phy-mode = "internal"; ethernet = <ðernet>; diff --git a/target/linux/bmips/dts/bcm63268.dtsi b/target/linux/bmips/dts/bcm63268.dtsi index 2ab14e5a335..2bc86d26f97 100644 --- a/target/linux/bmips/dts/bcm63268.dtsi +++ b/target/linux/bmips/dts/bcm63268.dtsi @@ -521,7 +521,6 @@ port@8 { reg = <8>; - label = "cpu"; phy-mode = "internal"; ethernet = <ðernet>; diff --git a/target/linux/bmips/dts/bcm6328.dtsi b/target/linux/bmips/dts/bcm6328.dtsi index c8e9138ccbd..dfd603b7c6e 100644 --- a/target/linux/bmips/dts/bcm6328.dtsi +++ b/target/linux/bmips/dts/bcm6328.dtsi @@ -418,7 +418,6 @@ port@8 { reg = <8>; - label = "cpu"; phy-mode = "internal"; ethernet = <ðernet>; diff --git a/target/linux/bmips/dts/bcm6362.dtsi b/target/linux/bmips/dts/bcm6362.dtsi index 77473c22bb1..d66a602df7a 100644 --- a/target/linux/bmips/dts/bcm6362.dtsi +++ b/target/linux/bmips/dts/bcm6362.dtsi @@ -515,7 +515,6 @@ port@8 { reg = <8>; - label = "cpu"; phy-mode = "internal"; ethernet = <ðernet>; diff --git a/target/linux/bmips/dts/bcm6368.dtsi b/target/linux/bmips/dts/bcm6368.dtsi index b50a572fd00..5ba90921936 100644 --- a/target/linux/bmips/dts/bcm6368.dtsi +++ b/target/linux/bmips/dts/bcm6368.dtsi @@ -529,7 +529,6 @@ port@8 { reg = <8>; - label = "cpu"; phy-mode = "internal"; ethernet = <ðernet>; diff --git a/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-4i-edge-200.dts b/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-4i-edge-200.dts index 143dac97fef..8e6c198c5e4 100644 --- a/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-4i-edge-200.dts +++ b/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-4i-edge-200.dts @@ -112,7 +112,6 @@ port@5 { reg = <5>; - label = "cpu"; phy-mode = "rgmii-id"; ethernet = <ð0port>; diff --git a/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ea3500.dts b/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ea3500.dts index f8f940dfc61..d0f2e35343a 100644 --- a/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ea3500.dts +++ b/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ea3500.dts @@ -125,7 +125,6 @@ port@5 { reg = <5>; - label = "cpu"; ethernet = <ð0port>; fixed-link { speed = <1000>; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi index 7fa2fac1ef5..e4c9be8f87d 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi @@ -447,7 +447,6 @@ port@6 { reg = <0x6>; - label = "cpu"; phy-mode = "internal"; ethernet = <ð0>; diff --git a/target/linux/mediatek/dts/mt7622-elecom-wrc-x3200gst3.dts b/target/linux/mediatek/dts/mt7622-elecom-wrc-x3200gst3.dts index fdbcbc18bce..c7e11c80b05 100644 --- a/target/linux/mediatek/dts/mt7622-elecom-wrc-x3200gst3.dts +++ b/target/linux/mediatek/dts/mt7622-elecom-wrc-x3200gst3.dts @@ -258,7 +258,6 @@ port@6 { reg = <6>; - label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; diff --git a/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi b/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi index 1fe839575ed..abac02a72d0 100644 --- a/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi +++ b/target/linux/mediatek/dts/mt7622-linksys-e8450.dtsi @@ -181,7 +181,6 @@ port@6 { reg = <6>; - label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; diff --git a/target/linux/mediatek/dts/mt7622-netgear-wax206.dts b/target/linux/mediatek/dts/mt7622-netgear-wax206.dts index 181abb915c4..3846fabbeda 100644 --- a/target/linux/mediatek/dts/mt7622-netgear-wax206.dts +++ b/target/linux/mediatek/dts/mt7622-netgear-wax206.dts @@ -191,7 +191,6 @@ port@6 { ethernet = <&gmac0>; - label = "cpu"; phy-mode = "2500base-x"; reg = <6>; diff --git a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi index 5a1cd99f619..a240f9bfcec 100644 --- a/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi +++ b/target/linux/mediatek/dts/mt7622-ruijie-rg-ew3200.dtsi @@ -137,7 +137,6 @@ port@6 { reg = <6>; - label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; diff --git a/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts b/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts index 9661d0c7fbc..ecc25fd328c 100644 --- a/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts +++ b/target/linux/mediatek/dts/mt7622-xiaomi-redmi-router-ax6s.dts @@ -196,7 +196,6 @@ port@6 { reg = <6>; - label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; diff --git a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dtsi b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dtsi index 50c7f3e88e1..a4e443a0fb6 100644 --- a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dtsi +++ b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dtsi @@ -178,7 +178,6 @@ cpu_port0: port@6 { reg = <6>; - label = "cpu"; ethernet = <&gmac0>; phy-mode = "trgmii"; diff --git a/target/linux/mediatek/dts/mt7629-iptime-a6004mx.dts b/target/linux/mediatek/dts/mt7629-iptime-a6004mx.dts index b40ac528482..dc1868a0669 100644 --- a/target/linux/mediatek/dts/mt7629-iptime-a6004mx.dts +++ b/target/linux/mediatek/dts/mt7629-iptime-a6004mx.dts @@ -161,7 +161,6 @@ port@6 { reg = <6>; - label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; diff --git a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3.dts b/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3.dts index 8e47cb85790..4d118b0fbc1 100644 --- a/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3.dts +++ b/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3.dts @@ -223,7 +223,6 @@ port@6 { reg = <6>; - label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; diff --git a/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi index cd74fbec742..101b81f8a9a 100644 --- a/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi +++ b/target/linux/mediatek/dts/mt7986a-xiaomi-redmi-router-ax6000.dtsi @@ -234,7 +234,6 @@ port@6 { reg = <6>; - label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi index 3fbe288dae7..b63692c1612 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtsi @@ -350,7 +350,6 @@ port@6 { reg = <6>; - label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; diff --git a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts index 52b6c152feb..85465223cf4 100644 --- a/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts +++ b/target/linux/mediatek/files-5.15/arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts @@ -139,7 +139,6 @@ port@6 { reg = <6>; - label = "cpu"; ethernet = <&gmac0>; phy-mode = "2500base-x"; diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts index 669b67e5a96..1a6594e3cda 100644 --- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-espressobin-ultra.dts @@ -184,7 +184,6 @@ switch0port0: port@0 { reg = <0>; - label = "cpu"; ethernet = <ð0>; }; diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts index 72d7267ccd0..8d163059a00 100644 --- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts @@ -175,7 +175,6 @@ port@0 { reg = <0>; - label = "cpu"; ethernet = <ð0>; }; diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-mochabin.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-mochabin.dts index c4e11b50493..26804a48755 100644 --- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-mochabin.dts +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-mochabin.dts @@ -339,7 +339,6 @@ port@5 { reg = <5>; - label = "cpu"; ethernet = <&cp0_eth1>; phy-mode = "2500base-x"; managed = "in-band-status"; diff --git a/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts index 15dc5f445e3..c611263099d 100644 --- a/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts +++ b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts @@ -269,7 +269,6 @@ status = "disabled"; reg = "<5>"; - label = "cpu"; ethernet = <&enet2>; phy-mode = "rgmii-id"; @@ -281,7 +280,6 @@ port@6 { reg = <6>; - label = "cpu"; ethernet = <&enet3>; phy-mode = "rgmii-id"; diff --git a/target/linux/ramips/dts/mt7621.dtsi b/target/linux/ramips/dts/mt7621.dtsi index 0eae4bb8717..0f513f313cf 100644 --- a/target/linux/ramips/dts/mt7621.dtsi +++ b/target/linux/ramips/dts/mt7621.dtsi @@ -558,7 +558,6 @@ port@6 { reg = <6>; - label = "cpu"; ethernet = <&gmac0>; phy-mode = "rgmii"; From 522a60cd31686a3d1b6d7ed1229eb68568aa89ac Mon Sep 17 00:00:00 2001 From: Prasun Maiti Date: Wed, 16 Nov 2022 16:33:33 +0530 Subject: [PATCH 28/34] build: fix for sourcing targets image config installed via feeds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sourcing of image/Config.in will not happen When a target is installed from target/linux/feeds/ Signed-off-by: Prasun Maiti Acked-by: Petr Å tetiar --- config/Config-images.in | 1 + 1 file changed, 1 insertion(+) diff --git a/config/Config-images.in b/config/Config-images.in index 0768c5a4831..8c4616f37ca 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -284,6 +284,7 @@ menu "Target Images" comment "Image Options" source "target/linux/*/image/Config.in" + source "target/linux/*/*/image/Config.in" config TARGET_KERNEL_PARTSIZE int "Kernel partition size (in MiB)" From 173d8642532125f7ba24ef6b6de34e6ca1a0935c Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Wed, 24 Aug 2022 18:05:57 +0200 Subject: [PATCH 29/34] ath79: mikrotik: stack ar9344 devices to single dtsi Most of boards from MikroTik with AR9344 SoC (supported and un-supported) replicate the same schematic, so stack common device nodes to a single dtsi. ar9344_mikrotik_routerboard-16m-nor.dtsi: - remove include paragraph and wmac node, make it single nor flash node for others dts to include ar9344_mikrotik_routerboard-lhg-5nd.dts: - move all of the nodes to new file ar9344_mikrotik_routerboard.dtsi and leave only power, user and lan LEDs which differ from sxt-5nd-r2 and other yet unsupported devices ar9344_mikrotik_routerboard-sxt-5n.dtsi: - remove, it made no sense to keep it, as only ar9344_mikrotik_routerboard-sxt-5nd-r2.dts included this file and added only compatible and model ar9344_mikrotik_routerboard-sxt-5nd-r2.dts: - include ar9344_mikrotik_routerboard.dtsi - add nand gpio activating node, beeper, additional LEDs and flash chips which previously have been in ar9344_mikrotik_routerboard-sxt-5n.dtsi ar9344_mikrotik_routerboard.dtsi: - inherited most of the content from ar9344_mikrotik_routerboard-lhg-5nd.dts except three LEDs - add wmac node, removed from ar9344_mikrotik_routerboard-16m-nor.dtsi Signed-off-by: Tomasz Maciej Nowak --- .../ar9344_mikrotik_routerboard-16m-nor.dtsi | 8 - .../ar9344_mikrotik_routerboard-lhg-5nd.dts | 92 ++------- .../ar9344_mikrotik_routerboard-sxt-5n.dtsi | 185 ------------------ ...ar9344_mikrotik_routerboard-sxt-5nd-r2.dts | 108 +++++++++- .../dts/ar9344_mikrotik_routerboard.dtsi | 78 ++++++++ 5 files changed, 199 insertions(+), 272 deletions(-) delete mode 100644 target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi create mode 100644 target/linux/ath79/dts/ar9344_mikrotik_routerboard.dtsi diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi index 7cc4bb689cd..b915dd5a723 100644 --- a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "ar9344.dtsi" - &spi { status = "okay"; @@ -55,9 +53,3 @@ }; }; }; - -&wmac { - status = "okay"; - - qca,no-eeprom; -}; diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-lhg-5nd.dts b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-lhg-5nd.dts index 194a789fb21..b6de8c4b7b1 100644 --- a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-lhg-5nd.dts +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-lhg-5nd.dts @@ -1,91 +1,27 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT +#include "ar9344_mikrotik_routerboard.dtsi" #include "ar9344_mikrotik_routerboard-16m-nor.dtsi" -#include -#include - / { compatible = "mikrotik,routerboard-lhg-5nd", "qca,ar9344"; model = "MikroTik RouterBOARD LHG 5nD"; - - aliases { - led-boot = &led_user; - led-failsafe = &led_user; - led-running = &led_user; - led-upgrade = &led_user; - }; - - leds { - compatible = "gpio-leds"; - - power { - label = "blue:power"; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - default-state = "on"; - }; - - rssilow { - label = "green:rssilow"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - }; - - rssimediumlow { - label = "green:rssimediumlow"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; - - rssimedium { - label = "green:rssimedium"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - - rssimediumhigh { - label = "green:rssimediumhigh"; - gpios = <&gpio 21 GPIO_ACTIVE_LOW>; - }; - - rssihigh { - label = "green:rssihigh"; - gpios = <&gpio 18 GPIO_ACTIVE_LOW>; - }; - - led_user: user { - label = "white:user"; - gpios = <&gpio 20 GPIO_ACTIVE_LOW>; - }; - - lan { - label = "green:lan"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - linux,code = ; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; }; -ð0 { - status = "okay"; +&leds { + power { + label = "blue:power"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; - phy-handle = <&swphy0>; + led_user: user { + label = "white:user"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; - gmac-config { - device = <&gmac>; - switch-phy-swap = <1>; + lan { + label = "green:lan"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; }; }; - -ð1 { - status = "okay"; - - compatible = "syscon", "simple-mfd"; -}; diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi deleted file mode 100644 index 6cf84c98b3a..00000000000 --- a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi +++ /dev/null @@ -1,185 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "ar9344.dtsi" - -#include -#include - -/ { - compatible = "mikrotik,routerboard-sxt-5n", "qca,ar9344"; - model = "MikroTik SXT 5N platform"; - - aliases { - led-boot = &led_user; - led-failsafe = &led_user; - led-running = &led_user; - led-upgrade = &led_user; - }; - - leds { - compatible = "gpio-leds"; - - power { - label = "green:power"; - gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; - default-state = "on"; - }; - - rssilow { - label = "green:rssilow"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - }; - - rssimediumlow { - label = "green:rssimediumlow"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; - - rssimedium { - label = "green:rssimedium"; - gpios = <&gpio 4 GPIO_ACTIVE_LOW>; - }; - - rssimediumhigh { - label = "green:rssimediumhigh"; - gpios = <&gpio 21 GPIO_ACTIVE_LOW>; - }; - - rssihigh { - label = "green:rssihigh"; - gpios = <&gpio 18 GPIO_ACTIVE_LOW>; - }; - - led_user: user { - label = "green:user"; - gpios = <&gpio 3 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - linux,code = ; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - gpio-export { - compatible = "gpio-export"; - - gpio_nand_power { - gpio-export,name = "sxt5n:power:nand"; - gpio-export,output = <0>; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - }; - }; - - beeper { - compatible = "gpio-beeper"; - gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; - }; -}; - -&spi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <40000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "RouterBoot"; - reg = <0x0 0x20000>; - compatible = "mikrotik,routerboot-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "bootloader1"; - reg = <0x0 0x0>; - read-only; - }; - - hard_config { - read-only; - }; - - bios { - size = <0x1000>; - read-only; - }; - - soft_config { - }; - - partition@10000 { - label = "bootloader2"; - reg = <0x10000 0x10000>; - read-only; - }; - }; - }; - }; -}; - -&nand { - status = "okay"; - - nand-ecc-mode = "soft"; - qca,nand-swap-dma; - qca,nand-scan-fixup; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "booter"; - reg = <0x0000000 0x0040000>; - read-only; - }; - - partition@40000 { - label = "kernel"; - reg = <0x0040000 0x03c0000>; - }; - - partition@400000 { - label = "ubi"; - reg = <0x0400000 0x7c00000>; - }; - }; -}; - -ð0 { - status = "okay"; - - phy-handle = <&swphy0>; - - gmac-config { - device = <&gmac>; - switch-phy-swap = <1>; - }; -}; - -ð1 { - status = "okay"; - - compatible = "syscon", "simple-mfd"; -}; - -&wmac { - status = "okay"; - - qca,no-eeprom; -}; diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5nd-r2.dts b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5nd-r2.dts index 3d0b941c24c..c8b1183d70c 100644 --- a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5nd-r2.dts +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5nd-r2.dts @@ -1,8 +1,114 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "ar9344_mikrotik_routerboard-sxt-5n.dtsi" +#include "ar9344_mikrotik_routerboard.dtsi" / { compatible = "mikrotik,routerboard-sxt-5nd-r2", "qca,ar9344"; model = "MikroTik RouterBOARD SXT 5nD r2 (SXT Lite5)"; + + gpio-export { + compatible = "gpio-export"; + + gpio_nand_power { + gpio-export,name = "sxt5n:power:nand"; + gpio-export,output = <0>; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + }; + + beeper { + compatible = "gpio-beeper"; + gpios = <&gpio 19 GPIO_ACTIVE_HIGH>; + }; +}; + +&leds { + power { + label = "green:power"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led_user: user { + label = "green:user"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "RouterBoot"; + reg = <0x0 0x20000>; + compatible = "mikrotik,routerboot-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader1"; + reg = <0x0 0x0>; + read-only; + }; + + hard_config { + read-only; + }; + + bios { + size = <0x1000>; + read-only; + }; + + soft_config { + }; + + partition@10000 { + label = "bootloader2"; + reg = <0x10000 0x10000>; + read-only; + }; + }; + }; + }; +}; + +&nand { + status = "okay"; + + nand-ecc-mode = "soft"; + qca,nand-swap-dma; + qca,nand-scan-fixup; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "booter"; + reg = <0x0000000 0x0040000>; + read-only; + }; + + partition@40000 { + label = "kernel"; + reg = <0x0040000 0x03c0000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x0400000 0x7c00000>; + }; + }; }; diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard.dtsi b/target/linux/ath79/dts/ar9344_mikrotik_routerboard.dtsi new file mode 100644 index 00000000000..10233e3d4ee --- /dev/null +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard.dtsi @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_user; + led-failsafe = &led_user; + led-running = &led_user; + led-upgrade = &led_user; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds: leds { + compatible = "gpio-leds"; + + rssilow { + label = "green:rssilow"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + rssimediumlow { + label = "green:rssimediumlow"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; + + rssimedium { + label = "green:rssimedium"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + rssimediumhigh { + label = "green:rssimediumhigh"; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + }; + + rssihigh { + label = "green:rssihigh"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy0>; + + gmac-config { + device = <&gmac>; + switch-phy-swap = <1>; + }; +}; + +ð1 { + status = "okay"; + + compatible = "syscon", "simple-mfd"; +}; + +&wmac { + status = "okay"; + + qca,no-eeprom; +}; From 43c7132bf8e7dc0756b527f985a1ac6056007f62 Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Wed, 24 Aug 2022 18:05:58 +0200 Subject: [PATCH 30/34] ath79: add support for MikroTik RouterBOARD 911 Lite2/Lite5 Forward-port from ar71xx target the board introduced in commit eb9e3651dd1a (" ar71xx: add support for the MikroTik RB911-2Hn/5Hn boards"). Citing: The patch adds support for the MikroTik RB911-2Hn (911 Lite2) and the RB911-5Hn (911 Lite5) boards: https://mikrotik.com/product/RB911-2Hn https://mikrotik.com/product/RB911-5Hn The two boards are using the same hardware design, the only difference between the two is the supported wireless band. Specifications: * SoC: Atheros AR9344 (600MHz) * RAM: 64MiB * Storage: 16 MiB SPI NOR flash * Ethernet: 1x100M (Passive PoE in) * Wireless: AR9344 built-in wireless MAC, single chain 802.11b/g/n (911-2Hn) or 802.11a/g/n (911-5Hn) Notes: * Older versions of these boards might be equipped with a NAND flash chip instead of the SPI NOR device. Those boards are not supported (yet).[1] * The MikroTik RB911-5HnD (911 Lite5 Dual) board also uses the same hardware. Support for that can be added later with little effort probably.[2] End of citation. Follow intallation instruction from that commit message, using openwrt-ath79-mikrotik-mikrotik_routerboard-911-lite-initramfs-kernel.bin and openwrt-ath79-mikrotik-mikrotik_routerboard-911-lite-squashfs-sysupgrade.bin images found in ath79/mikrotik directory. Be advised that the board accepts 10-30 V on PoE input. Known issues Compared to ar71xx target image, there is still small leak of current to user LED, which makes it lit, although weaker, even if brightness is set to 0. The cause of that is still unknown. 1. https://github.com/openwrt/openwrt/pull/3652 2. RB911-5HnD should work with this commit or with [1], depending on what flash topology was used. Signed-off-by: Tomasz Maciej Nowak --- .../ar9344_mikrotik_routerboard-911-lite.dts | 36 +++++++++++++++++++ target/linux/ath79/image/mikrotik.mk | 10 ++++++ .../mikrotik/base-files/etc/board.d/01_leds | 19 +++++----- .../base-files/etc/board.d/02_network | 2 ++ .../etc/hotplug.d/firmware/10-ath9k-eeprom | 1 + 5 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 target/linux/ath79/dts/ar9344_mikrotik_routerboard-911-lite.dts diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-911-lite.dts b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-911-lite.dts new file mode 100644 index 00000000000..d77078c5a22 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-911-lite.dts @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_mikrotik_routerboard.dtsi" +#include "ar9344_mikrotik_routerboard-16m-nor.dtsi" + +/ { + model = "MikroTik RouterBOARD 911-2Hn/5Hn (Lite2/Lite5)"; + compatible = "mikrotik,routerboard-911-lite", "qca,ar9344"; +}; + +&leds { + pinctrl-names = "default"; + pinctrl-0 = <&enable_gpio_20>; + + lan { + label = "green:lan"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + + power { + label = "green:power"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led_user: user { + label = "green:user"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; +}; + +&pinmux { + enable_gpio_20: pinmux_gpio_out_function5 { + pinctrl-single,bits = <0x14 0x0 0xff>; + }; +}; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index c90579fbb58..fb0035fb653 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -9,6 +9,16 @@ define Device/mikrotik_routerboard-493g endef TARGET_DEVICES += mikrotik_routerboard-493g +define Device/mikrotik_routerboard-911-lite + $(Device/mikrotik_nor) + SOC := ar9344 + DEVICE_MODEL := RouterBOARD 911 Lite2/Lite5 (2Hn/5Hn) + DEVICE_PACKAGES += rssileds + IMAGE_SIZE := 16256k + SUPPORTED_DEVICES += rb-911-2hn rb-911-5hn +endef +TARGET_DEVICES += mikrotik_routerboard-911-lite + define Device/mikrotik_routerboard-912uag-2hpnd $(Device/mikrotik_nand) SOC := ar9342 diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds index 76b91a54a5f..4c1b98fff22 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds @@ -6,6 +6,16 @@ board_config_update board=$(board_name) case "$board" in +mikrotik,routerboard-911-lite|\ +mikrotik,routerboard-lhg-5nd) + ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "rssilow" "rssilow" "green:rssilow" "wlan0" "1" "100" + ucidef_set_led_rssi "rssimediumlow" "rssimediumlow" "green:rssimediumlow" "wlan0" "20" "100" + ucidef_set_led_rssi "rssimedium" "rssimedium" "green:rssimedium" "wlan0" "40" "100" + ucidef_set_led_rssi "rssimediumhigh" "rssimediumhigh" "green:rssimediumhigh" "wlan0" "60" "100" + ucidef_set_led_rssi "rssihigh" "rssihigh" "green:rssihigh" "wlan0" "80" "100" + ;; mikrotik,routerboard-951ui-2nd|\ mikrotik,routerboard-952ui-5ac2nd) ucidef_set_led_netdev "port1" "port1" "green:port1" "eth1" @@ -19,15 +29,6 @@ mikrotik,routerboard-mapl-2nd|\ mikrotik,routerboard-wap-2nd) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" ;; -mikrotik,routerboard-lhg-5nd) - ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0" - ucidef_set_rssimon "wlan0" "200000" "1" - ucidef_set_led_rssi "rssilow" "rssilow" "green:rssilow" "wlan0" "1" "100" - ucidef_set_led_rssi "rssimediumlow" "rssimediumlow" "green:rssimediumlow" "wlan0" "20" "100" - ucidef_set_led_rssi "rssimedium" "rssimedium" "green:rssimedium" "wlan0" "40" "100" - ucidef_set_led_rssi "rssimediumhigh" "rssimediumhigh" "green:rssimediumhigh" "wlan0" "60" "100" - ucidef_set_led_rssi "rssihigh" "rssihigh" "green:rssihigh" "wlan0" "80" "100" - ;; mikrotik,routerboard-map-2nd) ucidef_set_led_netdev "eth_1" "eth_1" "green:eth_1" "eth1" ucidef_set_led_switch "eth_2" "eth_2" "green:eth_2" "switch0" "0x4" diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index 5646d8cf68a..da63347c3c0 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -14,6 +14,7 @@ ath79_setup_interfaces() ucidef_add_switch "switch1" \ "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" ;; + mikrotik,routerboard-911-lite|\ mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-lhg-5nd|\ @@ -52,6 +53,7 @@ ath79_setup_macs() local mac_base="$(cat /sys/firmware/mikrotik/hard_config/mac_base)" case "$board" in + mikrotik,routerboard-911-lite|\ mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-lhg-5nd|\ diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index aa5354bfdb3..e0bf1e47efb 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -23,6 +23,7 @@ board=$(board_name) case "$FIRMWARE" in "ath9k-eeprom-ahb-18100000.wmac.bin") case $board in + mikrotik,routerboard-911-lite|\ mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-lhg-5nd|\ From fb2480df36fa4f8faed9732ed06ac2093a060c28 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Fri, 17 Feb 2023 17:06:41 -0800 Subject: [PATCH 31/34] octeontx: add default packages for on-board devices The Gateworks Newport boards supported by the octeontx target have the following on-board devices: - Gateworks System Controller - GPIO buttons - GPIO leds - GPS PPS - Accelerometer - MCP251X CAN controller Add kernel drivers for these devices in DEFAULT_PACKAGES Signed-off-by: Tim Harvey --- target/linux/octeontx/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/octeontx/Makefile b/target/linux/octeontx/Makefile index 5260291d050..25096c90ba9 100644 --- a/target/linux/octeontx/Makefile +++ b/target/linux/octeontx/Makefile @@ -20,4 +20,8 @@ include $(INCLUDE_DIR)/target.mk KERNELNAME:=Image +DEFAULT_PACKAGES += kmod-hwmon-gsc kmod-leds-gpio kmod-pps-gpio \ + kmod-gpio-button-hotplug kmod-input-evdev kmod-rtc-ds1672 \ + kmod-can kmod-can-mcp251x + $(eval $(call BuildTarget)) From 026004d5301a273005390f0a0cd26539fbee09f1 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Tue, 21 Feb 2023 15:08:29 -0800 Subject: [PATCH 32/34] octeontx: add f2fs and ext4 support Add both ext4 and f2fs support for overlayfs. The fstools mount_root application will choose f2fs if the overlay volume space available exceeds 100MB, otherwise ext4 is used. Signed-off-by: Tim Harvey --- target/linux/octeontx/Makefile | 3 ++- target/linux/octeontx/config-5.15 | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/target/linux/octeontx/Makefile b/target/linux/octeontx/Makefile index 25096c90ba9..57250a5e01c 100644 --- a/target/linux/octeontx/Makefile +++ b/target/linux/octeontx/Makefile @@ -20,7 +20,8 @@ include $(INCLUDE_DIR)/target.mk KERNELNAME:=Image -DEFAULT_PACKAGES += kmod-hwmon-gsc kmod-leds-gpio kmod-pps-gpio \ +DEFAULT_PACKAGES += uboot-envtools mkf2fs e2fsprogs blkid \ + kmod-hwmon-gsc kmod-leds-gpio kmod-pps-gpio \ kmod-gpio-button-hotplug kmod-input-evdev kmod-rtc-ds1672 \ kmod-can kmod-can-mcp251x diff --git a/target/linux/octeontx/config-5.15 b/target/linux/octeontx/config-5.15 index 36402b70ebf..40cab28f60a 100644 --- a/target/linux/octeontx/config-5.15 +++ b/target/linux/octeontx/config-5.15 @@ -145,6 +145,8 @@ CONFIG_EDAC_SUPPORT=y CONFIG_EDAC_THUNDERX=y # CONFIG_EDAC_XGENE is not set CONFIG_EEPROM_AT24=y +CONFIG_EXT4_FS=y +CONFIG_F2FS_FS=y CONFIG_FAT_FS=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y From 2f96580c5282cd138d2bb858f7f27f539c8a63e1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 26 Feb 2023 13:36:58 +0100 Subject: [PATCH 33/34] mac80211: rework mesh fast xmit implementation Refactor in order to make use of generic fast xmit functions Fix issues with mesh SA/DA addressing Signed-off-by: Felix Fietkau --- ...wifi-mac80211-mesh-fast-xmit-support.patch | 795 +++++++++--------- ...e-mesh-header-cache-to-speed-up-mesh.patch | 144 +++- .../321-mac80211-fix-mesh-forwarding.patch | 4 +- .../500-mac80211_configure_antenna_gain.patch | 2 +- 4 files changed, 510 insertions(+), 435 deletions(-) diff --git a/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch b/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch index f18e1bb377b..b802960103a 100644 --- a/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch +++ b/package/kernel/mac80211/patches/subsys/319-wifi-mac80211-mesh-fast-xmit-support.patch @@ -1,33 +1,32 @@ -From: Sriram R -Date: Thu, 18 Aug 2022 12:35:42 +0530 +From: Felix Fietkau +Date: Sun, 26 Feb 2023 13:53:08 +0100 Subject: [PATCH] wifi: mac80211: mesh fast xmit support -Currently fast xmit is supported in AP, STA and other device types where -the destination doesn't change for the lifetime of its association by -caching the static parts of the header that can be reused directly for -every Tx such as addresses and updates only mutable header fields such as -PN. -This technique is not directly applicable for a Mesh device type due -to the dynamic nature of the topology and protocol. The header is built -based on the destination mesh device which is proxying a certain external -device and based on the Mesh destination the next hop changes. -And the RA/A1 which is the next hop for reaching the destination can -vary during runtime as per the best route based on airtime. To accommodate -these changes and to come up with a solution to avoid overhead during header -generation, the headers comprising the MAC, Mesh and LLC part are cached -whenever data for a certain external destination is sent. -This cached header is reused every time a data is sent to that external -destination. +Previously, fast xmit only worked on interface types where initially a +sta lookup is performed, and a cached header can be attached to the sta, +requiring only some fields to be updated at runtime. + +This technique is not directly applicable for a mesh device type due +to the dynamic nature of the topology and protocol. There are more +addresses that need to be filled, and there is an extra header with a +dynamic length based on the addressing mode. + +Change the code to cache entries contain a copy of the mesh subframe header + +bridge tunnel header, as well as an embedded struct ieee80211_fast_tx, which +contains the information for building the 802.11 header. + +Add a mesh specific early fast xmit call, which looks up a cached entry and +adds only the mesh subframe header, before passing it over to the generic +fast xmit code. To ensure the changes in network are reflected in these cached headers, flush affected cached entries on path changes, as well as other conditions that currently trigger a fast xmit check in other modes (key changes etc.) -In order to keep the cache small, use a short timeout for expiring cache -entries. +This code is loosely based on a previous implementation by: +Sriram R -Co-developed-by: Felix Fietkau -Signed-off-by: Sriram R +Signed-off-by: Ryder Lee Signed-off-by: Felix Fietkau --- @@ -37,24 +36,23 @@ Signed-off-by: Felix Fietkau extern const struct cfg80211_ops mac80211_config_ops; struct ieee80211_local; -+struct mhdr_cache_entry; ++struct ieee80211_mesh_fast_tx; /* Maximum number of broadcast/multicast frames to buffer when some of the * associated stations are using power saving. */ -@@ -655,6 +656,20 @@ struct mesh_table { +@@ -655,6 +656,19 @@ struct mesh_table { atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */ }; +/** -+ * struct mesh_hdr_cache - mesh fast xmit header cache ++ * struct mesh_tx_cache - mesh fast xmit header cache + * -+ * @rhead: hash table containing struct mhdr_cache_entry, using skb DA as key -+ * @walk_head: linked list containing all mhdr_cache_entry objects -+ * @walk_lock: lock protecting walk_head and rhead -+ * @enabled: indicates if header cache is initialized ++ * @rht: hash table containing struct ieee80211_mesh_fast_tx, using skb DA as key ++ * @walk_head: linked list containing all ieee80211_mesh_fast_tx objects ++ * @walk_lock: lock protecting walk_head and rht + */ -+struct mesh_hdr_cache { -+ struct rhashtable rhead; ++struct mesh_tx_cache { ++ struct rhashtable rht; + struct hlist_head walk_head; + spinlock_t walk_lock; +}; @@ -62,102 +60,209 @@ Signed-off-by: Felix Fietkau struct ieee80211_if_mesh { struct timer_list housekeeping_timer; struct timer_list mesh_path_timer; -@@ -733,6 +748,7 @@ struct ieee80211_if_mesh { +@@ -733,6 +747,7 @@ struct ieee80211_if_mesh { struct mesh_table mpp_paths; /* Store paths for MPP&MAP */ int mesh_paths_generation; int mpp_paths_generation; -+ struct mesh_hdr_cache hdr_cache; ++ struct mesh_tx_cache tx_cache; }; #ifdef CPTCFG_MAC80211_MESH -@@ -1998,6 +2014,9 @@ int ieee80211_tx_control_port(struct wip +@@ -1998,6 +2013,11 @@ int ieee80211_tx_control_port(struct wip int link_id, u64 *cookie); int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, const u8 *buf, size_t len); -+void __ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct mhdr_cache_entry *entry, -+ struct sk_buff *skb); ++void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta, ++ struct ieee80211_fast_tx *fast_tx, ++ struct sk_buff *skb, bool ampdu, ++ const u8 *da, const u8 *sa); /* HT */ void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c -@@ -780,6 +780,8 @@ static void ieee80211_mesh_housekeeping( +@@ -10,6 +10,7 @@ + #include + #include "ieee80211_i.h" + #include "mesh.h" ++#include "wme.h" + #include "driver-ops.h" + + static int mesh_allocated; +@@ -698,6 +699,102 @@ ieee80211_mesh_update_bss_params(struct + __le32_to_cpu(he_oper->he_oper_params); + } + ++bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata, ++ struct sk_buff *skb, u32 ctrl_flags) ++{ ++ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; ++ struct ieee80211_mesh_fast_tx *entry; ++ struct ieee80211s_hdr *meshhdr; ++ u8 sa[ETH_ALEN] __aligned(2); ++ struct tid_ampdu_tx *tid_tx; ++ struct sta_info *sta; ++ bool copy_sa = false; ++ u16 ethertype; ++ u8 tid; ++ ++ if (ctrl_flags & IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP) ++ return false; ++ ++ if (ifmsh->mshcfg.dot11MeshNolearn) ++ return false; ++ ++ /* Add support for these cases later */ ++ if (ifmsh->ps_peers_light_sleep || ifmsh->ps_peers_deep_sleep) ++ return false; ++ ++ if (is_multicast_ether_addr(skb->data)) ++ return false; ++ ++ ethertype = (skb->data[12] << 8) | skb->data[13]; ++ if (ethertype < ETH_P_802_3_MIN) ++ return false; ++ ++ if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) ++ return false; ++ ++ if (skb->ip_summed == CHECKSUM_PARTIAL) { ++ skb_set_transport_header(skb, skb_checksum_start_offset(skb)); ++ if (skb_checksum_help(skb)) ++ return false; ++ } ++ ++ entry = mesh_fast_tx_get(sdata, skb->data); ++ if (!entry) ++ return false; ++ ++ if (skb_headroom(skb) + 2 * ETH_ALEN < entry->hdrlen + ++ entry->fast_tx.hdr_len) ++ return false; ++ ++ sta = rcu_dereference(entry->mpath->next_hop); ++ if (!sta) ++ return false; ++ ++ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; ++ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); ++ if (tid_tx) { ++ if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) ++ return false; ++ if (tid_tx->timeout) ++ tid_tx->last_tx = jiffies; ++ } ++ ++ /* If the skb is shared we need to obtain our own copy */ ++ if (skb_shared(skb)) { ++ struct sk_buff *oskb = skb; ++ ++ skb = skb_clone(skb, GFP_ATOMIC); ++ if (!skb) ++ return false; ++ ++ kfree_skb(oskb); ++ } ++ ++ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); ++ ++ meshhdr = (struct ieee80211s_hdr *)entry->hdr; ++ if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) { ++ /* preserve SA from eth header for 6-addr frames */ ++ ether_addr_copy(sa, skb->data + ETH_ALEN); ++ copy_sa = true; ++ } ++ ++ memcpy(skb_push(skb, entry->hdrlen - 2 * ETH_ALEN), entry->hdr, ++ entry->hdrlen); ++ ++ meshhdr = (struct ieee80211s_hdr *)skb->data; ++ put_unaligned_le32(atomic_inc_return(&sdata->u.mesh.mesh_seqnum), ++ &meshhdr->seqnum); ++ meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL; ++ if (copy_sa) ++ ether_addr_copy(meshhdr->eaddr2, sa); ++ ++ __ieee80211_xmit_fast(sdata, sta, &entry->fast_tx, skb, tid_tx, ++ entry->mpath->dst, sdata->vif.addr); ++ ++ return true; ++} ++ + /** + * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame + * @hdr: 802.11 frame header +@@ -780,6 +877,8 @@ static void ieee80211_mesh_housekeeping( changed = mesh_accept_plinks_update(sdata); ieee80211_mbss_info_change_notify(sdata, changed); -+ mesh_hdr_cache_gc(sdata); ++ mesh_fast_tx_gc(sdata); + mod_timer(&ifmsh->housekeeping_timer, round_jiffies(jiffies + IEEE80211_MESH_HOUSEKEEPING_INTERVAL)); --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h -@@ -122,11 +122,49 @@ struct mesh_path { +@@ -122,11 +122,41 @@ struct mesh_path { u8 rann_snd_addr[ETH_ALEN]; u32 rann_metric; unsigned long last_preq_to_root; -+ unsigned long fast_xmit_check; ++ unsigned long fast_tx_check; bool is_root; bool is_gate; u32 path_change_count; }; -+#define MESH_HEADER_CACHE_MAX_SIZE 512 -+#define MESH_HEADER_CACHE_THRESHOLD_SIZE 384 -+#define MESH_HEADER_CACHE_TIMEOUT 8000 /* msecs */ -+#define MESH_HEADER_MAX_LEN 68 /* mac+mesh+rfc1042 hdr */ ++#define MESH_FAST_TX_CACHE_MAX_SIZE 512 ++#define MESH_FAST_TX_CACHE_THRESHOLD_SIZE 384 ++#define MESH_FAST_TX_CACHE_TIMEOUT 8000 /* msecs */ + +/** -+ * struct mhdr_cache_entry - Cached Mesh header entry -+ * @addr_key: The Ethernet DA which is the key for this entry -+ * @hdr: The cached header -+ * @machdr_len: Total length of the mac header -+ * @hdrlen: Length of this header entry -+ * @key: Key corresponding to the nexthop stored in the header -+ * @pn_offs: Offset to PN which is updated for every xmit -+ * @band: band used for tx -+ * @walk_list: list containing all the cached header entries ++ * struct ieee80211_mesh_fast_tx - cached mesh fast tx entry + * @rhash: rhashtable pointer -+ * @mpath: The Mesh path corresponding to the Mesh DA -+ * @mppath: The MPP entry corresponding to this DA ++ * @addr_key: The Ethernet DA which is the key for this entry ++ * @fast_tx: base fast_tx data ++ * @hdr: cached mesh and rfc1042 headers ++ * @hdrlen: length of mesh + rfc1042 ++ * @walk_list: list containing all the fast tx entries ++ * @mpath: mesh path corresponding to the Mesh DA ++ * @mppath: MPP entry corresponding to this DA + * @timestamp: Last used time of this entry -+ * @rcu: rcu to free this entry -+ * @path_change_count: Stored path change value corresponding to the mpath + */ -+struct mhdr_cache_entry { -+ u8 addr_key[ETH_ALEN] __aligned(2); -+ u8 hdr[MESH_HEADER_MAX_LEN]; -+ u16 machdr_len; -+ u16 hdrlen; -+ u8 pn_offs; -+ u8 band; -+ struct ieee80211_key *key; -+ struct hlist_node walk_list; ++struct ieee80211_mesh_fast_tx { + struct rhash_head rhash; ++ u8 addr_key[ETH_ALEN] __aligned(2); ++ ++ struct ieee80211_fast_tx fast_tx; ++ u8 hdr[sizeof(struct ieee80211s_hdr) + sizeof(rfc1042_header)]; ++ u16 hdrlen; ++ + struct mesh_path *mpath, *mppath; ++ struct hlist_node walk_list; + unsigned long timestamp; -+ struct rcu_head rcu; +}; + /* Recent multicast cache */ /* RMC_BUCKETS must be a power of 2, maximum 256 */ #define RMC_BUCKETS 256 -@@ -298,6 +336,18 @@ void mesh_path_discard_frame(struct ieee +@@ -298,6 +328,20 @@ void mesh_path_discard_frame(struct ieee void mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata); bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt); -+struct mhdr_cache_entry * -+mesh_get_cached_hdr(struct ieee80211_sub_if_data *sdata, const u8 *addr); -+void mesh_cache_hdr(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, struct mesh_path *mpath); -+void mesh_hdr_cache_gc(struct ieee80211_sub_if_data *sdata); -+void mesh_hdr_cache_flush_mpp(struct ieee80211_sub_if_data *sdata, -+ const u8 *addr); -+void mesh_hdr_cache_flush_mpath(struct mesh_path *mpath); -+void mesh_hdr_cache_flush_sta(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta); -+void mesh_refresh_path(struct ieee80211_sub_if_data *sdata, ++struct ieee80211_mesh_fast_tx * ++mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr); ++bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata, ++ struct sk_buff *skb, u32 ctrl_flags); ++void mesh_fast_tx_cache(struct ieee80211_sub_if_data *sdata, ++ struct sk_buff *skb, struct mesh_path *mpath); ++void mesh_fast_tx_gc(struct ieee80211_sub_if_data *sdata); ++void mesh_fast_tx_flush_addr(struct ieee80211_sub_if_data *sdata, ++ const u8 *addr); ++void mesh_fast_tx_flush_mpath(struct mesh_path *mpath); ++void mesh_fast_tx_flush_sta(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta); ++void mesh_path_refresh(struct ieee80211_sub_if_data *sdata, + struct mesh_path *mpath, const u8 *addr); #ifdef CPTCFG_MAC80211_MESH @@ -189,7 +294,7 @@ Signed-off-by: Felix Fietkau mesh_path_activate(mpath); spin_unlock_bh(&mpath->state_lock); + if (flush_mpath) -+ mesh_hdr_cache_flush_mpath(mpath); ++ mesh_fast_tx_flush_mpath(mpath); ewma_mesh_fail_avg_init(&sta->mesh->fail_avg); /* init it at a low value - 0 start is tricky */ ewma_mesh_fail_avg_add(&sta->mesh->fail_avg, 1); @@ -210,24 +315,15 @@ Signed-off-by: Felix Fietkau mesh_path_activate(mpath); spin_unlock_bh(&mpath->state_lock); + if (flush_mpath) -+ mesh_hdr_cache_flush_mpath(mpath); ++ mesh_fast_tx_flush_mpath(mpath); ewma_mesh_fail_avg_init(&sta->mesh->fail_avg); /* init it at a low value - 0 start is tricky */ ewma_mesh_fail_avg_add(&sta->mesh->fail_avg, 1); -@@ -977,7 +986,7 @@ free: - * Locking: the function must be called from within a rcu read lock block. - * - */ --static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) -+void mesh_queue_preq(struct mesh_path *mpath, u8 flags) - { - struct ieee80211_sub_if_data *sdata = mpath->sdata; - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; @@ -1215,6 +1224,20 @@ static int mesh_nexthop_lookup_nolearn(s return 0; } -+void mesh_refresh_path(struct ieee80211_sub_if_data *sdata, ++void mesh_path_refresh(struct ieee80211_sub_if_data *sdata, + struct mesh_path *mpath, const u8 *addr) +{ + if (mpath->flags & (MESH_PATH_REQ_QUEUED | MESH_PATH_FIXED | @@ -244,7 +340,7 @@ Signed-off-by: Felix Fietkau /** * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame. Calling * this function is considered "using" the associated mpath, so preempt a path -@@ -1242,19 +1265,18 @@ int mesh_nexthop_lookup(struct ieee80211 +@@ -1242,19 +1265,15 @@ int mesh_nexthop_lookup(struct ieee80211 if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE)) return -ENOENT; @@ -255,18 +351,15 @@ Signed-off-by: Felix Fietkau - !(mpath->flags & MESH_PATH_RESOLVING) && - !(mpath->flags & MESH_PATH_FIXED)) - mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); -+ mesh_refresh_path(sdata, mpath, hdr->addr4); ++ mesh_path_refresh(sdata, mpath, hdr->addr4); next_hop = rcu_dereference(mpath->next_hop); if (next_hop) { memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN); memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); ieee80211_mps_set_frame_flags(sdata, next_hop, hdr); -+ /* Cache the whole header so as to use next time rather than resolving -+ * and building it every time -+ */ + if (ieee80211_hw_check(&sdata->local->hw, SUPPORT_FAST_XMIT)) -+ mesh_cache_hdr(sdata, skb, mpath); ++ mesh_fast_tx_cache(sdata, skb, mpath); return 0; } @@ -284,37 +377,37 @@ Signed-off-by: Felix Fietkau .hashfn = mesh_table_hash, }; -+static const struct rhashtable_params mesh_hdr_rht_params = { ++static const struct rhashtable_params fast_tx_rht_params = { + .nelem_hint = 10, + .automatic_shrinking = true, -+ .key_len = ETH_ALEN, -+ .key_offset = offsetof(struct mhdr_cache_entry, addr_key), -+ .head_offset = offsetof(struct mhdr_cache_entry, rhash), ++ .key_len = ETH_ALEN, ++ .key_offset = offsetof(struct ieee80211_mesh_fast_tx, addr_key), ++ .head_offset = offsetof(struct ieee80211_mesh_fast_tx, rhash), + .hashfn = mesh_table_hash, +}; + -+static void __mesh_hdr_cache_entry_free(void *ptr, void *tblptr) ++static void __mesh_fast_tx_entry_free(void *ptr, void *tblptr) +{ -+ struct mhdr_cache_entry *mhdr = ptr; ++ struct ieee80211_mesh_fast_tx *entry = ptr; + -+ kfree_rcu(mhdr, rcu); ++ kfree_rcu(entry, fast_tx.rcu_head); +} + -+static void mesh_hdr_cache_deinit(struct ieee80211_sub_if_data *sdata) ++static void mesh_fast_tx_deinit(struct ieee80211_sub_if_data *sdata) +{ -+ struct mesh_hdr_cache *cache; ++ struct mesh_tx_cache *cache; + -+ cache = &sdata->u.mesh.hdr_cache; -+ rhashtable_free_and_destroy(&cache->rhead, -+ __mesh_hdr_cache_entry_free, NULL); ++ cache = &sdata->u.mesh.tx_cache; ++ rhashtable_free_and_destroy(&cache->rht, ++ __mesh_fast_tx_entry_free, NULL); +} + -+static void mesh_hdr_cache_init(struct ieee80211_sub_if_data *sdata) ++static void mesh_fast_tx_init(struct ieee80211_sub_if_data *sdata) +{ -+ struct mesh_hdr_cache *cache; ++ struct mesh_tx_cache *cache; + -+ cache = &sdata->u.mesh.hdr_cache; -+ rhashtable_init(&cache->rhead, &mesh_hdr_rht_params); ++ cache = &sdata->u.mesh.tx_cache; ++ rhashtable_init(&cache->rht, &fast_tx_rht_params); + INIT_HLIST_HEAD(&cache->walk_head); + spin_lock_init(&cache->walk_lock); +} @@ -322,40 +415,40 @@ Signed-off-by: Felix Fietkau static inline bool mpath_expired(struct mesh_path *mpath) { return (mpath->flags & MESH_PATH_ACTIVE) && -@@ -381,6 +417,254 @@ struct mesh_path *mesh_path_new(struct i +@@ -381,6 +417,243 @@ struct mesh_path *mesh_path_new(struct i return new_mpath; } -+static void mesh_hdr_cache_entry_free(struct mesh_hdr_cache *cache, -+ struct mhdr_cache_entry *entry) ++static void mesh_fast_tx_entry_free(struct mesh_tx_cache *cache, ++ struct ieee80211_mesh_fast_tx *entry) +{ + hlist_del_rcu(&entry->walk_list); -+ rhashtable_remove_fast(&cache->rhead, &entry->rhash, mesh_hdr_rht_params); -+ kfree_rcu(entry, rcu); ++ rhashtable_remove_fast(&cache->rht, &entry->rhash, fast_tx_rht_params); ++ kfree_rcu(entry, fast_tx.rcu_head); +} + -+struct mhdr_cache_entry * -+mesh_get_cached_hdr(struct ieee80211_sub_if_data *sdata, const u8 *addr) ++struct ieee80211_mesh_fast_tx * ++mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr) +{ -+ struct mhdr_cache_entry *entry; -+ struct mesh_hdr_cache *cache; ++ struct ieee80211_mesh_fast_tx *entry; ++ struct mesh_tx_cache *cache; + -+ cache = &sdata->u.mesh.hdr_cache; -+ entry = rhashtable_lookup(&cache->rhead, addr, mesh_hdr_rht_params); ++ cache = &sdata->u.mesh.tx_cache; ++ entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); + if (!entry) + return NULL; + + if (!(entry->mpath->flags & MESH_PATH_ACTIVE) || + mpath_expired(entry->mpath)) { + spin_lock_bh(&cache->walk_lock); -+ entry = rhashtable_lookup(&cache->rhead, addr, mesh_hdr_rht_params); ++ entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); + if (entry) -+ mesh_hdr_cache_entry_free(cache, entry); ++ mesh_fast_tx_entry_free(cache, entry); + spin_unlock_bh(&cache->walk_lock); + return NULL; + } + -+ mesh_refresh_path(sdata, entry->mpath, NULL); ++ mesh_path_refresh(sdata, entry->mpath, NULL); + if (entry->mppath) + entry->mppath->exp_time = jiffies; + entry->timestamp = jiffies; @@ -363,33 +456,30 @@ Signed-off-by: Felix Fietkau + return entry; +} + -+void mesh_cache_hdr(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, struct mesh_path *mpath) ++void mesh_fast_tx_cache(struct ieee80211_sub_if_data *sdata, ++ struct sk_buff *skb, struct mesh_path *mpath) +{ + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -+ struct mesh_hdr_cache *cache; -+ struct mhdr_cache_entry *mhdr, *old_mhdr; ++ struct ieee80211_mesh_fast_tx *entry, *prev; ++ struct ieee80211_mesh_fast_tx build = {}; + struct ieee80211s_hdr *meshhdr; -+ struct sta_info *sta; ++ struct mesh_tx_cache *cache; + struct ieee80211_key *key; + struct mesh_path *mppath; -+ u16 meshhdr_len; -+ u8 pn_offs = 0; -+ int hdrlen; ++ struct sta_info *sta; ++ u8 *qc; + -+ if (sdata->noack_map) ++ if (sdata->noack_map || ++ !ieee80211_is_data_qos(hdr->frame_control)) + return; + -+ if (!ieee80211_is_data_qos(hdr->frame_control)) -+ return; ++ build.fast_tx.hdr_len = ieee80211_hdrlen(hdr->frame_control); ++ meshhdr = (struct ieee80211s_hdr *)(skb->data + build.fast_tx.hdr_len); ++ build.hdrlen = ieee80211_get_mesh_hdrlen(meshhdr); + -+ hdrlen = ieee80211_hdrlen(hdr->frame_control); -+ meshhdr = (struct ieee80211s_hdr *)(skb->data + hdrlen); -+ meshhdr_len = ieee80211_get_mesh_hdrlen(meshhdr); -+ -+ cache = &sdata->u.mesh.hdr_cache; -+ if (atomic_read(&cache->rhead.nelems) >= MESH_HEADER_CACHE_MAX_SIZE) ++ cache = &sdata->u.mesh.tx_cache; ++ if (atomic_read(&cache->rht.nelems) >= MESH_FAST_TX_CACHE_MAX_SIZE) + return; + + sta = rcu_dereference(mpath->next_hop); @@ -401,6 +491,7 @@ Signed-off-by: Felix Fietkau + mppath = mpp_path_lookup(sdata, meshhdr->eaddr1); + if (!mppath) + return; ++ build.mppath = mppath; + } else if (ieee80211_has_a4(hdr->frame_control)) { + mppath = mpath; + } else { @@ -408,10 +499,10 @@ Signed-off-by: Felix Fietkau + } + + /* rate limit, in case fast xmit can't be enabled */ -+ if (mppath->fast_xmit_check == jiffies) ++ if (mppath->fast_tx_check == jiffies) + return; + -+ mppath->fast_xmit_check = jiffies; ++ mppath->fast_tx_check = jiffies; + + /* + * Same use of the sta lock as in ieee80211_check_fast_xmit, in order @@ -421,6 +512,7 @@ Signed-off-by: Felix Fietkau + key = rcu_access_pointer(sta->ptk[sta->ptk_idx]); + if (!key) + key = rcu_access_pointer(sdata->default_unicast_key); ++ build.fast_tx.key = key; + + if (key) { + bool gen_iv, iv_spc; @@ -436,60 +528,50 @@ Signed-off-by: Felix Fietkau + case WLAN_CIPHER_SUITE_CCMP: + case WLAN_CIPHER_SUITE_CCMP_256: + if (gen_iv) -+ pn_offs = hdrlen; ++ build.fast_tx.pn_offs = build.fast_tx.hdr_len; + if (gen_iv || iv_spc) -+ hdrlen += IEEE80211_CCMP_HDR_LEN; ++ build.fast_tx.hdr_len += IEEE80211_CCMP_HDR_LEN; + break; + case WLAN_CIPHER_SUITE_GCMP: + case WLAN_CIPHER_SUITE_GCMP_256: + if (gen_iv) -+ pn_offs = hdrlen; ++ build.fast_tx.pn_offs = build.fast_tx.hdr_len; + if (gen_iv || iv_spc) -+ hdrlen += IEEE80211_GCMP_HDR_LEN; ++ build.fast_tx.hdr_len += IEEE80211_GCMP_HDR_LEN; + break; + default: + goto unlock_sta; + } + } + -+ if (WARN_ON_ONCE(hdrlen + meshhdr_len + sizeof(rfc1042_header) > -+ MESH_HEADER_MAX_LEN)) -+ goto unlock_sta; ++ memcpy(build.addr_key, mppath->dst, ETH_ALEN); ++ build.timestamp = jiffies; ++ build.fast_tx.band = info->band; ++ build.fast_tx.da_offs = offsetof(struct ieee80211_hdr, addr3); ++ build.fast_tx.sa_offs = offsetof(struct ieee80211_hdr, addr4); ++ build.mpath = mpath; ++ memcpy(build.hdr, meshhdr, build.hdrlen); ++ memcpy(build.hdr + build.hdrlen, rfc1042_header, sizeof(rfc1042_header)); ++ build.hdrlen += sizeof(rfc1042_header); ++ memcpy(build.fast_tx.hdr, hdr, build.fast_tx.hdr_len); + -+ mhdr = kzalloc(sizeof(*mhdr), GFP_ATOMIC); -+ if (!mhdr) -+ goto unlock_sta; -+ -+ memcpy(mhdr->addr_key, mppath->dst, ETH_ALEN); -+ mhdr->machdr_len = hdrlen; -+ mhdr->hdrlen = mhdr->machdr_len + meshhdr_len + sizeof(rfc1042_header); -+ mhdr->mpath = mpath; -+ if (meshhdr->flags & MESH_FLAGS_AE) -+ mhdr->mppath = mppath; -+ mhdr->key = key; -+ mhdr->timestamp = jiffies; -+ mhdr->band = info->band; -+ mhdr->pn_offs = pn_offs; -+ -+ if (pn_offs) { -+ memcpy(mhdr->hdr, skb->data, pn_offs); -+ memcpy(mhdr->hdr + mhdr->machdr_len, skb->data + pn_offs, -+ mhdr->hdrlen - mhdr->machdr_len); -+ } else { -+ memcpy(mhdr->hdr, skb->data, mhdr->hdrlen); -+ } -+ -+ if (key) { -+ hdr = (struct ieee80211_hdr *)mhdr->hdr; ++ hdr = (struct ieee80211_hdr *)build.fast_tx.hdr; ++ if (build.fast_tx.key) + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); -+ } ++ ++ qc = ieee80211_get_qos_ctl(hdr); ++ qc[1] |= IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT >> 8; ++ ++ entry = kmemdup(&build, sizeof(build), GFP_ATOMIC); ++ if (!entry) ++ goto unlock_sta; + + spin_lock_bh(&cache->walk_lock); -+ old_mhdr = rhashtable_lookup_get_insert_fast(&cache->rhead, -+ &mhdr->rhash, -+ mesh_hdr_rht_params); -+ if (unlikely(IS_ERR(old_mhdr))) { -+ kfree(mhdr); ++ prev = rhashtable_lookup_get_insert_fast(&cache->rht, ++ &entry->rhash, ++ fast_tx_rht_params); ++ if (unlikely(IS_ERR(prev))) { ++ kfree(entry); + goto unlock_cache; + } + @@ -497,14 +579,14 @@ Signed-off-by: Felix Fietkau + * replace any previous entry in the hash table, in case we're + * replacing it with a different type (e.g. mpath -> mpp) + */ -+ if (unlikely(old_mhdr)) { -+ rhashtable_replace_fast(&cache->rhead, &old_mhdr->rhash, -+ &mhdr->rhash, mesh_hdr_rht_params); -+ hlist_del_rcu(&old_mhdr->walk_list); -+ kfree_rcu(old_mhdr, rcu); ++ if (unlikely(prev)) { ++ rhashtable_replace_fast(&cache->rht, &prev->rhash, ++ &entry->rhash, fast_tx_rht_params); ++ hlist_del_rcu(&prev->walk_list); ++ kfree_rcu(prev, fast_tx.rcu_head); + } + -+ hlist_add_head(&mhdr->walk_list, &cache->walk_head); ++ hlist_add_head(&entry->walk_list, &cache->walk_head); + +unlock_cache: + spin_unlock_bh(&cache->walk_lock); @@ -512,112 +594,112 @@ Signed-off-by: Felix Fietkau + spin_unlock_bh(&sta->lock); +} + -+void mesh_hdr_cache_gc(struct ieee80211_sub_if_data *sdata) ++void mesh_fast_tx_gc(struct ieee80211_sub_if_data *sdata) +{ -+ unsigned long timeout = msecs_to_jiffies(MESH_HEADER_CACHE_TIMEOUT); -+ struct mesh_hdr_cache *cache; -+ struct mhdr_cache_entry *entry; ++ unsigned long timeout = msecs_to_jiffies(MESH_FAST_TX_CACHE_TIMEOUT); ++ struct mesh_tx_cache *cache; ++ struct ieee80211_mesh_fast_tx *entry; + struct hlist_node *n; + -+ cache = &sdata->u.mesh.hdr_cache; -+ if (atomic_read(&cache->rhead.nelems) < MESH_HEADER_CACHE_THRESHOLD_SIZE) ++ cache = &sdata->u.mesh.tx_cache; ++ if (atomic_read(&cache->rht.nelems) < MESH_FAST_TX_CACHE_THRESHOLD_SIZE) + return; + + spin_lock_bh(&cache->walk_lock); + hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) + if (!time_is_after_jiffies(entry->timestamp + timeout)) -+ mesh_hdr_cache_entry_free(cache, entry); ++ mesh_fast_tx_entry_free(cache, entry); + spin_unlock_bh(&cache->walk_lock); +} + -+void mesh_hdr_cache_flush_mpath(struct mesh_path *mpath) ++void mesh_fast_tx_flush_mpath(struct mesh_path *mpath) +{ + struct ieee80211_sub_if_data *sdata = mpath->sdata; -+ struct mesh_hdr_cache *cache = &sdata->u.mesh.hdr_cache; -+ struct mhdr_cache_entry *entry; ++ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; ++ struct ieee80211_mesh_fast_tx *entry; + struct hlist_node *n; + -+ cache = &sdata->u.mesh.hdr_cache; ++ cache = &sdata->u.mesh.tx_cache; + spin_lock_bh(&cache->walk_lock); + hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) + if (entry->mpath == mpath) -+ mesh_hdr_cache_entry_free(cache, entry); ++ mesh_fast_tx_entry_free(cache, entry); + spin_unlock_bh(&cache->walk_lock); +} + -+void mesh_hdr_cache_flush_sta(struct ieee80211_sub_if_data *sdata, -+ struct sta_info *sta) ++void mesh_fast_tx_flush_sta(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta) +{ -+ struct mesh_hdr_cache *cache = &sdata->u.mesh.hdr_cache; -+ struct mhdr_cache_entry *entry; ++ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; ++ struct ieee80211_mesh_fast_tx *entry; + struct hlist_node *n; + -+ cache = &sdata->u.mesh.hdr_cache; ++ cache = &sdata->u.mesh.tx_cache; + spin_lock_bh(&cache->walk_lock); + hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) + if (rcu_access_pointer(entry->mpath->next_hop) == sta) -+ mesh_hdr_cache_entry_free(cache, entry); ++ mesh_fast_tx_entry_free(cache, entry); + spin_unlock_bh(&cache->walk_lock); +} + -+void mesh_hdr_cache_flush_mpp(struct ieee80211_sub_if_data *sdata, -+ const u8 *addr) ++void mesh_fast_tx_flush_addr(struct ieee80211_sub_if_data *sdata, ++ const u8 *addr) +{ -+ struct mesh_hdr_cache *cache = &sdata->u.mesh.hdr_cache; -+ struct mhdr_cache_entry *entry; ++ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; ++ struct ieee80211_mesh_fast_tx *entry; + -+ cache = &sdata->u.mesh.hdr_cache; ++ cache = &sdata->u.mesh.tx_cache; + spin_lock_bh(&cache->walk_lock); -+ entry = rhashtable_lookup(&cache->rhead, addr, mesh_hdr_rht_params); ++ entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); + if (entry) -+ mesh_hdr_cache_entry_free(cache, entry); ++ mesh_fast_tx_entry_free(cache, entry); + spin_unlock_bh(&cache->walk_lock); +} + /** * mesh_path_add - allocate and add a new path to the mesh path table * @dst: destination address of the path (ETH_ALEN length) -@@ -464,6 +748,8 @@ int mpp_path_add(struct ieee80211_sub_if +@@ -464,6 +737,8 @@ int mpp_path_add(struct ieee80211_sub_if if (ret) kfree(new_mpath); + else -+ mesh_hdr_cache_flush_mpp(sdata, dst); ++ mesh_fast_tx_flush_addr(sdata, dst); sdata->u.mesh.mpp_paths_generation++; return ret; -@@ -523,6 +809,10 @@ static void __mesh_path_del(struct mesh_ +@@ -523,6 +798,10 @@ static void __mesh_path_del(struct mesh_ { hlist_del_rcu(&mpath->walk_list); rhashtable_remove_fast(&tbl->rhead, &mpath->rhash, mesh_rht_params); + if (tbl == &mpath->sdata->u.mesh.mpp_paths) -+ mesh_hdr_cache_flush_mpp(mpath->sdata, mpath->dst); ++ mesh_fast_tx_flush_addr(mpath->sdata, mpath->dst); + else -+ mesh_hdr_cache_flush_mpath(mpath); ++ mesh_fast_tx_flush_mpath(mpath); mesh_path_free_rcu(tbl, mpath); } -@@ -747,6 +1037,7 @@ void mesh_path_fix_nexthop(struct mesh_p +@@ -747,6 +1026,7 @@ void mesh_path_fix_nexthop(struct mesh_p mpath->exp_time = 0; mpath->flags = MESH_PATH_FIXED | MESH_PATH_SN_VALID; mesh_path_activate(mpath); -+ mesh_hdr_cache_flush_mpath(mpath); ++ mesh_fast_tx_flush_mpath(mpath); spin_unlock_bh(&mpath->state_lock); ewma_mesh_fail_avg_init(&next_hop->mesh->fail_avg); /* init it at a low value - 0 start is tricky */ -@@ -758,6 +1049,7 @@ void mesh_pathtbl_init(struct ieee80211_ +@@ -758,6 +1038,7 @@ void mesh_pathtbl_init(struct ieee80211_ { mesh_table_init(&sdata->u.mesh.mesh_paths); mesh_table_init(&sdata->u.mesh.mpp_paths); -+ mesh_hdr_cache_init(sdata); ++ mesh_fast_tx_init(sdata); } static -@@ -785,6 +1077,7 @@ void mesh_path_expire(struct ieee80211_s +@@ -785,6 +1066,7 @@ void mesh_path_expire(struct ieee80211_s void mesh_pathtbl_unregister(struct ieee80211_sub_if_data *sdata) { -+ mesh_hdr_cache_deinit(sdata); ++ mesh_fast_tx_deinit(sdata); mesh_table_free(&sdata->u.mesh.mesh_paths); mesh_table_free(&sdata->u.mesh.mpp_paths); } @@ -646,7 +728,7 @@ Signed-off-by: Felix Fietkau + + /* flush fast xmit cache if the address path changed */ + if (update) -+ mesh_hdr_cache_flush_mpp(sdata, proxied_addr); ++ mesh_fast_tx_flush_addr(sdata, proxied_addr); + rcu_read_unlock(); } @@ -658,175 +740,105 @@ Signed-off-by: Felix Fietkau return; + if (ieee80211_vif_is_mesh(&sdata->vif)) -+ mesh_hdr_cache_flush_sta(sdata, sta); ++ mesh_fast_tx_flush_sta(sdata, sta); + /* Locking here protects both the pointer itself, and against concurrent * invocations winning data access races to, e.g., the key pointer that * is used. -@@ -3723,6 +3726,162 @@ free: - kfree_skb(skb); +@@ -3402,6 +3405,9 @@ static bool ieee80211_amsdu_aggregate(st + if (sdata->vif.offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED) + return false; + ++ if (ieee80211_vif_is_mesh(&sdata->vif)) ++ return false; ++ + if (skb_is_gso(skb)) + return false; + +@@ -3634,10 +3640,11 @@ free: + return NULL; } -+void __ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct mhdr_cache_entry *entry, -+ struct sk_buff *skb) -+{ -+ struct ieee80211_local *local = sdata->local; -+ struct ieee80211_tx_data tx = {}; -+ struct ieee80211_tx_info *info; -+ struct tid_ampdu_tx *tid_tx; -+ struct ieee80211_key *key; -+ struct ieee80211_hdr *hdr; -+ struct mesh_path *mpath; -+ ieee80211_tx_result r; -+ struct sta_info *sta; -+ u8 tid; +-static void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, +- struct sta_info *sta, +- struct ieee80211_fast_tx *fast_tx, +- struct sk_buff *skb, u8 tid, bool ampdu) ++void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta, ++ struct ieee80211_fast_tx *fast_tx, ++ struct sk_buff *skb, bool ampdu, ++ const u8 *da, const u8 *sa) + { + struct ieee80211_local *local = sdata->local; + struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; +@@ -3645,8 +3652,6 @@ static void __ieee80211_xmit_fast(struct + struct ieee80211_tx_data tx; + ieee80211_tx_result r; + int hw_headroom = sdata->local->hw.extra_tx_headroom; +- int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); +- struct ethhdr eth; + + skb = skb_share_check(skb, GFP_ATOMIC); + if (unlikely(!skb)) +@@ -3661,16 +3666,15 @@ static void __ieee80211_xmit_fast(struct + * more room than we already have in 'extra_head' + */ + if (unlikely(ieee80211_skb_resize(sdata, skb, +- max_t(int, extra_head + hw_headroom - ++ max_t(int, fast_tx->hdr_len + hw_headroom - + skb_headroom(skb), 0), + ENCRYPT_NO))) + goto free; + +- memcpy(ð, skb->data, ETH_HLEN - 2); +- hdr = skb_push(skb, extra_head); ++ hdr = skb_push(skb, fast_tx->hdr_len); + memcpy(skb->data, fast_tx->hdr, fast_tx->hdr_len); +- memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN); +- memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN); ++ memcpy(skb->data + fast_tx->da_offs, da, ETH_ALEN); ++ memcpy(skb->data + fast_tx->sa_offs, sa, ETH_ALEN); + + info = IEEE80211_SKB_CB(skb); + memset(info, 0, sizeof(*info)); +@@ -3689,7 +3693,7 @@ static void __ieee80211_xmit_fast(struct + #endif + + if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { +- tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; ++ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; + *ieee80211_get_qos_ctl(hdr) = tid; + } + +@@ -3732,6 +3736,7 @@ static bool ieee80211_xmit_fast(struct i + struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; + struct tid_ampdu_tx *tid_tx = NULL; + struct sk_buff *next; ++ struct ethhdr eth; + u8 tid = IEEE80211_NUM_TIDS; + + /* control port protocol needs a lot of special handling */ +@@ -3757,14 +3762,18 @@ static bool ieee80211_xmit_fast(struct i + } + } + ++ memcpy(ð, skb->data, ETH_HLEN - 2); + -+ if (!IS_ENABLED(CPTCFG_MAC80211_MESH)) -+ return; -+ -+ info = IEEE80211_SKB_CB(skb); -+ memset(info, 0, sizeof(*info)); -+ info->band = entry->band; -+ info->control.vif = &sdata->vif; -+ info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT | -+ IEEE80211_TX_CTL_DONTFRAG; -+ -+ info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT; -+ -+#ifdef CONFIG_MAC80211_DEBUGFS -+ if (local->force_tx_status) -+ info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; -+#endif -+ -+ mpath = entry->mpath; -+ key = entry->key; -+ sta = rcu_dereference(mpath->next_hop); -+ -+ __skb_queue_head_init(&tx.skbs); -+ -+ tx.flags = IEEE80211_TX_UNICAST; -+ tx.local = local; -+ tx.sdata = sdata; -+ tx.sta = sta; -+ tx.key = key; -+ tx.skb = skb; -+ -+ hdr = (struct ieee80211_hdr *)skb->data; -+ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; -+ *ieee80211_get_qos_ctl(hdr) = tid; -+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); -+ if (tid_tx) { -+ if (tid_tx->timeout) -+ tid_tx->last_tx = jiffies; -+ info->flags |= IEEE80211_TX_CTL_AMPDU; -+ } -+ -+ ieee80211_aggr_check(sdata, sta, skb); -+ -+ if (ieee80211_queue_skb(local, sdata, sta, skb)) -+ return; -+ -+ r = ieee80211_xmit_fast_finish(sdata, sta, entry->pn_offs, key, &tx); -+ if (r == TX_DROP) { -+ kfree_skb(skb); -+ return; -+ } -+ -+ __skb_queue_tail(&tx.skbs, skb); -+ ieee80211_tx_frags(local, &sdata->vif, sta, &tx.skbs, false); -+} -+ -+ -+static bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata, -+ struct sk_buff *skb, u32 ctrl_flags) -+{ -+ struct ieee80211_local *local = sdata->local; -+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; -+ struct mhdr_cache_entry *entry; -+ struct ieee80211s_hdr *meshhdr; -+ u8 sa[ETH_ALEN] __aligned(2); -+ struct sta_info *sta; -+ bool copy_sa = false; -+ u16 ethertype; -+ -+ if (!ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT)) -+ return false; -+ -+ if (ctrl_flags & IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP) -+ return false; -+ -+ if (ifmsh->mshcfg.dot11MeshNolearn) -+ return false; -+ -+ /* Add support for these cases later */ -+ if (ifmsh->ps_peers_light_sleep || ifmsh->ps_peers_deep_sleep) -+ return false; -+ -+ if (is_multicast_ether_addr(skb->data)) -+ return false; -+ -+ ethertype = (skb->data[12] << 8) | skb->data[13]; -+ if (ethertype < ETH_P_802_3_MIN) -+ return false; -+ -+ if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS) -+ return false; -+ -+ if (skb->ip_summed == CHECKSUM_PARTIAL) { -+ skb_set_transport_header(skb, skb_checksum_start_offset(skb)); -+ if (skb_checksum_help(skb)) -+ return false; -+ } -+ -+ entry = mesh_get_cached_hdr(sdata, skb->data); -+ if (!entry) -+ return false; -+ -+ /* Avoid extra work in this path */ -+ if (skb_headroom(skb) < (entry->hdrlen - ETH_HLEN + 2)) -+ return false; -+ -+ /* If the skb is shared we need to obtain our own copy */ -+ if (skb_shared(skb)) { -+ struct sk_buff *oskb = skb; -+ -+ skb = skb_clone(skb, GFP_ATOMIC); -+ if (!skb) -+ return false; -+ -+ kfree_skb(oskb); -+ } -+ -+ sta = rcu_dereference(entry->mpath->next_hop); -+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); -+ -+ meshhdr = (struct ieee80211s_hdr *)(entry->hdr + entry->machdr_len); -+ if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) { -+ /* preserve SA from eth header for 6-addr frames */ -+ ether_addr_copy(sa, skb->data + ETH_ALEN); -+ copy_sa = true; -+ } -+ -+ memcpy(skb_push(skb, entry->hdrlen - 2 * ETH_ALEN), entry->hdr, -+ entry->hdrlen); -+ -+ meshhdr = (struct ieee80211s_hdr *)(skb->data + entry->machdr_len); -+ put_unaligned_le32(atomic_inc_return(&sdata->u.mesh.mesh_seqnum), -+ &meshhdr->seqnum); -+ meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL; -+ if (copy_sa) -+ ether_addr_copy(meshhdr->eaddr2, sa); -+ -+ __ieee80211_mesh_xmit_fast(sdata, entry, skb); -+ -+ return true; -+} -+ - static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, - struct sta_info *sta, - struct ieee80211_fast_tx *fast_tx, -@@ -4244,8 +4403,14 @@ void __ieee80211_subif_start_xmit(struct + /* after this point (skb is modified) we cannot return false */ ++ skb_pull(skb, ETH_HLEN - 2); + skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata)); + if (!skb) + return true; + + skb_list_walk_safe(skb, skb, next) { + skb_mark_not_on_list(skb); +- __ieee80211_xmit_fast(sdata, sta, fast_tx, skb, tid, tid_tx); ++ __ieee80211_xmit_fast(sdata, sta, fast_tx, skb, tid_tx, ++ eth.h_dest, eth.h_source); + } + + return true; +@@ -4244,8 +4253,15 @@ void __ieee80211_subif_start_xmit(struct return; } @@ -835,13 +847,14 @@ Signed-off-by: Felix Fietkau rcu_read_lock(); + if (ieee80211_vif_is_mesh(&sdata->vif) && ++ ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT) && + ieee80211_mesh_xmit_fast(sdata, skb, ctrl_flags)) + goto out; + if (ieee80211_lookup_ra_sta(sdata, skb, &sta)) goto out_free; -@@ -4255,8 +4420,6 @@ void __ieee80211_subif_start_xmit(struct +@@ -4255,8 +4271,6 @@ void __ieee80211_subif_start_xmit(struct skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb)); ieee80211_aggr_check(sdata, sta, skb); diff --git a/package/kernel/mac80211/patches/subsys/320-wifi-mac80211-use-mesh-header-cache-to-speed-up-mesh.patch b/package/kernel/mac80211/patches/subsys/320-wifi-mac80211-use-mesh-header-cache-to-speed-up-mesh.patch index e0d4e60ed74..3b0bae67a5f 100644 --- a/package/kernel/mac80211/patches/subsys/320-wifi-mac80211-use-mesh-header-cache-to-speed-up-mesh.patch +++ b/package/kernel/mac80211/patches/subsys/320-wifi-mac80211-use-mesh-header-cache-to-speed-up-mesh.patch @@ -3,40 +3,92 @@ Date: Thu, 16 Feb 2023 11:07:30 +0100 Subject: [PATCH] wifi: mac80211: use mesh header cache to speed up mesh forwarding -Use it to look up the next hop address + sta pointer + key and call -__ieee80211_mesh_xmit_fast to queue the tx frame. - Significantly reduces mesh forwarding path CPU usage and enables the -use of iTXQ. +direct use of iTXQ. Signed-off-by: Felix Fietkau --- --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -2731,6 +2731,7 @@ ieee80211_rx_mesh_data(struct ieee80211_ - struct ieee80211_hdr hdr = { - .frame_control = cpu_to_le16(fc) - }; -+ struct mhdr_cache_entry *entry = NULL; - struct ieee80211_hdr *fwd_hdr; - struct ieee80211s_hdr *mesh_hdr; - struct ieee80211_tx_info *info; -@@ -2788,7 +2789,12 @@ ieee80211_rx_mesh_data(struct ieee80211_ - return RX_DROP_MONITOR; +@@ -2720,6 +2720,65 @@ ieee80211_deliver_skb(struct ieee80211_r } + } -- if (mesh_hdr->flags & MESH_FLAGS_AE) { -+ if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) -+ entry = mesh_get_cached_hdr(sdata, mesh_hdr->eaddr1); -+ else if (!(mesh_hdr->flags & MESH_FLAGS_AE)) -+ entry = mesh_get_cached_hdr(sdata, eth->h_dest); ++#ifdef CPTCFG_MAC80211_MESH ++static bool ++ieee80211_rx_mesh_fast_forward(struct ieee80211_sub_if_data *sdata, ++ struct sk_buff *skb, int hdrlen) ++{ ++ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; ++ struct ieee80211_mesh_fast_tx *entry = NULL; ++ struct ieee80211s_hdr *mesh_hdr; ++ struct tid_ampdu_tx *tid_tx; ++ struct sta_info *sta; ++ struct ethhdr eth; ++ u8 tid; + -+ if (!entry && (mesh_hdr->flags & MESH_FLAGS_AE)) { - struct mesh_path *mppath; - char *proxied_addr; - bool update = false; -@@ -2862,11 +2868,23 @@ ieee80211_rx_mesh_data(struct ieee80211_ ++ mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(eth)); ++ if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) ++ entry = mesh_fast_tx_get(sdata, mesh_hdr->eaddr1); ++ else if (!(mesh_hdr->flags & MESH_FLAGS_AE)) ++ entry = mesh_fast_tx_get(sdata, skb->data); ++ if (!entry) ++ return false; ++ ++ sta = rcu_dereference(entry->mpath->next_hop); ++ if (!sta) ++ return false; ++ ++ if (skb_linearize(skb)) ++ return false; ++ ++ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; ++ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); ++ if (tid_tx) { ++ if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) ++ return false; ++ ++ if (tid_tx->timeout) ++ tid_tx->last_tx = jiffies; ++ } ++ ++ ieee80211_aggr_check(sdata, sta, skb); ++ ++ if (ieee80211_get_8023_tunnel_proto(skb->data + hdrlen, ++ &skb->protocol)) ++ hdrlen += ETH_ALEN; ++ else ++ skb->protocol = htons(skb->len - hdrlen); ++ skb_set_network_header(skb, hdrlen + 2); ++ ++ skb->dev = sdata->dev; ++ memcpy(ð, skb->data, ETH_HLEN - 2); ++ skb_pull(skb, sizeof(eth)); ++ __ieee80211_xmit_fast(sdata, sta, &entry->fast_tx, skb, tid_tx, ++ eth.h_dest, eth.h_source); ++ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast); ++ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); ++ ++ return true; ++} ++#endif ++ + static ieee80211_rx_result + ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta, + struct sk_buff *skb) +@@ -2824,6 +2883,10 @@ ieee80211_rx_mesh_data(struct ieee80211_ + + skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]); + ++ if (!multicast && ++ ieee80211_rx_mesh_fast_forward(sdata, skb, mesh_hdrlen)) ++ return RX_QUEUED; ++ + ieee80211_fill_mesh_addresses(&hdr, &hdr.frame_control, + eth->h_dest, eth->h_source); + hdrlen = ieee80211_hdrlen(hdr.frame_control); +@@ -2862,6 +2925,7 @@ ieee80211_rx_mesh_data(struct ieee80211_ info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING; info->control.vif = &sdata->vif; info->control.jiffies = jiffies; @@ -44,23 +96,7 @@ Signed-off-by: Felix Fietkau if (multicast) { IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast); memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); - /* update power mode indication when forwarding */ - ieee80211_mps_set_frame_flags(sdata, NULL, fwd_hdr); -+ } else if (entry) { -+ struct ieee80211_hdr *ehdr = (struct ieee80211_hdr *)entry->hdr; -+ -+ ether_addr_copy(fwd_hdr->addr1, ehdr->addr1); -+ ether_addr_copy(fwd_hdr->addr2, sdata->vif.addr); -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast); -+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); -+ qos[0] = fwd_skb->priority; -+ qos[1] = ieee80211_get_qos_ctl(ehdr)[1]; -+ __ieee80211_mesh_xmit_fast(sdata, entry, fwd_skb); -+ return RX_QUEUED; - } else if (!mesh_nexthop_lookup(sdata, fwd_skb)) { - /* mesh power mode flags updated in mesh_nexthop_lookup */ - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast); -@@ -2883,7 +2901,6 @@ ieee80211_rx_mesh_data(struct ieee80211_ +@@ -2883,7 +2947,6 @@ ieee80211_rx_mesh_data(struct ieee80211_ } IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); @@ -68,3 +104,29 @@ Signed-off-by: Felix Fietkau ieee80211_add_pending_skb(local, fwd_skb); rx_accept: +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -2018,6 +2018,8 @@ void __ieee80211_xmit_fast(struct ieee80 + struct ieee80211_fast_tx *fast_tx, + struct sk_buff *skb, bool ampdu, + const u8 *da, const u8 *sa); ++void ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta, struct sk_buff *skb); + + /* HT */ + void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1191,10 +1191,8 @@ static bool ieee80211_tx_prep_agg(struct + return queued; + } + +-static void +-ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata, +- struct sta_info *sta, +- struct sk_buff *skb) ++void ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata, ++ struct sta_info *sta, struct sk_buff *skb) + { + struct rate_control_ref *ref = sdata->local->rate_ctrl; + u16 tid; diff --git a/package/kernel/mac80211/patches/subsys/321-mac80211-fix-mesh-forwarding.patch b/package/kernel/mac80211/patches/subsys/321-mac80211-fix-mesh-forwarding.patch index d9af8c79291..e2b268ae4c0 100644 --- a/package/kernel/mac80211/patches/subsys/321-mac80211-fix-mesh-forwarding.patch +++ b/package/kernel/mac80211/patches/subsys/321-mac80211-fix-mesh-forwarding.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -2847,6 +2847,9 @@ ieee80211_rx_mesh_data(struct ieee80211_ +@@ -2904,6 +2904,9 @@ ieee80211_rx_mesh_data(struct ieee80211_ if (skb_cow_head(fwd_skb, hdrlen - sizeof(struct ethhdr))) return RX_DROP_UNUSABLE; @@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau } fwd_hdr = skb_push(fwd_skb, hdrlen - sizeof(struct ethhdr)); -@@ -2861,7 +2864,7 @@ ieee80211_rx_mesh_data(struct ieee80211_ +@@ -2918,7 +2921,7 @@ ieee80211_rx_mesh_data(struct ieee80211_ hdrlen += ETH_ALEN; else fwd_skb->protocol = htons(fwd_skb->len - hdrlen); diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index 817be9e4d23..80ffb493b89 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -87,7 +87,7 @@ CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1536,6 +1536,7 @@ struct ieee80211_local { +@@ -1535,6 +1535,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ From 1272cb0a0dec0917f20adc79b8146e7ef19d3d95 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 26 Feb 2023 20:35:40 +0100 Subject: [PATCH 34/34] mac80211: fix mesh path discovery based on unicast packets If a packet has reached its intended destination, it was bumped to the code that accepts it, without first checking if a mesh_path needs to be created based on the discovered source. Fix this by moving the destination address check further down Signed-off-by: Felix Fietkau --- ...x-mesh-path-discovery-based-on-unica.patch | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 package/kernel/mac80211/patches/subsys/322-wifi-mac80211-fix-mesh-path-discovery-based-on-unica.patch diff --git a/package/kernel/mac80211/patches/subsys/322-wifi-mac80211-fix-mesh-path-discovery-based-on-unica.patch b/package/kernel/mac80211/patches/subsys/322-wifi-mac80211-fix-mesh-path-discovery-based-on-unica.patch new file mode 100644 index 00000000000..292a89ef921 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/322-wifi-mac80211-fix-mesh-path-discovery-based-on-unica.patch @@ -0,0 +1,52 @@ +From: Felix Fietkau +Date: Sun, 26 Feb 2023 20:30:20 +0100 +Subject: [PATCH] wifi: mac80211: fix mesh path discovery based on unicast + packets + +If a packet has reached its intended destination, it was bumped to the code +that accepts it, without first checking if a mesh_path needs to be created +based on the discovered source. +Fix this by moving the destination address check further down + +Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces") +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -2824,17 +2824,6 @@ ieee80211_rx_mesh_data(struct ieee80211_ + mesh_rmc_check(sdata, eth->h_source, mesh_hdr)) + return RX_DROP_MONITOR; + +- /* Frame has reached destination. Don't forward */ +- if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) +- goto rx_accept; +- +- if (!ifmsh->mshcfg.dot11MeshForwarding) { +- if (is_multicast_ether_addr(eth->h_dest)) +- goto rx_accept; +- +- return RX_DROP_MONITOR; +- } +- + /* forward packet */ + if (sdata->crypto_tx_tailroom_needed_cnt) + tailroom = IEEE80211_ENCRYPT_TAILROOM; +@@ -2881,6 +2870,17 @@ ieee80211_rx_mesh_data(struct ieee80211_ + rcu_read_unlock(); + } + ++ /* Frame has reached destination. Don't forward */ ++ if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) ++ goto rx_accept; ++ ++ if (!ifmsh->mshcfg.dot11MeshForwarding) { ++ if (is_multicast_ether_addr(eth->h_dest)) ++ goto rx_accept; ++ ++ return RX_DROP_MONITOR; ++ } ++ + skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]); + + if (!multicast &&