From: Josef Schlehofer <pepe.schlehofer@gmail.com>
To: Jeff Johnson <jjohnson@kernel.org>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH ath-next 2/9] wifi: ath6kl: handle the AR6006 WMI layout
Date: Mon, 30 Nov 2026 10:50:35 +0100 [thread overview]
Message-ID: <20261130095042.41330-3-pepe.schlehofer@gmail.com> (raw)
In-Reply-To: <20261130095042.41330-1-pepe.schlehofer@gmail.com>
The AR6006 hw1.1 firmware 5.x uses the WMI layout of Qualcomm's
ath6kl-3.5 driver, not the one of mainline ath6kl. Most command and
event IDs match, but a few payloads differ:
- WMI_CONNECT_CMDID and WMI_AP_CONFIG_COMMIT_CMDID take 52 bytes,
without the trailing nw_subtype.
- WMI_SET_BEACON_INT_CMDID takes 16 bits and WMI_AP_SET_DTIM_CMDID
8 bits.
- The STA part of WMI_CONNECT_EVENTID has a 16-bit nw_type, followed
by tx_scheduler_enabled and aid.
- The AP station part of WMI_CONNECT_EVENTID has phymode before aid.
- The AP per station statistics use a 43-byte record.
Add ATH6KL_HW_VENDOR_WMI and set it for the AR6006. Behind it, send
the shorter payloads and read the vendor variants of the connect event
and the statistics. Other chips are not affected.
WMI_AP_CONN_INACT_CMDID is shorter in this layout as well, but ath6kl
only sends it with the INACTIVITY_TIMEOUT capability, which this
firmware does not get. It is left alone.
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
---
The series ran on OpenWrt 25.12 (backports 6.18.55) on a big-endian
QCA9563 router. Station mode joined a WPA2 network and got a DHCP
lease, and AP mode associated a WPA2 client with unicast data both
ways. The AP statistics are only read through debugfs and did not
run.
drivers/net/wireless/ath/ath6kl/core.h | 2 +
drivers/net/wireless/ath/ath6kl/init.c | 3 +-
drivers/net/wireless/ath/ath6kl/main.c | 23 +++++++-
drivers/net/wireless/ath/ath6kl/wmi.c | 78 +++++++++++++++++++++-----
drivers/net/wireless/ath/ath6kl/wmi.h | 51 +++++++++++++++++
5 files changed, 141 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index 747ff2079..31cd88d83 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -167,6 +167,8 @@ enum ath6kl_hw_flags {
ATH6KL_HW_SDIO_CRC_ERROR_WAR = BIT(3),
/* the target does not use HTC credit flow control (USB) */
ATH6KL_HW_NO_HTC_CREDIT_FLOW = BIT(4),
+ /* firmware 5.x with the WMI layout of ath6kl-3.5 (AR6006) */
+ ATH6KL_HW_VENDOR_WMI = BIT(5),
};
#define ATH6KL_FW_API2_FILE "fw-2.bin"
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 8d1a1aa8a..745c49fcd 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -198,7 +198,8 @@ static const struct ath6kl_hw hw_list[] = {
.refclk_hz = 40000000,
.testscript_addr = 0,
.uarttx_pin = 11,
- .flags = ATH6KL_HW_NO_HTC_CREDIT_FLOW,
+ .flags = ATH6KL_HW_NO_HTC_CREDIT_FLOW |
+ ATH6KL_HW_VENDOR_WMI,
.fw = {
.dir = AR6006_HW_1_1_FW_DIR,
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c
index 9c023d7ce..9dd39d79f 100644
--- a/drivers/net/wireless/ath/ath6kl/main.c
+++ b/drivers/net/wireless/ath/ath6kl/main.c
@@ -827,7 +827,28 @@ void ath6kl_tgt_stats_event(struct ath6kl_vif *vif, u8 *ptr, u32 len)
struct wmi_per_sta_stat *st_ap, *st_p;
u8 ac;
- if (vif->nw_type == AP_NETWORK) {
+ if (vif->nw_type == AP_NETWORK &&
+ (ar->hw.flags & ATH6KL_HW_VENDOR_WMI)) {
+ struct wmi_ap_mode_stat_vendor *pv = (void *)ptr;
+ struct wmi_per_sta_stat_vendor *sv;
+
+ if (len < sizeof(*pv))
+ return;
+
+ for (ac = 0; ac < AP_MAX_NUM_STA; ac++) {
+ st_ap = &ap->sta[ac];
+ sv = &pv->sta[ac];
+
+ ath6kl_add_le32(&st_ap->tx_bytes, sv->tx_bytes);
+ ath6kl_add_le32(&st_ap->tx_pkts, sv->tx_pkts);
+ ath6kl_add_le32(&st_ap->tx_error, sv->tx_error);
+ ath6kl_add_le32(&st_ap->tx_discard, sv->tx_discard);
+ ath6kl_add_le32(&st_ap->rx_bytes, sv->rx_bytes);
+ ath6kl_add_le32(&st_ap->rx_pkts, sv->rx_pkts);
+ ath6kl_add_le32(&st_ap->rx_error, sv->rx_error);
+ ath6kl_add_le32(&st_ap->rx_discard, sv->rx_discard);
+ }
+ } else if (vif->nw_type == AP_NETWORK) {
if (len < sizeof(*p))
return;
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index 2140fddba..941612c68 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -734,6 +734,18 @@ static inline struct sk_buff *ath6kl_wmi_get_new_buf(u32 size)
return skb;
}
+/*
+ * The AR6006 hw1.1 firmware 5.x uses the WMI layout of Qualcomm's
+ * ath6kl-3.5 driver. A few payloads differ from mainline.
+ */
+static bool ath6kl_wmi_vendor_abi(struct wmi *wmi)
+{
+ return wmi->parent_dev->hw.flags & ATH6KL_HW_VENDOR_WMI;
+}
+
+/* the connect command of that layout ends before nw_subtype (52 bytes) */
+#define WMI_VENDOR_CONNECT_CMD_LEN offsetof(struct wmi_connect_cmd, nw_subtype)
+
/* Send a "simple" wmi command -- one with no arguments */
static int ath6kl_wmi_simple_cmd(struct wmi *wmi, u8 if_idx,
enum wmi_cmd_id cmd_id)
@@ -816,14 +828,24 @@ int ath6kl_wmi_ap_set_beacon_intvl_cmd(struct wmi *wmi, u8 if_idx,
{
struct sk_buff *skb;
struct set_beacon_int_cmd *cmd;
+ struct set_beacon_int_cmd_vendor *vcmd;
- skb = ath6kl_wmi_get_new_buf(sizeof(*cmd));
- if (!skb)
- return -ENOMEM;
+ if (ath6kl_wmi_vendor_abi(wmi)) {
+ skb = ath6kl_wmi_get_new_buf(sizeof(*vcmd));
+ if (!skb)
+ return -ENOMEM;
- cmd = (struct set_beacon_int_cmd *) skb->data;
+ vcmd = (struct set_beacon_int_cmd_vendor *)skb->data;
+ vcmd->beacon_intvl = cpu_to_le16(beacon_intvl);
+ } else {
+ skb = ath6kl_wmi_get_new_buf(sizeof(*cmd));
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (struct set_beacon_int_cmd *)skb->data;
+ cmd->beacon_intvl = cpu_to_le32(beacon_intvl);
+ }
- cmd->beacon_intvl = cpu_to_le32(beacon_intvl);
return ath6kl_wmi_cmd_send(wmi, if_idx, skb,
WMI_SET_BEACON_INT_CMDID, NO_SYNC_WMIFLAG);
}
@@ -832,14 +854,24 @@ int ath6kl_wmi_ap_set_dtim_cmd(struct wmi *wmi, u8 if_idx, u32 dtim_period)
{
struct sk_buff *skb;
struct set_dtim_cmd *cmd;
+ struct set_dtim_cmd_vendor *vcmd;
- skb = ath6kl_wmi_get_new_buf(sizeof(*cmd));
- if (!skb)
- return -ENOMEM;
+ if (ath6kl_wmi_vendor_abi(wmi)) {
+ skb = ath6kl_wmi_get_new_buf(sizeof(*vcmd));
+ if (!skb)
+ return -ENOMEM;
- cmd = (struct set_dtim_cmd *) skb->data;
+ vcmd = (struct set_dtim_cmd_vendor *)skb->data;
+ vcmd->dtim_period = dtim_period;
+ } else {
+ skb = ath6kl_wmi_get_new_buf(sizeof(*cmd));
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (struct set_dtim_cmd *)skb->data;
+ cmd->dtim_period = cpu_to_le32(dtim_period);
+ }
- cmd->dtim_period = cpu_to_le32(dtim_period);
return ath6kl_wmi_cmd_send(wmi, if_idx, skb,
WMI_AP_SET_DTIM_CMDID, NO_SYNC_WMIFLAG);
}
@@ -868,6 +900,8 @@ static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len,
{
struct wmi_connect_event *ev;
u8 *pie, *peie;
+ u32 nw_type;
+ u8 aid;
if (len < sizeof(struct wmi_connect_event))
return -EINVAL;
@@ -893,9 +927,14 @@ static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len,
ath6kl_connect_ap_mode_bss(
vif, le16_to_cpu(ev->u.ap_bss.ch));
} else {
+ if (ath6kl_wmi_vendor_abi(wmi))
+ aid = ev->u.ap_sta_vendor.aid;
+ else
+ aid = ev->u.ap_sta.aid;
+
ath6kl_dbg(ATH6KL_DBG_WMI,
"%s: aid %u mac_addr %pM auth=%u keymgmt=%u cipher=%u apsd_info=%u (STA connected)\n",
- __func__, ev->u.ap_sta.aid,
+ __func__, aid,
ev->u.ap_sta.mac_addr,
ev->u.ap_sta.auth,
ev->u.ap_sta.keymgmt,
@@ -903,7 +942,7 @@ static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len,
ev->u.ap_sta.apsd_info);
ath6kl_connect_ap_mode_sta(
- vif, ev->u.ap_sta.aid, ev->u.ap_sta.mac_addr,
+ vif, aid, ev->u.ap_sta.mac_addr,
ev->u.ap_sta.keymgmt,
le16_to_cpu(ev->u.ap_sta.cipher),
ev->u.ap_sta.auth, ev->assoc_req_len,
@@ -915,12 +954,17 @@ static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len,
/* STA/IBSS mode connection event */
+ if (ath6kl_wmi_vendor_abi(wmi))
+ nw_type = le16_to_cpu(ev->u.sta_vendor.nw_type);
+ else
+ nw_type = le32_to_cpu(ev->u.sta.nw_type);
+
ath6kl_dbg(ATH6KL_DBG_WMI,
"wmi event connect freq %d bssid %pM listen_intvl %d beacon_intvl %d type %d\n",
le16_to_cpu(ev->u.sta.ch), ev->u.sta.bssid,
le16_to_cpu(ev->u.sta.listen_intvl),
le16_to_cpu(ev->u.sta.beacon_intvl),
- le32_to_cpu(ev->u.sta.nw_type));
+ nw_type);
/* Start of assoc rsp IEs */
pie = ev->assoc_info + ev->beacon_ie_len +
@@ -953,7 +997,7 @@ static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len,
ev->u.sta.bssid,
le16_to_cpu(ev->u.sta.listen_intvl),
le16_to_cpu(ev->u.sta.beacon_intvl),
- le32_to_cpu(ev->u.sta.nw_type),
+ nw_type,
ev->beacon_ie_len, ev->assoc_req_len,
ev->assoc_resp_len, ev->assoc_info);
@@ -1918,6 +1962,9 @@ int ath6kl_wmi_connect_cmd(struct wmi *wmi, u8 if_idx,
if (bssid != NULL)
memcpy(cc->bssid, bssid, ETH_ALEN);
+ if (ath6kl_wmi_vendor_abi(wmi))
+ skb_trim(skb, WMI_VENDOR_CONNECT_CMD_LEN);
+
ret = ath6kl_wmi_cmd_send(wmi, if_idx, skb, WMI_CONNECT_CMDID,
NO_SYNC_WMIFLAG);
@@ -3419,6 +3466,9 @@ int ath6kl_wmi_ap_profile_commit(struct wmi *wmip, u8 if_idx,
cm = (struct wmi_connect_cmd *) skb->data;
memcpy(cm, p, sizeof(*cm));
+ if (ath6kl_wmi_vendor_abi(wmip))
+ skb_trim(skb, WMI_VENDOR_CONNECT_CMD_LEN);
+
res = ath6kl_wmi_cmd_send(wmip, if_idx, skb, WMI_AP_CONFIG_COMMIT_CMDID,
NO_SYNC_WMIFLAG);
ath6kl_dbg(ATH6KL_DBG_WMI,
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h
index 89ce2abbb..f1da394dd 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.h
+++ b/drivers/net/wireless/ath/ath6kl/wmi.h
@@ -1542,6 +1542,26 @@ struct wmi_connect_event {
u8 bssid[ETH_ALEN];
u8 unused[8];
} ap_bss;
+ /* AR6006 firmware 5.x, the WMI layout of ath6kl-3.5 */
+ struct {
+ __le16 ch;
+ u8 bssid[ETH_ALEN];
+ __le16 listen_intvl;
+ __le16 beacon_intvl;
+ __le16 nw_type;
+ u8 tx_scheduler_enabled;
+ u8 aid;
+ } sta_vendor;
+ struct {
+ u8 phymode;
+ u8 aid;
+ u8 mac_addr[ETH_ALEN];
+ u8 auth;
+ u8 keymgmt;
+ __le16 cipher;
+ u8 apsd_info;
+ u8 unused[3];
+ } ap_sta_vendor;
} u;
u8 beacon_ie_len;
u8 assoc_req_len;
@@ -1657,6 +1677,15 @@ struct set_dtim_cmd {
__le32 dtim_period;
} __packed;
+/* AR6006 firmware 5.x uses 16 and 8 bits for these */
+struct set_beacon_int_cmd_vendor {
+ __le16 beacon_intvl;
+} __packed;
+
+struct set_dtim_cmd_vendor {
+ u8 dtim_period;
+} __packed;
+
/* BSS INFO HDR version 2.0 */
struct wmi_bss_info_hdr2 {
__le16 ch; /* frequency in MHz */
@@ -2334,6 +2363,28 @@ struct wmi_ap_mode_stat {
struct wmi_per_sta_stat sta[AP_MAX_NUM_STA + 1];
} __packed;
+/* per station statistics of AR6006 firmware 5.x (ath6kl-3.5 layout) */
+struct wmi_per_sta_stat_vendor {
+ __le32 tx_bytes;
+ __le32 tx_pkts;
+ __le32 tx_error;
+ __le32 tx_discard;
+ __le32 rx_bytes;
+ __le32 rx_pkts;
+ __le32 rx_error;
+ __le32 rx_discard;
+ u8 aid;
+ u8 tx_ucast_rate;
+ __le16 last_txrx_time;
+ u8 mac[ETH_ALEN];
+ s8 rssi;
+} __packed;
+
+struct wmi_ap_mode_stat_vendor {
+ __le32 action;
+ struct wmi_per_sta_stat_vendor sta[AP_MAX_NUM_STA + 1];
+} __packed;
+
/* End of AP mode definitions */
struct wmi_remain_on_chnl_cmd {
--
2.54.0 (Apple Git-157)
next prev parent reply other threads:[~2026-11-30 9:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 9:50 [PATCH ath-next 0/9] wifi: ath6kl: add AR6006 hw1.1 (QCA6006) support Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 1/9] wifi: ath6kl: add AR6006 hw1.1 support Josef Schlehofer
2026-11-30 9:50 ` Josef Schlehofer [this message]
2026-11-30 9:50 ` [PATCH ath-next 3/9] wifi: ath6kl: ignore AR6006 regulatory domain events Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 4/9] wifi: ath6kl: use per-device band and channel copies Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 5/9] dt-bindings: net: wireless: add QCA6006 binding Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 6/9] wifi: ath6kl: take the AR6006 MAC address from DT Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 7/9] wifi: ath6kl: handle unsupported connection frequencies Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 8/9] wifi: ath6kl: honour ieee80211-freq-limit from DT Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 9/9] wifi: ath6kl: add QCA6006 USB ID Josef Schlehofer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130095042.41330-3-pepe.schlehofer@gmail.com \
--to=pepe.schlehofer@gmail.com \
--cc=jjohnson@kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox