mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 15:02:32 +00:00
d59d69f9e1
Manually rebased: backport-5.15/704-15-v5.19-net-mtk_eth_soc-move-MAC_MCR-setting-to-mac_finish.patch Removed upstreamed: backport-5.15/060-v6.0-01-tools-build-Add-feature-test-for-init_disassemble_in.patch[1] backport-5.15/060-v6.0-02-tools-include-add-dis-asm-compat.h-to-handle-version.patch[2] backport-5.15/060-v6.0-03-tools-perf-Fix-compilation-error-with-new-binutils.patch[3] backport-5.15/060-v6.0-04-tools-bpf_jit_disasm-Fix-compilation-error-with-new-.patch[4] backport-5.15/060-v6.0-05-tools-bpftool-Fix-compilation-error-with-new-binutil.patch[5] pending-5.15/733-02-net-ethernet-mtk_eth_soc-fix-RX-data-corruption-issu.patch[6] bcm47xx/patches-5.15/170-bgmac-fix-initial-chip-reset-to-support-BCM5358.patch[7] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=51b99dc38c1a053e2e732d7f9e2740e343ae7eae 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=451c9d7b16169645ed291ebb2ca9844caa088f2d 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=97f005c0bdbaf656a7808586d234965385a06c58 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=1c27fab243333821375e4d63128d60093fdbe149 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=4441a90091931fd81607567961dc122f24f735bb 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=2adc29350a5b4669544566f71f208d2abaec60ab 7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.103&id=04bfc5bcdfc0fdb73587487c71b04d63807ae15a Build system: x86_64 Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia <therealgraysky@proton.me>
136 lines
4.3 KiB
Diff
136 lines
4.3 KiB
Diff
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Date: Fri, 20 May 2022 20:11:37 +0200
|
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: convert ring dma pointer to void
|
|
|
|
Simplify the code converting {tx,rx} ring dma pointer to void
|
|
|
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
---
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
@@ -947,18 +947,15 @@ static int mtk_init_fq_dma(struct mtk_et
|
|
return 0;
|
|
}
|
|
|
|
-static inline void *mtk_qdma_phys_to_virt(struct mtk_tx_ring *ring, u32 desc)
|
|
+static void *mtk_qdma_phys_to_virt(struct mtk_tx_ring *ring, u32 desc)
|
|
{
|
|
- void *ret = ring->dma;
|
|
-
|
|
- return ret + (desc - ring->phys);
|
|
+ return ring->dma + (desc - ring->phys);
|
|
}
|
|
|
|
static struct mtk_tx_buf *mtk_desc_to_tx_buf(struct mtk_tx_ring *ring,
|
|
- struct mtk_tx_dma *txd,
|
|
- u32 txd_size)
|
|
+ void *txd, u32 txd_size)
|
|
{
|
|
- int idx = ((void *)txd - (void *)ring->dma) / txd_size;
|
|
+ int idx = (txd - ring->dma) / txd_size;
|
|
|
|
return &ring->buf[idx];
|
|
}
|
|
@@ -966,13 +963,12 @@ static struct mtk_tx_buf *mtk_desc_to_tx
|
|
static struct mtk_tx_dma *qdma_to_pdma(struct mtk_tx_ring *ring,
|
|
struct mtk_tx_dma *dma)
|
|
{
|
|
- return ring->dma_pdma - ring->dma + dma;
|
|
+ return ring->dma_pdma - (struct mtk_tx_dma *)ring->dma + dma;
|
|
}
|
|
|
|
-static int txd_to_idx(struct mtk_tx_ring *ring, struct mtk_tx_dma *dma,
|
|
- u32 txd_size)
|
|
+static int txd_to_idx(struct mtk_tx_ring *ring, void *dma, u32 txd_size)
|
|
{
|
|
- return ((void *)dma - (void *)ring->dma) / txd_size;
|
|
+ return (dma - ring->dma) / txd_size;
|
|
}
|
|
|
|
static void mtk_tx_unmap(struct mtk_eth *eth, struct mtk_tx_buf *tx_buf,
|
|
@@ -1389,7 +1385,7 @@ static struct mtk_rx_ring *mtk_get_rx_ri
|
|
|
|
ring = ð->rx_ring[i];
|
|
idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size);
|
|
- rxd = (void *)ring->dma + idx * eth->soc->txrx.rxd_size;
|
|
+ rxd = ring->dma + idx * eth->soc->txrx.rxd_size;
|
|
if (rxd->rxd2 & RX_DMA_DONE) {
|
|
ring->calc_idx_update = true;
|
|
return ring;
|
|
@@ -1441,7 +1437,7 @@ static int mtk_poll_rx(struct napi_struc
|
|
goto rx_done;
|
|
|
|
idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size);
|
|
- rxd = (void *)ring->dma + idx * eth->soc->txrx.rxd_size;
|
|
+ rxd = ring->dma + idx * eth->soc->txrx.rxd_size;
|
|
data = ring->data[idx];
|
|
|
|
if (!mtk_rx_get_desc(eth, &trxd, rxd))
|
|
@@ -1648,7 +1644,7 @@ static int mtk_poll_tx_pdma(struct mtk_e
|
|
|
|
mtk_tx_unmap(eth, tx_buf, true);
|
|
|
|
- desc = (void *)ring->dma + cpu * eth->soc->txrx.txd_size;
|
|
+ desc = ring->dma + cpu * eth->soc->txrx.txd_size;
|
|
ring->last_free = desc;
|
|
atomic_inc(&ring->free_count);
|
|
|
|
@@ -1793,7 +1789,7 @@ static int mtk_tx_alloc(struct mtk_eth *
|
|
int next = (i + 1) % MTK_DMA_SIZE;
|
|
u32 next_ptr = ring->phys + next * sz;
|
|
|
|
- txd = (void *)ring->dma + i * sz;
|
|
+ txd = ring->dma + i * sz;
|
|
txd->txd2 = next_ptr;
|
|
txd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU;
|
|
txd->txd4 = 0;
|
|
@@ -1823,7 +1819,7 @@ static int mtk_tx_alloc(struct mtk_eth *
|
|
|
|
ring->dma_size = MTK_DMA_SIZE;
|
|
atomic_set(&ring->free_count, MTK_DMA_SIZE - 2);
|
|
- ring->next_free = &ring->dma[0];
|
|
+ ring->next_free = ring->dma;
|
|
ring->last_free = (void *)txd;
|
|
ring->last_free_ptr = (u32)(ring->phys + ((MTK_DMA_SIZE - 1) * sz));
|
|
ring->thresh = MAX_SKB_FRAGS;
|
|
@@ -1938,7 +1934,7 @@ static int mtk_rx_alloc(struct mtk_eth *
|
|
if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr)))
|
|
return -ENOMEM;
|
|
|
|
- rxd = (void *)ring->dma + i * eth->soc->txrx.rxd_size;
|
|
+ rxd = ring->dma + i * eth->soc->txrx.rxd_size;
|
|
rxd->rxd1 = (unsigned int)dma_addr;
|
|
|
|
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
|
|
@@ -2000,7 +1996,7 @@ static void mtk_rx_clean(struct mtk_eth
|
|
if (!ring->data[i])
|
|
continue;
|
|
|
|
- rxd = (void *)ring->dma + i * eth->soc->txrx.rxd_size;
|
|
+ rxd = ring->dma + i * eth->soc->txrx.rxd_size;
|
|
if (!rxd->rxd1)
|
|
continue;
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
|
@@ -689,7 +689,7 @@ struct mtk_tx_buf {
|
|
* are present
|
|
*/
|
|
struct mtk_tx_ring {
|
|
- struct mtk_tx_dma *dma;
|
|
+ void *dma;
|
|
struct mtk_tx_buf *buf;
|
|
dma_addr_t phys;
|
|
struct mtk_tx_dma *next_free;
|
|
@@ -719,7 +719,7 @@ enum mtk_rx_flags {
|
|
* @calc_idx: The current head of ring
|
|
*/
|
|
struct mtk_rx_ring {
|
|
- struct mtk_rx_dma *dma;
|
|
+ void *dma;
|
|
u8 **data;
|
|
dma_addr_t phys;
|
|
u16 frag_size;
|