mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-20 10:51:27 +00:00
This series is based on * 2020-07-10 ipq6018-ilq-11-0_qca_oem-034672b0676c37b1f4519e5720e18e95fe6236ef Add support for * qsdk kernel/v4.4 * qsdk ethernet subsystem * v5.7 ath11k backport + QualComm staging patches (wlan_ap_1.0) * ath11k-firmware * hostapd/iw/... Feature support * full boot, system detection * sysupgrade to nand * HE support via latest hostapd * driver support for usb, crypto, hwmon, cpufreq, ... Missing * NSS/HW flow offloading - FW blob is not redistributable Using the qsdk v4.4 is an intermediate solution while the vanilla is being tested. Vanilla kernel is almost on feature par. Work has already started to upstream the ethernet and switch drivers. Once complete the target will be fully upstream. Signed-off-by: John Crispin <john@phrozen.org>
285 lines
8.4 KiB
Diff
285 lines
8.4 KiB
Diff
--- a/drivers/net/wireless/ath/ath11k/core.h
|
|
+++ b/drivers/net/wireless/ath/ath11k/core.h
|
|
@@ -621,6 +621,26 @@ struct ath11k_board_data {
|
|
/* IPQ8074 HW channel counters frequency value in hertz */
|
|
#define IPQ8074_CC_FREQ_HERTZ 320000
|
|
|
|
+struct ath11k_bp_stats {
|
|
+ /* Head Pointer reported by the last HTT Backpressure event for the ring*/
|
|
+ u16 hp;
|
|
+ /* Tail Pointer reported by the last HTT Backpressure event for the ring*/
|
|
+ u16 tp;
|
|
+ /* Number of Backpressure events received for the ring*/
|
|
+ u32 count;
|
|
+ /* Last recorded event timestamp */
|
|
+ unsigned long jiffies;
|
|
+};
|
|
+
|
|
+struct ath11k_dp_ring_bp_stats {
|
|
+ struct ath11k_bp_stats umac_ring_bp_stats[HTT_SW_UMAC_RING_IDX_MAX];
|
|
+ struct ath11k_bp_stats lmac_ring_bp_stats[HTT_SW_LMAC_RING_IDX_MAX][MAX_RADIOS];
|
|
+};
|
|
+
|
|
+struct ath11k_soc_dp_ring_stats {
|
|
+ struct ath11k_dp_ring_bp_stats bp_stats;
|
|
+};
|
|
+
|
|
struct ath11k_soc_dp_rx_stats {
|
|
u32 err_ring_pkts;
|
|
u32 invalid_rbm;
|
|
@@ -693,6 +713,7 @@ struct ath11k_base {
|
|
#ifdef CPTCFG_ATH11K_DEBUGFS
|
|
struct dentry *debugfs_soc;
|
|
struct dentry *debugfs_ath11k;
|
|
+ struct ath11k_soc_dp_ring_stats ring_stats;
|
|
#endif
|
|
struct ath11k_soc_dp_rx_stats soc_stats;
|
|
|
|
--- a/drivers/net/wireless/ath/ath11k/debug.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/debug.c
|
|
@@ -13,6 +13,45 @@
|
|
#include "peer.h"
|
|
#include "pktlog.h"
|
|
|
|
+#ifdef CPTCFG_ATH11K_DEBUGFS
|
|
+static const char *htt_bp_umac_ring[HTT_SW_UMAC_RING_IDX_MAX] = {
|
|
+ "REO2SW1_RING",
|
|
+ "REO2SW2_RING",
|
|
+ "REO2SW3_RING",
|
|
+ "REO2SW4_RING",
|
|
+ "WBM2REO_LINK_RING",
|
|
+ "REO2TCL_RING",
|
|
+ "REO2FW_RING",
|
|
+ "RELEASE_RING",
|
|
+ "PPE_RELEASE_RING",
|
|
+ "TCL2TQM_RING",
|
|
+ "TQM_RELEASE_RING",
|
|
+ "REO_RELEASE_RING",
|
|
+ "WBM2SW0_RELEASE_RING",
|
|
+ "WBM2SW1_RELEASE_RING",
|
|
+ "WBM2SW2_RELEASE_RING",
|
|
+ "WBM2SW3_RELEASE_RING",
|
|
+ "REO_CMD_RING",
|
|
+ "REO_STATUS_RING",
|
|
+};
|
|
+
|
|
+static const char *htt_bp_lmac_ring[HTT_SW_LMAC_RING_IDX_MAX] = {
|
|
+ "FW2RXDMA_BUF_RING",
|
|
+ "FW2RXDMA_STATUS_RING",
|
|
+ "FW2RXDMA_LINK_RING",
|
|
+ "SW2RXDMA_BUF_RING",
|
|
+ "WBM2RXDMA_LINK_RING",
|
|
+ "RXDMA2FW_RING",
|
|
+ "RXDMA2SW_RING",
|
|
+ "RXDMA2RELEASE_RING",
|
|
+ "RXDMA2REO_RING",
|
|
+ "MONITOR_STATUS_RING",
|
|
+ "MONITOR_BUF_RING",
|
|
+ "MONITOR_DESC_RING",
|
|
+ "MONITOR_DEST_RING",
|
|
+};
|
|
+#endif
|
|
+
|
|
void ath11k_info(struct ath11k_base *ab, const char *fmt, ...)
|
|
{
|
|
struct va_format vaf = {
|
|
@@ -795,6 +834,85 @@ static ssize_t ath11k_debug_dump_soc_rx_
|
|
return retval;
|
|
}
|
|
|
|
+static int ath11k_fill_bp_stats(struct ath11k_base *ab,
|
|
+ struct ath11k_bp_stats *bp_stats,
|
|
+ char *buf, int len, int size)
|
|
+{
|
|
+ lockdep_assert_held(&ab->base_lock);
|
|
+
|
|
+ len += scnprintf(buf + len, size - len, "count: %u\n",
|
|
+ bp_stats->count);
|
|
+ len += scnprintf(buf + len, size - len, "hp: %u\n",
|
|
+ bp_stats->hp);
|
|
+ len += scnprintf(buf + len, size - len, "tp: %u\n",
|
|
+ bp_stats->tp);
|
|
+ len += scnprintf(buf + len, size - len, "seen before: %ums\n\n",
|
|
+ jiffies_to_msecs(jiffies - bp_stats->jiffies));
|
|
+ return len;
|
|
+}
|
|
+
|
|
+static ssize_t ath11k_debug_dump_soc_ring_stats(struct file *file,
|
|
+ char __user *user_buf,
|
|
+ size_t count, loff_t *ppos)
|
|
+{
|
|
+ struct ath11k_base *ab = file->private_data;
|
|
+ struct ath11k_bp_stats *bp_stats;
|
|
+ int len = 0, retval;
|
|
+ u8 i, pdev_idx;
|
|
+ const int size = 4096;
|
|
+ bool stats_rxd = false;
|
|
+ char *buf;
|
|
+
|
|
+ buf = kzalloc(size, GFP_KERNEL);
|
|
+ if (!buf)
|
|
+ return -ENOMEM;
|
|
+
|
|
+ len += scnprintf(buf + len, size - len, "\nRing Stats\n==========\n");
|
|
+ len += scnprintf(buf + len, size - len, "Backpressure Stats\n");
|
|
+ len += scnprintf(buf + len, size - len, "==================\n");
|
|
+
|
|
+ spin_lock_bh(&ab->base_lock);
|
|
+ for (i = 0; i < HTT_SW_UMAC_RING_IDX_MAX; i++) {
|
|
+ bp_stats = &ab->ring_stats.bp_stats.umac_ring_bp_stats[i];
|
|
+
|
|
+ if (!bp_stats->count)
|
|
+ continue;
|
|
+
|
|
+ len += scnprintf(buf + len, size - len, "Ring: %s\n",
|
|
+ htt_bp_umac_ring[i]);
|
|
+ len = ath11k_fill_bp_stats(ab, bp_stats, buf, len, size);
|
|
+ stats_rxd = true;
|
|
+ }
|
|
+
|
|
+ for (i = 0; i < HTT_SW_LMAC_RING_IDX_MAX; i++) {
|
|
+ for(pdev_idx = 0; pdev_idx < MAX_RADIOS; pdev_idx++) {
|
|
+ bp_stats = &ab->ring_stats.bp_stats.lmac_ring_bp_stats[i][pdev_idx];
|
|
+
|
|
+ if (!bp_stats->count)
|
|
+ continue;
|
|
+
|
|
+ len += scnprintf(buf + len, size - len, "Ring: %s\n",
|
|
+ htt_bp_lmac_ring[i]);
|
|
+ len += scnprintf(buf + len, size - len, "pdev: %d\n",
|
|
+ pdev_idx);
|
|
+ len = ath11k_fill_bp_stats(ab, bp_stats, buf, len, size);
|
|
+ stats_rxd = true;
|
|
+ }
|
|
+ }
|
|
+ spin_unlock_bh(&ab->base_lock);
|
|
+
|
|
+ if (!stats_rxd)
|
|
+ len += scnprintf(buf + len, size - len, "No Ring Backpressure stats received\n\n");
|
|
+
|
|
+ if (len > size)
|
|
+ len = size;
|
|
+
|
|
+ retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
|
|
+ kfree(buf);
|
|
+
|
|
+ return retval;
|
|
+}
|
|
+
|
|
static const struct file_operations fops_soc_rx_stats = {
|
|
.read = ath11k_debug_dump_soc_rx_stats,
|
|
.open = simple_open,
|
|
@@ -827,6 +945,13 @@ void ath11k_debug_pdev_destroy(struct at
|
|
ab->debugfs_ath11k = NULL;
|
|
}
|
|
|
|
+static const struct file_operations fops_soc_ring_stats = {
|
|
+ .read = ath11k_debug_dump_soc_ring_stats,
|
|
+ .open = simple_open,
|
|
+ .owner = THIS_MODULE,
|
|
+ .llseek = default_llseek,
|
|
+};
|
|
+
|
|
int ath11k_debug_soc_create(struct ath11k_base *ab)
|
|
{
|
|
ab->debugfs_ath11k = debugfs_create_dir("ath11k", NULL);
|
|
@@ -837,6 +962,8 @@ int ath11k_debug_soc_create(struct ath11
|
|
return -ENOMEM;
|
|
}
|
|
|
|
+ debugfs_create_file("soc_ring_stats", 0600, ab->debugfs_soc, ab,
|
|
+ &fops_soc_ring_stats);
|
|
return 0;
|
|
}
|
|
|
|
--- a/drivers/net/wireless/ath/ath11k/dp.h
|
|
+++ b/drivers/net/wireless/ath/ath11k/dp.h
|
|
@@ -992,6 +992,48 @@ struct htt_resp_msg {
|
|
#define HTT_BACKPRESSURE_EVENT_HP_M GENMASK(15, 0)
|
|
#define HTT_BACKPRESSURE_EVENT_TP_M GENMASK(31, 16)
|
|
|
|
+#define HTT_BACKPRESSURE_UMAC_RING_TYPE 0
|
|
+#define HTT_BACKPRESSURE_LMAC_RING_TYPE 1
|
|
+
|
|
+enum htt_backpressure_umac_ringid {
|
|
+ HTT_SW_RING_IDX_REO_REO2SW1_RING,
|
|
+ HTT_SW_RING_IDX_REO_REO2SW2_RING,
|
|
+ HTT_SW_RING_IDX_REO_REO2SW3_RING,
|
|
+ HTT_SW_RING_IDX_REO_REO2SW4_RING,
|
|
+ HTT_SW_RING_IDX_REO_WBM2REO_LINK_RING,
|
|
+ HTT_SW_RING_IDX_REO_REO2TCL_RING,
|
|
+ HTT_SW_RING_IDX_REO_REO2FW_RING,
|
|
+ HTT_SW_RING_IDX_REO_REO_RELEASE_RING,
|
|
+ HTT_SW_RING_IDX_WBM_PPE_RELEASE_RING,
|
|
+ HTT_SW_RING_IDX_TCL_TCL2TQM_RING,
|
|
+ HTT_SW_RING_IDX_WBM_TQM_RELEASE_RING,
|
|
+ HTT_SW_RING_IDX_WBM_REO_RELEASE_RING,
|
|
+ HTT_SW_RING_IDX_WBM_WBM2SW0_RELEASE_RING,
|
|
+ HTT_SW_RING_IDX_WBM_WBM2SW1_RELEASE_RING,
|
|
+ HTT_SW_RING_IDX_WBM_WBM2SW2_RELEASE_RING,
|
|
+ HTT_SW_RING_IDX_WBM_WBM2SW3_RELEASE_RING,
|
|
+ HTT_SW_RING_IDX_REO_REO_CMD_RING,
|
|
+ HTT_SW_RING_IDX_REO_REO_STATUS_RING,
|
|
+ HTT_SW_UMAC_RING_IDX_MAX,
|
|
+};
|
|
+
|
|
+enum htt_backpressure_lmac_ringid {
|
|
+ HTT_SW_RING_IDX_FW2RXDMA_BUF_RING,
|
|
+ HTT_SW_RING_IDX_FW2RXDMA_STATUS_RING,
|
|
+ HTT_SW_RING_IDX_FW2RXDMA_LINK_RING,
|
|
+ HTT_SW_RING_IDX_SW2RXDMA_BUF_RING,
|
|
+ HTT_SW_RING_IDX_WBM2RXDMA_LINK_RING,
|
|
+ HTT_SW_RING_IDX_RXDMA2FW_RING,
|
|
+ HTT_SW_RING_IDX_RXDMA2SW_RING,
|
|
+ HTT_SW_RING_IDX_RXDMA2RELEASE_RING,
|
|
+ HTT_SW_RING_IDX_RXDMA2REO_RING,
|
|
+ HTT_SW_RING_IDX_MONITOR_STATUS_RING,
|
|
+ HTT_SW_RING_IDX_MONITOR_BUF_RING,
|
|
+ HTT_SW_RING_IDX_MONITOR_DESC_RING,
|
|
+ HTT_SW_RING_IDX_MONITOR_DEST_RING,
|
|
+ HTT_SW_LMAC_RING_IDX_MAX,
|
|
+};
|
|
+
|
|
/* ppdu stats
|
|
*
|
|
* @details
|
|
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
|
|
@@ -1504,6 +1504,10 @@ static void ath11k_htt_backpressure_even
|
|
u8 pdev_id, ring_type, ring_id;
|
|
u16 hp, tp;
|
|
u32 backpressure_time;
|
|
+#ifdef CPTCFG_ATH11K_DEBUGFS
|
|
+ u8 pdev_idx;
|
|
+ struct ath11k_bp_stats *bp_stats;
|
|
+#endif
|
|
|
|
pdev_id = FIELD_GET(HTT_BACKPRESSURE_EVENT_PDEV_ID_M, *data);
|
|
ring_type = FIELD_GET(HTT_BACKPRESSURE_EVENT_RING_TYPE_M, *data);
|
|
@@ -1518,6 +1522,25 @@ static void ath11k_htt_backpressure_even
|
|
|
|
ath11k_dbg(ab, ATH11K_DBG_DP_HTT, "htt backpressure event, pdev %d, ring type %d,ring id %d, hp %d tp %d, backpressure time %d\n",
|
|
pdev_id, ring_type, ring_id, hp, tp, backpressure_time);
|
|
+#ifdef CPTCFG_ATH11K_DEBUGFS
|
|
+ if (ring_type == HTT_BACKPRESSURE_UMAC_RING_TYPE) {
|
|
+ if (ring_id >= HTT_SW_UMAC_RING_IDX_MAX)
|
|
+ return;
|
|
+ bp_stats = &ab->ring_stats.bp_stats.umac_ring_bp_stats[ring_id];
|
|
+ } else if (ring_type == HTT_BACKPRESSURE_LMAC_RING_TYPE) {
|
|
+ pdev_idx = DP_HW2SW_MACID(pdev_id);
|
|
+
|
|
+ if (ring_id >= HTT_SW_LMAC_RING_IDX_MAX || pdev_idx >= MAX_RADIOS)
|
|
+ return;
|
|
+ bp_stats = &ab->ring_stats.bp_stats.lmac_ring_bp_stats[ring_id][pdev_idx];
|
|
+ }
|
|
+ spin_lock_bh(&ab->base_lock);
|
|
+ bp_stats->hp = hp;
|
|
+ bp_stats->tp = tp;
|
|
+ bp_stats->count++;
|
|
+ bp_stats->jiffies = jiffies;
|
|
+ spin_unlock_bh(&ab->base_lock);
|
|
+#endif
|
|
}
|
|
|
|
void ath11k_dp_htt_htc_t2h_msg_handler(struct ath11k_base *ab,
|