From 633f3e1118580db313faf93c67d5b89231687bc3 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 1 Nov 2022 14:47:14 +0100 Subject: [PATCH 01/12] kernel: Add kmod-drm-ttm-helper Add a package for drm_ttm_helper.ko. CONFIG_DRM_TTM_HELPER is compiled into the kernel on armvirt/64, x86/64, x86/generic and x86/legacy because also some DRM drivers are compiled into the kernel. On x86/geode it is not compiled into the kernel, but kmod-drm-amdgpu and kmod-drm-radeon depend on it. This fixes the x86/geode build. Signed-off-by: Hauke Mehrtens --- package/kernel/linux/modules/video.mk | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index 258414df45..83f48ac849 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -256,6 +256,20 @@ endef $(eval $(call KernelPackage,drm-ttm)) + +define KernelPackage/drm-ttm-helper + SUBMENU:=$(VIDEO_MENU) + TITLE:=Helpers for ttm-based gem objects + HIDDEN:=1 + DEPENDS:=@DISPLAY_SUPPORT +kmod-drm-ttm + KCONFIG:=CONFIG_DRM_TTM_HELPER + FILES:=$(LINUX_DIR)/drivers/gpu/drm/drm_ttm_helper.ko + AUTOLOAD:=$(call AutoProbe,drm_ttm_helper) +endef + +$(eval $(call KernelPackage,drm-ttm-helper)) + + define KernelPackage/drm-kms-helper SUBMENU:=$(VIDEO_MENU) TITLE:=CRTC helpers for KMS drivers @@ -278,7 +292,7 @@ define KernelPackage/drm-amdgpu SUBMENU:=$(VIDEO_MENU) TITLE:=AMDGPU DRM support DEPENDS:=@TARGET_x86 @DISPLAY_SUPPORT +kmod-backlight +kmod-drm-ttm \ - +kmod-drm-kms-helper +kmod-i2c-algo-bit +amdgpu-firmware + +kmod-drm-ttm-helper +kmod-drm-kms-helper +kmod-i2c-algo-bit +amdgpu-firmware KCONFIG:=CONFIG_DRM_AMDGPU \ CONFIG_DRM_AMDGPU_SI=y \ CONFIG_DRM_AMDGPU_CIK=y \ @@ -376,7 +390,7 @@ define KernelPackage/drm-radeon SUBMENU:=$(VIDEO_MENU) TITLE:=Radeon DRM support DEPENDS:=@TARGET_x86 @DISPLAY_SUPPORT +kmod-backlight +kmod-drm-kms-helper \ - +kmod-drm-ttm +kmod-i2c-algo-bit +radeon-firmware + +kmod-drm-ttm +kmod-drm-ttm-helper +kmod-i2c-algo-bit +radeon-firmware KCONFIG:=CONFIG_DRM_RADEON FILES:=$(LINUX_DIR)/drivers/gpu/drm/radeon/radeon.ko AUTOLOAD:=$(call AutoProbe,radeon) From 8d3e932b65b59ab7231cb5440866eb975bd150ea Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 29 Sep 2022 12:10:32 +0200 Subject: [PATCH 02/12] uboot-envtools: Fix format of autogenerated sectors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sector number must be stored in hex. Otherwise, the number (like 16) will be parsed as hex and any write to the partition will end up with an error like: MTD erase error on /dev/mtd5: Invalid argument Fixes: 9adfeccd8415 ("uboot-envtools: Add support for IPQ806x AP148 and DB149") Fixes: 54b275c8ed3a ("ipq40xx: add target") Signed-off-by: Sven Eckelmann Reviewed-by: Philippe Mathieu-Daudé --- package/boot/uboot-envtools/files/ipq40xx | 1 + package/boot/uboot-envtools/files/ipq806x | 1 + 2 files changed, 2 insertions(+) diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx index e45e26dcc7..823a33ca1b 100644 --- a/package/boot/uboot-envtools/files/ipq40xx +++ b/package/boot/uboot-envtools/files/ipq40xx @@ -26,6 +26,7 @@ ubootenv_mtdinfo () { fi sectors=$(( $ubootenv_size / $mtd_erase )) + sectors=$(printf "0x%x" $sectors ) echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors } diff --git a/package/boot/uboot-envtools/files/ipq806x b/package/boot/uboot-envtools/files/ipq806x index a8285d1452..77dfefbcd8 100644 --- a/package/boot/uboot-envtools/files/ipq806x +++ b/package/boot/uboot-envtools/files/ipq806x @@ -26,6 +26,7 @@ ubootenv_mtdinfo () { fi sectors=$(( $ubootenv_size / $mtd_erase )) + sectors=$(printf "0x%x" $sectors ) echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors } From 5c70b19c425896625f891c70910a96cdf9f61345 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 1 Nov 2022 18:00:54 +0100 Subject: [PATCH 03/12] iwinfo: update to the latest version 00aab87 Correctly identify key management algorithms starting with "FT-" Signed-off-by: Hauke Mehrtens --- package/network/utils/iwinfo/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index 686b3cef8d..590ee05f39 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git -PKG_SOURCE_DATE:=2022-10-14 -PKG_SOURCE_VERSION:=0496c722f1d798789d9280d9e357f87b920349eb -PKG_MIRROR_HASH:=6dcbb79b3ebcad3f013a162ee1b18535a05afe9be9bf578cf62d9cf0b210f9df +PKG_SOURCE_DATE:=2022-11-01 +PKG_SOURCE_VERSION:=00aab871c50d944fd83269e460e69124cb11adb7 +PKG_MIRROR_HASH:=e915d53da916db333d62c396154612ed7557fbb27ed8884e70c19c321c08b12c PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 From 5b7c99bc4c4d437285605d2a7dbb17d65aa6453d Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 1 Nov 2022 18:03:33 +0100 Subject: [PATCH 04/12] libnl-tiny: update to the latest version db3b2cd libnl-tiny: set SOCK_CLOEXEC if available Signed-off-by: Hauke Mehrtens --- package/libs/libnl-tiny/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/libs/libnl-tiny/Makefile b/package/libs/libnl-tiny/Makefile index eee17d22bb..4f09861ed1 100644 --- a/package/libs/libnl-tiny/Makefile +++ b/package/libs/libnl-tiny/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/libnl-tiny.git -PKG_SOURCE_DATE:=2022-05-23 -PKG_SOURCE_VERSION:=28c44ca97cd546ef8168e7476472a0da022b3421 -PKG_MIRROR_HASH:=66151ac44d70510d9320b6c0e002a3c43c787c2d756d1eaaa3b84b12edd34af5 +PKG_SOURCE_DATE:=2022-11-01 +PKG_SOURCE_VERSION:=db3b2cdbca5277723326a2720024a59fb821ae36 +PKG_MIRROR_HASH:=f6f9e2cb5366cda3be6d27a6320aa6cf3681c0b10df07b29ab4e4005e9f04f1c CMAKE_INSTALL:=1 PKG_LICENSE:=LGPL-2.1 From ef597b026bb0351ae909ae1fdaed12e76ddd41b7 Mon Sep 17 00:00:00 2001 From: Baptiste Jonglez Date: Wed, 19 Oct 2022 16:49:03 +0200 Subject: [PATCH 05/12] firewall: config: drop input traffic by default This is necessary with firewall4 to avoid a hard-to-diagnose race condition during boot, causing DNAT rules not to be taken into account correctly. The root cause is that, during boot, the ruleset is mostly empty, and interface-related rules (including DNAT rules) are added incrementally. If a packet hits the input chain before the DNAT rules are setup, it can create buggy conntrack entries that will persist indefinitely. This new default should be safe because firewall4 explicitly accepts authorized traffic and rejects the rest. Thus, in normal operations, the default policy is not used. Fixes: #10749 Ref: https://github.com/openwrt/openwrt/issues/10749 Signed-off-by: Baptiste Jonglez --- package/network/config/firewall/files/firewall.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/config/firewall/files/firewall.config b/package/network/config/firewall/files/firewall.config index 61cfe665e4..b90ac7af0a 100644 --- a/package/network/config/firewall/files/firewall.config +++ b/package/network/config/firewall/files/firewall.config @@ -1,6 +1,6 @@ config defaults option syn_flood 1 - option input ACCEPT + option input REJECT option output ACCEPT option forward REJECT # Uncomment this line to disable ipv6 rules From 82a05ce14b4f5ae921ce8796ef750b2d9f321d09 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 2 Nov 2022 11:27:47 +0000 Subject: [PATCH 06/12] mediatek: remove obsolete patch The patch enabling hardware flow offloading support on the MT7623 SoC has been merged upstream as of Linux 5.13. Remove our local patch which wrongly got forward-ported and now actually enables hardware flow offloading for the MT2701 SoC family (unsupported in OpenWrt). Signed-off-by: Daniel Golle --- ...mediatek-add-flow-offload-for-mt7623.patch | 24 ------------------- 1 file changed, 24 deletions(-) delete mode 100644 target/linux/mediatek/patches-5.15/510-net-mediatek-add-flow-offload-for-mt7623.patch diff --git a/target/linux/mediatek/patches-5.15/510-net-mediatek-add-flow-offload-for-mt7623.patch b/target/linux/mediatek/patches-5.15/510-net-mediatek-add-flow-offload-for-mt7623.patch deleted file mode 100644 index 1f1f6e0e39..0000000000 --- a/target/linux/mediatek/patches-5.15/510-net-mediatek-add-flow-offload-for-mt7623.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 4823778b116c08e9c55dbc5b5042223289ea6a0c Mon Sep 17 00:00:00 2001 -From: Frank Wunderlich -Date: Wed, 31 Mar 2021 15:34:37 +0200 -Subject: [PATCH] net: mediatek: add flow offload for mt7623 - -mt7623 uses offload version 2 too - -tested on Bananapi-R2 - -Signed-off-by: Frank Wunderlich ---- - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c -+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4166,6 +4166,7 @@ static const struct mtk_soc_data mt2701_ - .hw_features = MTK_HW_FEATURES, - .required_clks = MT7623_CLKS_BITMAP, - .required_pctl = true, -+ .offload_version = 2, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), - .rxd_size = sizeof(struct mtk_rx_dma), From 9721a42a272aab941ded476a4baa4a85031c3f07 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 2 Nov 2022 11:24:56 +0000 Subject: [PATCH 07/12] kernel: support hw flow-offloading counters on newer MediaTek SoCs The packet processing engine (PPE) found in newer ARM-based MediaTek SoCs provides packet and byte counters for offloaded streams. Import pending patch reading and using those counters. Signed-off-by: Daniel Golle --- ...iatek-ppe-add-support-for-flow-accou.patch | 409 ++++++++++++++++++ 1 file changed, 409 insertions(+) create mode 100644 target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch diff --git a/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch b/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch new file mode 100644 index 0000000000..815e0d2337 --- /dev/null +++ b/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch @@ -0,0 +1,409 @@ +From patchwork Wed Nov 2 00:58:01 2022 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Daniel Golle +X-Patchwork-Id: 13027653 +X-Patchwork-Delegate: kuba@kernel.org +Return-Path: +Date: Wed, 2 Nov 2022 00:58:01 +0000 +From: Daniel Golle +To: Felix Fietkau , John Crispin , + Sean Wang , + Mark Lee , + "David S. Miller" , + Eric Dumazet , + Jakub Kicinski , + Paolo Abeni , + Matthias Brugger , + netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, + linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org +Subject: [PATCH v4] net: ethernet: mediatek: ppe: add support for flow + accounting +Message-ID: +MIME-Version: 1.0 +Content-Disposition: inline +Precedence: bulk +List-ID: +X-Mailing-List: netdev@vger.kernel.org +X-Patchwork-Delegate: kuba@kernel.org + +The PPE units found in MT7622 and newer support packet and byte +accounting of hw-offloaded flows. Add support for reading those +counters as found in MediaTek's SDK[1]. + +[1]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/bc6a6a375c800dc2b80e1a325a2c732d1737df92 +Signed-off-by: Daniel Golle +--- +v4: declare function mtk_mib_entry_read as static +v3: don't bother to set 'false' values in any zero-initialized struct + use mtk_foe_entry_ib2 + both changes were requested by Felix Fietkau + +v2: fix wrong variable name in return value check spotted by Denis Kirjanov + + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 7 +- + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 1 + + drivers/net/ethernet/mediatek/mtk_ppe.c | 110 +++++++++++++++++- + drivers/net/ethernet/mediatek/mtk_ppe.h | 23 +++- + .../net/ethernet/mediatek/mtk_ppe_debugfs.c | 9 +- + .../net/ethernet/mediatek/mtk_ppe_offload.c | 7 ++ + drivers/net/ethernet/mediatek/mtk_ppe_regs.h | 14 +++ + 7 files changed, 166 insertions(+), 5 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -4084,7 +4084,9 @@ static int mtk_probe(struct platform_dev + u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400; + + eth->ppe[i] = mtk_ppe_init(eth, eth->base + ppe_addr, +- eth->soc->offload_version, i); ++ eth->soc->offload_version, i, ++ eth->soc->has_accounting); ++ + if (!eth->ppe[i]) { + err = -ENOMEM; + goto err_free_dev; +@@ -4204,6 +4206,7 @@ static const struct mtk_soc_data mt7622_ + .required_pctl = false, + .offload_version = 2, + .hash_offset = 2, ++ .has_accounting = true, + .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), +@@ -4241,6 +4244,7 @@ static const struct mtk_soc_data mt7629_ + .hw_features = MTK_HW_FEATURES, + .required_clks = MT7629_CLKS_BITMAP, + .required_pctl = false, ++ .has_accounting = true, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma), + .rxd_size = sizeof(struct mtk_rx_dma), +@@ -4261,6 +4265,7 @@ static const struct mtk_soc_data mt7986_ + .offload_version = 2, + .hash_offset = 4, + .foe_entry_size = sizeof(struct mtk_foe_entry), ++ .has_accounting = true, + .txrx = { + .txd_size = sizeof(struct mtk_tx_dma_v2), + .rxd_size = sizeof(struct mtk_rx_dma_v2), +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -983,6 +983,7 @@ struct mtk_soc_data { + u8 hash_offset; + u16 foe_entry_size; + netdev_features_t hw_features; ++ bool has_accounting; + struct { + u32 txd_size; + u32 rxd_size; +--- a/drivers/net/ethernet/mediatek/mtk_ppe.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.c +@@ -74,6 +74,46 @@ static int mtk_ppe_wait_busy(struct mtk_ + return ret; + } + ++static int mtk_ppe_mib_wait_busy(struct mtk_ppe *ppe) ++{ ++ int ret; ++ u32 val; ++ ++ ret = readl_poll_timeout(ppe->base + MTK_PPE_MIB_SER_CR, val, ++ !(val & MTK_PPE_MIB_SER_CR_ST), ++ 20, MTK_PPE_WAIT_TIMEOUT_US); ++ ++ if (ret) ++ dev_err(ppe->dev, "MIB table busy"); ++ ++ return ret; ++} ++ ++static int mtk_mib_entry_read(struct mtk_ppe *ppe, u16 index, u64 *bytes, u64 *packets) ++{ ++ u32 val, cnt_r0, cnt_r1, cnt_r2; ++ u32 byte_cnt_low, byte_cnt_high, pkt_cnt_low, pkt_cnt_high; ++ ++ val = FIELD_PREP(MTK_PPE_MIB_SER_CR_ADDR, index) | MTK_PPE_MIB_SER_CR_ST; ++ ppe_w32(ppe, MTK_PPE_MIB_SER_CR, val); ++ ++ if (mtk_ppe_mib_wait_busy(ppe)) ++ return -ETIMEDOUT; ++ ++ cnt_r0 = readl(ppe->base + MTK_PPE_MIB_SER_R0); ++ cnt_r1 = readl(ppe->base + MTK_PPE_MIB_SER_R1); ++ cnt_r2 = readl(ppe->base + MTK_PPE_MIB_SER_R2); ++ ++ byte_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R0_BYTE_CNT_LOW, cnt_r0); ++ byte_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R1_BYTE_CNT_HIGH, cnt_r1); ++ pkt_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R1_PKT_CNT_LOW, cnt_r1); ++ pkt_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH, cnt_r2); ++ *bytes = ((u64)byte_cnt_high << 32) | byte_cnt_low; ++ *packets = (pkt_cnt_high << 16) | pkt_cnt_low; ++ ++ return 0; ++} ++ + static void mtk_ppe_cache_clear(struct mtk_ppe *ppe) + { + ppe_set(ppe, MTK_PPE_CACHE_CTL, MTK_PPE_CACHE_CTL_CLEAR); +@@ -444,6 +484,13 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp + hwe->ib1 &= ~MTK_FOE_IB1_STATE; + hwe->ib1 |= FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_INVALID); + dma_wmb(); ++ if (ppe->accounting) { ++ struct mtk_foe_accounting *acct; ++ ++ acct = ppe->acct_table + entry->hash * sizeof(*acct); ++ acct->packets = 0; ++ acct->bytes = 0; ++ } + } + entry->hash = 0xffff; + +@@ -551,6 +598,9 @@ __mtk_foe_entry_commit(struct mtk_ppe *p + wmb(); + hwe->ib1 = entry->ib1; + ++ if (ppe->accounting) ++ *mtk_foe_entry_ib2(eth, hwe) |= MTK_FOE_IB2_MIB_CNT; ++ + dma_wmb(); + + mtk_ppe_cache_clear(ppe); +@@ -716,14 +766,42 @@ int mtk_foe_entry_idle_time(struct mtk_p + return __mtk_foe_entry_idle_time(ppe, entry->data.ib1); + } + ++struct mtk_foe_accounting *mtk_foe_entry_get_mib(struct mtk_ppe *ppe, u32 index, ++ struct mtk_foe_accounting *diff) ++{ ++ struct mtk_foe_accounting *acct; ++ int size = sizeof(struct mtk_foe_accounting); ++ u64 bytes, packets; ++ ++ if (!ppe->accounting) ++ return NULL; ++ ++ if (mtk_mib_entry_read(ppe, index, &bytes, &packets)) ++ return NULL; ++ ++ acct = ppe->acct_table + index * size; ++ ++ acct->bytes += bytes; ++ acct->packets += packets; ++ ++ if (diff) { ++ diff->bytes = bytes; ++ diff->packets = packets; ++ } ++ ++ return acct; ++} ++ + struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, +- int version, int index) ++ int version, int index, bool accounting) + { + const struct mtk_soc_data *soc = eth->soc; + struct device *dev = eth->dev; + struct mtk_ppe *ppe; + u32 foe_flow_size; + void *foe; ++ struct mtk_mib_entry *mib; ++ struct mtk_foe_accounting *acct; + + ppe = devm_kzalloc(dev, sizeof(*ppe), GFP_KERNEL); + if (!ppe) +@@ -738,6 +816,7 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ + ppe->eth = eth; + ppe->dev = dev; + ppe->version = version; ++ ppe->accounting = accounting; + + foe = dmam_alloc_coherent(ppe->dev, + MTK_PPE_ENTRIES * soc->foe_entry_size, +@@ -753,6 +832,25 @@ struct mtk_ppe *mtk_ppe_init(struct mtk_ + if (!ppe->foe_flow) + return NULL; + ++ if (accounting) { ++ mib = dmam_alloc_coherent(ppe->dev, MTK_PPE_ENTRIES * sizeof(*mib), ++ &ppe->mib_phys, GFP_KERNEL); ++ if (!mib) ++ return NULL; ++ ++ memset(mib, 0, MTK_PPE_ENTRIES * sizeof(*mib)); ++ ++ ppe->mib_table = mib; ++ ++ acct = devm_kzalloc(dev, MTK_PPE_ENTRIES * sizeof(*acct), ++ GFP_KERNEL); ++ ++ if (!acct) ++ return NULL; ++ ++ ppe->acct_table = acct; ++ } ++ + mtk_ppe_debugfs_init(ppe, index); + + return ppe; +@@ -867,6 +965,16 @@ void mtk_ppe_start(struct mtk_ppe *ppe) + ppe_w32(ppe, MTK_PPE_DEFAULT_CPU_PORT1, 0xcb777); + ppe_w32(ppe, MTK_PPE_SBW_CTRL, 0x7f); + } ++ ++ if (ppe->accounting && ppe->mib_phys) { ++ ppe_w32(ppe, MTK_PPE_MIB_TB_BASE, ppe->mib_phys); ++ ppe_m32(ppe, MTK_PPE_MIB_CFG, MTK_PPE_MIB_CFG_EN, ++ MTK_PPE_MIB_CFG_EN); ++ ppe_m32(ppe, MTK_PPE_MIB_CFG, MTK_PPE_MIB_CFG_RD_CLR, ++ MTK_PPE_MIB_CFG_RD_CLR); ++ ppe_m32(ppe, MTK_PPE_MIB_CACHE_CTL, MTK_PPE_MIB_CACHE_CTL_EN, ++ MTK_PPE_MIB_CFG_RD_CLR); ++ } + } + + int mtk_ppe_stop(struct mtk_ppe *ppe) +--- a/drivers/net/ethernet/mediatek/mtk_ppe.h ++++ b/drivers/net/ethernet/mediatek/mtk_ppe.h +@@ -57,6 +57,7 @@ enum { + #define MTK_FOE_IB2_MULTICAST BIT(8) + + #define MTK_FOE_IB2_WDMA_QID2 GENMASK(13, 12) ++#define MTK_FOE_IB2_MIB_CNT BIT(15) + #define MTK_FOE_IB2_WDMA_DEVIDX BIT(16) + #define MTK_FOE_IB2_WDMA_WINFO BIT(17) + +@@ -284,16 +285,34 @@ struct mtk_flow_entry { + unsigned long cookie; + }; + ++struct mtk_mib_entry { ++ u32 byt_cnt_l; ++ u16 byt_cnt_h; ++ u32 pkt_cnt_l; ++ u8 pkt_cnt_h; ++ u8 _rsv0; ++ u32 _rsv1; ++} __packed; ++ ++struct mtk_foe_accounting { ++ u64 bytes; ++ u64 packets; ++}; ++ + struct mtk_ppe { + struct mtk_eth *eth; + struct device *dev; + void __iomem *base; + int version; + char dirname[5]; ++ bool accounting; + + void *foe_table; + dma_addr_t foe_phys; + ++ struct mtk_mib_entry *mib_table; ++ dma_addr_t mib_phys; ++ + u16 foe_check_time[MTK_PPE_ENTRIES]; + struct hlist_head *foe_flow; + +@@ -303,7 +322,7 @@ struct mtk_ppe { + }; + + struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, +- int version, int index); ++ int version, int index, bool accounting); + void mtk_ppe_start(struct mtk_ppe *ppe); + int mtk_ppe_stop(struct mtk_ppe *ppe); + +@@ -354,5 +373,7 @@ int mtk_foe_entry_commit(struct mtk_ppe + void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry); + int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry); + int mtk_ppe_debugfs_init(struct mtk_ppe *ppe, int index); ++struct mtk_foe_accounting *mtk_foe_entry_get_mib(struct mtk_ppe *ppe, u32 index, ++ struct mtk_foe_accounting *diff); + + #endif +--- a/drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe_debugfs.c +@@ -82,6 +82,7 @@ mtk_ppe_debugfs_foe_show(struct seq_file + struct mtk_foe_entry *entry = mtk_foe_get_entry(ppe, i); + struct mtk_foe_mac_info *l2; + struct mtk_flow_addr_info ai = {}; ++ struct mtk_foe_accounting *acct; + unsigned char h_source[ETH_ALEN]; + unsigned char h_dest[ETH_ALEN]; + int type, state; +@@ -95,6 +96,8 @@ mtk_ppe_debugfs_foe_show(struct seq_file + if (bind && state != MTK_FOE_STATE_BIND) + continue; + ++ acct = mtk_foe_entry_get_mib(ppe, i, NULL); ++ + type = FIELD_GET(MTK_FOE_IB1_PACKET_TYPE, entry->ib1); + seq_printf(m, "%05x %s %7s", i, + mtk_foe_entry_state_str(state), +@@ -153,9 +156,11 @@ mtk_ppe_debugfs_foe_show(struct seq_file + *((__be16 *)&h_dest[4]) = htons(l2->dest_mac_lo); + + seq_printf(m, " eth=%pM->%pM etype=%04x" +- " vlan=%d,%d ib1=%08x ib2=%08x\n", ++ " vlan=%d,%d ib1=%08x ib2=%08x" ++ " packets=%lld bytes=%lld\n", + h_source, h_dest, ntohs(l2->etype), +- l2->vlan1, l2->vlan2, entry->ib1, ib2); ++ l2->vlan1, l2->vlan2, entry->ib1, ib2, ++ acct->packets, acct->bytes); + } + + return 0; +--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c ++++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +@@ -491,6 +491,7 @@ static int + mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f) + { + struct mtk_flow_entry *entry; ++ struct mtk_foe_accounting diff; + u32 idle; + + entry = rhashtable_lookup(ð->flow_table, &f->cookie, +@@ -501,6 +502,12 @@ mtk_flow_offload_stats(struct mtk_eth *e + idle = mtk_foe_entry_idle_time(eth->ppe[entry->ppe_index], entry); + f->stats.lastused = jiffies - idle * HZ; + ++ if (entry->hash != 0xFFFF) { ++ mtk_foe_entry_get_mib(eth->ppe[entry->ppe_index], entry->hash, &diff); ++ f->stats.pkts += diff.packets; ++ f->stats.bytes += diff.bytes; ++ } ++ + return 0; + } + +--- a/drivers/net/ethernet/mediatek/mtk_ppe_regs.h ++++ b/drivers/net/ethernet/mediatek/mtk_ppe_regs.h +@@ -143,6 +143,20 @@ enum { + + #define MTK_PPE_MIB_TB_BASE 0x338 + ++#define MTK_PPE_MIB_SER_CR 0x33C ++#define MTK_PPE_MIB_SER_CR_ST BIT(16) ++#define MTK_PPE_MIB_SER_CR_ADDR GENMASK(13, 0) ++ ++#define MTK_PPE_MIB_SER_R0 0x340 ++#define MTK_PPE_MIB_SER_R0_BYTE_CNT_LOW GENMASK(31, 0) ++ ++#define MTK_PPE_MIB_SER_R1 0x344 ++#define MTK_PPE_MIB_SER_R1_PKT_CNT_LOW GENMASK(31, 16) ++#define MTK_PPE_MIB_SER_R1_BYTE_CNT_HIGH GENMASK(15, 0) ++ ++#define MTK_PPE_MIB_SER_R2 0x348 ++#define MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH GENMASK(23, 0) ++ + #define MTK_PPE_MIB_CACHE_CTL 0x350 + #define MTK_PPE_MIB_CACHE_CTL_EN BIT(0) + #define MTK_PPE_MIB_CACHE_CTL_FLUSH BIT(2) From 1673b7dca3843698fe47f1df0ee61b88d9431ade Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 2 Nov 2022 12:41:40 +0000 Subject: [PATCH 08/12] kernel: backport fixes for MediaTek Ethernet driver Backport patches from net-next which fix possible memory and resource leaks in the error codepaths of WED initialization. Signed-off-by: Daniel Golle --- ...eth_soc-fix-mask-of-RX_DMA_GET_SPOR.patch} | 0 ...eth_soc-fix-state-in-__mtk_foe_entr.patch} | 0 ..._eth_soc-fix-possible-memory-leak-in.patch | 73 +++++++++++++++++++ ..._eth_wed-add-missing-put_device-in-m.patch | 47 ++++++++++++ ...-mtk_eth_wed-add-missing-of_node_put.patch | 43 +++++++++++ ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 2 +- 6 files changed, 164 insertions(+), 1 deletion(-) rename target/linux/generic/backport-5.15/{788-v6.0-net-ethernet-mtk_eth_soc-fix-mask-of-RX_DMA_GET_SPOR.patch => 726-v6.0-net-ethernet-mtk_eth_soc-fix-mask-of-RX_DMA_GET_SPOR.patch} (100%) rename target/linux/generic/backport-5.15/{789-v6.1-net-ethernet-mtk_eth_soc-fix-state-in-__mtk_foe_entr.patch => 727-v6.1-net-ethernet-mtk_eth_soc-fix-state-in-__mtk_foe_entr.patch} (100%) create mode 100644 target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch create mode 100644 target/linux/generic/backport-5.15/728-v6.1-02-net-ethernet-mtk_eth_wed-add-missing-put_device-in-m.patch create mode 100644 target/linux/generic/backport-5.15/728-v6.1-03-net-ethernet-mtk_eth_wed-add-missing-of_node_put.patch diff --git a/target/linux/generic/backport-5.15/788-v6.0-net-ethernet-mtk_eth_soc-fix-mask-of-RX_DMA_GET_SPOR.patch b/target/linux/generic/backport-5.15/726-v6.0-net-ethernet-mtk_eth_soc-fix-mask-of-RX_DMA_GET_SPOR.patch similarity index 100% rename from target/linux/generic/backport-5.15/788-v6.0-net-ethernet-mtk_eth_soc-fix-mask-of-RX_DMA_GET_SPOR.patch rename to target/linux/generic/backport-5.15/726-v6.0-net-ethernet-mtk_eth_soc-fix-mask-of-RX_DMA_GET_SPOR.patch diff --git a/target/linux/generic/backport-5.15/789-v6.1-net-ethernet-mtk_eth_soc-fix-state-in-__mtk_foe_entr.patch b/target/linux/generic/backport-5.15/727-v6.1-net-ethernet-mtk_eth_soc-fix-state-in-__mtk_foe_entr.patch similarity index 100% rename from target/linux/generic/backport-5.15/789-v6.1-net-ethernet-mtk_eth_soc-fix-state-in-__mtk_foe_entr.patch rename to target/linux/generic/backport-5.15/727-v6.1-net-ethernet-mtk_eth_soc-fix-state-in-__mtk_foe_entr.patch diff --git a/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch b/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch new file mode 100644 index 0000000000..c419fc8130 --- /dev/null +++ b/target/linux/generic/backport-5.15/728-v6.1-01-net-ethernet-mtk_eth_soc-fix-possible-memory-leak-in.patch @@ -0,0 +1,73 @@ +From b3d0d98179d62f9d55635a600679c4fa362baf8d Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Mon, 17 Oct 2022 11:51:54 +0800 +Subject: [PATCH 1/3] net: ethernet: mtk_eth_soc: fix possible memory leak in + mtk_probe() + +If mtk_wed_add_hw() has been called, mtk_wed_exit() needs be called +in error path or removing module to free the memory allocated in +mtk_wed_add_hw(). + +Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)") +Signed-off-by: Yang Yingliang +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -4008,19 +4008,23 @@ static int mtk_probe(struct platform_dev + eth->irq[i] = platform_get_irq(pdev, i); + if (eth->irq[i] < 0) { + dev_err(&pdev->dev, "no IRQ%d resource found\n", i); +- return -ENXIO; ++ err = -ENXIO; ++ goto err_wed_exit; + } + } + for (i = 0; i < ARRAY_SIZE(eth->clks); i++) { + eth->clks[i] = devm_clk_get(eth->dev, + mtk_clks_source_name[i]); + if (IS_ERR(eth->clks[i])) { +- if (PTR_ERR(eth->clks[i]) == -EPROBE_DEFER) +- return -EPROBE_DEFER; ++ if (PTR_ERR(eth->clks[i]) == -EPROBE_DEFER) { ++ err = -EPROBE_DEFER; ++ goto err_wed_exit; ++ } + if (eth->soc->required_clks & BIT(i)) { + dev_err(&pdev->dev, "clock %s not found\n", + mtk_clks_source_name[i]); +- return -EINVAL; ++ err = -EINVAL; ++ goto err_wed_exit; + } + eth->clks[i] = NULL; + } +@@ -4031,7 +4035,7 @@ static int mtk_probe(struct platform_dev + + err = mtk_hw_init(eth); + if (err) +- return err; ++ goto err_wed_exit; + + eth->hwlro = MTK_HAS_CAPS(eth->soc->caps, MTK_HWLRO); + +@@ -4129,6 +4133,8 @@ err_free_dev: + mtk_free_dev(eth); + err_deinit_hw: + mtk_hw_deinit(eth); ++err_wed_exit: ++ mtk_wed_exit(); + + return err; + } +@@ -4148,6 +4154,7 @@ static int mtk_remove(struct platform_de + phylink_disconnect_phy(mac->phylink); + } + ++ mtk_wed_exit(); + mtk_hw_deinit(eth); + + netif_napi_del(ð->tx_napi); diff --git a/target/linux/generic/backport-5.15/728-v6.1-02-net-ethernet-mtk_eth_wed-add-missing-put_device-in-m.patch b/target/linux/generic/backport-5.15/728-v6.1-02-net-ethernet-mtk_eth_wed-add-missing-put_device-in-m.patch new file mode 100644 index 0000000000..ef5374dcc5 --- /dev/null +++ b/target/linux/generic/backport-5.15/728-v6.1-02-net-ethernet-mtk_eth_wed-add-missing-put_device-in-m.patch @@ -0,0 +1,47 @@ +From 9d4f20a476ca57e4c9246eb1fa2a61bea2354720 Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Mon, 17 Oct 2022 11:51:55 +0800 +Subject: [PATCH 2/3] net: ethernet: mtk_eth_wed: add missing put_device() in + mtk_wed_add_hw() + +After calling get_device() in mtk_wed_add_hw(), in error path, put_device() +needs be called. + +Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)") +Signed-off-by: Yang Yingliang +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/mediatek/mtk_wed.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/mediatek/mtk_wed.c ++++ b/drivers/net/ethernet/mediatek/mtk_wed.c +@@ -1084,11 +1084,11 @@ void mtk_wed_add_hw(struct device_node * + get_device(&pdev->dev); + irq = platform_get_irq(pdev, 0); + if (irq < 0) +- return; ++ goto err_put_device; + + regs = syscon_regmap_lookup_by_phandle(np, NULL); + if (IS_ERR(regs)) +- return; ++ goto err_put_device; + + rcu_assign_pointer(mtk_soc_wed_ops, &wed_ops); + +@@ -1131,8 +1131,14 @@ void mtk_wed_add_hw(struct device_node * + + hw_list[index] = hw; + ++ mutex_unlock(&hw_lock); ++ ++ return; ++ + unlock: + mutex_unlock(&hw_lock); ++err_put_device: ++ put_device(&pdev->dev); + } + + void mtk_wed_exit(void) diff --git a/target/linux/generic/backport-5.15/728-v6.1-03-net-ethernet-mtk_eth_wed-add-missing-of_node_put.patch b/target/linux/generic/backport-5.15/728-v6.1-03-net-ethernet-mtk_eth_wed-add-missing-of_node_put.patch new file mode 100644 index 0000000000..0a452d4a7d --- /dev/null +++ b/target/linux/generic/backport-5.15/728-v6.1-03-net-ethernet-mtk_eth_wed-add-missing-of_node_put.patch @@ -0,0 +1,43 @@ +From e0bb4659e235770e6f53b3692e958591f49448f5 Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Mon, 17 Oct 2022 11:51:56 +0800 +Subject: [PATCH 3/3] net: ethernet: mtk_eth_wed: add missing of_node_put() + +The device_node pointer returned by of_parse_phandle() with refcount +incremented, when finish using it, the refcount need be decreased. + +Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)") +Signed-off-by: Yang Yingliang +Signed-off-by: David S. Miller +--- + drivers/net/ethernet/mediatek/mtk_wed.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/mediatek/mtk_wed.c ++++ b/drivers/net/ethernet/mediatek/mtk_wed.c +@@ -1079,7 +1079,7 @@ void mtk_wed_add_hw(struct device_node * + + pdev = of_find_device_by_node(np); + if (!pdev) +- return; ++ goto err_of_node_put; + + get_device(&pdev->dev); + irq = platform_get_irq(pdev, 0); +@@ -1139,6 +1139,8 @@ unlock: + mutex_unlock(&hw_lock); + err_put_device: + put_device(&pdev->dev); ++err_of_node_put: ++ of_node_put(np); + } + + void mtk_wed_exit(void) +@@ -1159,6 +1161,7 @@ void mtk_wed_exit(void) + hw_list[i] = NULL; + debugfs_remove(hw->debugfs_dir); + put_device(hw->dev); ++ of_node_put(hw->node); + kfree(hw); + } + } diff --git a/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index 670c2b04a8..3e1486962c 100644 --- a/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-5.15/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch @@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau } return IRQ_HANDLED; -@@ -4114,6 +4114,8 @@ static int mtk_probe(struct platform_dev +@@ -4118,6 +4118,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); From c3322cf04a1b9ee826dcc56944750b6bbcb716ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 2 Nov 2022 20:09:04 +0100 Subject: [PATCH 09/12] kernel: sort filesystems symbols alphabetically MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- package/kernel/linux/modules/fs.mk | 71 +++++++++++++++--------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index c4b6861192..d7f36ba4e0 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -244,17 +244,6 @@ endef $(eval $(call KernelPackage,fs-f2fs)) -define KernelPackage/fs-netfs - SUBMENU:=$(FS_MENU) - TITLE:=Network Filesystems support - DEPENDS:=@LINUX_5_15 - KCONFIG:= CONFIG_NETFS_SUPPORT - FILES:=$(LINUX_DIR)/fs/netfs/netfs.ko - AUTOLOAD:=$(call AutoLoad,28,netfs) -endef - -$(eval $(call KernelPackage,fs-netfs)) - define KernelPackage/fs-fscache SUBMENU:=$(FS_MENU) TITLE:=General filesystem local cache manager @@ -375,6 +364,18 @@ endef $(eval $(call KernelPackage,fs-msdos)) +define KernelPackage/fs-netfs + SUBMENU:=$(FS_MENU) + TITLE:=Network Filesystems support + DEPENDS:=@LINUX_5_15 + KCONFIG:= CONFIG_NETFS_SUPPORT + FILES:=$(LINUX_DIR)/fs/netfs/netfs.ko + AUTOLOAD:=$(call AutoLoad,28,netfs) +endef + +$(eval $(call KernelPackage,fs-netfs)) + + define KernelPackage/fs-nfs SUBMENU:=$(FS_MENU) TITLE:=NFS filesystem client support @@ -523,25 +524,21 @@ endef $(eval $(call KernelPackage,fs-ntfs)) -define KernelPackage/pstore +define KernelPackage/fs-ntfs3 SUBMENU:=$(FS_MENU) - TITLE:=Pstore file system - DEFAULT:=m if ALL_KMODS - KCONFIG:= \ - CONFIG_PSTORE \ - CONFIG_PSTORE_COMPRESS=y \ - CONFIG_PSTORE_COMPRESS_DEFAULT="deflate" \ - CONFIG_PSTORE_DEFLATE_COMPRESS=y \ - CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y - FILES:= $(LINUX_DIR)/fs/pstore/pstore.ko - AUTOLOAD:=$(call AutoLoad,30,pstore,1) + TITLE:=Ntfs3 support + KCONFIG:= CONFIG_NTFS3_FS CONFIG_NTFS3_FS_POSIX_ACL=y + FILES:=$(LINUX_DIR)/fs/ntfs3/ntfs3.ko + $(call AddDepends/nls) + DEPENDS+=@!LINUX_5_10 + AUTOLOAD:=$(call AutoLoad,80,ntfs3) endef -define KernelPackage/pstore/description - Kernel module for pstore filesystem support +define KernelPackage/fuse/description + Kernel module for new NTFS3 filesystem support endef -$(eval $(call KernelPackage,pstore)) +$(eval $(call KernelPackage,fs-ntfs3)) define KernelPackage/fs-reiserfs @@ -643,18 +640,22 @@ endef $(eval $(call KernelPackage,fuse)) -define KernelPackage/fs-ntfs3 +define KernelPackage/pstore SUBMENU:=$(FS_MENU) - TITLE:=Ntfs3 support - KCONFIG:= CONFIG_NTFS3_FS CONFIG_NTFS3_FS_POSIX_ACL=y - FILES:=$(LINUX_DIR)/fs/ntfs3/ntfs3.ko - $(call AddDepends/nls) - DEPENDS+=@!LINUX_5_10 - AUTOLOAD:=$(call AutoLoad,80,ntfs3) + TITLE:=Pstore file system + DEFAULT:=m if ALL_KMODS + KCONFIG:= \ + CONFIG_PSTORE \ + CONFIG_PSTORE_COMPRESS=y \ + CONFIG_PSTORE_COMPRESS_DEFAULT="deflate" \ + CONFIG_PSTORE_DEFLATE_COMPRESS=y \ + CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y + FILES:= $(LINUX_DIR)/fs/pstore/pstore.ko + AUTOLOAD:=$(call AutoLoad,30,pstore,1) endef -define KernelPackage/fuse/description - Kernel module for new NTFS3 filesystem support +define KernelPackage/pstore/description + Kernel module for pstore filesystem support endef -$(eval $(call KernelPackage,fs-ntfs3)) +$(eval $(call KernelPackage,pstore)) From e42ec112a44901f536d8ead638e7d31c03caf920 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 3 Nov 2022 00:20:30 +0100 Subject: [PATCH 10/12] kernel: Refresh generic patches This patch was out of sync. Fixes: 1673b7dca384 ("kernel: backport fixes for MediaTek Ethernet driver") Signed-off-by: Hauke Mehrtens --- ...ethernet-mediatek-ppe-add-support-for-flow-accou.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch b/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch index 815e0d2337..8bf036d006 100644 --- a/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch +++ b/target/linux/generic/pending-5.15/731-net-ethernet-mediatek-ppe-add-support-for-flow-accou.patch @@ -53,7 +53,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4084,7 +4084,9 @@ static int mtk_probe(struct platform_dev +@@ -4088,7 +4088,9 @@ static int mtk_probe(struct platform_dev u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400; eth->ppe[i] = mtk_ppe_init(eth, eth->base + ppe_addr, @@ -64,7 +64,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov if (!eth->ppe[i]) { err = -ENOMEM; goto err_free_dev; -@@ -4204,6 +4206,7 @@ static const struct mtk_soc_data mt7622_ +@@ -4211,6 +4213,7 @@ static const struct mtk_soc_data mt7622_ .required_pctl = false, .offload_version = 2, .hash_offset = 2, @@ -72,7 +72,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { .txd_size = sizeof(struct mtk_tx_dma), -@@ -4241,6 +4244,7 @@ static const struct mtk_soc_data mt7629_ +@@ -4248,6 +4251,7 @@ static const struct mtk_soc_data mt7629_ .hw_features = MTK_HW_FEATURES, .required_clks = MT7629_CLKS_BITMAP, .required_pctl = false, @@ -80,7 +80,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov .txrx = { .txd_size = sizeof(struct mtk_tx_dma), .rxd_size = sizeof(struct mtk_rx_dma), -@@ -4261,6 +4265,7 @@ static const struct mtk_soc_data mt7986_ +@@ -4268,6 +4272,7 @@ static const struct mtk_soc_data mt7986_ .offload_version = 2, .hash_offset = 4, .foe_entry_size = sizeof(struct mtk_foe_entry), From 6198eb3e6448e9a43a32d3f46b7d0543424f455b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 3 Nov 2022 07:37:42 +0100 Subject: [PATCH 11/12] bcm4908: backport upstream BQL support for bcm4908_enet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...t-broadcom-bcm4908_enet-report-queued-and-transmit.patch} | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) rename target/linux/bcm4908/patches-5.10/{170-net-broadcom-bcm4908_enet-report-queued-and-transmit.patch => 079-v6.2-0002-net-broadcom-bcm4908_enet-report-queued-and-transmit.patch} (85%) diff --git a/target/linux/bcm4908/patches-5.10/170-net-broadcom-bcm4908_enet-report-queued-and-transmit.patch b/target/linux/bcm4908/patches-5.10/079-v6.2-0002-net-broadcom-bcm4908_enet-report-queued-and-transmit.patch similarity index 85% rename from target/linux/bcm4908/patches-5.10/170-net-broadcom-bcm4908_enet-report-queued-and-transmit.patch rename to target/linux/bcm4908/patches-5.10/079-v6.2-0002-net-broadcom-bcm4908_enet-report-queued-and-transmit.patch index cd01c9177c..9f85a77b76 100644 --- a/target/linux/bcm4908/patches-5.10/170-net-broadcom-bcm4908_enet-report-queued-and-transmit.patch +++ b/target/linux/bcm4908/patches-5.10/079-v6.2-0002-net-broadcom-bcm4908_enet-report-queued-and-transmit.patch @@ -1,5 +1,6 @@ +From 471ef777ec79baadc5cd9773d08f95f49cf5e2b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 27 Oct 2022 22:18:05 +0200 +Date: Mon, 31 Oct 2022 11:48:56 +0100 Subject: [PATCH] net: broadcom: bcm4908_enet: report queued and transmitted bytes MIME-Version: 1.0 @@ -9,6 +10,8 @@ Content-Transfer-Encoding: 8bit This allows BQL to operate avoiding buffer bloat and reducing latency. Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20221031104856.32388-1-zajec5@gmail.com +Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/broadcom/bcm4908_enet.c | 4 ++++ 1 file changed, 4 insertions(+) From 46fbe55971c0e42bc1603bca424f3ff5384f15a6 Mon Sep 17 00:00:00 2001 From: Glen Huang Date: Mon, 24 Oct 2022 23:39:55 +0800 Subject: [PATCH 12/12] uhttpd: use procd to reload on acme renew Calling /etc/init.d/uhttpd reload directly in the acme hotplug script can inadvertently start a stopped instance. Signed-off-by: Glen Huang --- package/network/services/uhttpd/Makefile | 4 +--- package/network/services/uhttpd/files/acme.hotplug | 3 --- package/network/services/uhttpd/files/uhttpd.init | 1 + 3 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 package/network/services/uhttpd/files/acme.hotplug diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index 3258b70c85..d6a5a27181 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uhttpd -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git @@ -113,8 +113,6 @@ define Package/uhttpd/install $(VERSION_SED_SCRIPT) $(1)/etc/config/uhttpd $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd $(1)/usr/sbin/uhttpd - $(INSTALL_DIR) $(1)/etc/hotplug.d/acme - $(INSTALL_DATA) ./files/acme.hotplug $(1)/etc/hotplug.d/acme/00-uhttpd endef define Package/uhttpd-mod-lua/install diff --git a/package/network/services/uhttpd/files/acme.hotplug b/package/network/services/uhttpd/files/acme.hotplug deleted file mode 100644 index ace15e09c9..0000000000 --- a/package/network/services/uhttpd/files/acme.hotplug +++ /dev/null @@ -1,3 +0,0 @@ -if [ "$ACTION" = renewed ]; then - /etc/init.d/uhttpd reload -fi diff --git a/package/network/services/uhttpd/files/uhttpd.init b/package/network/services/uhttpd/files/uhttpd.init index 8dbc23f59c..bfde231bf6 100755 --- a/package/network/services/uhttpd/files/uhttpd.init +++ b/package/network/services/uhttpd/files/uhttpd.init @@ -222,6 +222,7 @@ start_instance() service_triggers() { procd_add_reload_trigger "uhttpd" + procd_add_raw_trigger acme.renew 5000 /etc/init.d/uhttpd reload } start_service() {