blob: f26cd8efdf6c820f27cbaf78f40bea6c7d8500e0 [file] [log] [blame]
From 8e8c3896353c975491cf322737c50606fb2d3611 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 3001/3013] mt76: mt7915: wed: add wed tx support
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
mt76_connac.h | 1 +
mt7915/mac.c | 11 +++++++----
mt7915/main.c | 4 ++--
mt7915/mmio.c | 5 +++--
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/mt76_connac.h b/mt76_connac.h
index 8ba883b..f70987d 100644
--- a/mt76_connac.h
+++ b/mt76_connac.h
@@ -116,6 +116,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 a0df785..0984357 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -891,9 +891,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
@@ -1009,6 +1009,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;
@@ -1064,12 +1065,14 @@ 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;
mt7915_txwi_free(dev, 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 09cf35c..2dd78ca 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1533,14 +1533,14 @@ 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;
path->type = DEV_PATH_MTK_WDMA;
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 c1b421d..04411e7 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -11,7 +11,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");
@@ -582,7 +582,7 @@ static void mt7915_mmio_wed_offload_disable(struct mtk_wed_device *wed)
dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed);
spin_lock_bh(&dev->mt76.token_lock);
- dev->mt76.token_size = MT7915_TOKEN_SIZE;
+ dev->mt76.token_size = wed->wlan.token_start;//MT7915_TOKEN_SIZE
spin_unlock_bh(&dev->mt76.token_lock);
/* MT_TXD5_TX_STATUS_HOST (MPDU format) has higher priority than
@@ -792,6 +792,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)
--
2.18.0