Files
wlan-ap/feeds/wifi-ax/mac80211/patches/pending/203-ath11k-mac.patch
John Crispin e973110de7 ath11k: fix mac assignment on cig wf196
Fixes: WIFI-11976
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-17 10:43:04 +01:00

87 lines
2.6 KiB
Diff

Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/qmi.c
===================================================================
--- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/qmi.c
+++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/qmi.c
@@ -3161,6 +3161,23 @@ out_req:
return ret;
}
+static const struct firmware *fw_macs;
+static int fw_macs_num = 0;
+
+int ath11k_get_custom_macs_num(int num)
+{
+ int ret = fw_macs_num;
+
+ fw_macs_num += num;
+
+ return ret;
+}
+
+const struct firmware* ath11k_get_custom_macs(void)
+{
+ return fw_macs;
+}
+
static int ath11k_qmi_load_bdf_qmi(struct ath11k_base *ab)
{
char filename[ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE];
@@ -3188,6 +3205,8 @@ static int ath11k_qmi_load_bdf_qmi(struc
goto out;
}
+ request_firmware(&fw_macs, "ath11k-macs", ab->dev);
+
/* Load caldata */
if(ab->bus_params.fixed_bdf_addr) {
snprintf(filename, sizeof(filename),
Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/wmi.c
===================================================================
--- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/wmi.c
+++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/wmi.c
@@ -19,6 +19,7 @@
#include "hw.h"
#include "peer.h"
#include "testmode.h"
+#include <linux/firmware.h>
struct wmi_tlv_policy {
size_t min_len;
@@ -7268,11 +7269,15 @@ mem_free:
return ret;
}
+const struct firmware* ath11k_get_custom_macs(void);
+int ath11k_get_custom_macs_num(int num);
+
static int ath11k_wmi_tlv_rdy_parse(struct ath11k_base *ab, u16 tag, u16 len,
const void *ptr, void *data)
{
struct wmi_tlv_rdy_parse *rdy_parse = data;
struct wmi_ready_event fixed_param;
+ const struct firmware *fw_entry;
struct wmi_mac_addr *addr_list;
struct ath11k_pdev *pdev;
u32 num_mac_addr;
@@ -7297,6 +7302,20 @@ static int ath11k_wmi_tlv_rdy_parse(stru
addr_list = (struct wmi_mac_addr *)ptr;
num_mac_addr = rdy_parse->num_extra_mac_addr;
+ fw_entry = ath11k_get_custom_macs();
+ if (fw_entry) {
+ int num = ath11k_get_custom_macs_num(ab->num_radios);
+ printk("applying ath11k-macs\n");
+ if (fw_entry->size >= ((num + ab->num_radios) * 6)) {
+ for (i = 0; i < ab->num_radios; i++) {
+ pdev = &ab->pdevs[i];
+ ether_addr_copy(pdev->mac_addr, &fw_entry->data[(num + i) * 6]);
+ }
+ }
+ ab->pdevs_macaddr_valid = true;
+ return 0;
+ }
+
if (!(ab->num_radios > 1 && num_mac_addr >= ab->num_radios))
break;