mediatek: refresh patches-6.1

Refresh patches for Linux 6.1 which no longer apply cleanly after
adding patches to fix ethernet rx hang issue on MT7981/MT7986.

Fixes: ede34465de ("mediatek: fix ethernet rx hang issue on MT7981/MT7986")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle 2024-01-17 01:48:29 +00:00
parent 3f8ed239a6
commit e1a6c7213f
2 changed files with 48 additions and 48 deletions

View File

@ -15,7 +15,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1238,7 +1238,7 @@ static int mtk_init_fq_dma(struct mtk_et
@@ -1239,7 +1239,7 @@ static int mtk_init_fq_dma(struct mtk_et
eth->scratch_ring = eth->sram_base;
else
eth->scratch_ring = dma_alloc_coherent(eth->dma_dev,
@ -24,7 +24,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
&eth->phy_scratch_ring,
GFP_KERNEL);
if (unlikely(!eth->scratch_ring))
@@ -1254,16 +1254,16 @@ static int mtk_init_fq_dma(struct mtk_et
@@ -1255,16 +1255,16 @@ static int mtk_init_fq_dma(struct mtk_et
if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr)))
return -ENOMEM;
@ -44,7 +44,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
txd->txd3 = TX_DMA_PLEN0(MTK_QDMA_PAGE_SIZE);
txd->txd4 = 0;
@@ -1512,7 +1512,7 @@ static int mtk_tx_map(struct sk_buff *sk
@@ -1513,7 +1513,7 @@ static int mtk_tx_map(struct sk_buff *sk
if (itxd == ring->last_free)
return -ENOMEM;
@ -53,7 +53,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
memset(itx_buf, 0, sizeof(*itx_buf));
txd_info.addr = dma_map_single(eth->dma_dev, skb->data, txd_info.size,
@@ -1553,7 +1553,7 @@ static int mtk_tx_map(struct sk_buff *sk
@@ -1554,7 +1554,7 @@ static int mtk_tx_map(struct sk_buff *sk
memset(&txd_info, 0, sizeof(struct mtk_tx_dma_desc_info));
txd_info.size = min_t(unsigned int, frag_size,
@ -62,7 +62,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
txd_info.qid = queue;
txd_info.last = i == skb_shinfo(skb)->nr_frags - 1 &&
!(frag_size - txd_info.size);
@@ -1566,7 +1566,7 @@ static int mtk_tx_map(struct sk_buff *sk
@@ -1567,7 +1567,7 @@ static int mtk_tx_map(struct sk_buff *sk
mtk_tx_set_dma_desc(dev, txd, &txd_info);
tx_buf = mtk_desc_to_tx_buf(ring, txd,
@ -71,7 +71,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
if (new_desc)
memset(tx_buf, 0, sizeof(*tx_buf));
tx_buf->data = (void *)MTK_DMA_DUMMY_DESC;
@@ -1609,7 +1609,7 @@ static int mtk_tx_map(struct sk_buff *sk
@@ -1610,7 +1610,7 @@ static int mtk_tx_map(struct sk_buff *sk
} else {
int next_idx;
@ -80,7 +80,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
ring->dma_size);
mtk_w32(eth, next_idx, MT7628_TX_CTX_IDX0);
}
@@ -1618,7 +1618,7 @@ static int mtk_tx_map(struct sk_buff *sk
@@ -1619,7 +1619,7 @@ static int mtk_tx_map(struct sk_buff *sk
err_dma:
do {
@ -89,7 +89,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
/* unmap dma */
mtk_tx_unmap(eth, tx_buf, NULL, false);
@@ -1643,7 +1643,7 @@ static int mtk_cal_txd_req(struct mtk_et
@@ -1644,7 +1644,7 @@ static int mtk_cal_txd_req(struct mtk_et
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
frag = &skb_shinfo(skb)->frags[i];
nfrags += DIV_ROUND_UP(skb_frag_size(frag),
@ -98,7 +98,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
}
} else {
nfrags += skb_shinfo(skb)->nr_frags;
@@ -1784,7 +1784,7 @@ static struct mtk_rx_ring *mtk_get_rx_ri
@@ -1785,7 +1785,7 @@ static struct mtk_rx_ring *mtk_get_rx_ri
ring = &eth->rx_ring[i];
idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size);
@ -107,7 +107,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
if (rxd->rxd2 & RX_DMA_DONE) {
ring->calc_idx_update = true;
return ring;
@@ -1952,7 +1952,7 @@ static int mtk_xdp_submit_frame(struct m
@@ -1953,7 +1953,7 @@ static int mtk_xdp_submit_frame(struct m
}
htxd = txd;
@ -116,7 +116,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
memset(tx_buf, 0, sizeof(*tx_buf));
htx_buf = tx_buf;
@@ -1971,7 +1971,7 @@ static int mtk_xdp_submit_frame(struct m
@@ -1972,7 +1972,7 @@ static int mtk_xdp_submit_frame(struct m
goto unmap;
tx_buf = mtk_desc_to_tx_buf(ring, txd,
@ -125,7 +125,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
memset(tx_buf, 0, sizeof(*tx_buf));
n_desc++;
}
@@ -2009,7 +2009,7 @@ static int mtk_xdp_submit_frame(struct m
@@ -2010,7 +2010,7 @@ static int mtk_xdp_submit_frame(struct m
} else {
int idx;
@ -134,7 +134,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
mtk_w32(eth, NEXT_DESP_IDX(idx, ring->dma_size),
MT7628_TX_CTX_IDX0);
}
@@ -2020,7 +2020,7 @@ static int mtk_xdp_submit_frame(struct m
@@ -2021,7 +2021,7 @@ static int mtk_xdp_submit_frame(struct m
unmap:
while (htxd != txd) {
@ -143,7 +143,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
mtk_tx_unmap(eth, tx_buf, NULL, false);
htxd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU;
@@ -2151,7 +2151,7 @@ static int mtk_poll_rx(struct napi_struc
@@ -2152,7 +2152,7 @@ static int mtk_poll_rx(struct napi_struc
goto rx_done;
idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size);
@ -152,7 +152,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
data = ring->data[idx];
if (!mtk_rx_get_desc(eth, &trxd, rxd))
@@ -2286,7 +2286,7 @@ static int mtk_poll_rx(struct napi_struc
@@ -2287,7 +2287,7 @@ static int mtk_poll_rx(struct napi_struc
rxdcsum = &trxd.rxd4;
}
@ -161,7 +161,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
skb->ip_summed = CHECKSUM_UNNECESSARY;
else
skb_checksum_none_assert(skb);
@@ -2410,7 +2410,7 @@ static int mtk_poll_tx_qdma(struct mtk_e
@@ -2411,7 +2411,7 @@ static int mtk_poll_tx_qdma(struct mtk_e
break;
tx_buf = mtk_desc_to_tx_buf(ring, desc,
@ -170,7 +170,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
if (!tx_buf->data)
break;
@@ -2461,7 +2461,7 @@ static int mtk_poll_tx_pdma(struct mtk_e
@@ -2462,7 +2462,7 @@ static int mtk_poll_tx_pdma(struct mtk_e
}
mtk_tx_unmap(eth, tx_buf, &bq, true);
@ -179,7 +179,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
ring->last_free = desc;
atomic_inc(&ring->free_count);
@@ -2551,7 +2551,7 @@ static int mtk_napi_rx(struct napi_struc
@@ -2552,7 +2552,7 @@ static int mtk_napi_rx(struct napi_struc
do {
int rx_done;
@ -188,7 +188,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
reg_map->pdma.irq_status);
rx_done = mtk_poll_rx(napi, budget - rx_done_total, eth);
rx_done_total += rx_done;
@@ -2567,10 +2567,10 @@ static int mtk_napi_rx(struct napi_struc
@@ -2568,10 +2568,10 @@ static int mtk_napi_rx(struct napi_struc
return budget;
} while (mtk_r32(eth, reg_map->pdma.irq_status) &
@ -201,7 +201,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
return rx_done_total;
}
@@ -2579,7 +2579,7 @@ static int mtk_tx_alloc(struct mtk_eth *
@@ -2580,7 +2580,7 @@ static int mtk_tx_alloc(struct mtk_eth *
{
const struct mtk_soc_data *soc = eth->soc;
struct mtk_tx_ring *ring = &eth->tx_ring;
@ -210,7 +210,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
struct mtk_tx_dma_v2 *txd;
int ring_size;
u32 ofs, val;
@@ -2702,14 +2702,14 @@ static void mtk_tx_clean(struct mtk_eth
@@ -2703,14 +2703,14 @@ static void mtk_tx_clean(struct mtk_eth
}
if (!MTK_HAS_CAPS(soc->caps, MTK_SRAM) && ring->dma) {
dma_free_coherent(eth->dma_dev,
@ -227,7 +227,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
ring->dma_pdma, ring->phys_pdma);
ring->dma_pdma = NULL;
}
@@ -2764,15 +2764,15 @@ static int mtk_rx_alloc(struct mtk_eth *
@@ -2765,15 +2765,15 @@ static int mtk_rx_alloc(struct mtk_eth *
if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SRAM) ||
rx_flag != MTK_RX_FLAGS_NORMAL) {
ring->dma = dma_alloc_coherent(eth->dma_dev,
@ -247,7 +247,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
}
if (!ring->dma)
@@ -2783,7 +2783,7 @@ static int mtk_rx_alloc(struct mtk_eth *
@@ -2784,7 +2784,7 @@ static int mtk_rx_alloc(struct mtk_eth *
dma_addr_t dma_addr;
void *data;
@ -256,7 +256,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
if (ring->page_pool) {
data = mtk_page_pool_get_buff(ring->page_pool,
&dma_addr, GFP_KERNEL);
@@ -2874,7 +2874,7 @@ static void mtk_rx_clean(struct mtk_eth
@@ -2875,7 +2875,7 @@ static void mtk_rx_clean(struct mtk_eth
if (!ring->data[i])
continue;
@ -265,7 +265,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
if (!rxd->rxd1)
continue;
@@ -2891,7 +2891,7 @@ static void mtk_rx_clean(struct mtk_eth
@@ -2892,7 +2892,7 @@ static void mtk_rx_clean(struct mtk_eth
if (!in_sram && ring->dma) {
dma_free_coherent(eth->dma_dev,
@ -274,7 +274,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
ring->dma, ring->phys);
ring->dma = NULL;
}
@@ -3254,7 +3254,7 @@ static void mtk_dma_free(struct mtk_eth
@@ -3255,7 +3255,7 @@ static void mtk_dma_free(struct mtk_eth
netdev_reset_queue(eth->netdev[i]);
if (!MTK_HAS_CAPS(soc->caps, MTK_SRAM) && eth->scratch_ring) {
dma_free_coherent(eth->dma_dev,
@ -283,7 +283,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
eth->scratch_ring, eth->phy_scratch_ring);
eth->scratch_ring = NULL;
eth->phy_scratch_ring = 0;
@@ -3304,7 +3304,7 @@ static irqreturn_t mtk_handle_irq_rx(int
@@ -3305,7 +3305,7 @@ static irqreturn_t mtk_handle_irq_rx(int
eth->rx_events++;
if (likely(napi_schedule_prep(&eth->rx_napi))) {
@ -292,7 +292,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
__napi_schedule(&eth->rx_napi);
}
@@ -3330,9 +3330,9 @@ static irqreturn_t mtk_handle_irq(int ir
@@ -3331,9 +3331,9 @@ static irqreturn_t mtk_handle_irq(int ir
const struct mtk_reg_map *reg_map = eth->soc->reg_map;
if (mtk_r32(eth, reg_map->pdma.irq_mask) &
@ -304,7 +304,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
mtk_handle_irq_rx(irq, _eth);
}
if (mtk_r32(eth, reg_map->tx_irq_mask) & MTK_TX_DONE_INT) {
@@ -3350,10 +3350,10 @@ static void mtk_poll_controller(struct n
@@ -3351,10 +3351,10 @@ static void mtk_poll_controller(struct n
struct mtk_eth *eth = mac->hw;
mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
@ -317,7 +317,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
}
#endif
@@ -3516,7 +3516,7 @@ static int mtk_open(struct net_device *d
@@ -3517,7 +3517,7 @@ static int mtk_open(struct net_device *d
napi_enable(&eth->tx_napi);
napi_enable(&eth->rx_napi);
mtk_tx_irq_enable(eth, MTK_TX_DONE_INT);
@ -326,7 +326,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
refcount_set(&eth->dma_refcnt, 1);
}
else
@@ -3599,7 +3599,7 @@ static int mtk_stop(struct net_device *d
@@ -3600,7 +3600,7 @@ static int mtk_stop(struct net_device *d
mtk_gdm_config(eth, MTK_GDMA_DROP_ALL);
mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
@ -335,7 +335,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
napi_disable(&eth->tx_napi);
napi_disable(&eth->rx_napi);
@@ -4075,9 +4075,9 @@ static int mtk_hw_init(struct mtk_eth *e
@@ -4076,9 +4076,9 @@ static int mtk_hw_init(struct mtk_eth *e
/* FE int grouping */
mtk_w32(eth, MTK_TX_DONE_INT, reg_map->pdma.int_grp);
@ -347,7 +347,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP);
if (mtk_is_netsys_v3_or_greater(eth)) {
@@ -5172,11 +5172,15 @@ static const struct mtk_soc_data mt2701_
@@ -5173,11 +5173,15 @@ static const struct mtk_soc_data mt2701_
.required_clks = MT7623_CLKS_BITMAP,
.required_pctl = true,
.version = 1,
@ -368,7 +368,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
@@ -5192,11 +5196,15 @@ static const struct mtk_soc_data mt7621_
@@ -5193,11 +5197,15 @@ static const struct mtk_soc_data mt7621_
.offload_version = 1,
.hash_offset = 2,
.foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
@ -389,7 +389,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
@@ -5214,11 +5222,15 @@ static const struct mtk_soc_data mt7622_
@@ -5215,11 +5223,15 @@ static const struct mtk_soc_data mt7622_
.hash_offset = 2,
.has_accounting = true,
.foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
@ -410,7 +410,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
@@ -5235,11 +5247,15 @@ static const struct mtk_soc_data mt7623_
@@ -5236,11 +5248,15 @@ static const struct mtk_soc_data mt7623_
.hash_offset = 2,
.foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
.disable_pll_modes = true,
@ -431,7 +431,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
@@ -5254,11 +5270,15 @@ static const struct mtk_soc_data mt7629_
@@ -5255,11 +5271,15 @@ static const struct mtk_soc_data mt7629_
.required_pctl = false,
.has_accounting = true,
.version = 1,
@ -452,7 +452,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
@@ -5276,11 +5296,15 @@ static const struct mtk_soc_data mt7981_
@@ -5277,11 +5297,15 @@ static const struct mtk_soc_data mt7981_
.hash_offset = 4,
.has_accounting = true,
.foe_entry_size = MTK_FOE_ENTRY_V2_SIZE,
@ -473,7 +473,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
.dma_len_offset = 8,
},
@@ -5298,11 +5322,15 @@ static const struct mtk_soc_data mt7986_
@@ -5299,11 +5323,15 @@ static const struct mtk_soc_data mt7986_
.hash_offset = 4,
.has_accounting = true,
.foe_entry_size = MTK_FOE_ENTRY_V2_SIZE,
@ -494,7 +494,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
.dma_len_offset = 8,
},
@@ -5320,11 +5348,15 @@ static const struct mtk_soc_data mt7988_
@@ -5321,11 +5349,15 @@ static const struct mtk_soc_data mt7988_
.hash_offset = 4,
.has_accounting = true,
.foe_entry_size = MTK_FOE_ENTRY_V3_SIZE,
@ -515,7 +515,7 @@ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
.dma_len_offset = 8,
},
@@ -5337,11 +5369,15 @@ static const struct mtk_soc_data rt5350_
@@ -5338,11 +5370,15 @@ static const struct mtk_soc_data rt5350_
.required_clks = MT7628_CLKS_BITMAP,
.required_pctl = false,
.version = 1,

View File

@ -44,7 +44,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
},
.qdma = {
.qtx_cfg = 0x4400,
@@ -1206,7 +1206,7 @@ static bool mtk_rx_get_desc(struct mtk_e
@@ -1207,7 +1207,7 @@ static bool mtk_rx_get_desc(struct mtk_e
rxd->rxd1 = READ_ONCE(dma_rxd->rxd1);
rxd->rxd3 = READ_ONCE(dma_rxd->rxd3);
rxd->rxd4 = READ_ONCE(dma_rxd->rxd4);
@ -53,7 +53,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
rxd->rxd5 = READ_ONCE(dma_rxd->rxd5);
rxd->rxd6 = READ_ONCE(dma_rxd->rxd6);
}
@@ -2158,7 +2158,7 @@ static int mtk_poll_rx(struct napi_struc
@@ -2159,7 +2159,7 @@ static int mtk_poll_rx(struct napi_struc
break;
/* find out which mac the packet come from. values start at 1 */
@ -62,7 +62,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
u32 val = RX_DMA_GET_SPORT_V2(trxd.rxd5);
switch (val) {
@@ -2270,7 +2270,7 @@ static int mtk_poll_rx(struct napi_struc
@@ -2271,7 +2271,7 @@ static int mtk_poll_rx(struct napi_struc
skb->dev = netdev;
bytes += skb->len;
@ -71,7 +71,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
reason = FIELD_GET(MTK_RXD5_PPE_CPU_REASON, trxd.rxd5);
hash = trxd.rxd5 & MTK_RXD5_FOE_ENTRY;
if (hash != MTK_RXD5_FOE_ENTRY)
@@ -2820,7 +2820,7 @@ static int mtk_rx_alloc(struct mtk_eth *
@@ -2821,7 +2821,7 @@ static int mtk_rx_alloc(struct mtk_eth *
rxd->rxd3 = 0;
rxd->rxd4 = 0;
@ -80,7 +80,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
rxd->rxd5 = 0;
rxd->rxd6 = 0;
rxd->rxd7 = 0;
@@ -4021,7 +4021,7 @@ static int mtk_hw_init(struct mtk_eth *e
@@ -4022,7 +4022,7 @@ static int mtk_hw_init(struct mtk_eth *e
else
mtk_hw_reset(eth);
@ -89,7 +89,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
/* Set FE to PDMAv2 if necessary */
val = mtk_r32(eth, MTK_FE_GLO_MISC);
mtk_w32(eth, val | BIT(4), MTK_FE_GLO_MISC);
@@ -5302,11 +5302,11 @@ static const struct mtk_soc_data mt7981_
@@ -5303,11 +5303,11 @@ static const struct mtk_soc_data mt7981_
.dma_len_offset = 8,
},
.rx = {
@ -105,7 +105,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
},
};
@@ -5328,11 +5328,11 @@ static const struct mtk_soc_data mt7986_
@@ -5329,11 +5329,11 @@ static const struct mtk_soc_data mt7986_
.dma_len_offset = 8,
},
.rx = {