IPQ806x NSS Drivers


#121

@Ansuel

Have you had a chance to test on 4.14 yet?


#122

I'm fixing the driver for 4.14
Today I will test if GMAC and drv firmware loader works
Then I will start to rework the offload part


#123

I know it's supported. :wink: Moreover I was trying to enable the internal GMAC to the Broadcom CPU (probably the only consumer device to have 3 gmac) to get VDSL working (https://forum.openwrt.org/t/ipq806x-lede-support-for-tp-link-archer-vr2600v/326/25).
I tried to change some code accordingly to the TP-Link sources, but didn't work. I hope that switching to this gmac implementation can solve the problem. :slight_smile:


#124

did you test my patch ?


#125

Actually wouldn't it be smarter for me to test it on my device? because i seem to have 2 different systems installed where 1 is OpenWRT and the other one is my original router firmware.
So in case my device bricks i could simply switch to my original firmware and from there install the custom firmware again :smiley:


#126

We don't actually know if the nss code is the same for zytel... We need to first compile something stable and make the crypto core works... Then we can try to port.. :frowning:


#127

I think the r7800 and zyxel are almost a 1:1 device.


#128

@JayJax from https://wikidevi.com/wiki/ZyXEL_NBG6817_(Armor_Z2) it looks like the same as the R7800 with different flash. If you’re comfortable compiling your own firmware, you can try cloning my repo and apply the changes I did for the R7800 to the Zyxel DTS and try to build. That should be all that’s needed.

Note that my repo is cloned from the lede-17.01 branch. If the Zyxel is already supported on that branch, you’re good to go with my repo.


#129

update on porting.... got to compile an image without error with only nss-gmac and nss-drv...

testing the image i get a null point exception (i think on gmac?)

@quarky what does gmac driver print? only the driver info with version and name or something else after that?


#130

I have this from my serial console:

[   10.574168] kmodloader: loading kernel modules from /etc/modules.d/*
[   10.579637] nf_conntrack version 0.5.0 (7480 buckets, 29920 max)
[   10.581702] rfs_ess_init[1115]:ERROR:Cannot find ess-switch
[   10.627540] ssdk_alloc_priv[3813]:INFO:ess-switch dts node number: 1
[   10.630335] ssdk_dt_get_switch_node[2823]:WARN:cannot find ess-switch node
[   10.637207] ssdk_plat_init start
[   10.640075] ssdk_driver_register[3022]:INFO:Register QCA PHY driver
[   11.093812] f1_phy_api_ops_init[1391]:INFO:qca probe f1 phy driver succeeded!
[   11.096876] regi_init[3952]:INFO:qca-ssdk module init succeeded!
[   11.106844] tun: Universal TUN/TAP device driver, 1.6
[   11.106887] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[   11.120349] **********************************************************
[   11.120390] * Driver    :NSS GMAC Driver for RTL v(3.72a)
[   11.125778] * Version   :1.0
[   11.131401] * Copyright :Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
[   11.134201] **********************************************************
[   11.178248] ipip: IPv4 over IPv4 tunneling driver
[   11.184474] l2tp_core: L2TP core driver, V2.0
[   11.185992] l2tp_netlink: L2TP netlink interface
[   11.202260] nss_init[634]:Init NSS drivernss-driver: fabric 0 handler
[   11.209057] nss-driver: fabric 1 handler
[   11.212133] nss_hal_probe[1031]:nss_hal_common_reset Done.
[   11.217583] nss_hal_probe[1065]:bf479178: NSS_DEV_ID 36000000.nss 
[   11.221405] nss_driver - fw of size 434240  bytes copied to load addr: 40000000, nss_id : 0
[   11.226507] nss_driver - Turbo Support 1
[   11.234622] Supported Frequencies - 110Mhz 600Mhz 800Mhz 
[   11.243247] nss_hal_probe[1260]:bf479178: Setting NSS0 Firmware load address to 40000000
[   11.243334] nss_hal_probe[1291]:0:ctx=bf479178, vphys=39000000, vmap=df540000, nphys=36000000, nmap=df4be000
[   11.252802] nss_hal_probe[1344]:0: This NSS core supports two interruptsnss_hal_probe[1396]:0: NSS shaping is enabled
[   11.267428] nss_pptp_register_handler[431]:nss_pptp_register_handlernss_l2tpv2_register_handler[303]:nss_l2tpv2_register_handler
[   11.277658] nss_wifi_register_handler[266]:nss_wifi_register_handlernss_hal_probe[1537]:bf479178: Reseting NSS core 0 now
[   11.289447] nss_hal_probe[1621]:bf479178: All resources initialized and nss core0 has been brought out of reset[   11.297764] nss_hal_probe[1065]:bf47a190: NSS_DEV_ID 36400000.nss 
[   11.309153] nss_driver - fw of size 189248  bytes copied to load addr: 40800000, nss_id : 1
[   11.310545] nss_hal_probe[1260]:bf47a190: Setting NSS1 Firmware load address to 40800000
[   11.318279] nss_hal_probe[1291]:1:ctx=bf47a190, vphys=39010000, vmap=df5c0000, nphys=36400000, nmap=df52e000
[   11.327651] nss_hal_probe[1344]:1: This NSS core supports two interruptsError - Duplicate Interface CB Registered for interface 107
[   11.342814] Error - Duplicate Interface CB Registered for interface 110
[   11.348227] nss_hal_probe[1537]:bf47a190: Reseting NSS core 1 now
[   11.354808] nss_hal_probe[1621]:bf47a190: All resources initialized and nss core1 has been brought out of reset

#131

thx for the log


#132

I will have access to my C2600 in a week or so, but to keep the momentum going, I compiled an image:

Edit: deleted link: bootloops.
md5: 86dfd5d891876f52440f611fb2ce629c

Needless to say, I did not test this on any hardware so get tftp/recovery image ready before flashing.

  1. Based on trunk, r8614 as of this post.
  2. Added current nss-gmac. (1)
  3. Disabled upstream stmmac driver, updated dts, switched to nss-gmac. (2)

luci and iperf3 included.

Thats it. The goal is to simply see if the first layer works with current master. Without it the rest would be useless.
If you try this on archer c2600, post dmesg and log.

(1) I opted to go for what seemed to be the latest version of nss-gmac instead of one supplied in stock gpl tarballs, since we are trying to go for 4.14, might as well bump everything else :smile:
Codeaurora has many branches, but nss branch looks clean/most up-to-date. When this was not available I went for HNSS QSDK 9.

(2) gmac-nss is the driver used by qca in their sdks, it has the ability to offload to the NSS cores. Sometime in 2015, they tried to upstream this but it was rejected as there's an existing driver that supports the hardware (stmmac), they published a 'glue layer', which enabled the hw in ipq806x to work with the upstream driver but without offloading ability.

Hence this test, if gmac-nss doesn't work with current kernel, we can't offload and so no point in trying to port the other components.


#133

The nss-gmac driver is tied to the nss-drv driver. And the nss-drv driver is tied to the NSS Firmware (I think.) So using the latest version may not be such a good idea.

Anyway, good to have more joining in the fun :grin:


#134

@quarky If you live in europe I'd be willing to borrow you a C2600 to make this work with 18.06.1. I'd also be willing to chip in a $100 of bounty for said version.

@abenz Tried your image, it bootloops :confused:


#135

@npr Thank you for your offer. I have my hands full with the R7800 now so unlikely I can do anything with the C2600. I don’t live in Europe as well. Besides, the C2600 doesn’t have a serial port so it’s hard to work on.

Let’s wait until we get it running well with the R7800. It should be easy to then target the C2600.


#136

Cool. Any idea if you'll be able to get it merged into openwrt, or will it be relegated to a custom build?


#137

Very unlikely to have it merged into the mainstream repo IMHO.


#138

If you could make NSS cores and drivers to work completely with current openwrt firmware, i'm pretty sure it actually is very likely to get this pushed into mainstream repo, especially with all the advantages that comes with NSS cores such as SQM/QoS. Not only that it will be a step into the right direction because this feature also provides more availability to openwrt such as adblocker/vpn load ect,ect.
So if you have everything well documented how and what you did pretty sure they will push it in :smiley:


#139

I hope it would be accepted, but seeing that the amount of code changes that's required, it'll take a long long time. Anyway, I'm now trying a newer version of the NSS drivers and see if it'll work. Will keep all posted on the results of my experiments.


#140

I'm gonna try to learn from all of this and see if i can help out in some ways.
Here on this link i see gmac0/1/2/3 they all include: compatible = "qcom,nss-gmac"; and nss-gmac-common.
Their layout is different then from your repo? I might be wrong but i guess it is some form of 3 years old information? :stuck_out_tongue: