[][MT76][WED][add wds support on panther when wed on]
[Description]
Add wds support on panther when wed on
1.wed only support 256 sta ,but mt7986 support 544
2.use wed cr overwrite bit[9:8] and start wds wcid form 256
[Release-log]
N/A
Change-Id: Ia1eea90721f722a137b35688cfb350ae01d1f73e
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6296500
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/3001-mt76-add-wed-tx-support.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/3001-mt76-add-wed-tx-support.patch
index 737c694..0cc1f89 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/3001-mt76-add-wed-tx-support.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/3001-mt76-add-wed-tx-support.patch
@@ -1,24 +1,24 @@
-From bac4df557d1674c557297e80b852867a650aa490 Mon Sep 17 00:00:00 2001
+From 379918ba724d761166f0677848b6266fe999486a Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Sun, 12 Jun 2022 16:38:45 +0800
Subject: [PATCH 3001/3003] mt76 add wed tx support
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
- .../net/wireless/mediatek/mt76/mt76_connac.h | 1 +
- .../net/wireless/mediatek/mt76/mt7915/dma.c | 59 +++++++---
- .../net/wireless/mediatek/mt76/mt7915/mac.c | 4 +-
- .../net/wireless/mediatek/mt76/mt7915/main.c | 9 +-
- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 2 +-
- .../net/wireless/mediatek/mt76/mt7915/mmio.c | 110 +++++++++++++++++-
- .../wireless/mediatek/mt76/mt7915/mt7915.h | 2 +
- .../net/wireless/mediatek/mt76/mt7915/pci.c | 72 +-----------
- .../net/wireless/mediatek/mt76/mt7915/regs.h | 15 +++
- .../net/wireless/mediatek/mt76/mt7915/soc.c | 16 ++-
+ mt76_connac.h | 1 +
+ mt7915/dma.c | 59 +++++++++++++++++++-------
+ mt7915/mac.c | 4 +-
+ mt7915/main.c | 9 +++-
+ mt7915/mcu.c | 2 +-
+ mt7915/mmio.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++-
+ mt7915/mt7915.h | 2 +
+ mt7915/pci.c | 72 +------------------------------
+ mt7915/regs.h | 15 +++++++
+ mt7915/soc.c | 16 +++++--
10 files changed, 193 insertions(+), 97 deletions(-)
diff --git a/mt76_connac.h b/mt76_connac.h
-index 5a9c1c97..c8d86800 100644
+index 5a9c1c9..c8d8680 100644
--- a/mt76_connac.h
+++ b/mt76_connac.h
@@ -110,6 +110,7 @@ struct mt76_connac_sta_key_conf {
@@ -30,7 +30,7 @@
struct mt76_connac_fw_txp {
__le16 flags;
diff --git a/mt7915/dma.c b/mt7915/dma.c
-index 9e3d14db..71223221 100644
+index 9e3d14d..7122322 100644
--- a/mt7915/dma.c
+++ b/mt7915/dma.c
@@ -12,7 +12,10 @@ mt7915_init_tx_queues(struct mt7915_phy *phy, int idx, int n_desc, int ring_base
@@ -144,7 +144,7 @@
return ret;
}
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 0310ca74..db21d83e 100644
+index 0310ca7..db21d83 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -835,9 +835,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
@@ -160,7 +160,7 @@
static void
diff --git a/mt7915/main.c b/mt7915/main.c
-index 6085e124..2e721cd0 100644
+index 6085e12..2e721cd 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1439,14 +1439,19 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
@@ -186,10 +186,10 @@
ctx->dev = NULL;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 681a2a7c..674cbc4e 100644
+index ffe0447..9e9a2ea 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -2381,7 +2381,7 @@ int mt7915_run_firmware(struct mt7915_dev *dev)
+@@ -2377,7 +2377,7 @@ int mt7915_run_firmware(struct mt7915_dev *dev)
if (ret)
return ret;
@@ -199,7 +199,7 @@
ret = mt7915_mcu_set_mwds(dev, 1);
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 6d1dbdbd..b4a3120d 100644
+index 6d1dbdb..b4a3120 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -10,6 +10,9 @@
@@ -341,7 +341,7 @@
void __iomem *mem_base, u32 device_id)
{
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 491566e9..39127922 100644
+index 491566e..3912792 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -533,6 +533,8 @@ static inline void mt7986_wmac_disable(struct mt7915_dev *dev)
@@ -354,7 +354,7 @@
void __iomem *mem_base, u32 device_id);
void mt7915_wfsys_reset(struct mt7915_dev *dev);
diff --git a/mt7915/pci.c b/mt7915/pci.c
-index d74f6097..c5da01a9 100644
+index d74f609..c5da01a 100644
--- a/mt7915/pci.c
+++ b/mt7915/pci.c
@@ -12,9 +12,6 @@
@@ -451,7 +451,7 @@
goto free_wed_or_irq_vector;
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 444440e1..ffda5f6b 100644
+index 444440e..ffda5f6 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -623,6 +623,7 @@ enum offs_rev {
@@ -498,7 +498,7 @@
#define MT_INT_TX_DONE_MCU (MT_INT_TX_MCU(MT_MCUQ_WA) | \
MT_INT_TX_MCU(MT_MCUQ_WM) | \
diff --git a/mt7915/soc.c b/mt7915/soc.c
-index 3618718d..8d0b2068 100644
+index 3618718..8d0b206 100644
--- a/mt7915/soc.c
+++ b/mt7915/soc.c
@@ -1171,10 +1171,6 @@ static int mt7986_wmac_probe(struct platform_device *pdev)
@@ -539,5 +539,5 @@
return ret;
--
-2.25.1
+2.18.0
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/3002-mt76-add-wed-rx-support.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/3002-mt76-add-wed-rx-support.patch
index 8265434..45e7386 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/3002-mt76-add-wed-rx-support.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/3002-mt76-add-wed-rx-support.patch
@@ -1,35 +1,38 @@
-From a6bbc51840c63e5992c2d0cee9fbbb795312da0c Mon Sep 17 00:00:00 2001
+From 50c04081556744438d6017c11ddfa3b7239efd26 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Tue, 5 Jul 2022 19:42:55 +0800
Subject: [PATCH 3002/3003] mt76 add wed rx support
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
- drivers/net/wireless/mediatek/mt76/dma.c | 250 +++++++++++++++---
- drivers/net/wireless/mediatek/mt76/dma.h | 10 +
- drivers/net/wireless/mediatek/mt76/mac80211.c | 8 +-
- drivers/net/wireless/mediatek/mt76/mt76.h | 24 +-
- .../net/wireless/mediatek/mt76/mt7603/dma.c | 2 +-
- .../wireless/mediatek/mt76/mt7603/mt7603.h | 2 +-
- .../net/wireless/mediatek/mt76/mt7615/mac.c | 2 +-
- .../wireless/mediatek/mt76/mt7615/mt7615.h | 2 +-
- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 9 +
- drivers/net/wireless/mediatek/mt76/mt76x02.h | 2 +-
- .../net/wireless/mediatek/mt76/mt76x02_txrx.c | 2 +-
- .../net/wireless/mediatek/mt76/mt7915/dma.c | 10 +
- .../net/wireless/mediatek/mt76/mt7915/mac.c | 103 +++++++-
- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 3 +
- .../net/wireless/mediatek/mt76/mt7915/mmio.c | 26 +-
- .../wireless/mediatek/mt76/mt7915/mt7915.h | 7 +-
- .../net/wireless/mediatek/mt76/mt7915/regs.h | 14 +-
- .../net/wireless/mediatek/mt76/mt7921/mac.c | 2 +-
- .../wireless/mediatek/mt76/mt7921/mt7921.h | 4 +-
- .../wireless/mediatek/mt76/mt7921/pci_mac.c | 4 +-
- drivers/net/wireless/mediatek/mt76/tx.c | 34 +++
- 21 files changed, 448 insertions(+), 68 deletions(-)
+ dma.c | 250 ++++++++++++++++++++++++++++++++++++++--------
+ dma.h | 10 ++
+ mac80211.c | 8 +-
+ mt76.h | 25 ++++-
+ mt7603/dma.c | 2 +-
+ mt7603/mt7603.h | 2 +-
+ mt7615/mac.c | 2 +-
+ mt7615/mt7615.h | 2 +-
+ mt76_connac_mcu.c | 9 ++
+ mt76x02.h | 2 +-
+ mt76x02_txrx.c | 2 +-
+ mt7915/dma.c | 10 ++
+ mt7915/init.c | 9 ++
+ mt7915/mac.c | 103 ++++++++++++++++++-
+ mt7915/main.c | 25 ++++-
+ mt7915/mcu.c | 14 ++-
+ mt7915/mcu.h | 1 +
+ mt7915/mmio.c | 26 ++++-
+ mt7915/mt7915.h | 10 +-
+ mt7915/regs.h | 14 ++-
+ mt7921/mac.c | 2 +-
+ mt7921/mt7921.h | 4 +-
+ mt7921/pci_mac.c | 4 +-
+ tx.c | 34 +++++++
+ 24 files changed, 495 insertions(+), 75 deletions(-)
diff --git a/dma.c b/dma.c
-index 03ee9109..3acba9a3 100644
+index 03ee910..4d4d404 100644
--- a/dma.c
+++ b/dma.c
@@ -98,6 +98,63 @@ mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t)
@@ -271,7 +274,7 @@
{
int idx = q->tail;
-@@ -314,7 +433,7 @@ mt76_dma_dequeue(struct mt76_dev *dev, struct mt76_queue *q, bool flush,
+@@ -314,7 +435,7 @@ mt76_dma_dequeue(struct mt76_dev *dev, struct mt76_queue *q, bool flush,
q->tail = (q->tail + 1) % q->ndesc;
q->queued--;
@@ -280,7 +283,7 @@
}
static int
-@@ -336,7 +455,7 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
+@@ -336,7 +457,7 @@ mt76_dma_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
buf.len = skb->len;
spin_lock_bh(&q->lock);
@@ -289,7 +292,7 @@
mt76_dma_kick_queue(dev, q);
spin_unlock_bh(&q->lock);
-@@ -413,7 +532,7 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
+@@ -413,7 +534,7 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,
goto unmap;
return mt76_dma_add_buf(dev, q, tx_info.buf, tx_info.nbuf,
@@ -298,7 +301,7 @@
unmap:
for (n--; n > 0; n--)
-@@ -448,6 +567,8 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -448,6 +569,8 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
int frames = 0;
int len = SKB_WITH_OVERHEAD(q->buf_size);
int offset = q->buf_offset;
@@ -307,7 +310,7 @@
if (!q->ndesc)
return 0;
-@@ -456,10 +577,29 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -456,10 +579,29 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
while (q->queued < q->ndesc - 1) {
struct mt76_queue_buf qbuf;
@@ -340,7 +343,7 @@
addr = dma_map_single(dev->dma_dev, buf, len, DMA_FROM_DEVICE);
if (unlikely(dma_mapping_error(dev->dma_dev, addr))) {
-@@ -470,7 +610,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -470,7 +612,7 @@ mt76_dma_rx_fill(struct mt76_dev *dev, struct mt76_queue *q)
qbuf.addr = addr + offset;
qbuf.len = len - offset;
qbuf.skip_unmap = false;
@@ -349,7 +352,7 @@
frames++;
}
-@@ -516,6 +656,11 @@ mt76_dma_wed_setup(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -516,6 +658,11 @@ mt76_dma_wed_setup(struct mt76_dev *dev, struct mt76_queue *q)
if (!ret)
q->wed_regs = wed->txfree_ring.reg_base;
break;
@@ -361,7 +364,7 @@
default:
ret = -EINVAL;
}
-@@ -531,7 +676,8 @@ mt76_dma_alloc_queue(struct mt76_dev *dev, struct mt76_queue *q,
+@@ -531,7 +678,8 @@ mt76_dma_alloc_queue(struct mt76_dev *dev, struct mt76_queue *q,
int idx, int n_desc, int bufsize,
u32 ring_base)
{
@@ -371,7 +374,7 @@
spin_lock_init(&q->lock);
spin_lock_init(&q->cleanup_lock);
-@@ -541,6 +687,11 @@ mt76_dma_alloc_queue(struct mt76_dev *dev, struct mt76_queue *q,
+@@ -541,6 +689,11 @@ mt76_dma_alloc_queue(struct mt76_dev *dev, struct mt76_queue *q,
q->buf_size = bufsize;
q->hw_idx = idx;
@@ -383,7 +386,7 @@
size = q->ndesc * sizeof(struct mt76_desc);
q->desc = dmam_alloc_coherent(dev->dma_dev, size, &q->desc_dma, GFP_KERNEL);
if (!q->desc)
-@@ -573,7 +724,7 @@ mt76_dma_rx_cleanup(struct mt76_dev *dev, struct mt76_queue *q)
+@@ -573,7 +726,7 @@ mt76_dma_rx_cleanup(struct mt76_dev *dev, struct mt76_queue *q)
spin_lock_bh(&q->lock);
do {
@@ -392,7 +395,7 @@
if (!buf)
break;
-@@ -614,7 +765,7 @@ mt76_dma_rx_reset(struct mt76_dev *dev, enum mt76_rxq_id qid)
+@@ -614,7 +767,7 @@ mt76_dma_rx_reset(struct mt76_dev *dev, enum mt76_rxq_id qid)
static void
mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
@@ -401,7 +404,7 @@
{
struct sk_buff *skb = q->rx_head;
struct skb_shared_info *shinfo = skb_shinfo(skb);
-@@ -634,7 +785,7 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
+@@ -634,7 +787,7 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
q->rx_head = NULL;
if (nr_frags < ARRAY_SIZE(shinfo->frags))
@@ -410,7 +413,7 @@
else
dev_kfree_skb(skb);
}
-@@ -655,6 +806,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
+@@ -655,6 +808,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
}
while (done < budget) {
@@ -418,7 +421,7 @@
u32 info;
if (check_ddone) {
-@@ -665,10 +817,13 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
+@@ -665,10 +819,13 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
break;
}
@@ -433,7 +436,7 @@
if (q->rx_head)
data_len = q->buf_size;
else
-@@ -681,7 +836,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
+@@ -681,7 +838,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
}
if (q->rx_head) {
@@ -442,7 +445,7 @@
continue;
}
-@@ -708,7 +863,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
+@@ -708,7 +865,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget)
continue;
}
@@ -451,7 +454,7 @@
continue;
free_frag:
-@@ -785,7 +940,7 @@ EXPORT_SYMBOL_GPL(mt76_dma_attach);
+@@ -785,7 +942,7 @@ EXPORT_SYMBOL_GPL(mt76_dma_attach);
void mt76_dma_cleanup(struct mt76_dev *dev)
{
@@ -460,7 +463,7 @@
mt76_worker_disable(&dev->tx_worker);
netif_napi_del(&dev->tx_napi);
-@@ -801,12 +956,17 @@ void mt76_dma_cleanup(struct mt76_dev *dev)
+@@ -801,12 +958,17 @@ void mt76_dma_cleanup(struct mt76_dev *dev)
mt76_for_each_q_rx(dev, i) {
netif_napi_del(&dev->napi[i]);
@@ -480,7 +483,7 @@
}
EXPORT_SYMBOL_GPL(mt76_dma_cleanup);
diff --git a/dma.h b/dma.h
-index fdf786f9..90370d12 100644
+index fdf786f..90370d1 100644
--- a/dma.h
+++ b/dma.h
@@ -16,6 +16,16 @@
@@ -501,7 +504,7 @@
#define MT_RX_INFO_LEN 4
#define MT_FCE_INFO_LEN 4
diff --git a/mac80211.c b/mac80211.c
-index af2c09ad..fa5ce6ec 100644
+index af2c09a..fa5ce6e 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -594,11 +594,14 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
@@ -532,7 +535,7 @@
mt76_rx_complete(dev, &frames, napi);
diff --git a/mt76.h b/mt76.h
-index 49314895..9162213a 100644
+index 4931489..0043c7c 100644
--- a/mt76.h
+++ b/mt76.h
@@ -20,6 +20,8 @@
@@ -597,7 +600,7 @@
struct mt76_queue *q_mcu[__MT_MCUQ_MAX];
struct mt76_queue q_rx[__MT_RXQ_MAX];
const struct mt76_queue_ops *queue_ops;
-@@ -785,6 +794,9 @@ struct mt76_dev {
+@@ -785,12 +794,16 @@ struct mt76_dev {
u16 wed_token_count;
u16 token_count;
u16 token_size;
@@ -607,7 +610,14 @@
wait_queue_head_t tx_wait;
/* spinclock used to protect wcid pktid linked list */
-@@ -1352,6 +1364,8 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
+ spinlock_t status_lock;
+
+ u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
++ u32 wcid_wds_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
+ u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
+
+ u64 vif_mask;
+@@ -1352,6 +1365,8 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
}
void mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);
@@ -616,7 +626,7 @@
void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
struct napi_struct *napi);
void mt76_rx_poll_complete(struct mt76_dev *dev, enum mt76_rxq_id q,
-@@ -1496,6 +1510,12 @@ struct mt76_txwi_cache *
+@@ -1496,6 +1511,12 @@ struct mt76_txwi_cache *
mt76_token_release(struct mt76_dev *dev, int token, bool *wake);
int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi);
void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked);
@@ -630,7 +640,7 @@
static inline void mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)
{
diff --git a/mt7603/dma.c b/mt7603/dma.c
-index 590cff9d..2ff71c53 100644
+index 590cff9..2ff71c5 100644
--- a/mt7603/dma.c
+++ b/mt7603/dma.c
@@ -69,7 +69,7 @@ free:
@@ -643,7 +653,7 @@
struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76);
__le32 *rxd = (__le32 *)skb->data;
diff --git a/mt7603/mt7603.h b/mt7603/mt7603.h
-index 0fd46d90..f2ce22ae 100644
+index 0fd46d9..f2ce22a 100644
--- a/mt7603/mt7603.h
+++ b/mt7603/mt7603.h
@@ -244,7 +244,7 @@ int mt7603_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -656,7 +666,7 @@
void mt7603_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps);
int mt7603_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
diff --git a/mt7615/mac.c b/mt7615/mac.c
-index 37286276..14cdd9a2 100644
+index 3728627..14cdd9a 100644
--- a/mt7615/mac.c
+++ b/mt7615/mac.c
@@ -1648,7 +1648,7 @@ bool mt7615_rx_check(struct mt76_dev *mdev, void *data, int len)
@@ -669,7 +679,7 @@
struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
__le32 *rxd = (__le32 *)skb->data;
diff --git a/mt7615/mt7615.h b/mt7615/mt7615.h
-index 25880d1a..983469c7 100644
+index 25880d1..983469c 100644
--- a/mt7615/mt7615.h
+++ b/mt7615/mt7615.h
@@ -511,7 +511,7 @@ void mt7615_tx_worker(struct mt76_worker *w);
@@ -682,7 +692,7 @@
int mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta);
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index cd350689..24548469 100644
+index cd35068..2454846 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -1190,6 +1190,7 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
@@ -730,7 +740,7 @@
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_add_key);
diff --git a/mt76x02.h b/mt76x02.h
-index f76fd22e..0b872af1 100644
+index f76fd22..0b872af 100644
--- a/mt76x02.h
+++ b/mt76x02.h
@@ -173,7 +173,7 @@ int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u32 val);
@@ -743,7 +753,7 @@
irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance);
void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
diff --git a/mt76x02_txrx.c b/mt76x02_txrx.c
-index 96fdf423..bf24d3e0 100644
+index 96fdf42..bf24d3e 100644
--- a/mt76x02_txrx.c
+++ b/mt76x02_txrx.c
@@ -33,7 +33,7 @@ void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
@@ -756,7 +766,7 @@
struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
void *rxwi = skb->data;
diff --git a/mt7915/dma.c b/mt7915/dma.c
-index 71223221..ac98e01b 100644
+index 7122322..ac98e01 100644
--- a/mt7915/dma.c
+++ b/mt7915/dma.c
@@ -376,6 +376,8 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
@@ -790,8 +800,28 @@
ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_EXT],
MT_RXQ_ID(MT_RXQ_EXT),
MT7915_RX_RING_SIZE,
+diff --git a/mt7915/init.c b/mt7915/init.c
+index b549fa0..eb321b7 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -695,6 +695,15 @@ mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2)
+ return ret;
+ }
+
++ /* wds workaround for mt7986 */
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7986(&dev->mt76)) {
++ for(idx = MT7915_WTBL_WDS_START; idx < MT7915_WTBL_WDS_END; idx++)
++ mt76_wcid_mask_set(dev->mt76.wcid_mask, idx);
++
++ for (idx = 0; idx < DIV_ROUND_UP(MT7915_WTBL_STA, 32); idx++)
++ dev->mt76.wcid_wds_mask[idx] = ~dev->mt76.wcid_mask[idx];
++ }
++
+ /* Beacon and mgmt frames should occupy wcid 0 */
+ idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
+ if (idx)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index db21d83e..1f8e1230 100644
+index db21d83..1f8e123 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -217,7 +217,7 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev)
@@ -939,11 +969,62 @@
mt76_rx(&dev->mt76, q, skb);
return;
}
+diff --git a/mt7915/main.c b/mt7915/main.c
+index 2e721cd..9c808ff 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -670,8 +670,15 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+ #endif
+ int ret, idx;
+ u32 addr;
++ bool wed_wds = false;
+
+- idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
++ if (mtk_wed_device_active(&mdev->mmio.wed))
++ wed_wds = !!test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
++
++ if (wed_wds)
++ idx = mt76_wcid_alloc(mdev->wcid_wds_mask, MT7915_WTBL_STA);
++ else
++ idx = mt76_wcid_alloc(mdev->wcid_mask, MT7915_WTBL_STA);
+ if (idx < 0)
+ return -ENOSPC;
+
+@@ -1107,6 +1114,13 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
+ else
+ clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
+
++ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
++ (msta->wcid.idx < MT7915_WTBL_WDS_START ||
++ msta->wcid.idx > MT7915_WTBL_WDS_END)) {
++ mt7915_sta_remove(hw, vif, sta);
++ mt7915_sta_add(hw, vif, sta);
++ }
++
+ mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
+ }
+
+@@ -1449,9 +1463,12 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
+ /* fw will find the wcid by dest addr */
+ if(is_mt7915(&dev->mt76))
+ path->mtk_wdma.wcid = 0xff;
+- else
+- path->mtk_wdma.wcid = 0x3ff;
+-
++ else {
++ if (test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags))
++ path->mtk_wdma.wcid = msta->wcid.idx;
++ else
++ path->mtk_wdma.wcid = 0x3ff;
++ }
+ path->mtk_wdma.queue = phy != &dev->phy;
+
+ ctx->dev = NULL;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 674cbc4e..0ae6daf3 100644
+index 9e9a2ea..dfa7311 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -1723,6 +1723,7 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
+@@ -1719,6 +1719,7 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, bool enable)
{
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
@@ -951,7 +1032,7 @@
struct mt7915_sta *msta;
struct sk_buff *skb;
int ret;
-@@ -1775,6 +1776,8 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
+@@ -1771,6 +1772,8 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
return ret;
}
out:
@@ -960,8 +1041,45 @@
return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_EXT_CMD(STA_REC_UPDATE), true);
}
+@@ -2348,6 +2351,7 @@ mt7915_mcu_init_rx_airtime(struct mt7915_dev *dev)
+ int mt7915_run_firmware(struct mt7915_dev *dev)
+ {
+ int ret;
++ struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
+
+ /* force firmware operation mode into normal state,
+ * which should be set before firmware download stage.
+@@ -2377,8 +2381,14 @@ int mt7915_run_firmware(struct mt7915_dev *dev)
+ if (ret)
+ return ret;
+
+- if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7915(&dev->mt76))
+- mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY), 0, 0, 0);
++ if (mtk_wed_device_active(wed)) {
++ if (wed->ver == MTK_WED_V1)
++ mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY),
++ 0, 0, 0);
++ mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(SET),
++ MCU_WA_PARAM_WED_VERSION,
++ wed->rev_id, 0);
++ }
+
+ ret = mt7915_mcu_set_mwds(dev, 1);
+ if (ret)
+diff --git a/mt7915/mcu.h b/mt7915/mcu.h
+index b8a433e..ce50e60 100644
+--- a/mt7915/mcu.h
++++ b/mt7915/mcu.h
+@@ -268,6 +268,7 @@ enum {
+ MCU_WA_PARAM_RED_SHOW_STA = 0xf,
+ MCU_WA_PARAM_RED_TARGET_DELAY = 0x10,
+ #endif
++ MCU_WA_PARAM_WED_VERSION = 0x32,
+ };
+
+ enum mcu_mmps_mode {
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index b4a3120d..08ff556e 100644
+index b4a3120..08ff556 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -28,6 +28,9 @@ static const u32 mt7915_reg[] = {
@@ -1042,10 +1160,20 @@
dev->mt76.dma_dev = wed->dev;
mdev->token_size = wed->wlan.token_start;
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 39127922..22399cc7 100644
+index 3912792..97eac73 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -78,6 +78,7 @@
+@@ -18,6 +18,9 @@
+ #define MT7915_WTBL_STA (MT7915_WTBL_RESERVED - \
+ MT7915_MAX_INTERFACES)
+
++#define MT7915_WTBL_WDS_START 256
++#define MT7915_WTBL_WDS_END 274
++
+ #define MT7915_WATCHDOG_TIME (HZ / 10)
+ #define MT7915_RESET_TIMEOUT (30 * HZ)
+
+@@ -78,6 +81,7 @@
#define MT7915_MAX_STA_TWT_AGRT 8
#define MT7915_MIN_TWT_DUR 64
#define MT7915_MAX_QUEUE (__MT_RXQ_MAX + __MT_MCUQ_MAX + 2)
@@ -1053,7 +1181,7 @@
struct mt7915_vif;
struct mt7915_sta;
-@@ -541,7 +542,9 @@ void mt7915_wfsys_reset(struct mt7915_dev *dev);
+@@ -541,7 +545,9 @@ void mt7915_wfsys_reset(struct mt7915_dev *dev);
irqreturn_t mt7915_irq_handler(int irq, void *dev_instance);
u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif);
u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
@@ -1064,7 +1192,7 @@
int mt7915_register_device(struct mt7915_dev *dev);
void mt7915_unregister_device(struct mt7915_dev *dev);
int mt7915_eeprom_init(struct mt7915_dev *dev);
-@@ -693,7 +696,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+@@ -693,7 +699,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
struct mt76_tx_info *tx_info);
void mt7915_tx_token_put(struct mt7915_dev *dev);
void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
@@ -1074,7 +1202,7 @@
void mt7915_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps);
void mt7915_stats_work(struct work_struct *work);
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index ffda5f6b..08bf84ce 100644
+index ffda5f6..08bf84c 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -33,6 +33,9 @@ enum reg_rev {
@@ -1120,7 +1248,7 @@
#define MT_INT_SOURCE_CSR __REG(INT_SOURCE_CSR)
#define MT_INT_MASK_CSR __REG(INT_MASK_CSR)
diff --git a/mt7921/mac.c b/mt7921/mac.c
-index 4fcadf86..4897940b 100644
+index 4fcadf8..4897940 100644
--- a/mt7921/mac.c
+++ b/mt7921/mac.c
@@ -555,7 +555,7 @@ out:
@@ -1133,7 +1261,7 @@
struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
__le32 *rxd = (__le32 *)skb->data;
diff --git a/mt7921/mt7921.h b/mt7921/mt7921.h
-index efeb82cb..4b2e974b 100644
+index efeb82c..4b2e974 100644
--- a/mt7921/mt7921.h
+++ b/mt7921/mt7921.h
@@ -388,7 +388,7 @@ int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -1155,7 +1283,7 @@
int mt7921e_mac_reset(struct mt7921_dev *dev);
int mt7921e_mcu_init(struct mt7921_dev *dev);
diff --git a/mt7921/pci_mac.c b/mt7921/pci_mac.c
-index e1800674..ca982eb5 100644
+index e180067..ca982eb 100644
--- a/mt7921/pci_mac.c
+++ b/mt7921/pci_mac.c
@@ -182,7 +182,7 @@ bool mt7921e_rx_check(struct mt76_dev *mdev, void *data, int len)
@@ -1177,7 +1305,7 @@
}
}
diff --git a/tx.c b/tx.c
-index ae44afe0..bccd206e 100644
+index ae44afe..bccd206 100644
--- a/tx.c
+++ b/tx.c
@@ -767,3 +767,37 @@ mt76_token_release(struct mt76_dev *dev, int token, bool *wake)
@@ -1219,5 +1347,5 @@
+}
+EXPORT_SYMBOL_GPL(mt76_rx_token_release);
--
-2.25.1
+2.18.0
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/3003-mt76-add-fill-receive-path-to-report-wed-idx.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/3003-mt76-add-fill-receive-path-to-report-wed-idx.patch
index 19e0e99..37ebdd1 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/3003-mt76-add-fill-receive-path-to-report-wed-idx.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/3003-mt76-add-fill-receive-path-to-report-wed-idx.patch
@@ -1,18 +1,18 @@
-From 4206557087f5b77b3993818b70885e21d7dcffbb Mon Sep 17 00:00:00 2001
+From 552c7b193e72472b522153449f195fbb46f2b6ed Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Thu, 19 May 2022 13:44:42 +0800
Subject: [PATCH 3003/3003] mt76: add fill receive path to report wed idx
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
- .../net/wireless/mediatek/mt76/mt7915/main.c | 19 +++++++++++++++++++
+ mt7915/main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/mt7915/main.c b/mt7915/main.c
-index 2e721cd0..cfc522f7 100644
+index 9c808ff..74c6f7c 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -1458,6 +1458,24 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1475,6 +1475,24 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
return 0;
}
@@ -37,7 +37,7 @@
#endif
const struct ieee80211_ops mt7915_ops = {
-@@ -1509,5 +1527,6 @@ const struct ieee80211_ops mt7915_ops = {
+@@ -1526,5 +1544,6 @@ const struct ieee80211_ops mt7915_ops = {
.set_radar_background = mt7915_set_radar_background,
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
.net_fill_forward_path = mt7915_net_fill_forward_path,
@@ -45,5 +45,5 @@
#endif
};
--
-2.25.1
+2.18.0
diff --git a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9997-add-wed-rx-support-for-mt7896.patch b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9997-add-wed-rx-support-for-mt7896.patch
index 3df0ab7..8913f3f 100755
--- a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9997-add-wed-rx-support-for-mt7896.patch
+++ b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/9997-add-wed-rx-support-for-mt7896.patch
@@ -8,14 +8,14 @@
arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 42 +-
arch/arm64/boot/dts/mediatek/mt7986b.dtsi | 42 +-
drivers/net/ethernet/mediatek/Makefile | 2 +-
- drivers/net/ethernet/mediatek/mtk_wed.c | 613 ++++++++++++++++--
+ drivers/net/ethernet/mediatek/mtk_wed.c | 620 ++++++++++++++++--
drivers/net/ethernet/mediatek/mtk_wed.h | 51 ++
drivers/net/ethernet/mediatek/mtk_wed_ccif.c | 133 ++++
drivers/net/ethernet/mediatek/mtk_wed_ccif.h | 45 ++
.../net/ethernet/mediatek/mtk_wed_debugfs.c | 90 +++
drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 561 ++++++++++++++++
drivers/net/ethernet/mediatek/mtk_wed_mcu.h | 125 ++++
- drivers/net/ethernet/mediatek/mtk_wed_regs.h | 147 ++++-
+ drivers/net/ethernet/mediatek/mtk_wed_regs.h | 148 ++++-
drivers/net/ethernet/mediatek/mtk_wed_wo.c | 588 +++++++++++++++++
drivers/net/ethernet/mediatek/mtk_wed_wo.h | 336 ++++++++++
include/linux/soc/mediatek/mtk_wed.h | 63 +-
@@ -719,7 +719,7 @@
static void
-mtk_wed_ring_reset(struct mtk_wdma_desc *desc, int size, int scale)
+mtk_wed_rx_hw_init(struct mtk_wed_device *dev)
-+{
+ {
+ wed_w32(dev, MTK_WED_WPDMA_RX_D_RST_IDX,
+ MTK_WED_WPDMA_RX_D_RST_CRX_IDX0 |
+ MTK_WED_WPDMA_RX_D_RST_CRX_IDX1 |
@@ -748,7 +748,7 @@
+
+static void
+mtk_wed_ring_reset(struct mtk_wdma_desc *desc, int size, int scale, bool tx)
- {
++{
+ __le32 ctrl;
int i;
@@ -991,8 +991,23 @@
mtk_wed_set_512_support(dev, true);
}
-@@ -841,9 +1330,17 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+@@ -809,6 +1298,7 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+ __releases(RCU)
+ {
+ struct mtk_wed_hw *hw;
++ u16 ver;
+ int ret = 0;
+
+ RCU_LOCKDEP_WARN(!rcu_read_lock_held(),
+@@ -839,11 +1329,24 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+
+ dev->ver = FIELD_GET(MTK_WED_REV_ID_MAJOR,
wed_r32(dev, MTK_WED_REV_ID));
++ if (dev->ver > MTK_WED_V1)
++ ver = FIELD_GET(MTK_WED_REV_ID_MINOR,
++ wed_r32(dev, MTK_WED_REV_ID));
++
++ dev->rev_id = ((dev->ver << 28) | ver << 16);
ret = mtk_wed_buffer_alloc(dev);
- if (ret) {
@@ -1012,7 +1027,7 @@
}
mtk_wed_hw_init_early(dev);
-@@ -851,7 +1348,12 @@ mtk_wed_attach(struct mtk_wed_device *dev)
+@@ -851,7 +1354,12 @@ mtk_wed_attach(struct mtk_wed_device *dev)
if (dev->ver == MTK_WED_V1)
regmap_update_bits(hw->hifsys, HIFSYS_DMA_AG_MAP,
BIT(hw->index), 0);
@@ -1025,7 +1040,7 @@
out:
mutex_unlock(&hw_lock);
-@@ -877,10 +1379,10 @@ mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx, void __iomem *regs)
+@@ -877,10 +1385,10 @@ mtk_wed_tx_ring_setup(struct mtk_wed_device *dev, int idx, void __iomem *regs)
BUG_ON(idx > ARRAY_SIZE(dev->tx_ring));
@@ -1038,7 +1053,7 @@
return -ENOMEM;
ring->reg_base = MTK_WED_RING_TX(idx);
-@@ -927,6 +1429,35 @@ mtk_wed_txfree_ring_setup(struct mtk_wed_device *dev, void __iomem *regs)
+@@ -927,6 +1435,35 @@ mtk_wed_txfree_ring_setup(struct mtk_wed_device *dev, void __iomem *regs)
return 0;
}
@@ -1074,7 +1089,7 @@
static u32
mtk_wed_irq_get(struct mtk_wed_device *dev, u32 mask)
{
-@@ -1014,6 +1545,8 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1014,6 +1551,8 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
.attach = mtk_wed_attach,
.tx_ring_setup = mtk_wed_tx_ring_setup,
.txfree_ring_setup = mtk_wed_txfree_ring_setup,
@@ -1083,7 +1098,7 @@
.start = mtk_wed_start,
.stop = mtk_wed_stop,
.reset_dma = mtk_wed_reset_dma,
-@@ -1022,6 +1555,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
+@@ -1022,6 +1561,7 @@ void mtk_wed_add_hw(struct device_node *np, struct mtk_eth *eth,
.irq_get = mtk_wed_irq_get,
.irq_set_mask = mtk_wed_irq_set_mask,
.detach = mtk_wed_detach,
@@ -2224,7 +2239,7 @@
+
+#endif
diff --git a/drivers/net/ethernet/mediatek/mtk_wed_regs.h b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
-index e107de7..64a2483 100644
+index e107de7..c3bd660 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_regs.h
+++ b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
@@ -4,6 +4,8 @@
@@ -2244,7 +2259,15 @@
struct mtk_wdma_desc {
__le32 buf0;
-@@ -41,6 +44,8 @@ struct mtk_wdma_desc {
+@@ -31,6 +34,7 @@ struct mtk_wdma_desc {
+ #define MTK_WED_REV_ID 0x000
+ #define MTK_WED_REV_ID_MAJOR GENMASK(7, 0)
+ #endif
++#define MTK_WED_REV_ID_MINOR GENMASK(27, 16)
+
+ #define MTK_WED_RESET 0x008
+ #define MTK_WED_RESET_TX_BM BIT(0)
+@@ -41,6 +45,8 @@ struct mtk_wdma_desc {
#define MTK_WED_RESET_WED_TX_DMA BIT(12)
#define MTK_WED_RESET_WDMA_RX_DRV BIT(17)
#define MTK_WED_RESET_WDMA_INT_AGENT BIT(19)
@@ -2253,7 +2276,7 @@
#define MTK_WED_RESET_WED BIT(31)
#define MTK_WED_CTRL 0x00c
-@@ -52,8 +57,12 @@ struct mtk_wdma_desc {
+@@ -52,8 +58,12 @@ struct mtk_wdma_desc {
#define MTK_WED_CTRL_WED_TX_BM_BUSY BIT(9)
#define MTK_WED_CTRL_WED_TX_FREE_AGENT_EN BIT(10)
#define MTK_WED_CTRL_WED_TX_FREE_AGENT_BUSY BIT(11)
@@ -2268,7 +2291,7 @@
#define MTK_WED_CTRL_FINAL_DIDX_READ BIT(24)
#define MTK_WED_CTRL_ETH_DMAD_FMT BIT(25)
#define MTK_WED_CTRL_MIB_READ_CLEAR BIT(28)
-@@ -68,8 +77,8 @@ struct mtk_wdma_desc {
+@@ -68,8 +78,8 @@ struct mtk_wdma_desc {
#define MTK_WED_EXT_INT_STATUS_TX_TKID_LO_TH BIT(10)
#define MTK_WED_EXT_INT_STATUS_TX_TKID_HI_TH BIT(11)
#endif
@@ -2279,7 +2302,7 @@
#define MTK_WED_EXT_INT_STATUS_RX_DRV_R_RESP_ERR BIT(16)
#define MTK_WED_EXT_INT_STATUS_RX_DRV_W_RESP_ERR BIT(17)
#define MTK_WED_EXT_INT_STATUS_RX_DRV_COHERENT BIT(18)
-@@ -86,8 +95,8 @@ struct mtk_wdma_desc {
+@@ -86,8 +96,8 @@ struct mtk_wdma_desc {
#define MTK_WED_EXT_INT_STATUS_ERROR_MASK (MTK_WED_EXT_INT_STATUS_TF_LEN_ERR | \
MTK_WED_EXT_INT_STATUS_TKID_WO_PYLD | \
MTK_WED_EXT_INT_STATUS_TKID_TITO_INVALID | \
@@ -2290,7 +2313,7 @@
MTK_WED_EXT_INT_STATUS_RX_DRV_R_RESP_ERR | \
MTK_WED_EXT_INT_STATUS_RX_DRV_W_RESP_ERR | \
MTK_WED_EXT_INT_STATUS_RX_DRV_COHERENT | \
-@@ -96,6 +105,8 @@ struct mtk_wdma_desc {
+@@ -96,6 +106,8 @@ struct mtk_wdma_desc {
MTK_WED_EXT_INT_STATUS_TX_DMA_W_RESP_ERR)
#define MTK_WED_EXT_INT_MASK 0x028
@@ -2299,7 +2322,7 @@
#define MTK_WED_STATUS 0x060
#define MTK_WED_STATUS_TX GENMASK(15, 8)
-@@ -183,6 +194,9 @@ struct mtk_wdma_desc {
+@@ -183,6 +195,9 @@ struct mtk_wdma_desc {
#define MTK_WED_RING_RX(_n) (0x400 + (_n) * 0x10)
@@ -2309,7 +2332,7 @@
#define MTK_WED_WPDMA_INT_TRIGGER 0x504
#define MTK_WED_WPDMA_INT_TRIGGER_RX_DONE BIT(1)
#define MTK_WED_WPDMA_INT_TRIGGER_TX_DONE GENMASK(5, 4)
-@@ -239,13 +253,19 @@ struct mtk_wdma_desc {
+@@ -239,13 +254,19 @@ struct mtk_wdma_desc {
#define MTK_WED_WPDMA_INT_CTRL_TX 0x530
#define MTK_WED_WPDMA_INT_CTRL_TX0_DONE_EN BIT(0)
@@ -2330,7 +2353,7 @@
#define MTK_WED_WPDMA_INT_CTRL_TX_FREE 0x538
#define MTK_WED_WPDMA_INT_CTRL_TX_FREE_DONE_EN BIT(0)
-@@ -270,13 +290,43 @@ struct mtk_wdma_desc {
+@@ -270,13 +291,43 @@ struct mtk_wdma_desc {
#define MTK_WED_WPDMA_TX_MIB(_n) (0x5a0 + (_n) * 4)
#define MTK_WED_WPDMA_TX_COHERENT_MIB(_n) (0x5d0 + (_n) * 4)
@@ -2374,7 +2397,7 @@
#define MTK_WED_WDMA_GLO_CFG_RX_DRV_EN BIT(2)
#define MTK_WED_WDMA_GLO_CFG_RX_DRV_BUSY BIT(3)
#define MTK_WED_WDMA_GLO_CFG_BT_SIZE GENMASK(5, 4)
-@@ -320,6 +370,20 @@ struct mtk_wdma_desc {
+@@ -320,6 +371,20 @@ struct mtk_wdma_desc {
#define MTK_WED_WDMA_RX_RECYCLE_MIB(_n) (0xae8 + (_n) * 4)
#define MTK_WED_WDMA_RX_PROCESSED_MIB(_n) (0xaf0 + (_n) * 4)
@@ -2395,7 +2418,7 @@
#define MTK_WED_RING_OFS_BASE 0x00
#define MTK_WED_RING_OFS_COUNT 0x04
#define MTK_WED_RING_OFS_CPU_IDX 0x08
-@@ -330,7 +394,9 @@ struct mtk_wdma_desc {
+@@ -330,7 +395,9 @@ struct mtk_wdma_desc {
#define MTK_WDMA_GLO_CFG 0x204
#define MTK_WDMA_GLO_CFG_TX_DMA_EN BIT(0)
@@ -2405,7 +2428,7 @@
#define MTK_WDMA_GLO_CFG_RX_INFO3_PRERES BIT(26)
#define MTK_WDMA_GLO_CFG_RX_INFO2_PRERES BIT(27)
#define MTK_WDMA_GLO_CFG_RX_INFO1_PRERES BIT(28)
-@@ -359,4 +425,71 @@ struct mtk_wdma_desc {
+@@ -359,4 +426,71 @@ struct mtk_wdma_desc {
/* DMA channel mapping */
#define HIFSYS_DMA_AG_MAP 0x008
@@ -3452,7 +3475,12 @@
struct mtk_wed_device {
#ifdef CONFIG_NET_MEDIATEK_SOC_WED
const struct mtk_wed_ops *ops;
-@@ -46,19 +67,27 @@ struct mtk_wed_device {
+@@ -42,39 +63,57 @@ struct mtk_wed_device {
+ int wdma_idx;
+ int irq;
+ u8 ver;
++ u32 rev_id;
+
struct mtk_wed_ring tx_ring[MTK_WED_TX_QUEUES];
struct mtk_wed_ring txfree_ring;
struct mtk_wed_ring tx_wdma[MTK_WED_TX_QUEUES];
@@ -3483,9 +3511,8 @@
u32 bus_type;
+ u32 phy_base;
- union {
- u32 wpdma_phys;
-@@ -67,16 +96,25 @@ struct mtk_wed_device {
+ u32 wpdma_phys;
+ u32 wpdma_int;
u32 wpdma_mask;
u32 wpdma_tx;
u32 wpdma_txfree;
@@ -3511,7 +3538,7 @@
} wlan;
#endif
};
-@@ -87,6 +125,10 @@ struct mtk_wed_ops {
+@@ -85,6 +124,10 @@ struct mtk_wed_ops {
void __iomem *regs);
int (*txfree_ring_setup)(struct mtk_wed_device *dev,
void __iomem *regs);
@@ -3522,16 +3549,16 @@
void (*detach)(struct mtk_wed_device *dev);
void (*stop)(struct mtk_wed_device *dev);
-@@ -98,6 +140,8 @@ struct mtk_wed_ops {
+@@ -96,6 +139,8 @@ struct mtk_wed_ops {
u32 (*irq_get)(struct mtk_wed_device *dev, u32 mask);
void (*irq_set_mask)(struct mtk_wed_device *dev, u32 mask);
-+ void (*ppe_check)(struct mtk_wed_device *dev, struct sk_buff *skb,
++ void (*ppe_check)(struct mtk_wed_device *dev, struct sk_buff *skb,
+ u32 reason, u32 hash);
};
extern const struct mtk_wed_ops __rcu *mtk_soc_wed_ops;
-@@ -130,6 +174,10 @@ mtk_wed_device_attach(struct mtk_wed_device *dev)
+@@ -128,6 +173,10 @@ mtk_wed_device_attach(struct mtk_wed_device *dev)
(_dev)->ops->tx_ring_setup(_dev, _ring, _regs)
#define mtk_wed_device_txfree_ring_setup(_dev, _regs) \
(_dev)->ops->txfree_ring_setup(_dev, _regs)
@@ -3542,7 +3569,7 @@
#define mtk_wed_device_reg_read(_dev, _reg) \
(_dev)->ops->reg_read(_dev, _reg)
#define mtk_wed_device_reg_write(_dev, _reg, _val) \
-@@ -138,6 +186,8 @@ mtk_wed_device_attach(struct mtk_wed_device *dev)
+@@ -136,6 +185,8 @@ mtk_wed_device_attach(struct mtk_wed_device *dev)
(_dev)->ops->irq_get(_dev, _mask)
#define mtk_wed_device_irq_set_mask(_dev, _mask) \
(_dev)->ops->irq_set_mask(_dev, _mask)
@@ -3551,7 +3578,7 @@
#else
static inline bool mtk_wed_device_active(struct mtk_wed_device *dev)
{
-@@ -147,10 +197,13 @@ static inline bool mtk_wed_device_active(struct mtk_wed_device *dev)
+@@ -145,10 +196,13 @@ static inline bool mtk_wed_device_active(struct mtk_wed_device *dev)
#define mtk_wed_device_start(_dev, _mask) do {} while (0)
#define mtk_wed_device_tx_ring_setup(_dev, _ring, _regs) -ENODEV
#define mtk_wed_device_txfree_ring_setup(_dev, _ring, _regs) -ENODEV