Merge branch 'openwrt:master' into master

This commit is contained in:
Hayzam Sherif 2023-06-15 00:49:13 +05:30 committed by GitHub
commit f709cd631d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
196 changed files with 10203 additions and 2886 deletions

8
.github/labeler.yml vendored
View file

@ -5,8 +5,8 @@
- "target/linux/apm821xx/**"
"target/archs38":
- "target/linux/archs38/**"
"target/armvirt":
- "target/linux/armvirt/**"
"target/armsr":
- "target/linux/armsr/**"
"target/at91":
- "target/linux/at91/**"
- "package/boot/at91bootstrap/**"
@ -94,6 +94,10 @@
- "target/linux/rockchip/**"
- "package/boot/arm-trusted-firmware-rockchip/**"
- "package/boot/uboot-rockchip/**"
"target/sifiveu":
- "target/linux/sifiveu/**"
- "package/boot/uboot-sifiveu/**"
- "package/boot/opensbi/**"
"target/sunxi":
- "target/linux/sunxi/**"
- "package/boot/arm-trusted-firmware-sunxi/**"

View file

@ -204,12 +204,12 @@ menu "Target Images"
config GRUB_EFI_IMAGES
bool "Build GRUB EFI images (Linux x86 or x86_64 host only)"
depends on TARGET_x86 || TARGET_armvirt
depends on TARGET_x86 || TARGET_armsr
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
select PACKAGE_grub2 if TARGET_x86
select PACKAGE_grub2-efi if TARGET_x86
select PACKAGE_grub2-bios-setup if TARGET_x86
select PACKAGE_grub2-efi-arm if TARGET_armvirt
select PACKAGE_grub2-efi-arm if TARGET_armsr
select PACKAGE_kmod-fs-vfat
default y
@ -267,7 +267,7 @@ menu "Target Images"
config VMDK_IMAGES
bool "Build VMware image files (VMDK)"
depends on TARGET_x86 || TARGET_armvirt
depends on TARGET_x86 || TARGET_armsr
depends on GRUB_IMAGES || GRUB_EFI_IMAGES
select PACKAGE_kmod-e1000
@ -279,7 +279,7 @@ menu "Target Images"
config TARGET_IMAGES_GZIP
bool "GZip images"
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armvirt || TARGET_malta
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armsr || TARGET_malta
default y
comment "Image Options"
@ -292,7 +292,7 @@ menu "Target Images"
depends on USES_BOOT_PART
default 8 if TARGET_apm821xx_sata
default 64 if TARGET_bcm27xx
default 128 if TARGET_armvirt
default 128 if TARGET_armsr
default 16
config TARGET_ROOTFS_PARTSIZE

View file

@ -1,2 +1,2 @@
LINUX_VERSION-5.15 = .114
LINUX_KERNEL_HASH-5.15.114 = e981ea5d219f77735bf5a3f7e84a8af578df8ac3e1c4ff1b0649e2b0795277d2
LINUX_VERSION-5.15 = .116
LINUX_KERNEL_HASH-5.15.116 = f617c9d1bb5326cc93495938f43eb8cb9aea9d2f451e5a99bce2893f296e179a

View file

@ -1,2 +1,2 @@
LINUX_VERSION-6.1 = .32
LINUX_KERNEL_HASH-6.1.32 = 7c88b7a09ba2b9e47b78eba2b32b1db6a4d89636f7ddd586545f9671a2521a6c
LINUX_VERSION-6.1 = .33
LINUX_KERNEL_HASH-6.1.33 = b87d6ba8ea7328e8007a7ea9171d1aa0d540d95eacfcab09578e0a3b623dd2cd

View file

@ -83,6 +83,9 @@ endef
define Build/Configure/U-Boot
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIGURE_VARS) $(UBOOT_CONFIG)_config
$(if $(strip $(UBOOT_CUSTOMIZE_CONFIG)),
$(PKG_BUILD_DIR)/scripts/config --file $(PKG_BUILD_DIR)/.config $(UBOOT_CUSTOMIZE_CONFIG)
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIGURE_VARS) oldconfig)
endef
DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)

View file

@ -41,7 +41,7 @@ endef
Package/grub2=$(call Package/grub2/Default,x86,pc)
Package/grub2-efi=$(call Package/grub2/Default,x86,efi)
Package/grub2-efi-arm=$(call Package/grub2/Default,armvirt,efi)
Package/grub2-efi-arm=$(call Package/grub2/Default,armsr,efi)
define Package/grub2-editenv
CATEGORY:=Utilities

View file

@ -0,0 +1,36 @@
include $(TOPDIR)/rules.mk
PKG_VERSION:=2023.04
PKG_RELEASE:=1
PKG_HASH:=e31cac91545ff41b71cec5d8c22afd695645cd6e2a442ccdacacd60534069341
include $(INCLUDE_DIR)/u-boot.mk
include $(INCLUDE_DIR)/package.mk
define U-Boot/Default
BUILD_TARGET:=armsr
endef
define U-Boot/qemu_armv7
NAME:=QEMU ARM Virtual Machine 32-bit
BUILD_SUBTARGET:=armv7
BUILD_DEVICES:=generic
UBOOT_CONFIG:=qemu_arm
endef
define U-Boot/qemu_armv8
NAME:=QEMU ARM Virtual Machine 64-bit
BUILD_SUBTARGET:=armv8
BUILD_DEVICES:=generic
UBOOT_CONFIG:=qemu_arm64
endef
UBOOT_TARGETS := \
qemu_armv7 \
qemu_armv8
UBOOT_CUSTOMIZE_CONFIG := \
--enable CMD_EFIDEBUG
$(eval $(call BuildPackage/U-Boot))

View file

@ -0,0 +1,62 @@
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Subject: [PATCH v10 7/9] bootstd: Use blk uclass device numbers to set efi
bootdev
Date: Mon, 24 Apr 2023 13:49:50 +1200
Message-ID:
<20230424134946.v10.7.Ia5f5e39c882ac22b5f71c4d576941b34e868eeba@changeid>
From: Mathew McBride <matt@traverse.com.au>
When loading a file from a block device, efiload_read_file
was using the seq_num of the device (e.g "35" of virtio_blk#35)
instead of the block device id (e.g what you get from running
the corresponding device scan command, like "virtio 0")
This cause EFI booting from these devices to fail as an
invalid device number is passed to blk_get_device_part_str:
Scanning bootdev 'virtio-blk#35.bootdev':
distro_efi_read_bootflow_file start (efi,fname=<NULL>)
distro_efi_read_bootflow_file start (efi,fname=<NULL>)
setting bootdev virtio, 35, efi/boot/bootaa64.efi, 00000000beef9a40, 170800
efi_dp_from_name calling blk_get_device_part_str
dev=virtio devnr=35 path=efi/boot/bootaa64.efi
blk_get_device_part_str (virtio,35)
blk_get_device_by_str (virtio, 35)
** Bad device specification virtio 35 **
Using default device tree: dtb/qemu-arm.dtb
No device tree available
0 efi ready virtio 1 virtio-blk#35.bootdev.par efi/boot/bootaa64.efi
** Booting bootflow 'virtio-blk#35.bootdev.part_1' with efi
blk_get_device_part_str (virtio,0:1)
blk_get_device_by_str (virtio, 0)
No UEFI binary known at beef9a40 (image buf=00000000beef9a40,addr=0000000000000000)
Boot failed (err=-22)
Signed-off-by: Mathew McBride <matt@traverse.com.au>
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [backport to 2023.04]
---
(no changes since v8)
Changes in v8:
- Add new patch to use blk uclass device numbers to set efi bootdev
boot/bootmeth_efi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -117,7 +117,9 @@ static int efiload_read_file(struct blk_
* this can go away.
*/
media_dev = dev_get_parent(bflow->dev);
- snprintf(devnum_str, sizeof(devnum_str), "%x", dev_seq(media_dev));
+ snprintf(devnum_str, sizeof(devnum_str), "%x:%x",
+ desc ? desc->devnum : dev_seq(media_dev),
+ bflow->part);
strlcpy(dirname, bflow->fname, sizeof(dirname));
last_slash = strrchr(dirname, '/');

View file

@ -36,6 +36,11 @@ xiaomi,ax9000)
[ -n "$idx2" ] && \
ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x10000" "0x20000"
;;
prpl,haze)
mmcpart="$(find_mmc_part 0:APPSBLENV)"
[ -n "$mmcpart" ] && \
ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x400" "0x100"
;;
qnap,301w)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \

View file

@ -39,6 +39,7 @@ ampedwireless,ally-r1900k)
;;
beeline,smartbox-giga|\
beeline,smartbox-turbo|\
beeline,smartbox-turbo-plus|\
etisalat,s3|\
rostelecom,rt-sf-1)
ubootenv_add_uci_config "/dev/mtd0" "0x80000" "0x1000" "0x20000"

View file

@ -6,9 +6,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git
PKG_SOURCE_DATE:=2023-05-22
PKG_SOURCE_VERSION:=0f73d32e641c4f17e64597da0e6c40ed3cbebe69
PKG_MIRROR_HASH:=70bd8ecda004528ec74de078d00df792f92322c58c4ec4b0630d1da097a8bc89
PKG_SOURCE_DATE:=2023-06-03
PKG_SOURCE_VERSION:=cd9c30ca47b8e5388b770c523a7f6b8b969e2f92
PKG_MIRROR_HASH:=45e623fcc512b514ade0f22e217275536aa8de4afba7dfdb11696482b8fa71a2
PKG_FLAGS:=nonshared
@ -34,6 +34,7 @@ ALLWIFIBOARDS:= \
edgecore_eap102 \
edimax_cax1800 \
netgear_wax218 \
prpl_haze \
qnap_301w \
redmi_ax6 \
wallys_dr40x9 \
@ -120,6 +121,7 @@ $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102))
$(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800))
$(eval $(call generate-ipq-wifi-package,netgear_wax218,Netgear WAX218))
$(eval $(call generate-ipq-wifi-package,qnap_301w,QNAP 301w))
$(eval $(call generate-ipq-wifi-package,prpl_haze,prpl Haze))
$(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6))
$(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9))
$(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600))

View file

@ -12,7 +12,7 @@ PKG_VERSION:=21.08
PKG_RELEASE:=3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/mc-utils
PKG_SOURCE_URL:=https://github.com/nxp-qoriq/mc-utils
PKG_SOURCE_VERSION:=LSDK-21.08
PKG_MIRROR_HASH:=372498ff4b5c8a1ac64ead5856d03ee021332f57771989ed6fe066745372b242

View file

@ -142,7 +142,7 @@ $(eval $(call KernelPackage,mii))
define KernelPackage/mdio-devres
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Supports MDIO device registration
DEPENDS:=+kmod-libphy +(TARGET_armvirt||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio
DEPENDS:=+kmod-libphy +(TARGET_armsr||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio
KCONFIG:=CONFIG_MDIO_DEVRES
HIDDEN:=1
FILES:=$(LINUX_DIR)/drivers/net/phy/mdio_devres.ko
@ -159,7 +159,7 @@ $(eval $(call KernelPackage,mdio-devres))
define KernelPackage/mdio-gpio
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:= Supports GPIO lib-based MDIO busses
DEPENDS:=+kmod-libphy @GPIO_SUPPORT +(TARGET_armvirt||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio
DEPENDS:=+kmod-libphy @GPIO_SUPPORT +(TARGET_armsr||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio
KCONFIG:= \
CONFIG_MDIO_BITBANG \
CONFIG_MDIO_GPIO
@ -438,7 +438,7 @@ $(eval $(call KernelPackage,switch-rtl8306))
define KernelPackage/switch-rtl8366-smi
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Realtek RTL8366 SMI switch interface support
DEPENDS:=@GPIO_SUPPORT +kmod-swconfig +(TARGET_armvirt||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio
DEPENDS:=@GPIO_SUPPORT +kmod-swconfig +(TARGET_armsr||TARGET_bcm27xx_bcm2708||TARGET_malta||TARGET_tegra):kmod-of-mdio
KCONFIG:=CONFIG_RTL8366_SMI
FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8366_smi.ko
AUTOLOAD:=$(call AutoLoad,42,rtl8366_smi,1)
@ -1544,7 +1544,7 @@ $(eval $(call KernelPackage,lan743x))
define KernelPackage/amazon-ena
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Elastic Network Adapter (for Amazon AWS)
DEPENDS:=@TARGET_x86_64||TARGET_armvirt_64
DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8
KCONFIG:=CONFIG_ENA_ETHERNET
FILES:=$(LINUX_DIR)/drivers/net/ethernet/amazon/ena/ena.ko
AUTOLOAD:=$(call AutoLoad,12,ena)

View file

@ -1,7 +1,7 @@
From 845a89b05aae807fb837f8e8f27f95c89de6023f Mon Sep 17 00:00:00 2001
From 1e46d596701fedb751a669666a74677344fb8724 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Wed, 12 May 2021 13:45:45 +0200
Subject: [PATCH 02/11] SSDK: replace ioremap_nocache with ioremap
Subject: [PATCH 01/14] SSDK: replace ioremap_nocache with ioremap
ioremap_nocache was dropped upstream, simply use the
generic variety.

View file

@ -1,7 +1,7 @@
From 85f988dbc15559a5a2fee606e6ef400aa39fe444 Mon Sep 17 00:00:00 2001
From 60d2b72cacd43796def9b4bd69a9e0e84be9d2e1 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Wed, 12 May 2021 17:15:46 +0200
Subject: [PATCH 03/11] SSDK: platform: use of_mdio_find_bus() to get MDIO bus
Subject: [PATCH 02/14] SSDK: platform: use of_mdio_find_bus() to get MDIO bus
Kernel has a generic of_mdio_find_bus() which can get the appropriate
MDIO bus based on the DT node.

View file

@ -1,7 +1,7 @@
From 079c20aa182c6b623d49e1f375e022dedac7373c Mon Sep 17 00:00:00 2001
From c1b6fa42a160763b574dd52aa4845718e4cd0ea6 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 13 Aug 2021 20:03:21 +0200
Subject: [PATCH 04/11] SSDK: dts: fix of_get_mac_address()
Subject: [PATCH 03/14] SSDK: dts: fix of_get_mac_address()
Recently OpenWrt backported the updated of_get_mac_address()
function which returns and error code instead.

View file

@ -1,7 +1,7 @@
From 9278b2794d984f5a8ec2350b9607a35aea2cc106 Mon Sep 17 00:00:00 2001
From aaac91b5e8756dce1c0242d58074a0b5d4607b57 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 24 Dec 2021 20:02:32 +0100
Subject: [PATCH 06/11] qca8081: convert to 5.11 IRQ model
Subject: [PATCH 04/14] qca8081: convert to 5.11 IRQ model
Kernel 5.11 introduced new IRQ handling model for PHY-s,
so provide those if 5.11 or later is used.

View file

@ -1,56 +0,0 @@
From 0c509f8d8e5a6a03933a112d4487fd1c005442d6 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 24 Dec 2021 19:39:02 +0100
Subject: [PATCH 05/11] SSDK: config: add kernel 5.15
This is purely to identify it and be able to set
flags correctly.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
config | 6 +++++-
make/linux_opt.mk | 4 ++--
2 files changed, 7 insertions(+), 3 deletions(-)
--- a/config
+++ b/config
@@ -24,6 +24,10 @@ ifeq ($(KVER),$(filter 5.4%,$(KVER)))
OS_VER=5_4
endif
+ifeq ($(KVER),$(filter 5.15%,$(KVER)))
+OS_VER=5_15
+endif
+
ifeq ($(KVER), 3.4.0)
OS_VER=3_4
endif
@@ -132,7 +136,7 @@ ifeq ($(ARCH), arm)
endif
ifeq ($(ARCH), arm64)
- ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4%,$(KVER)))
+ ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.15%,$(KVER)))
CPU_CFLAG= -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -Werror -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large
endif
endif
--- a/make/linux_opt.mk
+++ b/make/linux_opt.mk
@@ -437,7 +437,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
KASAN_SHADOW_SCALE_SHIFT := 3
endif
- ifeq (5_4, $(OS_VER))
+ ifeq (5_4 5_15, $(OS_VER))
ifeq ($(ARCH), arm64)
KASAN_OPTION += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT)
endif
@@ -468,7 +468,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
endif
- ifeq ($(OS_VER),$(filter 4_4 5_4, $(OS_VER)))
+ ifeq ($(OS_VER),$(filter 4_4 5_4 5_15, $(OS_VER)))
MODULE_CFLAG += -DKVER34
MODULE_CFLAG += -DKVER32
MODULE_CFLAG += -DLNX26_22

View file

@ -1,7 +1,7 @@
From 20a7945b82a4aefcb9ca0a14978412e4ae0057c9 Mon Sep 17 00:00:00 2001
From 37255b97a9170f6dd1604931f0d7a8f847be5b5d Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Tue, 11 Jan 2022 00:28:42 +0100
Subject: [PATCH 07/11] qca807x: add a LED quirk for Xiaomi AX9000
Subject: [PATCH 05/14] qca807x: add a LED quirk for Xiaomi AX9000
Xiaomi AX9000 has a single LED for each of 4 gigabit ethernet ports that
are connected to QCA8075, and that LED is connected to the 100M LED pin.

View file

@ -1,7 +1,7 @@
From bad774f43ec253e7e743e23bde87444c9d9cefdc Mon Sep 17 00:00:00 2001
From 1eaed6c8d72cb07e221a94d05615ae45b60ffd82 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Wed, 26 Jan 2022 14:47:33 +0100
Subject: [PATCH 08/11] qca807x: add a LED quirk for Xiaomi AX3600
Subject: [PATCH 06/14] qca807x: add a LED quirk for Xiaomi AX3600
AX3600 requires the same LED quirk so that PHY LED-s will blink even
once Linux resets the PHY.

View file

@ -1,7 +1,7 @@
From be352dd54d163c005611906ac6b87692c9b8a1e6 Mon Sep 17 00:00:00 2001
From adc75660a50c5b7a16032921a30a0eaedc8b826f Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
Date: Sat, 7 May 2022 19:03:55 +0200
Subject: [PATCH 09/11] include: fix compilation error for parse_uci_option
Subject: [PATCH 07/14] include: fix compilation error for parse_uci_option
Fix missing include for parse_uci_option

View file

@ -1,7 +1,7 @@
From ecd1e0c57fdf7f8916fa20f085e08bb4b6ba0396 Mon Sep 17 00:00:00 2001
From d70d013ac1090565ebb71875f5bdc70840807428 Mon Sep 17 00:00:00 2001
From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Date: Fri, 23 Sep 2022 08:21:13 -0500
Subject: [PATCH 10/11] QSDK: config: Avoid -Werror heroics
Subject: [PATCH 08/14] QSDK: config: Avoid -Werror heroics
Trying to compile the QSDK with warnings as errors is a very brave
endeavor. It's also stupid as it doesn't work on ipq60xx:
@ -19,10 +19,10 @@ Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
--- a/config
+++ b/config
@@ -137,7 +137,7 @@ endif
@@ -133,7 +133,7 @@ endif
ifeq ($(ARCH), arm64)
ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.15%,$(KVER)))
ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4%,$(KVER)))
- CPU_CFLAG= -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -Werror -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large
+ CPU_CFLAG= -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large
endif

View file

@ -1,7 +1,7 @@
From c06e6edfb740d0ba0b804fa16d6222e257349089 Mon Sep 17 00:00:00 2001
From 0582c76ce9c35ce8d49cba598e0e17073dd875b5 Mon Sep 17 00:00:00 2001
From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Date: Fri, 23 Sep 2022 08:30:03 -0500
Subject: [PATCH 11/11] Revert "qca-ssdk: remove bridge fdb entry for the
Subject: [PATCH 09/14] Revert "qca-ssdk: remove bridge fdb entry for the
authentication failed mac"
This change causes an undefined reference to "br_fdb_delete_by_netdev".

View file

@ -1,7 +1,7 @@
From edd3d4347cc73a99c7cf59aceeb1e8ad4d4dd303 Mon Sep 17 00:00:00 2001
From 2276a0b93751f015ef719dedf9a0d4b55ae684d5 Mon Sep 17 00:00:00 2001
From: crao <quic_crao@quicinc.com>
Date: Tue, 15 Nov 2022 18:50:01 +0800
Subject: [PATCH] [qca-ssdk]: Support Linux-Style Makefile for SSDK
Subject: [PATCH 10/14] Support Linux-Style Makefile for SSDK
Change-Id: I8c4399433b6422ef6192f70bf08b0d3023cc94b6
Signed-off-by: crao <quic_crao@quicinc.com>
@ -13,12 +13,7 @@ Signed-off-by: crao <quic_crao@quicinc.com>
make/target.mk | 12 +++++++++++
src/api/Makefile | 2 +-
6 files changed, 77 insertions(+), 23 deletions(-)
mode change 100755 => 100644 Makefile
create mode 100644 Makefile.modules
mode change 100755 => 100644 make/defs.mk
mode change 100755 => 100644 make/linux_opt.mk
mode change 100755 => 100644 make/target.mk
mode change 100755 => 100644 src/api/Makefile
--- a/Makefile
+++ b/Makefile

View file

@ -1,14 +1,13 @@
From 3026f89b06049df01d5fe19c5fccc972637aa344 Mon Sep 17 00:00:00 2001
From 46a5dd73195081b5d78582f2a13f83e49f36e917 Mon Sep 17 00:00:00 2001
From: crao <quic_crao@quicinc.com>
Date: Tue, 7 Mar 2023 17:15:07 +0800
Subject: [PATCH] [qca-ssdk]: fix compilation issue in Linux-Style Makefile
Subject: [PATCH 11/14] fix compilation issue in Linux-Style Makefile
Change-Id: If38251fc0a2bf4abc666d30f4812c0d9507310dc
Signed-off-by: crao <quic_crao@quicinc.com>
---
Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
mode change 100644 => 100755 Makefile
--- a/Makefile
+++ b/Makefile

View file

@ -1,7 +1,7 @@
From 6e4efd68e6e560a1994bc273fe6f7a72139f3957 Mon Sep 17 00:00:00 2001
From 0060aa1b0d2530672e64708d8062b3f33d007ed3 Mon Sep 17 00:00:00 2001
From: crao <quic_crao@quicinc.com>
Date: Wed, 15 Mar 2023 11:19:39 +0800
Subject: [PATCH] [qca-ssdk]: fix compilation issue in Miami yocto
Subject: [PATCH 12/14] fix compilation issue in Miami yocto
Change-Id: I8526b9e43667d72ae9afa4ef8a13167088d194ba
Signed-off-by: crao <quic_crao@quicinc.com>

View file

@ -1,7 +1,7 @@
From 1f9eb43f118b86c0b68e9d82bfae77471d6c3921 Mon Sep 17 00:00:00 2001
From 05aba6d6dfd49fe10b33cf221b7e81250a67033c Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 29 Sep 2022 09:59:20 +0200
Subject: [PATCH] SSDK: config: add kernel 6.1
Subject: [PATCH 13/14] SSDK: config: add kernel 6.1
Allow kernel 6.1 to be recognized and compiled under it.
@ -13,23 +13,23 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
--- a/config
+++ b/config
@@ -28,6 +28,10 @@ ifeq ($(KVER),$(filter 5.15%,$(KVER)))
OS_VER=5_15
@@ -24,6 +24,10 @@ ifeq ($(KVER),$(filter 5.4%,$(KVER)))
OS_VER=5_4
endif
+ifeq ($(KVER),$(filter 6.1%,$(KVER)))
+OS_VER=6_1
+ OS_VER=6_1
+endif
+
ifeq ($(KVER), 3.4.0)
OS_VER=3_4
endif
@@ -136,7 +140,7 @@ ifeq ($(ARCH), arm)
@@ -132,7 +136,7 @@ ifeq ($(ARCH), arm)
endif
ifeq ($(ARCH), arm64)
- ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.15%,$(KVER)))
+ ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.15% 6.1%,$(KVER)))
- ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4%,$(KVER)))
+ ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 6.1%,$(KVER)))
CPU_CFLAG= -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large
endif
endif
@ -39,8 +39,8 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
KASAN_SHADOW_SCALE_SHIFT := 3
endif
- ifeq (5_4 5_15, $(OS_VER))
+ ifeq (5_4 5_15 6_1, $(OS_VER))
- ifeq (5_4, $(OS_VER))
+ ifeq (5_4 6_1, $(OS_VER))
ifeq ($(ARCH), arm64)
KASAN_OPTION += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT)
endif
@ -48,8 +48,8 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
endif
- ifeq ($(OS_VER),$(filter 4_4 5_4 5_15, $(OS_VER)))
+ ifeq ($(OS_VER),$(filter 4_4 5_4 5_15 6_1, $(OS_VER)))
- ifeq ($(OS_VER),$(filter 4_4 5_4, $(OS_VER)))
+ ifeq ($(OS_VER),$(filter 4_4 5_4 6_1, $(OS_VER)))
MODULE_CFLAG += -DKVER34
MODULE_CFLAG += -DKVER32
MODULE_CFLAG += -DLNX26_22

View file

@ -1,7 +1,7 @@
From 55ea8c9b278aafe3211f7250986b1f9d9a06cd21 Mon Sep 17 00:00:00 2001
From 6a49dd6bb2e40ce49351adb6100599f176d80494 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 21 Oct 2022 13:40:15 +0200
Subject: [PATCH] SSDK: qca808x: use get_random_u32
Subject: [PATCH 14/14] SSDK: qca808x: use get_random_u32
prandom has been removed from the kernel in 6.1-rc1, so use get_random_u32
instead as its the drop-in replacement.

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=openssl
PKG_VERSION:=3.0.9
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_BUILD_FLAGS:=no-mips16 gc-sections
PKG_BUILD_PARALLEL:=1
@ -366,6 +366,7 @@ define Build/Configure
--libdir=lib \
--openssldir=/etc/ssl \
--cross-compile-prefix="$(TARGET_CROSS)" \
$(TARGET_CFLAGS) \
$(TARGET_CPPFLAGS) \
$(TARGET_LDFLAGS) \
$(OPENSSL_OPTIONS) && \

View file

@ -100,8 +100,8 @@ This variant uses AES CPU instructions (Intel AESNI or ARMv8 Crypto Extension)
endef
define Package/libwolfsslcpu-crypto/config
if TARGET_armvirt && PACKAGE_libwolfsslcpu-crypto = y
comment "You are about to build libwolfsslcpu-crypto into an armvirt_64 image."
if TARGET_armsr && PACKAGE_libwolfsslcpu-crypto = y
comment "You are about to build libwolfsslcpu-crypto into an armsr_64 image."
comment "Ensure all of your installation targets support the Crypto Extension. "
comment "Look for the 'aes' feature in /proc/cpuinfo. This library does not do "
comment "run-time detection and will crash if the CPU does not support it. "

View file

@ -101,6 +101,24 @@ speed_str(int speed)
return "unknown";
}
static void
free_attr_val(const struct switch_attr *attr, const struct switch_val *val)
{
switch (attr->type) {
case SWITCH_TYPE_STRING:
free(val->value.s);
break;
case SWITCH_TYPE_PORTS:
free(val->value.ports);
break;
case SWITCH_TYPE_LINK:
free(val->value.link);
break;
default:
break;
}
}
static void
print_attr_val(const struct switch_attr *attr, const struct switch_val *val)
{
@ -150,8 +168,10 @@ show_attrs(struct switch_dev *dev, struct switch_attr *attr, struct switch_val *
printf("\t%s: ", attr->name);
if (swlib_get_attr(dev, attr, val) < 0)
printf("???");
else
else {
print_attr_val(attr, val);
free_attr_val(attr, val);
}
putchar('\n');
}
attr = attr->next;
@ -354,6 +374,7 @@ int main(int argc, char **argv)
goto out;
}
print_attr_val(a, &val);
free_attr_val(a, &val);
putchar('\n');
break;
case CMD_LOAD:

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ppp
PKG_RELEASE:=4
PKG_RELEASE:=5
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/paulusmack/ppp

View file

@ -0,0 +1,54 @@
From 98ec18f098e5ef68e3a8cc6954fcaf5a7fb8b7be Mon Sep 17 00:00:00 2001
From: pali <7141871+pali@users.noreply.github.com>
Date: Mon, 15 Feb 2021 07:54:01 +0100
Subject: [PATCH] pppd: Fix compilation with older glibc or kernel headers
(#248)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
glibc versions prior to 2.24 do not define SOL_NETLINK and linux kernel
versions prior to 4.3 do not define NETLINK_CAP_ACK. So add fallback
definitions for these macros into pppd/sys-linux.c file.
Also extend description why we call SOL_NETLINK/NETLINK_CAP_ACK option.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
pppd/sys-linux.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -125,6 +125,14 @@
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/if_addr.h>
+/* glibc versions prior to 2.24 do not define SOL_NETLINK */
+#ifndef SOL_NETLINK
+#define SOL_NETLINK 270
+#endif
+/* linux kernel versions prior to 4.3 do not define/support NETLINK_CAP_ACK */
+#ifndef NETLINK_CAP_ACK
+#define NETLINK_CAP_ACK 10
+#endif
#endif
#include "pppd.h"
@@ -2843,7 +2851,15 @@ static int append_peer_ipv6_address(unsi
if (fd < 0)
return 0;
- /* do not ask for error message content */
+ /*
+ * Tell kernel to not send to us payload of acknowledgment error message.
+ * NETLINK_CAP_ACK option is supported since Linux kernel version 4.3 and
+ * older kernel versions always send full payload in acknowledgment netlink
+ * message. We ignore payload of this message as we need only error code,
+ * to check if our set remote peer address request succeeded or failed.
+ * So ignore return value from the following setsockopt() call as setting
+ * option NETLINK_CAP_ACK means for us just a kernel hint / optimization.
+ */
one = 1;
setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one));

View file

@ -0,0 +1,518 @@
From 81ad945630120cc1c27c8bb00503be42b76ff202 Mon Sep 17 00:00:00 2001
From: Jaco Kroon <jaco@uls.co.za>
Date: Thu, 13 Jan 2022 08:38:04 +0200
Subject: [PATCH] Expand byte count statistics to 64 bits (#298)
* Add Gigawords to radius packets where applicable.
IMPORTANT NOTE: The ioctl() only supports 32-bit counters. In order t
obtain 64-bit counters, these are now pulled in from sysfs (it's assumed
to be mounted on /sys which I'm assuming is standard).
It is unknown whether sysfs will be available everywhere, as such, keep
the ioctl() method in place, but attempt to detect wrap-overs.
If the sysfs mechanism fails, fail back to the ioctl().
Given maximum data rates, the intervals between calling this needs to be
such that no more than 4GB (2^32) bytes are sent or received in any
given interval. Mostly important for radius plugin where data
accounting may be in effect.
Towards this, a timer interval on 25 seconds is set to force a ioctl()
poll irrespective of the rate of stats update calls. This may be
important for especially radius that needs to provide interim-update
intervals, if the interim updates is too long and the counters could
wrap-over twice in a single interval. At 25 seconds we should detect
all wraps up to an effective data rate of 1.37Gbps, which for my
purposes is adequate.
Possible downsides, 4 files are opened, read and closed every time
statistics is requested. This results in 12 system calls every single
time statistics is required, compared to 1 for the ioctl. Efficiency is
unknown, but as a rule of thumb fewer system calls are better, this is
however not a critical path in my opinion, so should not be a problem.
If required I can run a few benchmarks using gettimeofday() to measure
actual impact.
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
* Use netlink if possible to obtain 64-bit stats.
This uses two system calls per round.
This should be preferred where available. It seems the RTM_GETSTATS was
only added from 2016 some point (4.7.0 as per pali), which is in my
opinion old, but given experience with certain embedded systems does
need to be supported.
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
Co-authored-by: Jaco Kroon <jaco@iewc.co.za>
---
pppd/main.c | 5 +-
pppd/plugins/radius/etc/dictionary | 2 +
pppd/plugins/radius/radius.c | 28 ++-
pppd/plugins/radius/radiusclient.h | 2 +
pppd/pppd.h | 9 +-
pppd/sys-linux.c | 281 ++++++++++++++++++++++++++++-
6 files changed, 313 insertions(+), 14 deletions(-)
--- a/pppd/main.c
+++ b/pppd/main.c
@@ -87,6 +87,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <inttypes.h>
#include "pppd.h"
#include "magic.h"
@@ -1230,9 +1231,9 @@ update_link_stats(int u)
slprintf(numbuf, sizeof(numbuf), "%u", link_connect_time);
script_setenv("CONNECT_TIME", numbuf, 0);
- slprintf(numbuf, sizeof(numbuf), "%u", link_stats.bytes_out);
+ snprintf(numbuf, sizeof(numbuf), "%" PRIu64, link_stats.bytes_out);
script_setenv("BYTES_SENT", numbuf, 0);
- slprintf(numbuf, sizeof(numbuf), "%u", link_stats.bytes_in);
+ snprintf(numbuf, sizeof(numbuf), "%" PRIu64, link_stats.bytes_in);
script_setenv("BYTES_RCVD", numbuf, 0);
}
--- a/pppd/plugins/radius/etc/dictionary
+++ b/pppd/plugins/radius/etc/dictionary
@@ -82,6 +82,8 @@ ATTRIBUTE Acct-Session-Time 46 integer
ATTRIBUTE Acct-Input-Packets 47 integer
ATTRIBUTE Acct-Output-Packets 48 integer
ATTRIBUTE Acct-Terminate-Cause 49 integer
+ATTRIBUTE Acct-Input-Gigawords 52 integer
+ATTRIBUTE Acct-Output-Gigawords 53 integer
ATTRIBUTE Chap-Challenge 60 string
ATTRIBUTE NAS-Port-Type 61 integer
ATTRIBUTE Port-Limit 62 integer
--- a/pppd/plugins/radius/radius.c
+++ b/pppd/plugins/radius/radius.c
@@ -1020,12 +1020,22 @@ radius_acct_stop(void)
av_type = link_connect_time;
rc_avpair_add(&send, PW_ACCT_SESSION_TIME, &av_type, 0, VENDOR_NONE);
- av_type = link_stats.bytes_out;
+ av_type = link_stats.bytes_out & 0xFFFFFFFF;
rc_avpair_add(&send, PW_ACCT_OUTPUT_OCTETS, &av_type, 0, VENDOR_NONE);
- av_type = link_stats.bytes_in;
+ if (link_stats.bytes_out > 0xFFFFFFFF) {
+ av_type = link_stats.bytes_out >> 32;
+ rc_avpair_add(&send, PW_ACCT_OUTPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE);
+ }
+
+ av_type = link_stats.bytes_in & 0xFFFFFFFF;
rc_avpair_add(&send, PW_ACCT_INPUT_OCTETS, &av_type, 0, VENDOR_NONE);
+ if (link_stats.bytes_in > 0xFFFFFFFF) {
+ av_type = link_stats.bytes_in >> 32;
+ rc_avpair_add(&send, PW_ACCT_INPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE);
+ }
+
av_type = link_stats.pkts_out;
rc_avpair_add(&send, PW_ACCT_OUTPUT_PACKETS, &av_type, 0, VENDOR_NONE);
@@ -1172,12 +1182,22 @@ radius_acct_interim(void *ignored)
av_type = link_connect_time;
rc_avpair_add(&send, PW_ACCT_SESSION_TIME, &av_type, 0, VENDOR_NONE);
- av_type = link_stats.bytes_out;
+ av_type = link_stats.bytes_out & 0xFFFFFFFF;
rc_avpair_add(&send, PW_ACCT_OUTPUT_OCTETS, &av_type, 0, VENDOR_NONE);
- av_type = link_stats.bytes_in;
+ if (link_stats.bytes_out > 0xFFFFFFFF) {
+ av_type = link_stats.bytes_out >> 32;
+ rc_avpair_add(&send, PW_ACCT_OUTPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE);
+ }
+
+ av_type = link_stats.bytes_in & 0xFFFFFFFF;
rc_avpair_add(&send, PW_ACCT_INPUT_OCTETS, &av_type, 0, VENDOR_NONE);
+ if (link_stats.bytes_in > 0xFFFFFFFF) {
+ av_type = link_stats.bytes_in >> 32;
+ rc_avpair_add(&send, PW_ACCT_INPUT_GIGAWORDS, &av_type, 0, VENDOR_NONE);
+ }
+
av_type = link_stats.pkts_out;
rc_avpair_add(&send, PW_ACCT_OUTPUT_PACKETS, &av_type, 0, VENDOR_NONE);
--- a/pppd/plugins/radius/radiusclient.h
+++ b/pppd/plugins/radius/radiusclient.h
@@ -184,6 +184,8 @@ typedef struct pw_auth_hdr
#define PW_ACCT_LINK_COUNT 51 /* integer */
/* From RFC 2869 */
+#define PW_ACCT_INPUT_GIGAWORDS 52 /* integer */
+#define PW_ACCT_OUTPUT_GIGAWORDS 53 /* integer */
#define PW_ACCT_INTERIM_INTERVAL 85 /* integer */
/* Merit Experimental Extensions */
--- a/pppd/pppd.h
+++ b/pppd/pppd.h
@@ -53,6 +53,7 @@
#include <stdlib.h> /* for encrypt */
#include <unistd.h> /* for setkey */
#include <stdarg.h>
+#include <stdint.h>
#include <limits.h> /* for NGROUPS_MAX */
#include <sys/param.h> /* for MAXPATHLEN and BSD4_4, if defined */
#include <sys/types.h> /* for u_int32_t, if defined */
@@ -173,8 +174,8 @@ struct permitted_ip {
* pppd needs.
*/
struct pppd_stats {
- unsigned int bytes_in;
- unsigned int bytes_out;
+ uint64_t bytes_in;
+ uint64_t bytes_out;
unsigned int pkts_in;
unsigned int pkts_out;
};
@@ -347,7 +348,7 @@ extern char *max_tls_version;
extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */
extern int maxoctets_dir; /* Direction :
0 - in+out (default)
- 1 - in
+ 1 - in
2 - out
3 - max(in,out) */
extern int maxoctets_timeout; /* Timeout for check of octets limit */
@@ -356,7 +357,7 @@ extern int maxoctets_timeout; /*
#define PPP_OCTETS_DIRECTION_OUT 2
#define PPP_OCTETS_DIRECTION_MAXOVERAL 3
/* same as previos, but little different on RADIUS side */
-#define PPP_OCTETS_DIRECTION_MAXSESSION 4
+#define PPP_OCTETS_DIRECTION_MAXSESSION 4
#endif
#ifdef PPP_FILTER
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -79,6 +79,7 @@
#include <sys/sysmacros.h>
#include <errno.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
@@ -92,6 +93,7 @@
#include <ctype.h>
#include <termios.h>
#include <unistd.h>
+#include <limits.h>
/* This is in netdevice.h. However, this compile will fail miserably if
you attempt to include netdevice.h because it has so many references
@@ -121,9 +123,19 @@
#include <linux/ppp_defs.h>
#include <linux/if_ppp.h>
-#ifdef INET6
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
+#include <linux/if_link.h>
+/* Attempt at retaining compile-support with older than 4.7 kernels, or kernels
+ * where RTM_NEWSTATS isn't defined for whatever reason.
+ */
+#ifndef RTM_NEWSTATS
+#define RTM_NEWSTATS 92
+#define RTM_GETSTATS 94
+#define IFLA_STATS_LINK_64 1
+#endif
+
+#ifdef INET6
#include <linux/if_addr.h>
/* glibc versions prior to 2.24 do not define SOL_NETLINK */
#ifndef SOL_NETLINK
@@ -1407,11 +1419,17 @@ get_idle_time(int u, struct ppp_idle *ip
/********************************************************************
*
- * get_ppp_stats - return statistics for the link.
+ * get_ppp_stats_iocl - return statistics for the link, using the ioctl() method,
+ * this only supports 32-bit counters, so need to count the wraps.
*/
-int
-get_ppp_stats(int u, struct pppd_stats *stats)
+static int
+get_ppp_stats_ioctl(int u, struct pppd_stats *stats)
{
+ static u_int32_t previbytes = 0;
+ static u_int32_t prevobytes = 0;
+ static u_int32_t iwraps = 0;
+ static u_int32_t owraps = 0;
+
struct ifpppstatsreq req;
memset (&req, 0, sizeof (req));
@@ -1426,7 +1444,262 @@ get_ppp_stats(int u, struct pppd_stats *
stats->bytes_out = req.stats.p.ppp_obytes;
stats->pkts_in = req.stats.p.ppp_ipackets;
stats->pkts_out = req.stats.p.ppp_opackets;
+
+ if (stats->bytes_in < previbytes)
+ ++iwraps;
+ if (stats->bytes_out < prevobytes)
+ ++owraps;
+
+ previbytes = stats->bytes_in;
+ prevobytes = stats->bytes_out;
+
+ stats->bytes_in += (uint64_t)iwraps << 32;
+ stats->bytes_out += (uint64_t)owraps << 32;
+
+ return 1;
+}
+
+/********************************************************************
+ * get_ppp_stats_rtnetlink - return statistics for the link, using rtnetlink
+ * This provides native 64-bit counters.
+ */
+static int
+get_ppp_stats_rtnetlink(int u, struct pppd_stats *stats)
+{
+ static int rtnl_fd = -1;
+
+ struct sockaddr_nl nladdr;
+ struct {
+ struct nlmsghdr nlh;
+ struct if_stats_msg ifsm;
+ } nlreq;
+ struct nlresp {
+ struct nlmsghdr nlh;
+ union {
+ struct {
+ struct nlmsgerr nlerr;
+ char __end_err[0];
+ };
+ struct {
+ struct rtmsg rth;
+ struct {
+ /* We only case about these first fields from rtnl_link_stats64 */
+ uint64_t rx_packets;
+ uint64_t tx_packets;
+ uint64_t rx_bytes;
+ uint64_t tx_bytes;
+ } stats;
+ char __end_stats[0];
+ };
+ };
+ } nlresp;
+ ssize_t nlresplen;
+ struct iovec iov;
+ struct msghdr msg;
+
+ memset(&nladdr, 0, sizeof(nladdr));
+ nladdr.nl_family = AF_NETLINK;
+
+ if (rtnl_fd < 0) {
+ rtnl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+ if (rtnl_fd < 0) {
+ error("get_ppp_stats_rtnetlink: error creating NETLINK socket: %m (line %d)", __LINE__);
+ return 0;
+ }
+
+ if (bind(rtnl_fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) {
+ error("get_ppp_stats_rtnetlink: bind(AF_NETLINK): %m (line %d)", __LINE__);
+ goto err;
+ }
+ }
+
+ memset(&nlreq, 0, sizeof(nlreq));
+ nlreq.nlh.nlmsg_len = sizeof(nlreq);
+ nlreq.nlh.nlmsg_type = RTM_GETSTATS;
+ nlreq.nlh.nlmsg_flags = NLM_F_REQUEST;
+
+ nlreq.ifsm.ifindex = if_nametoindex(ifname);
+ nlreq.ifsm.filter_mask = IFLA_STATS_LINK_64;
+
+ memset(&iov, 0, sizeof(iov));
+ iov.iov_base = &nlreq;
+ iov.iov_len = sizeof(nlreq);
+
+ memset(&msg, 0, sizeof(msg));
+ msg.msg_name = &nladdr;
+ msg.msg_namelen = sizeof(nladdr);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+
+ if (sendmsg(rtnl_fd, &msg, 0) < 0) {
+ error("get_ppp_stats_rtnetlink: sendmsg(RTM_GETSTATS): %m (line %d)", __LINE__);
+ goto err;
+ }
+
+ /* We just need to repoint to IOV ... everything else stays the same */
+ iov.iov_base = &nlresp;
+ iov.iov_len = sizeof(nlresp);
+
+ nlresplen = recvmsg(rtnl_fd, &msg, 0);
+
+ if (nlresplen < 0) {
+ error("get_ppp_stats_rtnetlink: recvmsg(RTM_GETSTATS): %m (line %d)", __LINE__);
+ goto err;
+ }
+
+ if (nlresplen < sizeof(nlresp.nlh)) {
+ error("get_ppp_stats_rtnetlink: Netlink response message was incomplete (line %d)", __LINE__);
+ goto err;
+ }
+
+ if (nlresp.nlh.nlmsg_type == NLMSG_ERROR) {
+ if (nlresplen < offsetof(struct nlresp, __end_err)) {
+ if (kernel_version >= KVERSION(4,7,0))
+ error("get_ppp_stats_rtnetlink: Netlink responded with error: %s (line %d)", strerror(-nlresp.nlerr.error), __LINE__);
+ } else {
+ error("get_ppp_stats_rtnetlink: Netlink responded with an error message, but the nlmsgerr structure is incomplete (line %d).",
+ __LINE__);
+ }
+ goto err;
+ }
+
+ if (nlresp.nlh.nlmsg_type != RTM_NEWSTATS) {
+ error("get_ppp_stats_rtnetlink: Expected RTM_NEWSTATS response, found something else (mlmsg_type %d, line %d)",
+ nlresp.nlh.nlmsg_type, __LINE__);
+ goto err;
+ }
+
+ if (nlresplen < offsetof(struct nlresp, __end_stats)) {
+ error("get_ppp_stats_rtnetlink: Obtained an insufficiently sized rtnl_link_stats64 struct from the kernel (line %d).", __LINE__);
+ goto err;
+ }
+
+ stats->bytes_in = nlresp.stats.rx_bytes;
+ stats->bytes_out = nlresp.stats.tx_bytes;
+ stats->pkts_in = nlresp.stats.rx_packets;
+ stats->pkts_out = nlresp.stats.tx_packets;
+
return 1;
+err:
+ close(rtnl_fd);
+ rtnl_fd = -1;
+ return 0;
+}
+
+/********************************************************************
+ * get_ppp_stats_sysfs - return statistics for the link, using the files in sysfs,
+ * this provides native 64-bit counters.
+ */
+static int
+get_ppp_stats_sysfs(int u, struct pppd_stats *stats)
+{
+ char fname[PATH_MAX+1];
+ char buf[21], *err; /* 2^64 < 10^20 */
+ int blen, fd, rlen;
+ unsigned long long val;
+
+ struct {
+ const char* fname;
+ void* ptr;
+ unsigned size;
+ } slist[] = {
+#define statfield(fn, field) { .fname = #fn, .ptr = &stats->field, .size = sizeof(stats->field) }
+ statfield(rx_bytes, bytes_in),
+ statfield(tx_bytes, bytes_out),
+ statfield(rx_packets, pkts_in),
+ statfield(tx_packets, pkts_out),
+#undef statfield
+ };
+
+ blen = snprintf(fname, sizeof(fname), "/sys/class/net/%s/statistics/", ifname);
+ if (blen >= sizeof(fname))
+ return 0; /* ifname max 15, so this should be impossible */
+
+ for (int i = 0; i < sizeof(slist) / sizeof(*slist); ++i) {
+ if (snprintf(fname + blen, sizeof(fname) - blen, "%s", slist[i].fname) >= sizeof(fname) - blen) {
+ fname[blen] = 0;
+ error("sysfs stats: filename %s/%s overflowed PATH_MAX", fname, slist[i].fname);
+ return 0;
+ }
+
+ fd = open(fname, O_RDONLY);
+ if (fd < 0) {
+ error("%s: %m", fname);
+ return 0;
+ }
+
+ rlen = read(fd, buf, sizeof(buf) - 1);
+ close(fd);
+ if (rlen < 0) {
+ error("%s: %m", fname);
+ return 0;
+ }
+ /* trim trailing \n if present */
+ while (rlen > 0 && buf[rlen-1] == '\n')
+ rlen--;
+ buf[rlen] = 0;
+
+ errno = 0;
+ val = strtoull(buf, &err, 10);
+ if (*buf < '0' || *buf > '9' || errno != 0 || *err) {
+ error("string to number conversion error converting %s (from %s) for remaining string %s%s%s",
+ buf, fname, err, errno ? ": " : "", errno ? strerror(errno) : "");
+ return 0;
+ }
+ switch (slist[i].size) {
+#define stattype(type) case sizeof(type): *(type*)slist[i].ptr = (type)val; break
+ stattype(uint64_t);
+ stattype(uint32_t);
+ stattype(uint16_t);
+ stattype(uint8_t);
+#undef stattype
+ default:
+ error("Don't know how to store stats for %s of size %u", slist[i].fname, slist[i].size);
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+/********************************************************************
+ * Periodic timer function to be used to keep stats up to date in case of ioctl
+ * polling.
+ *
+ * Given the 25s interval this should be fine up to data rates of 1.37Gbps.
+ * If you do change the timer, remember to also bring the get_ppp_stats (which
+ * sets up the initial trigger) as well.
+ */
+static void
+ppp_stats_poller(void* u)
+{
+ struct pppd_stats dummy;
+ get_ppp_stats_ioctl((long)u, &dummy);
+ TIMEOUT(ppp_stats_poller, u, 25);
+}
+
+/********************************************************************
+ * get_ppp_stats - return statistics for the link.
+ */
+int get_ppp_stats(int u, struct pppd_stats *stats)
+{
+ static int (*func)(int, struct pppd_stats*) = NULL;
+
+ if (!func) {
+ if (get_ppp_stats_rtnetlink(u, stats)) {
+ func = get_ppp_stats_rtnetlink;
+ return 1;
+ }
+ if (get_ppp_stats_sysfs(u, stats)) {
+ func = get_ppp_stats_sysfs;
+ return 1;
+ }
+ warn("statistics falling back to ioctl which only supports 32-bit counters");
+ func = get_ppp_stats_ioctl;
+ TIMEOUT(ppp_stats_poller, (void*)(long)u, 25);
+ }
+
+ return func(u, stats);
}
/********************************************************************

View file

@ -0,0 +1,299 @@
From 4a54e34cf5629f9fed61f0b7d69ee3ba4d874bc6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Sat, 9 Jul 2022 13:40:24 +0200
Subject: [PATCH] pppd: Add support for registering ppp interface via Linux
rtnetlink API
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
pppd currently creates ppp network interface via PPPIOCNEWUNIT ioctl API.
This API creates a new ppp network interface named "ppp<unit_id>". If user
supply option "ifname" with custom network name then pppd calls SIOCSIFNAME
ioctl to rename "ppp<unit_id>" to custom name immediately after successful
PPPIOCNEWUNIT ioctl call. If custom name is already registered then
SIOCSIFNAME ioctl fails and pppd close current channel (which destroy also
network interface).
This has side effect that in the first few miliseconds interface has
different name as what user supplied.
Tools like systemd, udev or NetworkManager are trying to query
interface attributes based on interface name immediately when new
network interface is created.
But if interface is renamed immediately after creation then these tools
fails. For example when running pppd with option "ifname ppp-wan" following
error is reported by systemd / udev into dmesg log:
[ 35.718732] PPP generic driver version 2.4.2
[ 35.793914] NET: Registered protocol family 24
[ 35.889924] systemd-udevd[1852]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
[ 35.901450] ppp-wan: renamed from ppp0
[ 35.930332] systemd-udevd[1852]: link_config: could not get ethtool features for ppp0
[ 35.939473] systemd-udevd[1852]: Could not set offload features of ppp0: No such device
There is an easy way to fix this issue: Use new rtnetlink API.
Via rtnetlink API it is possible to create ppp network interface with
custom ifname atomically. Just it is not possible to specify custom ppp
unit id.
So use new rtnetlink API when user requested custom ifname without custom
ppp unit id. This will avoid system issues with interface renaming as ppp
interface is directly registered with specified final name.
This has also advantage that if requested interface name already exists
then pppd fail during registering of networking interface and not during
renaming network interface which happens after successful registration.
If user supply custom ppp unit id then it is required to use old ioctl API
as currently it is the only API which allows specifying ppp unit id.
When user does not specify custom ifname stay also with old ioctl API.
There is currently a bug in kernel which cause that when empty interface is
specified in rtnetlink message for creating ppp interface then kernel
creates ppp interface but with pseudo-random name, not derived from ppp
unit id. And therefore it is not possible to retrieve what is the name of
newly created network interface. So when user does not specify interface
name via "ifname" option (which means that want from kernel to choose some
"free" interface name) it is needed to use old ioctl API which do it
correctly for now.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
pppd/sys-linux.c | 194 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 192 insertions(+), 2 deletions(-)
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -126,6 +126,11 @@
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/if_link.h>
+
+#ifdef INET6
+#include <linux/if_addr.h>
+#endif
+
/* Attempt at retaining compile-support with older than 4.7 kernels, or kernels
* where RTM_NEWSTATS isn't defined for whatever reason.
*/
@@ -135,16 +140,20 @@
#define IFLA_STATS_LINK_64 1
#endif
-#ifdef INET6
-#include <linux/if_addr.h>
/* glibc versions prior to 2.24 do not define SOL_NETLINK */
#ifndef SOL_NETLINK
#define SOL_NETLINK 270
#endif
+
/* linux kernel versions prior to 4.3 do not define/support NETLINK_CAP_ACK */
#ifndef NETLINK_CAP_ACK
#define NETLINK_CAP_ACK 10
#endif
+
+/* linux kernel versions prior to 4.7 do not define/support IFLA_PPP_DEV_FD */
+#ifndef IFLA_PPP_MAX
+/* IFLA_PPP_DEV_FD is declared as enum when IFLA_PPP_MAX is defined */
+#define IFLA_PPP_DEV_FD 1
#endif
#include "pppd.h"
@@ -657,6 +666,160 @@ void generic_disestablish_ppp(int dev_fd
}
/*
+ * make_ppp_unit_rtnetlink - register a new ppp network interface for ppp_dev_fd
+ * with specified req_ifname via rtnetlink. Interface name req_ifname must not
+ * be empty. Custom ppp unit id req_unit is ignored and kernel choose some free.
+ */
+static int make_ppp_unit_rtnetlink(void)
+{
+ struct {
+ struct nlmsghdr nlh;
+ struct ifinfomsg ifm;
+ struct {
+ struct rtattr rta;
+ char ifname[IFNAMSIZ];
+ } ifn;
+ struct {
+ struct rtattr rta;
+ struct {
+ struct rtattr rta;
+ char ifkind[sizeof("ppp")];
+ } ifik;
+ struct {
+ struct rtattr rta;
+ struct {
+ struct rtattr rta;
+ union {
+ int ppp_dev_fd;
+ } ppp;
+ } ifdata[1];
+ } ifid;
+ } ifli;
+ } nlreq;
+ struct {
+ struct nlmsghdr nlh;
+ struct nlmsgerr nlerr;
+ } nlresp;
+ struct sockaddr_nl nladdr;
+ struct iovec iov;
+ struct msghdr msg;
+ ssize_t nlresplen;
+ int one;
+ int fd;
+
+ fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+ if (fd < 0) {
+ error("make_ppp_unit_rtnetlink: socket(NETLINK_ROUTE): %m (line %d)", __LINE__);
+ return 0;
+ }
+
+ /* Tell kernel to not send to us payload of acknowledgment error message. */
+ one = 1;
+ setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one));
+
+ memset(&nladdr, 0, sizeof(nladdr));
+ nladdr.nl_family = AF_NETLINK;
+
+ if (bind(fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) {
+ error("make_ppp_unit_rtnetlink: bind(AF_NETLINK): %m (line %d)", __LINE__);
+ close(fd);
+ return 0;
+ }
+
+ memset(&nlreq, 0, sizeof(nlreq));
+ nlreq.nlh.nlmsg_len = sizeof(nlreq);
+ nlreq.nlh.nlmsg_type = RTM_NEWLINK;
+ nlreq.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE;
+ nlreq.ifm.ifi_family = AF_UNSPEC;
+ nlreq.ifm.ifi_type = ARPHRD_NETROM;
+ nlreq.ifn.rta.rta_len = sizeof(nlreq.ifn);
+ nlreq.ifn.rta.rta_type = IFLA_IFNAME;
+ strlcpy(nlreq.ifn.ifname, req_ifname, sizeof(nlreq.ifn.ifname));
+ nlreq.ifli.rta.rta_len = sizeof(nlreq.ifli);
+ nlreq.ifli.rta.rta_type = IFLA_LINKINFO;
+ nlreq.ifli.ifik.rta.rta_len = sizeof(nlreq.ifli.ifik);
+ nlreq.ifli.ifik.rta.rta_type = IFLA_INFO_KIND;
+ strcpy(nlreq.ifli.ifik.ifkind, "ppp");
+ nlreq.ifli.ifid.rta.rta_len = sizeof(nlreq.ifli.ifid);
+ nlreq.ifli.ifid.rta.rta_type = IFLA_INFO_DATA;
+ nlreq.ifli.ifid.ifdata[0].rta.rta_len = sizeof(nlreq.ifli.ifid.ifdata[0]);
+ nlreq.ifli.ifid.ifdata[0].rta.rta_type = IFLA_PPP_DEV_FD;
+ nlreq.ifli.ifid.ifdata[0].ppp.ppp_dev_fd = ppp_dev_fd;
+
+ memset(&nladdr, 0, sizeof(nladdr));
+ nladdr.nl_family = AF_NETLINK;
+
+ memset(&iov, 0, sizeof(iov));
+ iov.iov_base = &nlreq;
+ iov.iov_len = sizeof(nlreq);
+
+ memset(&msg, 0, sizeof(msg));
+ msg.msg_name = &nladdr;
+ msg.msg_namelen = sizeof(nladdr);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+
+ if (sendmsg(fd, &msg, 0) < 0) {
+ error("make_ppp_unit_rtnetlink: sendmsg(RTM_NEWLINK/NLM_F_CREATE): %m (line %d)", __LINE__);
+ close(fd);
+ return 0;
+ }
+
+ memset(&iov, 0, sizeof(iov));
+ iov.iov_base = &nlresp;
+ iov.iov_len = sizeof(nlresp);
+
+ memset(&msg, 0, sizeof(msg));
+ msg.msg_name = &nladdr;
+ msg.msg_namelen = sizeof(nladdr);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+
+ nlresplen = recvmsg(fd, &msg, 0);
+
+ if (nlresplen < 0) {
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): %m (line %d)", __LINE__);
+ close(fd);
+ return 0;
+ }
+
+ close(fd);
+
+ if (nladdr.nl_family != AF_NETLINK) {
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not a netlink packet (line %d)", __LINE__);
+ return 0;
+ }
+
+ if ((size_t)nlresplen < sizeof(nlresp) || nlresp.nlh.nlmsg_len < sizeof(nlresp)) {
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Acknowledgment netlink packet too short (line %d)", __LINE__);
+ return 0;
+ }
+
+ /* acknowledgment packet for NLM_F_ACK is NLMSG_ERROR */
+ if (nlresp.nlh.nlmsg_type != NLMSG_ERROR) {
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not an acknowledgment netlink packet (line %d)", __LINE__);
+ return 0;
+ }
+
+ /* error == 0 indicates success, negative value is errno code */
+ if (nlresp.nlerr.error != 0) {
+ /*
+ * Linux kernel versions prior to 4.7 do not support creating ppp
+ * interfaces via rtnetlink API and therefore error response is
+ * expected. On older kernel versions do not show this error message.
+ * When error is different than EEXIST then pppd tries to fallback to
+ * the old ioctl method.
+ */
+ errno = (nlresp.nlerr.error < 0) ? -nlresp.nlerr.error : EINVAL;
+ if (kernel_version >= KVERSION(4,7,0))
+ error("Couldn't create ppp interface %s: %m", req_ifname);
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
* make_ppp_unit - make a new ppp unit for ppp_dev_fd.
* Assumes new_style_driver.
*/
@@ -676,6 +839,33 @@ static int make_ppp_unit(void)
|| fcntl(ppp_dev_fd, F_SETFL, flags | O_NONBLOCK) == -1)
warn("Couldn't set /dev/ppp to nonblock: %m");
+ /*
+ * Via rtnetlink it is possible to create ppp network interface with
+ * custom ifname atomically. But it is not possible to specify custom
+ * ppp unit id.
+ *
+ * Tools like systemd, udev or NetworkManager are trying to query
+ * interface attributes based on interface name immediately when new
+ * network interface is created. And therefore immediate interface
+ * renaming is causing issues.
+ *
+ * So use rtnetlink API only when user requested custom ifname. It will
+ * avoid system issues with interface renaming.
+ */
+ if (req_unit == -1 && req_ifname[0] != '\0' && kernel_version >= KVERSION(2,1,16)) {
+ if (make_ppp_unit_rtnetlink()) {
+ if (ioctl(ppp_dev_fd, PPPIOCGUNIT, &ifunit))
+ fatal("Couldn't retrieve PPP unit id: %m");
+ return 0;
+ }
+ /*
+ * If interface with requested name already exist return error
+ * otherwise fallback to old ioctl method.
+ */
+ if (errno == EEXIST)
+ return -1;
+ }
+
ifunit = req_unit;
x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit);
if (x < 0 && req_unit >= 0 && errno == EEXIST) {

View file

@ -0,0 +1,59 @@
From 44609bfc974bdafc0316d069aabf5e2903efa805 Mon Sep 17 00:00:00 2001
From: pali <7141871+pali@users.noreply.github.com>
Date: Tue, 9 Aug 2022 11:20:15 +0200
Subject: [PATCH] pppd: Workaround for generating ppp unit id on Linux (#355)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Linux kernel has nasty bug / feature. If PPPIOCNEWUNIT is called with
negative ppp unit id (which is default option when command line argument
"unit" is not specified; and tells kernel to choose some free ppp unit id)
and the lowest unused/free ppp unit id is present in some existing network
interface name prefixed by "ppp" string then this PPPIOCNEWUNIT ioctl
fails. In this case kernel is basically unable to create a new ppp
interface via PPPIOCNEWUNIT ioctl when user does not specify some unused
and non-conflicted unit id.
Linux kernel should be fixed to choose usable ppp unit id when was
requested via PPPIOCNEWUNIT parameter -1.
Until this happens, add a workaround for pppd to help choosing some random
ppp unit id when kernel returns this error.
Simple test case (run on system when there is no ppp interface):
sudo ./pppd ifname ppp1 nodefaultroute noauth nolock local nodetach pty "./pppd nodefaultroute noauth nolock local nodetach notty"
Second pppd process without this patch prints into syslog following error:
pppd 2.4.10-dev started by pali, uid 0
Couldn't create new ppp unit: File exists
Exit.
With this patch it falls back to random ppp unit id and succeeds:
pppd 2.4.10-dev started by pali, uid 0
Using interface ppp1361
Connect: ppp1361 <--> /dev/pts/14
...
Signed-off-by: Pali Rohár <pali@kernel.org>
---
pppd/sys-linux.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -873,6 +873,11 @@ static int make_ppp_unit(void)
ifunit = -1;
x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit);
}
+ if (x < 0 && errno == EEXIST) {
+ srand(time(NULL) * getpid());
+ ifunit = rand() % 10000;
+ x = ioctl(ppp_dev_fd, PPPIOCNEWUNIT, &ifunit);
+ }
if (x < 0)
error("Couldn't create new ppp unit: %m");

View file

@ -0,0 +1,218 @@
From 089687fbcc6524809ae9f4b2f8145fe3c2a91147 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Sat, 7 Aug 2021 19:48:01 +0200
Subject: [PATCH] pppd: Retry registering interface when on rtnetlink -EBUSY
error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Due to workaround in kernel module ppp_generic.ko in function
ppp_nl_newlink(), kernel may return -EBUSY error to prevent possible
mutex deadlock. In this case userspace needs to retry its request.
Proper way would be to fix kernel module to order requests and mutex
locking, so prevent deadlock in kernel and so never return this error to
userspace. Until it happens we need retry code in userspace.
Signed-off-by: Pali Rohár <pali@kernel.org>
[ backport to ppp 2.4.9 ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
pppd/sys-linux.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -707,99 +707,101 @@ static int make_ppp_unit_rtnetlink(void)
int one;
int fd;
- fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
- if (fd < 0) {
- error("make_ppp_unit_rtnetlink: socket(NETLINK_ROUTE): %m (line %d)", __LINE__);
- return 0;
- }
-
- /* Tell kernel to not send to us payload of acknowledgment error message. */
- one = 1;
- setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one));
+ do {
+ fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+ if (fd < 0) {
+ error("make_ppp_unit_rtnetlink: socket(NETLINK_ROUTE): %m (line %d)", __LINE__);
+ return 0;
+ }
+
+ /* Tell kernel to not send to us payload of acknowledgment error message. */
+ one = 1;
+ setsockopt(fd, SOL_NETLINK, NETLINK_CAP_ACK, &one, sizeof(one));
+
+ memset(&nladdr, 0, sizeof(nladdr));
+ nladdr.nl_family = AF_NETLINK;
+
+ if (bind(fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) {
+ error("make_ppp_unit_rtnetlink: bind(AF_NETLINK): %m (line %d)", __LINE__);
+ close(fd);
+ return 0;
+ }
+
+ memset(&nlreq, 0, sizeof(nlreq));
+ nlreq.nlh.nlmsg_len = sizeof(nlreq);
+ nlreq.nlh.nlmsg_type = RTM_NEWLINK;
+ nlreq.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE;
+ nlreq.ifm.ifi_family = AF_UNSPEC;
+ nlreq.ifm.ifi_type = ARPHRD_NETROM;
+ nlreq.ifn.rta.rta_len = sizeof(nlreq.ifn);
+ nlreq.ifn.rta.rta_type = IFLA_IFNAME;
+ strlcpy(nlreq.ifn.ifname, req_ifname, sizeof(nlreq.ifn.ifname));
+ nlreq.ifli.rta.rta_len = sizeof(nlreq.ifli);
+ nlreq.ifli.rta.rta_type = IFLA_LINKINFO;
+ nlreq.ifli.ifik.rta.rta_len = sizeof(nlreq.ifli.ifik);
+ nlreq.ifli.ifik.rta.rta_type = IFLA_INFO_KIND;
+ strcpy(nlreq.ifli.ifik.ifkind, "ppp");
+ nlreq.ifli.ifid.rta.rta_len = sizeof(nlreq.ifli.ifid);
+ nlreq.ifli.ifid.rta.rta_type = IFLA_INFO_DATA;
+ nlreq.ifli.ifid.ifdata[0].rta.rta_len = sizeof(nlreq.ifli.ifid.ifdata[0]);
+ nlreq.ifli.ifid.ifdata[0].rta.rta_type = IFLA_PPP_DEV_FD;
+ nlreq.ifli.ifid.ifdata[0].ppp.ppp_dev_fd = ppp_dev_fd;
+
+ memset(&nladdr, 0, sizeof(nladdr));
+ nladdr.nl_family = AF_NETLINK;
+
+ memset(&iov, 0, sizeof(iov));
+ iov.iov_base = &nlreq;
+ iov.iov_len = sizeof(nlreq);
+
+ memset(&msg, 0, sizeof(msg));
+ msg.msg_name = &nladdr;
+ msg.msg_namelen = sizeof(nladdr);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+
+ if (sendmsg(fd, &msg, 0) < 0) {
+ error("make_ppp_unit_rtnetlink: sendmsg(RTM_NEWLINK/NLM_F_CREATE): %m (line %d)", __LINE__);
+ close(fd);
+ return 0;
+ }
+
+ memset(&iov, 0, sizeof(iov));
+ iov.iov_base = &nlresp;
+ iov.iov_len = sizeof(nlresp);
+
+ memset(&msg, 0, sizeof(msg));
+ msg.msg_name = &nladdr;
+ msg.msg_namelen = sizeof(nladdr);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+
+ nlresplen = recvmsg(fd, &msg, 0);
+
+ if (nlresplen < 0) {
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): %m (line %d)", __LINE__);
+ close(fd);
+ return 0;
+ }
- memset(&nladdr, 0, sizeof(nladdr));
- nladdr.nl_family = AF_NETLINK;
-
- if (bind(fd, (struct sockaddr *)&nladdr, sizeof(nladdr)) < 0) {
- error("make_ppp_unit_rtnetlink: bind(AF_NETLINK): %m (line %d)", __LINE__);
close(fd);
- return 0;
- }
-
- memset(&nlreq, 0, sizeof(nlreq));
- nlreq.nlh.nlmsg_len = sizeof(nlreq);
- nlreq.nlh.nlmsg_type = RTM_NEWLINK;
- nlreq.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_EXCL | NLM_F_CREATE;
- nlreq.ifm.ifi_family = AF_UNSPEC;
- nlreq.ifm.ifi_type = ARPHRD_NETROM;
- nlreq.ifn.rta.rta_len = sizeof(nlreq.ifn);
- nlreq.ifn.rta.rta_type = IFLA_IFNAME;
- strlcpy(nlreq.ifn.ifname, req_ifname, sizeof(nlreq.ifn.ifname));
- nlreq.ifli.rta.rta_len = sizeof(nlreq.ifli);
- nlreq.ifli.rta.rta_type = IFLA_LINKINFO;
- nlreq.ifli.ifik.rta.rta_len = sizeof(nlreq.ifli.ifik);
- nlreq.ifli.ifik.rta.rta_type = IFLA_INFO_KIND;
- strcpy(nlreq.ifli.ifik.ifkind, "ppp");
- nlreq.ifli.ifid.rta.rta_len = sizeof(nlreq.ifli.ifid);
- nlreq.ifli.ifid.rta.rta_type = IFLA_INFO_DATA;
- nlreq.ifli.ifid.ifdata[0].rta.rta_len = sizeof(nlreq.ifli.ifid.ifdata[0]);
- nlreq.ifli.ifid.ifdata[0].rta.rta_type = IFLA_PPP_DEV_FD;
- nlreq.ifli.ifid.ifdata[0].ppp.ppp_dev_fd = ppp_dev_fd;
-
- memset(&nladdr, 0, sizeof(nladdr));
- nladdr.nl_family = AF_NETLINK;
-
- memset(&iov, 0, sizeof(iov));
- iov.iov_base = &nlreq;
- iov.iov_len = sizeof(nlreq);
-
- memset(&msg, 0, sizeof(msg));
- msg.msg_name = &nladdr;
- msg.msg_namelen = sizeof(nladdr);
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
-
- if (sendmsg(fd, &msg, 0) < 0) {
- error("make_ppp_unit_rtnetlink: sendmsg(RTM_NEWLINK/NLM_F_CREATE): %m (line %d)", __LINE__);
- close(fd);
- return 0;
- }
-
- memset(&iov, 0, sizeof(iov));
- iov.iov_base = &nlresp;
- iov.iov_len = sizeof(nlresp);
-
- memset(&msg, 0, sizeof(msg));
- msg.msg_name = &nladdr;
- msg.msg_namelen = sizeof(nladdr);
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
-
- nlresplen = recvmsg(fd, &msg, 0);
-
- if (nlresplen < 0) {
- error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): %m (line %d)", __LINE__);
- close(fd);
- return 0;
- }
-
- close(fd);
- if (nladdr.nl_family != AF_NETLINK) {
- error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not a netlink packet (line %d)", __LINE__);
- return 0;
- }
-
- if ((size_t)nlresplen < sizeof(nlresp) || nlresp.nlh.nlmsg_len < sizeof(nlresp)) {
- error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Acknowledgment netlink packet too short (line %d)", __LINE__);
- return 0;
- }
-
- /* acknowledgment packet for NLM_F_ACK is NLMSG_ERROR */
- if (nlresp.nlh.nlmsg_type != NLMSG_ERROR) {
- error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not an acknowledgment netlink packet (line %d)", __LINE__);
- return 0;
- }
+ if (nladdr.nl_family != AF_NETLINK) {
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not a netlink packet (line %d)", __LINE__);
+ return 0;
+ }
+
+ if ((size_t)nlresplen < sizeof(nlresp) || nlresp.nlh.nlmsg_len < sizeof(nlresp)) {
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Acknowledgment netlink packet too short (line %d)", __LINE__);
+ return 0;
+ }
+
+ /* acknowledgment packet for NLM_F_ACK is NLMSG_ERROR */
+ if (nlresp.nlh.nlmsg_type != NLMSG_ERROR) {
+ error("make_ppp_unit_rtnetlink: recvmsg(NLM_F_ACK): Not an acknowledgment netlink packet (line %d)", __LINE__);
+ return 0;
+ }
+ } while (nlresp.nlerr.error == -EBUSY);
/* error == 0 indicates success, negative value is errno code */
if (nlresp.nlerr.error != 0) {

View file

@ -12,7 +12,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
--- a/pppd/main.c
+++ b/pppd/main.c
@@ -1034,7 +1034,8 @@ get_input(void)
@@ -1035,7 +1035,8 @@ get_input(void)
}
notice("Modem hangup");
hungup = 1;

View file

@ -119,7 +119,7 @@ Signed-off-by: George Kashperko <george@znau.edu.ua>
&& memcmp(vd.dptr, key.dptr, vd.dsize) == 0;
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -706,6 +706,16 @@ void cfg_bundle(int mrru, int mtru, int
@@ -923,6 +923,16 @@ void cfg_bundle(int mrru, int mtru, int
add_fd(ppp_dev_fd);
}
@ -136,7 +136,7 @@ Signed-off-by: George Kashperko <george@znau.edu.ua>
/*
* make_new_bundle - create a new PPP unit (i.e. a bundle)
* and connect our channel to it. This should only get called
@@ -724,6 +734,8 @@ void make_new_bundle(int mrru, int mtru,
@@ -941,6 +951,8 @@ void make_new_bundle(int mrru, int mtru,
/* set the mrru and flags */
cfg_bundle(mrru, mtru, rssn, tssn);

View file

@ -12,7 +12,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -1770,6 +1770,7 @@ int cifdefaultroute (int unit, u_int32_t
@@ -2248,6 +2248,7 @@ int cifdefaultroute (int unit, u_int32_t
SIN_ADDR(rt.rt_genmask) = 0L;
}

View file

@ -13,7 +13,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -1720,6 +1720,9 @@ int sifdefaultroute (int unit, u_int32_t
@@ -2198,6 +2198,9 @@ int sifdefaultroute (int unit, u_int32_t
memset (&rt, 0, sizeof (rt));
SET_SA_FAMILY (rt.rt_dst, AF_INET);
@ -23,7 +23,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
rt.rt_dev = ifname;
rt.rt_metric = dfl_route_metric + 1; /* +1 for binary compatibility */
@@ -1728,7 +1731,7 @@ int sifdefaultroute (int unit, u_int32_t
@@ -2206,7 +2209,7 @@ int sifdefaultroute (int unit, u_int32_t
SIN_ADDR(rt.rt_genmask) = 0L;
}

View file

@ -10,7 +10,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -206,7 +206,7 @@ static int driver_is_old = 0;
@@ -235,7 +235,7 @@ static int driver_is_old = 0;
static int restore_term = 0; /* 1 => we've munged the terminal */
static struct termios inittermios; /* Initial TTY termios */
@ -19,7 +19,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
static char loop_name[20];
static unsigned char inbuf[512]; /* buffer for chars read from loopback */
@@ -225,8 +225,8 @@ static int looped; /* 1 if using loop
@@ -254,8 +254,8 @@ static int looped; /* 1 if using loop
static int link_mtu; /* mtu for the link (not bundle) */
static struct utsname utsname; /* for the kernel version */
@ -29,7 +29,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
#define MAX_IFS 100
@@ -1455,11 +1455,12 @@ int ccp_fatal_error (int unit)
@@ -1933,11 +1933,12 @@ int ccp_fatal_error (int unit)
*
* path_to_procfs - find the path to the proc file system mount point
*/
@ -44,7 +44,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
struct mntent *mntent;
FILE *fp;
@@ -1481,6 +1482,7 @@ static char *path_to_procfs(const char *
@@ -1959,6 +1960,7 @@ static char *path_to_procfs(const char *
fclose (fp);
}
}
@ -52,7 +52,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
strlcpy(proc_path + proc_path_len, tail,
sizeof(proc_path) - proc_path_len);
@@ -2365,15 +2367,19 @@ int ppp_available(void)
@@ -2843,15 +2845,19 @@ int ppp_available(void)
int my_version, my_modification, my_patch;
int osmaj, osmin, ospatch;
@ -72,7 +72,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
/* XXX should get from driver */
driver_version = 2;
@@ -2433,6 +2439,7 @@ int ppp_available(void)
@@ -2911,6 +2917,7 @@ int ppp_available(void)
if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP))
ok = 0;
@ -80,7 +80,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
/*
* This is the PPP device. Validate the version of the driver at this
@@ -3106,6 +3113,7 @@ get_pty(int *master_fdp, int *slave_fdp,
@@ -3592,6 +3599,7 @@ get_pty(int *master_fdp, int *slave_fdp,
}
#endif /* TIOCGPTN */
@ -88,7 +88,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
if (sfd < 0) {
/* the old way - scan through the pty name space */
for (i = 0; i < 64; ++i) {
@@ -3124,6 +3132,7 @@ get_pty(int *master_fdp, int *slave_fdp,
@@ -3610,6 +3618,7 @@ get_pty(int *master_fdp, int *slave_fdp,
}
}
}

View file

@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
--- a/pppd/pppd.h
+++ b/pppd/pppd.h
@@ -317,7 +317,6 @@ extern int holdoff; /* Dead time before
@@ -318,7 +318,6 @@ extern int holdoff; /* Dead time before
extern bool holdoff_specified; /* true if user gave a holdoff value */
extern bool notty; /* Stdin/out is not a tty */
extern char *pty_socket; /* Socket to connect to pty */

View file

@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
--- a/pppd/sys-linux.c
+++ b/pppd/sys-linux.c
@@ -2503,6 +2503,7 @@ int ppp_available(void)
@@ -2981,6 +2981,7 @@ int ppp_available(void)
void logwtmp (const char *line, const char *name, const char *host)
{
@ -15,7 +15,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
struct utmp ut, *utp;
pid_t mypid = getpid();
#if __GLIBC__ < 2
@@ -2568,6 +2569,7 @@ void logwtmp (const char *line, const ch
@@ -3046,6 +3047,7 @@ void logwtmp (const char *line, const ch
close (wtmp);
}
#endif

View file

@ -7,7 +7,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
--- a/pppd/main.c
+++ b/pppd/main.c
@@ -866,14 +866,17 @@ struct protocol_list {
@@ -867,14 +867,17 @@ struct protocol_list {
const char *name;
} protocol_list[] = {
{ 0x21, "IP" },
@ -25,7 +25,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x33, "Stream Protocol ST-II" },
{ 0x35, "Banyan Vines" },
{ 0x39, "AppleTalk EDDP" },
@@ -887,8 +890,11 @@ struct protocol_list {
@@ -888,8 +891,11 @@ struct protocol_list {
{ 0x49, "Serial Data Transport Protocol (PPP-SDTP)" },
{ 0x4b, "SNA over 802.2" },
{ 0x4d, "SNA" },
@ -37,7 +37,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x53, "Encryption" },
{ 0x55, "Individual Link Encryption" },
{ 0x57, "IPv6" },
@@ -899,12 +905,15 @@ struct protocol_list {
@@ -900,12 +906,15 @@ struct protocol_list {
{ 0x65, "RTP IPHC Compressed non-TCP" },
{ 0x67, "RTP IPHC Compressed UDP 8" },
{ 0x69, "RTP IPHC Compressed RTP 8" },
@ -53,7 +53,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x0203, "IBM Source Routing BPDU" },
{ 0x0205, "DEC LANBridge100 Spanning Tree" },
{ 0x0207, "Cisco Discovery Protocol" },
@@ -916,15 +925,19 @@ struct protocol_list {
@@ -917,15 +926,19 @@ struct protocol_list {
{ 0x0231, "Luxcom" },
{ 0x0233, "Sigma Network Systems" },
{ 0x0235, "Apple Client Server Protocol" },
@ -73,7 +73,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x4001, "Cray Communications Control Protocol" },
{ 0x4003, "CDPD Mobile Network Registration Protocol" },
{ 0x4005, "Expand accelerator protocol" },
@@ -935,8 +948,10 @@ struct protocol_list {
@@ -936,8 +949,10 @@ struct protocol_list {
{ 0x4023, "RefTek Protocol" },
{ 0x4025, "Fibre Channel" },
{ 0x4027, "EMIT Protocols" },
@ -84,7 +84,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x8023, "OSI Network Layer Control Protocol" },
{ 0x8025, "Xerox NS IDP Control Protocol" },
{ 0x8027, "DECnet Phase IV Control Protocol" },
@@ -945,7 +960,9 @@ struct protocol_list {
@@ -946,7 +961,9 @@ struct protocol_list {
{ 0x8031, "Bridging NCP" },
{ 0x8033, "Stream Protocol Control Protocol" },
{ 0x8035, "Banyan Vines Control Protocol" },
@ -94,7 +94,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x803f, "NETBIOS Framing Control Protocol" },
{ 0x8041, "Cisco Systems Control Protocol" },
{ 0x8043, "Ascom Timeplex" },
@@ -954,18 +971,24 @@ struct protocol_list {
@@ -955,18 +972,24 @@ struct protocol_list {
{ 0x8049, "Serial Data Control Protocol (PPP-SDCP)" },
{ 0x804b, "SNA over 802.2 Control Protocol" },
{ 0x804d, "SNA Control Protocol" },
@ -119,7 +119,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
{ 0x8207, "Cisco Discovery Protocol Control" },
{ 0x8209, "Netcs Twin Routing" },
{ 0x820b, "STP - Control Protocol" },
@@ -974,24 +997,29 @@ struct protocol_list {
@@ -975,24 +998,29 @@ struct protocol_list {
{ 0x8281, "MPLSCP" },
{ 0x8285, "IEEE p1284.4 standard - Protocol Control" },
{ 0x8287, "ETSI TETRA TNP1 Control Protocol" },

View file

@ -12,7 +12,7 @@ PKG_VERSION:=21.08
PKG_RELEASE:=4
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/restool
PKG_SOURCE_URL:=https://github.com/nxp-qoriq/restool
PKG_SOURCE_VERSION:=LSDK-21.08
PKG_MIRROR_HASH:=0396644927b8f3da20183227562f695c8063d3d4c6bb606e8f31dda450e962e4

View file

@ -11,6 +11,7 @@ proto_qmi_init_config() {
no_device=1
proto_config_add_string "device:device"
proto_config_add_string apn
proto_config_add_string v6apn
proto_config_add_string auth
proto_config_add_string username
proto_config_add_string password
@ -19,6 +20,7 @@ proto_qmi_init_config() {
proto_config_add_string modes
proto_config_add_string pdptype
proto_config_add_int profile
proto_config_add_int v6profile
proto_config_add_boolean dhcp
proto_config_add_boolean dhcpv6
proto_config_add_boolean autoconnect
@ -31,14 +33,14 @@ proto_qmi_init_config() {
proto_qmi_setup() {
local interface="$1"
local dataformat connstat plmn_mode mcc mnc
local device apn auth username password pincode delay modes pdptype
local profile dhcp dhcpv6 autoconnect plmn timeout mtu $PROTO_DEFAULT_OPTIONS
local device apn v6apn auth username password pincode delay modes pdptype
local profile v6profile dhcp dhcpv6 autoconnect plmn timeout mtu $PROTO_DEFAULT_OPTIONS
local ip4table ip6table
local cid_4 pdh_4 cid_6 pdh_6
local ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6
json_get_vars device apn auth username password pincode delay modes
json_get_vars pdptype profile dhcp dhcpv6 autoconnect plmn ip4table
json_get_vars device apn v6apn auth username password pincode delay modes
json_get_vars pdptype profile v6profile dhcp dhcpv6 autoconnect plmn ip4table
json_get_vars ip6table timeout mtu $PROTO_DEFAULT_OPTIONS
[ "$timeout" = "" ] && timeout="10"
@ -309,10 +311,13 @@ proto_qmi_setup() {
uqmi -s -d "$device" --set-client-id wds,"$cid_6" --set-ip-family ipv6 > /dev/null 2>&1
: "${v6apn:=${apn}}"
: "${v6profile:=${profile}}"
pdh_6=$(uqmi -s -d "$device" --set-client-id wds,"$cid_6" \
--start-network \
${apn:+--apn $apn} \
${profile:+--profile $profile} \
${v6apn:+--apn $v6apn} \
${v6profile:+--profile $v6profile} \
${auth:+--auth-type $auth} \
${username:+--username $username} \
${password:+--password $password} \
@ -383,6 +388,7 @@ proto_qmi_setup() {
json_init
json_add_string name "${interface}_6"
json_add_string ifname "@$interface"
[ "$pdptype" = "ipv4v6" ] && json_add_string iface_464xlat "0"
json_add_string proto "dhcpv6"
[ -n "$ip6table" ] && json_add_string ip6table "$ip6table"
proto_add_dynamic_defaults

View file

@ -109,10 +109,10 @@ Examples
$SELF malta be -m 64
$SELF malta le64
$SELF malta be-glibc
$SELF armvirt 32 \\
$SELF armsr armv7 \\
--machine virt,highmem=off \\
--kernel bin/targets/armvirt/32/openwrt-armvirt-32-zImage \\
--rootfs bin/targets/armvirt/32/openwrt-armvirt-32-root.ext4
--kernel bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-kernel.bin \\
--rootfs bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-ext4-rootfs.img
EOF
}
@ -162,7 +162,7 @@ parse_args() {
o_bindir="${CONFIG_BINARY_FOLDER:-bin}/targets/$o_target/$o_subtarget"
}
start_qemu_armvirt() {
start_qemu_armsr() {
local kernel="$o_kernel"
local rootfs="$o_rootfs"
local mach="${o_mach:-virt}"
@ -170,15 +170,15 @@ start_qemu_armvirt() {
local qemu_exe
case "${o_subtarget%-*}" in
32)
armv7)
qemu_exe="qemu-system-arm"
cpu="cortex-a15"
[ -n "$kernel" ] || kernel="$o_bindir/openwrt-$o_target-${o_subtarget%-*}-zImage-initramfs"
[ -n "$kernel" ] || kernel="$o_bindir/openwrt-$o_target-${o_subtarget%-*}-generic-initramfs-kernel.bin"
;;
64)
armv8)
qemu_exe="qemu-system-aarch64"
cpu="cortex-a57"
[ -n "$kernel" ] || kernel="$o_bindir/openwrt-$o_target-${o_subtarget%-*}-Image-initramfs"
[ -n "$kernel" ] || kernel="$o_bindir/openwrt-$o_target-${o_subtarget%-*}-generic-initramfs-kernel.bin"
;;
*)
__errmsg "target $o_target: unknown subtarget $o_subtarget"
@ -328,7 +328,7 @@ start_qemu_x86() {
start_qemu() {
case "$o_target" in
armvirt) start_qemu_armvirt ;;
armsr) start_qemu_armsr ;;
malta) start_qemu_malta ;;
x86) start_qemu_x86 ;;
*)

View file

@ -48,12 +48,12 @@ def get_kernel_header(args):
struct.pack_into('<L', header, 0x2c, rootfs_size)
struct.pack_into('<L', header, 0x30, crc)
rootfs_end_offset = args.rootfs_offset + rootfs_size
struct.pack_into('<L', header, 0x4, rootfs_end_offset)
kernel_size = os.path.getsize(args.kernel_file)
struct.pack_into('<L', header, 0x14, kernel_size)
kernel_end_offset = args.kernel_offset + kernel_size
struct.pack_into('<L', header, 0x4, kernel_end_offset)
buf = open(args.kernel_file,'rb').read()
crc = binascii.crc32(buf) & 0xffffffff
struct.pack_into('<L', header, 0x18, crc)

View file

@ -4,8 +4,8 @@
include $(TOPDIR)/rules.mk
BOARD:=armvirt
BOARDNAME:=QEMU ARM Virtual Machine
BOARD:=armsr
BOARDNAME:=Arm SystemReady (EFI) compliant
FEATURES:=fpu pci pcie rtc usb boot-part rootfs-part
FEATURES+=cpiogz ext4 ramdisk squashfs targz vmdk

View file

@ -1,37 +1,41 @@
This target generates images that can be used on ARM machines with EFI
support (e.g EDKII/TianoCore or U-Boot with bootefi).
There are two subtargets:
- armv7 for 32-bit machines
- armv8 for 64-bit machines
The kernel and filesystem images can also be used directly by QEMU:
Run with qemu-system-arm
# boot with initramfs embedded in
qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-initramfs-kernel.bin
qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armsr-armv7-generic-initramfs-kernel.bin
# boot with accel=kvm
qemu-system-arm -nographic -M virt,accel=kvm -cpu host -m 64 -kernel
openwrt-armvirt-32-generic-initramfs-kernel.bin
openwrt-armsr-armv7-generic-initramfs-kernel.bin
# boot with a separate rootfs
qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-kernel.bin \
-drive file=openwrt-armvirt-32-generic-ext4-rootfs.img,format=raw,if=virtio -append 'root=/dev/vda rootwait'
qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armsr-armv7-generic-kernel.bin \
-drive file=openwrt-armsr-armv7-generic-ext4-rootfs.img,format=raw,if=virtio -append 'root=/dev/vda rootwait'
# boot with local dir as rootfs
qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-kernel.bin \
-fsdev local,id=rootdev,path=root-armvirt/,security_model=none \
qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armsr-armv7-generic-kernel.bin \
-fsdev local,id=rootdev,path=root-armsr/,security_model=none \
-device virtio-9p-pci,fsdev=rootdev,mount_tag=/dev/root \
-append 'rootflags=trans=virtio,version=9p2000.L,cache=loose rootfstype=9p'
Run with kvmtool
# start a named machine
lkvm run -k openwrt-armvirt-32-zImage -i openwrt-armvirt-32-rootfs.cpio --name armvirt0
lkvm run -k openwrt-armsr-armv7-zImage -i openwrt-armsr-armv7-rootfs.cpio --name armsr0
# start with virtio-9p rootfs
lkvm run -k openwrt-armvirt-32-zImage -d root-armvirt/
lkvm run -k openwrt-armsr-armv7-zImage -d root-armsr/
# stop "armvirt0"
lkvm stop --name armvirt0
# stop "armsr0"
lkvm stop --name armsr0
# stop all
lkvm stop --all
@ -39,16 +43,16 @@ Run with kvmtool
The multi-platform ARMv8 target can be used with QEMU:
qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic \
-kernel openwrt-armvirt-64-generic-initramfs-kernel.bin \
-kernel openwrt-armsr-armv8-generic-initramfs-kernel.bin \
With a EDKII or U-Boot binary for the QEMU ARM virtual machines, you can use these
images in EFI mode:
32-bit:
gunzip -c bin/targets/armvirt/32/openwrt-armvirt-32-generic-ext4-combined.img.gz > openwrt-arm-32.img
gunzip -c bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-ext4-combined.img.gz > openwrt-arm-32.img
qemu-system-arm -nographic \
-cpu cortex-a15 -machine virt \
-bios QEMU_EFI_32.fd \
-bios bin/targets/armsr/armv7/u-boot-qemu_armv7/u-boot.bin \
-smp 1 -m 1024 \
-device virtio-rng-pci \
-drive file=openwrt-arm-32.img,format=raw,index=0,media=disk \
@ -56,17 +60,16 @@ qemu-system-arm -nographic \
-netdev user,id=testwan -net nic,netdev=testwan
64-bit:
gunzip -c bin/targets/armvirt/64/openwrt-armvirt-64-generic-ext4-combined.img.gz > openwrt-arm-64.img
gunzip -c bin/targets/armsr/armv8/openwrt-armsr-armv8-generic-ext4-combined.img.gz > openwrt-arm-64.img
qemu-system-aarch64 -nographic \
-cpu cortex-a53 -machine virt \
-bios QEMU_EFI_64.fd \
-bios bin/targets/armsr/armv8/u-boot-qemu_armv8/u-boot.bin \
-smp 1 -m 1024 \
-device virtio-rng-pci \
-drive file=openwrt-arm-64.img,format=raw,index=0,media=disk \
-netdev user,id=testlan -net nic,netdev=testlan \
-netdev user,id=testwan -net nic,netdev=testwan
One can find EFI/BIOS binaries from:
- Compile mainline U-Boot for the QEMU ARM virtual machine (qemu_arm_defconfig/qemu_arm64_defconfig)
- From distribution packages (such as qemu-efi-arm and qemu-efi-aarch64 in Debian)
One can obtain other EFI/BIOS binaries from:
- Distribution packages (such as qemu-efi-arm and qemu-efi-aarch64 in Debian)
- Community builds, like retrage/edk2-nightly: https://retrage.github.io/edk2-nightly/

View file

@ -1,6 +1,6 @@
ARCH:=arm
SUBTARGET:=32
BOARDNAME:=32-bit ARM QEMU Virtual Machine
SUBTARGET:=armv7
BOARDNAME:=32-bit (armv7) machines
CPU_TYPE:=cortex-a15
CPU_SUBTYPE:=neon-vfpv4
KERNELNAME:=zImage

View file

@ -1,6 +1,6 @@
ARCH:=aarch64
SUBTARGET:=64
BOARDNAME:=64-bit ARM machines
SUBTARGET:=armv8
BOARDNAME:=64-bit (armv8) machines
define Target/Description
Build multi-platform images for the ARMv8 instruction set architecture

View file

@ -73,7 +73,7 @@ define Build/grub-install
$(INSTALL_DIR) $@.grub2
endef
DEVICE_VARS += GRUB2_VARIANT
DEVICE_VARS += GRUB2_VARIANT UBOOT
define Device/efi-default
IMAGE/rootfs.img := append-rootfs | pad-to $(ROOTFS_PARTSIZE)
IMAGE/rootfs.img.gz := append-rootfs | pad-to $(ROOTFS_PARTSIZE) | gzip
@ -105,6 +105,7 @@ define Device/generic
DEVICE_TITLE := Generic EFI Boot
GRUB2_VARIANT := generic
FILESYSTEMS := ext4 squashfs
UBOOT := $(if $(CONFIG_aarch64),qemu_armv8,qemu_armv7)
DEVICE_PACKAGES += kmod-amazon-ena kmod-e1000e kmod-vmxnet3 kmod-rtc-rx8025 \
kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils kmod-wdt-sp805 \
kmod-mvneta kmod-mvpp2 kmod-fsl-dpaa1-net kmod-fsl-dpaa2-net \

View file

@ -1,7 +1,7 @@
define KernelPackage/acpi-mdio
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=ACPI MDIO support
DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-mdio-devres
DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-mdio-devres
KCONFIG:=CONFIG_ACPI_MDIO
FILES:=$(LINUX_DIR)/drivers/net/mdio/acpi_mdio.ko
AUTOLOAD:=$(call AutoLoad,11,acpi_mdio)
@ -15,7 +15,7 @@ $(eval $(call KernelPackage,acpi-mdio))
define KernelPackage/fsl-pcs-lynx
SUBMENU=$(NETWORK_DEVICES_MENU)
DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-phylink
DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio +kmod-phylink
TITLE:=NXP (Freescale) Lynx PCS
HIDDEN:=1
KCONFIG:=CONFIG_PCS_LYNX
@ -28,7 +28,7 @@ $(eval $(call KernelPackage,fsl-pcs-lynx))
define KernelPackage/pcs-xpcs
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Synopsis DesignWare PCS driver
DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink
DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink
KCONFIG:=CONFIG_PCS_XPCS
FILES:=$(LINUX_DIR)/drivers/net/pcs/pcs_xpcs.ko
AUTOLOAD:=$(call AutoLoad,20,pcs_xpcs)
@ -38,7 +38,7 @@ $(eval $(call KernelPackage,pcs-xpcs))
define KernelPackage/fsl-fec
SUBMENU:=$(NETWORK_DEVICES_MENU)
DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio \
DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio \
+kmod-ptp +kmod-net-selftests
TITLE:=NXP (Freescale) FEC Ethernet controller (i.MX)
KCONFIG:=CONFIG_FEC
@ -50,7 +50,7 @@ $(eval $(call KernelPackage,fsl-fec))
define KernelPackage/fsl-xgmac-mdio
SUBMENU=$(NETWORK_DEVICES_MENU)
DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio
DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio
TITLE:=NXP (Freescale) MDIO bus
KCONFIG:=CONFIG_FSL_XGMAC_MDIO
FILES=$(LINUX_DIR)/drivers/net/ethernet/freescale/xgmac_mdio.ko
@ -74,7 +74,7 @@ $(eval $(call KernelPackage,fsl-mc-dpio))
define KernelPackage/fsl-enetc-net
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=:NXP ENETC (LS1028A) Ethernet
DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink +kmod-fsl-pcs-lynx
DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink +kmod-fsl-pcs-lynx
KCONFIG:= \
CONFIG_FSL_ENETC \
CONFIG_FSL_ENETC_VF \
@ -92,7 +92,7 @@ $(eval $(call KernelPackage,fsl-enetc-net))
define KernelPackage/fsl-dpaa1-net
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=NXP DPAA1 (LS1043/LS1046) Ethernet
DEPENDS:=@(TARGET_armvirt_64) +kmod-fsl-xgmac-mdio +kmod-libphy +kmod-crypto-crc32
DEPENDS:=@(TARGET_armsr_armv8) +kmod-fsl-xgmac-mdio +kmod-libphy +kmod-crypto-crc32
KCONFIG:= \
CONFIG_FSL_DPAA=y \
CONFIG_FSL_DPAA_ETH \
@ -112,7 +112,7 @@ $(eval $(call KernelPackage,fsl-dpaa1-net))
define KernelPackage/fsl-dpaa2-net
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=NXP DPAA2 Ethernet
DEPENDS:=@(TARGET_armvirt_64) +kmod-fsl-xgmac-mdio +kmod-phylink \
DEPENDS:=@(TARGET_armsr_armv8) +kmod-fsl-xgmac-mdio +kmod-phylink \
+kmod-fsl-pcs-lynx +kmod-fsl-mc-dpio
KCONFIG:= \
CONFIG_FSL_MC_UAPI_SUPPORT=y \
@ -127,7 +127,7 @@ $(eval $(call KernelPackage,fsl-dpaa2-net))
define KernelPackage/fsl-dpaa2-console
SUBMENU:=$(OTHER_MENU)
TITLE:=NXP DPAA2 Debug console
DEPENDS:=@(TARGET_armvirt_64)
DEPENDS:=@(TARGET_armsr_armv8)
KCONFIG:=CONFIG_DPAA2_CONSOLE
FILES=$(LINUX_DIR)/drivers/soc/fsl/dpaa2-console.ko
AUTOLOAD=$(call AutoLoad,40,dpaa2-console)
@ -143,7 +143,7 @@ $(eval $(call KernelPackage,fsl-dpaa2-console))
define KernelPackage/marvell-mdio
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Marvell Armada platform MDIO driver
DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio
DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio
KCONFIG:=CONFIG_MVMDIO
FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvmdio.ko
AUTOLOAD=$(call AutoLoad,30,marvell-mdio)
@ -154,7 +154,7 @@ $(eval $(call KernelPackage,marvell-mdio))
define KernelPackage/phy-marvell-10g
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Marvell Alaska 10G PHY driver
DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy
DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy
KCONFIG:=CONFIG_MARVELL_10G_PHY
FILES=$(LINUX_DIR)/drivers/net/phy/marvell10g.ko
AUTOLOAD=$(call AutoLoad,35,marvell10g)
@ -165,7 +165,7 @@ $(eval $(call KernelPackage,phy-marvell-10g))
define KernelPackage/mvneta
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Marvell Armada 370/38x/XP/37xx network driver
DEPENDS:=@(TARGET_armvirt_64) +kmod-marvell-mdio +kmod-phylink
DEPENDS:=@(TARGET_armsr_armv8) +kmod-marvell-mdio +kmod-phylink
KCONFIG:=CONFIG_MVNETA
FILES:=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvneta.ko
AUTOLOAD=$(call AutoLoad,30,mvneta)
@ -176,7 +176,7 @@ $(eval $(call KernelPackage,mvneta))
define KernelPackage/mvpp2
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Marvell Armada 375/7K/8K network driver
DEPENDS:=@(TARGET_armvirt_64) +kmod-marvell-mdio +kmod-phylink
DEPENDS:=@(TARGET_armsr_armv8) +kmod-marvell-mdio +kmod-phylink
KCONFIG:=CONFIG_MVPP2 \
CONFIG_MVPP2_PTP=n
FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvpp2/mvpp2.ko
@ -208,7 +208,7 @@ $(eval $(call KernelPackage,imx7-ulp-wdt))
define KernelPackage/stmmac-core
SUBMENU=$(NETWORK_DEVICES_MENU)
TITLE:=Synopsis Ethernet Controller core (NXP,STMMicro,others)
DEPENDS:=@(TARGET_armvirt_64) +kmod-pcs-xpcs +kmod-ptp \
DEPENDS:=@(TARGET_armsr_armv8) +kmod-pcs-xpcs +kmod-ptp \
+kmod-of-mdio
KCONFIG:=CONFIG_STMMAC_ETH \
CONFIG_STMMAC_SELFTESTS=n \
@ -259,7 +259,7 @@ $(eval $(call KernelPackage,dwmac-rockchip))
define KernelPackage/thunderx-net
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Marvell (Cavium) ThunderX/2 network drivers
DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink +kmod-of-mdio
DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink +kmod-of-mdio
KCONFIG:=CONFIG_NET_VENDOR_CAVIUM \
CONFIG_THUNDER_NIC_PF \
CONFIG_THUNDER_NIC_VF \

View file

@ -1,77 +0,0 @@
CONFIG_ALIGNMENT_TRAP=y
CONFIG_ARCH_32BIT_OFF_T=y
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
CONFIG_ARCH_MULTIPLATFORM=y
CONFIG_ARCH_MULTI_V6_V7=y
CONFIG_ARCH_MULTI_V7=y
CONFIG_ARCH_NR_GPIO=0
CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y
CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
CONFIG_ARCH_VIRT=y
CONFIG_ARM=y
CONFIG_ARM_CPU_SUSPEND=y
CONFIG_ARM_CRYPTO=y
CONFIG_ARM_HAS_SG_CHAIN=y
CONFIG_ARM_HEAVY_MB=y
CONFIG_ARM_L1_CACHE_SHIFT=6
CONFIG_ARM_L1_CACHE_SHIFT_6=y
CONFIG_ARM_LPAE=y
CONFIG_ARM_PATCH_IDIV=y
CONFIG_ARM_PATCH_PHYS_VIRT=y
CONFIG_ARM_PSCI=y
CONFIG_ARM_THUMB=y
CONFIG_ARM_UNWIND=y
CONFIG_ARM_VIRT_EXT=y
CONFIG_AUTO_ZRELADDR=y
CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y
CONFIG_CACHE_L2X0=y
CONFIG_COMPAT_32BIT_TIME=y
CONFIG_CPU_32v6K=y
CONFIG_CPU_32v7=y
CONFIG_CPU_ABRT_EV7=y
CONFIG_CPU_CACHE_V7=y
CONFIG_CPU_CACHE_VIPT=y
CONFIG_CPU_COPY_V6=y
CONFIG_CPU_CP15=y
CONFIG_CPU_CP15_MMU=y
CONFIG_CPU_HAS_ASID=y
CONFIG_CPU_PABRT_V7=y
CONFIG_CPU_SPECTRE=y
CONFIG_CPU_THUMB_CAPABLE=y
CONFIG_CPU_TLB_V7=y
CONFIG_CPU_V7=y
CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
CONFIG_DMA_OPS=y
CONFIG_EDAC_ATOMIC_SCRUB=y
CONFIG_GENERIC_IRQ_MULTI_HANDLER=y
CONFIG_GENERIC_VDSO_32=y
CONFIG_HARDEN_BRANCH_PREDICTOR=y
CONFIG_HAVE_SMP=y
CONFIG_HZ_FIXED=0
CONFIG_HZ_PERIODIC=y
CONFIG_MIGHT_HAVE_CACHE_L2X0=y
CONFIG_MODULES_USE_ELF_REL=y
CONFIG_NEON=y
CONFIG_NR_CPUS=4
CONFIG_OLD_SIGACTION=y
CONFIG_OLD_SIGSUSPEND3=y
CONFIG_OUTER_CACHE=y
CONFIG_OUTER_CACHE_SYNC=y
CONFIG_PAGE_OFFSET=0xC0000000
CONFIG_PERF_USE_VMALLOC=y
CONFIG_RTC_MC146818_LIB=y
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SMP_ON_UP=y
CONFIG_SWP_EMULATE=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
CONFIG_UNWINDER_ARM=y
CONFIG_USE_OF=y
CONFIG_VFP=y
CONFIG_VFPv3=y
CONFIG_XZ_DEC_ARM=y
CONFIG_XZ_DEC_BCJ=y
CONFIG_ZBOOT_ROM_BSS=0
CONFIG_ZBOOT_ROM_TEXT=0

View file

@ -1,154 +0,0 @@
CONFIG_64BIT=y
CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
CONFIG_ARCH_MMAP_RND_BITS=18
CONFIG_ARCH_MMAP_RND_BITS_MAX=24
CONFIG_ARCH_MMAP_RND_BITS_MIN=18
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
CONFIG_ARCH_PROC_KCORE_TEXT=y
CONFIG_ARCH_STACKWALK=y
CONFIG_ARCH_VEXPRESS=y
CONFIG_ARCH_WANTS_NO_INSTR=y
CONFIG_ARM64=y
CONFIG_ARM64_4K_PAGES=y
CONFIG_ARM64_CNP=y
CONFIG_ARM64_CRYPTO=y
CONFIG_ARM64_EPAN=y
CONFIG_ARM64_ERRATUM_1165522=y
CONFIG_ARM64_ERRATUM_1286807=y
CONFIG_ARM64_ERRATUM_819472=y
CONFIG_ARM64_ERRATUM_824069=y
CONFIG_ARM64_ERRATUM_826319=y
CONFIG_ARM64_ERRATUM_827319=y
CONFIG_ARM64_ERRATUM_832075=y
CONFIG_ARM64_ERRATUM_843419=y
CONFIG_ARM64_HW_AFDBM=y
CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y
CONFIG_ARM64_PAGE_SHIFT=12
CONFIG_ARM64_PAN=y
CONFIG_ARM64_PA_BITS=48
CONFIG_ARM64_PA_BITS_48=y
CONFIG_ARM64_PTR_AUTH=y
CONFIG_ARM64_PTR_AUTH_KERNEL=y
CONFIG_ARM64_SVE=y
CONFIG_ARM64_TAGGED_ADDR_ABI=y
CONFIG_ARM64_VA_BITS=39
CONFIG_ARM64_VA_BITS_39=y
CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y
CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y
CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y
CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND=y
CONFIG_ARM_SBSA_WATCHDOG=y
CONFIG_ATOMIC64_SELFTEST=y
CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_BLK_PM=y
CONFIG_CAVIUM_TX2_ERRATUM_219=y
CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
CONFIG_CLK_SP810=y
CONFIG_CLK_VEXPRESS_OSC=y
# CONFIG_COMPAT_32BIT_TIME is not set
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE_GOV_MENU=y
CONFIG_CPU_LITTLE_ENDIAN=y
CONFIG_CPU_PM=y
CONFIG_CRYPTO_AES_ARM64=y
CONFIG_CRYPTO_AES_ARM64_BS=y
CONFIG_CRYPTO_AES_ARM64_CE=y
CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y
CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=y
CONFIG_CRYPTO_BLAKE2S=y
CONFIG_CRYPTO_CHACHA20=y
CONFIG_CRYPTO_CHACHA20_NEON=y
CONFIG_CRYPTO_CRYPTD=y
CONFIG_CRYPTO_GHASH_ARM64_CE=y
CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
CONFIG_CRYPTO_LIB_CHACHA_GENERIC=y
CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA1_ARM64_CE=y
CONFIG_CRYPTO_SHA256_ARM64=y
CONFIG_CRYPTO_SHA2_ARM64_CE=y
CONFIG_CRYPTO_SHA512_ARM64=y
CONFIG_CRYPTO_SIMD=y
CONFIG_DMA_DIRECT_REMAP=y
CONFIG_DMA_SHARED_BUFFER=y
CONFIG_DRM=y
CONFIG_DRM_BOCHS=y
CONFIG_DRM_BRIDGE=y
CONFIG_DRM_GEM_SHMEM_HELPER=y
CONFIG_DRM_KMS_HELPER=y
CONFIG_DRM_PANEL=y
CONFIG_DRM_PANEL_BRIDGE=y
CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y
CONFIG_DRM_QXL=y
CONFIG_DRM_TTM=y
CONFIG_DRM_TTM_HELPER=y
CONFIG_DRM_VIRTIO_GPU=y
CONFIG_DRM_VRAM_HELPER=y
CONFIG_FB=y
CONFIG_FB_ARMCLCD=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_CMDLINE=y
CONFIG_FB_MODE_HELPERS=y
CONFIG_FRAME_POINTER=y
CONFIG_FSL_ERRATUM_A008585=y
CONFIG_FUJITSU_ERRATUM_010001=y
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
CONFIG_GENERIC_CSUM=y
CONFIG_GENERIC_FIND_FIRST_BIT=y
CONFIG_GPIO_GENERIC=y
CONFIG_GPIO_GENERIC_PLATFORM=y
CONFIG_HDMI=y
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_ARM_SMCCC_TRNG=y
CONFIG_HW_RANDOM_VIRTIO=y
CONFIG_I2C=y
CONFIG_I2C_ALGOBIT=y
CONFIG_I2C_BOARDINFO=y
CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
CONFIG_KCMP=y
CONFIG_LCD_CLASS_DEVICE=m
# CONFIG_LCD_PLATFORM is not set
CONFIG_MFD_CORE=y
CONFIG_MFD_SYSCON=y
CONFIG_MFD_VEXPRESS_SYSREG=y
CONFIG_MMC=y
CONFIG_MMC_ARMMMCI=y
CONFIG_MODULES_USE_ELF_RELA=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_NO_HZ=y
CONFIG_NO_HZ_COMMON=y
CONFIG_NO_HZ_IDLE=y
CONFIG_NR_CPUS=64
CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y
CONFIG_PM=y
CONFIG_PM_CLK=y
CONFIG_PM_GENERIC_DOMAINS=y
CONFIG_PM_GENERIC_DOMAINS_OF=y
CONFIG_POWER_RESET=y
CONFIG_POWER_RESET_VEXPRESS=y
CONFIG_POWER_SUPPLY=y
CONFIG_QUEUED_RWLOCKS=y
CONFIG_QUEUED_SPINLOCKS=y
CONFIG_REGMAP=y
CONFIG_REGMAP_MMIO=y
CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
CONFIG_RTC_I2C_AND_SPI=y
CONFIG_SMC91X=y
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
CONFIG_SYNC_FILE=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_THREAD_INFO_IN_TASK=y
CONFIG_UNMAP_KERNEL_AT_EL0=y
CONFIG_VEXPRESS_CONFIG=y
CONFIG_VIDEOMODE_HELPERS=y
CONFIG_VIRTIO_DMA_SHARED_BUFFER=y
CONFIG_VMAP_STACK=y
CONFIG_WATCHDOG_CORE=y
CONFIG_ZONE_DMA32=y

View file

@ -1,155 +0,0 @@
CONFIG_9P_FS=y
# CONFIG_9P_FS_POSIX_ACL is not set
# CONFIG_9P_FS_SECURITY is not set
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_KEEP_MEMBLOCK=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARM_AMBA=y
CONFIG_ARM_ARCH_TIMER=y
CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
CONFIG_ARM_GIC=y
CONFIG_ARM_GIC_V2M=y
CONFIG_ARM_GIC_V3=y
CONFIG_ARM_GIC_V3_ITS=y
CONFIG_ARM_GIC_V3_ITS_PCI=y
CONFIG_ARM_PSCI_FW=y
CONFIG_BALLOON_COMPACTION=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_MQ_PCI=y
CONFIG_BLK_MQ_VIRTIO=y
CONFIG_CLONE_BACKWARDS=y
CONFIG_COMMON_CLK=y
CONFIG_CPU_RMAP=y
CONFIG_CRC16=y
CONFIG_CRYPTO_CRC32=y
CONFIG_CRYPTO_CRC32C=y
CONFIG_CRYPTO_RNG2=y
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DMADEVICES=y
CONFIG_DMA_ENGINE=y
CONFIG_DMA_OF=y
CONFIG_DMA_REMAP=y
CONFIG_DTC=y
CONFIG_EDAC_SUPPORT=y
CONFIG_EXT4_FS=y
CONFIG_F2FS_FS=y
CONFIG_FAILOVER=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_FS_IOMAP=y
CONFIG_FS_MBCACHE=y
CONFIG_FW_LOADER_PAGED_BUF=y
CONFIG_GENERIC_ALLOCATOR=y
CONFIG_GENERIC_ARCH_TOPOLOGY=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CPU_AUTOPROBE=y
CONFIG_GENERIC_CPU_VULNERABILITIES=y
CONFIG_GENERIC_EARLY_IOREMAP=y
CONFIG_GENERIC_GETTIMEOFDAY=y
CONFIG_GENERIC_IDLE_POLL_SETUP=y
CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
CONFIG_GENERIC_IRQ_MIGRATION=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_GENERIC_MSI_IRQ_DOMAIN=y
CONFIG_GENERIC_PCI_IOMAP=y
CONFIG_GENERIC_SCHED_CLOCK=y
CONFIG_GENERIC_SMP_IDLE_THREAD=y
CONFIG_GENERIC_STRNCPY_FROM_USER=y
CONFIG_GENERIC_STRNLEN_USER=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GPIOLIB_IRQCHIP=y
CONFIG_GPIO_CDEV=y
CONFIG_GPIO_PL061=y
CONFIG_HANDLE_DOMAIN_IRQ=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_HAS_DMA=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT_MAP=y
CONFIG_HOTPLUG_CPU=y
CONFIG_HVC_DRIVER=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_IRQCHIP=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_IRQ_WORK=y
CONFIG_JBD2=y
CONFIG_LIBFDT=y
CONFIG_LOCK_DEBUGGING_SUPPORT=y
CONFIG_LOCK_SPIN_ON_OWNER=y
CONFIG_MEMFD_CREATE=y
CONFIG_MEMORY_BALLOON=y
CONFIG_MIGRATION=y
CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NET_9P=y
# CONFIG_NET_9P_DEBUG is not set
CONFIG_NET_9P_VIRTIO=y
CONFIG_NET_FAILOVER=y
CONFIG_NET_FLOW_LIMIT=y
CONFIG_NLS=y
CONFIG_NVMEM=y
CONFIG_OF=y
CONFIG_OF_ADDRESS=y
CONFIG_OF_EARLY_FLATTREE=y
CONFIG_OF_FLATTREE=y
CONFIG_OF_GPIO=y
CONFIG_OF_IRQ=y
CONFIG_OF_KOBJ=y
CONFIG_PADATA=y
CONFIG_PAGE_REPORTING=y
CONFIG_PARTITION_PERCPU=y
CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCI_DOMAINS_GENERIC=y
CONFIG_PCI_ECAM=y
CONFIG_PCI_HOST_COMMON=y
CONFIG_PCI_HOST_GENERIC=y
CONFIG_PCI_MSI=y
CONFIG_PCI_MSI_IRQ_DOMAIN=y
CONFIG_PGTABLE_LEVELS=3
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
CONFIG_RATIONAL=y
CONFIG_RFS_ACCEL=y
CONFIG_RPS=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_PL031=y
CONFIG_RWSEM_SPIN_ON_OWNER=y
CONFIG_SCSI=y
CONFIG_SCSI_COMMON=y
CONFIG_SCSI_VIRTIO=y
CONFIG_SERIAL_8250_FSL=y
CONFIG_SERIAL_AMBA_PL011=y
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_SERIAL_MCTRL_GPIO=y
CONFIG_SG_POOL=y
CONFIG_SMP=y
CONFIG_SOCK_RX_QUEUE_MAPPING=y
CONFIG_SPARSE_IRQ=y
CONFIG_SRCU=y
CONFIG_SWIOTLB=y
CONFIG_TICK_CPU_ACCOUNTING=y
CONFIG_TIMER_OF=y
CONFIG_TIMER_PROBE=y
CONFIG_TREE_RCU=y
CONFIG_TREE_SRCU=y
CONFIG_USB_SUPPORT=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
CONFIG_VIRTIO_NET=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_PCI_LEGACY=y
CONFIG_VIRTIO_PCI_LIB=y
CONFIG_XPS=y

View file

@ -1,6 +1,6 @@
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -95,6 +95,10 @@ config IP17XX_PHY
@@ -96,6 +96,10 @@ config IP17XX_PHY
tristate "Driver for IC+ IP17xx switches"
select SWCONFIG

View file

@ -0,0 +1,172 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qca956x.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
compatible = "tplink,tl-wdr6500-v2", "qca,qca9561";
model = "TP-Link TL-WDR6500 v2";
aliases {
led-boot = &led_system;
led-failsafe = &led_system;
led-running = &led_system;
led-upgrade = &led_system;
label-mac-device = &eth1;
};
keys {
compatible = "gpio-keys";
reset {
label = "Reset button";
linux,code = <KEY_RESTART>;
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
lan4 {
label = "green:lan4";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
};
lan3 {
label = "green:lan3";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
lan2 {
label = "green:lan2";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
};
lan1 {
label = "green:lan1";
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
};
wan {
label = "green:wan";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
};
led_system: system {
label = "white:system";
gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
};
};
&spi {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <25000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x010000>;
read-only;
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_uboot_0fc00: macaddr@0fc00 {
reg = <0x0fc00 0x6>;
};
};
partition@10000 {
compatible = "tplink,firmware";
label = "firmware";
reg = <0x010000 0x7e0000>;
};
partition@7f0000 {
label = "art";
reg = <0x7f0000 0x010000>;
read-only;
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
calibration_ath9k: calibration@1000 {
reg = <0x1000 0x440>;
};
calibration_ath10k: calibration@5000 {
reg = <0x5000 0x844>;
};
};
};
};
};
&uart {
status = "okay";
};
&pcie {
status = "okay";
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0 0 0 0 0>;
nvmem-cells = <&macaddr_uboot_0fc00>, <&calibration_ath10k>;
nvmem-cell-names = "mac-address", "calibration";
mac-address-increment = <(-2)>;
};
};
&mdio0 {
status = "okay";
};
&eth0 {
status = "okay";
phy-handle = <&swphy4>;
nvmem-cells = <&macaddr_uboot_0fc00>;
nvmem-cell-names = "mac-address";
mac-address-increment = <1>;
};
&eth1 {
status = "okay";
nvmem-cells = <&macaddr_uboot_0fc00>;
nvmem-cell-names = "mac-address";
};
&wmac {
status = "okay";
nvmem-cells = <&macaddr_uboot_0fc00>, <&calibration_ath9k>;
nvmem-cell-names = "mac-address", "calibration";
mac-address-increment = <(-1)>;
};
&usb0 {
status = "okay";
};
&usb_phy0 {
status = "okay";
};

View file

@ -30,6 +30,13 @@ tplink,cpe610-v2|\
tplink,tl-wa1201-v2)
ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0"
;;
tplink,tl-wdr6500-v2)
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
ucidef_set_led_switch "lan1" "LAN1" "green:lan1" "switch0" "0x02"
ucidef_set_led_switch "lan2" "LAN2" "green:lan2" "switch0" "0x04"
ucidef_set_led_switch "lan3" "LAN3" "green:lan3" "switch0" "0x08"
ucidef_set_led_switch "lan4" "LAN4" "green:lan4" "switch0" "0x10"
;;
alfa-network,n2q)
ucidef_set_led_netdev "lan2" "LAN2" "orange:lan2" "eth1"
ucidef_set_led_switch "lan1" "LAN1" "orange:lan1" "switch0" "0x10"

View file

@ -247,7 +247,8 @@ ath79_setup_interfaces()
comfast,cf-e560ac|\
qca,ap143-8m|\
qca,ap143-16m|\
tplink,tl-wr841hp-v3)
tplink,tl-wr841hp-v3|\
tplink,tl-wdr6500-v2)
ucidef_set_interface_wan "eth1"
ucidef_add_switch "switch0" \
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"

View file

@ -676,6 +676,22 @@ define Device/tplink_tl-wdr4900-v2
endef
TARGET_DEVICES += tplink_tl-wdr4900-v2
define Device/tplink_tl-wdr6500-v2
$(Device/tplink-8mlzma)
SOC := qca9561
DEVICE_MODEL := TL-WDR6500
DEVICE_VARIANT := v2
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev \
kmod-ath9k kmod-ath10k-ct ath10k-firmware-qca988x-ct
IMAGE_SIZE := 8000k
KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
TPLINK_HWID := 0x65000002
TPLINK_HEADER_VERSION := 1
SUPPORTED_DEVICES += tl-wdr6500-v2
endef
TARGET_DEVICES += tplink_tl-wdr6500-v2
define Device/tplink_tl-wdr7500-v3
$(Device/tplink-8mlzma)
SOC := qca9558

View file

@ -336,7 +336,7 @@ SVN-Revision: 35130
#endif /* _LINUX_TYPES_H */
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1475,8 +1475,8 @@ struct sk_buff *inet_gro_receive(struct
@@ -1477,8 +1477,8 @@ struct sk_buff *inet_gro_receive(struct
if (unlikely(ip_fast_csum((u8 *)iph, 5)))
goto out_unlock;

View file

@ -9,7 +9,7 @@ Subject: [PATCH] Added Device IDs for August DVB-T 205
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1944,6 +1944,10 @@ static const struct usb_device_id rtl28x
@@ -1964,6 +1964,10 @@ static const struct usb_device_id rtl28x
&rtl28xxu_props, "Compro VideoMate U650F", NULL) },
{ DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd394,
&rtl28xxu_props, "MaxMedia HU394-T", NULL) },

View file

@ -33,7 +33,7 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
#define USB_VENDOR_ID_BELKIN 0x050d
#define USB_DEVICE_ID_FLIP_KVM 0x3201
@@ -1366,6 +1369,9 @@
@@ -1367,6 +1370,9 @@
#define USB_VENDOR_ID_XIAOMI 0x2717
#define USB_DEVICE_ID_MI_SILENT_MOUSE 0x5014

View file

@ -5,6 +5,7 @@
board_config_update
case "$(board_name)" in
comtrend,ar-5381u |\
comtrend,ar-5387un)
ucidef_set_bridge_device switch
ucidef_set_interface_lan "lan1 lan2 lan3 lan4"

View file

@ -3,6 +3,7 @@
. /lib/functions.sh
case "$(board_name)" in
comtrend,ar-5381u |\
comtrend,ar-5387un)
mtd fixtrx firmware
;;

View file

@ -6,6 +6,23 @@
board_config_update
case "$(board_name)" in
comtrend,wap-5813n)
ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1"
;;
netgear,dgnd3700-v1 |\
netgear,dgnd3800b)
ucidef_set_led_netdev "lan" "LAN" "green:lan" "switch.1"
ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan"
ucidef_set_led_netdev "wlan0" "WIFI2G" "green:wifi2g" "phy0-ap0"
ucidef_set_led_netdev "wlan1" "WIFI5G" "blue:wifi5g" "phy1-ap0"
ucidef_set_led_usbport "usb1" "USB1" "green:usb1" "usb1-port1" "usb2-port1"
ucidef_set_led_usbport "usb2" "USB2" "green:usb2" "usb1-port2" "usb2-port2"
;;
netgear,evg2000)
ucidef_set_led_netdev "lan" "LAN" "green:lan" "switch.1"
ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan"
ucidef_set_led_usbdev "usb" "USB" "green:usb" "usb1-port1" "usb2-port1" "usb1-port2" "usb2-port2"
;;
observa,vh4032n)
ucidef_set_led_usbport "usb1" "USB1" "blue:hspa" "usb1-port1" "usb2-port1"
ucidef_set_led_usbport "usb2" "USB2" "red:hspa" "1-2-port1" "1-2-port2"

View file

@ -10,6 +10,17 @@ observa,vh4032n)
ucidef_set_bridge_device switch
ucidef_set_interface_lan "lan1 lan2 lan3 lan4"
;;
comtrend,vr-3025un)
ucidef_set_bridge_device switch
ucidef_set_interface_lan "lan1 lan2 lan3 iptv"
;;
comtrend,wap-5813n |\
netgear,dgnd3700-v1 |\
netgear,dgnd3800b |\
netgear,evg2000)
ucidef_set_bridge_device switch
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
;;
esac
board_config_flush

View file

@ -4,6 +4,9 @@
case "$(board_name)" in
comtrend,vr-3025u |\
comtrend,vr-3025un |\
comtrend,wap-5813n |\
netgear,evg2000 |\
observa,vh4032n)
mtd fixtrx firmware
;;

View file

@ -8,10 +8,6 @@
led-failsafe = &led_power_red;
led-running = &led_power_green;
led-upgrade = &led_power_green;
led-internet = &led_internet_green;
led-usb = &led_mobile_green;
led-wireless = &led_wireless_green;
};
keys {
@ -56,7 +52,7 @@
label = "red:mobile";
};
led_mobile_green: led@1 {
led@1 {
reg = <1>;
label = "green:mobile";
};
@ -64,9 +60,10 @@
led_power_red: led@8 {
reg = <8>;
label = "red:power";
panic-indicator;
};
led_wireless_green: led@9 {
led@9 {
reg = <9>;
label = "green:wifi";
};
@ -86,7 +83,7 @@
label = "red:internet";
};
led_internet_green: led@15 {
led@15 {
reg = <15>;
label = "green:internet";
};

View file

@ -11,10 +11,6 @@
led-failsafe = &led_power_green;
led-running = &led_power_green;
led-upgrade = &led_power_green;
led-dsl = &led_dsl_green;
led-internet = &led_internet_green;
led-usb = &led_usb_green;
};
keys {
@ -78,13 +74,13 @@
label = "red:internet";
};
led_dsl_green: led@3 {
led@3 {
reg = <3>;
active-low;
label = "green:dsl";
};
led_usb_green: led@4 {
led@4 {
reg = <4>;
active-low;
label = "green:usb";
@ -96,7 +92,7 @@
label = "green:wps";
};
led_internet_green: led@8 {
led@8 {
reg = <8>;
active-low;
label = "green:internet";

View file

@ -11,10 +11,6 @@
led-failsafe = &led_power_red;
led-running = &led_power_red;
led-upgrade = &led_power_red;
led-internet = &led_internet_green;
led-usb = &led_modem_green;
led-wireless = &led_wireless_green;
};
i2c {
@ -82,7 +78,7 @@
label = "red:modem";
};
led_modem_green: led@2 {
led@2 {
reg = <2>;
label = "green:modem";
};
@ -107,7 +103,7 @@
label = "green:phone";
};
led_wireless_green: led@7 {
led@7 {
reg = <7>;
label = "green:wifi";
};
@ -117,7 +113,7 @@
label = "red:power";
};
led_internet_green: led@9 {
led@9 {
reg = <9>;
label = "green:internet";
};

View file

@ -11,10 +11,6 @@
led-failsafe = &led_power_red;
led-running = &led_power_green;
led-upgrade = &led_power_green;
led-dsl = &led_dsl_green;
led-internet = &led_internet_green;
led-usb = &led_usb_green;
};
keys {
@ -130,41 +126,41 @@
label = "green:power";
};
led_usb_green: led@2 {
led@2 {
reg = <2>;
active-low;
label = "green:usb";
};
led@4 {
/* EPHY0 Act */
reg = <4>;
brcm,hardware-controlled;
brcm,link-signal-sources = <4>;
/* EPHY0 Act */
};
led@5 {
/* EPHY1 Act */
reg = <5>;
brcm,hardware-controlled;
brcm,link-signal-sources = <5>;
/* EPHY1 Act */
};
led@6 {
/* EPHY2 Act */
reg = <6>;
brcm,hardware-controlled;
brcm,link-signal-sources = <6>;
/* EPHY2 Act */
};
led@7 {
/* EPHY3 Act */
reg = <7>;
brcm,hardware-controlled;
brcm,link-signal-sources = <7>;
/* EPHY3 Act */
};
led_internet_green: led@8 {
led@8 {
reg = <8>;
active-low;
label = "green:internet";
@ -176,7 +172,7 @@
label = "red:internet";
};
led_dsl_green: led@10 {
led@10 {
reg = <10>;
active-low;
label = "green:dsl";
@ -186,6 +182,7 @@
reg = <11>;
active-low;
label = "red:power";
panic-indicator;
};
};

View file

@ -0,0 +1,190 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "bcm6328.dtsi"
/ {
model = "Comtrend AR-5381u";
compatible = "comtrend,ar-5381u", "brcm,bcm6328";
aliases {
led-boot = &led_power_green;
led-failsafe = &led_alarm_red;
led-running = &led_power_green;
led-upgrade = &led_power_green;
};
keys {
compatible = "gpio-keys-polled";
poll-interval = <100>;
reset {
label = "reset";
gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
debounce-interval = <60>;
};
};
bcm43225-sprom {
compatible = "brcm,bcma-sprom";
pci-bus = <1>;
pci-dev = <0>;
nvmem-cells = <&macaddr_cfe_6a0>;
nvmem-cell-names = "mac-address";
mac-address-increment = <1>;
brcm,sprom = "brcm/bcm43225-sprom.bin";
brcm,sprom-fixups = <97 0xfee5>,
<98 0x157c>,
<99 0xfae7>,
<113 0xfefa>,
<114 0x15d6>,
<115 0xfaf8>;
};
};
&ehci {
status = "okay";
};
&ethernet {
status = "okay";
nvmem-cells = <&macaddr_cfe_6a0>;
nvmem-cell-names = "mac-address";
};
&hsspi {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
spi-max-frequency = <16666667>;
spi-tx-bus-width = <2>;
spi-rx-bus-width = <2>;
reg = <0>;
#address-cells = <1>;
#size-cells = <1>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
cfe: partition@0 {
reg = <0x000000 0x010000>;
label = "cfe";
read-only;
};
partition@10000 {
compatible = "brcm,bcm963xx-imagetag";
reg = <0x010000 0xfe0000>;
label = "firmware";
};
partition@ff0000 {
reg = <0xff0000 0x010000>;
label = "nvram";
};
};
};
};
&leds {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_leds>;
led_alarm_red: led@2 {
reg = <2>;
active-low;
label = "red:alarm";
panic-indicator;
};
led@3 {
reg = <3>;
active-low;
label = "green:internet";
};
led_power_green: led@4 {
reg = <4>;
active-low;
label = "green:power";
};
};
&ohci {
status = "okay";
};
&pcie {
status = "okay";
};
&pinctrl {
pinctrl_leds: leds {
function = "led";
pins = "gpio2", "gpio3", "gpio4";
};
};
&switch0 {
ports {
port@0 {
reg = <0>;
label = "lan1";
phy-handle = <&phy1>;
phy-mode = "mii";
};
port@1 {
reg = <1>;
label = "lan2";
phy-handle = <&phy2>;
phy-mode = "mii";
};
port@2 {
reg = <2>;
label = "lan3";
phy-handle = <&phy3>;
phy-mode = "mii";
};
port@3 {
reg = <3>;
label = "lan4";
phy-handle = <&phy4>;
phy-mode = "mii";
};
};
};
&uart0 {
status = "okay";
};
&usbh {
status = "okay";
};
&cfe {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_cfe_6a0: macaddr@6a0 {
reg = <0x6a0 0x6>;
};
};

View file

@ -11,9 +11,6 @@
led-failsafe = &led_power_red;
led-running = &led_power_green;
led-upgrade = &led_power_green;
led-dsl = &led_dsl_green;
led-internet = &led_internet_green;
};
keys {
@ -129,9 +126,10 @@
led_power_red: led@4 {
reg = <4>;
label = "red:power";
panic-indicator;
};
led_internet_green: led@7 {
led@7 {
reg = <7>;
label = "green:internet";
};
@ -141,7 +139,7 @@
label = "green:power";
};
led_dsl_green: led@11 {
led@11 {
reg = <11>;
active-low;
label = "green:dsl";

Some files were not shown because too many files have changed in this diff Show more