Dynalink DL-WRX36 Askey RT5010W IPQ8072A technical discussion

Alright, what's the process usually in a case where you intend to upstream the work of others? I'm guessing you'd just amend the requested changes in the commits, retaining the original author and message, and then submit that after rebase?

Yes, you preserve the authorsip and add your signed off.

You can modify commit message and anything requored.

@robimarko will MBSSID and EMA be enabled by default in tomorrow's snapshot when having multiple BSSIDs on one radio? Seems like it doesn't need additional configuration at least

And do you know what difference it makes?

Nope, hostapd config needs updates, there is a pending patch on openwrt mailing list.

https://lists.openwrt.org/pipermail/openwrt-devel/2023-May/041087.html

I see. Looks like it'll be trial and error then to find out if clients support handling multiple BSSIDs in a single beacon frame.

Rebased and amended the patch but it will just crash the firmware after a few seconds, though stations are able to connect before that.

I only tried with the patch so can't tell if it's definitely it or 6.1 but I assume the former.

From 602272ef6049c81ac2a2bde8fb1095c06ccd74e7 Mon Sep 17 00:00:00 2001
From: Seevalamuthu Mariappan <quic_seevalam@quicinc.com>
Date: Mon, 10 Jan 2022 09:11:30 +0530
Subject: [PATCH] ath11k: Add support for dynamic vlan

Advertise AP-VLAN interface type for vlan support in driver.
Metadata information in dp_tx is added to notify firmware
that multicast/broadcast packets are encrypted in software.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01073-QCAHKSWPL_SILICONZ-1

Signed-off-by: Seevalamuthu Mariappan <quic_seevalam@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/core.c  |  8 +++
 drivers/net/wireless/ath/ath11k/dp_tx.c | 77 ++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath11k/dp_tx.h | 14 +++++
 drivers/net/wireless/ath/ath11k/hw.h    |  1 +
 drivers/net/wireless/ath/ath11k/mac.c   |  5 ++
 5 files changed, 103 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 8a82a4ed0a..073bb5e682 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -92,6 +92,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
 		.num_vdevs = 16 + 1,
 		.num_peers = 512,
 		.supports_suspend = false,
+		.supports_ap_vlan = true,
 		.hal_desc_sz = sizeof(struct hal_rx_desc_ipq8074),
 		.supports_regdb = false,
 		.fix_l1ss = true,
@@ -173,6 +174,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
 		.num_vdevs = 16 + 1,
 		.num_peers = 512,
 		.supports_suspend = false,
+		.supports_ap_vlan = true,
 		.hal_desc_sz = sizeof(struct hal_rx_desc_ipq8074),
 		.supports_regdb = false,
 		.fix_l1ss = true,
@@ -254,6 +256,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
 		.num_vdevs = 16 + 1,
 		.num_peers = 512,
 		.supports_suspend = true,
+		.supports_ap_vlan = true,
 		.hal_desc_sz = sizeof(struct hal_rx_desc_ipq8074),
 		.supports_regdb = false,
 		.fix_l1ss = true,
@@ -338,6 +341,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
 		.num_vdevs = 8,
 		.num_peers = 128,
 		.supports_suspend = false,
+		.supports_ap_vlan = true,
 		.hal_desc_sz = sizeof(struct hal_rx_desc_qcn9074),
 		.supports_regdb = false,
 		.fix_l1ss = true,
@@ -419,6 +423,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
 		.num_vdevs = 16 + 1,
 		.num_peers = 512,
 		.supports_suspend = true,
+		.supports_ap_vlan = true,
 		.hal_desc_sz = sizeof(struct hal_rx_desc_wcn6855),
 		.supports_regdb = true,
 		.fix_l1ss = false,
@@ -501,6 +506,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
 		.num_vdevs = 16 + 1,
 		.num_peers = 512,
 		.supports_suspend = true,
+		.supports_ap_vlan = true,
 		.hal_desc_sz = sizeof(struct hal_rx_desc_wcn6855),
 		.supports_regdb = true,
 		.fix_l1ss = false,
@@ -584,6 +590,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
 		.num_vdevs = 16 + 1,
 		.num_peers = 512,
 		.supports_suspend = false,
+		.supports_ap_vlan = true,
 		.hal_desc_sz = sizeof(struct hal_rx_desc_qcn9074),
 		.supports_regdb = true,
 		.fix_l1ss = false,
@@ -665,6 +672,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
 		.supports_regdb = false,
 		.idle_ps = false,
 		.supports_suspend = false,
+		.supports_ap_vlan = true,
 		.hal_params = &ath11k_hw_hal_params_ipq8074,
 		.single_pdev_only = false,
 		.cold_boot_calib = true,
diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless/ath/ath11k/dp_tx.c
index 08a28464eb..47e2a41c61 100644
--- a/drivers/net/wireless/ath/ath11k/dp_tx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c
@@ -79,6 +79,47 @@ enum hal_encrypt_type ath11k_dp_tx_get_encrypt_type(u32 cipher)
 	}
 }
 
+#define HTT_META_DATA_ALIGNMENT    0x8
+
+static int ath11k_dp_metadata_align_skb(struct sk_buff *skb, u8 align_len)
+{
+	int ret;
+
+	ret = skb_cow_head(skb, align_len);
+	if (ret)
+		return -ENOMEM;
+
+	skb_push(skb, align_len);
+	memset(skb->data, 0, align_len);
+	return 0;
+}
+
+static int ath11k_dp_prepare_htt_metadata(struct sk_buff *skb,
+					  u8 *htt_metadata_size)
+{
+	u8 htt_desc_size;
+	/* Size rounded of multiple of 8 bytes */
+	u8 htt_desc_size_aligned;
+	struct htt_tx_msdu_desc_ext *desc_ext;
+	int ret;
+
+	htt_desc_size = sizeof(*desc_ext);
+	htt_desc_size_aligned = ALIGN(htt_desc_size, HTT_META_DATA_ALIGNMENT);
+
+	ret = ath11k_dp_metadata_align_skb(skb, htt_desc_size_aligned);
+	if (unlikely(ret))
+		return ret;
+
+	desc_ext = (struct htt_tx_msdu_desc_ext *)skb->data;
+	desc_ext->info0 =
+		__cpu_to_le32(FIELD_PREP(HTT_TX_MSDU_DESC_INFO0_VALID_ENCRYPT_TYPE, 1) |
+			      FIELD_PREP(HTT_TX_MSDU_DESC_INFO0_ENCRYPT_TYPE, 0) |
+			      FIELD_PREP(HTT_TX_MSDU_DESC_INFO0_HOST_TX_DESC_POOL, 1));
+	*htt_metadata_size = htt_desc_size_aligned;
+
+	return 0;
+}
+
 int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
 		 struct ath11k_sta *arsta, struct sk_buff *skb)
 {
@@ -97,6 +138,7 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
 	u32 ring_selector = 0;
 	u8 ring_map = 0;
 	bool tcl_ring_retry;
+	u8 align_pad, htt_meta_size = 0;
 
 	if (unlikely(test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags)))
 		return -ESHUTDOWN;
@@ -208,15 +250,42 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
 		goto fail_remove_idr;
 	}
 
+	/* Add metadata for sw encrypted vlan group traffic */
+	if (!test_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ar->ab->dev_flags) &&
+	    !(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) &&
+	    !info->control.hw_key &&
+	    ieee80211_has_protected(hdr->frame_control)) {
+		/* HW requirement is that metadata should always point to a
+		 * 8-byte aligned address. So we add alignment pad to start of
+		 * buffer. HTT Metadata should be ensured to be multiple of 8-bytes
+		 *  to get 8-byte aligned start address along with align_pad added
+		 */
+		align_pad = ((unsigned long)skb->data) & (HTT_META_DATA_ALIGNMENT - 1);
+		ret = ath11k_dp_metadata_align_skb(skb, align_pad);
+		if (unlikely(ret))
+			goto fail_remove_idr;
+
+		ti.pkt_offset += align_pad;
+		ret = ath11k_dp_prepare_htt_metadata(skb, &htt_meta_size);
+		if (unlikely(ret))
+			goto fail_pull_skb;
+
+		ti.pkt_offset += htt_meta_size;
+		ti.meta_data_flags |= HTT_TCL_META_DATA_VALID_HTT;
+		ti.flags0 |= FIELD_PREP(HAL_TCL_DATA_CMD_INFO1_TO_FW, 1);
+		ti.encap_type = HAL_TCL_ENCAP_TYPE_RAW;
+		ti.encrypt_type = HAL_ENCRYPT_TYPE_OPEN;
+	}
+
 	ti.paddr = dma_map_single(ab->dev, skb->data, skb->len, DMA_TO_DEVICE);
 	if (unlikely(dma_mapping_error(ab->dev, ti.paddr))) {
 		atomic_inc(&ab->soc_stats.tx_err.misc_fail);
 		ath11k_warn(ab, "failed to DMA map data Tx buffer\n");
 		ret = -ENOMEM;
-		goto fail_remove_idr;
+		goto fail_pull_skb;
 	}
 
-	ti.data_len = skb->len;
+	ti.data_len = skb->len - ti.pkt_offset;
 	skb_cb->paddr = ti.paddr;
 	skb_cb->vif = arvif->vif;
 	skb_cb->ar = ar;
@@ -271,6 +340,10 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
 fail_unmap_dma:
 	dma_unmap_single(ab->dev, ti.paddr, ti.data_len, DMA_TO_DEVICE);
 
+fail_pull_skb:
+	if (ti.pkt_offset)
+		skb_pull(skb, ti.pkt_offset);
+
 fail_remove_idr:
 	spin_lock_bh(&tx_ring->tx_idr_lock);
 	idr_remove(&tx_ring->txbuf_idr,
diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.h b/drivers/net/wireless/ath/ath11k/dp_tx.h
index 68a21ea9b9..311d6936d4 100644
--- a/drivers/net/wireless/ath/ath11k/dp_tx.h
+++ b/drivers/net/wireless/ath/ath11k/dp_tx.h
@@ -16,6 +16,20 @@ struct ath11k_dp_htt_wbm_tx_status {
 	u16 peer_id;
 };
 
+#define HTT_TX_MSDU_DESC_INFO0_VALID_ENCRYPT_TYPE	BIT(8)
+#define HTT_TX_MSDU_DESC_INFO0_ENCRYPT_TYPE		GENMASK(16, 15)
+#define HTT_TX_MSDU_DESC_INFO0_HOST_TX_DESC_POOL	BIT(31)
+
+struct htt_tx_msdu_desc_ext {
+	__le32 info0;
+	__le32 info1;
+	__le32 info2;
+	__le32 info3;
+	__le32 info4;
+	__le32 info5;
+	__le32 info6;
+} __packed;
+
 void ath11k_dp_tx_update_txcompl(struct ath11k *ar, struct hal_tx_status *ts);
 int ath11k_dp_tx_htt_h2t_ver_req_msg(struct ath11k_base *ab);
 int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/ath/ath11k/hw.h
index f5533630a7..31d434e449 100644
--- a/drivers/net/wireless/ath/ath11k/hw.h
+++ b/drivers/net/wireless/ath/ath11k/hw.h
@@ -193,6 +193,7 @@ struct ath11k_hw_params {
 	u32 num_vdevs;
 	u32 num_peers;
 	bool supports_suspend;
+	bool supports_ap_vlan;
 	u32 hal_desc_sz;
 	bool supports_regdb;
 	bool fix_l1ss;
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index a31b8e8968..7d8316467e 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -9601,6 +9601,11 @@ static int __ath11k_mac_register(struct ath11k *ar)
 		 */
 		ar->hw->wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MONITOR);
 
+	if (ab->hw_params.supports_ap_vlan) {
+		ar->hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
+		ar->hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
+	}
+
 	/* Apply the regd received during initialization */
 	ret = ath11k_regd_update(ar);
 	if (ret) {
-- 
2.30.2

Maybe it's actually 6.1 and not the vlan patch. This looks just like what I saw also on the AX3600

Please try the previous firmware version:

@robimarko: I'm also seeing frequent crashes with the latest 2.9.0.1 version. The previous version seems stable so far.

can't attend sysupgade, latest snaphot with new 6.1 kernel and new wifi firmware. i will give it some time and try again

Collected errors:
 * pkg_hash_check_unresolved: cannot find dependency libubox20230523 for block-mount
 * pkg_hash_check_unresolved: cannot find dependency libblobmsg-json20230523 for block-mount
 * pkg_hash_fetch_best_installation_candidate: Packages for block-mount found, but incompatible with the architectures configured
 * opkg_install_cmd: Cannot install package block-mount.
 * pkg_hash_check_unresolved: cannot find dependency libubox20230523 for mtd
 * pkg_hash_fetch_best_installation_candidate: Packages for mtd found, but incompatible with the architectures configured
 * opkg_install_cmd: Cannot install package mtd.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for mtd:
 * 	libubox20230523
 * opkg_install_cmd: Cannot install package mtd.
make[2]: *** [Makefile:186: package_install] Error 255
make[1]: *** [Makefile:151: _call_manifest] Error 2
make: *** [Makefile:271: manifest] Error 2

libubox was upgraded yesterday. Due to the 2-phased build strategy it may take 1-2 days before the buildbot again has a coherent package set (to be used by auc/attendedsysupgrade).

If you compile from sources, you can compile it right now.

3 Likes

So 2.9.0.1-01385 was stable?

If so I will post a revert

It is a stable, also with the vlan patch

Great, I made a PR to revert to previous FW version.

1 Like

anyone still having the issue of the need to restore from a backup or redo the setup after a sysupgrade ? strangely ... after a sysupgrade the system comes back but it fails to load the firmware ... once I reboot the router is back to 192.168.1.1 and loading the firmware correctly ... restoring a back all is fine as before the sysupgrade

none of this happens on other devices that I have ... the qnap, ax9000 & ax36000

No idea as I have sysupgraded mine with the preserved config probably 50+ times so far

1 Like

would you mind to share your output of fw_printenv ? it feels to me has to be something here ...thx in advance

I am just using the default one:

root@Dynalink:~# fw_printenv 
baudrate=115200
bootargs=console=ttyMSM0,115200n8
bootdelay=2
eth1addr=a4:97:33:df:ae:af
eth2addr=a4:97:33:df:ae:af
eth3addr=a4:97:33:df:ae:af
eth4addr=a4:97:33:df:ae:af
ethact=eth0
ethaddr=a4:97:33:df:ae:ae
fdt_high=0x4A400000
fdtcontroladdr=4a971480
flash_type=2
ipaddr=192.168.10.10
machid=8850105
mtdids=nand0=nand0
mtdparts=mtdparts=nand0:0x6100000@0x1000000(fs)
netmask=255.255.255.0
serverip=192.168.10.1
soc_version_major=2
soc_version_minor=0
stderr=serial@78B3000
stdin=serial@78B3000
stdout=serial@78B3000
bootcmd=setenv bootargs console=ttyMSM0,115200n8 ubi.mtd=rootfs root=mtd:rootfs rootfstype=squashfs rootwait; ubi part fs; ubi read 0x44000000 kernel; bootm 0x44000000#config@rt5010w-d350-rev0
1 Like

do you stop wpad service before flashing?

Any idea on how to avoid doing all the process again after every firmware flash?

In both wrx36 and ax3600, on the latest snapshot OpenWrt SNAPSHOT r23298-598e058080 / LuCI Master git-23.118.79121-6fb185f, I noticed this on the kernel log that I don't remember seeing before:

[    1.499877] i2c_dev: i2c /dev entries driver
[    1.501325] thermal_sys: Failed to find 'trips' node
[    1.503292] thermal_sys: Failed to find trip points for thermal-sensor id=4
[    1.508245] thermal_sys: Failed to find 'trips' node
[    1.514867] thermal_sys: Failed to find trip points for thermal-sensor id=5
[    1.520138] thermal_sys: Failed to find 'trips' node
[    1.526756] thermal_sys: Failed to find trip points for thermal-sensor id=6
[    1.532033] thermal_sys: Failed to find 'trips' node
[    1.538650] thermal_sys: Failed to find trip points for thermal-sensor id=7
[    1.543937] thermal_sys: Failed to find 'trips' node
[    1.550530] thermal_sys: Failed to find trip points for thermal-sensor id=8
[    1.557130] thermal_sys: Failed to find 'trips' node
[    1.562423] thermal_sys: Failed to find trip points for thermal-sensor id=14
[    1.567750] thermal_sys: Failed to find 'trips' node
[    1.574673] thermal_sys: Failed to find trip points for thermal-sensor id=15
[    1.581636] sdhci: Secure Digital Host Controller Interface driver
1 Like