blob: b51c053a38bbc4aec30f0d19354e9dd95cb95020 [file] [log] [blame]
From daf071f6469272be2b7b61cb227efb7ad57c2ddd Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 25 Nov 2022 10:38:53 +0800
Subject: [PATCH 78/94] wifi: mt76: mt7915: wed: add wed tx support
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
mt76_connac.h | 1 +
mt7915/mac.c | 10 +++++++---
mt7915/main.c | 4 ++--
mt7915/mmio.c | 3 ++-
mt7915/mt7915.h | 2 +-
wed.c | 2 +-
6 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/mt76_connac.h b/mt76_connac.h
index e411032..f2006ea 100644
--- a/mt76_connac.h
+++ b/mt76_connac.h
@@ -130,6 +130,7 @@ struct mt76_connac_sta_key_conf {
};
#define MT_TXP_MAX_BUF_NUM 6
+#define MT_TXD_TXP_BUF_SIZE 128
struct mt76_connac_fw_txp {
__le16 flags;
diff --git a/mt7915/mac.c b/mt7915/mac.c
index 677c339..543077d 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -878,9 +878,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
txp->token = cpu_to_le16(token_id);
txp->nbuf = 1;
- txp->buf[0] = cpu_to_le32(phys + MT_TXD_SIZE + sizeof(*txp));
+ txp->buf[0] = cpu_to_le32(phys + MT_TXD_TXP_BUF_SIZE);
- return MT_TXD_SIZE + sizeof(*txp);
+ return MT_TXD_TXP_BUF_SIZE;
}
static void
@@ -929,6 +929,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
LIST_HEAD(free_list);
void *end = data + len;
bool v3, wake = false;
+ bool with_txwi = true;
u16 total, count = 0;
u32 txd = le32_to_cpu(free->txd);
__le32 *cur_info;
@@ -1010,12 +1011,15 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
txwi = mt76_token_release(mdev, msdu, &wake);
if (!txwi)
continue;
+ else
+ with_txwi = false;
mt76_connac2_txwi_free(mdev, txwi, sta, &free_list);
}
}
- mt7915_mac_tx_free_done(dev, &free_list, wake);
+ if (!with_txwi)
+ mt7915_mac_tx_free_done(dev, &free_list, wake);
}
static void
diff --git a/mt7915/main.c b/mt7915/main.c
index e3bc373..6f09dda 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1832,7 +1832,7 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
if (!mtk_wed_device_active(wed))
return -ENODEV;
- if (msta->wcid.idx > 0xff)
+ if (msta->wcid.idx > MT7915_WTBL_STA)
return -EIO;
if (!test_bit((mvif->qos_map[path->mtk_wdma.tid >> 2] + AMPDU_ADDBA_SUCC_SHFT),
@@ -1843,7 +1843,7 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
path->dev = ctx->dev;
path->mtk_wdma.wdma_idx = wed->wdma_idx;
path->mtk_wdma.bss = mvif->mt76.idx;
- path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? msta->wcid.idx : 0x3ff;
+ path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? 0xff : 0x3ff;
path->mtk_wdma.queue = phy != &dev->phy;
ctx->dev = NULL;
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
index b1b219c..5364821 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -13,7 +13,7 @@
#include "../trace.h"
#include "../dma.h"
-static bool wed_enable;
+static bool wed_enable = true;
module_param(wed_enable, bool, 0644);
MODULE_PARM_DESC(wed_enable, "Enable Wireless Ethernet Dispatch support");
@@ -732,6 +732,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
*irq = wed->irq;
dev->mt76.dma_dev = wed->dev;
+ dev->mt76.token_size = wed->wlan.token_start;
ret = dma_set_mask(wed->dev, DMA_BIT_MASK(32));
if (ret)
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
index 7c185a1..94ea3e1 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -62,7 +62,7 @@
#define MT7916_EEPROM_SIZE 4096
#define MT7915_EEPROM_BLOCK_SIZE 16
-#define MT7915_HW_TOKEN_SIZE 4096
+#define MT7915_HW_TOKEN_SIZE 7168
#define MT7915_TOKEN_SIZE 8192
#define MT7915_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
diff --git a/wed.c b/wed.c
index f7a3f1b..47c81a2 100644
--- a/wed.c
+++ b/wed.c
@@ -187,7 +187,7 @@ void mt76_wed_offload_disable(struct mtk_wed_device *wed)
struct mt76_dev *dev = container_of(wed, struct mt76_dev, mmio.wed);
spin_lock_bh(&dev->token_lock);
- dev->token_size = dev->drv->token_size;
+ dev->token_size = wed->wlan.token_start;
spin_unlock_bh(&dev->token_lock);
}
EXPORT_SYMBOL_GPL(mt76_wed_offload_disable);
--
2.45.2