-LINUX_VERSION-6.6 = .104
-LINUX_KERNEL_HASH-6.6.104 = 2a772f9d661afabaaddcdfd1116239acb2d943377aceab9e0baed2b7a915e36a
+LINUX_VERSION-6.6 = .105
+LINUX_KERNEL_HASH-6.6.105 = 3f916e664f1872980b436614cba1d8b10246033435e0312ea0d8cc16599e1a1d
snprintf(bp->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
bp->pdev->name, bp->pdev->id);
bp->mii_bus->priv = bp;
-@@ -1641,6 +1658,11 @@ static int macb_rx(struct macb_queue *qu
+@@ -1642,6 +1659,11 @@ static int macb_rx(struct macb_queue *qu
macb_init_rx_ring(queue);
queue_writel(queue, RBQP, queue->rx_ring_dma);
macb_writel(bp, NCR, ctrl | MACB_BIT(RE));
-@@ -1941,8 +1963,9 @@ static irqreturn_t macb_interrupt(int ir
+@@ -1944,8 +1966,9 @@ static irqreturn_t macb_interrupt(int ir
queue_writel(queue, ISR, MACB_BIT(TCOMP) |
MACB_BIT(TXUBR));
wmb(); // ensure softirq can see update
}
-@@ -2397,6 +2420,11 @@ static netdev_tx_t macb_start_xmit(struc
+@@ -2401,6 +2424,11 @@ static netdev_tx_t macb_start_xmit(struc
skb_tx_timestamp(skb);
- spin_lock_irq(&bp->lock);
+ spin_lock(&bp->lock);
+
+ /* TSTART write might get dropped, so make the IRQ retrigger a buffer read */
+ if (macb_readl(bp, TSR) & MACB_BIT(TGO))
+ queue->tx_pending = 1;
+
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
- spin_unlock_irq(&bp->lock);
+ spin_unlock(&bp->lock);
-@@ -2771,6 +2799,37 @@ static void macb_configure_dma(struct ma
+@@ -2775,6 +2803,37 @@ static void macb_configure_dma(struct ma
}
}
static void macb_init_hw(struct macb *bp)
{
u32 config;
-@@ -2799,6 +2858,11 @@ static void macb_init_hw(struct macb *bp
+@@ -2803,6 +2862,11 @@ static void macb_init_hw(struct macb *bp
if (bp->caps & MACB_CAPS_JUMBO)
bp->rx_frm_len_mask = MACB_RX_JFRMLEN_MASK;
macb_configure_dma(bp);
/* Enable RX partial store and forward and set watermark */
-@@ -3163,6 +3227,52 @@ static void gem_get_ethtool_strings(stru
+@@ -3167,6 +3231,52 @@ static void gem_get_ethtool_strings(stru
}
}
static struct net_device_stats *macb_get_stats(struct net_device *dev)
{
struct macb *bp = netdev_priv(dev);
-@@ -3757,6 +3867,8 @@ static const struct ethtool_ops macb_eth
+@@ -3761,6 +3871,8 @@ static const struct ethtool_ops macb_eth
};
static const struct ethtool_ops gem_ethtool_ops = {
.get_regs_len = macb_get_regs_len,
.get_regs = macb_get_regs,
.get_wol = macb_get_wol,
-@@ -3766,6 +3878,8 @@ static const struct ethtool_ops gem_etht
+@@ -3770,6 +3882,8 @@ static const struct ethtool_ops gem_etht
.get_ethtool_stats = gem_get_ethtool_stats,
.get_strings = gem_get_ethtool_strings,
.get_sset_count = gem_get_sset_count,
.get_link_ksettings = macb_get_link_ksettings,
.set_link_ksettings = macb_set_link_ksettings,
.get_ringparam = macb_get_ringparam,
-@@ -5062,6 +5176,11 @@ static int macb_probe(struct platform_de
+@@ -5066,6 +5180,11 @@ static int macb_probe(struct platform_de
}
}
}
spin_lock_init(&bp->lock);
spin_lock_init(&bp->stats_lock);
-@@ -5122,6 +5241,21 @@ static int macb_probe(struct platform_de
+@@ -5126,6 +5245,21 @@ static int macb_probe(struct platform_de
else
bp->phy_interface = interface;
/* IP specific init */
err = init(pdev);
if (err)
-@@ -5198,6 +5332,19 @@ static int macb_remove(struct platform_d
+@@ -5202,6 +5336,19 @@ static int macb_remove(struct platform_d
return 0;
}
static int __maybe_unused macb_suspend(struct device *dev)
{
struct net_device *netdev = dev_get_drvdata(dev);
-@@ -5412,6 +5559,7 @@ static const struct dev_pm_ops macb_pm_o
+@@ -5416,6 +5563,7 @@ static const struct dev_pm_ops macb_pm_o
static struct platform_driver macb_driver = {
.probe = macb_probe,
.remove = macb_remove,
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
-@@ -5023,6 +5023,17 @@ static const struct macb_config versal_c
+@@ -5027,6 +5027,17 @@ static const struct macb_config versal_c
.usrio = &macb_default_usrio,
};
static const struct of_device_id macb_dt_ids[] = {
{ .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config },
{ .compatible = "cdns,macb" },
-@@ -5043,6 +5054,7 @@ static const struct of_device_id macb_dt
+@@ -5047,6 +5058,7 @@ static const struct of_device_id macb_dt
{ .compatible = "microchip,mpfs-macb", .data = &mpfs_config },
{ .compatible = "microchip,sama7g5-gem", .data = &sama7g5_gem_config },
{ .compatible = "microchip,sama7g5-emac", .data = &sama7g5_emac_config },
+++ /dev/null
-Subject: [PATCH v3] proc: fix missing pde_set_flags() for net proc files
-Date: Thu, 21 Aug 2025 18:58:06 +0800 [thread overview]
-
-To avoid potential UAF issues during module removal races, we use pde_set_flags()
-to save proc_ops flags in PDE itself before proc_register(), and then use
-pde_has_proc_*() helpers instead of directly dereferencing pde->proc_ops->*.
-
-However, the pde_set_flags() call was missing when creating net related proc files.
-This omission caused incorrect behavior which FMODE_LSEEK was being cleared
-inappropriately in proc_reg_open() for net proc files. Lars reported it in this link[1].
-
-Fix this by ensuring pde_set_flags() is called when register proc entry, and add
-NULL check for proc_ops in pde_set_flags().
-
-
-Fixes: ff7ec8dc1b64 ("proc: use the same treatment to check proc_lseek as ones for proc_read_iter et.al")
----
-v3:
-- followed by Christian's suggestion to stash pde->proc_ops in a local const variable
-v2:
-- followed by Jiri's suggestion to refractor code and reformat commit message
----
- fs/proc/generic.c | 38 +++++++++++++++++++++-----------------
- 1 file changed, 21 insertions(+), 17 deletions(-)
-
---- a/fs/proc/generic.c
-+++ b/fs/proc/generic.c
-@@ -362,6 +362,25 @@ static const struct inode_operations pro
- .setattr = proc_notify_change,
- };
-
-+static void pde_set_flags(struct proc_dir_entry *pde)
-+{
-+ const struct proc_ops *proc_ops = pde->proc_ops;
-+
-+ if (!proc_ops)
-+ return;
-+
-+ if (proc_ops->proc_flags & PROC_ENTRY_PERMANENT)
-+ pde->flags |= PROC_ENTRY_PERMANENT;
-+ if (proc_ops->proc_read_iter)
-+ pde->flags |= PROC_ENTRY_proc_read_iter;
-+#ifdef CONFIG_COMPAT
-+ if (proc_ops->proc_compat_ioctl)
-+ pde->flags |= PROC_ENTRY_proc_compat_ioctl;
-+#endif
-+ if (proc_ops->proc_lseek)
-+ pde->flags |= PROC_ENTRY_proc_lseek;
-+}
-+
- /* returns the registered entry, or frees dp and returns NULL on failure */
- struct proc_dir_entry *proc_register(struct proc_dir_entry *dir,
- struct proc_dir_entry *dp)
-@@ -369,6 +388,8 @@ struct proc_dir_entry *proc_register(str
- if (proc_alloc_inum(&dp->low_ino))
- goto out_free_entry;
-
-+ pde_set_flags(dp);
-+
- write_lock(&proc_subdir_lock);
- dp->parent = dir;
- if (pde_subdir_insert(dir, dp) == false) {
-@@ -557,20 +578,6 @@ struct proc_dir_entry *proc_create_reg(c
- return p;
- }
-
--static void pde_set_flags(struct proc_dir_entry *pde)
--{
-- if (pde->proc_ops->proc_flags & PROC_ENTRY_PERMANENT)
-- pde->flags |= PROC_ENTRY_PERMANENT;
-- if (pde->proc_ops->proc_read_iter)
-- pde->flags |= PROC_ENTRY_proc_read_iter;
--#ifdef CONFIG_COMPAT
-- if (pde->proc_ops->proc_compat_ioctl)
-- pde->flags |= PROC_ENTRY_proc_compat_ioctl;
--#endif
-- if (pde->proc_ops->proc_lseek)
-- pde->flags |= PROC_ENTRY_proc_lseek;
--}
--
- struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
- struct proc_dir_entry *parent,
- const struct proc_ops *proc_ops, void *data)
-@@ -581,7 +588,6 @@ struct proc_dir_entry *proc_create_data(
- if (!p)
- return NULL;
- p->proc_ops = proc_ops;
-- pde_set_flags(p);
- return proc_register(parent, p);
- }
- EXPORT_SYMBOL(proc_create_data);
-@@ -632,7 +638,6 @@ struct proc_dir_entry *proc_create_seq_p
- p->proc_ops = &proc_seq_ops;
- p->seq_ops = ops;
- p->state_size = state_size;
-- pde_set_flags(p);
- return proc_register(parent, p);
- }
- EXPORT_SYMBOL(proc_create_seq_private);
-@@ -663,7 +668,6 @@ struct proc_dir_entry *proc_create_singl
- return NULL;
- p->proc_ops = &proc_single_ops;
- p->single_show = show;
-- pde_set_flags(p);
- return proc_register(parent, p);
- }
- EXPORT_SYMBOL(proc_create_single_data);
}
} else {
nfrags += skb_shinfo(skb)->nr_frags;
-@@ -1650,7 +1650,7 @@ static struct mtk_rx_ring *mtk_get_rx_ri
+@@ -1658,7 +1658,7 @@ static struct mtk_rx_ring *mtk_get_rx_ri
ring = ð->rx_ring[i];
idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size);
if (rxd->rxd2 & RX_DMA_DONE) {
ring->calc_idx_update = true;
return ring;
-@@ -1818,7 +1818,7 @@ static int mtk_xdp_submit_frame(struct m
+@@ -1826,7 +1826,7 @@ static int mtk_xdp_submit_frame(struct m
}
htxd = txd;
memset(tx_buf, 0, sizeof(*tx_buf));
htx_buf = tx_buf;
-@@ -1837,7 +1837,7 @@ static int mtk_xdp_submit_frame(struct m
+@@ -1845,7 +1845,7 @@ static int mtk_xdp_submit_frame(struct m
goto unmap;
tx_buf = mtk_desc_to_tx_buf(ring, txd,
memset(tx_buf, 0, sizeof(*tx_buf));
n_desc++;
}
-@@ -1875,7 +1875,7 @@ static int mtk_xdp_submit_frame(struct m
+@@ -1883,7 +1883,7 @@ static int mtk_xdp_submit_frame(struct m
} else {
int idx;
mtk_w32(eth, NEXT_DESP_IDX(idx, ring->dma_size),
MT7628_TX_CTX_IDX0);
}
-@@ -1886,7 +1886,7 @@ static int mtk_xdp_submit_frame(struct m
+@@ -1894,7 +1894,7 @@ static int mtk_xdp_submit_frame(struct m
unmap:
while (htxd != txd) {
mtk_tx_unmap(eth, tx_buf, NULL, false);
htxd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU;
-@@ -2017,7 +2017,7 @@ static int mtk_poll_rx(struct napi_struc
+@@ -2025,7 +2025,7 @@ static int mtk_poll_rx(struct napi_struc
goto rx_done;
idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size);
data = ring->data[idx];
if (!mtk_rx_get_desc(eth, &trxd, rxd))
-@@ -2152,7 +2152,7 @@ static int mtk_poll_rx(struct napi_struc
+@@ -2160,7 +2160,7 @@ static int mtk_poll_rx(struct napi_struc
rxdcsum = &trxd.rxd4;
}
skb->ip_summed = CHECKSUM_UNNECESSARY;
else
skb_checksum_none_assert(skb);
-@@ -2280,7 +2280,7 @@ static int mtk_poll_tx_qdma(struct mtk_e
+@@ -2288,7 +2288,7 @@ static int mtk_poll_tx_qdma(struct mtk_e
break;
tx_buf = mtk_desc_to_tx_buf(ring, desc,
if (!tx_buf->data)
break;
-@@ -2331,7 +2331,7 @@ static int mtk_poll_tx_pdma(struct mtk_e
+@@ -2339,7 +2339,7 @@ static int mtk_poll_tx_pdma(struct mtk_e
}
mtk_tx_unmap(eth, tx_buf, &bq, true);
ring->last_free = desc;
atomic_inc(&ring->free_count);
-@@ -2421,7 +2421,7 @@ static int mtk_napi_rx(struct napi_struc
+@@ -2429,7 +2429,7 @@ static int mtk_napi_rx(struct napi_struc
do {
int rx_done;
reg_map->pdma.irq_status);
rx_done = mtk_poll_rx(napi, budget - rx_done_total, eth);
rx_done_total += rx_done;
-@@ -2437,10 +2437,10 @@ static int mtk_napi_rx(struct napi_struc
+@@ -2445,10 +2445,10 @@ static int mtk_napi_rx(struct napi_struc
return budget;
} while (mtk_r32(eth, reg_map->pdma.irq_status) &
return rx_done_total;
}
-@@ -2449,7 +2449,7 @@ static int mtk_tx_alloc(struct mtk_eth *
+@@ -2457,7 +2457,7 @@ static int mtk_tx_alloc(struct mtk_eth *
{
const struct mtk_soc_data *soc = eth->soc;
struct mtk_tx_ring *ring = ð->tx_ring;
struct mtk_tx_dma_v2 *txd;
int ring_size;
u32 ofs, val;
-@@ -2572,14 +2572,14 @@ static void mtk_tx_clean(struct mtk_eth
+@@ -2580,14 +2580,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,
ring->dma_pdma, ring->phys_pdma);
ring->dma_pdma = NULL;
}
-@@ -2634,15 +2634,15 @@ static int mtk_rx_alloc(struct mtk_eth *
+@@ -2642,15 +2642,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,
}
if (!ring->dma)
-@@ -2653,7 +2653,7 @@ static int mtk_rx_alloc(struct mtk_eth *
+@@ -2661,7 +2661,7 @@ static int mtk_rx_alloc(struct mtk_eth *
dma_addr_t dma_addr;
void *data;
if (ring->page_pool) {
data = mtk_page_pool_get_buff(ring->page_pool,
&dma_addr, GFP_KERNEL);
-@@ -2744,7 +2744,7 @@ static void mtk_rx_clean(struct mtk_eth
+@@ -2752,7 +2752,7 @@ static void mtk_rx_clean(struct mtk_eth
if (!ring->data[i])
continue;
if (!rxd->rxd1)
continue;
-@@ -2761,7 +2761,7 @@ static void mtk_rx_clean(struct mtk_eth
+@@ -2769,7 +2769,7 @@ static void mtk_rx_clean(struct mtk_eth
if (!in_sram && ring->dma) {
dma_free_coherent(eth->dma_dev,
ring->dma, ring->phys);
ring->dma = NULL;
}
-@@ -3132,7 +3132,7 @@ static void mtk_dma_free(struct mtk_eth
+@@ -3140,7 +3140,7 @@ static void mtk_dma_free(struct mtk_eth
if (!MTK_HAS_CAPS(soc->caps, MTK_SRAM) && eth->scratch_ring) {
dma_free_coherent(eth->dma_dev,
eth->scratch_ring, eth->phy_scratch_ring);
eth->scratch_ring = NULL;
eth->phy_scratch_ring = 0;
-@@ -3182,7 +3182,7 @@ static irqreturn_t mtk_handle_irq_rx(int
+@@ -3190,7 +3190,7 @@ static irqreturn_t mtk_handle_irq_rx(int
eth->rx_events++;
if (likely(napi_schedule_prep(ð->rx_napi))) {
__napi_schedule(ð->rx_napi);
}
-@@ -3208,9 +3208,9 @@ static irqreturn_t mtk_handle_irq(int ir
+@@ -3216,9 +3216,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) &
mtk_handle_irq_rx(irq, _eth);
}
if (mtk_r32(eth, reg_map->tx_irq_mask) & MTK_TX_DONE_INT) {
-@@ -3228,10 +3228,10 @@ static void mtk_poll_controller(struct n
+@@ -3236,10 +3236,10 @@ static void mtk_poll_controller(struct n
struct mtk_eth *eth = mac->hw;
mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
}
#endif
-@@ -3395,7 +3395,7 @@ static int mtk_open(struct net_device *d
+@@ -3403,7 +3403,7 @@ static int mtk_open(struct net_device *d
napi_enable(ð->tx_napi);
napi_enable(ð->rx_napi);
mtk_tx_irq_enable(eth, MTK_TX_DONE_INT);
refcount_set(ð->dma_refcnt, 1);
}
else
-@@ -3479,7 +3479,7 @@ static int mtk_stop(struct net_device *d
+@@ -3487,7 +3487,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);
napi_disable(ð->tx_napi);
napi_disable(ð->rx_napi);
-@@ -3955,9 +3955,9 @@ static int mtk_hw_init(struct mtk_eth *e
+@@ -3963,9 +3963,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);
mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP);
if (mtk_is_netsys_v3_or_greater(eth)) {
-@@ -5065,11 +5065,15 @@ static const struct mtk_soc_data mt2701_
+@@ -5073,11 +5073,15 @@ static const struct mtk_soc_data mt2701_
.required_clks = MT7623_CLKS_BITMAP,
.required_pctl = true,
.version = 1,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5085,11 +5089,15 @@ static const struct mtk_soc_data mt7621_
+@@ -5093,11 +5097,15 @@ static const struct mtk_soc_data mt7621_
.offload_version = 1,
.hash_offset = 2,
.foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5107,11 +5115,15 @@ static const struct mtk_soc_data mt7622_
+@@ -5115,11 +5123,15 @@ static const struct mtk_soc_data mt7622_
.hash_offset = 2,
.has_accounting = true,
.foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5128,11 +5140,15 @@ static const struct mtk_soc_data mt7623_
+@@ -5136,11 +5148,15 @@ static const struct mtk_soc_data mt7623_
.hash_offset = 2,
.foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
.disable_pll_modes = true,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5147,11 +5163,15 @@ static const struct mtk_soc_data mt7629_
+@@ -5155,11 +5171,15 @@ static const struct mtk_soc_data mt7629_
.required_pctl = false,
.has_accounting = true,
.version = 1,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5169,11 +5189,15 @@ static const struct mtk_soc_data mt7981_
+@@ -5177,11 +5197,15 @@ static const struct mtk_soc_data mt7981_
.hash_offset = 4,
.has_accounting = true,
.foe_entry_size = MTK_FOE_ENTRY_V2_SIZE,
.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
.dma_len_offset = 8,
},
-@@ -5191,11 +5215,15 @@ static const struct mtk_soc_data mt7986_
+@@ -5199,11 +5223,15 @@ static const struct mtk_soc_data mt7986_
.hash_offset = 4,
.has_accounting = true,
.foe_entry_size = MTK_FOE_ENTRY_V2_SIZE,
.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
.dma_len_offset = 8,
},
-@@ -5213,11 +5241,15 @@ static const struct mtk_soc_data mt7988_
+@@ -5221,11 +5249,15 @@ static const struct mtk_soc_data mt7988_
.hash_offset = 4,
.has_accounting = true,
.foe_entry_size = MTK_FOE_ENTRY_V3_SIZE,
.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
.dma_len_offset = 8,
},
-@@ -5230,11 +5262,15 @@ static const struct mtk_soc_data rt5350_
+@@ -5238,11 +5270,15 @@ static const struct mtk_soc_data rt5350_
.required_clks = MT7628_CLKS_BITMAP,
.required_pctl = false,
.version = 1,
rxd->rxd5 = READ_ONCE(dma_rxd->rxd5);
rxd->rxd6 = READ_ONCE(dma_rxd->rxd6);
}
-@@ -2024,7 +2024,7 @@ static int mtk_poll_rx(struct napi_struc
+@@ -2032,7 +2032,7 @@ static int mtk_poll_rx(struct napi_struc
break;
/* find out which mac the packet come from. values start at 1 */
u32 val = RX_DMA_GET_SPORT_V2(trxd.rxd5);
switch (val) {
-@@ -2136,7 +2136,7 @@ static int mtk_poll_rx(struct napi_struc
+@@ -2144,7 +2144,7 @@ static int mtk_poll_rx(struct napi_struc
skb->dev = netdev;
bytes += skb->len;
reason = FIELD_GET(MTK_RXD5_PPE_CPU_REASON, trxd.rxd5);
hash = trxd.rxd5 & MTK_RXD5_FOE_ENTRY;
if (hash != MTK_RXD5_FOE_ENTRY)
-@@ -2690,7 +2690,7 @@ static int mtk_rx_alloc(struct mtk_eth *
+@@ -2698,7 +2698,7 @@ static int mtk_rx_alloc(struct mtk_eth *
rxd->rxd3 = 0;
rxd->rxd4 = 0;
rxd->rxd5 = 0;
rxd->rxd6 = 0;
rxd->rxd7 = 0;
-@@ -3901,7 +3901,7 @@ static int mtk_hw_init(struct mtk_eth *e
+@@ -3909,7 +3909,7 @@ static int mtk_hw_init(struct mtk_eth *e
else
mtk_hw_reset(eth);
/* Set FE to PDMAv2 if necessary */
val = mtk_r32(eth, MTK_FE_GLO_MISC);
mtk_w32(eth, val | BIT(4), MTK_FE_GLO_MISC);
-@@ -5195,11 +5195,11 @@ static const struct mtk_soc_data mt7981_
+@@ -5203,11 +5203,11 @@ static const struct mtk_soc_data mt7981_
.dma_len_offset = 8,
},
.rx = {
},
};
-@@ -5221,11 +5221,11 @@ static const struct mtk_soc_data mt7986_
+@@ -5229,11 +5229,11 @@ static const struct mtk_soc_data mt7986_
.dma_len_offset = 8,
},
.rx = {
}
}
-@@ -2461,7 +2467,7 @@ static int mtk_tx_alloc(struct mtk_eth *
+@@ -2469,7 +2475,7 @@ static int mtk_tx_alloc(struct mtk_eth *
if (MTK_HAS_CAPS(soc->caps, MTK_QDMA))
ring_size = MTK_QDMA_RING_SIZE;
else
ring->buf = kcalloc(ring_size, sizeof(*ring->buf),
GFP_KERNEL);
-@@ -2469,8 +2475,8 @@ static int mtk_tx_alloc(struct mtk_eth *
+@@ -2477,8 +2483,8 @@ static int mtk_tx_alloc(struct mtk_eth *
goto no_tx_mem;
if (MTK_HAS_CAPS(soc->caps, MTK_SRAM)) {
} else {
ring->dma = dma_alloc_coherent(eth->dma_dev, ring_size * sz,
&ring->phys, GFP_KERNEL);
-@@ -2592,6 +2598,7 @@ static void mtk_tx_clean(struct mtk_eth
+@@ -2600,6 +2606,7 @@ static void mtk_tx_clean(struct mtk_eth
static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)
{
const struct mtk_reg_map *reg_map = eth->soc->reg_map;
struct mtk_rx_ring *ring;
int rx_data_len, rx_dma_size, tx_ring_size;
int i;
-@@ -2599,7 +2606,7 @@ static int mtk_rx_alloc(struct mtk_eth *
+@@ -2607,7 +2614,7 @@ static int mtk_rx_alloc(struct mtk_eth *
if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA))
tx_ring_size = MTK_QDMA_RING_SIZE;
else
if (rx_flag == MTK_RX_FLAGS_QDMA) {
if (ring_no)
-@@ -2614,7 +2621,7 @@ static int mtk_rx_alloc(struct mtk_eth *
+@@ -2622,7 +2629,7 @@ static int mtk_rx_alloc(struct mtk_eth *
rx_dma_size = MTK_HW_LRO_DMA_SIZE;
} else {
rx_data_len = ETH_DATA_LEN;
}
ring->frag_size = mtk_max_frag_size(rx_data_len);
-@@ -3151,7 +3158,10 @@ static void mtk_dma_free(struct mtk_eth
+@@ -3159,7 +3166,10 @@ static void mtk_dma_free(struct mtk_eth
mtk_rx_clean(eth, ð->rx_ring[i], false);
}
}
static bool mtk_hw_reset_check(struct mtk_eth *eth)
-@@ -5073,11 +5083,14 @@ static const struct mtk_soc_data mt2701_
+@@ -5081,11 +5091,14 @@ static const struct mtk_soc_data mt2701_
.desc_size = sizeof(struct mtk_tx_dma),
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5097,11 +5110,14 @@ static const struct mtk_soc_data mt7621_
+@@ -5105,11 +5118,14 @@ static const struct mtk_soc_data mt7621_
.desc_size = sizeof(struct mtk_tx_dma),
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5123,11 +5139,14 @@ static const struct mtk_soc_data mt7622_
+@@ -5131,11 +5147,14 @@ static const struct mtk_soc_data mt7622_
.desc_size = sizeof(struct mtk_tx_dma),
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5148,11 +5167,14 @@ static const struct mtk_soc_data mt7623_
+@@ -5156,11 +5175,14 @@ static const struct mtk_soc_data mt7623_
.desc_size = sizeof(struct mtk_tx_dma),
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5171,11 +5193,14 @@ static const struct mtk_soc_data mt7629_
+@@ -5179,11 +5201,14 @@ static const struct mtk_soc_data mt7629_
.desc_size = sizeof(struct mtk_tx_dma),
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5197,6 +5222,8 @@ static const struct mtk_soc_data mt7981_
+@@ -5205,6 +5230,8 @@ static const struct mtk_soc_data mt7981_
.desc_size = sizeof(struct mtk_tx_dma_v2),
.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
.dma_len_offset = 8,
},
.rx = {
.desc_size = sizeof(struct mtk_rx_dma),
-@@ -5204,6 +5231,7 @@ static const struct mtk_soc_data mt7981_
+@@ -5212,6 +5239,7 @@ static const struct mtk_soc_data mt7981_
.dma_l4_valid = RX_DMA_L4_VALID_V2,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
};
-@@ -5223,6 +5251,8 @@ static const struct mtk_soc_data mt7986_
+@@ -5231,6 +5259,8 @@ static const struct mtk_soc_data mt7986_
.desc_size = sizeof(struct mtk_tx_dma_v2),
.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
.dma_len_offset = 8,
},
.rx = {
.desc_size = sizeof(struct mtk_rx_dma),
-@@ -5230,6 +5260,7 @@ static const struct mtk_soc_data mt7986_
+@@ -5238,6 +5268,7 @@ static const struct mtk_soc_data mt7986_
.dma_l4_valid = RX_DMA_L4_VALID_V2,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
};
-@@ -5249,6 +5280,8 @@ static const struct mtk_soc_data mt7988_
+@@ -5257,6 +5288,8 @@ static const struct mtk_soc_data mt7988_
.desc_size = sizeof(struct mtk_tx_dma_v2),
.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
.dma_len_offset = 8,
},
.rx = {
.desc_size = sizeof(struct mtk_rx_dma_v2),
-@@ -5256,6 +5289,7 @@ static const struct mtk_soc_data mt7988_
+@@ -5264,6 +5297,7 @@ static const struct mtk_soc_data mt7988_
.dma_l4_valid = RX_DMA_L4_VALID_V2,
.dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
.dma_len_offset = 8,
},
};
-@@ -5270,6 +5304,7 @@ static const struct mtk_soc_data rt5350_
+@@ -5278,6 +5312,7 @@ static const struct mtk_soc_data rt5350_
.desc_size = sizeof(struct mtk_tx_dma),
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
.rx = {
.desc_size = sizeof(struct mtk_rx_dma),
-@@ -5277,6 +5312,7 @@ static const struct mtk_soc_data rt5350_
+@@ -5285,6 +5320,7 @@ static const struct mtk_soc_data rt5350_
.dma_l4_valid = RX_DMA_L4_VALID_PDMA,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
.ppe_base = 0x2000,
.wdma_base = {
[0] = 0x4800,
-@@ -2015,6 +2024,7 @@ static int mtk_poll_rx(struct napi_struc
+@@ -2023,6 +2032,7 @@ static int mtk_poll_rx(struct napi_struc
struct mtk_rx_dma_v2 *rxd, trxd;
int done = 0, bytes = 0;
dma_addr_t dma_addr = DMA_MAPPING_ERROR;
while (done < budget) {
unsigned int pktlen, *rxdcsum;
-@@ -2058,6 +2068,7 @@ static int mtk_poll_rx(struct napi_struc
+@@ -2066,6 +2076,7 @@ static int mtk_poll_rx(struct napi_struc
goto release_desc;
netdev = eth->netdev[mac];
if (unlikely(test_bit(MTK_RESETTING, ð->state)))
goto release_desc;
-@@ -2181,7 +2192,7 @@ static int mtk_poll_rx(struct napi_struc
+@@ -2189,7 +2200,7 @@ static int mtk_poll_rx(struct napi_struc
}
if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
skb_record_rx_queue(skb, 0);
napi_gro_receive(napi, skb);
-@@ -3288,37 +3299,27 @@ static int mtk_start_dma(struct mtk_eth
+@@ -3296,37 +3307,27 @@ static int mtk_start_dma(struct mtk_eth
return 0;
}
}
-@@ -3378,7 +3379,10 @@ static int mtk_open(struct net_device *d
+@@ -3386,7 +3387,10 @@ static int mtk_open(struct net_device *d
{
struct mtk_mac *mac = netdev_priv(dev);
struct mtk_eth *eth = mac->hw;
err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0);
if (err) {
-@@ -3402,18 +3406,38 @@ static int mtk_open(struct net_device *d
+@@ -3410,18 +3414,38 @@ static int mtk_open(struct net_device *d
for (i = 0; i < ARRAY_SIZE(eth->ppe); i++)
mtk_ppe_start(eth->ppe[i]);
phylink_start(mac->phylink);
netif_tx_start_all_queues(dev);
-@@ -3490,7 +3514,8 @@ static int mtk_stop(struct net_device *d
+@@ -3498,7 +3522,8 @@ static int mtk_stop(struct net_device *d
if (!refcount_dec_and_test(ð->dma_refcnt))
return 0;
mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
mtk_rx_irq_disable(eth, eth->soc->rx.irq_done_mask);
-@@ -4985,23 +5010,24 @@ static int mtk_probe(struct platform_dev
+@@ -4993,23 +5018,24 @@ static int mtk_probe(struct platform_dev
}
if (eth->soc->offload_version) {
}
for (i = 0; i < MTK_MAX_DEVS; i++) {
-@@ -5104,6 +5130,7 @@ static const struct mtk_soc_data mt7621_
+@@ -5112,6 +5138,7 @@ static const struct mtk_soc_data mt7621_
.required_pctl = false,
.version = 1,
.offload_version = 1,
.hash_offset = 2,
.foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
.tx = {
-@@ -5132,6 +5159,7 @@ static const struct mtk_soc_data mt7622_
+@@ -5140,6 +5167,7 @@ static const struct mtk_soc_data mt7622_
.required_pctl = false,
.version = 1,
.offload_version = 2,
.hash_offset = 2,
.has_accounting = true,
.foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
-@@ -5160,6 +5188,7 @@ static const struct mtk_soc_data mt7623_
+@@ -5168,6 +5196,7 @@ static const struct mtk_soc_data mt7623_
.required_pctl = true,
.version = 1,
.offload_version = 1,
.hash_offset = 2,
.foe_entry_size = MTK_FOE_ENTRY_V1_SIZE,
.disable_pll_modes = true,
-@@ -5215,6 +5244,7 @@ static const struct mtk_soc_data mt7981_
+@@ -5223,6 +5252,7 @@ static const struct mtk_soc_data mt7981_
.required_pctl = false,
.version = 2,
.offload_version = 2,
.hash_offset = 4,
.has_accounting = true,
.foe_entry_size = MTK_FOE_ENTRY_V2_SIZE,
-@@ -5244,6 +5274,7 @@ static const struct mtk_soc_data mt7986_
+@@ -5252,6 +5282,7 @@ static const struct mtk_soc_data mt7986_
.required_pctl = false,
.version = 2,
.offload_version = 2,
.hash_offset = 4,
.has_accounting = true,
.foe_entry_size = MTK_FOE_ENTRY_V2_SIZE,
-@@ -5273,6 +5304,7 @@ static const struct mtk_soc_data mt7988_
+@@ -5281,6 +5312,7 @@ static const struct mtk_soc_data mt7988_
.required_pctl = false,
.version = 3,
.offload_version = 2,
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -3408,7 +3408,7 @@ static int mtk_open(struct net_device *d
+@@ -3416,7 +3416,7 @@ static int mtk_open(struct net_device *d
for (i = 0; i < MTK_MAX_DEVS; i++) {
if (!eth->netdev[i])
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -4490,6 +4490,20 @@ static int mtk_set_rxnfc(struct net_devi
+@@ -4498,6 +4498,20 @@ static int mtk_set_rxnfc(struct net_devi
return ret;
}
static u16 mtk_select_queue(struct net_device *dev, struct sk_buff *skb,
struct net_device *sb_dev)
{
-@@ -4518,8 +4532,10 @@ static const struct ethtool_ops mtk_etht
+@@ -4526,8 +4540,10 @@ static const struct ethtool_ops mtk_etht
.get_strings = mtk_get_strings,
.get_sset_count = mtk_get_sset_count,
.get_ethtool_stats = mtk_get_ethtool_stats,
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -5064,6 +5064,8 @@ static int mtk_probe(struct platform_dev
+@@ -5072,6 +5072,8 @@ static int mtk_probe(struct platform_dev
* for NAPI to work
*/
init_dummy_netdev(ð->dummy_dev);
bool gso = false;
int tx_num;
-@@ -1623,6 +1640,18 @@ static netdev_tx_t mtk_start_xmit(struct
+@@ -1630,6 +1647,18 @@ static netdev_tx_t mtk_start_xmit(struct
return NETDEV_TX_BUSY;
}
/* TSO: fill MSS info in tcp checksum field */
if (skb_is_gso(skb)) {
if (skb_cow_head(skb, 0)) {
-@@ -1638,8 +1667,14 @@ static netdev_tx_t mtk_start_xmit(struct
+@@ -1645,8 +1674,14 @@ static netdev_tx_t mtk_start_xmit(struct
}
}
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -2140,7 +2140,7 @@ static int mtk_poll_rx(struct napi_struc
+@@ -2148,7 +2148,7 @@ static int mtk_poll_rx(struct napi_struc
if (ret != XDP_PASS)
goto skip_rx;
if (unlikely(!skb)) {
page_pool_put_full_page(ring->page_pool,
page, true);
-@@ -2178,7 +2178,7 @@ static int mtk_poll_rx(struct napi_struc
+@@ -2186,7 +2186,7 @@ static int mtk_poll_rx(struct napi_struc
dma_unmap_single(eth->dma_dev, ((u64)trxd.rxd1 | addr64),
ring->buf_size, DMA_FROM_DEVICE);
/* QDMA Flow Control Register */
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -3313,12 +3313,14 @@ static int mtk_start_dma(struct mtk_eth
+@@ -3321,12 +3321,14 @@ static int mtk_start_dma(struct mtk_eth
MTK_TX_BT_32DWORDS | MTK_NDP_CO_PRO |
MTK_RX_2B_OFFSET | MTK_TX_WB_DDONE;
.mac_finish = mtk_mac_finish,
.mac_link_down = mtk_mac_link_down,
.mac_link_up = mtk_mac_link_up,
-@@ -3421,6 +3562,9 @@ static int mtk_open(struct net_device *d
+@@ -3429,6 +3570,9 @@ static int mtk_open(struct net_device *d
ppe_num = eth->soc->ppe_num;
err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0);
if (err) {
netdev_err(dev, "%s: could not attach PHY: %d\n", __func__,
-@@ -3571,6 +3715,9 @@ static int mtk_stop(struct net_device *d
+@@ -3579,6 +3723,9 @@ static int mtk_stop(struct net_device *d
for (i = 0; i < ARRAY_SIZE(eth->ppe); i++)
mtk_ppe_stop(eth->ppe[i]);
return 0;
}
-@@ -4600,6 +4747,7 @@ static const struct net_device_ops mtk_n
+@@ -4608,6 +4755,7 @@ static const struct net_device_ops mtk_n
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
{
const __be32 *_id = of_get_property(np, "reg", NULL);
phy_interface_t phy_mode;
struct phylink *phylink;
struct mtk_mac *mac;
-@@ -4636,16 +4784,41 @@ static int mtk_add_mac(struct mtk_eth *e
+@@ -4644,16 +4792,41 @@ static int mtk_add_mac(struct mtk_eth *e
mac->id = id;
mac->hw = eth;
mac->of_node = np;
}
memset(mac->hwlro_ip, 0, sizeof(mac->hwlro_ip));
-@@ -4728,8 +4901,21 @@ static int mtk_add_mac(struct mtk_eth *e
+@@ -4736,8 +4909,21 @@ static int mtk_add_mac(struct mtk_eth *e
phy_interface_zero(mac->phylink_config.supported_interfaces);
__set_bit(PHY_INTERFACE_MODE_INTERNAL,
mac->phylink_config.supported_interfaces);
phylink = phylink_create(&mac->phylink_config,
of_fwnode_handle(mac->of_node),
phy_mode, &mtk_phylink_ops);
-@@ -4780,6 +4966,26 @@ free_netdev:
+@@ -4788,6 +4974,26 @@ free_netdev:
return err;
}
void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev)
{
struct net_device *dev, *tmp;
-@@ -4926,7 +5132,8 @@ static int mtk_probe(struct platform_dev
+@@ -4934,7 +5140,8 @@ static int mtk_probe(struct platform_dev
regmap_write(cci, 0, 3);
}
err = mtk_sgmii_init(eth);
if (err)
-@@ -5037,6 +5244,24 @@ static int mtk_probe(struct platform_dev
+@@ -5045,6 +5252,24 @@ static int mtk_probe(struct platform_dev
}
}
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_INT)) {
err = devm_request_irq(eth->dev, eth->irq[0],
mtk_handle_irq, 0,
-@@ -5140,6 +5365,11 @@ static int mtk_remove(struct platform_de
+@@ -5148,6 +5373,11 @@ static int mtk_remove(struct platform_de
mtk_stop(eth->netdev[i]);
mac = netdev_priv(eth->netdev[i]);
phylink_disconnect_phy(mac->phylink);
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -5401,7 +5401,7 @@ static const struct mtk_soc_data mt2701_
+@@ -5409,7 +5409,7 @@ static const struct mtk_soc_data mt2701_
.desc_size = sizeof(struct mtk_rx_dma),
.irq_done_mask = MTK_RX_DONE_INT,
.dma_l4_valid = RX_DMA_L4_VALID,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5429,7 +5429,7 @@ static const struct mtk_soc_data mt7621_
+@@ -5437,7 +5437,7 @@ static const struct mtk_soc_data mt7621_
.desc_size = sizeof(struct mtk_rx_dma),
.irq_done_mask = MTK_RX_DONE_INT,
.dma_l4_valid = RX_DMA_L4_VALID,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5459,7 +5459,7 @@ static const struct mtk_soc_data mt7622_
+@@ -5467,7 +5467,7 @@ static const struct mtk_soc_data mt7622_
.desc_size = sizeof(struct mtk_rx_dma),
.irq_done_mask = MTK_RX_DONE_INT,
.dma_l4_valid = RX_DMA_L4_VALID,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5488,7 +5488,7 @@ static const struct mtk_soc_data mt7623_
+@@ -5496,7 +5496,7 @@ static const struct mtk_soc_data mt7623_
.desc_size = sizeof(struct mtk_rx_dma),
.irq_done_mask = MTK_RX_DONE_INT,
.dma_l4_valid = RX_DMA_L4_VALID,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5514,7 +5514,7 @@ static const struct mtk_soc_data mt7629_
+@@ -5522,7 +5522,7 @@ static const struct mtk_soc_data mt7629_
.desc_size = sizeof(struct mtk_rx_dma),
.irq_done_mask = MTK_RX_DONE_INT,
.dma_l4_valid = RX_DMA_L4_VALID,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
-@@ -5546,7 +5546,7 @@ static const struct mtk_soc_data mt7981_
+@@ -5554,7 +5554,7 @@ static const struct mtk_soc_data mt7981_
.dma_l4_valid = RX_DMA_L4_VALID_V2,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
};
-@@ -5576,7 +5576,7 @@ static const struct mtk_soc_data mt7986_
+@@ -5584,7 +5584,7 @@ static const struct mtk_soc_data mt7986_
.dma_l4_valid = RX_DMA_L4_VALID_V2,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
},
};
-@@ -5629,7 +5629,7 @@ static const struct mtk_soc_data rt5350_
+@@ -5637,7 +5637,7 @@ static const struct mtk_soc_data rt5350_
.dma_l4_valid = RX_DMA_L4_VALID_PDMA,
.dma_max_len = MTK_TX_DMA_BUF_LEN,
.dma_len_offset = 16,
help
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -4572,6 +4572,7 @@ static int mtk_get_sset_count(struct net
+@@ -4580,6 +4580,7 @@ static int mtk_get_sset_count(struct net
static void mtk_ethtool_pp_stats(struct mtk_eth *eth, u64 *data)
{
struct page_pool_stats stats = {};
int i;
-@@ -4584,6 +4585,7 @@ static void mtk_ethtool_pp_stats(struct
+@@ -4592,6 +4593,7 @@ static void mtk_ethtool_pp_stats(struct
page_pool_get_stats(ring->page_pool, &stats);
}
page_pool_ethtool_stats_get(data, &stats);
+++ /dev/null
-Date: Sun, 31 Aug 2025 20:05:13 +0200
-Subject: [PATCH] net: ethernet: mtk_eth_soc: fix tx vlan tag for llc packets
-
-When sending llc packets with vlan tx offload, the hardware fails to
-actually add the tag. Deal with this by fixing it up in software.
-
-Fixes: 656e705243fd ("net-next: mediatek: add support for MT7623 ethernet")
----
-
---- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -1763,6 +1763,13 @@ static netdev_tx_t mtk_start_xmit(struct
- bool gso = false;
- int tx_num;
-
-+ if (skb_vlan_tag_present(skb) &&
-+ !eth_proto_is_802_3(eth_hdr(skb)->h_proto)) {
-+ skb = __vlan_hwaccel_push_inside(skb);
-+ if (!skb)
-+ goto dropped;
-+ }
-+
- /* normally we can rely on the stack not calling this more than once,
- * however we have 2 queues running on the same ring so we need to lock
- * the ring access
-@@ -1826,8 +1833,9 @@ static netdev_tx_t mtk_start_xmit(struct
-
- drop:
- spin_unlock(ð->page_lock);
-- stats->tx_dropped++;
- dev_kfree_skb_any(skb);
-+dropped:
-+ stats->tx_dropped++;
- return NETDEV_TX_OK;
- }
-
(transaction layer end-to-end CRC checking).
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
-@@ -1610,6 +1610,8 @@ void pci_walk_bus_locked(struct pci_bus
+@@ -1612,6 +1612,8 @@ void pci_walk_bus_locked(struct pci_bus
void *userdata);
int pci_cfg_space_size(struct pci_dev *dev);
unsigned char pci_bus_max_busnr(struct pci_bus *bus);
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
-@@ -1249,7 +1249,7 @@ static int lvts_probe(struct platform_de
+@@ -1271,7 +1271,7 @@ static int lvts_probe(struct platform_de
return 0;
}
{
struct lvts_domain *lvts_td;
int i;
-@@ -1260,8 +1260,6 @@ static int lvts_remove(struct platform_d
+@@ -1282,8 +1282,6 @@ static int lvts_remove(struct platform_d
lvts_ctrl_set_enable(&lvts_td->lvts_ctrl[i], false);
lvts_debugfs_exit(lvts_td);
}
static const struct lvts_ctrl_data mt8195_lvts_mcu_data_ctrl[] = {
-@@ -1362,7 +1360,7 @@ MODULE_DEVICE_TABLE(of, lvts_of_match);
+@@ -1384,7 +1382,7 @@ MODULE_DEVICE_TABLE(of, lvts_of_match);
static struct platform_driver lvts_driver = {
.probe = lvts_probe,
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
-@@ -80,8 +80,8 @@
+@@ -84,8 +84,8 @@
#define LVTS_SENSOR_MAX 4
#define LVTS_GOLDEN_TEMP_MAX 62
#define LVTS_GOLDEN_TEMP_DEFAULT 50
#define LVTS_MSR_IMMEDIATE_MODE 0
#define LVTS_MSR_FILTERED_MODE 1
-@@ -94,7 +94,7 @@
+@@ -98,7 +98,7 @@
#define LVTS_MINIMUM_THRESHOLD 20000
static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT;
struct lvts_sensor_data {
int dt_id;
-@@ -112,6 +112,8 @@ struct lvts_ctrl_data {
+@@ -116,6 +116,8 @@ struct lvts_ctrl_data {
struct lvts_data {
const struct lvts_ctrl_data *lvts_ctrl;
int num_lvts_ctrl;
};
struct lvts_sensor {
-@@ -126,6 +128,7 @@ struct lvts_sensor {
+@@ -130,6 +132,7 @@ struct lvts_sensor {
struct lvts_ctrl {
struct lvts_sensor sensors[LVTS_SENSOR_MAX];
u32 calibration[LVTS_SENSOR_MAX];
u32 hw_tshut_raw_temp;
int num_lvts_sensor;
-@@ -247,21 +250,21 @@ static void lvts_debugfs_exit(struct lvt
+@@ -251,21 +254,21 @@ static void lvts_debugfs_exit(struct lvt
#endif
return raw_temp;
}
-@@ -269,6 +272,9 @@ static u32 lvts_temp_to_raw(int temperat
+@@ -273,6 +276,9 @@ static u32 lvts_temp_to_raw(int temperat
static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
{
struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz);
void __iomem *msr = lvts_sensor->msr;
u32 value;
int rc;
-@@ -301,7 +307,7 @@ static int lvts_get_temp(struct thermal_
+@@ -305,7 +311,7 @@ static int lvts_get_temp(struct thermal_
if (rc)
return -EAGAIN;
return 0;
}
-@@ -348,10 +354,13 @@ static bool lvts_should_update_thresh(st
+@@ -370,10 +376,13 @@ static bool lvts_should_update_thresh(st
static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
{
struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz);
bool should_update_thresh;
lvts_sensor->low_thresh = low;
-@@ -694,7 +703,7 @@ static int lvts_calibration_read(struct
+@@ -716,7 +725,7 @@ static int lvts_calibration_read(struct
return 0;
}
{
u32 gt;
-@@ -707,7 +716,7 @@ static int lvts_golden_temp_init(struct
+@@ -729,7 +738,7 @@ static int lvts_golden_temp_init(struct
if (gt < LVTS_GOLDEN_TEMP_MAX)
golden_temp = gt;
return 0;
}
-@@ -730,7 +739,7 @@ static int lvts_ctrl_init(struct device
+@@ -752,7 +761,7 @@ static int lvts_ctrl_init(struct device
* The golden temp information is contained in the first chunk
* of efuse data.
*/
if (ret)
return ret;
-@@ -741,6 +750,7 @@ static int lvts_ctrl_init(struct device
+@@ -763,6 +772,7 @@ static int lvts_ctrl_init(struct device
for (i = 0; i < lvts_data->num_lvts_ctrl; i++) {
lvts_ctrl[i].base = lvts_td->base + lvts_data->lvts_ctrl[i].offset;
ret = lvts_sensor_init(dev, &lvts_ctrl[i],
&lvts_data->lvts_ctrl[i]);
-@@ -764,7 +774,8 @@ static int lvts_ctrl_init(struct device
+@@ -786,7 +796,8 @@ static int lvts_ctrl_init(struct device
* after initializing the calibration.
*/
lvts_ctrl[i].hw_tshut_raw_temp =
lvts_ctrl[i].low_thresh = INT_MIN;
lvts_ctrl[i].high_thresh = INT_MIN;
-@@ -1231,6 +1242,8 @@ static int lvts_probe(struct platform_de
+@@ -1253,6 +1264,8 @@ static int lvts_probe(struct platform_de
if (irq < 0)
return irq;
ret = lvts_domain_init(dev, lvts_td, lvts_data);
if (ret)
return dev_err_probe(dev, ret, "Failed to initialize the lvts domain\n");
-@@ -1344,11 +1357,15 @@ static const struct lvts_ctrl_data mt819
+@@ -1366,11 +1379,15 @@ static const struct lvts_ctrl_data mt819
static const struct lvts_data mt8195_lvts_mcu_data = {
.lvts_ctrl = mt8195_lvts_mcu_data_ctrl,
.num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_mcu_data_ctrl),
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
-@@ -82,6 +82,8 @@
+@@ -86,6 +86,8 @@
#define LVTS_GOLDEN_TEMP_DEFAULT 50
#define LVTS_COEFF_A_MT8195 -250460
#define LVTS_COEFF_B_MT8195 250460
#define LVTS_MSR_IMMEDIATE_MODE 0
#define LVTS_MSR_FILTERED_MODE 1
-@@ -89,6 +91,7 @@
+@@ -93,6 +95,7 @@
#define LVTS_MSR_READ_TIMEOUT_US 400
#define LVTS_MSR_READ_WAIT_US (LVTS_MSR_READ_TIMEOUT_US / 2)
#define LVTS_HW_SHUTDOWN_MT8195 105000
#define LVTS_MINIMUM_THRESHOLD 20000
-@@ -1275,6 +1278,33 @@ static void lvts_remove(struct platform_
+@@ -1297,6 +1300,33 @@ static void lvts_remove(struct platform_
lvts_debugfs_exit(lvts_td);
}
static const struct lvts_ctrl_data mt8195_lvts_mcu_data_ctrl[] = {
{
.cal_offset = { 0x04, 0x07 },
-@@ -1354,6 +1384,13 @@ static const struct lvts_ctrl_data mt819
+@@ -1376,6 +1406,13 @@ static const struct lvts_ctrl_data mt819
}
};
static const struct lvts_data mt8195_lvts_mcu_data = {
.lvts_ctrl = mt8195_lvts_mcu_data_ctrl,
.num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_mcu_data_ctrl),
-@@ -1369,6 +1406,7 @@ static const struct lvts_data mt8195_lvt
+@@ -1391,6 +1428,7 @@ static const struct lvts_data mt8195_lvt
};
static const struct of_device_id lvts_of_match[] = {
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
-@@ -219,7 +219,7 @@ static int lvts_debugfs_init(struct devi
+@@ -223,7 +223,7 @@ static int lvts_debugfs_init(struct devi
sprintf(name, "controller%d", i);
dentry = debugfs_create_dir(name, lvts_td->dom_dentry);
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
-@@ -1305,6 +1305,38 @@ static const struct lvts_ctrl_data mt798
+@@ -1327,6 +1327,38 @@ static const struct lvts_ctrl_data mt798
}
};
static const struct lvts_ctrl_data mt8195_lvts_mcu_data_ctrl[] = {
{
.cal_offset = { 0x04, 0x07 },
-@@ -1413,12 +1445,17 @@ static const struct of_device_id lvts_of
+@@ -1435,12 +1467,17 @@ static const struct of_device_id lvts_of
};
MODULE_DEVICE_TABLE(of, lvts_of_match);
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
-@@ -92,6 +92,7 @@
+@@ -96,6 +96,7 @@
#define LVTS_MSR_READ_WAIT_US (LVTS_MSR_READ_TIMEOUT_US / 2)
#define LVTS_HW_SHUTDOWN_MT7988 105000
#define LVTS_HW_SHUTDOWN_MT8195 105000
#define LVTS_MINIMUM_THRESHOLD 20000
-@@ -1337,6 +1338,88 @@ static int lvts_resume(struct device *de
+@@ -1359,6 +1360,88 @@ static int lvts_resume(struct device *de
return 0;
}
static const struct lvts_ctrl_data mt8195_lvts_mcu_data_ctrl[] = {
{
.cal_offset = { 0x04, 0x07 },
-@@ -1423,6 +1506,16 @@ static const struct lvts_data mt7988_lvt
+@@ -1445,6 +1528,16 @@ static const struct lvts_data mt7988_lvt
.temp_offset = LVTS_COEFF_B_MT7988,
};
static const struct lvts_data mt8195_lvts_mcu_data = {
.lvts_ctrl = mt8195_lvts_mcu_data_ctrl,
.num_lvts_ctrl = ARRAY_SIZE(mt8195_lvts_mcu_data_ctrl),
-@@ -1439,6 +1532,8 @@ static const struct lvts_data mt8195_lvt
+@@ -1461,6 +1554,8 @@ static const struct lvts_data mt8195_lvt
static const struct of_device_id lvts_of_match[] = {
{ .compatible = "mediatek,mt7988-lvts-ap", .data = &mt7988_lvts_ap_data },
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
-@@ -616,7 +616,34 @@ static int lvts_sensor_init(struct devic
+@@ -638,7 +638,34 @@ static int lvts_sensor_init(struct devic
* The efuse blob values follows the sensor enumeration per thermal
* controller. The decoding of the stream is as follow:
*
*
* <-----mcu-tc#0-----> <-----sensor#0-----> <-----sensor#1----->
* 0x01 | 0x02 | 0x03 | 0x04 | 0x05 | 0x06 | 0x07 | 0x08 | 0x09
-@@ -627,7 +654,7 @@ static int lvts_sensor_init(struct devic
+@@ -649,7 +676,7 @@ static int lvts_sensor_init(struct devic
* <-----mcu-tc#2-----> <-----sensor#4-----> <-----sensor#5-----> <-----sensor#6-----> <-----sensor#7----->
* 0x13 | 0x14 | 0x15 | 0x16 | 0x17 | 0x18 | 0x19 | 0x1A | 0x1B | 0x1C | 0x1D | 0x1E | 0x1F | 0x20 | 0x21
*