IPQ806x NSS Drivers

I should try to port one patch to normal ath10k that should improve speed even more.
@pattagghiu pushed the patch recompile.

i'm fighting with UWSGI right now, let me see if i can compile a new image this afternoon :slight_smile:
thanks!

1 Like

i had never seen anything like this in my log

Sat Oct 17 13:13:28 2020 kern.warn kernel: [  255.088791] ath10k_pci 0000:01:00.0: SWBA overrun on vdev 1, skipped old beacon
Sat Oct 17 13:13:28 2020 kern.warn kernel: [  255.096951] ath10k_pci 0000:01:00.0: SWBA overrun on vdev 0, skipped old beacon
Sat Oct 17 13:13:28 2020 kern.warn kernel: [  255.819031] ath10k_pci 0001:01:00.0: SWBA overrun on vdev 1, skipped old beacon
Sat Oct 17 13:13:28 2020 kern.warn kernel: [  255.826742] ath10k_pci 0001:01:00.0: SWBA overrun on vdev 2, skipped old beacon
Sat Oct 17 13:13:28 2020 kern.warn kernel: [  255.878914] ath10k_pci 0001:01:00.0: SWBA overrun on vdev 0, skipped old beacon
Sat Oct 17 13:13:28 2020 kern.warn kernel: [  255.879036] ath10k_pci 0001:01:00.0: SWBA overrun on vdev 1, skipped old beacon
Sat Oct 17 13:13:28 2020 kern.warn kernel: [  255.898929] ath10k_pci 0001:01:00.0: SWBA overrun on vdev 2, skipped old beacon
Sat Oct 17 13:13:28 2020 kern.warn kernel: [  255.948925] ath10k_pci 0001:01:00.0: SWBA overrun on vdev 0, skipped old beacon
Sat Oct 17 13:13:28 2020 kern.warn kernel: [  255.949049] ath10k_pci 0001:01:00.0: SWBA overrun on vdev 1, skipped old beacon
Sat Oct 17 13:13:28 2020 kern.warn kernel: [  255.955152] ath10k_pci 0001:01:00.0: SWBA overrun on vdev 2, skipped old beacon

(still not updated build)

Just tested it and everything works well. Download speeds are just as good and these are the top output:

Download
CPU: 0% usr 0% sys 0% nic 51% idle 0% io 0% irq 48% sirq
Load average: 0.16 0.08 0.04 1/100 3785
Upload
CPU: 0% usr 0% sys 0% nic 62% idle 0% io 0% irq 37% sirq
Load average: 0.20 0.09 0.05 1/99 3793

i'm seeing a problem but i'm not good enough to fully understand it :slight_smile:
i have a nginx webserver, i can reach my router from wan on https.
Or better, i could. With new firmware i can no longer.
any of you with new versions can accept connection from wan?
thanks

mmm something is wrong with the patch

Applying ./patches/ath/999-ath10k-Enable-802.11-encap-offload-in-tx-path.patch using plaintext: 
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- a/ath10k-5.4/core.c
|+++ b/ath10k-5.4/core.c
--------------------------
No file to patch.  Skipping patch.
4 out of 4 hunks ignored
can't find file to patch at input line 44
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- a/ath10k-5.4/core.h
|+++ b/ath10k-5.4/core.h
--------------------------
No file to patch.  Skipping patch.
2 out of 2 hunks ignored
can't find file to patch at input line 63
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- a/ath10k-5.4/htt_tx.c
|+++ b/ath10k-5.4/htt_tx.c
--------------------------
No file to patch.  Skipping patch.
2 out of 2 hunks ignored
can't find file to patch at input line 103
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- a/ath10k-5.4/mac.c
|+++ b/ath10k-5.4/mac.c
--------------------------
No file to patch.  Skipping patch.
1 out of 1 hunk ignored
can't find file to patch at input line 256
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
| 	 */
|@@ -4343,6 +4347,14 @@ static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar,
| 			ieee80211_is_data_qos(hdr->frame_control);
| 
| 	cb->flags = 0;
|+	cb->vif = vif;
|+	cb->txq = txq;
|+
|+	if (ieee80211_hw_check(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD)) {
|+		cb->flags |= ATH10K_SKB_F_NO_80211_ENCAP;
|+		return;
|+	}
|+
| 	if (!ath10k_tx_h_use_hwcrypto(vif, skb))
| 		cb->flags |= ATH10K_SKB_F_NO_HWCRYPT;
| 
|@@ -4362,8 +4374,6 @@ static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar,
| 		cb->flags |= ATH10K_SKB_F_RAW_TX;
| 	}
| 
|-	cb->vif = vif;
|-	cb->txq = txq;
| 	cb->airtime_est = airtime;
| }
| 
|@@ -4477,6 +4487,9 @@ static int ath10k_mac_tx(struct ath10k *ar,
| 	const struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
| 	int ret;
| 
|+	if (ieee80211_hw_check(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD))
|+		goto skip_encap;
|+
| 	/* We should disable CCK RATE due to P2P */
| 	if (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE)
| 		ath10k_dbg(ar, ATH10K_DBG_MAC, "IEEE80211_TX_CTL_NO_CCK_RATE\n");
|@@ -4505,6 +4518,7 @@ static int ath10k_mac_tx(struct ath10k *ar,
| 		}
| 	}
| 
|+skip_encap:
| 	if (!noque_offchan && info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) {
| 		if (!ath10k_mac_tx_frm_has_freq(ar)) {
| 			ath10k_dbg(ar, ATH10K_DBG_MAC, "mac queued offchannel skb %pK len %d\n",
|@@ -4554,6 +4568,7 @@ void ath10k_offchan_tx_work(struct work_struct *work)
| 	int ret;
| 	unsigned long time_left;
| 	bool tmp_peer_created = false;
|+	struct ieee80211_tx_info *info;
| 
| 	/* FW requirement: We must create a peer before FW will send out
| 	 * an offchannel frame. Otherwise the frame will be stuck and
|@@ -4573,8 +4588,14 @@ void ath10k_offchan_tx_work(struct work_struct *work)
| 		ath10k_dbg(ar, ATH10K_DBG_MAC, "mac offchannel skb %pK len %d\n",
| 			   skb, skb->len);
| 
|-		hdr = (struct ieee80211_hdr *)skb->data;
|-		peer_addr = ieee80211_get_DA(hdr);
|+		info = IEEE80211_SKB_CB(skb);
|+
|+		if (ieee80211_hw_check(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD)) {
|+			peer_addr = skb->data;
|+		} else {
|+			hdr = (struct ieee80211_hdr *)skb->data;
|+			peer_addr = ieee80211_get_DA(hdr);
|+		}
| 
| 		spin_lock_bh(&ar->data_lock);
| 		vdev_id = ar->scan.vdev_id;
|@@ -5213,7 +5234,7 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
| 	struct ieee80211_vif *vif = info->control.vif;
| 	struct ieee80211_sta *sta = control->sta;
| 	struct ieee80211_txq *txq = NULL;
|-	struct ieee80211_hdr *hdr = (void *)skb->data;
|+	struct ieee80211_hdr *hdr;
| 	enum ath10k_hw_txrx_mode txmode;
| 	enum ath10k_mac_tx_path txpath;
| 	bool is_htt;
|@@ -5227,6 +5248,7 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
| 
| 	txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb);
| 	txpath = ath10k_mac_tx_h_get_txpath(ar, skb, txmode);
|+
| 	is_htt = (txpath == ATH10K_MAC_TX_HTT ||
| 		  txpath == ATH10K_MAC_TX_HTT_MGMT);
| 	is_mgmt = (txpath == ATH10K_MAC_TX_HTT_MGMT);
|@@ -5239,7 +5261,6 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
| 
| 	if (is_htt) {
| 		spin_lock_bh(&ar->htt.tx_lock);
|-		is_presp = ieee80211_is_probe_resp(hdr->frame_control);
| 
| 		ret = ath10k_htt_tx_inc_pending(htt);
| 		if (ret) {
|@@ -5250,14 +5271,19 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
| 			return;
| 		}
| 
|-		ret = ath10k_htt_tx_mgmt_inc_pending(htt, is_mgmt, is_presp);
|-		if (ret) {
|-			ath10k_dbg(ar, ATH10K_DBG_MAC, "failed to increase tx mgmt pending count: %d, dropping\n",
|-				   ret);
|-			ath10k_htt_tx_dec_pending(htt);
|-			spin_unlock_bh(&ar->htt.tx_lock);
|-			ieee80211_free_txskb(ar->hw, skb);
|-			return;
|+		if (is_mgmt) {
|+			hdr = (struct ieee80211_hdr *)skb->data;
|+			is_presp = ieee80211_is_probe_resp(hdr->frame_control);
|+
|+			ret = ath10k_htt_tx_mgmt_inc_pending(htt, is_mgmt, is_presp);
|+			if (ret) {
|+				ath10k_dbg(ar, ATH10K_DBG_MAC, "failed to increase tx mgmt pending count: %d, dropping\n",
|+					   ret);
|+				ath10k_htt_tx_dec_pending(htt);
|+				spin_unlock_bh(&ar->htt.tx_lock);
|+				ieee80211_free_txskb(ar->hw, skb);
|+				return;
|+			}
| 		}
| 		spin_unlock_bh(&ar->htt.tx_lock);
| 	}
|@@ -10095,7 +10121,6 @@ int ath10k_mac_register(struct ath10k *ar)
| 	ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL);
| 	ieee80211_hw_set(ar->hw, AP_LINK_PS);
| 	ieee80211_hw_set(ar->hw, SPECTRUM_MGMT);
|-	ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT);
| 	if (ar->bmiss_offload_max_vdev > 0)
| 		ieee80211_hw_set(ar->hw, CONNECTION_MONITOR);
| 	ieee80211_hw_set(ar->hw, SUPPORTS_PER_STA_GTK);
|@@ -10105,6 +10130,11 @@ int ath10k_mac_register(struct ath10k *ar)
| 	ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG);
| 	ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK);
| 
|+	if (ar->ethernet_mode)
|+		ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD);
|+	else
|+		ieee80211_hw_set(ar->hw, SUPPORT_FAST_XMIT);
|+
| 	if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags))
| 		ieee80211_hw_set(ar->hw, SW_CRYPTO_CONTROL);
| 
|--- a/ath10k-5.4/txrx.c
|+++ b/ath10k-5.4/txrx.c
--------------------------
No file to patch.  Skipping patch.
1 out of 1 hunk ignored
Patch failed!  Please fix ./patches/ath/999-ath10k-Enable-802.11-encap-offload-in-tx-path.patch!
make[3]: *** [Makefile:574: /home/massi/test/OWRT-MASTER-NSS/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/backports-5.8-1/.prepared_05e122dd6c924b0ffc3c4b9cbb1f5bfe_6664517399ebbbc92a37c5bb081b5c53] Error 1
make[3]: Leaving directory '/home/massi/test/OWRT-MASTER-NSS/package/kernel/mac80211'
time: package/kernel/mac80211/compile#1.18#0.56#1.68
make[2]: *** [package/Makefile:114: package/kernel/mac80211/compile] Error 2
make[2]: *** Waiting for unfinished jobs....
arm-openwrt-linux-muslgnueabi-gcc -c -Wno-unused-result -Wsign-compare -DNDEBUG -Os -pipe -g3 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -fmacro-prefix-map=/home/massi/test/OWRT-MASTER-NSS/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/Python-3.8.5=Python-3.8.5 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -Os -pipe -g3 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -fmacro-prefix-map=/home/massi/test/OWRT-MASTER-NSS/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/Python-3.8.5=Python-3.8.5 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DNDEBUG -fno-inline -Os -pipe -g3 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -fmacro-prefix-map=/home/massi/test/OWRT-MASTER-NSS/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/Python-3.8.5=Python-3.8.5 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DNDEBUG -fno-inline -I/home/massi/test/OWRT-MASTER-NSS/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/include -I/home/massi/test/OWRT-MASTER-NSS/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.4.0_musl_eabi/usr/include -I/home/massi/test/OWRT-MASTER-NSS/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.4.0_musl_eabi/include/fortify -I/home/massi/test/OWRT-MASTER-NSS/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.4.0_musl_eabi/include   -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fprofile-generate -I./Include/internal  -I. -I./Include -I/home/massi/test/OWRT-MASTER-NSS/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/include -I/home/massi/test/OWRT-MASTER-NSS/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.4.0_musl_eabi/usr/include -I/home/massi/test/OWRT-MASTER-NSS/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.4.0_musl_eabi/include/fortify -I/home/massi/test/OWRT-MASTER-NSS/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.4.0_musl_eabi/include   -fPIC -DPy_BUILD_CORE -o Objects/dictobject.o Objects/dictobject.c
cc1: note: someone does not honour COPTS correctly, passed 3 times

think i pushed the wrong patch?
@pattagghiu yep didn't push the right patch ahahha

Well, the router crashed again after about 2 days of uptime. I have added a proactive daily reboot to see if that is going to help.
@Ansuel and @ACwifidude .... Any suggestion how to set up remote logging to collect diag data ?

Do you have the new wifi patch? Can you test with today changes?
(the new wifi patch had a bug that cause crash)

@Ansuel, The build I'm using on the router is the one from @ACwifidude build a few days ago.
I'm tied up in the next few days to do a full build, but if someone does the build, I'm willing to load it and test it. Any suggestion how to collect crash data? I might be able to do that too, if it does not take too much fiddling

Have just build the latest code from Ansuel. sorry for the dumb question, but how can i rebase ansuels fork of openwrt:master to the latest open:wrt master? as i see that Felix has just added some mac2011 fixes that i think would fix some issues i'm seeing with my apple devices.

Add the OpenWRT git if you haven’t already:


git remote add upstream https://git.openwrt.org/openwrt/openwrt.git

Then rebase off master:


git fetch upstream && git rebase upstream/master

Then you can clean your directory and build again with the latest and greatest.

IMHO the clear is optional... It's good but you don't need that. The build system is intelligent enough to know what to recompile. The clean process is needed only if you accumulate lots of junk (old package updated) and still the dl dir is not cleared.

1 Like

Old habit. :grin: Good to know that the system is smarter than I thought.

1 Like

Thanks, Much appreciated.
Slowly i'm learning the intricate details of git :slight_smile:

Must say that I haven't seen anything weird yet with Ansuels code. previous build has ran for 2.5 days without stability issues.

@quarky any reason why we used tasklet instead of workqueues? priority?

what about GPL Files for Netgear R7800 Router. Is there any Firmware in this Open Source Files ?

There is a Embeded Board from Compex the WPQ864 any chance to get a Firmware from there?

they all use proprietary wifi driver AND extra old nss firmware... I mean even newer ipq807x netgear router use qsdk8 nss firmware so... all the gpl source are useless

Very good! same speed, less than half the cpu usage.
but i still have the impossibility to receive connections from outside..

Very strange.
For me everything is working properly.