mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 22:23:27 +00:00
521efb62eb
6c256218e59e wifi: mt76: dma: use napi_build_skb 679254c50f27 mt7915: add CONFIG_MT76_LEDS to cflags 15b9dd6b1b6a wifi: mt76: mt7915: call mt7915_mcu_set_thermal_throttling() only after init_work 8e5c21fe7c5c wifi: mt76: mt7915: rework mt7915_mcu_set_thermal_throttling 87cb74fe42d9 wifi: mt76: mt7915: rework mt7915_thermal_temp_store() c6f24b83eba5 wifi: mt76: mt7915: add error message in mt7915_thermal_set_cur_throttle_state() 99e96b89ee4d wifi: mt76: mt7915: add chip id condition in mt7915_check_eeprom() 833cd420480f wifi: mt76: mt7921: fix channel switch fail in monitor mode f1f8bae6092d wifi: mt76: mt7921: add ack signal support f47087a6dd62 wifi: mt76: mt7996: fix chainmask calculation in mt7996_set_antenna() 2f3b0acc1588 wifi: mt76: mt7996: update register for CFEND_RATE 7e9540dcbd70 wifi: mt76: mt7996: do not hardcode vht beamform cap a37e427d0959 wifi: mt76: connac: fix POWER_CTRL command name typo 98aa346042bd wifi: mt76: mt7915: remove BW160 and BW80+80 support 94fed6a43541 wifi: mt76: mt7921: fix invalid remain_on_channel duration 3c162384d80a wifi: mt76: introduce mt76_queue_is_wed_rx utility routine a409a9454587 wifi: mt76: mt7915: fix memory leak in mt7915_mcu_exit 8b27ecd3a684 wifi: mt76: mt7996: fix memory leak in mt7996_mcu_exit 683760461dd0 wifi: mt76: dma: free rx_head in mt76_dma_rx_cleanup 0c750cf08f85 wifi: mt76: dma: fix memory leak running mt76_dma_tx_cleanup 5de9ae29bea2 wifi: mt76: mt7915: avoid mcu_restart function pointer dad96dd3e62d wifi: mt76: mt7603: avoid mcu_restart function pointer 19d36dd9c8ea wifi: mt76: mt7615: avoid mcu_restart function pointer 6fe2c2383d3d wifi: mt76: mt7921: avoid mcu_restart function pointer 9df89143bf71 wifi: mt76: mt7915: get rid of wed rx_buf_ring page_frag_cache 8d51d11760cb wifi: mt76: fix switch default case in mt7996_reverse_frag0_hdr_trans 0d8057dbd51c wifi: mt76: mt7921u: add support for Comfast CF-952AX ddbf4e933d54 wifi: mt76: mt7915: set sku initial value to zero 06a8904e954e wifi: mt76: mt7915: wed: enable red per-band token drop 724a337caef9 wifi: mt76: mt7915: fix WED TxS reporting 747ca943a5bb wifi: mt76: add flexible polling wait-interval support 133d7859977a wifi: mt76: mt7921: reduce polling time in pmctrl 5fe319a0550e wifi: mt76: add memory barrier to SDIO queue kick 822f060b9d19 wifi: mt76: mt7921: fix rx filter incorrect by drv/fw inconsistent c6794954a723 wifi: mt76: mt7915: fix memory leak in mt7915_mmio_wed_init_rx_buf 9686cd7cc65c wifi: mt76: switch to page_pool allocator 04da4eaa8235 wifi: mt76: enable page_pool stats 1af4a911ebcb wifi: mt76: mt7915: release rxwi in mt7915_wed_release_rx_buf e8c10835cf06 wifi: mt76: fix compile error without CONFIG_PAGE_POOL_STATS 0cf0ede7cc42 net: ethernet: mtk_wed: add reset to rx_ring_setup callback 715b3ed9708a net: ethernet: mtk_wed: add reset to tx_ring_setup callback 9107381d0ff3 wifi: mt76: mt7921: fix error code of return in mt7921_acpi_read 36d2a5bf7802 wifi: mt76: mt7996: rely on mt76_connac2_mac_tx_rate_val c67f57d2cda2 wifi: mt76: dma: add reset to mt76_dma_wed_setup signature 3dace36e2941 wifi: mt76: dma: reset wed queues in mt76_dma_rx_reset 4b229d2da562 wifi: mt76: mt7915: add mt7915 wed reset callbacks f83958376085 wifi: mt76: mt7915: complete wed reset support 321edbb414dc wifi: mt76: mt7996: rely on mt76_connac_txp_common structure bdb7dc38a6d1 wifi: mt76: mt7996: rely on mt76_connac_txp_skb_unmap 8688756305c6 wifi: mt76: mt7996: rely on mt76_connac_tx_complete_skb fbf986dbd4c0 wifi: mt76: mt7996: rely on mt76_connac2_mac_decode_he_radiotap adc556cbce37 wifi: mt76: mt7996: avoid mcu_restart function pointer 5eb4e2303be4 wifi: mt76: remove __mt76_mcu_restart macro e7a61c5f70f5 wifi: mt76: add EHT phy type b375845abc10 wifi: mt76: connac: add CMD_CBW_320MHZ 68b17a243332 wifi: mt76: connac: add helpers for EHT capability 02ec1f61b3a2 wifi: mt76: connac: add cmd id related to EHT support 9209294cd81b wifi: mt76: increase wcid size to 1088 5e85136c9b2f wifi: mt76: add EHT rate stats for ethtool a171f672fdeb wifi: mt76: mt7996: add variants support eda8fd62c105 wifi: mt76: mt7996: add helpers for wtbl and interface limit 4a5a9f4cdc3b wifi: mt76: mt7996: rework capability init 06b73c155680 wifi: mt76: mt7996: add EHT capability init ae71a1b8294f wifi: mt76: mt7996: add support for EHT rate report 65bdfae2991d wifi: mt76: mt7996: enable EHT support in firmware b2360d59747c wifi: mt76: mt7996: add EHT beamforming support Signed-off-by: Felix Fietkau <nbd@nbd.name>
144 lines
4.7 KiB
Diff
144 lines
4.7 KiB
Diff
From: Felix Fietkau <nbd@nbd.name>
|
|
Date: Thu, 27 Oct 2022 19:53:57 +0200
|
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: increase tx ring side for
|
|
QDMA devices
|
|
|
|
In order to use the hardware traffic shaper feature, a larger tx ring is
|
|
needed, especially for the scratch ring, which the hardware shaper uses to
|
|
reorder packets.
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
---
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
@@ -900,7 +900,7 @@ static int mtk_init_fq_dma(struct mtk_et
|
|
{
|
|
const struct mtk_soc_data *soc = eth->soc;
|
|
dma_addr_t phy_ring_tail;
|
|
- int cnt = MTK_DMA_SIZE;
|
|
+ int cnt = MTK_QDMA_RING_SIZE;
|
|
dma_addr_t dma_addr;
|
|
int i;
|
|
|
|
@@ -2154,19 +2154,25 @@ static int mtk_tx_alloc(struct mtk_eth *
|
|
struct mtk_tx_ring *ring = ð->tx_ring;
|
|
int i, sz = soc->txrx.txd_size;
|
|
struct mtk_tx_dma_v2 *txd;
|
|
+ int ring_size;
|
|
|
|
- ring->buf = kcalloc(MTK_DMA_SIZE, sizeof(*ring->buf),
|
|
+ if (MTK_HAS_CAPS(soc->caps, MTK_QDMA))
|
|
+ ring_size = MTK_QDMA_RING_SIZE;
|
|
+ else
|
|
+ ring_size = MTK_DMA_SIZE;
|
|
+
|
|
+ ring->buf = kcalloc(ring_size, sizeof(*ring->buf),
|
|
GFP_KERNEL);
|
|
if (!ring->buf)
|
|
goto no_tx_mem;
|
|
|
|
- ring->dma = dma_alloc_coherent(eth->dma_dev, MTK_DMA_SIZE * sz,
|
|
+ ring->dma = dma_alloc_coherent(eth->dma_dev, ring_size * sz,
|
|
&ring->phys, GFP_KERNEL);
|
|
if (!ring->dma)
|
|
goto no_tx_mem;
|
|
|
|
- for (i = 0; i < MTK_DMA_SIZE; i++) {
|
|
- int next = (i + 1) % MTK_DMA_SIZE;
|
|
+ for (i = 0; i < ring_size; i++) {
|
|
+ int next = (i + 1) % ring_size;
|
|
u32 next_ptr = ring->phys + next * sz;
|
|
|
|
txd = ring->dma + i * sz;
|
|
@@ -2186,22 +2192,22 @@ static int mtk_tx_alloc(struct mtk_eth *
|
|
* descriptors in ring->dma_pdma.
|
|
*/
|
|
if (!MTK_HAS_CAPS(soc->caps, MTK_QDMA)) {
|
|
- ring->dma_pdma = dma_alloc_coherent(eth->dma_dev, MTK_DMA_SIZE * sz,
|
|
+ ring->dma_pdma = dma_alloc_coherent(eth->dma_dev, ring_size * sz,
|
|
&ring->phys_pdma, GFP_KERNEL);
|
|
if (!ring->dma_pdma)
|
|
goto no_tx_mem;
|
|
|
|
- for (i = 0; i < MTK_DMA_SIZE; i++) {
|
|
+ for (i = 0; i < ring_size; i++) {
|
|
ring->dma_pdma[i].txd2 = TX_DMA_DESP2_DEF;
|
|
ring->dma_pdma[i].txd4 = 0;
|
|
}
|
|
}
|
|
|
|
- ring->dma_size = MTK_DMA_SIZE;
|
|
- atomic_set(&ring->free_count, MTK_DMA_SIZE - 2);
|
|
+ ring->dma_size = ring_size;
|
|
+ atomic_set(&ring->free_count, ring_size - 2);
|
|
ring->next_free = ring->dma;
|
|
ring->last_free = (void *)txd;
|
|
- ring->last_free_ptr = (u32)(ring->phys + ((MTK_DMA_SIZE - 1) * sz));
|
|
+ ring->last_free_ptr = (u32)(ring->phys + ((ring_size - 1) * sz));
|
|
ring->thresh = MAX_SKB_FRAGS;
|
|
|
|
/* make sure that all changes to the dma ring are flushed before we
|
|
@@ -2213,14 +2219,14 @@ static int mtk_tx_alloc(struct mtk_eth *
|
|
mtk_w32(eth, ring->phys, soc->reg_map->qdma.ctx_ptr);
|
|
mtk_w32(eth, ring->phys, soc->reg_map->qdma.dtx_ptr);
|
|
mtk_w32(eth,
|
|
- ring->phys + ((MTK_DMA_SIZE - 1) * sz),
|
|
+ ring->phys + ((ring_size - 1) * sz),
|
|
soc->reg_map->qdma.crx_ptr);
|
|
mtk_w32(eth, ring->last_free_ptr, soc->reg_map->qdma.drx_ptr);
|
|
mtk_w32(eth, (QDMA_RES_THRES << 8) | QDMA_RES_THRES,
|
|
soc->reg_map->qdma.qtx_cfg);
|
|
} else {
|
|
mtk_w32(eth, ring->phys_pdma, MT7628_TX_BASE_PTR0);
|
|
- mtk_w32(eth, MTK_DMA_SIZE, MT7628_TX_MAX_CNT0);
|
|
+ mtk_w32(eth, ring_size, MT7628_TX_MAX_CNT0);
|
|
mtk_w32(eth, 0, MT7628_TX_CTX_IDX0);
|
|
mtk_w32(eth, MT7628_PST_DTX_IDX0, soc->reg_map->pdma.rst_idx);
|
|
}
|
|
@@ -2238,7 +2244,7 @@ static void mtk_tx_clean(struct mtk_eth
|
|
int i;
|
|
|
|
if (ring->buf) {
|
|
- for (i = 0; i < MTK_DMA_SIZE; i++)
|
|
+ for (i = 0; i < ring->dma_size; i++)
|
|
mtk_tx_unmap(eth, &ring->buf[i], false);
|
|
kfree(ring->buf);
|
|
ring->buf = NULL;
|
|
@@ -2246,14 +2252,14 @@ static void mtk_tx_clean(struct mtk_eth
|
|
|
|
if (ring->dma) {
|
|
dma_free_coherent(eth->dma_dev,
|
|
- MTK_DMA_SIZE * soc->txrx.txd_size,
|
|
+ ring->dma_size * soc->txrx.txd_size,
|
|
ring->dma, ring->phys);
|
|
ring->dma = NULL;
|
|
}
|
|
|
|
if (ring->dma_pdma) {
|
|
dma_free_coherent(eth->dma_dev,
|
|
- MTK_DMA_SIZE * soc->txrx.txd_size,
|
|
+ ring->dma_size * soc->txrx.txd_size,
|
|
ring->dma_pdma, ring->phys_pdma);
|
|
ring->dma_pdma = NULL;
|
|
}
|
|
@@ -2773,7 +2779,7 @@ static void mtk_dma_free(struct mtk_eth
|
|
netdev_reset_queue(eth->netdev[i]);
|
|
if (eth->scratch_ring) {
|
|
dma_free_coherent(eth->dma_dev,
|
|
- MTK_DMA_SIZE * soc->txrx.txd_size,
|
|
+ MTK_QDMA_RING_SIZE * soc->txrx.txd_size,
|
|
eth->scratch_ring, eth->phy_scratch_ring);
|
|
eth->scratch_ring = NULL;
|
|
eth->phy_scratch_ring = 0;
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
|
@@ -27,6 +27,7 @@
|
|
#define MTK_MAX_RX_LENGTH_2K 2048
|
|
#define MTK_TX_DMA_BUF_LEN 0x3fff
|
|
#define MTK_TX_DMA_BUF_LEN_V2 0xffff
|
|
+#define MTK_QDMA_RING_SIZE 2048
|
|
#define MTK_DMA_SIZE 512
|
|
#define MTK_MAC_COUNT 2
|
|
#define MTK_RX_ETH_HLEN (VLAN_ETH_HLEN + ETH_FCS_LEN)
|