Netgear X10 (R9000)

Actually, i found a bug in kexec-tools. It happens when a zImage with appended DTB is loaded :slight_smile:

http://lists.infradead.org/pipermail/kexec/2021-April/022353.html

With my kexec-tools patch, it is not necessary anymore to disable CONFIG_ARM_APPENDED_DTB.

4 Likes

Ported Alpine Crypto Accelerator and Alpine Thermal driver to Linux 5.10, first tests successful, but needs more testing.
Used tcrypt kernel module to run tests with it (kmod-crypto-test package).
kexec was a real productivity booster during the porting.

insmod /lib/modules/5.10.27/tcrypt.ko mode=422 sec=1
insmod /lib/modules/5.10.27/tcrypt.ko mode=423 sec=1
insmod /lib/modules/5.10.27/tcrypt.ko mode=424 sec=1
insmod /lib/modules/5.10.27/tcrypt.ko mode=600 sec=1
insmod /lib/modules/5.10.27/tcrypt.ko mode=601 sec=1
insmod /lib/modules/5.10.27/tcrypt.ko mode=602 sec=1

You can see the CPU temperature with LuCI and collectd.

Next week getting my new and shiny Nighthawk XR700, going to test it too :wink:

1 Like

Hello egorenar,
Thank you very much for your work!
I still have my R9000 with stock firmware and will be happy to test your OpenWRT build :slight_smile:
Will take a look on your Github repo :wink:
Is your build ready to be used daily? or is it still in heavy development?

I use it on a daily basis, got rid of DDWRT a month ago and never been sorry :slight_smile:
With DDWRT e.g. i had to use Entware and an external USB drive for additional packages.
But with OpenWRT i have so much NAND now, not even the half of it is used, all my packages are on NAND. No need for Entware or external USB drives, and Samba has never been better.

But any bug reports are welcome.

Hmm, i did some more tests with the Alpine Crypto Engine and it seems to make things slower :frowning: Maybe i'm missing something.

Without Alpine crypto engine

root@OpenWrt:/tmp# openssl speed -elapsed -evp aes-128-cbc
You have chosen to measure elapsed time instead of user CPU time.
Doing aes-128-cbc for 3s on 16 size blocks: 11573065 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 64 size blocks: 3530988 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 256 size blocks: 959882 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 1024 size blocks: 245368 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 8192 size blocks: 30867 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 16384 size blocks: 15436 aes-128-cbc's in 3.00s
OpenSSL 1.1.1k  25 Mar 2021
built on: Sun Apr 11 07:52:52 2021 UTC
options:bn(64,32) rc4(char) des(long) aes(partial) blowfish(ptr)
compiler: arm-openwrt-linux-muslgnueabi-gcc -fPIC -pthread -Wa,--noexecstack -Wall -O3 -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -O3 -DPIC -fpic -ffunction-sections -fdata-sections -znow -zrelro -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG -DOPENSSL_PREFER_CHACHA_OVER_GCM
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
aes-128-cbc      61723.01k    75327.74k    81909.93k    83752.28k    84287.49k    84301.14k

With Alpine crypto engine

root@OpenWrt:/tmp# openssl speed -evp aes-128-cbc -engine afalg -elapsed
engine "afalg" set.
You have chosen to measure elapsed time instead of user CPU time.
Doing aes-128-cbc for 3s on 16 size blocks: 48380 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 64 size blocks: 47806 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 256 size blocks: 48272 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 1024 size blocks: 56674 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 8192 size blocks: 39220 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 16384 size blocks: 31801 aes-128-cbc's in 3.00s
OpenSSL 1.1.1k  25 Mar 2021
built on: Sun Apr 11 07:52:52 2021 UTC
options:bn(64,32) rc4(char) des(long) aes(partial) blowfish(ptr)
compiler: arm-openwrt-linux-muslgnueabi-gcc -fPIC -pthread -Wa,--noexecstack -Wall -O3 -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -O3 -DPIC -fpic -ffunction-sections -fdata-sections -znow -zrelro -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG -DOPENSSL_PREFER_CHACHA_OVER_GCM
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
aes-128-cbc        258.89k     1019.86k     4119.21k    19344.73k   107096.75k   173675.86k

The crypto engine makes things faster but only for bigger buffers, e.g. 8192 bytes and 16384 bytes.
But it is slower for smaller buffers. Needs investigating.

The driver code quality is the worst shit, as usual :face_vomiting:

Maybe the overhead for smaller buffers just exceeds gains won with HW acceleration which can be seen only with larger buffers. I can imagine that user/kernel space switch overhead and preparing the crypto engine takes some time which is considerable for smaller buffers.

Here is the proof that the crypto engine is indeed being used by OpenSSL + AF_ALG

root@OpenWrt:/# cat /proc/interrupts | grep crypto
195:          0          0          0          0      MSIx 67587 Edge      al-crypto-comp-0@pci:0000:00:04.1
196:          0          0          0          0      MSIx 67588 Edge      al-crypto-comp-1@pci:0000:00:04.1
197:          0          0          0          0      MSIx 67589 Edge      al-crypto-comp-2@pci:0000:00:04.1
198:          0          0          0          0      MSIx 67590 Edge      al-crypto-comp-3@pci:0000:00:04.1
199:          0          0          0          0      MSIx 67586 Edge      al-crypto-interrupt-group-d@pci:0000:00
200:     568256          0          0          0      MSIx 65539 Edge      al-crypto-comp-0@pci:0000:00:04.0
201:          0     485774          0          0      MSIx 65540 Edge      al-crypto-comp-1@pci:0000:00:04.0
202:          0          0     446074          0      MSIx 65541 Edge      al-crypto-comp-2@pci:0000:00:04.0
203:          0          0          0     446768      MSIx 65542 Edge      al-crypto-comp-3@pci:0000:00:04.0
204:          0          0          0          0      MSIx 65538 Edge      al-crypto-interrupt-group-d@pci:0000:00

The interrupts spikes above are from the crypto engine.

The temperature is also getting higher :rofl:

I believe this is quite a common experience also reported elsewhere e.g. see the following discussion:

Indeed, especially for faster SOCs it's very common that the CPU can encrypt faster than its dedicated cryptoengines. Partially because they might not be optimized for the tasks you're throwing at, partially because the overhead is bad for small buffers - it might still be worth using, as their use is 'free' and not taxing the main CPU.

I general I'd suggest to defer working on this until the basic target/ device support is merged (ideally mainline, but also for OpenWrt), as it's not necessary for the device to work (well), but can become a huge time sink with little return (it's quite likely that there is no way to speed up the cryptoengine).

1 Like

The main bottleneck with using hardware crypto engines with OpenSSL or any userland crypto software is the transfer of crypto buffers between user memory to kernel memory. This kills thruput for smaller buffers.

1 Like

Hmm, i might be wrong but i think the AF_ALG solution offers a zero-copy method where a user-space application is able to map its buffers into kernel and by doing this avoids copying between user and kernel space.

For reference: https://mjmwired.net/kernel/Documentation/crypto/userspace-if.rst#328

It of course depends on the application whether to use it or not.

I tried using AF_ALG. Doesn’t seem to improve performance any if at all. Not sure if my code is correct when I tested with the ipq806x crypto engine. Codes works, but performance is the same, I.e. slow. I guess the AF_ALG method remaps the memory space, but to get data to the hardware crypto engine, memory copies still have to be done, although DMA should be use.

In any case, I didn’t try it further and changed strategy by trying to move OpenVPN into kernel space. Turns out to be not trivial and I left it hanging. :sweat_smile:

1 Like

Got my Netgear XR700 today. It didn't have a chance to boot Netgear's FW even once :rofl:
After unpacking entered factory mode and flashed OpenWRT factory image. Everything works.

"u-boot-env" MTD partition is still empty :slight_smile:

1 Like

You beat me to it! I also got my "new" one and immediately installed OpenWrt. Worked flawlessly so far.

BTW: Was there any progress on getting the SFP+ slot to work? As I might look into that one next.

1 Like

Not yet. Maybe now because i have 2 devices and would be able to test it. But i need a cable first. Any recommendations ?

Well, passive or even active direct attach cables are usually the cheapest option but they only go in certain lengths of up to 5, 7 or maybe 10 meters (compatibility somewhat varies especially with them more expensive switches). Those may be had starting at around 10 bucks on AliExpress or eBay. Then, there are real optical transceivers, either the classical multi-mode ones e.g. with two LC/PC receptacle or the more "modern" single-mode bi-directional (aka what one may use for Internet connection if one is lucky) ones with just one LC/PC receptacle. The former are typically available in cheap short-range SR as well as much more expensive long-range LR fashions. And then, of course, there are also copper transceivers for 10GBase-T. With those compatibility concerning the later NBase-T aka 2.5 Gigabit and 5 Gigabit varies widely. I got some for as low as 40 bucks but while some do not work with NBase-T at all, others somewhat work (e.g. the Marvell 88X3310 PHY based ones with the dreaded send throughput drop) while others work perfectly (e.g. the Aquantia AQS-107 PHY based ones). Unfortunately, it is usually quite hard to tell what PHY those cheaper (Chinese) offerings really have. Ultimately, it all depends what exactly you are looking for. But just connecting them two units if they are no further than 7 or maximum 10 meters apart, I would recommend using regular cheap passive direct attach cables.

Yay, finally really fixed Alpine Crypto Driver, what a piece of junk :face_vomiting:
The original driver contained a couple of bugs.
All crypto testmgr tests are OK now :grinning_face_with_smiling_eyes:
crypto testmgr tests are run every time a new crypto alg is registered, e.g. when al_crypto kernel module is loaded. They are different from tcrypt tests which only test speed BUT no correctness !!!
I want to do more openssl testing to find more potential bugs.

[   20.352702] al_crypto: Annapurna Labs Crypto Driver 0.01
[   20.358123] al_crypto 0000:00:04.0: of_irq_parse_pci: failed with rc=-22
[   20.480326] al_crypto 0000:00:04.0: enabling device (0000 -> 0002)
[   20.599324] pci 0000:00:04.1: [1c36:8011] type 00 class 0x100000
[   20.605346] pci 0000:00:04.1: Max Payload Size set to  128/ 128 (was  128), Max Read Rq  128
[   20.730322] al_crypto 0000:00:04.1: enabling device (0400 -> 0402)
[   20.739599] al_crypto 0000:00:04.1: al_crypto_pci_probe: Skipping alg/hash initialization, no allocated channels
[   20.762779] al_crypto 0000:00:04.1: crc/csum algorithms registered in /proc/crypto
[   20.783867] al_crypto 0000:00:04.0: algorithms registered in /proc/crypto
[   20.841956] al_crypto 0000:00:04.0: hash algorithms registered in /proc/crypto
[   20.849173] al_crypto 0000:00:04.0: al_crypto_pci_probe: Skipping crc initialization, no allocated channels

tcrypt tests

root@OpenWrt-dev:/# modprobe tcrypt mode=402 sec=1
[  323.782306]
[  323.782306] testing speed of async md5 (md5-al)
[  323.788315] tcrypt: test  0 (   16 byte blocks,   16 bytes per update,   1 updates):
[  324.779266]  48997 opers/sec,    783952 bytes/sec
[  324.791792] tcrypt: test  1 (   64 byte blocks,   16 bytes per update,   4 updates):  45993 opers/sec,   2943552 bytes/sec
[  325.800331] tcrypt: test  2 (   64 byte blocks,   64 bytes per update,   1 updates):
[  326.799261]  51150 opers/sec,   3273600 bytes/sec
[  326.811787] tcrypt: test  3 (  256 byte blocks,   16 bytes per update,  16 updates):  12122 opers/sec,   3103232 bytes/sec
[  327.820342] tcrypt: test  4 (  256 byte blocks,   64 bytes per update,   4 updates):  12704 opers/sec,   3252224 bytes/sec
[  328.830308] tcrypt: test  5 (  256 byte blocks,  256 bytes per update,   1 updates):
[  329.829254]  50499 opers/sec,  12927744 bytes/sec
[  329.841776] tcrypt: test  6 ( 1024 byte blocks,   16 bytes per update,  64 updates):   3041 opers/sec,   3113984 bytes/sec
[  330.850300] tcrypt: test  7 ( 1024 byte blocks,  256 bytes per update,   4 updates):  10110 opers/sec,  10352640 bytes/sec
[  331.860331] tcrypt: test  8 ( 1024 byte blocks, 1024 bytes per update,   1 updates):
[  332.859259]  47750 opers/sec,  48896000 bytes/sec
[  332.871778] tcrypt: test  9 ( 2048 byte blocks,   16 bytes per update, 128 updates):   1531 opers/sec,   3135488 bytes/sec
[  333.880726] tcrypt: test 10 ( 2048 byte blocks,  256 bytes per update,   8 updates):   5527 opers/sec,  11319296 bytes/sec
[  334.890292] tcrypt: test 11 ( 2048 byte blocks, 1024 bytes per update,   2 updates):  16115 opers/sec,  33003520 bytes/sec
[  335.900327] tcrypt: test 12 ( 2048 byte blocks, 2048 bytes per update,   1 updates):
[  336.899253]  44225 opers/sec,  90572800 bytes/sec
[  336.911772] tcrypt: test 13 ( 4096 byte blocks,   16 bytes per update, 256 updates):    765 opers/sec,   3133440 bytes/sec
[  337.920823] tcrypt: test 14 ( 4096 byte blocks,  256 bytes per update,  16 updates):   2939 opers/sec,  12038144 bytes/sec
[  338.930319] tcrypt: test 15 ( 4096 byte blocks, 1024 bytes per update,   4 updates):   9575 opers/sec,  39219200 bytes/sec
[  339.940396] tcrypt: test 16 ( 4096 byte blocks, 4096 bytes per update,   1 updates):
[  340.939271]  39604 opers/sec, 162217984 bytes/sec
[  340.951794] tcrypt: test 17 ( 8192 byte blocks,   16 bytes per update, 512 updates):    383 opers/sec,   3137536 bytes/sec
[  341.960613] tcrypt: test 18 ( 8192 byte blocks,  256 bytes per update,  32 updates):   1498 opers/sec,  12271616 bytes/sec
[  342.970556] tcrypt: test 19 ( 8192 byte blocks, 1024 bytes per update,   8 updates):   5232 opers/sec,  42860544 bytes/sec
[  343.980427] tcrypt: test 20 ( 8192 byte blocks, 4096 bytes per update,   2 updates):  14194 opers/sec, 116277248 bytes/sec
[  344.990292] tcrypt: test 21 ( 8192 byte blocks, 8192 bytes per update,   1 updates):
[  345.989284]  32132 opers/sec, 263225344 bytes/sec
modprobe: ERROR: could not insert 'tcrypt': Resource temporarily unavailable

root@OpenWrt-dev:/# modprobe tcrypt mode=422 sec=1
[  181.354382] tcrypt:
[  181.354382] testing speed of multibuffer sha1 (sha1-al)
[  181.361799] tcrypt: test  0 (   16 byte blocks,   16 bytes per update,   1 updates): 249872 operations in 1 seconds (3997952 bytes)
[  182.371081] tcrypt: test  2 (   64 byte blocks,   64 bytes per update,   1 updates): 250056 operations in 1 seconds (16003584 bytes)
[  183.381167] tcrypt: test  5 (  256 byte blocks,  256 bytes per update,   1 updates): 240552 operations in 1 seconds (61581312 bytes)
[  184.391144] tcrypt: test  8 ( 1024 byte blocks, 1024 bytes per update,   1 updates): 229024 operations in 1 seconds (234520576 bytes)
[  185.402505] tcrypt: test 12 ( 2048 byte blocks, 2048 bytes per update,   1 updates): 190728 operations in 1 seconds (390610944 bytes)
[  186.411272] tcrypt: test 16 ( 4096 byte blocks, 4096 bytes per update,   1 updates): 109264 operations in 1 seconds (447545344 bytes)
[  187.421263] tcrypt: test 21 ( 8192 byte blocks, 8192 bytes per update,   1 updates): 60168 operations in 1 seconds (492896256 bytes)
modprobe: ERROR: could not insert 'tcrypt': Resource temporarily unavailable

root@OpenWrt-dev:/# modprobe tcrypt mode=423 sec=1
[  196.044205] tcrypt:
[  196.044205] testing speed of multibuffer sha256 (sha256-al)
[  196.051989] tcrypt: test  0 (   16 byte blocks,   16 bytes per update,   1 updates): 113608 operations in 1 seconds (1817728 bytes)
[  197.061198] tcrypt: test  2 (   64 byte blocks,   64 bytes per update,   1 updates): 236688 operations in 1 seconds (15148032 bytes)
[  198.071171] tcrypt: test  5 (  256 byte blocks,  256 bytes per update,   1 updates): 230672 operations in 1 seconds (59052032 bytes)
[  199.081145] tcrypt: test  8 ( 1024 byte blocks, 1024 bytes per update,   1 updates): 219440 operations in 1 seconds (224706560 bytes)
[  200.091259] tcrypt: test 12 ( 2048 byte blocks, 2048 bytes per update,   1 updates): 205104 operations in 1 seconds (420052992 bytes)
[  201.101255] tcrypt: test 16 ( 4096 byte blocks, 4096 bytes per update,   1 updates): 139176 operations in 1 seconds (570064896 bytes)
[  202.111260] tcrypt: test 21 ( 8192 byte blocks, 8192 bytes per update,   1 updates): 74584 operations in 1 seconds (610992128 bytes)
modprobe: ERROR: could not insert 'tcrypt': Resource temporarily unavailable

root@OpenWrt-dev:/# modprobe tcrypt mode=424 sec=1
[  204.764160] tcrypt:
[  204.764160] testing speed of multibuffer sha512 (sha512-al)
[  204.771952] tcrypt: test  0 (   16 byte blocks,   16 bytes per update,   1 updates): 87352 operations in 1 seconds (1397632 bytes)
[  205.781014] tcrypt: test  2 (   64 byte blocks,   64 bytes per update,   1 updates): 147776 operations in 1 seconds (9457664 bytes)
[  206.791197] tcrypt: test  5 (  256 byte blocks,  256 bytes per update,   1 updates): 238832 operations in 1 seconds (61140992 bytes)
[  207.801163] tcrypt: test  8 ( 1024 byte blocks, 1024 bytes per update,   1 updates): 213072 operations in 1 seconds (218185728 bytes)
[  208.811255] tcrypt: test 12 ( 2048 byte blocks, 2048 bytes per update,   1 updates): 216952 operations in 1 seconds (444317696 bytes)
[  209.821225] tcrypt: test 16 ( 4096 byte blocks, 4096 bytes per update,   1 updates): 184816 operations in 1 seconds (757006336 bytes)
[  210.831262] tcrypt: test 21 ( 8192 byte blocks, 8192 bytes per update,   1 updates): 110248 operations in 1 seconds (903151616 bytes)
modprobe: ERROR: could not insert 'tcrypt': Resource temporarily unavailable

root@OpenWrt-dev:/# modprobe tcrypt mode=600 sec=1
[  213.924309] tcrypt:
[  213.924309] testing speed of multibuffer ecb(aes) (ecb-aes-al) encryption
[  213.933292] tcrypt: test 0 (128 bit key, 16 byte blocks): 87784 operations in 1 seconds (1404544 bytes)
[  214.938731] tcrypt: test 1 (128 bit key, 64 byte blocks): 91544 operations in 1 seconds (5858816 bytes)
[  215.938680] tcrypt: test 2 (128 bit key, 256 byte blocks): 104168 operations in 1 seconds (26667008 bytes)
[  216.938964] tcrypt: test 3 (128 bit key, 1024 byte blocks): 116912 operations in 1 seconds (119717888 bytes)
[  217.939192] tcrypt: test 4 (128 bit key, 1472 byte blocks): 127448 operations in 1 seconds (187603456 bytes)
[  218.939185] tcrypt: test 5 (128 bit key, 8192 byte blocks): 177680 operations in 1 seconds (1455554560 bytes)
[  219.939140] tcrypt: test 6 (192 bit key, 16 byte blocks): 224392 operations in 1 seconds (3590272 bytes)
[  220.938706] tcrypt: test 7 (192 bit key, 64 byte blocks): 225160 operations in 1 seconds (14410240 bytes)
[  221.938786] tcrypt: test 8 (192 bit key, 256 byte blocks): 228696 operations in 1 seconds (58546176 bytes)
[  222.938890] tcrypt: test 9 (192 bit key, 1024 byte blocks): 229568 operations in 1 seconds (235077632 bytes)
[  223.939080] tcrypt: test 10 (192 bit key, 1472 byte blocks): 229016 operations in 1 seconds (337111552 bytes)
[  224.939141] tcrypt: test 11 (192 bit key, 8192 byte blocks): 176712 operations in 1 seconds (1447624704 bytes)
[  225.939259] tcrypt: test 12 (256 bit key, 16 byte blocks): 227560 operations in 1 seconds (3640960 bytes)
[  226.948814] tcrypt: test 13 (256 bit key, 64 byte blocks): 227688 operations in 1 seconds (14572032 bytes)
[  227.948878] tcrypt: test 14 (256 bit key, 256 byte blocks): 230208 operations in 1 seconds (58933248 bytes)
[  228.948964] tcrypt: test 15 (256 bit key, 1024 byte blocks): 229344 operations in 1 seconds (234848256 bytes)
[  229.949141] tcrypt: test 16 (256 bit key, 1472 byte blocks): 229272 operations in 1 seconds (337488384 bytes)
[  230.949156] tcrypt: test 17 (256 bit key, 8192 byte blocks): 177248 operations in 1 seconds (1452015616 bytes)
[  231.949504] tcrypt:
[  231.949504] testing speed of multibuffer ecb(aes) (ecb-aes-al) decryption
[  231.958448] tcrypt: test 0 (128 bit key, 16 byte blocks): 175040 operations in 1 seconds (2800640 bytes)
[  232.958706] tcrypt: test 1 (128 bit key, 64 byte blocks): 172432 operations in 1 seconds (11035648 bytes)
[  233.958813] tcrypt: test 2 (128 bit key, 256 byte blocks): 176072 operations in 1 seconds (45074432 bytes)
[  234.958909] tcrypt: test 3 (128 bit key, 1024 byte blocks): 172944 operations in 1 seconds (177094656 bytes)
[  235.959057] tcrypt: test 4 (128 bit key, 1472 byte blocks): 177400 operations in 1 seconds (261132800 bytes)
[  236.959053] tcrypt: test 5 (128 bit key, 8192 byte blocks): 94264 operations in 1 seconds (772210688 bytes)
[  237.960419] tcrypt: test 6 (192 bit key, 16 byte blocks): 175824 operations in 1 seconds (2813184 bytes)
[  238.968708] tcrypt: test 7 (192 bit key, 64 byte blocks): 171744 operations in 1 seconds (10991616 bytes)
[  239.968793] tcrypt: test 8 (192 bit key, 256 byte blocks): 175928 operations in 1 seconds (45037568 bytes)
[  240.968918] tcrypt: test 9 (192 bit key, 1024 byte blocks): 173040 operations in 1 seconds (177192960 bytes)
[  241.969093] tcrypt: test 10 (192 bit key, 1472 byte blocks): 173040 operations in 1 seconds (254714880 bytes)
[  242.969166] tcrypt: test 11 (192 bit key, 8192 byte blocks): 82408 operations in 1 seconds (675086336 bytes)
[  243.969340] tcrypt: test 12 (256 bit key, 16 byte blocks): 174432 operations in 1 seconds (2790912 bytes)
[  244.978811] tcrypt: test 13 (256 bit key, 64 byte blocks): 173072 operations in 1 seconds (11076608 bytes)
[  245.980867] tcrypt: test 14 (256 bit key, 256 byte blocks): 177872 operations in 1 seconds (45535232 bytes)
[  246.988994] tcrypt: test 15 (256 bit key, 1024 byte blocks): 176344 operations in 1 seconds (180576256 bytes)
[  247.989132] tcrypt: test 16 (256 bit key, 1472 byte blocks): 174088 operations in 1 seconds (256257536 bytes)
[  248.989178] tcrypt: test 17 (256 bit key, 8192 byte blocks): 73400 operations in 1 seconds (601292800 bytes)
[  249.989960] tcrypt:
[  249.989960] testing speed of multibuffer cbc(aes) (cbc-aes-al) encryption
[  249.998904] tcrypt: test 0 (128 bit key, 16 byte blocks): 232072 operations in 1 seconds (3713152 bytes)
[  250.998729] tcrypt: test 1 (128 bit key, 64 byte blocks): 228616 operations in 1 seconds (14631424 bytes)
[  251.998812] tcrypt: test 2 (128 bit key, 256 byte blocks): 100408 operations in 1 seconds (25704448 bytes)
[  252.998991] tcrypt: test 3 (128 bit key, 1024 byte blocks): 212672 operations in 1 seconds (217776128 bytes)
[  253.999048] tcrypt: test 4 (128 bit key, 1472 byte blocks): 203944 operations in 1 seconds (300205568 bytes)
[  254.999058] tcrypt: test 5 (128 bit key, 8192 byte blocks): 100920 operations in 1 seconds (826736640 bytes)
[  255.999097] tcrypt: test 6 (192 bit key, 16 byte blocks): 234328 operations in 1 seconds (3749248 bytes)
[  256.998721] tcrypt: test 7 (192 bit key, 64 byte blocks): 220696 operations in 1 seconds (14124544 bytes)
[  257.998817] tcrypt: test 8 (192 bit key, 256 byte blocks): 217912 operations in 1 seconds (55785472 bytes)
[  258.998880] tcrypt: test 9 (192 bit key, 1024 byte blocks): 205088 operations in 1 seconds (210010112 bytes)
[  259.999104] tcrypt: test 10 (192 bit key, 1472 byte blocks): 115696 operations in 1 seconds (170304512 bytes)
[  260.999404] tcrypt: test 11 (192 bit key, 8192 byte blocks): 84384 operations in 1 seconds (691273728 bytes)
[  262.009054] tcrypt: test 12 (256 bit key, 16 byte blocks): 235056 operations in 1 seconds (3760896 bytes)
[  263.008818] tcrypt: test 13 (256 bit key, 64 byte blocks): 151872 operations in 1 seconds (9719808 bytes)
[  264.008844] tcrypt: test 14 (256 bit key, 256 byte blocks): 159208 operations in 1 seconds (40757248 bytes)
[  265.009108] tcrypt: test 15 (256 bit key, 1024 byte blocks): 204560 operations in 1 seconds (209469440 bytes)
[  266.012117] tcrypt: test 16 (256 bit key, 1472 byte blocks): 200584 operations in 1 seconds (295259648 bytes)
[  267.019157] tcrypt: test 17 (256 bit key, 8192 byte blocks): 77096 operations in 1 seconds (631570432 bytes)
[  268.019404] tcrypt:
[  268.019404] testing speed of multibuffer cbc(aes) (cbc-aes-al) decryption
[  268.028457] tcrypt: test 0 (128 bit key, 16 byte blocks): 81040 operations in 1 seconds (1296640 bytes)
[  269.028747] tcrypt: test 1 (128 bit key, 64 byte blocks): 118776 operations in 1 seconds (7601664 bytes)
[  270.028859] tcrypt: test 2 (128 bit key, 256 byte blocks): 175128 operations in 1 seconds (44832768 bytes)
[  271.028919] tcrypt: test 3 (128 bit key, 1024 byte blocks): 174128 operations in 1 seconds (178307072 bytes)
[  272.029070] tcrypt: test 4 (128 bit key, 1472 byte blocks): 175576 operations in 1 seconds (258447872 bytes)
[  273.029067] tcrypt: test 5 (128 bit key, 8192 byte blocks): 96872 operations in 1 seconds (793575424 bytes)
[  274.028986] tcrypt: test 6 (192 bit key, 16 byte blocks): 174824 operations in 1 seconds (2797184 bytes)
[  275.028739] tcrypt: test 7 (192 bit key, 64 byte blocks): 172888 operations in 1 seconds (11064832 bytes)
[  276.028811] tcrypt: test 8 (192 bit key, 256 byte blocks): 175056 operations in 1 seconds (44814336 bytes)
[  277.028923] tcrypt: test 9 (192 bit key, 1024 byte blocks): 175104 operations in 1 seconds (179306496 bytes)
[  278.029090] tcrypt: test 10 (192 bit key, 1472 byte blocks): 176088 operations in 1 seconds (259201536 bytes)
[  279.029162] tcrypt: test 11 (192 bit key, 8192 byte blocks): 84456 operations in 1 seconds (691863552 bytes)
[  280.029075] tcrypt: test 12 (256 bit key, 16 byte blocks): 175984 operations in 1 seconds (2815744 bytes)
[  281.028788] tcrypt: test 13 (256 bit key, 64 byte blocks): 174848 operations in 1 seconds (11190272 bytes)
[  282.028873] tcrypt: test 14 (256 bit key, 256 byte blocks): 176088 operations in 1 seconds (45078528 bytes)
[  283.029003] tcrypt: test 15 (256 bit key, 1024 byte blocks): 177600 operations in 1 seconds (181862400 bytes)
[  284.029128] tcrypt: test 16 (256 bit key, 1472 byte blocks): 171960 operations in 1 seconds (253125120 bytes)
[  285.029153] tcrypt: test 17 (256 bit key, 8192 byte blocks): 74936 operations in 1 seconds (613875712 bytes)
[  286.034659] tcrypt: failed to load transform for lrw(aes): -2
[  286.045495] tcrypt: failed to load transform for lrw(aes): -2
[  286.056309] tcrypt: failed to load transform for xts(aes): -2
[  286.067122] tcrypt: failed to load transform for xts(aes): -2
[  286.077968] tcrypt: failed to load transform for cts(cbc(aes)): -2
[  286.089307] tcrypt: failed to load transform for cts(cbc(aes)): -2
[  286.100525] tcrypt: failed to load transform for ctr(aes): -2
[  286.111849] tcrypt: failed to load transform for ctr(aes): -2
[  286.122820] tcrypt: failed to load transform for cfb(aes): -2
[  286.133788] tcrypt: failed to load transform for cfb(aes): -2
[  286.144932] tcrypt: failed to load transform for ofb(aes): -2
[  286.155976] tcrypt: failed to load transform for ofb(aes): -2
[  286.167044] tcrypt: failed to load transform for rfc3686(ctr(aes)): -2
[  286.178670] tcrypt: failed to load transform for rfc3686(ctr(aes)): -2
modprobe: ERROR: could not insert 'tcrypt': Resource temporarily unavailable

root@OpenWrt-dev:/# modprobe tcrypt mode=601 sec=1
[  295.304114] tcrypt:
[  295.304114] testing speed of multibuffer ecb(des3_ede) (ecb-des3-ede-al) encryption
[  295.313973] tcrypt: test 0 (192 bit key, 16 byte blocks): 90320 operations in 1 seconds (1445120 bytes)
[  296.318732] tcrypt: test 1 (192 bit key, 64 byte blocks): 251536 operations in 1 seconds (16098304 bytes)
[  297.318786] tcrypt: test 2 (192 bit key, 256 byte blocks): 124136 operations in 1 seconds (31778816 bytes)
[  298.318938] tcrypt: test 3 (192 bit key, 1024 byte blocks): 101872 operations in 1 seconds (104316928 bytes)
[  299.319084] tcrypt: test 4 (192 bit key, 1472 byte blocks): 75984 operations in 1 seconds (111848448 bytes)
[  300.319052] tcrypt: test 5 (192 bit key, 8192 byte blocks): 14568 operations in 1 seconds (119341056 bytes)
[  301.319671] tcrypt:
[  301.319671] testing speed of multibuffer ecb(des3_ede) (ecb-des3-ede-al) decryption
[  301.329500] tcrypt: test 0 (192 bit key, 16 byte blocks): 251672 operations in 1 seconds (4026752 bytes)
[  302.338700] tcrypt: test 1 (192 bit key, 64 byte blocks): 250320 operations in 1 seconds (16020480 bytes)
[  303.338805] tcrypt: test 2 (192 bit key, 256 byte blocks): 223760 operations in 1 seconds (57282560 bytes)
[  304.338902] tcrypt: test 3 (192 bit key, 1024 byte blocks): 99536 operations in 1 seconds (101924864 bytes)
[  305.338991] tcrypt: test 4 (192 bit key, 1472 byte blocks): 73104 operations in 1 seconds (107609088 bytes)
[  306.339024] tcrypt: test 5 (192 bit key, 8192 byte blocks): 14392 operations in 1 seconds (117899264 bytes)
[  307.339413] tcrypt:
[  307.339413] testing speed of multibuffer cbc(des3_ede) (cbc-des3-ede-al) encryption
[  307.349352] tcrypt: test 0 (192 bit key, 16 byte blocks): 86088 operations in 1 seconds (1377408 bytes)
[  308.358675] tcrypt: test 1 (192 bit key, 64 byte blocks): 138320 operations in 1 seconds (8852480 bytes)
[  309.358795] tcrypt: test 2 (192 bit key, 256 byte blocks): 202016 operations in 1 seconds (51716096 bytes)
[  310.358906] tcrypt: test 3 (192 bit key, 1024 byte blocks): 93792 operations in 1 seconds (96043008 bytes)
[  311.358900] tcrypt: test 4 (192 bit key, 1472 byte blocks): 72224 operations in 1 seconds (106313728 bytes)
[  312.359007] tcrypt: test 5 (192 bit key, 8192 byte blocks): 13880 operations in 1 seconds (113704960 bytes)
[  313.359409] tcrypt:
[  313.359409] testing speed of multibuffer cbc(des3_ede) (cbc-des3-ede-al) decryption
[  313.369348] tcrypt: test 0 (192 bit key, 16 byte blocks): 80856 operations in 1 seconds (1293696 bytes)
[  314.378749] tcrypt: test 1 (192 bit key, 64 byte blocks): 174760 operations in 1 seconds (11184640 bytes)
[  315.378811] tcrypt: test 2 (192 bit key, 256 byte blocks): 174624 operations in 1 seconds (44703744 bytes)
[  316.378907] tcrypt: test 3 (192 bit key, 1024 byte blocks): 96904 operations in 1 seconds (99229696 bytes)
[  317.378943] tcrypt: test 4 (192 bit key, 1472 byte blocks): 70168 operations in 1 seconds (103287296 bytes)
[  318.378977] tcrypt: test 5 (192 bit key, 8192 byte blocks): 14056 operations in 1 seconds (115146752 bytes)
[  319.384792] tcrypt: failed to load transform for cfb(des3_ede): -2
[  319.396235] tcrypt: failed to load transform for cfb(des3_ede): -2
[  319.407649] tcrypt: failed to load transform for ofb(des3_ede): -2
[  319.418916] tcrypt: failed to load transform for ofb(des3_ede): -2
modprobe: ERROR: could not insert 'tcrypt': Resource temporarily unavailable

root@OpenWrt-dev:/# modprobe tcrypt mode=602 sec=1
[  327.474126] tcrypt:
[  327.474126] testing speed of multibuffer ecb(des) (ecb-des-al) encryption
[  327.483120] tcrypt: test 0 (64 bit key, 16 byte blocks): 248448 operations in 1 seconds (3975168 bytes)
[  328.488620] tcrypt: test 1 (64 bit key, 64 byte blocks): 245624 operations in 1 seconds (15719936 bytes)
[  329.488700] tcrypt: test 2 (64 bit key, 256 byte blocks): 231000 operations in 1 seconds (59136000 bytes)
[  330.488790] tcrypt: test 3 (64 bit key, 1024 byte blocks): 212288 operations in 1 seconds (217382912 bytes)
[  331.488960] tcrypt: test 4 (64 bit key, 1472 byte blocks): 150648 operations in 1 seconds (221753856 bytes)
[  332.489047] tcrypt: test 5 (64 bit key, 8192 byte blocks): 40280 operations in 1 seconds (329973760 bytes)
[  333.489409] tcrypt:
[  333.489409] testing speed of multibuffer ecb(des) (ecb-des-al) decryption
[  333.498474] tcrypt: test 0 (64 bit key, 16 byte blocks): 89080 operations in 1 seconds (1425280 bytes)
[  334.498657] tcrypt: test 1 (64 bit key, 64 byte blocks): 251496 operations in 1 seconds (16095744 bytes)
[  335.498700] tcrypt: test 2 (64 bit key, 256 byte blocks): 243288 operations in 1 seconds (62281728 bytes)
[  336.498810] tcrypt: test 3 (64 bit key, 1024 byte blocks): 212968 operations in 1 seconds (218079232 bytes)
[  337.498958] tcrypt: test 4 (64 bit key, 1472 byte blocks): 181400 operations in 1 seconds (267020800 bytes)
[  338.498956] tcrypt: test 5 (64 bit key, 8192 byte blocks): 40792 operations in 1 seconds (334168064 bytes)
[  339.499234] tcrypt:
[  339.499234] testing speed of multibuffer cbc(des) (cbc-des-al) encryption
[  339.508180] tcrypt: test 0 (64 bit key, 16 byte blocks): 85840 operations in 1 seconds (1373440 bytes)
[  340.508647] tcrypt: test 1 (64 bit key, 64 byte blocks): 133576 operations in 1 seconds (8548864 bytes)
[  341.508735] tcrypt: test 2 (64 bit key, 256 byte blocks): 218624 operations in 1 seconds (55967744 bytes)
[  342.508792] tcrypt: test 3 (64 bit key, 1024 byte blocks): 194312 operations in 1 seconds (198975488 bytes)
[  343.508971] tcrypt: test 4 (64 bit key, 1472 byte blocks): 122096 operations in 1 seconds (179725312 bytes)
[  344.509058] tcrypt: test 5 (64 bit key, 8192 byte blocks): 40056 operations in 1 seconds (328138752 bytes)
[  345.509427] tcrypt:
[  345.509427] testing speed of multibuffer cbc(des) (cbc-des-al) decryption
[  345.518493] tcrypt: test 0 (64 bit key, 16 byte blocks): 168088 operations in 1 seconds (2689408 bytes)
[  346.518619] tcrypt: test 1 (64 bit key, 64 byte blocks): 177728 operations in 1 seconds (11374592 bytes)
[  347.518737] tcrypt: test 2 (64 bit key, 256 byte blocks): 179616 operations in 1 seconds (45981696 bytes)
[  348.518786] tcrypt: test 3 (64 bit key, 1024 byte blocks): 175728 operations in 1 seconds (179945472 bytes)
[  349.519002] tcrypt: test 4 (64 bit key, 1472 byte blocks): 165208 operations in 1 seconds (243186176 bytes)
[  350.518975] tcrypt: test 5 (64 bit key, 8192 byte blocks): 40200 operations in 1 seconds (329318400 bytes)
[  351.524666] tcrypt: failed to load transform for cfb(des): -2
[  351.535649] tcrypt: failed to load transform for cfb(des): -2
[  351.546639] tcrypt: failed to load transform for ofb(des): -2
[  351.557451] tcrypt: failed to load transform for ofb(des): -2
modprobe: ERROR: could not insert 'tcrypt': Resource temporarily unavailable

Hmm, interesting OpenSSL is faster with devcrypto than with AF_ALG !!!

devcrypto engine

root@(none):/# openssl speed -evp aes-256-cbc -engine devcrypto -elapsed
engine "devcrypto" set.
You have chosen to measure elapsed time instead of user CPU time.
Doing aes-256-cbc for 3s on 16 size blocks: 103519 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 64 size blocks: 108227 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 256 size blocks: 132323 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 1024 size blocks: 127454 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 8192 size blocks: 72286 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 16384 size blocks: 55760 aes-256-cbc's in 3.00s
OpenSSL 1.1.1k  25 Mar 2021
built on: Tue Apr 13 06:16:48 2021 UTC
options:bn(64,32) rc4(char) des(long) aes(partial) blowfish(ptr)
compiler: arm-openwrt-linux-muslgnueabi-gcc -fPIC -pthread -Wa,--noexecstack -Wall -O3 -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -O3 -DPIC -fpic -ffunction-sections -fdata-sections -znow -zrelro -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG -DOPENSSL_PREFER_CHACHA_OVER_GCM
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        552.10k     2308.84k    11291.56k    43504.30k   197388.97k   304523.95k

AF_ALG engine

root@(none):/# openssl speed -evp aes-256-cbc -engine afalg -elapsed
engine "afalg" set.
You have chosen to measure elapsed time instead of user CPU time.
Doing aes-256-cbc for 3s on 16 size blocks: 51135 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 64 size blocks: 45648 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 256 size blocks: 51652 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 1024 size blocks: 43952 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 8192 size blocks: 35001 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 16384 size blocks: 27121 aes-256-cbc's in 3.00s
OpenSSL 1.1.1k  25 Mar 2021
built on: Tue Apr 13 06:16:48 2021 UTC
options:bn(64,32) rc4(char) des(long) aes(partial) blowfish(ptr)
compiler: arm-openwrt-linux-muslgnueabi-gcc -fPIC -pthread -Wa,--noexecstack -Wall -O3 -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -O3 -DPIC -fpic -ffunction-sections -fdata-sections -znow -zrelro -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG -DOPENSSL_PREFER_CHACHA_OVER_GCM
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        272.72k      973.82k     4407.64k    15002.28k    95576.06k   148116.82k

Wow, the factor is more than 2 !!!

2 Likes

Found this on Netgear's site: https://kb.netgear.com/31408/What-SFP-modules-are-compatible-with-Nighthawk-X10-R9000-R8900-and-Nighthawk-Pro-Gaming-XR700-routers

1 Like

Added libkcapi as a package to OpenWRT and found another bug in al_crypto driver where the libkcapi test kcapi-enc-test.sh enters non-interruptable state. Have no fix yet.
But libkcapi tests are pretty good :slight_smile:

Apparently the test is waiting for a completion of a sent request.
The driver is not getting an interrupt for whatever reason.

[  529.019635] sysrq: Show Blocked State
[  529.023358] task:kcapi-enc       state:D stack:    0 pid:21209 ppid: 16713 flags:0x00000001
[  529.031729] Backtrace:
[  529.034195] [<c080a670>] (__schedule) from [<c080ac30>] (schedule+0x94/0xe4)
[  529.041265]  r10:c28d1f44 r9:c40b9000 r8:00000002 r7:ffffe000 r6:7fffffff r5:c3448c00
[  529.049103]  r4:ffffe000
[  529.051643] [<c080ab9c>] (schedule) from [<c080e9c4>] (schedule_timeout+0x28/0x358)
[  529.059306]  r5:c32077d4 r4:7fffffff
[  529.062885] [<c080e99c>] (schedule_timeout) from [<c080b728>] (wait_for_completion+0xa8/0x114)
[  529.071499]  r8:00000002 r7:ffffe000 r6:7fffffff r5:c32077d4 r4:c32077d0
[  529.078200] [<c080b680>] (wait_for_completion) from [<bf2ae658>] (skcipher_recvmsg+0x328/0x3fc [algif_skcipher])
[  529.088373]  r8:c40b9240 r7:ffffff8d r6:c32077c0 r5:c281b400 r4:c32077d0
[  529.095093] [<bf2ae330>] (skcipher_recvmsg [algif_skcipher]) from [<c066d494>] (____sys_recvmsg+0x7c/0x164)
[  529.104837]  r10:bf2ae330 r9:00000000 r8:00000000 r7:c28d1e04 r6:bee3e994 r5:c1704f48
[  529.112673]  r4:c28d1f44
[  529.115213] [<c066d418>] (____sys_recvmsg) from [<c066f3d8>] (___sys_recvmsg+0x68/0x80)
[  529.123224]  r10:00000129 r9:c28d0000 r8:bee3e994 r7:00000000 r6:c2f04fc0 r5:c28d1f44
[  529.131059]  r4:00000000
[  529.133598] [<c066f370>] (___sys_recvmsg) from [<c066fa28>] (__sys_recvmsg+0x4c/0x70)
[  529.141434]  r8:c0100224 r7:00000129 r6:c2f04fc0 r5:00000000 r4:bee3e994
[  529.148129] [<c066f9dc>] (__sys_recvmsg) from [<c066fa68>] (sys_recvmsg+0x1c/0x20)
[  529.155705]  r6:00000000 r5:00000000 r4:00000000
[  529.160346] [<c066fa4c>] (sys_recvmsg) from [<c0100060>] (ret_fast_syscall+0x0/0x28)
[  529.168078] Exception stack(0xc28d1fa8 to 0xc28d1ff0)
[  529.173143] 1fa0:                   00000000 00000000 00000008 bee3e994 00000000 00000000
[  529.181328] 1fc0: 00000000 00000000 00000000 00000129 b6e57000 00010000 00000007 b6f23240
[  529.189519] 1fe0: bee3e950 bee3e940 b6efa66c b6ef9b44

To debug al_crypto driver, unload it, then load it like this:
modprobe al_crypto dyndbg="file drivers/crypto/al/* +p"

While fixing al_crypto bugs found a bug in sg_split(): https://marc.info/?l=linux-kernel&m=161873368518602&w=2.

Oh boi, and another 2 bug fixes for sg_split() coming up :slight_smile: It seems it's not very well tested at all :frowning:

Update

Yuhu, after fixing 3 bugs in sg_split.c and a couple of other bugs in al_crypto all AES-CBC libkcapi tests are OK. The original al_crypto driver doesn't support input >= 64kB that's why i needed sg_split().

https://marc.info/?l=linux-kernel&m=161875647724150&w=2
https://marc.info/?l=linux-kernel&m=161875647724151&w=2

libkcapi AES-CBC(128) & AES-CBC(256) tests:

bash-5.1# /usr/lib/libkcapi/kcapi-enc-test.sh
/usr/share/misc/magic, 12891: Warning: Unparsable number `xu                    \b, dcrypt version %d'
[PASSED: 32-bit - 5.10.31] 1 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 1 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 1 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 1 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 1 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 1 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 1 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 1 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 15 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 15 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 15 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 15 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 15 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 15 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 15 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 15 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 16 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 16 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 16 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 16 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 16 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 16 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 16 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 16 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 29 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 29 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 29 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 29 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 29 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 29 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 29 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 29 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 32 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 32 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 32 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 32 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 32 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 32 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 32 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 32 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 257 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 257 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 257 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 257 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 257 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 257 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 257 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 257 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 512 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 512 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 512 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 512 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 512 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 512 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 512 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 512 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 1023 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 1023 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 1023 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 1023 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 1023 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 1023 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 1023 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 1023 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 16385 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 16385 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 16385 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 16385 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 16385 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 16385 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 16385 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 16385 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 65535 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 65535 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 65535 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 65535 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 65535 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 65535 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 65535 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 65535 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 65536 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 65536 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 65536 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 65536 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 65536 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 65536 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 65536 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 65536 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 65537 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 65537 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 65537 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 65537 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 65537 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 65537 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 65537 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 65537 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 99999 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 99999 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 99999 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 99999 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 99999 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 99999 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 99999 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 99999 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 100000 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 100000 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 100000 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 100000 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 100000 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 100000 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 100000 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 100000 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 100001 bytes: FILEIN / FILEOUT enc test (128 bits)
[PASSED: 32-bit - 5.10.31] 100001 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 100001 bytes: FILEIN / FILEOUT enc test (128 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 100001 bytes: FILEIN / FILEOUT enc test (password)
[PASSED: 32-bit - 5.10.31] 100001 bytes: FILEIN / FILEOUT enc test (256 bits)
[PASSED: 32-bit - 5.10.31] 100001 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated CT)
[PASSED: 32-bit - 5.10.31] 100001 bytes: FILEIN / FILEOUT enc test (256 bits) (openssl generated PT)
[PASSED: 32-bit - 5.10.31] 100001 bytes: FILEIN / FILEOUT enc test (password)
===================================================================
Number of failures: 0
1 Like

As I started looking into proper SFP support I noticed us still using an Ethernet driver pre-dating phylink [1]. Googling around I stumbled over Antoine's mainline submission [2] and contacted him. However, he stopped working on this not long after. If he recalls correctly, in addition to issues in the driver itself, there were design issues to solve as well in DMA and other parts. I also quickly analysed what other downstream sources may be floating around from other products using Linux on Alpine. I checked NAS sources from Netgear, QNAP and Synology with QNAP's stuff likely being most current, but still ancient. Then, I stumbled over Ubiquiti's UDM stuff which is much more recent and likely also more suitable for our use case. Anyway, I am now diving into that [3]. Wish me luck!

[1] https://www.kernel.org/doc/html/latest/networking/sfp-phylink.html
[2] https://patchwork.ozlabs.org/project/netdev/patch/20170203181216.30214-5-antoine.tenart@free-electrons.com/
[3] https://drive.google.com/file/d/1K-emdRB_EWNzJDJI4-j7_9nzI19yzF2D/view?usp=sharing

1 Like