wlan-ap-Telecominfraproject/feeds/ipq95xx/mac80211/patches/qca/237-002-ath11k-Add-provision-to-configure-rx-hashmap.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

222 lines
7.5 KiB
Diff

From 60d0a63d537c280ff9501296cefd322b981b88f5 Mon Sep 17 00:00:00 2001
From: P Praneesh <ppranees@codeaurora.org>
Date: Mon, 14 Dec 2020 19:13:49 +0530
Subject: [PATCH] ath11k: Add provision to configure rx hashmap
Currently the hashmap is set to default during REO
setup and all REO rings are equally distributed across
32 hash values.
Add provision to configure the hashmap so that destination
rings can be controlled. Setting 0 will disable hash based
steering.
echo "hashmap" > /sys/kernel/debug/ath11k/ipq8074\ hw2.0/rx_hash
Signed-off-by: Sriram R <srirrama@codeaurora.org>
Signed-off-by: P Praneesh <ppranees@codeaurora.org>
---
drivers/net/wireless/ath/ath11k/core.h | 2 ++
drivers/net/wireless/ath/ath11k/debugfs.c | 51 ++++++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath11k/dp.c | 4 ++-
drivers/net/wireless/ath/ath11k/hal.h | 1 +
drivers/net/wireless/ath/ath11k/hal_rx.c | 30 +++++++++++--------
5 files changed, 74 insertions(+), 14 deletions(-)
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -1168,6 +1168,8 @@ struct ath11k_base {
struct ath11k_num_vdevs_peers *num_vdevs_peers;
bool enable_memory_stats;
+ u32 rx_hash;
+
/* must be last */
u8 drv_priv[] __aligned(sizeof(void *));
};
--- a/drivers/net/wireless/ath/ath11k/debugfs.c
+++ b/drivers/net/wireless/ath/ath11k/debugfs.c
@@ -1569,6 +1569,55 @@ static const struct file_operations fops
.llseek = default_llseek,
};
+static ssize_t ath11k_write_rx_hash(struct file *file,
+ const char __user *ubuf,
+ size_t count, loff_t *ppos)
+{
+ struct ath11k_base *ab = file->private_data;
+ struct ath11k_pdev *pdev;
+ u32 rx_hash;
+ u8 buf[128] = {0};
+ int ret, i, radioup = 0;
+
+ for (i = 0; i < ab->num_radios; i++) {
+ pdev = &ab->pdevs[i];
+ if (pdev && pdev->ar) {
+ radioup = 1;
+ break;
+ }
+ }
+
+ if (radioup == 0) {
+ ath11k_err(ab, "radio is not up\n");
+ ret = -ENETDOWN;
+ goto exit;
+ }
+
+ ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count);
+ if (ret < 0)
+ goto exit;
+
+ buf[ret] = '\0';
+ ret = sscanf(buf, "%x", &rx_hash);
+ if (!ret) {
+ ret = -EINVAL;
+ goto exit;
+ }
+
+ if (rx_hash != ab->rx_hash) {
+ ab->rx_hash = rx_hash;
+ if (rx_hash)
+ ath11k_hal_reo_hash_setup(ab, rx_hash);
+ }
+ ret = count;
+exit:
+ return ret;
+}
+static const struct file_operations fops_soc_rx_hash = {
+ .open = simple_open,
+ .write = ath11k_write_rx_hash,
+};
+
static ssize_t ath11k_debug_write_fw_recovery(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
@@ -1850,6 +1899,9 @@ int ath11k_debugfs_pdev_create(struct at
debugfs_create_file("ce_latency_stats", 0600, ab->debugfs_soc, ab,
&fops_ce_latency_stats);
+ debugfs_create_file("rx_hash", 0600, ab->debugfs_soc, ab,
+ &fops_soc_rx_hash);
+
return 0;
}
--- a/drivers/net/wireless/ath/ath11k/dp.c
+++ b/drivers/net/wireless/ath/ath11k/dp.c
@@ -48,7 +48,7 @@ int ath11k_dp_peer_setup(struct ath11k *
bool rx_hash_enable = DP_RX_HASH_ENABLE;
/* RX Hash based steering is disabled for NSS Offload */
- if (ar->ab->nss.enabled)
+ if (ar->ab->nss.enabled || !ab->rx_hash)
rx_hash_enable = DP_RX_HASH_DISABLE;
/* NOTE: reo_dest ring id starts from 1 unlike mac_id which starts from 0 */
--- a/drivers/net/wireless/ath/ath11k/hal.h
+++ b/drivers/net/wireless/ath/ath11k/hal.h
@@ -926,6 +926,7 @@ void ath11k_hal_reo_qdesc_setup(void *va
u32 start_seq, enum hal_pn_type type);
void ath11k_hal_reo_init_cmd_ring(struct ath11k_base *ab,
struct hal_srng *srng);
+void ath11k_hal_reo_hash_setup(struct ath11k_base *ab, u32 ring_hash_map);
void ath11k_hal_setup_link_idle_list(struct ath11k_base *ab,
struct hal_wbm_idle_scatter_list *sbuf,
u32 nsbufs, u32 tot_link_desc,
--- a/drivers/net/wireless/ath/ath11k/hw.c
+++ b/drivers/net/wireless/ath/ath11k/hw.c
@@ -103,6 +103,23 @@ static void ath11k_init_wmi_config_qca63
config->flag1 |= WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64;
}
+void ath11k_hal_reo_hash_setup(struct ath11k_base *ab, u32 ring_hash_map)
+{
+ u32 reo_base = HAL_SEQ_WCSS_UMAC_REO_REG;
+ u8 reo_dest_hash_shift = ab->hw_params.reo_dest_ring_map_shift;
+
+ ab->rx_hash = ring_hash_map;
+
+ /* These registers use only 24bits(3 bits x 8 hash values) for
+ * mapping the dest rings and remaining bits are reserved/not used
+ * so its safe to write them completely.
+ */
+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_2,
+ ring_hash_map << reo_dest_hash_shift);
+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_3,
+ ring_hash_map << reo_dest_hash_shift);
+}
+
static void ath11k_hw_ipq8074_reo_setup(struct ath11k_base *ab)
{
u32 reo_base = HAL_SEQ_WCSS_UMAC_REO_REG;
@@ -116,7 +133,6 @@ static void ath11k_hw_ipq8074_reo_setup(
HAL_HASH_ROUTING_RING_SW2 << 15 |
HAL_HASH_ROUTING_RING_SW3 << 18 |
HAL_HASH_ROUTING_RING_SW4 << 21;
- u8 reo_dest_hash_shift = ab->hw_params.reo_dest_ring_map_shift;
ab->hw_params.hw_ops->set_rx_fragmentation_dst_ring(ab);
@@ -133,18 +149,7 @@ static void ath11k_hw_ipq8074_reo_setup(
if (ab->nss.enabled)
return;
- /* These registers use only 24bits(3 bits x 8 hash values) for
- * mapping the dest rings and remaining bits are reserved/not used
- * so its safe to write them completely.
- */
- ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_0,
- ring_hash_map << reo_dest_hash_shift);
- ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_1,
- ring_hash_map << reo_dest_hash_shift);
- ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_2,
- ring_hash_map << reo_dest_hash_shift);
- ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_3,
- ring_hash_map << reo_dest_hash_shift);
+ ath11k_hal_reo_hash_setup(ab, ring_hash_map);
}
static void ath11k_init_wmi_config_ipq8074(struct ath11k_base *ab,
@@ -927,7 +932,6 @@ static void ath11k_hw_wcn6855_reo_setup(
HAL_HASH_ROUTING_RING_SW3 << 24 |
HAL_HASH_ROUTING_RING_SW4 << 28;
- u8 reo_dest_hash_shift = ab->hw_params.reo_dest_ring_map_shift;
ab->hw_params.hw_ops->set_rx_fragmentation_dst_ring(ab);
ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_0(ab),
@@ -943,16 +947,12 @@ static void ath11k_hw_wcn6855_reo_setup(
if (ab->nss.enabled)
return;
- ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_2,
- ring_hash_map << reo_dest_hash_shift);
- ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_3,
- ring_hash_map << reo_dest_hash_shift);
+ ath11k_hal_reo_hash_setup(ab, ring_hash_map);
}
static void ath11k_hw_ipq5018_reo_setup(struct ath11k_base *ab)
{
u32 reo_base = HAL_SEQ_WCSS_UMAC_REO_REG;
- u8 reo_dest_hash_shift = ab->hw_params.reo_dest_ring_map_shift;
/* Each hash entry uses three bits to map to a particular ring. */
u32 ring_hash_map = HAL_HASH_ROUTING_RING_SW1 << 0 |
@@ -979,14 +979,7 @@ static void ath11k_hw_ipq5018_reo_setup(
if (ab->nss.enabled)
return;
- ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_0,
- ring_hash_map << reo_dest_hash_shift);
- ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_1,
- ring_hash_map << reo_dest_hash_shift);
- ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_2,
- ring_hash_map << reo_dest_hash_shift);
- ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_3,
- ring_hash_map << reo_dest_hash_shift);
+ ath11k_hal_reo_hash_setup(ab, ring_hash_map);
}
static u16 ath11k_hw_ipq8074_mpdu_info_get_peerid(u8 *tlv_data)