wlan-ap-Telecominfraproject/feeds/ipq95xx/mac80211/patches/qca/453-ath11k-compilation-error-fix.patch
John Crispin 144c5d00f4 ipq95xx/mac80211: update to ATH12.3-CS
Signed-off-by: John Crispin <john@phrozen.org>
2024-02-28 18:56:21 +01:00

408 lines
13 KiB
Diff

From 67adadf481d7826f450e5fcd2ff33b91899b4059 Mon Sep 17 00:00:00 2001
From: Bhagavathi Perumal S <quic_bperumal@quicinc.com>
Date: Sat, 17 Jun 2023 17:39:03 +0530
Subject: [PATCH] ath11k compilation error fix
This changes has ath11k integration with OpenWRT-ginger branch, Also
fixed the various compilation issues due to kernel upgradation from 5.x to 6.x,
some API names are changed and some unsupported API are disable in the kernel 6.x
this patch support for both the kernel versions
Signed-off-by: Bhagavathi Perumal S <quic_bperumal@quicinc.com>
---
drivers/net/wireless/ath/ath11k/ahb.c | 19 +++++++++++++++++++
drivers/net/wireless/ath/ath11k/cfr.c | 2 +-
drivers/net/wireless/ath/ath11k/core.c | 4 ++--
drivers/net/wireless/ath/ath11k/core.h | 2 ++
drivers/net/wireless/ath/ath11k/coredump.c | 2 ++
drivers/net/wireless/ath/ath11k/dp_tx.c | 2 +-
drivers/net/wireless/ath/ath11k/mac.c | 10 +++++-----
drivers/net/wireless/ath/ath11k/mhi.c | 16 ++++++++++++++++
drivers/net/wireless/ath/ath11k/pcic.c | 19 ++++++++++++++++++-
drivers/net/wireless/ath/ath11k/qmi.c | 2 ++
drivers/net/wireless/ath/ath11k/qmi.h | 1 +
drivers/net/wireless/ath/ath11k/wmi.c | 4 ++--
drivers/net/wireless/ath/ath11k/wmi.h | 6 +++++-
drivers/net/wireless/ath/ath12k/ahb.h | 5 +++++
14 files changed, 81 insertions(+), 13 deletions(-)
--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -579,8 +579,13 @@
irq_grp->ab = ab;
irq_grp->grp_id = i;
init_dummy_netdev(&irq_grp->napi_ndev);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
netif_napi_add(&irq_grp->napi_ndev, &irq_grp->napi,
ath11k_ahb_ext_grp_napi_poll, NAPI_POLL_WEIGHT);
+#else
+ netif_napi_add_weight(&irq_grp->napi_ndev, &irq_grp->napi,
+ ath11k_ahb_ext_grp_napi_poll, NAPI_POLL_WEIGHT);
+#endif
for (j = 0; j < ATH11K_EXT_IRQ_NUM_MAX; j++) {
if (!nss_offload && ab->hw_params.ring_mask->tx[i] & BIT(j)) {
@@ -733,9 +738,13 @@
#if LINUX_VERSION_IS_LESS(5, 4, 0)
qcom_register_ssr_notifier(&ab->qmi.ssr_nb);
#else
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab);
rproc_register_subsys_notifier(ab_ahb->tgt_rproc->name,
&ab->qmi.ssr_nb, &ab->qmi.ssr_nb);
+#else
+ ab->qmi.ssr_handle = qcom_register_ssr_notifier("q6wcss", &ab->qmi.ssr_nb);
+#endif
#endif
}
@@ -744,10 +753,15 @@
#if LINUX_VERSION_IS_LESS(5, 4, 0)
qcom_unregister_ssr_notifier(&ab->qmi.ssr_nb);
#else
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab);
rproc_unregister_subsys_notifier(ab_ahb->tgt_rproc->name,
&ab->qmi.ssr_nb,
&ab->qmi.ssr_nb);
+#else
+ if (ab->qmi.ssr_handle)
+ qcom_unregister_ssr_notifier(ab->qmi.ssr_handle, &ab->qmi.ssr_nb);
+#endif
#endif
}
#endif
@@ -1224,7 +1238,12 @@
* and the space is not contiguous, hence remapping the CE registers
* to a new space for accessing them.
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
ab->mem_ce = ioremap_nocache(HAL_IPQ5018_CE_WFSS_REG_BASE, HAL_IPQ5018_CE_SIZE);
+#else
+ ab->mem_ce = ioremap(HAL_IPQ5018_CE_WFSS_REG_BASE, HAL_IPQ5018_CE_SIZE);
+#endif
+
if (IS_ERR(ab->mem_ce)) {
dev_err(&pdev->dev, "ce ioremap error\n");
return -ENOMEM;
--- a/drivers/net/wireless/ath/ath11k/cfr.c
+++ b/drivers/net/wireless/ath/ath11k/cfr.c
@@ -90,7 +90,7 @@
case 3: /* DUP160/VHT160 */
return TONES_IN_160MHZ;
}
-
+ fallthrough;
case ATH11K_CFR_PREAMBLE_TYPE_HT:
switch (bw) {
case 0:
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -1901,13 +1901,13 @@
}
#if LINUX_VERSION_IS_GEQ(5,4,0)
- if (ath11k_collect_dump && event == SUBSYS_AFTER_POWERUP) {
+ if (ath11k_collect_dump && event == ATH11K_SSR_POWERUP) {
ath11k_collect_dump = false;
wake_up(&ath11k_ssr_dump_wq);
return 0;
}
- if (event != SUBSYS_PREPARE_FOR_FATAL_SHUTDOWN)
+ if (event != ATH11K_SSR_PREPARE_SHUTDOWN)
return 0;
ath11k_collect_dump = true;
#else
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -97,6 +97,14 @@
#define HAL_REO_DEST_RING_CTRL_HASH_RING_SHIFT 8
#define HAL_IPQ5018_REO_DEST_RING_CTRL_HASH_RING_SHIFT 0
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
+#define ATH11K_SSR_POWERUP SUBSYS_AFTER_POWERUP
+#define ATH11K_SSR_PREPARE_SHUTDOWN SUBSYS_PREPARE_FOR_FATAL_SHUTDOWN
+#else
+#define ATH11K_SSR_POWERUP QCOM_SSR_AFTER_POWERUP
+#define ATH11K_SSR_PREPARE_SHUTDOWN QCOM_SSR_NOTIFY_CRASH
+#endif
+
enum ath11k_supported_bw {
ATH11K_BW_20 = 0,
ATH11K_BW_40 = 1,
@@ -1639,8 +1647,10 @@
void ath11k_core_dump_bp_stats(struct ath11k_base *ab);
void ath11k_coredump_qdss_dump(struct ath11k_base *ab,
struct ath11k_qmi_event_qdss_trace_save_data *event_data);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
int ath11k_coredump_mhi_update_bhie_table(struct ath11k_base *ab, void *va,
phys_addr_t pa, size_t size);
+#endif
const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
const char *filename);
void ath11k_core_wait_dump_collect(struct ath11k_base *ab);
--- a/drivers/net/wireless/ath/ath11k/coredump.c
+++ b/drivers/net/wireless/ath/ath11k/coredump.c
@@ -374,6 +374,7 @@
vfree(dump);
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
int ath11k_coredump_mhi_update_bhie_table(struct ath11k_base *ab, void *va,
phys_addr_t pa, size_t size)
{
@@ -392,3 +393,4 @@
return ret;
}
+#endif
--- a/drivers/net/wireless/ath/ath11k/dp_tx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c
@@ -1022,7 +1022,7 @@
now = ieee80211_txdelay_get_time();
bin = txdelay_ms_to_bin(txdelay_time_to_ms(now - enqueue_time));
- if (!ar->debug.tx_delay_stats) {
+ if (!ar->debug.tx_delay_stats[tid]) {
ath11k_warn(ar->ab, "tx delay stats invalid\n");
return;
}
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -2066,7 +2066,7 @@
}
static bool
-ath11k_peer_assoc_h_ht_masked(const u8 ht_mcs_mask[IEEE80211_HT_MCS_MASK_LEN])
+ath11k_peer_assoc_h_ht_masked(const u8 ht_mcs_mask[])
{
int nss;
@@ -2473,7 +2473,7 @@
}
static bool
-ath11k_peer_assoc_h_he_masked(const u16 he_mcs_mask[NL80211_HE_NSS_MAX])
+ath11k_peer_assoc_h_he_masked(const u16 *he_mcs_mask[])
{
int nss;
@@ -3112,8 +3112,8 @@
vif_mask = &arvif->bitrate_mask;
ath11k_warn(ar->ab, "arvif bit rate masked: he %d vht %d ht %d",
ath11k_peer_assoc_h_he_masked(vif_mask->control[band].he_mcs),
- ath11k_peer_assoc_h_he_masked(vif_mask->control[band].vht_mcs),
- ath11k_peer_assoc_h_he_masked(vif_mask->control[band].ht_mcs));
+ ath11k_peer_assoc_h_vht_masked(vif_mask->control[band].vht_mcs),
+ ath11k_peer_assoc_h_ht_masked(vif_mask->control[band].ht_mcs));
WARN_ON_ONCE(1);
return true;
}
@@ -4274,7 +4274,7 @@
arg->chan_list.num_chan = req->n_channels;
for (i = 0; i < arg->chan_list.num_chan; i++) {
- if (req->channels)
+ if (req->channels[i])
chan[i].freq = req->channels[i]->center_freq;
if (req->chandef)
chan[i].phymode = ath11k_phymodes[band][width];
--- a/drivers/net/wireless/ath/ath11k/mhi.c
+++ b/drivers/net/wireless/ath/ath11k/mhi.c
@@ -38,7 +38,9 @@
.offload_channel = false,
.doorbell_mode_switch = false,
.auto_queue = false,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
.auto_start = false,
+#endif
},
{
.num = 1,
@@ -53,7 +55,9 @@
.offload_channel = false,
.doorbell_mode_switch = false,
.auto_queue = false,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
.auto_start = false,
+#endif
},
{
.num = 20,
@@ -68,7 +72,9 @@
.offload_channel = false,
.doorbell_mode_switch = false,
.auto_queue = false,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
.auto_start = true,
+#endif
},
{
.num = 21,
@@ -83,7 +89,9 @@
.offload_channel = false,
.doorbell_mode_switch = false,
.auto_queue = true,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
.auto_start = true,
+#endif
},
};
@@ -135,7 +143,9 @@
.offload_channel = false,
.doorbell_mode_switch = false,
.auto_queue = false,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
.auto_start = false,
+#endif
},
{
.num = 1,
@@ -150,7 +160,9 @@
.offload_channel = false,
.doorbell_mode_switch = false,
.auto_queue = false,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
.auto_start = false,
+#endif
},
{
.num = 20,
@@ -165,7 +177,9 @@
.offload_channel = false,
.doorbell_mode_switch = false,
.auto_queue = false,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
.auto_start = true,
+#endif
},
{
.num = 21,
@@ -180,7 +194,9 @@
.offload_channel = false,
.doorbell_mode_switch = false,
.auto_queue = true,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
.auto_start = true,
+#endif
},
};
--- a/drivers/net/wireless/ath/ath11k/pcic.c
+++ b/drivers/net/wireless/ath/ath11k/pcic.c
@@ -531,8 +531,13 @@
irq_grp->ab = ab;
irq_grp->grp_id = i;
init_dummy_netdev(&irq_grp->napi_ndev);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
netif_napi_add(&irq_grp->napi_ndev, &irq_grp->napi,
ath11k_pcic_ext_grp_napi_poll, NAPI_POLL_WEIGHT);
+#else
+ netif_napi_add_weight(&irq_grp->napi_ndev, &irq_grp->napi,
+ ath11k_pcic_ext_grp_napi_poll, NAPI_POLL_WEIGHT);
+#endif
/* tcl, reo, rx_err, wbm release, rxdma rings are offloaded to nss. */
if (ab->nss.enabled &&
@@ -797,8 +802,13 @@
irq_grp->ab = ab;
irq_grp->grp_id = i;
init_dummy_netdev(&irq_grp->napi_ndev);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
netif_napi_add(&irq_grp->napi_ndev, &irq_grp->napi,
ath11k_pcic_ext_grp_napi_poll, NAPI_POLL_WEIGHT);
+#else
+ netif_napi_add_weight(&irq_grp->napi_ndev, &irq_grp->napi,
+ ath11k_pcic_ext_grp_napi_poll, NAPI_POLL_WEIGHT);
+#endif
if (ab->hw_params.ring_mask->tx[i] ||
ab->hw_params.ring_mask->rx[i] ||
@@ -894,8 +904,11 @@
ath11k_warn(ab, "failed to alloc irqs %d ab %pM\n", ret, ab);
return ret;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
for_each_msi_entry(msi_desc, &pdev->dev) {
+#else
+ msi_for_each_desc(msi_desc, &pdev->dev, MSI_DESC_ALL) {
+#endif
if (!ce_done && i == ab->hw_params.ce_count) {
i = 0;
ce_done = true;
@@ -926,7 +939,11 @@
ab->pci.msi.ep_base_data = msi_desc->msg.data;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
for_each_msi_entry(msi_desc, &pdev->dev) {
+#else
+ msi_for_each_desc(msi_desc, &pdev->dev, MSI_DESC_ALL) {
+#endif
u32 user_base_data = 0, base_vector = 0;
int vector, num_vectors = 0;
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -3037,7 +3037,7 @@
ab->qmi.target_mem[i].size);
ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size;
ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type;
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
ret = ath11k_coredump_mhi_update_bhie_table(ab,
ab->qmi.target_mem[idx].vaddr,
ab->qmi.target_mem[idx].paddr,
@@ -3045,7 +3045,7 @@
if (ret < 0)
ath11k_warn(ab, "qmi fail to update BHI table %d\n",
ret);
-
+#endif
idx++;
break;
default:
--- a/drivers/net/wireless/ath/ath11k/qmi.h
+++ b/drivers/net/wireless/ath/ath11k/qmi.h
@@ -201,6 +201,7 @@
struct list_head event_list;
spinlock_t event_lock; /* spinlock for qmi event list */
struct notifier_block ssr_nb;
+ void *ssr_handle;
struct ath11k_qmi_ce_cfg ce_cfg;
struct target_mem_chunk target_mem[ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01];
u32 mem_seg_count;
--- a/drivers/net/wireless/ath/ath11k/wmi.h
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
@@ -53,7 +53,11 @@
#define WMI_TLV_LEN GENMASK(15, 0)
#define WMI_TLV_TAG GENMASK(31, 16)
-#define TLV_HDR_SIZE FIELD_SIZEOF(struct wmi_tlv, header)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
+#define TLV_HDR_SIZE FIELD_SIZEOF(struct wmi_tlv, header)
+#else
+#define TLV_HDR_SIZE sizeof_field(struct wmi_tlv, header)
+#endif
#define WMI_CMD_HDR_CMD_ID GENMASK(23, 0)
#define WMI_MAX_MEM_REQS 32
@@ -7706,11 +7710,11 @@
const u8 *macaddr, const u32 *tx_antenna);
int ath11k_wmi_pdev_set_rx_ant(struct ath11k *ar, u32 antenna);
int
-ath11k_wmi_peer_set_smart_ant_node_config(struct ath11k *ar, u8 *mac,
+ath11k_wmi_peer_set_smart_ant_node_config(struct ath11k *ar, u8 mac_addr[ETH_ALEN],
struct ath11k_smart_ant_node_config_params *param);
int
ath11k_wmi_peer_set_smart_ant_train_info(struct ath11k *ar, u32 vdev_id,
- u8 *mac,
+ u8 mac_addr[ETH_ALEN],
struct ath11k_smart_ant_train_info *param);
int
ath11k_wmi_peer_set_smart_ant_train_ant_param_cmd(struct ath11k *ar,