Skip to content

airoha: add support for Gemtek W1700K - #17869

Merged
openwrt-bot merged 4 commits into
openwrt:mainfrom
andrewjlamarche:w1700k
Mar 10, 2026
Merged

openwrt-bot merged 4 commits into
openwrt:mainfrom
andrewjlamarche:w1700k

Conversation

@andrewjlamarche

@andrewjlamarche andrewjlamarche commented Feb 6, 2025 •

Copy link
Copy Markdown
Contributor

This commit adds support for Gemtek (Centurylink/Lumen/Quantum Fiber)
W1700K.

Device specification

SoC Type: Airoha AN7581
RAM: ESMT M16U8G16512A (2GB)
Flash: Winbond 25N04KVZEIR (512MB)
Ethernet: 2x gigabit via AN7581, 2x 10g via RTL8261N
Wi-Fi: MT7996 - BE19000
LEDs: 1 LED, power/status
Button: Reset
USB ports: None
Bootloader: U-Boot 2014.04-rc1 (Jun 12 2024 - 08:14:34) AXON 2.0

This device is pretty useless with the stock firmware as it requires an
account to completely set it up. Additionally, the vendor bootloader is
signed and uses Airoha/Mediatek's BBT/BMT for bad block management on
the flash. It does not support UBI, thus kernel updates are subject to
BMT/BBT which OpenWrt does not support. In turn, if a kernel update
happens and a block is marked bad in the process, the device will fail
to boot and will need to be recovered via serial.

The workaround is to chainload U-Boot in place of the kernel, as it
should not need frequent updates and thus should not cause BBT/BMT to
misbehave and soft-brick the device. Upstream U-Boot supports loading
a FIT image from UBI, so we create a UBI partition for the new u-boot
env, FIT image and factory data. This way, bad blocks are managed by UBI
instead, which will not soft-brick the device should a block be marked
bad during a normal OpenWrt update. Users wishing to update U-Boot can
do so, but should be prepared to recover if a block goes bad.

Because the device is not useful with stock firmware, this is a one-way
ticket for most users and reverting will not be documented.

The following steps can be used to install OpenWrt on the W1700K.

Connect to serial console. There is a Torx T10 screw underneath the QR
code printed onto the label. Then, pry between the gray and white
plastic, starting by the ports on the back. There are clips arount the
entire device. Starting closest to the screw next to the UART header,
TX - GND - VCC - N/A - RX. The bootloader can be interrupted by
pressing any key.

Configuring Vendor Bootloader and Installing U-Boot Chainloader:
The bootloader's default bootcmd will only run a signed image. However,
we can still bootm our own image from flash.

NOTE: The vendor's ethernet drivers are flaky. You may have to reboot
and try the tftpboot part several times for it to work.

  • setenv one flash read 0x600000 0x1000000 $loadaddr
  • setenv two "; bootm"
  • setenv bootcmd "$one$two"
  • setenv one
  • setenv two
  • saveenv
  • setenv serverip 192.168.1.10; setenv ipaddr 192.168.1.1; tftpboot
    0x89000000 openwrt-airoha-an7581-gemtek_w1700k-ubi-chainload-uboot.itb
  • flash erase 0x600000 0x100000
  • flash write 0x600000 0x100000 0x89000000
  • reset

The device will now reboot into the U-Boot chainloader.

Loading the W1700K UBI Installer:
The installer can be downloaded at
https://github.com/hurrian/w1700k-ubi-installer/releases

Depends: #20450 and #20475

@github-actions github-actions Bot added kernel pull request/issue with Linux kernel related changes target/airoha pull request/issue for airoha target labels Feb 6, 2025
@mrkiko

mrkiko commented Feb 6, 2025

Copy link
Copy Markdown
Contributor

Hi! Thanks for your contribution.
Would it be possible to include in the commit any instruction or reference on how installation may be performed?

Thanks!

@Ansuel

Ansuel commented Feb 6, 2025

Copy link
Copy Markdown
Member

If this device makes trough I can see the price of the thing sky rocket on ebay... (or the ISP starting to lock down the device...)
Happened the same with one DSL modem here in italy... Price went from 9€ to 80-120€ just because there was a vulnerability and people could actually OWN the device... Fun thing hope this progress nicely!

@andrewjlamarche

Copy link
Copy Markdown
Contributor Author

Hi! Thanks for your contribution. Would it be possible to include in the commit any instruction or reference on how installation may be performed?

Thanks!

Yes, as soon as I have them ready I will add them.

@Ansuel

Ansuel commented Feb 6, 2025

Copy link
Copy Markdown
Member

Worth mention (working on USB support)

One USB port can be shared for HSGMII... The other port can be shared for PCIE2... It's possible some register are not correctly set to support this... Just giving clue of why PCIE2 might be silent.

Comment thread target/linux/airoha/image/an7581.mk Resolved
Comment thread target/linux/airoha/image/an7581.mk Resolved
@andrewjlamarche
andrewjlamarche force-pushed the w1700k branch 3 times, most recently from f0798fe to 4ec184d Compare February 7, 2025 04:41
@merbanan

merbanan commented Feb 7, 2025

Copy link
Copy Markdown

Worth mention (working on USB support)

One USB port can be shared for HSGMII... The other port can be shared for PCIE2... It's possible some register are not correctly set to support this... Just giving clue of why PCIE2 might be silent.

1FB0009C bit 3 needs to be 0 to enable PCIE2. Reset value is 1 (USB mode).

@andrewjlamarche
andrewjlamarche force-pushed the w1700k branch 3 times, most recently from 9cf53b7 to e62547f Compare February 8, 2025 01:56
@hurrian

hurrian commented Feb 9, 2025

Copy link
Copy Markdown
Contributor

For the fan,

  • Based on /usr/bin/gcontrol.sh called by /usr/bin/fan_monitor.sh the fan and sensor readings are done by directly reading/writing registers in MMIO space
  • There is a NCT7511Y SMBus/I2C fan/temperature hub near the SoC, this is likely the fan controller. There is currently no Linux driver for it, but the existing Nuvoton I2C hwmon drivers could probably be patched to support it.

Other interesting peripherals:

  • EFR32MG21 Zigbee/Thread radio (USB) - matter border router? Didn't see anything about this in the stock firmware
  • Airoha AG3352Q - multi-constellation GNSS chip likely used for AFC, this is probably connected to an internal serial port (couldn't tell which one from the AFC binary)

@andrewjlamarche
andrewjlamarche force-pushed the w1700k branch 5 times, most recently from 9178f0c to a40312b Compare February 19, 2025 14:21
@Ansuel

Ansuel commented Mar 10, 2026

Copy link
Copy Markdown
Member

@andrewjlamarche I mean that the driver needs to be patched with some additional debug log to understand why it's not getting trough.

@kirdesde

Copy link
Copy Markdown

Looks like that describes our problem with the wiphy mac-addresses:

#19493

@hurrian

hurrian commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Looks like that describes our problem with the wiphy mac-addresses:

#19493

We don't use this hotplug script, as userspace MAC handling is deprecated.

MAC is set in mt76_eeprom_override and it is supposedly multi-band radio aware...

@andrewjlamarche

Copy link
Copy Markdown
Contributor Author

@Ansuel MAC addresses are fixed, was missing mac-base. This is completely ready to merge now.

@Ansuel

Ansuel commented Mar 10, 2026

Copy link
Copy Markdown
Member

@andrewjlamarche stupid me for not noticing that.

@Ansuel

Ansuel commented Mar 10, 2026 •

Copy link
Copy Markdown
Member

@andrewjlamarche I was merging but... latest commit no SoB line... :((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((

Please fix.
Also no description.

@andrewjlamarche

Copy link
Copy Markdown
Contributor Author

Oops, fixed.

This commit adds support for Gemtek (Centurylink/Lumen/Quantum Fiber)
W1700K.

Device specification
--------------------
SoC Type:	Airoha AN7581
RAM:		ESMT M16U8G16512A (2GB)
Flash:		Winbond 25N04KVZEIR (512MB)
Ethernet:	2x gigabit via AN7581, 2x 10g via RTL8261N
Wi-Fi:		MT7996 - BE19000
LEDs:		1 LED, power/status
Button:		Reset
USB ports:	None
Bootloader:	U-Boot 2014.04-rc1 (Jun 12 2024 - 08:14:34) AXON 2.0
Fan:		1x controlled by Nuvoton NCT7511Y

This device is pretty useless with the stock firmware as it requires an
account to completely set it up. Additionally, the vendor bootloader is
signed and uses Airoha/Mediatek's BBT/BMT for bad block management on
the flash. It does not support UBI, thus kernel updates are subject to
BMT/BBT which OpenWrt does not support. In turn, if a kernel update
happens and a block is marked bad in the process, the device will fail
to boot and will need to be recovered via serial.

The workaround is to chainload U-Boot in place of the kernel, as it
should not need frequent updates and thus should not cause BBT/BMT to
misbehave and soft-brick the device. Upstream U-Boot supports loading
a FIT image from UBI, so we create a UBI partition for the new u-boot
env, FIT image and factory data. This way, bad blocks are managed by UBI
instead, which will not soft-brick the device should a block be marked
bad during a normal OpenWrt update. Users wishing to update U-Boot can
do so, but should be prepared to recover if a block goes bad.

Because the device is not useful with stock firmware, this is a one-way
ticket for most users and reverting will not be documented.

The following steps can be used to install OpenWrt on the W1700K.

Connect to serial console. There is a Torx T10 screw underneath the QR
code printed onto the label. Then, pry between the gray and white
plastic, starting by the ports on the back. There are clips arount the
entire device. Starting closest to the screw next to the UART header,
TX - GND - VCC - N/A - RX. The bootloader can be interrupted by
pressing any key.

Configuring Vendor Bootloader and Installing U-Boot Chainloader:
The bootloader's default bootcmd will only run a signed image. However,
we can still bootm our own image from flash.

NOTE: The vendor's ethernet drivers are flaky. You may have to reboot
and try the tftpboot part several times for it to work.

- setenv one flash read 0x600000 0x1000000 \$loadaddr
- setenv two "; bootm"
- setenv bootcmd "$one$two"
- setenv one
- setenv two
- saveenv
- setenv serverip 192.168.1.10; setenv ipaddr 192.168.1.1; tftpboot
0x89000000 openwrt-airoha-an7581-gemtek_w1700k-ubi-chainload-uboot.itb
- flash erase 0x600000 0x100000
- flash write 0x600000 0x100000 0x89000000
- reset

The device will now reboot into the U-Boot chainloader.

Loading the W1700K UBI Installer:
The installer can be downloaded at
https://github.com/hurrian/w1700k-ubi-installer/releases

- Boot the installer via the TFTP option in the U-Boot menu. This
  process is automatic, though you may be prompted to answer some
  questions.
- Once it is done, you may upgrade to your preferred build.
- For more information: https://github.com/hurrian/w1700k-ubi-installer

For those wishing to explore the stock firmware:

Rooting Stock FW (for making backups, recommended):
- Boot the router and watch serial console until presented with failsafe
  mode. Enter it (f + enter).
- mount_root
- Change the root password (passwd).
- Open /etc/config/axon_platform_manager and set sshServerEnable,
  localAccessEnable and remoteAccessEnable to 1.
- Search for "SSH". You'll find a long string with 3 matches such as
  Enabled%25252c1%25252cSSH%Drop. Change any instances of "Disabled"
  preceding SSH to "Enabled" and any instances of "Drop" to "Accept"
  that follow SSH. Same for "Local SSH" and "Remote SSH".
- Set /etc/config/dropbear to:

config dropbear
	option PasswordAuth 'on'
	option RootPasswordAuth 'on'
	option Port '22'

- Reboot.
- Connect 10g WAN port to existing network and SSH in with the password
  you set.
- SSH into rooted stock fw.

Signed-off-by: Andrew LaMarche <[email protected]>
Link: openwrt#17869
Signed-off-by: Christian Marangi <[email protected]>
Add uboot-envtools to default packages to facilitate modifying the
u-boot environment.

Signed-off-by: Andrew LaMarche <[email protected]>
Link: openwrt#17869
Signed-off-by: Christian Marangi <[email protected]>
Most, if not all Airoha devices will have LEDs and buttons. Add them to
default packages.

Signed-off-by: Andrew LaMarche <[email protected]>
Link: openwrt#17869
Signed-off-by: Christian Marangi <[email protected]>
Remove source-only from an7581.

Signed-off-by: Andrew LaMarche <[email protected]>
Link: openwrt#17869
Signed-off-by: Christian Marangi <[email protected]>
@naseef

naseef commented Mar 12, 2026 •

Copy link
Copy Markdown
Contributor

Hi, apologies for posting on this thread , I couldn't find a more appropriate place to raise this.

I've been porting the EIP93 crypto engine support to the econet EN7528 (MIPS) target, which uses the same inside-secure,safexcel-eip93ies IP block and the same 201-crypto-Add-Mediatek-EIP-93-crypto-engine-support.patch

After enabling kmod-cryptodev and libopenssl-devcrypto, running

time openssl speed -elapsed -evp aes-256-cbc

causes a kernel panic

root@OpenWrt:~# time openssl speed -elapsed -evp aes-256-cbc
[   36.434857] CPU 3 Unable to handle kernel paging request at virtual address 0000009c, epc == 810b4780, ra == 81515b04
[   36.445570] Oops[#1]:
[   36.447880] CPU: 3 UID: 0 PID: 1810 Comm: openssl Tainted: G           O       6.12.74 #0
[   36.456087] Tainted: [O]=OOT_MODULE
[   36.459602] Hardware name: DASAN H660GM-A (Airtel)
[   36.464426] $ 0   : 00000000 7f8db574 00000000 00003508
[   36.469756] $ 4   : 00000000 80097520 00000a00 00000080
[   36.475103] $ 8   : 00000001 817823bc 00001e16 00001e17
[   36.480460] $12   : 000000e0 00000002 77dba750 00000045
[   36.485790] $16   : 82b7aa00 83508a00 82fd6e80 00000000
[   36.491159] $20   : 83508b80 9f603036 00000001 00000000
[   36.496514] $24   : 00000000 81515df0
[   36.501860] $28   : 834a4000 834a5998 81b20000 81515b04
[   36.507171] Hi    : 00000000
[   36.510106] Lo    : 00000002
[   36.513016] epc   : 810b4780 dma_map_page_attrs+0x20/0x2e0
[   36.518595] ra    : 81515b04 _eip93_hash_init+0x1a4/0x380
[   36.524089] Status: 11000003 KERNEL EXL IE
[   36.528363] Cause : 40800408 (ExcCode 02)
[   36.532401] BadVA : 0000009c
[   36.535311] PrId  : 0001992f (MIPS 1004Kc)
[   36.539442] Modules linked in: pppoe ppp_async nft_fib_inet nf_flow_table_inet pppox ppp_generic nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject nft_redir nft_quota nft_numgen nft_nat nft_masq nft_log nft_limit nft_hash nft_flow_offload nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_ct nft_chain_nat nf_tables nf_nat nf_flow_table nf_conntrack mt7615e(O) mt7615_common(O) mt7603e(O) mt76_connac_lib(O) mt76(O) mac80211(O) cfg80211(O) slhc nfnetlink nf_reject_ipv6 nf_reject_ipv4 nf_log_syslog nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c hwmon crc_ccitt compat(O) econet_eth(O) i2c_dev i2c_core cryptodev(O) nls_utf8 nls_iso8859_1 nls_cp437 sha512_generic seqiv sha3_generic jitterentropy_rng drbg hmac geniv rng cmac sd_mod scsi_mod scsi_common gpio_button_hotplug(O) vfat fat nls_base crc32c_generic
[   36.610271] Process openssl (pid: 1810, threadinfo=7a6816cf, task=64fdd3af, tls=77e36dfc)
[   36.618522] Stack : 83508b80 9f603036 3a400fc3 00000000 00000000 81515df0 819aac80 81333950
[   36.626972]         834a4000 834a59e0 00000000 81515ac8 11000003 00000000 00000002 82b7aa00
[   36.635426]         83508a00 81515b04 00000001 00000000 67452301 efcdab89 00000001 00000000
[   36.643876]         83508b80 82b7aa00 82fd6e80 00000000 82b7af64 82c18bcc 81920000 834a5adc
[   36.652329]         00000000 81515e30 834a5a9c 82b7aa00 03508b80 82b7af64 82fd6e00 82c0b3a0
[   36.660777]         ...
[   36.663264] Call Trace:
[   36.665710] [<810b4780>] dma_map_page_attrs+0x20/0x2e0
[   36.670905] [<81515b04>] _eip93_hash_init+0x1a4/0x380
[   36.676010] [<81515e30>] eip93_hash_init+0x40/0x1bc
[   36.680976] [<82c0b590>] cryptodev_hash_reset+0x14/0x6c [cryptodev]
[   36.687384] [<82c08fd0>] 0x82c08fd0
[   36.690965]
[   36.692474] Code: afb0003c  38420001  00020336 <8c8a009c> 1140007e  3c0281b2  00808025  8c429cb4  8e0300b0
[   36.702305]
[   36.703990] ---[ end trace 0000000000000000 ]---
[   36.708644] Kernel panic - not syncing: Fatal exception
[   36.713936] Rebooting in 3 seconds..

Could someone with an AN7581device try running the above openssl speed command with kmod-cryptodev and libopenssl-devcrypto installed, to confirm whether this affects the airoha target as well? I'd like to confirm this is a bug in the driver itself and not something specific to the EN7528 port

@namiltd

namiltd commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

@naseef Check this: namiltd#113 and namiltd#116.

@Sirherobrine23

Copy link
Copy Markdown

in an7523

root@OpenWrt:~# time openssl speed -elapsed -evp aes-256-cbc
You have chosen to measure elapsed time instead of user CPU time.
Doing AES-256-CBC ops for 3s on 16 size blocks: 3788839 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 64 size blocks: 1252764 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 256 size blocks: 342980 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 1024 size blocks: 87871 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 8192 size blocks: 11065 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 16384 size blocks: 5535 AES-256-CBC ops in 3.00s
version: 3.5.5
built on: Thu Mar 12 02:33:33 2026 UTC
options: bn(64,32)
compiler: ccache arm-openwrt-linux-muslgnueabi-gcc -fPIC -pthread -Wa,--noexecstack -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=soft -ffunction-sections -fdata-sections -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fpic -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DOPENSSL_PREFER_CHACHA_OVER_GCM
CPUINFO: OPENSSL_armcap=0x0
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
AES-256-CBC      20207.14k    26725.63k    29267.63k    29993.30k    30214.83k    30228.48k
real    0m 18.97s
user    0m 17.98s
sys     0m 0.01s

@naseef

naseef commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

@naseef Check this: namiltd#113 and namiltd#116.

Thank you. Will check this out

@naseef

naseef commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

in an7523

root@OpenWrt:~# time openssl speed -elapsed -evp aes-256-cbc
You have chosen to measure elapsed time instead of user CPU time.
Doing AES-256-CBC ops for 3s on 16 size blocks: 3788839 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 64 size blocks: 1252764 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 256 size blocks: 342980 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 1024 size blocks: 87871 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 8192 size blocks: 11065 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 16384 size blocks: 5535 AES-256-CBC ops in 3.00s
version: 3.5.5
built on: Thu Mar 12 02:33:33 2026 UTC
options: bn(64,32)
compiler: ccache arm-openwrt-linux-muslgnueabi-gcc -fPIC -pthread -Wa,--noexecstack -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=soft -ffunction-sections -fdata-sections -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fpic -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DOPENSSL_PREFER_CHACHA_OVER_GCM
CPUINFO: OPENSSL_armcap=0x0
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
AES-256-CBC      20207.14k    26725.63k    29267.63k    29993.30k    30214.83k    30228.48k
real    0m 18.97s
user    0m 17.98s
sys     0m 0.01s

Seems like openssl not using the hw engine ( see real and user time ). Did you install the packages in mentioned?

@Sirherobrine23

This comment was marked as off-topic.

@naseef

naseef commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

yep

There is something wrong with your configuration. The user time should be closely to zero. See https://openwrt.org/docs/techref/hardware/cryptographic.hardware.accelerators

@lukasz1992

lukasz1992 commented Mar 12, 2026 •

Copy link
Copy Markdown

Hi, apologies for posting on this thread , I couldn't find a more appropriate place to raise this.

I've been porting the EIP93 crypto engine support to the econet EN7528 (MIPS) target, which uses the same inside-secure,safexcel-eip93ies IP block and the same 201-crypto-Add-Mediatek-EIP-93-crypto-engine-support.patch

After enabling kmod-cryptodev and libopenssl-devcrypto, running

time openssl speed -elapsed -evp aes-256-cbc

causes a kernel panic

root@OpenWrt:~# time openssl speed -elapsed -evp aes-256-cbc
[   36.434857] CPU 3 Unable to handle kernel paging request at virtual address 0000009c, epc == 810b4780, ra == 81515b04
[   36.445570] Oops[#1]:
[   36.447880] CPU: 3 UID: 0 PID: 1810 Comm: openssl Tainted: G           O       6.12.74 #0
[   36.456087] Tainted: [O]=OOT_MODULE
[   36.459602] Hardware name: DASAN H660GM-A (Airtel)
[   36.464426] $ 0   : 00000000 7f8db574 00000000 00003508
[   36.469756] $ 4   : 00000000 80097520 00000a00 00000080
[   36.475103] $ 8   : 00000001 817823bc 00001e16 00001e17
[   36.480460] $12   : 000000e0 00000002 77dba750 00000045
[   36.485790] $16   : 82b7aa00 83508a00 82fd6e80 00000000
[   36.491159] $20   : 83508b80 9f603036 00000001 00000000
[   36.496514] $24   : 00000000 81515df0
[   36.501860] $28   : 834a4000 834a5998 81b20000 81515b04
[   36.507171] Hi    : 00000000
[   36.510106] Lo    : 00000002
[   36.513016] epc   : 810b4780 dma_map_page_attrs+0x20/0x2e0
[   36.518595] ra    : 81515b04 _eip93_hash_init+0x1a4/0x380
[   36.524089] Status: 11000003 KERNEL EXL IE
[   36.528363] Cause : 40800408 (ExcCode 02)
[   36.532401] BadVA : 0000009c
[   36.535311] PrId  : 0001992f (MIPS 1004Kc)
[   36.539442] Modules linked in: pppoe ppp_async nft_fib_inet nf_flow_table_inet pppox ppp_generic nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject nft_redir nft_quota nft_numgen nft_nat nft_masq nft_log nft_limit nft_hash nft_flow_offload nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_ct nft_chain_nat nf_tables nf_nat nf_flow_table nf_conntrack mt7615e(O) mt7615_common(O) mt7603e(O) mt76_connac_lib(O) mt76(O) mac80211(O) cfg80211(O) slhc nfnetlink nf_reject_ipv6 nf_reject_ipv4 nf_log_syslog nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c hwmon crc_ccitt compat(O) econet_eth(O) i2c_dev i2c_core cryptodev(O) nls_utf8 nls_iso8859_1 nls_cp437 sha512_generic seqiv sha3_generic jitterentropy_rng drbg hmac geniv rng cmac sd_mod scsi_mod scsi_common gpio_button_hotplug(O) vfat fat nls_base crc32c_generic
[   36.610271] Process openssl (pid: 1810, threadinfo=7a6816cf, task=64fdd3af, tls=77e36dfc)
[   36.618522] Stack : 83508b80 9f603036 3a400fc3 00000000 00000000 81515df0 819aac80 81333950
[   36.626972]         834a4000 834a59e0 00000000 81515ac8 11000003 00000000 00000002 82b7aa00
[   36.635426]         83508a00 81515b04 00000001 00000000 67452301 efcdab89 00000001 00000000
[   36.643876]         83508b80 82b7aa00 82fd6e80 00000000 82b7af64 82c18bcc 81920000 834a5adc
[   36.652329]         00000000 81515e30 834a5a9c 82b7aa00 03508b80 82b7af64 82fd6e00 82c0b3a0
[   36.660777]         ...
[   36.663264] Call Trace:
[   36.665710] [<810b4780>] dma_map_page_attrs+0x20/0x2e0
[   36.670905] [<81515b04>] _eip93_hash_init+0x1a4/0x380
[   36.676010] [<81515e30>] eip93_hash_init+0x40/0x1bc
[   36.680976] [<82c0b590>] cryptodev_hash_reset+0x14/0x6c [cryptodev]
[   36.687384] [<82c08fd0>] 0x82c08fd0
[   36.690965]
[   36.692474] Code: afb0003c  38420001  00020336 <8c8a009c> 1140007e  3c0281b2  00808025  8c429cb4  8e0300b0
[   36.702305]
[   36.703990] ---[ end trace 0000000000000000 ]---
[   36.708644] Kernel panic - not syncing: Fatal exception
[   36.713936] Rebooting in 3 seconds..

Could someone with an AN7581device try running the above openssl speed command with kmod-cryptodev and libopenssl-devcrypto installed, to confirm whether this affects the airoha target as well? I'd like to confirm this is a bug in the driver itself and not something specific to the EN7528 port

I would say that in eip93_crypto_probe, struct device *dev = &pdev->dev; is null - maybe something wrong with device tree?

@Sirherobrine23

Copy link
Copy Markdown

yep

There is something wrong with your configuration. The user time should be closely to zero. See https://openwrt.org/docs/techref/hardware/cryptographic.hardware.accelerators

I forgot to enable the module in the kernel, I'll add it here and test again

@Sirherobrine23

Copy link
Copy Markdown

loaded

[    3.706771] mtk-eip93 1fb70000.crypto: EIP93:3:0:1,PE(0xfe007:0x41710041)

but now get kernel panic

[   18.584872] 8<--- cut here ---
[   18.587950] Unable to handle kernel paging request at virtual address d6d2221b when read
[   18.596051] [d6d2221b] *pgd=00000000
[   18.599662] Internal error: Oops: 5 [#1] SMP ARM
[   18.604305] Modules linked in: xt_connlimit pppoe ppp_async nf_conncount xt_state xt_helper xt_conntrack xt_connmark xt_connbytes xt_CT wireguard pppox ppp_generic nft_redir nft_nat nft_masq nft_flow_offload nft_fib_inet nft_ct nft_chain_nat nf_nat nf_flow_table_inet nf_flow_table nf_conntrack mt7915e(O) mt76_connac_lib(O) mt76(O) mac80211(O) libchacha20poly1305 ipt_REJECT cfg80211(O) xt_time xt_tcpudp xt_tcpmss xt_statistic xt_recent xt_multiport xt_mark xt_mac xt_limit xt_length xt_hl xt_ecn xt_dscp xt_comment xt_TCPMSS xt_LOG xt_HL xt_DSCP xt_CLASSIFY ums_usbat ums_sddr55 ums_sddr09 ums_karma ums_jumpshot ums_isd200 ums_freecom ums_datafab ums_cypress ums_alauda slhc sch_cake poly1305_arm nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject nft_quota nft_numgen nft_log nft_limit nft_hash nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_compat nf_tables nf_reject_ipv4 nf_log_syslog nf_defrag_ipv6 nf_defrag_ipv4 libcurve25519_generic libcrc32c iptable_mangle iptable_filter ipt_ECN ip_tables hwmon crc_ccitt compat(O)
[   18.604721]  chacha_neon act_vlan ntfs3 sch_tbf sch_ingress sch_htb sch_hfsc em_u32 cls_u32 cls_route cls_matchall cls_fw cls_flow cls_basic act_skbedit act_mirred act_gact i2c_dev cryptodev(O) xt_set ip_set_list_set ip_set_hash_netportnet ip_set_hash_netport ip_set_hash_netnet ip_set_hash_netiface ip_set_hash_net ip_set_hash_mac ip_set_hash_ipportnet ip_set_hash_ipportip ip_set_hash_ipport ip_set_hash_ipmark ip_set_hash_ipmac ip_set_hash_ip ip_set_bitmap_port ip_set_bitmap_ipmac ip_set_bitmap_ip ip_set nfnetlink ip6table_mangle ip6table_filter ip6_tables ip6t_REJECT x_tables nf_reject_ipv6 msdos ifb ip6_udp_tunnel udp_tunnel nls_utf8 nls_iso8859_1 nls_cp437 sha512_generic sha512_arm seqiv sha3_generic jitterentropy_rng drbg hmac geniv rng cmac usb_storage leds_gpio xhci_plat_hcd uhci_hcd ohci_platform ohci_hcd fsl_mph_dr_of ehci_platform ehci_fsl ehci_hcd gpio_button_hotplug(O) vfat fat exfat crc32c_generic
[   18.775239] CPU: 0 UID: 0 PID: 2432 Comm: openssl Tainted: G           O       6.12.74 #0
[   18.783450] Tainted: [O]=OOT_MODULE
[   18.786959] Hardware name: Generic DT based system
[   18.791778] PC is at _eip93_hash_init+0xe0/0x2d4
[   18.796431] LR is at _eip93_hash_init+0x5c/0x2d4
[   18.801074] pc : [<c064afe4>]    lr : [<c064af60>]    psr: 40000013
[   18.807368] sp : c7899ab8  ip : 00000000  fp : 00000000
[   18.812620] r10: bf2d0a14  r9 : d6d22217  r8 : 3a400fc3
[   18.817872] r7 : cb3bb040  r6 : cb3bb040  r5 : c78ff680  r4 : c78ff480
[   18.824433] r3 : cb3e5dc0  r2 : ffffffff  r1 : 00000000  r0 : c78ff680
[   18.830977] Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   18.838115] Control: 10c5383d  Table: 8795406a  DAC: 00000055
[   18.843859] Register r0 information: slab kmalloc-128 start c78ff680 pointer offset 0 size 128
[   18.852496] Register r1 information: NULL pointer
[   18.857201] Register r2 information: non-paged memory
[   18.862253] Register r3 information: slab kmalloc-128 start cb3e5d80 pointer offset 64 size 128
[   18.870968] Register r4 information: slab kmalloc-128 start c78ff480 pointer offset 0 size 128
[   18.879597] Register r5 information: slab kmalloc-128 start c78ff680 pointer offset 0 size 128
[   18.888225] Register r6 information: slab kmalloc-256 start cb3bb000 pointer offset 64 size 256
[   18.896940] Register r7 information: slab kmalloc-256 start cb3bb000 pointer offset 64 size 256
[   18.905656] Register r8 information: non-paged memory
[   18.910708] Register r9 information: vmalloc memory
[   18.915586] Register r10 information: 3-page vmalloc region starting at 0xbf2d0000 allocated at load_module+0x6a4/0x196c
[   18.926474] Register r11 information: NULL pointer
[   18.931273] Register r12 information: NULL pointer
[   18.936065] Process openssl (pid: 2432, stack limit = 0x912c4ac3)
[   18.942158] Stack: (0xc7899ab8 to 0xc789a000)
[   18.946518] 9aa0:                                                       67452301 efcdab89
[   18.954697] 9ac0: cb87b5c0 8ba7b5c0 bf2d0a14 c793f0c0 cbcae540 c78ff480 cb3bb040 c7899b84
[   18.962874] 9ae0: 00000000 bf2d0a14 00000000 c064b2d4 00000000 bf2d0a14 00000000 8ba7b5c0
[   18.971051] 9b00: c793f0c0 cbcae540 c793f128 c7899dd4 c7899b84 bf2ca050 cbcae540 c793f128
[   18.979228] 9b20: c793f0c0 bf2c7e48 00000000 00000000 cfb96640 cfb9665c 00000000 00000000
[   18.987406] 9b40: 00000020 33323130 37363534 31303938 35343332 39383736 33323130 37363534
[   18.995583] 9b60: 31303938 c4fc2ca4 00000000 00000000 c4f9ac40 00000000 c4f9a8f0 00000000
[   19.003759] 9b80: c4fc13b8 00000000 00000000 00000000 00000098 ba2e8ba3 00000000 00052cc0
[   19.011937] 9ba0: 00000000 c7899e14 c7899e14 00000000 00000001 00052cc0 00052cc0 c4fc13b8
[   19.020114] 9bc0: 00040cc0 00000000 c684ea80 c029fd98 c4f9a6c0 cfb96640 cfd87e68 c029e430
[   19.028291] 9be0: cb54cb00 ffffffff c4f9a6c0 c4f0e2a4 c4fc2d10 00000000 11111111 38e38e39
[   19.036468] 9c00: fffff800 c4fc2ca8 c4fc5764 83f00000 38e38e39 c4f9a6c0 00000001 c7899cfc
[   19.044646] 9c20: c7899cf8 c02be8c4 c7899cfc c4f9ac40 00000000 c4f9ac40 00000000 00000000
[   19.052822] 9c40: 00000000 00000000 0000003e c025226c c0026c40 60000013 00000001 cfd87e68
[   19.061000] 9c60: 00000001 4bddc23f c0001180 00000015 cfccf4dc c052d618 c0001180 00052cc0
[   19.069176] 9c80: cfccf4dc c793f000 c4f0e2a4 c02a5ca4 0000001f c793f000 ffe00000 c0026c40
[   19.077354] 9ca0: cfd88888 cfb96270 cfd67078 00000000 c0001180 c0000080 ffffffff 00000088
[   19.085530] 9cc0: c684ea80 c02a63f8 00000dc0 00000dc0 00000001 c0026c40 b6b19000 c02b99d4
[   19.093708] 9ce0: cfd87e68 cbbc8820 cb792590 cb7925f0 00150015 c08bb938 cb000000 cfd87e68
[   19.101886] 9d00: b6b1a000 c0001180 00000dc0 00000435 cbcae55c c0a82400 bf2ce240 00000088
[   19.110063] 9d20: c7899d28 c02a7950 ffffff04 ffff0a00 cb7923c0 bf2c72e8 ffffff04 ffff0a00
[   19.118239] 9d40: ffffffff bf2d0518 00000002 c08b5af0 00000040 ffffff04 ffff0a00 c684ea80
[   19.126415] 9d60: c684ea80 c7899e74 c7899e34 00000040 ffffff04 ffff0a00 cb485800 c793f0c0
[   19.134593] 9d80: c793fdc0 bea311a0 c7899df0 49a65b70 cbcae540 c01c6366 cbcae540 bea31168
[   19.142771] 9da0: bea31168 c684ea80 00000004 c6b7cda8 b6b0d010 bf2c8778 c6b7cda8 c684ea80
[   19.150950] 9dc0: c0a1e980 c6b7cda8 c5e896e8 c5e89748 c7899dd0 00000000 0000000d 00000000
[   19.159133] 9de0: 00000000 00000000 00000000 00000000 68616da8 28626365 29736561 65646500
[   19.167318] 9e00: 00000029 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   19.175496] 9e20: 00000000 00000000 00000000 00000000 00000000 28626365 2d736561 39706965
[   19.183673] 9e40: 70002933 00293339 00000006 00000010 0000003e b6f1c270 00000000 b6bdae6c
[   19.191849] 9e60: 00000000 b6f1c048 ffffffff 00000040 00000012 00000000 00000000 00000004
[   19.200029] 9e80: 0000003e 015ebdf0 00001000 b6b19000 00000000 b6f35b70 00001000 b6f7ef50
[   19.208214] 9ea0: 00001000 b6f1b7d4 b6b19000 00001000 0000006a c793fdc0 c793fd80 c4f8eb00
[   19.216401] 9ec0: cbcae548 c78ff680 c793fdc0 c793fd80 c4f8eb00 c793fd80 c793f0dc c793f0c0
[   19.224585] 9ee0: c793f0c0 bf2ce240 68616da8 cbcae548 c793f0c8 00000004 00000000 49a65b70
[   19.232762] 9f00: c01c6366 c684ea80 00000000 bea31168 c684ea80 00000004 c6b7cda8 c02dc334
[   19.240939] 9f20: c6b96000 ffffff9c c0100258 cb54cb00 00000005 c02c2df4 00000000 00020002
[   19.249116] 9f40: b6b10000 00000006 00000100 00000001 c7899f58 b6b0b64d 00000000 00000002
[   19.257294] 9f60: 00000005 c02c3054 00020002 00000000 cb485800 00000003 000d0f30 49a65b70
[   19.265479] 9f80: c0100258 00000004 bea31168 00000000 00000036 c0100258 cb54cb00 00000036
[   19.273655] 9fa0: b6b0d010 c0100060 00000004 bea31168 00000004 c01c6366 bea31168 00000000
[   19.281833] 9fc0: 00000004 bea31168 00000000 00000036 00000000 b6b0d088 bea31184 b6b0d010
[   19.290010] 9fe0: b6b0cf34 bea31020 b6b0a428 b6f33974 60000010 00000004 00000000 00000000
[   19.298183] Call trace: 
[   19.298193]  _eip93_hash_init from eip93_hash_init+0x34/0x170
[   19.306490]  eip93_hash_init from cryptodev_hash_reset+0x10/0x64 [cryptodev]
[   19.313671]  cryptodev_hash_reset [cryptodev] from cryptodev_release+0x808/0xc3c [cryptodev]
[   19.322238]  cryptodev_release [cryptodev] from cryptodev_ioctl+0x3bc/0xda8 [cryptodev]
[   19.330370]  cryptodev_ioctl [cryptodev] from sys_ioctl+0x2f4/0xb1c
[   19.336708]  sys_ioctl from ret_fast_syscall+0x0/0x4c
[   19.341767] Exception stack(0xc7899fa8 to 0xc7899ff0)
[   19.346823] 9fa0:                   00000004 bea31168 00000004 c01c6366 bea31168 00000000
[   19.355001] 9fc0: 00000004 bea31168 00000000 00000036 00000000 b6b0d088 bea31184 b6b0d010
[   19.363176] 9fe0: b6b0cf34 bea31020 b6b0a428 b6f33974
[   19.368233] Code: e5963040 e1a00005 e5843040 e5845044 (e5998004) 
[   19.374331] ---[ end trace 0000000000000000 ]---
[   19.378948] Kernel panic - not syncing: Fatal exception
[   19.384282] Rebooting in 3 seconds..

@naseef

naseef commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

but now get kernel panic

Thanks for confirming. That's the exact same crash. Could you try applying this patch and see if it fixes it for you as well? (I'm not 100% sure this is the exact right fix, but it resolves the crash on my EN7528 setup)

+--- a/drivers/crypto/inside-secure/eip93/eip93-hash.c
++++ b/drivers/crypto/inside-secure/eip93/eip93-hash.c
+@@ -115,10 +115,12 @@ static int _eip93_hash_init(struct ahash
+       struct crypto_ahash *ahash = crypto_ahash_reqtfm(req);
+       struct eip93_hash_ctx *ctx = crypto_ahash_ctx(ahash);
+       struct sa_record *sa_record, *sa_record_hmac;
+-      struct eip93_device *mtk = rctx->mtk;
++      struct eip93_device *mtk = ctx->mtk;
+       int digestsize;
+       int ret;
+
++      rctx->mtk = mtk;
++
+       sa_record = kzalloc(sizeof(*sa_record), GFP_KERNEL);
+       if (!sa_record)
+               return -ENOMEM;
+@@ -164,7 +166,6 @@ static int _eip93_hash_init(struct ahash
+               sa_record->sa_cmd1_word &= ~EIP93_SA_CMD_HMAC;
+       }
+
+-      rctx->mtk = ctx->mtk;
+       rctx->sa_record = sa_record;
+       rctx->sa_record_base = dma_map_single(mtk->dev, rctx->sa_record,
+                                             sizeof(*rctx->sa_record),

@lukasz1992

Copy link
Copy Markdown

Hardware name: Generic DT based system

@Sirherobrine23

Copy link
Copy Markdown

now with patch

root@OpenWrt:~# time openssl speed -elapsed -evp aes-256-cbc
You have chosen to measure elapsed time instead of user CPU time.
Doing AES-256-CBC ops for 3s on 16 size blocks: 106706 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 64 size blocks: 105045 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 256 size blocks: 97929 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 1024 size blocks: 75922 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 8192 size blocks: 23417 AES-256-CBC ops in 3.00s
Doing AES-256-CBC ops for 3s on 16384 size blocks: 13124 AES-256-CBC ops in 3.00s
version: 3.5.5
built on: Thu Mar 12 02:33:33 2026 UTC
options: bn(64,32)
compiler: ccache arm-openwrt-linux-muslgnueabi-gcc -fPIC -pthread -Wa,--noexecstack -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=soft -ffunction-sections -fdata-sections -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fpic -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DOPENSSL_PREFER_CHACHA_OVER_GCM
CPUINFO: OPENSSL_armcap=0x0
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
AES-256-CBC        569.10k     2240.96k     8356.61k    25914.71k    63944.02k    71674.54k
real    0m 18.21s
user    0m 0.30s
sys     0m 5.24s

@abajk

abajk commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

@naseef These bugs have already been fixed in the upstream driver.

@maurerle

Copy link
Copy Markdown
Contributor

Any chance to get support for this device in openwrt-25.12?
I did get some build errors with this: https://github.com/maurerle/openwrt/tree/add_support_w1700k - so I guess other commits are needed as well..?

@hurrian

hurrian commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Any chance to get support for this device in openwrt-25.12? I did get some build errors with this: https://github.com/maurerle/openwrt/tree/add_support_w1700k - so I guess other commits are needed as well..?

Please refer to #22374 for progress on adding this target to 25.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core packages pull request/issue for core (in-tree) packages kernel pull request/issue with Linux kernel related changes target/airoha pull request/issue for airoha target

Projects

None yet

Development

Successfully merging this pull request may close these issues.