From 38cba61bff52f22affa66cc764dab2ac158ab7d3 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Fri, 27 Jan 2023 23:35:47 +0100 Subject: [PATCH 01/33] realtek: timer: Register enabled scheduler clock Before calling sched_clock_register(), the timer used to drive the scheduling clock should already be enabled. Otherwise the kernel log will show strange time jumps during, and the watchdog might not be pinged in a timely fashion, resulting in reboots. [ 0.160281] NET: Registered PF_NETLINK/PF_ROUTE protocol family [ 78.104319] clocksource: Switched to clocksource realtek_otto_timer Fixes: 3cc801117118 ("realtek: resurrect timer driver") Signed-off-by: Sander Vanheule --- .../realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c | 2 +- .../realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c b/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c index c096d8742b..0395cf29e5 100644 --- a/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c +++ b/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c @@ -229,7 +229,6 @@ struct rttm_cs rttm_cs = { .mask = CLOCKSOURCE_MASK(RTTM_BIT_COUNT), .flags = CLOCK_SOURCE_IS_CONTINUOUS, .read = rttm_read_clocksource, - .enable = rttm_enable_clocksource } }; @@ -276,6 +275,7 @@ static int __init rttm_probe(struct device_node *np) to->of_base.index = clkidx; timer_of_init(np, to); if (rttm_cs.to.of_base.base && rttm_cs.to.of_clk.rate) { + rttm_enable_clocksource(&rttm_cs.cs); clocksource_register_hz(&rttm_cs.cs, RTTM_TICKS_PER_SEC); sched_clock_register(rttm_read_clock, RTTM_BIT_COUNT, RTTM_TICKS_PER_SEC); } else diff --git a/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c b/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c index c096d8742b..0395cf29e5 100644 --- a/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c +++ b/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c @@ -229,7 +229,6 @@ struct rttm_cs rttm_cs = { .mask = CLOCKSOURCE_MASK(RTTM_BIT_COUNT), .flags = CLOCK_SOURCE_IS_CONTINUOUS, .read = rttm_read_clocksource, - .enable = rttm_enable_clocksource } }; @@ -276,6 +275,7 @@ static int __init rttm_probe(struct device_node *np) to->of_base.index = clkidx; timer_of_init(np, to); if (rttm_cs.to.of_base.base && rttm_cs.to.of_clk.rate) { + rttm_enable_clocksource(&rttm_cs.cs); clocksource_register_hz(&rttm_cs.cs, RTTM_TICKS_PER_SEC); sched_clock_register(rttm_read_clock, RTTM_BIT_COUNT, RTTM_TICKS_PER_SEC); } else From 68e28cdc47ac805faf2dda58127e848f8ef6efca Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Wed, 14 Sep 2022 14:50:38 +0200 Subject: [PATCH 02/33] realtek: timer: Activate for RTL930x devices Use the new timer driver for the RTL930x devices. Signed-off-by: Olliver Schinagl [remove old clock provider, select MIPS_EXTERNAL_TIMER and refresh kernel config] Signed-off-by: Sander Vanheule --- target/linux/realtek/dts-5.15/rtl930x.dtsi | 18 ++++++++++-------- .../300-mips-add-rtl838x-platform.patch | 5 ++--- target/linux/realtek/rtl930x/config-5.15 | 8 ++++---- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/target/linux/realtek/dts-5.15/rtl930x.dtsi b/target/linux/realtek/dts-5.15/rtl930x.dtsi index c2a992a174..fdec626c9a 100644 --- a/target/linux/realtek/dts-5.15/rtl930x.dtsi +++ b/target/linux/realtek/dts-5.15/rtl930x.dtsi @@ -57,14 +57,6 @@ interrupts = <2>, <3>, <4>, <5>, <6>, <7>; }; - rtl9300clock: rtl9300clock@3200 { - compatible = "realtek,rtl9300clock"; - reg = <0x3200 0x10>, <0x3210 0x10>; - - interrupt-parent = <&intc>; - interrupts = <7 5>, <8 5>; - }; - spi0: spi@1200 { compatible = "realtek,rtl8380-spi"; reg = <0x1200 0x100>; @@ -73,6 +65,16 @@ #size-cells = <0>; }; + timer0: timer@3200 { + compatible = "realtek,rtl930x-timer", "realtek,otto-timer"; + reg = <0x3200 0x10>, <0x3210 0x10>, <0x3220 0x10>, + <0x3230 0x10>, <0x3240 0x10>; + + interrupt-parent = <&intc>; + interrupts = <7 4>, <8 4>, <9 4>, <10 4>, <11 4>; + clocks = <&lx_clk>; + }; + uart0: uart@2000 { compatible = "ns16550a"; reg = <0x2000 0x100>; diff --git a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch index 8428c32e4e..4027b5319a 100644 --- a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch @@ -25,7 +25,7 @@ Submitted-by: Birger Koblitz platform-$(CONFIG_SGI_IP28) += sgi-ip22/ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1053,8 +1053,59 @@ config NLM_XLP_BOARD +@@ -1053,8 +1053,58 @@ config NLM_XLP_BOARD This board is based on Netlogic XLP Processor. Say Y here if you have a XLP based board. @@ -68,8 +68,7 @@ Submitted-by: Birger Koblitz + bool "Realtek RTL930X based platforms" + depends on RTL83XX + select MIPS_CPU_SCACHE -+ select CSRC_R4K -+ select CEVT_RTL9300 ++ select MIPS_EXTERNAL_TIMER + select SYS_SUPPORTS_MULTITHREADING + +config RTL931X diff --git a/target/linux/realtek/rtl930x/config-5.15 b/target/linux/realtek/rtl930x/config-5.15 index 5e03616678..35365370ef 100644 --- a/target/linux/realtek/rtl930x/config-5.15 +++ b/target/linux/realtek/rtl930x/config-5.15 @@ -9,7 +9,6 @@ CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BOARD_SCACHE=y -CONFIG_CEVT_RTL9300=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y # CONFIG_COMMON_CLK_REALTEK is not set @@ -33,7 +32,6 @@ CONFIG_CPU_SUPPORTS_MSA=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 CONFIG_CRYPTO_RNG2=y -CONFIG_CSRC_R4K=y CONFIG_DEBUG_SECTION_MISMATCH=y CONFIG_DMA_NONCOHERENT=y CONFIG_DTC=y @@ -113,11 +111,11 @@ CONFIG_MIGRATION=y CONFIG_MIPS=y CONFIG_MIPS_ASID_BITS=8 CONFIG_MIPS_ASID_SHIFT=0 -CONFIG_MIPS_CLOCK_VSYSCALL=y # CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set CONFIG_MIPS_CMDLINE_FROM_DTB=y CONFIG_MIPS_CPU_SCACHE=y CONFIG_MIPS_EBPF_JIT=y +CONFIG_MIPS_EXTERNAL_TIMER=y CONFIG_MIPS_L1_CACHE_SHIFT=5 CONFIG_MIPS_LD_CAN_LINK_VDSO=y # CONFIG_MIPS_MT_SMP is not set @@ -166,7 +164,7 @@ CONFIG_POWER_RESET_GPIO_RESTART=y CONFIG_POWER_RESET_SYSCON=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_RATIONAL=y -# CONFIG_REALTEK_OTTO_TIMER is not set +CONFIG_REALTEK_OTTO_TIMER=y CONFIG_REALTEK_OTTO_WDT=y CONFIG_REALTEK_PHY=y CONFIG_REALTEK_SOC_PHY=y @@ -199,6 +197,8 @@ CONFIG_SYS_SUPPORTS_MIPS16=y CONFIG_SYS_SUPPORTS_MULTITHREADING=y CONFIG_TARGET_ISA_REV=2 CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y CONFIG_TINY_SRCU=y CONFIG_USE_GENERIC_EARLY_PRINTK_8250=y CONFIG_USE_OF=y From f6ba61b9298f12dbf116556edc879d047e5145e9 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Thu, 29 Dec 2022 11:27:54 +0100 Subject: [PATCH 03/33] realtek: timer: Remove CEVT_RTL9300 completely As the timer has been fixed now, we can drop the CEVT_RTL9300 timer all together. Signed-off-by: Olliver Schinagl --- .../arch/mips/kernel/cevt-rtl9300.c | 204 ------------------ .../300-mips-add-rtl838x-platform.patch | 10 - .../309-cevt-rtl9300-support.patch | 54 ----- 3 files changed, 268 deletions(-) delete mode 100644 target/linux/realtek/files-5.15/arch/mips/kernel/cevt-rtl9300.c delete mode 100644 target/linux/realtek/patches-5.15/309-cevt-rtl9300-support.patch diff --git a/target/linux/realtek/files-5.15/arch/mips/kernel/cevt-rtl9300.c b/target/linux/realtek/files-5.15/arch/mips/kernel/cevt-rtl9300.c deleted file mode 100644 index 1f7698d314..0000000000 --- a/target/linux/realtek/files-5.15/arch/mips/kernel/cevt-rtl9300.c +++ /dev/null @@ -1,204 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -/* - * Timer registers - * the RTL9300/9310 SoCs have 6 timers, each register block 0x10 apart - */ -#define RTL9300_TC_DATA 0x0 -#define RTL9300_TC_CNT 0x4 -#define RTL9300_TC_CTRL 0x8 -#define RTL9300_TC_CTRL_MODE BIT(24) -#define RTL9300_TC_CTRL_EN BIT(28) -#define RTL9300_TC_INT 0xc -#define RTL9300_TC_INT_IP BIT(16) -#define RTL9300_TC_INT_IE BIT(20) - -/* Timer modes */ -#define TIMER_MODE_REPEAT 1 -#define TIMER_MODE_ONCE 0 - -/* Minimum divider is 2 */ -#define DIVISOR_RTL9300 2 - -#define N_BITS 28 - -#define RTL9300_CLOCK_RATE 87500000 - -struct rtl9300_clk_dev { - struct clock_event_device clkdev; - void __iomem *base; -}; - -static void __iomem *rtl9300_tc_base(struct clock_event_device *clk) -{ - struct rtl9300_clk_dev *rtl_clk = container_of(clk, struct rtl9300_clk_dev, clkdev); - - return rtl_clk->base; -} - -static irqreturn_t rtl9300_timer_interrupt(int irq, void *dev_id) -{ - struct rtl9300_clk_dev *rtl_clk = dev_id; - struct clock_event_device *clk = &rtl_clk->clkdev; - - u32 v = readl(rtl_clk->base + RTL9300_TC_INT); - - /* Acknowledge the IRQ */ - v |= RTL9300_TC_INT_IP; - writel(v, rtl_clk->base + RTL9300_TC_INT); - - clk->event_handler(clk); - - return IRQ_HANDLED; -} - -static void rtl9300_clock_stop(void __iomem *base) -{ - u32 v; - - writel(0, base + RTL9300_TC_CTRL); - - /* Acknowledge possibly pending IRQ */ - v = readl(base + RTL9300_TC_INT); - writel(v | RTL9300_TC_INT_IP, base + RTL9300_TC_INT); -} - -static void rtl9300_timer_start(void __iomem *base, bool periodic) -{ - u32 v = (periodic ? RTL9300_TC_CTRL_MODE : 0) | RTL9300_TC_CTRL_EN | DIVISOR_RTL9300; - - writel(0, base + RTL9300_TC_CNT); - pr_debug("------------- starting timer base %08x\n", (u32)base); - writel(v, base + RTL9300_TC_CTRL); -} - -static int rtl9300_next_event(unsigned long delta, struct clock_event_device *clk) -{ - void __iomem *base = rtl9300_tc_base(clk); - - rtl9300_clock_stop(base); - writel(delta, base + RTL9300_TC_DATA); - rtl9300_timer_start(base, TIMER_MODE_ONCE); - - return 0; -} - -static int rtl9300_state_periodic(struct clock_event_device *clk) -{ - void __iomem *base = rtl9300_tc_base(clk); - - pr_debug("------------- rtl9300_state_periodic %08x\n", (u32)base); - rtl9300_clock_stop(base); - writel(RTL9300_CLOCK_RATE / HZ, base + RTL9300_TC_DATA); - rtl9300_timer_start(base, TIMER_MODE_REPEAT); - - return 0; -} - -static int rtl9300_state_oneshot(struct clock_event_device *clk) -{ - void __iomem *base = rtl9300_tc_base(clk); - - pr_debug("------------- rtl9300_state_oneshot %08x\n", (u32)base); - rtl9300_clock_stop(base); - writel(RTL9300_CLOCK_RATE / HZ, base + RTL9300_TC_DATA); - rtl9300_timer_start(base, TIMER_MODE_ONCE); - - return 0; -} - -static int rtl9300_shutdown(struct clock_event_device *clk) -{ - void __iomem *base = rtl9300_tc_base(clk); - - pr_debug("------------- rtl9300_shutdown %08x\n", (u32)base); - rtl9300_clock_stop(base); - - return 0; -} - -static void rtl9300_clock_setup(void __iomem *base) -{ - u32 v; - - /* Disable timer */ - writel(0, base + RTL9300_TC_CTRL); - - /* Acknowledge possibly pending IRQ */ - v = readl(base + RTL9300_TC_INT); - writel(v | RTL9300_TC_INT_IP, base + RTL9300_TC_INT); - - /* Setup maximum period (for use as clock-source) */ - writel(0x0fffffff, base + RTL9300_TC_DATA); -} - -static DEFINE_PER_CPU(struct rtl9300_clk_dev, rtl9300_clockevent); -static DEFINE_PER_CPU(char [18], rtl9300_clock_name); - -void rtl9300_clockevent_init(void) -{ - int cpu = smp_processor_id(); - int irq; - struct rtl9300_clk_dev *rtl_clk = &per_cpu(rtl9300_clockevent, cpu); - struct clock_event_device *cd = &rtl_clk->clkdev; - unsigned char *name = per_cpu(rtl9300_clock_name, cpu); - unsigned long flags = IRQF_PERCPU | IRQF_TIMER; - struct device_node *node; - - pr_info("%s called for cpu%d\n", __func__, cpu); - BUG_ON(cpu > 3); /* Only have 4 general purpose timers */ - - node = of_find_compatible_node(NULL, NULL, "realtek,rtl9300clock"); - if (!node) { - pr_err("No DT entry found for realtek,rtl9300clock\n"); - return; - } - - irq = irq_of_parse_and_map(node, cpu); - pr_info("%s using IRQ %d\n", __func__, irq); - - rtl_clk->base = of_iomap(node, cpu); - if (!rtl_clk->base) { - pr_err("cannot map timer for cpu %d", cpu); - return; - } - - rtl9300_clock_setup(rtl_clk->base); - - sprintf(name, "rtl9300-counter-%d", cpu); - cd->name = name; - cd->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; - - clockevent_set_clock(cd, RTL9300_CLOCK_RATE); - - cd->max_delta_ns = clockevent_delta2ns(0x0fffffff, cd); - cd->max_delta_ticks = 0x0fffffff; - cd->min_delta_ns = clockevent_delta2ns(0x20, cd); - cd->min_delta_ticks = 0x20; - cd->rating = 300; - cd->irq = irq; - cd->cpumask = cpumask_of(cpu); - cd->set_next_event = rtl9300_next_event; - cd->set_state_shutdown = rtl9300_shutdown; - cd->set_state_periodic = rtl9300_state_periodic; - cd->set_state_oneshot = rtl9300_state_oneshot; - clockevents_register_device(cd); - - irq_set_affinity(irq, cd->cpumask); - - if (request_irq(irq, rtl9300_timer_interrupt, flags, name, rtl_clk)) - pr_err("Failed to request irq %d (%s)\n", irq, name); - - writel(RTL9300_TC_INT_IE, rtl_clk->base + RTL9300_TC_INT); -} diff --git a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch index 4027b5319a..6407a49fb6 100644 --- a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch @@ -84,13 +84,3 @@ Submitted-by: Birger Koblitz source "arch/mips/alchemy/Kconfig" source "arch/mips/ath25/Kconfig" source "arch/mips/ath79/Kconfig" -@@ -1112,6 +1162,9 @@ config CEVT_GT641XX - config CEVT_R4K - bool - -+config CEVT_RTL9300 -+ bool -+ - config CEVT_SB1250 - bool - diff --git a/target/linux/realtek/patches-5.15/309-cevt-rtl9300-support.patch b/target/linux/realtek/patches-5.15/309-cevt-rtl9300-support.patch deleted file mode 100644 index 93d69c07cf..0000000000 --- a/target/linux/realtek/patches-5.15/309-cevt-rtl9300-support.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 775d903216a08c2a8009863d2f9c33f62657ba94 Mon Sep 17 00:00:00 2001 -From: Birger Koblitz -Date: Thu, 6 Jan 2022 20:27:01 +0100 -Subject: [PATCH] realtek: Replace the RTL9300 generic timer with a CEVT timer - -The RTL9300 has a broken R4K MIPS timer interrupt, however, the -R4K clocksource works. We replace the RTL9300 timer with a -Clock Event Timer (CEVT), which is VSMP aware and can be instantiated -as part of brining a VSMTP cpu up instead of the R4K CEVT source. -For this we place the RTL9300 CEVT timer in arch/mips/kernel -together with other MIPS CEVT timers, initialize the SoC IRQs -from a modified smp-mt.c and instantiate each timer as part -of the MIPS time setup in arch/mips/include/asm/time.h instead -of the R4K CEVT, similarly as is done by other MIPS CEVT timers. - -Submitted-by: Birger Koblitz ---- - arch/mips/kernel/Makefile | 1 + - arch/mips/include/asm/time.h | 7 +++++++ - 2 files changed, 8 insertions(+) - ---- a/arch/mips/kernel/Makefile -+++ b/arch/mips/kernel/Makefile -@@ -27,6 +27,7 @@ obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm14 - obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o - obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o - obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o -+obj-$(CONFIG_CEVT_RTL9300) += cevt-rtl9300.o - obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o - obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o - obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o ---- a/arch/mips/include/asm/time.h -+++ b/arch/mips/include/asm/time.h -@@ -15,6 +15,8 @@ - #include - #include - -+extern void rtl9300_clockevent_init(void); -+ - extern spinlock_t rtc_lock; - - /* -@@ -43,6 +45,11 @@ extern int r4k_clockevent_init(void); - - static inline int mips_clockevent_init(void) - { -+#ifdef CONFIG_CEVT_RTL9300 -+ rtl9300_clockevent_init(); -+ return 0; -+#endif -+ - #ifdef CONFIG_CEVT_R4K - return r4k_clockevent_init(); - #else From afb5d9e9d5a5ecafceb0e3d4ffe1210077f8a40b Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Sat, 28 Jan 2023 15:26:35 +0100 Subject: [PATCH 04/33] realtek: timer: Fix cosmetic whitespace in comments Comments are a bit weird in the timer driver, lets fix those. Signed-off-by: Olliver Schinagl --- .../drivers/clocksource/timer-rtl-otto.c | 27 +++++-------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c b/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c index 0395cf29e5..086f62112a 100644 --- a/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c +++ b/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c @@ -27,7 +27,6 @@ * the timer is in operating mode COUNTER it stops. In mode TIMER it will * continue to count up. */ - #define RTTM_CTRL_COUNTER 0 #define RTTM_CTRL_TIMER BIT(24) @@ -43,7 +42,6 @@ * MHz and 153.125 MHz. The greatest common divisor of all explained possible * speeds is 3125000. Pin the timers to this 3.125 MHz reference frequency. */ - #define RTTM_TICKS_PER_SEC 3125000 struct rttm_cs { @@ -51,10 +49,7 @@ struct rttm_cs { struct clocksource cs; }; -/* - * Simple internal register functions - */ - +/* Simple internal register functions */ static inline void rttm_set_counter(void __iomem *base, unsigned int counter) { iowrite32(counter, base + RTTM_CNT); @@ -95,10 +90,7 @@ static inline void rttm_disable_irq(void __iomem *base) iowrite32(0, base + RTTM_INT); } -/* - * Aggregated control functions for kernel clock framework - */ - +/* Aggregated control functions for kernel clock framework */ #define RTTM_DEBUG(base) \ pr_debug("------------- %s %d %08x\n", __func__, \ smp_processor_id(), (u32)base) @@ -187,10 +179,7 @@ static u64 rttm_read_clocksource(struct clocksource *cs) return (u64)rttm_get_counter(rcs->to.of_base.base); } -/* - * Module initialization part. - */ - +/* Module initialization part. */ static DEFINE_PER_CPU(struct timer_of, rttm_to) = { .flags = TIMER_OF_BASE | TIMER_OF_CLOCK | TIMER_OF_IRQ, .of_irq = { @@ -256,9 +245,8 @@ static int __init rttm_probe(struct device_node *np) int cpu, cpu_rollback; struct timer_of *to; int clkidx = num_possible_cpus(); -/* - * Use the first n timers as per CPU clock event generators - */ + + /* Use the first n timers as per CPU clock event generators */ for_each_possible_cpu(cpu) { to = per_cpu_ptr(&rttm_to, cpu); to->of_irq.index = to->of_base.index = cpu; @@ -268,9 +256,8 @@ static int __init rttm_probe(struct device_node *np) } rttm_setup_timer(to->of_base.base); } -/* - * Activate the n'th+1 timer as a stable CPU clocksource. - */ + + /* Activate the n'th + 1 timer as a stable CPU clocksource. */ to = &rttm_cs.to; to->of_base.index = clkidx; timer_of_init(np, to); From d14559e9df4052cfaecd016c2afd2353ce18c455 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 28 Jan 2023 19:27:51 +0100 Subject: [PATCH 05/33] uhttpd: update to latest Git HEAD 47561aa mimetypes: add audio/video support for apple airplay 6341357 ucode: respect all arguments passed to send() Signed-off-by: Hauke Mehrtens --- package/network/services/uhttpd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index 55ca3f6818..4090bf4579 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git -PKG_SOURCE_DATE:=2022-10-31 -PKG_SOURCE_VERSION:=23977554d9694d025eada50a5547e99ee1be7838 -PKG_MIRROR_HASH:=e546fd57d0d0be6a51e2aeb5797febe8c89d2bba61b26c930ecb0616d5f6ace9 +PKG_SOURCE_DATE:=2023-01-28 +PKG_SOURCE_VERSION:=47561aa13574068403d48f13ea310f8511057b2b +PKG_MIRROR_HASH:=84500cf0c8224fe80b5717c9b6bad8ac13f44f286e3a88e8b12adfcf02e22c7c PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=ISC From 3ba8dd0731000cd406f10e597cfa051bb02f7034 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 28 Jan 2023 19:49:51 +0100 Subject: [PATCH 06/33] realtek: Refresh kernel patches Make the patches apply cleanly again. Fixes: 4db8598e4296 ("realtek: Do not set KERNEL_ENTRY just to avoid NO_EXCEPT_FILL") Signed-off-by: Hauke Mehrtens --- .../realtek/patches-5.10/300-mips-add-rtl838x-platform.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch index f54bd28242..fce26133fc 100644 --- a/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch @@ -85,7 +85,7 @@ Submitted-by: Birger Koblitz source "arch/mips/alchemy/Kconfig" source "arch/mips/ath25/Kconfig" source "arch/mips/ath79/Kconfig" -@@ -1097,6 +1147,9 @@ config CEVT_GT641XX +@@ -1097,6 +1148,9 @@ config CEVT_GT641XX config CEVT_R4K bool From 5d227b16035ddcda54ecaccaed497f725bfa98f9 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 22 Jan 2023 17:17:14 +0100 Subject: [PATCH 07/33] pistachio: Cleanup kernel configuration This removes some kernel configuration options which are not needed. This brings the target closer to the OpenWrt standard configuration. Signed-off-by: Hauke Mehrtens --- target/linux/pistachio/config-5.15 | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/target/linux/pistachio/config-5.15 b/target/linux/pistachio/config-5.15 index c303e99987..c16a0c4551 100644 --- a/target/linux/pistachio/config-5.15 +++ b/target/linux/pistachio/config-5.15 @@ -71,8 +71,6 @@ CONFIG_DMA_VIRTUAL_CHANNELS=y CONFIG_DTC=y CONFIG_DWMAC_GENERIC=y CONFIG_EXT4_FS=y -CONFIG_EXT4_FS_POSIX_ACL=y -CONFIG_EXT4_FS_SECURITY=y # CONFIG_FIT_IMAGE_FDT_BOSTON is not set # CONFIG_FIT_IMAGE_FDT_JAGUAR2 is not set # CONFIG_FIT_IMAGE_FDT_LUTON is not set @@ -120,6 +118,7 @@ CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HOTPLUG_CPU=y +CONFIG_HZ_PERIODIC=y CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_IMG=y @@ -138,7 +137,6 @@ CONFIG_LEDS_PWM=y # CONFIG_LEGACY_BOARD_OCELOT is not set # CONFIG_LEGACY_BOARD_SEAD3 is not set CONFIG_LIBFDT=y -CONFIG_LKDTM=y CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_LOG_BUF_SHIFT=18 CONFIG_LZO_COMPRESS=y @@ -201,17 +199,12 @@ CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_FASTMAP=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_NAMESPACES=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NET_FLOW_LIMIT=y -CONFIG_NET_NS=y CONFIG_NET_PTP_CLASSIFY=y CONFIG_NET_SELFTESTS=y CONFIG_NLS=y CONFIG_NO_EXCEPT_FILL=y -CONFIG_NO_HZ=y -CONFIG_NO_HZ_COMMON=y -CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_OF=y CONFIG_OF_ADDRESS=y @@ -234,11 +227,8 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_PISTACHIO=y CONFIG_POWER_SUPPLY=y CONFIG_PPS=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_VOLUNTARY=y CONFIG_PRINTK_TIME=y CONFIG_PROC_EVENTS=y -CONFIG_PROFILING=y CONFIG_PTP_1588_CLOCK=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_PWM=y @@ -329,7 +319,6 @@ CONFIG_USB_GADGET=y CONFIG_USB_ROLE_SWITCH=y CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y -CONFIG_USER_NS=y CONFIG_USE_OF=y # CONFIG_VIRT_BOARD_RANCHU is not set CONFIG_WATCHDOG_CORE=y From 015c1087559d8433f488d6dbde142489696a27e0 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 28 Jan 2023 20:23:20 +0100 Subject: [PATCH 08/33] relayd: bump to version 2023-01-28 f646ba4 route: Fix compile warning with glibc Signed-off-by: Hauke Mehrtens --- package/network/services/relayd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/relayd/Makefile b/package/network/services/relayd/Makefile index 64a08a9665..aba6939955 100644 --- a/package/network/services/relayd/Makefile +++ b/package/network/services/relayd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=$(PROJECT_GIT)/project/relayd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2020-04-25 -PKG_SOURCE_VERSION:=f4d759be54ceb37714e9a6ca320d5b50c95e9ce9 -PKG_MIRROR_HASH:=b1ff6e99072867be0975ba0be52ba9da3a876c8b8da893d68301e8238243a51e +PKG_SOURCE_DATE:=2023-01-28 +PKG_SOURCE_VERSION:=f646ba40489371e69f624f2dee2fc4e19ceec00e +PKG_MIRROR_HASH:=672d3115728d40ee6897a9f633d269d127496699a7bd45eba11844aa771f2501 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 364a9be3384d87fa1d7a21862a7479a8ce8492b2 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 25 Jan 2023 09:07:51 +0100 Subject: [PATCH 09/33] ethtool: update to 6.1 Release notes: https://lore.kernel.org/netdev/20221219225600.r54vejiqapn266cm@lion.mk-sys.cz/T/ Add patches fixing compilation: - 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, 555 insertions(+), 2 deletions(-) create mode 100644 package/network/utils/ethtool/patches/100-uapi-Bring-in-if-h.patch create mode 100644 package/network/utils/ethtool/patches/101-netlink-Fix-maybe-uninitialized-meters-variable.patch create 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 467630d24c..bec26cd364 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.0 +PKG_VERSION:=6.1 PKG_RELEASE:=1 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=d5446c93de570ce68f3b1ea69dbfa12fcfd67fc19897f655d3f18231e2b818d6 +PKG_HASH:=c41fc881ffa5a40432d2dd829eb44c64a49dee482e716baacf9262c64daa8f90 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING 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 new file mode 100644 index 0000000000..09be05c1f6 --- /dev/null +++ b/package/network/utils/ethtool/patches/100-uapi-Bring-in-if-h.patch @@ -0,0 +1,465 @@ +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 new file mode 100644 index 0000000000..381b949ede --- /dev/null +++ b/package/network/utils/ethtool/patches/101-netlink-Fix-maybe-uninitialized-meters-variable.patch @@ -0,0 +1,25 @@ +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 new file mode 100644 index 0000000000..33b1715967 --- /dev/null +++ b/package/network/utils/ethtool/patches/102-raw-marvell-c-Fix-build-with-musl-libc.patch @@ -0,0 +1,63 @@ +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 290a6527bea2b2031e8f87387247fe96cfa833c0 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 25 Jan 2023 13:02:56 -0500 Subject: [PATCH 10/33] ath79: add pcie1 wifi device to Senao qca955x AP DTSI Each individual device DTS now enables either pcie0 or pcie1. Signed-off-by: Michael Pratt --- .../ath79/dts/qca9557_araknis_an-500-ap-i-ac.dts | 4 ++++ target/linux/ath79/dts/qca9557_engenius_eap1200h.dts | 6 +++++- .../ath79/dts/qca9557_engenius_enstationac-v1.dts | 4 ++++ .../linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts | 4 ++++ .../ath79/dts/qca9558_araknis_an-700-ap-i-ac.dts | 4 ++++ target/linux/ath79/dts/qca9558_engenius_eap1750h.dts | 6 +++++- target/linux/ath79/dts/qca9558_watchguard_ap300.dts | 4 ++++ target/linux/ath79/dts/qca955x_senao_loader.dtsi | 11 ++++++++--- 8 files changed, 38 insertions(+), 5 deletions(-) diff --git a/target/linux/ath79/dts/qca9557_araknis_an-500-ap-i-ac.dts b/target/linux/ath79/dts/qca9557_araknis_an-500-ap-i-ac.dts index 419e77c4f8..bd9f3e8da8 100644 --- a/target/linux/ath79/dts/qca9557_araknis_an-500-ap-i-ac.dts +++ b/target/linux/ath79/dts/qca9557_araknis_an-500-ap-i-ac.dts @@ -94,6 +94,10 @@ mac-address-increment = <1>; }; +&pcie0 { + status = "okay"; +}; + &art { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/ath79/dts/qca9557_engenius_eap1200h.dts b/target/linux/ath79/dts/qca9557_engenius_eap1200h.dts index beb3e5ee07..d20a044475 100644 --- a/target/linux/ath79/dts/qca9557_engenius_eap1200h.dts +++ b/target/linux/ath79/dts/qca9557_engenius_eap1200h.dts @@ -110,10 +110,14 @@ mac-address-increment = <1>; }; -&ath10k { +&ath10k_0 { status = "okay"; nvmem-cells = <&macaddr_art_0>, <&calibration_art_5000>; nvmem-cell-names = "mac-address", "calibration"; mac-address-increment = <2>; }; + +&pcie0 { + status = "okay"; +}; diff --git a/target/linux/ath79/dts/qca9557_engenius_enstationac-v1.dts b/target/linux/ath79/dts/qca9557_engenius_enstationac-v1.dts index 812fcfc5dc..12740b9bdf 100644 --- a/target/linux/ath79/dts/qca9557_engenius_enstationac-v1.dts +++ b/target/linux/ath79/dts/qca9557_engenius_enstationac-v1.dts @@ -111,6 +111,10 @@ qca955x-sgmii-fixup; }; +&pcie0 { + status = "okay"; +}; + &art { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts b/target/linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts index aa1f4ad02b..c8b1d94c96 100644 --- a/target/linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts +++ b/target/linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts @@ -95,6 +95,10 @@ mac-address-increment = <1>; }; +&pcie0 { + status = "okay"; +}; + &art { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/ath79/dts/qca9558_araknis_an-700-ap-i-ac.dts b/target/linux/ath79/dts/qca9558_araknis_an-700-ap-i-ac.dts index 304eac5e62..520ca60144 100644 --- a/target/linux/ath79/dts/qca9558_araknis_an-700-ap-i-ac.dts +++ b/target/linux/ath79/dts/qca9558_araknis_an-700-ap-i-ac.dts @@ -93,6 +93,10 @@ mac-address-increment = <1>; }; +&pcie0 { + status = "okay"; +}; + &art { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/ath79/dts/qca9558_engenius_eap1750h.dts b/target/linux/ath79/dts/qca9558_engenius_eap1750h.dts index 605030455c..e17eda3840 100644 --- a/target/linux/ath79/dts/qca9558_engenius_eap1750h.dts +++ b/target/linux/ath79/dts/qca9558_engenius_eap1750h.dts @@ -110,10 +110,14 @@ mac-address-increment = <1>; }; -&ath10k { +&ath10k_0 { status = "okay"; nvmem-cells = <&macaddr_art_0>, <&calibration_art_5000>; nvmem-cell-names = "mac-address", "calibration"; mac-address-increment = <2>; }; + +&pcie0 { + status = "okay"; +}; diff --git a/target/linux/ath79/dts/qca9558_watchguard_ap300.dts b/target/linux/ath79/dts/qca9558_watchguard_ap300.dts index 90f5cddfa7..799883c350 100644 --- a/target/linux/ath79/dts/qca9558_watchguard_ap300.dts +++ b/target/linux/ath79/dts/qca9558_watchguard_ap300.dts @@ -121,6 +121,10 @@ mac-address-increment = <1>; }; +&pcie0 { + status = "okay"; +}; + &art { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/ath79/dts/qca955x_senao_loader.dtsi b/target/linux/ath79/dts/qca955x_senao_loader.dtsi index 5a8c4fb799..cf82c050b6 100644 --- a/target/linux/ath79/dts/qca955x_senao_loader.dtsi +++ b/target/linux/ath79/dts/qca955x_senao_loader.dtsi @@ -26,14 +26,19 @@ }; &pcie0 { - status = "okay"; - - ath10k: wifi@0,0,0 { + ath10k_0: wifi@0,0,0 { compatible = "qcom,ath10k"; reg = <0x0 0 0 0 0>; }; }; +&pcie1 { + ath10k_1: wifi@0,1,0 { + compatible = "qcom,ath10k"; + reg = <0x0 1 0 0 0>; + }; +}; + &spi { status = "okay"; From 52992efc345b693486e102a631953600ee7c0ba8 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 13 Jan 2023 00:37:10 -0500 Subject: [PATCH 11/33] ath79: add support for Senao Engenius EWS660AP FCC ID: A8J-EWS660AP Engenius EWS660AP is an outdoor wireless access point with 2 gigabit ethernet ports, dual-band wireless, internal antenna plates, and 802.3at PoE+ **Specification:** - QCA9558 SOC 2.4 GHz, 3x3 - QCA9880 WLAN mini PCIe card, 5 GHz, 3x3, 26dBm - AR8035-A PHY RGMII GbE with PoE+ IN - AR8033 PHY SGMII GbE with PoE+ OUT - 40 MHz clock - 16 MB FLASH MX25L12845EMI-10G - 2x 64 MB RAM - UART at J1 populated, RX grounded - 6 internal antenna plates (5 dbi, omni-directional) - 5 LEDs, 1 button (power, eth0, eth1, 2G, 5G) (reset) **MAC addresses:** Base MAC addressed labeled as "MAC" Only one Vendor MAC address in flash eth0 *:d4 MAC art 0x0 eth1 *:d5 --- art 0x0 +1 phy1 *:d6 --- art 0x0 +2 phy0 *:d7 --- art 0x0 +3 **Serial Access:** the RX line on the board for UART is shorted to ground by resistor R176 therefore it must be removed to use the console but it is not necessary to remove to view boot log optionally, R175 can be replaced with a solder bridge short the resistors R175 and R176 are next to the UART RX pin **Installation:** 2 ways to flash factory.bin from OEM: Method 1: Firmware upgrade page: OEM webpage at 192.168.1.1 username and password "admin" Navigate to "Firmware Upgrade" page from left pane Click Browse and select the factory.bin image Upload and verify checksum Click Continue to confirm and wait 3 minutes Method 2: Serial to load Failsafe webpage: After connecting to serial console and rebooting... Interrupt uboot with any key pressed rapidly execute `run failsafe_boot` OR `bootm 0x9fd70000` wait a minute connect to ethernet and navigate to "192.168.1.1/index.htm" Select the factory.bin image and upload wait about 3 minutes **Return to OEM:** If you have a serial cable, see Serial Failsafe instructions otherwise, uboot-env can be used to make uboot load the failsafe image ssh into openwrt and run `fw_setenv rootfs_checksum 0` reboot, wait 3 minutes connect to ethernet and navigate to 192.168.1.1/index.htm select OEM firmware image from Engenius and click upgrade **TFTP recovery:** Requires serial console, reset button does nothing rename initramfs.bin to '0101A8C0.img' make available on TFTP server at 192.168.1.101 power board, interrupt boot execute tftpboot and bootm 0x81000000 **Format of OEM firmware image:** The OEM software of EWS660AP is a heavily modified version of Openwrt Kamikaze. One of the many modifications is to the sysupgrade program. Image verification is performed simply by the successful ungzip and untar of the supplied file and name check and header verification of the resulting contents. To form a factory.bin that is accepted by OEM Openwrt build, the kernel and rootfs must have specific names... openwrt-ar71xx-generic-ews660ap-uImage-lzma.bin openwrt-ar71xx-generic-ews660ap-root.squashfs and begin with the respective headers (uImage, squashfs). Then the files must be tarballed and gzipped. The resulting binary is actually a tar.gz file in disguise. This can be verified by using binwalk on the OEM firmware images, ungzipping then untaring. Newer EnGenius software requires more checks but their script includes a way to skip them, otherwise the tar must include a text file with the version and md5sums in a deprecated format. The OEM upgrade script is at /etc/fwupgrade.sh. OKLI kernel loader is required because the OEM software expects the kernel to be no greater than 1536k and the factory.bin upgrade procedure would otherwise overwrite part of the kernel when writing rootfs. Note on PLL-data cells: The default PLL register values will not work because of the external AR8035 switch between the SOC and the ethernet port. For QCA955x series, the PLL registers for eth0 and eth1 can be see in the DTSI as 0x28 and 0x48 respectively. Therefore the PLL registers can be read from uboot for each link speed after attempting tftpboot or another network action using that link speed with `md 0x18050028 1` and `md 0x18050048 1`. The clock delay required for RGMII can be applied at the PHY side, using the at803x driver `phy-mode`. Therefore the PLL registers for GMAC0 do not need the bits for delay on the MAC side. This is possible due to fixes in at803x driver since Linux 5.1 and 5.3 Tested-by: Niklas Arnitz Signed-off-by: Michael Pratt --- package/boot/uboot-envtools/files/ath79 | 1 + .../ath79/dts/qca9558_engenius_ews660ap.dts | 132 ++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 1 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/ath79/image/generic.mk | 12 ++ 5 files changed, 147 insertions(+) create mode 100644 target/linux/ath79/dts/qca9558_engenius_ews660ap.dts diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 71dd104f55..0510a4b51a 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -38,6 +38,7 @@ engenius,ecb600|\ engenius,enh202-v1|\ engenius,ens202ext-v1|\ engenius,enstationac-v1|\ +engenius,ews660ap|\ etactica,eg200|\ glinet,gl-ar750s-nor|\ glinet,gl-ar750s-nor-nand|\ diff --git a/target/linux/ath79/dts/qca9558_engenius_ews660ap.dts b/target/linux/ath79/dts/qca9558_engenius_ews660ap.dts new file mode 100644 index 0000000000..eca3a6091f --- /dev/null +++ b/target/linux/ath79/dts/qca9558_engenius_ews660ap.dts @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x_senao_loader.dtsi" + +#include +#include + +/ { + compatible = "engenius,ews660ap", "qca,qca9558"; + model = "EnGenius EWS660AP"; + + aliases { + label-mac-device = ð0; + led-boot = &led_wifi5g; + led-failsafe = &led_wifi5g; + led-upgrade = &led_wifi5g; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + wifi2g { + label = "green:wifi2g"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led_wifi5g: wifi5g { + label = "green:wifi5g"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + }; +}; + +&partitions { + partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + calibration_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + + calibration_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy1: ethernet-phy@1 { + reg = <1>; + eee-broken-100tx; + eee-broken-1000t; + }; + + phy2: ethernet-phy@2 { + reg = <2>; + eee-broken-100tx; + eee-broken-1000t; + at803x-override-sgmii-link-check; + }; +}; + +ð0 { + status = "okay"; + + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + + phy-handle = <&phy1>; + phy-mode = "rgmii-id"; + + pll-data = <0x82000000 0x80000101 0x80001313>; +}; + +ð1 { + status = "okay"; + + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + + phy-handle = <&phy2>; + + pll-data = <0x03000000 0x00000101 0x00001313>; + + qca955x-sgmii-fixup; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&macaddr_art_0>, <&calibration_art_1000>; + nvmem-cell-names = "mac-address", "calibration"; + mac-address-increment = <2>; +}; + +&ath10k_1 { + status = "okay"; + + nvmem-cells = <&macaddr_art_0>, <&calibration_art_5000>; + nvmem-cell-names = "mac-address", "calibration"; + mac-address-increment = <3>; +}; + +&pcie1 { + status = "okay"; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 610e70e500..5db3a2d3c4 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -136,6 +136,7 @@ ath79_setup_interfaces() devolo,dvl1750e|\ engenius,enstationac-v1|\ engenius,ews511ap|\ + engenius,ews660ap|\ ocedo,ursus|\ ruckus,zf7372|\ ubnt,unifi-ap-outdoor-plus) diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh index d03163a8ea..67a3635075 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh @@ -42,6 +42,7 @@ platform_do_upgrade() { engenius,ecb600|\ engenius,ens202ext-v1|\ engenius,enstationac-v1|\ + engenius,ews660ap|\ watchguard,ap100|\ watchguard,ap200|\ watchguard,ap300) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 3e32a08295..b3b510a2ec 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1308,6 +1308,18 @@ define Device/engenius_ews511ap endef TARGET_DEVICES += engenius_ews511ap +define Device/engenius_ews660ap + $(Device/senao_loader_okli) + SOC := qca9558 + DEVICE_VENDOR := EnGenius + DEVICE_MODEL := EWS660AP + DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct + IMAGE_SIZE := 11584k + LOADER_FLASH_OFFS := 0x220000 + SENAO_IMGNAME := ar71xx-generic-ews660ap +endef +TARGET_DEVICES += engenius_ews660ap + define Device/enterasys_ws-ap3705i SOC := ar9344 DEVICE_VENDOR := Enterasys From a911f63df9bade09e950059b4ed3222e4d278fab Mon Sep 17 00:00:00 2001 From: Daniel Groth Date: Sat, 14 Jan 2023 15:32:00 +0100 Subject: [PATCH 12/33] realtek: dgs-1210-10mp: update sfp phy-handle Adjust the wrong phy-handle definitions for the sfp ports so that they match the correct switch ports. Fixes: 89eb8b50d18d ("realtek: dgs-1210-10mp: add full sfp description") Signed-off-by: Daniel Groth --- .../linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts | 4 ++-- .../linux/realtek/dts-5.15/rtl8380_d-link_dgs-1210-10mp-f.dts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts index 39e37ee595..664cab5999 100644 --- a/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts +++ b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts @@ -112,7 +112,7 @@ port@24 { reg = <24>; label = "lan9"; - phy-handle = <14>; + phy-handle = <&phy24>; phy-mode = "1000base-x"; managed = "in-band-status"; sfp = <&sfp0>; @@ -121,7 +121,7 @@ port@26 { reg = <26>; label = "lan10"; - phy-handle = <15>; + phy-handle = <&phy26>; phy-mode = "1000base-x"; managed = "in-band-status"; sfp = <&sfp1>; diff --git a/target/linux/realtek/dts-5.15/rtl8380_d-link_dgs-1210-10mp-f.dts b/target/linux/realtek/dts-5.15/rtl8380_d-link_dgs-1210-10mp-f.dts index 39e37ee595..664cab5999 100644 --- a/target/linux/realtek/dts-5.15/rtl8380_d-link_dgs-1210-10mp-f.dts +++ b/target/linux/realtek/dts-5.15/rtl8380_d-link_dgs-1210-10mp-f.dts @@ -112,7 +112,7 @@ port@24 { reg = <24>; label = "lan9"; - phy-handle = <14>; + phy-handle = <&phy24>; phy-mode = "1000base-x"; managed = "in-band-status"; sfp = <&sfp0>; @@ -121,7 +121,7 @@ port@26 { reg = <26>; label = "lan10"; - phy-handle = <15>; + phy-handle = <&phy26>; phy-mode = "1000base-x"; managed = "in-band-status"; sfp = <&sfp1>; From f83f5f8452edd3115aacf333b0038da89639a218 Mon Sep 17 00:00:00 2001 From: Tom Herbers Date: Tue, 24 Jan 2023 14:14:58 +0100 Subject: [PATCH 13/33] ath79: add label-mac-device for GL-XE300 This adds an label-mac-device alias which refrences the mac which is printed on the Label of the device. Signed-off-by: Tom Herbers --- target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts b/target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts index 9c2760398b..9212c0a754 100644 --- a/target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts +++ b/target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts @@ -9,6 +9,10 @@ compatible = "glinet,gl-xe300", "qca,qca9531"; model = "GL.iNet GL-XE300"; + aliases { + label-mac-device = ð0; + }; + gpio-export { compatible = "gpio-export"; From a7f3a51982be34270d9b10283f6d188bd54fc7a1 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Tue, 6 Dec 2022 16:39:27 -0800 Subject: [PATCH 14/33] kernel: add kmod-lib-842 "842" is a compression scheme and this is the software implementation which is too slow to really use beyond a proof of concept. It can be selected in ZRAM, ZSWAP, or `fs/pstore`, and is here for completeness. In general you need a Power8 or better with 842-in-hardware for it to be fast, but other 842-accelerators are emerging. Signed-off-by: Tony Butler --- package/kernel/linux/modules/lib.mk | 22 ++++++++++++++++++++++ target/linux/generic/config-5.15 | 1 + 2 files changed, 23 insertions(+) diff --git a/package/kernel/linux/modules/lib.mk b/package/kernel/linux/modules/lib.mk index d4d44ad8f0..299c5a8c35 100644 --- a/package/kernel/linux/modules/lib.mk +++ b/package/kernel/linux/modules/lib.mk @@ -170,6 +170,28 @@ endef $(eval $(call KernelPackage,lib-lz4)) +define KernelPackage/lib-842 + SUBMENU:=$(LIB_MENU) + TITLE:=842 support + DEPENDS:=+kmod-crypto-acompress +kmod-crypto-crc32 + KCONFIG:= \ + CONFIG_CRYPTO_842 \ + CONFIG_842_COMPRESS \ + CONFIG_842_DECOMPRESS + FILES:= \ + $(LINUX_DIR)/crypto/842.ko \ + $(LINUX_DIR)/lib/842/842_compress.ko \ + $(LINUX_DIR)/lib/842/842_decompress.ko + AUTOLOAD:=$(call AutoProbe,842 842_compress 842_decompress) +endef + +define KernelPackage/lib-842/description + Kernel module for 842 compression/decompression support +endef + +$(eval $(call KernelPackage,lib-842)) + + define KernelPackage/lib-raid6 SUBMENU:=$(LIB_MENU) TITLE:=RAID6 algorithm support diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 878a60e66b..bd27f74d73 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -7562,6 +7562,7 @@ CONFIG_ZONE_DMA=y # CONFIG_ZPA2326 is not set # CONFIG_ZPOOL is not set # CONFIG_ZRAM is not set +# CONFIG_ZRAM_DEF_COMP_842 is not set # CONFIG_ZRAM_DEF_COMP_LZ4 is not set # CONFIG_ZRAM_DEF_COMP_LZ4HC is not set # CONFIG_ZRAM_DEF_COMP_LZO is not set From 2a20dc717a897efe54f241636ee1566b695dbc7d Mon Sep 17 00:00:00 2001 From: Edward Chow Date: Mon, 2 Jan 2023 19:24:20 +0800 Subject: [PATCH 15/33] ath79: calibrate dlink dir-825 c1 and dir-835 a1 with nvmem Driver for both soc (2.4GHz Wifi) and pci (5 GHz) now pull the calibration data from the nvmem subsystem. This allows us to move the userspace caldata extraction for the pci-e ath9k supported wifi into the device-tree definition of the device. Currently, "mac-address-ascii" cells only works for ethernet and wmac devices, so PCI ath9k device uses the old method to calibrate. Signed-off-by: Edward Chow --- .../linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi | 42 +++++++++++++++++-- .../generic/base-files/etc/board.d/02_network | 1 - .../etc/hotplug.d/firmware/10-ath9k-eeprom | 4 +- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi b/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi index 33c75f4967..8e21b0dd9e 100644 --- a/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi +++ b/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi @@ -29,6 +29,9 @@ /* default for ar934x, except for 1000M */ pll-data = <0x06000000 0x00000101 0x00001616>; + nvmem-cells = <&macaddr_lan>; + nvmem-cell-names = "mac-address-ascii"; + phy-mode = "rgmii"; phy-handle = <&phy0>; }; @@ -55,7 +58,13 @@ ath9k: wifi@0,0 { compatible = "pci168c,0030"; reg = <0x0000 0 0 0 0>; - qca,no-eeprom; + /* "mac-address-ascii" currently does not work for + ath9k pci devices. these below are retained for future + improvements. */ + /* nvmem-cells = <&macaddr_wan>, <&cal_art_5000>; + nvmem-cell-names = "mac-address-ascii", "calibration"; + mac-address-increment = <1>; */ + qca,no-eeprom; /* remove this when "mac-address-ascii" works */ gpio-controller; #gpio-cells = <2>; }; @@ -102,16 +111,40 @@ read-only; }; - partition@fe0000 { + mac: partition@fe0000 { label = "mac"; reg = <0xfe0000 0x010000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_lan: macaddr@4 { + reg = <0x4 0x11>; + }; + + macaddr_wan: macaddr@18 { + reg = <0x18 0x11>; + }; }; - partition@ff0000 { + art: partition@ff0000 { label = "art"; reg = <0xff0000 0x010000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_1000: cal@1000 { + reg = <0x1000 0x440>; + }; + + cal_art_5000: cal@5000 { + reg = <0x5000 0x440>; + }; }; }; }; @@ -127,5 +160,6 @@ &wmac { status = "okay"; - qca,no-eeprom; + nvmem-cells = <&macaddr_lan>, <&cal_art_1000>; + nvmem-cell-names = "mac-address-ascii", "calibration"; }; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 5db3a2d3c4..3330cd2b0a 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -639,7 +639,6 @@ ath79_setup_macs() ;; dlink,dir-825-c1|\ dlink,dir-835-a1) - lan_mac=$(mtd_get_mac_text "mac" 0x4) wan_mac=$(mtd_get_mac_text "mac" 0x18) ;; dlink,dir-842-c1|\ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 961f5f46aa..14c8eb7d64 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -23,9 +23,7 @@ case "$FIRMWARE" in avm,fritzdvbc) caldata_extract_reverse "urlader" 0x1541 0x440 ;; - dlink,dir-505|\ - dlink,dir-825-c1|\ - dlink,dir-835-a1) + dlink,dir-505) caldata_extract "art" 0x1000 0x440 ath9k_patch_mac $(mtd_get_mac_text "mac" 0x4) ;; From c7059c56a85567ce6bc943960168b19e2572508b Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Fri, 20 Jan 2023 03:16:33 +0000 Subject: [PATCH 16/33] ath79: improve support for Letv LBA-047-CH 1. Convert wireless calibration data to NVMEM. 2. Enable control green status LED and change default LED behaviors. The three LEDs of LBA-047-CH are in the same position, and the green LED will be completely covered by the other two LEDs. So don's use green LED as WAN indicator to ensure that only one LED is on at a time. LED Factory OpenWrt blue internet fail failsafe && upgrade green internet okay run red boot boot 3. Reduce the SPI clock to 30 MHz because the ath79 target does not support 50 MHz SPI operation well. Keep the fast-read support to ensure the spi-mem feature (b3f9842330) is enabled. 4. Remove unused package "uboot-envtools". 5. Split the factory image into two parts: rootfs and kernel. This change can reduce the factory image size and allow users to upgrade the OpenWrt kernel loader uImage (OKLI) independently. The new installation method: First, rename "squashfs-kernel.bin" to "openwrt-ar71xx-generic-ap147-16M-kernel.bin" and rename "rootfs.bin" to "openwrt-ar71xx-generic-ap147-16M-rootfs-squashfs.bin". Then we can press reset button for about 5 seconds to enter tftp download mode. Finally, set IP address to 192.168.67.100 and upload the above two parts via tftp server. Tested on Letv LBA-047-CH Signed-off-by: Shiji Yang --- .../ath79/dts/qca9531_letv_lba-047-ch.dts | 71 ++++++++++--------- target/linux/ath79/image/generic.mk | 10 +-- 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/target/linux/ath79/dts/qca9531_letv_lba-047-ch.dts b/target/linux/ath79/dts/qca9531_letv_lba-047-ch.dts index d65417c0d5..586facc9e5 100644 --- a/target/linux/ath79/dts/qca9531_letv_lba-047-ch.dts +++ b/target/linux/ath79/dts/qca9531_letv_lba-047-ch.dts @@ -4,6 +4,7 @@ #include #include +#include #include / { @@ -11,11 +12,11 @@ compatible = "letv,lba-047-ch", "qca,qca9531"; aliases { - led-boot = &led_status_red; - led-failsafe = &led_status_red; - led-running = &led_status_blue; - led-upgrade = &led_status_red; label-mac-device = ð0; + led-boot = &led_status_red; + led-failsafe = &led_status_blue; + led-running = &led_status_green; + led-upgrade = &led_status_blue; }; keys { @@ -31,16 +32,24 @@ leds { compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_wan_pin>; - - led_status_blue: status_blue { + led_status_blue: led-0 { label = "blue:status"; + color = ; + function = LED_FUNCTION_STATUS; gpios = <&gpio 13 GPIO_ACTIVE_LOW>; }; - led_status_red: status_red { + led_status_green: led-1 { + label = "green:status"; + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led_status_red: led-2 { label = "red:status"; + color = ; + function = LED_FUNCTION_STATUS; gpios = <&gpio 11 GPIO_ACTIVE_LOW>; }; }; @@ -64,20 +73,13 @@ }; }; -&pinmux { - /* GPIO 4: LED_LINK_5 (WAN) */ - led_wan_pin: pinmux_led_wan_pin { - pinctrl-single,bits = <0x04 0x0000002d 0x000000ff>; - }; -}; - &spi { status = "okay"; flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <50000000>; + spi-max-frequency = <30000000>; m25p,fast-read; partitions { @@ -112,10 +114,26 @@ reg = <0xe90000 0x160000>; }; - art: partition@ff0000 { + partition@ff0000 { label = "art"; reg = <0xff0000 0x10000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_art_6: macaddr@6 { + reg = <0x6 0x6>; + }; + + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; }; }; }; @@ -140,19 +158,6 @@ &wmac { status = "okay"; - mtd-cal-data = <&art 0x1000>; -}; - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; - }; - - macaddr_art_6: macaddr@6 { - reg = <0x6 0x6>; - }; + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; }; diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index b3b510a2ec..0837d37a30 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1645,13 +1645,15 @@ define Device/letv_lba-047-ch SOC := qca9531 DEVICE_VENDOR := Letv DEVICE_MODEL := LBA-047-CH + DEVICE_PACKAGES := -uboot-envtools + FACTORY_SIZE := 14528k IMAGE_SIZE := 15936k LOADER_FLASH_OFFS := 0x50000 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 - IMAGES += factory.bin - IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ - append-rootfs | pad-rootfs | check-size | pad-to 14528k | \ - append-loader-okli-uimage $(1) | pad-to 64k + IMAGES += kernel.bin rootfs.bin + IMAGE/kernel.bin := append-loader-okli-uimage $(1) | pad-to 64k + IMAGE/rootfs.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | check-size $$$$(FACTORY_SIZE) endef TARGET_DEVICES += letv_lba-047-ch From 67f283be4430ebfb46be6c00fcc7c12a6adabce3 Mon Sep 17 00:00:00 2001 From: Tom Herbers Date: Sat, 10 Sep 2022 16:45:42 +0200 Subject: [PATCH 17/33] ath79: add LTE packages for GL-XE300 Add LTE packages required for operating the LTE modems shipped with the GL-XE300. Example configuration for an unauthenticated dual-stack APN: network.wwan0=interface network.wwan0.proto='qmi' network.wwan0.device='/dev/cdc-wdm0' network.wwan0.apn='internet' network.wwan0.auth='none' network.wwan0.delay='10' network.wwan0.pdptype='IPV4V6' Signed-off-by: Tom Herbers --- target/linux/ath79/image/nand.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index ee14c005cc..c83beef952 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -199,7 +199,8 @@ define Device/glinet_gl-xe300 SOC := qca9531 DEVICE_VENDOR := GL.iNet DEVICE_MODEL := GL-XE300 - DEVICE_PACKAGES := kmod-usb2 block-mount kmod-usb-serial-ch341 + DEVICE_PACKAGES := kmod-usb2 block-mount kmod-usb-serial-ch341 \ + kmod-usb-net-qmi-wwan uqmi KERNEL_SIZE := 4096k IMAGE_SIZE := 131072k PAGESIZE := 2048 From 2fe29794b11928f363a38d312a53f56a0043df91 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Fri, 20 Jan 2023 16:09:09 +0300 Subject: [PATCH 18/33] ramips: use hex value in zyimage command for Keenetic KN-3010 This is cosmetic change. The hex value is related to the device model and more human friendly. Signed-off-by: Maxim Anisimov --- target/linux/ramips/image/mt7621.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 9d01399c5c..6d199b0d6a 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1304,7 +1304,7 @@ define Device/keenetic_kn-3010 DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to $$$$(BLOCKSIZE) | \ - check-size | zyimage -d 8400912 -v "KN-3010" + check-size | zyimage -d 0x803010 -v "KN-3010" endef TARGET_DEVICES += keenetic_kn-3010 From 3690c4a092e2590a2cd5d06855eb905012dced6b Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Fri, 20 Jan 2023 14:23:40 +0300 Subject: [PATCH 19/33] ramips: improve support for Zyxel Keenetic Extra II - drop unneeded default-state for led_power - concat firmware partitions to extend available free space - increase spi flash frequency to 32 Mhz (value from stock firmware bootlog) - drop broken-flash-reset because of onboard flash chip W25Q256FV has reset support - add compatible for pcie wifi according to kernel documetation - switch to wan mac address with offset 0x28 in rf-eeprom Signed-off-by: Maxim Anisimov --- .../dts/mt7628an_zyxel_keenetic-extra-ii.dts | 32 +++++++++++++------ target/linux/ramips/image/mt76x8.mk | 2 +- .../mt76x8/base-files/etc/board.d/02_network | 6 ++-- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts b/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts index d292b211af..c53289debf 100644 --- a/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts +++ b/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts @@ -46,7 +46,6 @@ led_power: power { label = "green:power"; gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - default-state = "keep"; }; internet { @@ -77,6 +76,23 @@ gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; }; }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &firmware2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x0 0x1d20000>; + }; + }; + }; }; &spi0 { @@ -85,8 +101,7 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <10000000>; - broken-flash-reset; + spi-max-frequency = <32000000>; partitions { compatible = "fixed-partitions"; @@ -106,14 +121,13 @@ }; factory: partition@40000 { - label = "factory"; + label = "rf-eeprom"; reg = <0x40000 0x10000>; read-only; }; - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; + firmware1: partition@50000 { + label = "firmware_1"; reg = <0x50000 0xe90000>; }; @@ -153,10 +167,9 @@ read-only; }; - partition@1050000 { + firmware2: partition@1050000 { label = "firmware_2"; reg = <0x1050000 0xe90000>; - read-only; }; partition@1ee0000 { @@ -189,6 +202,7 @@ &pcie0 { mt76@0,0 { + compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x8000>; ieee80211-freq-limit = <5000000 6000000>; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index f482872813..156aa634be 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -1029,7 +1029,7 @@ endef TARGET_DEVICES += zbtlink_zbt-we1226 define Device/zyxel_keenetic-extra-ii - IMAGE_SIZE := 14912k + IMAGE_SIZE := 29824k BLOCKSIZE := 64k DEVICE_VENDOR := ZyXEL DEVICE_MODEL := Keenetic Extra II diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 7570999a4e..bfd11fda2e 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -228,8 +228,7 @@ ramips_setup_macs() netgear,r6080|\ netgear,r6120|\ wrtnode,wrtnode2p|\ - wrtnode,wrtnode2r|\ - zyxel,keenetic-extra-ii) + wrtnode,wrtnode2r) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1) ;; hiwifi,hc5611|\ @@ -253,7 +252,8 @@ ramips_setup_macs() totolink,lr1200) wan_mac=$(mtd_get_mac_binary factory 0x2e) ;; - keenetic,kn-1613) + keenetic,kn-1613|\ + zyxel,keenetic-extra-ii) wan_mac=$(mtd_get_mac_binary rf-eeprom 0x28) ;; linksys,e5400) From 39e4f03fd335d5b5d1259d74fc3f00ad09e7796c Mon Sep 17 00:00:00 2001 From: Dmitry Sokolov Date: Mon, 16 Jan 2023 02:52:27 +0500 Subject: [PATCH 20/33] ramips: mt7621: add support for Xiaomi Mi Router 4A Gigabit v2 Device is the same as Xiaomi Mi Router 4A Gigabit, except of: - 5G WiFi is MT7663 - addresses of leds, wifi and eth ports are slightly changed Specs: SoC: MT7621 CPU: 2 x 880 MHz ROM: 16 MB RAM: 128 MB WLAN: MT7603, MT7663 MAC addresses: WAN **** factory 0xe006 (label) LAN *:f7 factory 0xe000 2.4 GHz *:f8 factory 0x0000+0x4 (mtd-eeprom+0x4) 5 GHz *:f9 factory 0x8000+0x4 (mtd-eeprom+0x4) Installation: Factory firmware is based on a custom OpenWrt 17.x. Installation is the same as for Xiaomi Mi Router 4A Gigabit. Probably the easiest way to install is to use the script from this repository: https://github.com/acecilia/OpenWRTInvasion/pull/155 In a more advanced case, you can do everything yourself: - gain access to the device through one of the exploits described in the link above - upload sysupgrade image to /tmp - overwrite stock firmware: # mtd -e OS1 -r write /tmp/sysupgrade.bin OS1 Recovery: Recovery procedure is the same as for Xiaomi Mi Router 4A Gigabit. Possible options can be found here: https://openwrt.org/inbox/toh/xiaomi/xiaomi_mi_router_4a_gigabit_edition One of the ways is to use another router with OpenWrt: - connect both routers by their LAN ports - download stock firmware from [1] - place it inside /tmp/test.bin on the main router - configure PXE/TFTP on the main router - power off 4Av2, hold Reset button, power on - as soon as image download via TFTP starts, Reset can be released - blinking blue wan LED will indicate the end of the flashing process, now router can be rebooted [1] http://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/r4av2/miwifi_r4av2_firmware_release_2.30.28.bin Signed-off-by: Dmitry Sokolov --- .../dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi | 138 +----------------- .../mt7621_xiaomi_mi-router-4a-common.dtsi | 138 ++++++++++++++++++ .../mt7621_xiaomi_mi-router-4a-gigabit-v2.dts | 80 ++++++++++ target/linux/ramips/image/mt7621.mk | 11 ++ .../mt7621/base-files/etc/board.d/01_leds | 3 + .../mt7621/base-files/etc/board.d/02_network | 3 +- 6 files changed, 241 insertions(+), 132 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi index a0ee79ae23..d05872337b 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi @@ -1,23 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "mt7621.dtsi" - -#include -#include +#include "mt7621_xiaomi_mi-router-4a-common.dtsi" / { aliases { - led-boot = &led_status_yellow; - led-failsafe = &led_status_yellow; - led-running = &led_status_blue; - led-upgrade = &led_status_yellow; label-mac-device = &gmac1; }; - chosen { - bootargs = "console=ttyS0,115200n8"; - }; - leds { compatible = "gpio-leds"; @@ -31,108 +20,16 @@ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; }; }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio 18 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <50000000>; - m25p,fast-read; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - partition@40000 { - label = "Bdata"; - reg = <0x40000 0x10000>; - read-only; - }; - - factory: partition@50000 { - label = "factory"; - reg = <0x50000 0x10000>; - read-only; - }; - - partition@60000 { - label = "crash"; - reg = <0x60000 0x10000>; - read-only; - }; - - partition@70000 { - label = "cfg_bak"; - reg = <0x70000 0x10000>; - read-only; - }; - - partition@80000 { - label = "overlay"; - reg = <0x80000 0x100000>; - read-only; - }; - - firmware: partition@180000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x180000 0xe80000>; - }; - }; - }; +&wifi0 { + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; -&pcie { - status = "okay"; -}; - -&pcie0 { - wifi@0,0 { - compatible = "pci14c3,7662"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; -}; - -&pcie1 { - wifi@0,0 { - compatible = "pci14c3,7603"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; -}; - -&gmac0 { - nvmem-cells = <&macaddr_factory_e000>; - nvmem-cell-names = "mac-address"; +&wifi1 { + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; }; &gmac1 { @@ -163,24 +60,3 @@ }; }; }; - -&state_default { - gpio { - groups = "jtag", "uart2", "uart3", "wdt"; - function = "gpio"; - }; -}; - -&factory { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_factory_e000: macaddr@e000 { - reg = <0xe000 0x6>; - }; - - macaddr_factory_e006: macaddr@e006 { - reg = <0xe006 0x6>; - }; -}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi new file mode 100644 index 0000000000..efc32733e9 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi @@ -0,0 +1,138 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_status_yellow; + led-failsafe = &led_status_yellow; + led-running = &led_status_blue; + led-upgrade = &led_status_yellow; + }; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + m25p,fast-read; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "Bdata"; + reg = <0x40000 0x10000>; + read-only; + }; + + factory: partition@50000 { + label = "factory"; + reg = <0x50000 0x10000>; + read-only; + }; + + partition@60000 { + label = "crash"; + reg = <0x60000 0x10000>; + read-only; + }; + + partition@70000 { + label = "cfg_bak"; + reg = <0x70000 0x10000>; + read-only; + }; + + partition@80000 { + label = "overlay"; + reg = <0x80000 0x100000>; + read-only; + }; + + firmware: partition@180000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x180000 0xe80000>; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi0: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + }; +}; + +&pcie1 { + wifi1: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&state_default { + gpio { + groups = "jtag", "uart2", "uart3", "wdt"; + function = "gpio"; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_e000: macaddr@e000 { + reg = <0xe000 0x6>; + }; + + macaddr_factory_e006: macaddr@e006 { + reg = <0xe006 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts new file mode 100644 index 0000000000..67ff6ea11e --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_xiaomi_mi-router-4a-common.dtsi" + +/ { + compatible = "xiaomi,mi-router-4a-gigabit-v2", "mediatek,mt7621-soc"; + model = "Xiaomi Mi Router 4A Gigabit Edition v2"; + + aliases { + label-mac-device = &wan; + }; + + leds { + compatible = "gpio-leds"; + + led_status_blue: status_blue { + label = "blue:status"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + led_status_yellow: status_yellow { + label = "yellow:status"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + wan_blue { + label = "blue:wan"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + wan_yellow { + label = "yellow:wan"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&partitions { + partition@180000 { + // size changed against to the common dtsi + reg = <0x180000 0xe70000>; + }; + + partition@ff0000 { + label = "Config"; + reg = <0xff0000 0x10000>; + read-only; + }; +}; + +&wifi0 { + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; +}; + +&wifi1 { + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + label = "lan1"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + wan: port@3 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 6d199b0d6a..3587fb613a 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2427,6 +2427,17 @@ define Device/xiaomi_mi-router-4a-gigabit endef TARGET_DEVICES += xiaomi_mi-router-4a-gigabit +define Device/xiaomi_mi-router-4a-gigabit-v2 + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 14784k + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router 4A + DEVICE_VARIANT := Gigabit Edition v2 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap +endef +TARGET_DEVICES += xiaomi_mi-router-4a-gigabit-v2 + define Device/xiaomi_mi-router-ac2100 $(Device/xiaomi_nand_separate) DEVICE_MODEL := Mi Router AC2100 diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 91f3fe6e93..597d7302ac 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -179,6 +179,9 @@ tplink,re650-v2) tplink,tl-wpa8631p-v3) ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan" ;; +xiaomi,mi-router-4a-gigabit-v2) + ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link" + ;; xiaomi,mi-router-ac2100) ucidef_set_led_netdev "wan-blue" "WAN (blue)" "blue:wan" "wan" ;; diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index ddbbf9891d..67f58b10b2 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -72,7 +72,8 @@ ramips_setup_interfaces() xiaomi,mi-router-3g|\ xiaomi,mi-router-3g-v2|\ xiaomi,mi-router-4|\ - xiaomi,mi-router-4a-gigabit) + xiaomi,mi-router-4a-gigabit|\ + xiaomi,mi-router-4a-gigabit-v2) ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" ;; bolt,arion) From d1893f1c889b991746f6546b98f009b4125d5046 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 28 Dec 2022 00:11:00 +0100 Subject: [PATCH 21/33] px5g-mbedtls: Use getrandom() Instead of accessing /dev/urandom use the getrandom syscall. This way we do not have to keep the file open all the time. This also fixes a compile error with glibc: -------- px5g-mbedtls.c: In function '_urandom': px5g-mbedtls.c:48:9: error: ignoring return value of 'read' declared with attribute 'warn_unused_result' [-Werror=unused-result] 48 | read(urandom_fd, out, len); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors -------- Signed-off-by: Hauke Mehrtens --- package/utils/px5g-mbedtls/px5g-mbedtls.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/package/utils/px5g-mbedtls/px5g-mbedtls.c b/package/utils/px5g-mbedtls/px5g-mbedtls.c index 0b72154509..4e0a73ab0a 100644 --- a/package/utils/px5g-mbedtls/px5g-mbedtls.c +++ b/package/utils/px5g-mbedtls/px5g-mbedtls.c @@ -20,6 +20,7 @@ */ #include +#include #include #include @@ -31,6 +32,7 @@ #include #include +#include #include #include #include @@ -40,12 +42,16 @@ #define PX5G_COPY "Copyright (c) 2009 Steven Barth " #define PX5G_LICENSE "Licensed under the GNU Lesser General Public License v2.1" -static int urandom_fd; static char buf[16384]; static int _urandom(void *ctx, unsigned char *out, size_t len) { - read(urandom_fd, out, len); + ssize_t ret; + + ret = getrandom(out, len, 0); + if (ret < 0 || (size_t)ret != len) + return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED; + return 0; } @@ -306,8 +312,6 @@ int selfsigned(char **arg) int main(int argc, char *argv[]) { - urandom_fd = open("/dev/urandom", O_RDONLY); - if (!argv[1]) { //Usage } else if (!strcmp(argv[1], "eckey")) { From 9902c8520be2418a6f57652ccda814ec9bbd322b Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Mon, 28 Nov 2022 10:06:07 +0100 Subject: [PATCH 22/33] uhttpd: clean up Makefile uhttpd's cmake options all default to ON. Either we set all of them or none if the defaults need to be changed. Let's go with the latter. Because support for all modules is always compiled in, remove two unused and useless config toggles. uhttpd detects and uses libcrypt itself, no need to add it here again. Signed-off-by: Andre Heider --- package/network/services/uhttpd/Makefile | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index 4090bf4579..3923e55b07 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -20,7 +20,6 @@ PKG_LICENSE:=ISC PKG_ASLR_PIE_REGULAR:=1 PKG_BUILD_DEPENDS = ustream-ssl -PKG_CONFIG_DEPENDS:= CONFIG_uhttpd_lua CONFIG_uhttpd_ucode include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -44,18 +43,6 @@ define Package/uhttpd/description HTTP daemon. endef -define Package/uhttpd/config - config uhttpd_lua - depends on PACKAGE_uhttpd-mod-lua - bool "Enable Integrated Lua interpreter" - default y - - config uhttpd_ucode - depends on PACKAGE_uhttpd-mod-ucode - bool "Enable Integrated ucode interpreter" - default y -endef - define Package/uhttpd/conffiles /etc/config/uhttpd /etc/uhttpd.crt @@ -101,17 +88,11 @@ ifneq ($(CONFIG_USE_GLIBC),) TARGET_CFLAGS += -D_DEFAULT_SOURCE endif -TARGET_LDFLAGS += -lcrypt - -CMAKE_OPTIONS += -DTLS_SUPPORT=on - define Package/uhttpd/install - $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config $(1)/usr/sbin $(INSTALL_BIN) ./files/uhttpd.init $(1)/etc/init.d/uhttpd - $(INSTALL_DIR) $(1)/etc/config $(INSTALL_CONF) ./files/uhttpd.config $(1)/etc/config/uhttpd $(VERSION_SED_SCRIPT) $(1)/etc/config/uhttpd - $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd $(1)/usr/sbin/uhttpd endef From b246385126ace0aeabacf9c94851d2f6dc26f912 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Mon, 28 Nov 2022 11:17:43 +0100 Subject: [PATCH 23/33] ucode: move to the lang submenu Just as lua or the various languages from the package feed. libucode is the exception, so move it to the libs menu instead. Signed-off-by: Andre Heider --- package/utils/ucode/Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index 3913fd2aa4..ddad598c7f 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -39,9 +39,10 @@ CMAKE_HOST_OPTIONS += \ define Package/ucode/default - SECTION:=utils - CATEGORY:=Utilities - TITLE:=ucode - Tiny scripting and templating language + SUBMENU:=ucode + SECTION:=lang + CATEGORY:=Languages + TITLE:=Tiny scripting and templating language endef define Package/ucode @@ -57,7 +58,10 @@ endef define Package/libucode $(Package/ucode/default) - TITLE+= - runtime library + SUBMENU:= + SECTION:=libs + CATEGORY:=Libraries + TITLE+= (library) ABI_VERSION:=$(PKG_ABI_VERSION) DEPENDS:=+libjson-c endef @@ -129,7 +133,7 @@ define Package/ucode-mod-struct endef define Package/ucode-mod-struct/description - The struct plugin implemnts Python 3 compatible struct.pack/unpack functionality. + The struct plugin implements Python 3 compatible struct.pack/unpack functionality. endef From 781a3ae5dc4755e5826862d023e149e68029d554 Mon Sep 17 00:00:00 2001 From: Chen Minqiang Date: Sun, 18 Dec 2022 08:57:20 +0800 Subject: [PATCH 24/33] base-files: fix nand_do_platform_check fail This change ensures compatibility with both types of sysupgrade-tar files. 1. For some boards like xiaomi,redmi-router-ax6s, sysupgrade-tar is pack in directory `vendor,name/` 2. For some boards like xiaomi,mi-router-3g, sysupgrade-tar is pack in directory `vendor_name/` Signed-off-by: Chen Minqiang --- package/base-files/files/lib/upgrade/nand.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh index a1dbd6e266..e7ac34f5d0 100644 --- a/package/base-files/files/lib/upgrade/nand.sh +++ b/package/base-files/files/lib/upgrade/nand.sh @@ -453,7 +453,11 @@ nand_do_platform_check() { local gz="$(identify_if_gzip "$file")" local file_type="$(identify "$file" "" "$gz")" - local control_length=$( (tar xO${gz}f "$file" "sysupgrade-$board_name/CONTROL" | wc -c) 2> /dev/null) + local control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//,/_}/CONTROL" | wc -c) 2> /dev/null) + + if [ "$control_length" = 0 ]; then + control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//_/,}/CONTROL" | wc -c) 2> /dev/null) + fi if [ "$control_length" != 0 ]; then nand_verify_tar_file "$file" "$gz" || return 1 From 016a7bd558183dae67e6ed3c29ee82d7b5c2f579 Mon Sep 17 00:00:00 2001 From: Chen Minqiang Date: Sun, 18 Dec 2022 08:59:44 +0800 Subject: [PATCH 25/33] mediatek: fix wrong return code in platform_check_image() Ensure that the platform_check_image() function returns an error code. Signed-off-by: Chen Minqiang --- .../linux/mediatek/filogic/base-files/lib/upgrade/platform.sh | 2 +- target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 93b202218a..9a389d59b1 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -95,7 +95,7 @@ platform_check_image() { ;; *) nand_do_platform_check "$board" "$1" - return 0 + return $? ;; esac diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh index d3d503dd1e..e3c66a3b01 100755 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh @@ -74,6 +74,7 @@ platform_check_image() { totolink,a8000ru|\ xiaomi,redmi-router-ax6s) nand_do_platform_check "$board" "$1" + return $? ;; *) [ "$magic" != "d00dfeed" ] && { From e51a57e1924176afe60cd6e76b7ee4eec3e6f6a2 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 29 Jan 2023 03:40:15 +0000 Subject: [PATCH 26/33] uboot-envtools: mt7622: bpi-r64: fix env selection Selecting the environment when booting from SD card has been broken by a previous commit. Fix it. Fixes: 84b5b0f88c ("uboot-envtools: mediatek/mt7622: don't rely on mapped rootfs") Signed-off-by: Daniel Golle --- package/boot/uboot-envtools/files/mediatek_mt7622 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package/boot/uboot-envtools/files/mediatek_mt7622 b/package/boot/uboot-envtools/files/mediatek_mt7622 index 9ad4c7c1a7..e01dcc4fef 100644 --- a/package/boot/uboot-envtools/files/mediatek_mt7622 +++ b/package/boot/uboot-envtools/files/mediatek_mt7622 @@ -17,13 +17,16 @@ linksys,e8450-ubi) ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1" ;; bananapi,bpi-r64) - case "$(cmdline_get_var root)" in - /dev/mmc*) + rootdev="$(cmdline_get_var root)" + rootdev="${rootdev##*/}" + rootdev="${rootdev%%p[0-9]*}" + case "$rootdev" in + mmc*) local envdev=$(find_mmc_part "ubootenv" $rootdev) ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1" ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1" ;; - /dev/ubi*) + ubi*) ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1" ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1" ;; From 90dbdb4941ba79055cc9327c6f7d503583020c96 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 29 Jan 2023 03:42:15 +0000 Subject: [PATCH 27/33] uboot-envtools: filogic: bpi-r3: fix env selection Selecting the environment when booting from SD card has been broken by a previous commit. Fix it. Fixes: f46355b4d7 ("uboot-envtools: mediatek_filogic: fix BPi-R3 when no OS is installed") Signed-off-by: Daniel Golle --- package/boot/uboot-envtools/files/mediatek_filogic | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 787fac8dd6..30cd0e8367 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -13,18 +13,21 @@ board=$(board_name) case "$board" in bananapi,bpi-r3) - case "$(cmdline_get_var root)" in - /dev/mmc*) + rootdev="$(cmdline_get_var root)" + rootdev="${rootdev##*/}" + rootdev="${rootdev%%p[0-9]*}" + case "$rootdev" in + mmc*) local envdev=$(find_mmc_part "ubootenv" $rootdev) ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1" ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1" ;; - /dev/mtd*) + mtd*) local envdev=/dev/mtd$(find_mtd_index "u-boot-env") ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1" ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1" ;; - /dev/ubi*) + ubi*) . /lib/upgrade/nand.sh local envubi=$(nand_find_ubi ubi) local envdev=/dev/$(nand_find_volume $envubi ubootenv) From 74e5e213da152bc3791fe0c664ffae9b0218bd55 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 27 Jan 2023 10:35:51 +0100 Subject: [PATCH 28/33] ucode: update to the latest version 1c8df08824ef style: add .editorconfig file ec167d39b803 nl80211: refactor command bitmask handling 6704ec0d5b29 nl80211: add support for registering an uloop based listener 48a6eac1da15 fs: implement `fs.pipe()` f1be0d725735 types: fix array unshift operations and add test coverage 941d14837faf Merge pull request #138 from nbd168/nl80211 Signed-off-by: Felix Fietkau --- package/utils/ucode/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index ddad598c7f..893daf99c7 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2023-01-09 -PKG_SOURCE_VERSION:=8dad974baa4696fcba85837fa70cde8b68dd7c12 -PKG_MIRROR_HASH:=91494352ac298ac2735d62355837a1f18e366999c9e940613e6fa3265edc0364 +PKG_SOURCE_DATE:=2023-01-23 +PKG_SOURCE_VERSION:=941d14837faf248eb2fa88dd0d5cfddeed044a15 +PKG_MIRROR_HASH:=19e8654bcb8a13a0a276a240a1da0f2815b0dd0d4f8bb8622e8de1040d5408a5 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC @@ -96,7 +96,7 @@ endef define Package/ucode-mod-nl80211 $(Package/ucode/default) TITLE+= (nl80211 module) - DEPENDS:=ucode +libnl-tiny + DEPENDS:=ucode +libnl-tiny +libubox endef define Package/ucode-mod-nl80211/description From 908397f6d2d167c02ee579b51c79ef03cdcdae9c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 27 Jan 2023 11:35:41 +0100 Subject: [PATCH 29/33] mac80211: backport napi_build_skb for 5.10 It is needed for an upcoming mt76 update Signed-off-by: Felix Fietkau --- .../patches/build/110-backport_napi_build_skb.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch diff --git a/package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch b/package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch new file mode 100644 index 0000000000..e2f6be5633 --- /dev/null +++ b/package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch @@ -0,0 +1,11 @@ +--- a/backport-include/linux/skbuff.h ++++ b/backport-include/linux/skbuff.h +@@ -140,4 +140,8 @@ static inline u64 skb_get_kcov_handle(st + } + #endif + ++#if LINUX_VERSION_IS_LESS(5,11,0) ++#define napi_build_skb build_skb ++#endif ++ + #endif /* __BACKPORT_SKBUFF_H */ From 638283d481a15769ba60ae42f11c6603f6c2dd11 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 27 Jan 2023 11:40:46 +0100 Subject: [PATCH 30/33] kernel: backport page pool fragment support from v5.15 Required for an upcoming mt76 update Signed-off-by: Felix Fietkau --- .../630-v5.15-page_pool_frag_support.patch | 798 ++++++++++++++++++ .../721-net-add-packet-mangeling.patch | 4 +- .../pending-5.10/655-increase_skb_pad.patch | 2 +- ...T-skip-GRO-for-foreign-MAC-addresses.patch | 2 +- 4 files changed, 802 insertions(+), 4 deletions(-) create mode 100644 target/linux/generic/backport-5.10/630-v5.15-page_pool_frag_support.patch diff --git a/target/linux/generic/backport-5.10/630-v5.15-page_pool_frag_support.patch b/target/linux/generic/backport-5.10/630-v5.15-page_pool_frag_support.patch new file mode 100644 index 0000000000..dbcdac8590 --- /dev/null +++ b/target/linux/generic/backport-5.10/630-v5.15-page_pool_frag_support.patch @@ -0,0 +1,798 @@ +--- a/include/net/page_pool.h ++++ b/include/net/page_pool.h +@@ -45,7 +45,10 @@ + * Please note DMA-sync-for-CPU is still + * device driver responsibility + */ +-#define PP_FLAG_ALL (PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV) ++#define PP_FLAG_PAGE_FRAG BIT(2) /* for page frag feature */ ++#define PP_FLAG_ALL (PP_FLAG_DMA_MAP |\ ++ PP_FLAG_DMA_SYNC_DEV |\ ++ PP_FLAG_PAGE_FRAG) + + /* + * Fast allocation side cache array/stack +@@ -65,7 +68,7 @@ + #define PP_ALLOC_CACHE_REFILL 64 + struct pp_alloc_cache { + u32 count; +- void *cache[PP_ALLOC_CACHE_SIZE]; ++ struct page *cache[PP_ALLOC_CACHE_SIZE]; + }; + + struct page_pool_params { +@@ -79,6 +82,22 @@ struct page_pool_params { + unsigned int offset; /* DMA addr offset */ + }; + ++ ++static inline int page_pool_ethtool_stats_get_count(void) ++{ ++ return 0; ++} ++ ++static inline u8 *page_pool_ethtool_stats_get_strings(u8 *data) ++{ ++ return data; ++} ++ ++static inline u64 *page_pool_ethtool_stats_get(u64 *data, void *stats) ++{ ++ return data; ++} ++ + struct page_pool { + struct page_pool_params p; + +@@ -88,6 +107,9 @@ struct page_pool { + unsigned long defer_warn; + + u32 pages_state_hold_cnt; ++ unsigned int frag_offset; ++ struct page *frag_page; ++ long frag_users; + + /* + * Data structure for allocation side +@@ -137,6 +159,18 @@ static inline struct page *page_pool_dev + return page_pool_alloc_pages(pool, gfp); + } + ++struct page *page_pool_alloc_frag(struct page_pool *pool, unsigned int *offset, ++ unsigned int size, gfp_t gfp); ++ ++static inline struct page *page_pool_dev_alloc_frag(struct page_pool *pool, ++ unsigned int *offset, ++ unsigned int size) ++{ ++ gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN); ++ ++ return page_pool_alloc_frag(pool, offset, size, gfp); ++} ++ + /* get the stored dma direction. A driver might decide to treat this locally and + * avoid the extra cache line from page_pool to determine the direction + */ +@@ -146,6 +180,8 @@ inline enum dma_data_direction page_pool + return pool->p.dma_dir; + } + ++bool page_pool_return_skb_page(struct page *page); ++ + struct page_pool *page_pool_create(const struct page_pool_params *params); + + #ifdef CONFIG_PAGE_POOL +@@ -165,6 +201,7 @@ static inline void page_pool_release_pag + struct page *page) + { + } ++ + #endif + + void page_pool_put_page(struct page_pool *pool, struct page *page, +@@ -189,19 +226,48 @@ static inline void page_pool_recycle_dir + page_pool_put_full_page(pool, page, true); + } + ++#define PAGE_POOL_DMA_USE_PP_FRAG_COUNT \ ++ (sizeof(dma_addr_t) > sizeof(unsigned long)) ++ + static inline dma_addr_t page_pool_get_dma_addr(struct page *page) + { +- dma_addr_t ret = page->dma_addr[0]; +- if (sizeof(dma_addr_t) > sizeof(unsigned long)) +- ret |= (dma_addr_t)page->dma_addr[1] << 16 << 16; ++ dma_addr_t ret = page->dma_addr; ++ ++ if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT) ++ ret |= (dma_addr_t)page->dma_addr_upper << 16 << 16; ++ + return ret; + } + + static inline void page_pool_set_dma_addr(struct page *page, dma_addr_t addr) + { +- page->dma_addr[0] = addr; +- if (sizeof(dma_addr_t) > sizeof(unsigned long)) +- page->dma_addr[1] = upper_32_bits(addr); ++ page->dma_addr = addr; ++ if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT) ++ page->dma_addr_upper = upper_32_bits(addr); ++} ++ ++static inline void page_pool_set_frag_count(struct page *page, long nr) ++{ ++ atomic_long_set(&page->pp_frag_count, nr); ++} ++ ++static inline long page_pool_atomic_sub_frag_count_return(struct page *page, ++ long nr) ++{ ++ long ret; ++ ++ /* As suggested by Alexander, atomic_long_read() may cover up the ++ * reference count errors, so avoid calling atomic_long_read() in ++ * the cases of freeing or draining the page_frags, where we would ++ * not expect it to match or that are slowpath anyway. ++ */ ++ if (__builtin_constant_p(nr) && ++ atomic_long_read(&page->pp_frag_count) == nr) ++ return 0; ++ ++ ret = atomic_long_sub_return(nr, &page->pp_frag_count); ++ WARN_ON(ret < 0); ++ return ret; + } + + static inline bool is_page_pool_compiled_in(void) +@@ -225,4 +291,23 @@ static inline void page_pool_nid_changed + if (unlikely(pool->p.nid != new_nid)) + page_pool_update_nid(pool, new_nid); + } ++ ++static inline void page_pool_ring_lock(struct page_pool *pool) ++ __acquires(&pool->ring.producer_lock) ++{ ++ if (in_serving_softirq()) ++ spin_lock(&pool->ring.producer_lock); ++ else ++ spin_lock_bh(&pool->ring.producer_lock); ++} ++ ++static inline void page_pool_ring_unlock(struct page_pool *pool) ++ __releases(&pool->ring.producer_lock) ++{ ++ if (in_serving_softirq()) ++ spin_unlock(&pool->ring.producer_lock); ++ else ++ spin_unlock_bh(&pool->ring.producer_lock); ++} ++ + #endif /* _NET_PAGE_POOL_H */ +--- a/net/core/page_pool.c ++++ b/net/core/page_pool.c +@@ -11,16 +11,22 @@ + #include + + #include ++#include ++ + #include + #include + #include + #include /* for __put_page() */ ++#include ++#include + + #include + + #define DEFER_TIME (msecs_to_jiffies(1000)) + #define DEFER_WARN_INTERVAL (60 * HZ) + ++#define BIAS_MAX LONG_MAX ++ + static int page_pool_init(struct page_pool *pool, + const struct page_pool_params *params) + { +@@ -64,6 +70,10 @@ static int page_pool_init(struct page_po + */ + } + ++ if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT && ++ pool->p.flags & PP_FLAG_PAGE_FRAG) ++ return -EINVAL; ++ + if (ptr_ring_init(&pool->ring, ring_qsize, GFP_KERNEL) < 0) + return -ENOMEM; + +@@ -180,40 +190,10 @@ static void page_pool_dma_sync_for_devic + pool->p.dma_dir); + } + +-/* slow path */ +-noinline +-static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool, +- gfp_t _gfp) ++static bool page_pool_dma_map(struct page_pool *pool, struct page *page) + { +- struct page *page; +- gfp_t gfp = _gfp; + dma_addr_t dma; + +- /* We could always set __GFP_COMP, and avoid this branch, as +- * prep_new_page() can handle order-0 with __GFP_COMP. +- */ +- if (pool->p.order) +- gfp |= __GFP_COMP; +- +- /* FUTURE development: +- * +- * Current slow-path essentially falls back to single page +- * allocations, which doesn't improve performance. This code +- * need bulk allocation support from the page allocator code. +- */ +- +- /* Cache was empty, do real allocation */ +-#ifdef CONFIG_NUMA +- page = alloc_pages_node(pool->p.nid, gfp, pool->p.order); +-#else +- page = alloc_pages(gfp, pool->p.order); +-#endif +- if (!page) +- return NULL; +- +- if (!(pool->p.flags & PP_FLAG_DMA_MAP)) +- goto skip_dma_map; +- + /* Setup DMA mapping: use 'struct page' area for storing DMA-addr + * since dma_addr_t can be either 32 or 64 bits and does not always fit + * into page private data (i.e 32bit cpu with 64bit DMA caps) +@@ -222,22 +202,53 @@ static struct page *__page_pool_alloc_pa + dma = dma_map_page_attrs(pool->p.dev, page, 0, + (PAGE_SIZE << pool->p.order), + pool->p.dma_dir, DMA_ATTR_SKIP_CPU_SYNC); +- if (dma_mapping_error(pool->p.dev, dma)) { +- put_page(page); +- return NULL; +- } ++ if (dma_mapping_error(pool->p.dev, dma)) ++ return false; ++ + page_pool_set_dma_addr(page, dma); + + if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV) + page_pool_dma_sync_for_device(pool, page, pool->p.max_len); + +-skip_dma_map: ++ return true; ++} ++ ++static void page_pool_set_pp_info(struct page_pool *pool, ++ struct page *page) ++{ ++ page->pp = pool; ++ page->pp_magic |= PP_SIGNATURE; ++} ++ ++static void page_pool_clear_pp_info(struct page *page) ++{ ++ page->pp_magic = 0; ++ page->pp = NULL; ++} ++ ++/* slow path */ ++noinline ++static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool, ++ gfp_t gfp) ++{ ++ struct page *page; ++ ++ gfp |= __GFP_COMP; ++ page = alloc_pages_node(pool->p.nid, gfp, pool->p.order); ++ if (unlikely(!page)) ++ return NULL; ++ ++ if ((pool->p.flags & PP_FLAG_DMA_MAP) && ++ unlikely(!page_pool_dma_map(pool, page))) { ++ put_page(page); ++ return NULL; ++ } ++ ++ page_pool_set_pp_info(pool, page); ++ + /* Track how many pages are held 'in-flight' */ + pool->pages_state_hold_cnt++; +- + trace_page_pool_state_hold(pool, page, pool->pages_state_hold_cnt); +- +- /* When page just alloc'ed is should/must have refcnt 1. */ + return page; + } + +@@ -302,10 +313,12 @@ void page_pool_release_page(struct page_ + DMA_ATTR_SKIP_CPU_SYNC); + page_pool_set_dma_addr(page, 0); + skip_dma_unmap: ++ page_pool_clear_pp_info(page); ++ + /* This may be the last page returned, releasing the pool, so + * it is not safe to reference pool afterwards. + */ +- count = atomic_inc_return(&pool->pages_state_release_cnt); ++ count = atomic_inc_return_relaxed(&pool->pages_state_release_cnt); + trace_page_pool_state_release(pool, page, count); + } + EXPORT_SYMBOL(page_pool_release_page); +@@ -331,7 +344,10 @@ static bool page_pool_recycle_in_ring(st + else + ret = ptr_ring_produce_bh(&pool->ring, page); + +- return (ret == 0) ? true : false; ++ if (!ret) ++ return true; ++ ++ return false; + } + + /* Only allow direct recycling in special circumstances, into the +@@ -350,46 +366,43 @@ static bool page_pool_recycle_in_cache(s + return true; + } + +-/* page is NOT reusable when: +- * 1) allocated when system is under some pressure. (page_is_pfmemalloc) +- */ +-static bool pool_page_reusable(struct page_pool *pool, struct page *page) +-{ +- return !page_is_pfmemalloc(page); +-} +- + /* If the page refcnt == 1, this will try to recycle the page. + * if PP_FLAG_DMA_SYNC_DEV is set, we'll try to sync the DMA area for + * the configured size min(dma_sync_size, pool->max_len). + * If the page refcnt != 1, then the page will be returned to memory + * subsystem. + */ +-void page_pool_put_page(struct page_pool *pool, struct page *page, +- unsigned int dma_sync_size, bool allow_direct) +-{ ++static __always_inline struct page * ++__page_pool_put_page(struct page_pool *pool, struct page *page, ++ unsigned int dma_sync_size, bool allow_direct) ++{ ++ /* It is not the last user for the page frag case */ ++ if (pool->p.flags & PP_FLAG_PAGE_FRAG && ++ page_pool_atomic_sub_frag_count_return(page, 1)) ++ return NULL; ++ + /* This allocator is optimized for the XDP mode that uses + * one-frame-per-page, but have fallbacks that act like the + * regular page allocator APIs. + * + * refcnt == 1 means page_pool owns page, and can recycle it. ++ * ++ * page is NOT reusable when allocated when system is under ++ * some pressure. (page_is_pfmemalloc) + */ +- if (likely(page_ref_count(page) == 1 && +- pool_page_reusable(pool, page))) { ++ if (likely(page_ref_count(page) == 1 && !page_is_pfmemalloc(page))) { + /* Read barrier done in page_ref_count / READ_ONCE */ + + if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV) + page_pool_dma_sync_for_device(pool, page, + dma_sync_size); + +- if (allow_direct && in_serving_softirq()) +- if (page_pool_recycle_in_cache(page, pool)) +- return; ++ if (allow_direct && in_serving_softirq() && ++ page_pool_recycle_in_cache(page, pool)) ++ return NULL; + +- if (!page_pool_recycle_in_ring(pool, page)) { +- /* Cache full, fallback to free pages */ +- page_pool_return_page(pool, page); +- } +- return; ++ /* Page found as candidate for recycling */ ++ return page; + } + /* Fallback/non-XDP mode: API user have elevated refcnt. + * +@@ -407,9 +420,98 @@ void page_pool_put_page(struct page_pool + /* Do not replace this with page_pool_return_page() */ + page_pool_release_page(pool, page); + put_page(page); ++ ++ return NULL; ++} ++ ++void page_pool_put_page(struct page_pool *pool, struct page *page, ++ unsigned int dma_sync_size, bool allow_direct) ++{ ++ page = __page_pool_put_page(pool, page, dma_sync_size, allow_direct); ++ if (page && !page_pool_recycle_in_ring(pool, page)) ++ /* Cache full, fallback to free pages */ ++ page_pool_return_page(pool, page); + } + EXPORT_SYMBOL(page_pool_put_page); + ++static struct page *page_pool_drain_frag(struct page_pool *pool, ++ struct page *page) ++{ ++ long drain_count = BIAS_MAX - pool->frag_users; ++ ++ /* Some user is still using the page frag */ ++ if (likely(page_pool_atomic_sub_frag_count_return(page, ++ drain_count))) ++ return NULL; ++ ++ if (page_ref_count(page) == 1 && !page_is_pfmemalloc(page)) { ++ if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV) ++ page_pool_dma_sync_for_device(pool, page, -1); ++ ++ return page; ++ } ++ ++ page_pool_return_page(pool, page); ++ return NULL; ++} ++ ++static void page_pool_free_frag(struct page_pool *pool) ++{ ++ long drain_count = BIAS_MAX - pool->frag_users; ++ struct page *page = pool->frag_page; ++ ++ pool->frag_page = NULL; ++ ++ if (!page || ++ page_pool_atomic_sub_frag_count_return(page, drain_count)) ++ return; ++ ++ page_pool_return_page(pool, page); ++} ++ ++struct page *page_pool_alloc_frag(struct page_pool *pool, ++ unsigned int *offset, ++ unsigned int size, gfp_t gfp) ++{ ++ unsigned int max_size = PAGE_SIZE << pool->p.order; ++ struct page *page = pool->frag_page; ++ ++ if (WARN_ON(!(pool->p.flags & PP_FLAG_PAGE_FRAG) || ++ size > max_size)) ++ return NULL; ++ ++ size = ALIGN(size, dma_get_cache_alignment()); ++ *offset = pool->frag_offset; ++ ++ if (page && *offset + size > max_size) { ++ page = page_pool_drain_frag(pool, page); ++ if (page) ++ goto frag_reset; ++ } ++ ++ if (!page) { ++ page = page_pool_alloc_pages(pool, gfp); ++ if (unlikely(!page)) { ++ pool->frag_page = NULL; ++ return NULL; ++ } ++ ++ pool->frag_page = page; ++ ++frag_reset: ++ pool->frag_users = 1; ++ *offset = 0; ++ pool->frag_offset = size; ++ page_pool_set_frag_count(page, BIAS_MAX); ++ return page; ++ } ++ ++ pool->frag_users++; ++ pool->frag_offset = *offset + size; ++ return page; ++} ++EXPORT_SYMBOL(page_pool_alloc_frag); ++ + static void page_pool_empty_ring(struct page_pool *pool) + { + struct page *page; +@@ -515,6 +617,8 @@ void page_pool_destroy(struct page_pool + if (!page_pool_put(pool)) + return; + ++ page_pool_free_frag(pool); ++ + if (!page_pool_release(pool)) + return; + +@@ -541,3 +645,32 @@ void page_pool_update_nid(struct page_po + } + } + EXPORT_SYMBOL(page_pool_update_nid); ++ ++bool page_pool_return_skb_page(struct page *page) ++{ ++ struct page_pool *pp; ++ ++ page = compound_head(page); ++ ++ /* page->pp_magic is OR'ed with PP_SIGNATURE after the allocation ++ * in order to preserve any existing bits, such as bit 0 for the ++ * head page of compound page and bit 1 for pfmemalloc page, so ++ * mask those bits for freeing side when doing below checking, ++ * and page_is_pfmemalloc() is checked in __page_pool_put_page() ++ * to avoid recycling the pfmemalloc page. ++ */ ++ if (unlikely((page->pp_magic & ~0x3UL) != PP_SIGNATURE)) ++ return false; ++ ++ pp = page->pp; ++ ++ /* Driver set this to memory recycling info. Reset it on recycle. ++ * This will *not* work for NIC using a split-page memory model. ++ * The page will be returned to the pool here regardless of the ++ * 'flipped' fragment being in use or not. ++ */ ++ page_pool_put_full_page(pp, page, false); ++ ++ return true; ++} ++EXPORT_SYMBOL(page_pool_return_skb_page); +--- a/include/linux/mm_types.h ++++ b/include/linux/mm_types.h +@@ -97,10 +97,25 @@ struct page { + }; + struct { /* page_pool used by netstack */ + /** +- * @dma_addr: might require a 64-bit value on +- * 32-bit architectures. ++ * @pp_magic: magic value to avoid recycling non ++ * page_pool allocated pages. + */ +- unsigned long dma_addr[2]; ++ unsigned long pp_magic; ++ struct page_pool *pp; ++ unsigned long _pp_mapping_pad; ++ unsigned long dma_addr; ++ union { ++ /** ++ * dma_addr_upper: might require a 64-bit ++ * value on 32-bit architectures. ++ */ ++ unsigned long dma_addr_upper; ++ /** ++ * For frag page support, not supported in ++ * 32-bit architectures with 64-bit DMA. ++ */ ++ atomic_long_t pp_frag_count; ++ }; + }; + struct { /* slab, slob and slub */ + union { +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -594,13 +594,22 @@ static void skb_clone_fraglist(struct sk + skb_get(list); + } + ++static bool skb_pp_recycle(struct sk_buff *skb, void *data) ++{ ++ if (!IS_ENABLED(CONFIG_PAGE_POOL) || !skb->pp_recycle) ++ return false; ++ return page_pool_return_skb_page(virt_to_page(data)); ++} ++ + static void skb_free_head(struct sk_buff *skb) + { + unsigned char *head = skb->head; + +- if (skb->head_frag) ++ if (skb->head_frag) { ++ if (skb_pp_recycle(skb, head)) ++ return; + skb_free_frag(head); +- else ++ } else + kfree(head); + } + +@@ -612,16 +621,27 @@ static void skb_release_data(struct sk_b + if (skb->cloned && + atomic_sub_return(skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1, + &shinfo->dataref)) +- return; ++ goto exit; + + for (i = 0; i < shinfo->nr_frags; i++) +- __skb_frag_unref(&shinfo->frags[i]); ++ __skb_frag_unref(&shinfo->frags[i], skb->pp_recycle); + + if (shinfo->frag_list) + kfree_skb_list(shinfo->frag_list); + + skb_zcopy_clear(skb, true); + skb_free_head(skb); ++exit: ++ /* When we clone an SKB we copy the reycling bit. The pp_recycle ++ * bit is only set on the head though, so in order to avoid races ++ * while trying to recycle fragments on __skb_frag_unref() we need ++ * to make one SKB responsible for triggering the recycle path. ++ * So disable the recycling bit if an SKB is cloned and we have ++ * additional references to to the fragmented part of the SKB. ++ * Eventually the last SKB will have the recycling bit set and it's ++ * dataref set to 0, which will trigger the recycling ++ */ ++ skb->pp_recycle = 0; + } + + /* +@@ -1003,6 +1023,7 @@ static struct sk_buff *__skb_clone(struc + n->nohdr = 0; + n->peeked = 0; + C(pfmemalloc); ++ C(pp_recycle); + n->destructor = NULL; + C(tail); + C(end); +@@ -3421,7 +3442,7 @@ int skb_shift(struct sk_buff *tgt, struc + fragto = &skb_shinfo(tgt)->frags[merge]; + + skb_frag_size_add(fragto, skb_frag_size(fragfrom)); +- __skb_frag_unref(fragfrom); ++ __skb_frag_unref(fragfrom, skb->pp_recycle); + } + + /* Reposition in the original skb */ +@@ -5189,6 +5210,20 @@ bool skb_try_coalesce(struct sk_buff *to + if (skb_cloned(to)) + return false; + ++ /* In general, avoid mixing slab allocated and page_pool allocated ++ * pages within the same SKB. However when @to is not pp_recycle and ++ * @from is cloned, we can transition frag pages from page_pool to ++ * reference counted. ++ * ++ * On the other hand, don't allow coalescing two pp_recycle SKBs if ++ * @from is cloned, in case the SKB is using page_pool fragment ++ * references (PP_FLAG_PAGE_FRAG). Since we only take full page ++ * references for cloned SKBs at the moment that would result in ++ * inconsistent reference counts. ++ */ ++ if (to->pp_recycle != (from->pp_recycle && !skb_cloned(from))) ++ return false; ++ + if (len <= skb_tailroom(to)) { + if (len) + BUG_ON(skb_copy_bits(from, 0, skb_put(to, len), len)); +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + #if IS_ENABLED(CONFIG_NF_CONNTRACK) + #include + #endif +@@ -786,7 +787,8 @@ struct sk_buff { + fclone:2, + peeked:1, + head_frag:1, +- pfmemalloc:1; ++ pfmemalloc:1, ++ pp_recycle:1; /* page_pool recycle indicator */ + #ifdef CONFIG_SKB_EXTENSIONS + __u8 active_extensions; + #endif +@@ -3029,9 +3031,15 @@ static inline void skb_frag_ref(struct s + * + * Releases a reference on the paged fragment @frag. + */ +-static inline void __skb_frag_unref(skb_frag_t *frag) ++static inline void __skb_frag_unref(skb_frag_t *frag, bool recycle) + { +- put_page(skb_frag_page(frag)); ++ struct page *page = skb_frag_page(frag); ++ ++#ifdef CONFIG_PAGE_POOL ++ if (recycle && page_pool_return_skb_page(page)) ++ return; ++#endif ++ put_page(page); + } + + /** +@@ -3043,7 +3051,7 @@ static inline void __skb_frag_unref(skb_ + */ + static inline void skb_frag_unref(struct sk_buff *skb, int f) + { +- __skb_frag_unref(&skb_shinfo(skb)->frags[f]); ++ __skb_frag_unref(&skb_shinfo(skb)->frags[f], skb->pp_recycle); + } + + /** +@@ -4642,5 +4650,12 @@ static inline u64 skb_get_kcov_handle(st + #endif + } + ++#ifdef CONFIG_PAGE_POOL ++static inline void skb_mark_for_recycle(struct sk_buff *skb) ++{ ++ skb->pp_recycle = 1; ++} ++#endif ++ + #endif /* __KERNEL__ */ + #endif /* _LINUX_SKBUFF_H */ +--- a/drivers/net/ethernet/marvell/sky2.c ++++ b/drivers/net/ethernet/marvell/sky2.c +@@ -2501,7 +2501,7 @@ static void skb_put_frags(struct sk_buff + + if (length == 0) { + /* don't need this page */ +- __skb_frag_unref(frag); ++ __skb_frag_unref(frag, false); + --skb_shinfo(skb)->nr_frags; + } else { + size = min(length, (unsigned) PAGE_SIZE); +--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c ++++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c +@@ -526,7 +526,7 @@ static int mlx4_en_complete_rx_desc(stru + fail: + while (nr > 0) { + nr--; +- __skb_frag_unref(skb_shinfo(skb)->frags + nr); ++ __skb_frag_unref(skb_shinfo(skb)->frags + nr, false); + } + return 0; + } +--- a/net/tls/tls_device.c ++++ b/net/tls/tls_device.c +@@ -131,7 +131,7 @@ static void destroy_record(struct tls_re + int i; + + for (i = 0; i < record->num_frags; i++) +- __skb_frag_unref(&record->frags[i]); ++ __skb_frag_unref(&record->frags[i], false); + kfree(record); + } + +--- a/include/linux/poison.h ++++ b/include/linux/poison.h +@@ -82,4 +82,7 @@ + /********** security/ **********/ + #define KEY_DESTROY 0xbd + ++/********** net/core/page_pool.c **********/ ++#define PP_SIGNATURE (0x40 + POISON_POINTER_DELTA) ++ + #endif +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -1602,7 +1602,7 @@ static inline bool page_is_pfmemalloc(st + * Page index cannot be this large so this must be + * a pfmemalloc page. + */ +- return page->index == -1UL; ++ return (uintptr_t)page->lru.next & BIT(1); + } + + /* +@@ -1611,12 +1611,12 @@ static inline bool page_is_pfmemalloc(st + */ + static inline void set_page_pfmemalloc(struct page *page) + { +- page->index = -1UL; ++ page->lru.next = (void *)BIT(1); + } + + static inline void clear_page_pfmemalloc(struct page *page) + { +- page->index = 0; ++ page->lru.next = NULL; + } + + /* diff --git a/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch index 41b85b1f7c..a4ce0d1dbc 100644 --- a/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch @@ -60,7 +60,7 @@ Signed-off-by: Felix Fietkau */ --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2725,6 +2725,10 @@ static inline int pskb_trim(struct sk_bu +@@ -2727,6 +2727,10 @@ static inline int pskb_trim(struct sk_bu return (len < skb->len) ? __pskb_trim(skb, len) : 0; } @@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau /** * pskb_trim_unique - remove end from a paged unique (not cloned) buffer * @skb: buffer to alter -@@ -2856,16 +2860,6 @@ static inline struct sk_buff *dev_alloc_ +@@ -2858,16 +2862,6 @@ static inline struct sk_buff *dev_alloc_ } diff --git a/target/linux/generic/pending-5.10/655-increase_skb_pad.patch b/target/linux/generic/pending-5.10/655-increase_skb_pad.patch index 3655f75a5c..0b25a76416 100644 --- a/target/linux/generic/pending-5.10/655-increase_skb_pad.patch +++ b/target/linux/generic/pending-5.10/655-increase_skb_pad.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2691,7 +2691,7 @@ static inline int pskb_network_may_pull( +@@ -2693,7 +2693,7 @@ static inline int pskb_network_may_pull( * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) */ #ifndef NET_SKB_PAD diff --git a/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index f1fc063a45..10f5c9b9c6 100644 --- a/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -22,7 +22,7 @@ Signed-off-by: Felix Fietkau #endif --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -861,6 +861,7 @@ struct sk_buff { +@@ -863,6 +863,7 @@ struct sk_buff { __u8 decrypted:1; #endif __u8 scm_io_uring:1; From 2770cbe63ff32a8006b7c6ea4e0a16eebd0f0f5f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 26 Jan 2023 20:44:21 +0100 Subject: [PATCH 31/33] kernel: add fix for a page pool related crash on GRO Needed for upcoming mt76 page pool support Signed-off-by: Felix Fietkau --- ...pool-and-page-referenced-frags-in-GR.patch | 35 +++++++++++++++++++ ...pool-and-page-referenced-frags-in-GR.patch | 35 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 target/linux/generic/pending-5.10/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch create mode 100644 target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch diff --git a/target/linux/generic/pending-5.10/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch b/target/linux/generic/pending-5.10/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch new file mode 100644 index 0000000000..5a145abed3 --- /dev/null +++ b/target/linux/generic/pending-5.10/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch @@ -0,0 +1,35 @@ +From: Alexander Duyck +Date: Thu, 26 Jan 2023 11:06:59 -0800 +Subject: [PATCH] skb: Do mix page pool and page referenced frags in GRO + +GSO should not merge page pool recycled frames with standard reference +counted frames. Traditionally this didn't occur, at least not often. +However as we start looking at adding support for wireless adapters there +becomes the potential to mix the two due to A-MSDU repartitioning frames in +the receive path. There are possibly other places where this may have +occurred however I suspect they must be few and far between as we have not +seen this issue until now. + +Fixes: 53e0961da1c7 ("page_pool: add frag page recycling support in page pool") +Reported-by: Felix Fietkau +Signed-off-by: Alexander Duyck +--- + +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -4166,6 +4166,15 @@ int skb_gro_receive(struct sk_buff *p, s + if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush)) + return -E2BIG; + ++ /* Do not splice page pool based packets w/ non-page pool ++ * packets. This can result in reference count issues as page ++ * pool pages will not decrement the reference count and will ++ * instead be immediately returned to the pool or have frag ++ * count decremented. ++ */ ++ if (p->pp_recycle != skb->pp_recycle) ++ return -ETOOMANYREFS; ++ + lp = NAPI_GRO_CB(p)->last; + pinfo = skb_shinfo(lp); + diff --git a/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch b/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch new file mode 100644 index 0000000000..60c7721df0 --- /dev/null +++ b/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch @@ -0,0 +1,35 @@ +From: Alexander Duyck +Date: Thu, 26 Jan 2023 11:06:59 -0800 +Subject: [PATCH] skb: Do mix page pool and page referenced frags in GRO + +GSO should not merge page pool recycled frames with standard reference +counted frames. Traditionally this didn't occur, at least not often. +However as we start looking at adding support for wireless adapters there +becomes the potential to mix the two due to A-MSDU repartitioning frames in +the receive path. There are possibly other places where this may have +occurred however I suspect they must be few and far between as we have not +seen this issue until now. + +Fixes: 53e0961da1c7 ("page_pool: add frag page recycling support in page pool") +Reported-by: Felix Fietkau +Signed-off-by: Alexander Duyck +--- + +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -4348,6 +4348,15 @@ int skb_gro_receive(struct sk_buff *p, s + if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush)) + return -E2BIG; + ++ /* Do not splice page pool based packets w/ non-page pool ++ * packets. This can result in reference count issues as page ++ * pool pages will not decrement the reference count and will ++ * instead be immediately returned to the pool or have frag ++ * count decremented. ++ */ ++ if (p->pp_recycle != skb->pp_recycle) ++ return -ETOOMANYREFS; ++ + lp = NAPI_GRO_CB(p)->last; + pinfo = skb_shinfo(lp); + From 83d3e255f1cc7ca59e51f02857cef2e004d946dc Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 27 Jan 2023 19:07:00 +0100 Subject: [PATCH 32/33] bridger: update to the latest version 8be8bb9df789 nl: fix accessing hairpin mode and isolated from the right attribute set Signed-off-by: Felix Fietkau --- package/network/services/bridger/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/bridger/Makefile b/package/network/services/bridger/Makefile index 39cbd2c560..be4ae3bc42 100644 --- a/package/network/services/bridger/Makefile +++ b/package/network/services/bridger/Makefile @@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bridger PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/nbd168/bridger -PKG_SOURCE_DATE:=2023-01-03 -PKG_SOURCE_VERSION:=978c1f9eed07504cc0b84f72ee7384aab722386a -PKG_MIRROR_HASH:=2a019b188d8de2fdc95453529d1820b0a7a5576adf161bd19e182c9c1c2b2c85 +PKG_SOURCE_DATE:=2023-01-27 +PKG_SOURCE_VERSION:=8be8bb9df789b53a68f08298f610648ebded6063 +PKG_MIRROR_HASH:=d4f47009bb00c4f129d0959cb00ed90bc14bfe5dd0e67458ddb54176365e65f0 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau From d02d4556789f59f472c3134569a341a48f18c1ec Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 27 Jan 2023 19:07:32 +0100 Subject: [PATCH 33/33] kernel: make it possible for packages to select page pool support Will be used by the next mt76 update Signed-off-by: Felix Fietkau --- config/Config-kernel.in | 7 +++++++ target/linux/generic/hack-5.10/251-kconfig.patch | 11 +++++++++++ target/linux/generic/hack-5.15/251-kconfig.patch | 11 +++++++++++ 3 files changed, 29 insertions(+) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index eed3fba1aa..81b76179a5 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1123,6 +1123,13 @@ config KERNEL_WEXT_PROC config KERNEL_WEXT_SPY def_bool KERNEL_WIRELESS_EXT +config KERNEL_PAGE_POOL + def_bool n + +config KERNEL_PAGE_POOL_STATS + bool "Page pool stats support" + depends on KERNEL_PAGE_POOL + depends on !LINUX_5_10 # # NFS related symbols diff --git a/target/linux/generic/hack-5.10/251-kconfig.patch b/target/linux/generic/hack-5.10/251-kconfig.patch index 30b8ee23ea..d692d137f1 100644 --- a/target/linux/generic/hack-5.10/251-kconfig.patch +++ b/target/linux/generic/hack-5.10/251-kconfig.patch @@ -197,3 +197,14 @@ Signed-off-by: John Crispin config SND_JACK bool +--- a/net/Kconfig ++++ b/net/Kconfig +@@ -436,7 +436,7 @@ config NET_DEVLINK + default n + + config PAGE_POOL +- bool ++ bool "Page pool support" + + config FAILOVER + tristate "Generic failover module" diff --git a/target/linux/generic/hack-5.15/251-kconfig.patch b/target/linux/generic/hack-5.15/251-kconfig.patch index 5a8a820252..0e24c3e804 100644 --- a/target/linux/generic/hack-5.15/251-kconfig.patch +++ b/target/linux/generic/hack-5.15/251-kconfig.patch @@ -197,3 +197,14 @@ Signed-off-by: John Crispin config SND_JACK bool +--- a/net/Kconfig ++++ b/net/Kconfig +@@ -432,7 +432,7 @@ config NET_DEVLINK + default n + + config PAGE_POOL +- bool ++ bool "Page pool support" + + config PAGE_POOL_STATS + default n