
From: mengxiangdong <mengxiangdong@loongson.cn> mainline inclusion from mainline-v6.15-rc1 commit 8dbf0c7556454b52af91bae305ca71500c31495c category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ICOFL4 CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... -------------------------------- Now for dwmac-loongson {tx,rx}_fifo_size are uninitialised, which means zero. This means dwmac-loongson doesn't support changing MTU because in stmmac_change_mtu() it requires the fifo size be no less than MTU. Thus, set the correct tx_fifo_size and rx_fifo_size for it (16KB multiplied by queue counts). Here {tx,rx}_fifo_size is initialised with the initial value (also the maximum value) of {tx,rx}_queues_to_use. So it will keep as 16KB if we don't change the queue count, and will be larger than 16KB if we change (decrease) the queue count. However stmmac_change_mtu() still work well with current logic (MTU cannot be larger than 16KB for stmmac). [ Upstream commit 6ef8067def5c76397299816e28f1ff8a950c2281 ] Change-Id: I424bdc771031a1553d25f6f39e62788161795e7e Signed-off-by: mengxiangdong <mengxiangdong@loongson.cn> Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn> --- drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c index 0bb4081c8c41..555793886aa1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c @@ -549,6 +549,9 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id if (ret) goto err_disable_device; + plat->tx_fifo_size = SZ_16K * plat->tx_queues_to_use; + plat->rx_fifo_size = SZ_16K * plat->rx_queues_to_use; + if (np) { plat->mdio_node = of_get_child_by_name(np, "mdio"); if (plat->mdio_node) { -- 2.33.0