Merge branch 'openwrt:master' into master

This commit is contained in:
Hayzam Sherif 2023-03-30 00:08:35 +05:30 committed by GitHub
commit dbbc4c9556
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 254 additions and 34 deletions

View file

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=comgt PKG_NAME:=comgt
PKG_VERSION:=0.32 PKG_VERSION:=0.32
PKG_RELEASE:=34 PKG_RELEASE:=35
PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
PKG_SOURCE_URL:=@SF/comgt PKG_SOURCE_URL:=@SF/comgt
@ -79,6 +79,7 @@ define Package/comgt/install
$(INSTALL_DATA) ./files/getcarrier.gcom $(1)/etc/gcom/getcarrier.gcom $(INSTALL_DATA) ./files/getcarrier.gcom $(1)/etc/gcom/getcarrier.gcom
$(INSTALL_DATA) ./files/getcnum.gcom $(1)/etc/gcom/getcnum.gcom $(INSTALL_DATA) ./files/getcnum.gcom $(1)/etc/gcom/getcnum.gcom
$(INSTALL_DATA) ./files/getimsi.gcom $(1)/etc/gcom/getimsi.gcom $(INSTALL_DATA) ./files/getimsi.gcom $(1)/etc/gcom/getimsi.gcom
$(INSTALL_DATA) ./files/runcommand.gcom $(1)/etc/gcom/runcommand.gcom
$(INSTALL_DIR) $(1)/etc/hotplug.d/tty $(INSTALL_DIR) $(1)/etc/hotplug.d/tty
$(INSTALL_CONF) ./files/3g.usb $(1)/etc/hotplug.d/tty/30-3g $(INSTALL_CONF) ./files/3g.usb $(1)/etc/hotplug.d/tty/30-3g
$(INSTALL_DIR) $(1)/lib/netifd/proto $(INSTALL_DIR) $(1)/lib/netifd/proto
@ -96,7 +97,6 @@ endef
define Package/comgt-ncm/install define Package/comgt-ncm/install
$(INSTALL_DIR) $(1)/etc/gcom $(INSTALL_DIR) $(1)/etc/gcom
$(INSTALL_DATA) ./files/ncm.json $(1)/etc/gcom/ncm.json $(INSTALL_DATA) ./files/ncm.json $(1)/etc/gcom/ncm.json
$(INSTALL_DATA) ./files/runcommand.gcom $(1)/etc/gcom/runcommand.gcom
$(INSTALL_DIR) $(1)/lib/netifd/proto $(INSTALL_DIR) $(1)/lib/netifd/proto
$(INSTALL_BIN) ./files/ncm.sh $(1)/lib/netifd/proto/ncm.sh $(INSTALL_BIN) ./files/ncm.sh $(1)/lib/netifd/proto/ncm.sh
endef endef

View file

@ -72,6 +72,8 @@ proto_3g_setup() {
*) CODE="2,2";; *) CODE="2,2";;
esac esac
export MODE="AT^SYSCFG=${CODE},3FFFFFFF,2,4" export MODE="AT^SYSCFG=${CODE},3FFFFFFF,2,4"
elif echo "$cardinfo" | grep -q "MikroTik"; then
COMMAND="AT+CFUN=1" gcom -d "$device" -s /etc/gcom/runcommand.gcom || return 1
fi fi
if [ -n "$pincode" ]; then if [ -n "$pincode" ]; then

View file

@ -112,5 +112,17 @@
], ],
"connect": "AT+ZGACT=1,${profile}", "connect": "AT+ZGACT=1,${profile}",
"disconnect": "AT+ZGACT=0,${profile}" "disconnect": "AT+ZGACT=0,${profile}"
},
"\"mikrotik\"": {
"configure": [
"AT+CFUN=4",
"AT+ZGDCONT=${profile},\\\"${pdptype}\\\",\\\"${apn}\\\",0",
"AT+ZDHCPLEASE=10",
"AT+CFUN=1"
],
"waitforconnect": "\\\"+ZCONSTAT: 1,${context_type}\\\",\\\"+ZGIPDNS: ${context_type}\\\"",
"connect": "AT+ZGACT=1,${context_type}",
"finalize": "AT+ZDHCPLEASE=0",
"disconnect": "AT+ZGACT=0,1"
} }
} }

View file

@ -145,6 +145,13 @@
nvmem-cells = <&macaddr_cfe_6a0>; nvmem-cells = <&macaddr_cfe_6a0>;
nvmem-cell-names = "mac-address"; nvmem-cell-names = "mac-address";
phy-mode = "mii";
fixed-link {
speed = <100>;
full-duplex;
};
}; };
&iudma { &iudma {

View file

@ -128,6 +128,8 @@ struct bcm6348_iudma {
unsigned int dma_channels; unsigned int dma_channels;
}; };
int bcm6348_iudma_drivers_register(struct platform_device *pdev);
static inline u32 dma_readl(struct bcm6348_iudma *iudma, u32 off) static inline u32 dma_readl(struct bcm6348_iudma *iudma, u32 off)
{ {
u32 val; u32 val;
@ -269,7 +271,7 @@ static int bcm6348_iudma_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, iudma); platform_set_drvdata(pdev, iudma);
return 0; return bcm6348_iudma_drivers_register(pdev);
} }
static const struct of_device_id bcm6348_iudma_of_match[] = { static const struct of_device_id bcm6348_iudma_of_match[] = {
@ -489,6 +491,11 @@ struct bcm6348_emac {
/* external mii bus */ /* external mii bus */
bool ext_mii; bool ext_mii;
/* phy */
int old_link;
int old_duplex;
int old_pause;
}; };
static inline void emac_writel(struct bcm6348_emac *emac, u32 val, u32 off) static inline void emac_writel(struct bcm6348_emac *emac, u32 val, u32 off)
@ -968,6 +975,96 @@ static void bcm6348_emac_disable_mac(struct bcm6348_emac *emac)
} while (limit--); } while (limit--);
} }
/*
* set emac duplex parameters
*/
static void bcm6348_emac_set_duplex(struct bcm6348_emac *emac, int fullduplex)
{
u32 val;
val = emac_readl(emac, ENET_TXCTL_REG);
if (fullduplex)
val |= ENET_TXCTL_FD_MASK;
else
val &= ~ENET_TXCTL_FD_MASK;
emac_writel(emac, val, ENET_TXCTL_REG);
}
/*
* set emac flow control parameters
*/
static void bcm6348_emac_set_flow(struct bcm6348_emac *emac, bool rx_en, bool tx_en)
{
struct bcm6348_iudma *iudma = emac->iudma;
u32 val;
val = emac_readl(emac, ENET_RXCFG_REG);
if (rx_en)
val |= ENET_RXCFG_ENFLOW_MASK;
else
val &= ~ENET_RXCFG_ENFLOW_MASK;
emac_writel(emac, val, ENET_RXCFG_REG);
dmas_writel(iudma, emac->rx_desc_dma, DMAS_RSTART_REG, emac->rx_chan);
dmas_writel(iudma, emac->tx_desc_dma, DMAS_RSTART_REG, emac->tx_chan);
val = dma_readl(iudma, DMA_CFG_REG);
if (tx_en)
val |= DMA_CFG_FLOWCH_MASK(emac->rx_chan);
else
val &= ~DMA_CFG_FLOWCH_MASK(emac->rx_chan);
dma_writel(iudma, val, DMA_CFG_REG);
}
/*
* adjust emac phy
*/
static void bcm6348_emac_adjust_phy(struct net_device *ndev)
{
struct phy_device *phydev = ndev->phydev;
struct bcm6348_emac *emac = netdev_priv(ndev);
struct platform_device *pdev = emac->pdev;
struct device *dev = &pdev->dev;
bool status_changed = false;
if (emac->old_link != phydev->link) {
status_changed = true;
emac->old_link = phydev->link;
}
if (phydev->link && phydev->duplex != emac->old_duplex) {
bcm6348_emac_set_duplex(emac, phydev->duplex == DUPLEX_FULL);
status_changed = true;
emac->old_duplex = phydev->duplex;
}
if (phydev->link && phydev->pause != emac->old_pause) {
bool rx_pause_en, tx_pause_en;
if (phydev->pause) {
rx_pause_en = true;
tx_pause_en = true;
} else {
rx_pause_en = false;
tx_pause_en = false;
}
bcm6348_emac_set_flow(emac, rx_pause_en, tx_pause_en);
status_changed = true;
emac->old_pause = phydev->pause;
}
if (status_changed)
dev_info(dev, "%s: phy link %s %s/%s/%s/%s\n",
ndev->name,
phydev->link ? "UP" : "DOWN",
phy_modes(phydev->interface),
phy_speed_to_str(phydev->speed),
phy_duplex_to_str(phydev->duplex),
phydev->pause ? "rx/tx" : "off");
}
static int bcm6348_emac_open(struct net_device *ndev) static int bcm6348_emac_open(struct net_device *ndev)
{ {
struct bcm6348_emac *emac = netdev_priv(ndev); struct bcm6348_emac *emac = netdev_priv(ndev);
@ -1133,6 +1230,9 @@ static int bcm6348_emac_open(struct net_device *ndev)
dmac_writel(iudma, DMAC_IR_PKTDONE_MASK, dmac_writel(iudma, DMAC_IR_PKTDONE_MASK,
DMAC_IRMASK_REG, emac->tx_chan); DMAC_IRMASK_REG, emac->tx_chan);
if (ndev->phydev)
phy_start(ndev->phydev);
netif_carrier_on(ndev); netif_carrier_on(ndev);
netif_start_queue(ndev); netif_start_queue(ndev);
@ -1171,6 +1271,9 @@ out_freeirq_rx:
free_irq(emac->irq_rx, ndev); free_irq(emac->irq_rx, ndev);
out_freeirq: out_freeirq:
if (ndev->phydev)
phy_disconnect(ndev->phydev);
return ret; return ret;
} }
@ -1183,6 +1286,8 @@ static int bcm6348_emac_stop(struct net_device *ndev)
netif_stop_queue(ndev); netif_stop_queue(ndev);
napi_disable(&emac->napi); napi_disable(&emac->napi);
if (ndev->phydev)
phy_stop(ndev->phydev);
del_timer_sync(&emac->rx_timeout); del_timer_sync(&emac->rx_timeout);
/* mask all interrupts */ /* mask all interrupts */
@ -1454,6 +1559,10 @@ static int bcm6348_emac_probe(struct platform_device *pdev)
emac->tx_ring_size = ENET_DEF_TX_DESC; emac->tx_ring_size = ENET_DEF_TX_DESC;
emac->copybreak = ENET_DEF_CPY_BREAK; emac->copybreak = ENET_DEF_CPY_BREAK;
emac->old_link = 0;
emac->old_duplex = -1;
emac->old_pause = -1;
of_get_mac_address(node, ndev->dev_addr); of_get_mac_address(node, ndev->dev_addr);
if (is_valid_ether_addr(ndev->dev_addr)) { if (is_valid_ether_addr(ndev->dev_addr)) {
dev_info(dev, "mtd mac %pM\n", ndev->dev_addr); dev_info(dev, "mtd mac %pM\n", ndev->dev_addr);
@ -1543,6 +1652,11 @@ static int bcm6348_emac_probe(struct platform_device *pdev)
netif_carrier_off(ndev); netif_carrier_off(ndev);
ndev->phydev = of_phy_get_and_connect(ndev, node,
bcm6348_emac_adjust_phy);
if (IS_ERR_OR_NULL(ndev->phydev))
dev_warn(dev, "PHY not found!\n");
dev_info(dev, "%s at 0x%px, IRQ %d\n", ndev->name, emac->base, dev_info(dev, "%s at 0x%px, IRQ %d\n", ndev->name, emac->base,
ndev->irq); ndev->irq);
@ -1591,4 +1705,15 @@ static struct platform_driver bcm6348_emac_driver = {
.probe = bcm6348_emac_probe, .probe = bcm6348_emac_probe,
.remove = bcm6348_emac_remove, .remove = bcm6348_emac_remove,
}; };
module_platform_driver(bcm6348_emac_driver);
int bcm6348_iudma_drivers_register(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
int ret;
ret = platform_driver_register(&bcm6348_emac_driver);
if (ret)
dev_err(dev, "error registering emac driver!\n");
return ret;
}

View file

@ -0,0 +1,31 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Fri, 24 Mar 2023 14:56:58 +0100
Subject: [PATCH] net: ethernet: mtk_eth_soc: fix tx throughput regression with
direct 1G links
Using the QDMA tx scheduler to throttle tx to line speed works fine for
switch ports, but apparently caused a regression on non-switch ports.
Based on a number of tests, it seems that this throttling can be safely
dropped without re-introducing the issues on switch ports that the
tx scheduling changes resolved.
Link: https://lore.kernel.org/netdev/trinity-92c3826f-c2c8-40af-8339-bc6d0d3ffea4-1678213958520@3c-app-gmx-bs16/
Fixes: f63959c7eec3 ("net: ethernet: mtk_eth_soc: implement multi-queue support for per-port queues")
Reported-by: Frank Wunderlich <frank-w@public-files.de>
Reported-by: Daniel Golle <daniel@makrotopia.org>
Tested-by: Daniel Golle <daniel@makrotopia.org>
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
@@ -676,8 +676,6 @@ static void mtk_mac_link_up(struct phyli
break;
}
- mtk_set_queue_speed(mac->hw, mac->id, speed);
-
/* Configure duplex */
if (duplex == DUPLEX_FULL)
mcr |= MAC_MCR_FORCE_DPX;

View file

@ -34,7 +34,7 @@
mtk_eth_path_name(path), __func__, updated); mtk_eth_path_name(path), __func__, updated);
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -4757,6 +4757,26 @@ static const struct mtk_soc_data mt7629_ @@ -4755,6 +4755,26 @@ static const struct mtk_soc_data mt7629_
}, },
}; };
@ -61,7 +61,7 @@
static const struct mtk_soc_data mt7986_data = { static const struct mtk_soc_data mt7986_data = {
.reg_map = &mt7986_reg_map, .reg_map = &mt7986_reg_map,
.ana_rgc3 = 0x128, .ana_rgc3 = 0x128,
@@ -4799,6 +4819,7 @@ const struct of_device_id of_mtk_match[] @@ -4797,6 +4817,7 @@ const struct of_device_id of_mtk_match[]
{ .compatible = "mediatek,mt7622-eth", .data = &mt7622_data}, { .compatible = "mediatek,mt7622-eth", .data = &mt7622_data},
{ .compatible = "mediatek,mt7623-eth", .data = &mt7623_data}, { .compatible = "mediatek,mt7623-eth", .data = &mt7623_data},
{ .compatible = "mediatek,mt7629-eth", .data = &mt7629_data}, { .compatible = "mediatek,mt7629-eth", .data = &mt7629_data},

View file

@ -21,7 +21,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -704,8 +704,10 @@ static const struct phylink_mac_ops mtk_ @@ -702,8 +702,10 @@ static const struct phylink_mac_ops mtk_
static int mtk_mdio_init(struct mtk_eth *eth) static int mtk_mdio_init(struct mtk_eth *eth)
{ {
@ -32,7 +32,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
mii_np = of_get_child_by_name(eth->dev->of_node, "mdio-bus"); mii_np = of_get_child_by_name(eth->dev->of_node, "mdio-bus");
if (!mii_np) { if (!mii_np) {
@@ -731,6 +733,25 @@ static int mtk_mdio_init(struct mtk_eth @@ -729,6 +731,25 @@ static int mtk_mdio_init(struct mtk_eth
eth->mii_bus->parent = eth->dev; eth->mii_bus->parent = eth->dev;
snprintf(eth->mii_bus->id, MII_BUS_ID_SIZE, "%pOFn", mii_np); snprintf(eth->mii_bus->id, MII_BUS_ID_SIZE, "%pOFn", mii_np);

View file

@ -60,7 +60,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
} }
return NULL; return NULL;
@@ -3979,8 +3980,17 @@ static int mtk_unreg_dev(struct mtk_eth @@ -3977,8 +3978,17 @@ static int mtk_unreg_dev(struct mtk_eth
return 0; return 0;
} }
@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
mtk_unreg_dev(eth); mtk_unreg_dev(eth);
mtk_free_dev(eth); mtk_free_dev(eth);
cancel_work_sync(&eth->pending_work); cancel_work_sync(&eth->pending_work);
@@ -4410,6 +4420,36 @@ void mtk_eth_set_dma_device(struct mtk_e @@ -4408,6 +4418,36 @@ void mtk_eth_set_dma_device(struct mtk_e
rtnl_unlock(); rtnl_unlock();
} }
@ -115,7 +115,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
static int mtk_probe(struct platform_device *pdev) static int mtk_probe(struct platform_device *pdev)
{ {
struct resource *res = NULL; struct resource *res = NULL;
@@ -4473,13 +4513,7 @@ static int mtk_probe(struct platform_dev @@ -4471,13 +4511,7 @@ static int mtk_probe(struct platform_dev
} }
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SGMII)) { if (MTK_HAS_CAPS(eth->soc->caps, MTK_SGMII)) {
@ -130,7 +130,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
if (err) if (err)
return err; return err;
@@ -4490,14 +4524,17 @@ static int mtk_probe(struct platform_dev @@ -4488,14 +4522,17 @@ static int mtk_probe(struct platform_dev
"mediatek,pctl"); "mediatek,pctl");
if (IS_ERR(eth->pctl)) { if (IS_ERR(eth->pctl)) {
dev_err(&pdev->dev, "no pctl regmap found\n"); dev_err(&pdev->dev, "no pctl regmap found\n");
@ -151,7 +151,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
} }
if (eth->soc->offload_version) { if (eth->soc->offload_version) {
@@ -4657,6 +4694,8 @@ err_deinit_hw: @@ -4655,6 +4692,8 @@ err_deinit_hw:
mtk_hw_deinit(eth); mtk_hw_deinit(eth);
err_wed_exit: err_wed_exit:
mtk_wed_exit(); mtk_wed_exit();

View file

@ -9,6 +9,7 @@ CONFIG_CLANG_VERSION=.*
# CONFIG_INLINE_.* is not set # CONFIG_INLINE_.* is not set
# CONFIG_LD_.* is not set # CONFIG_LD_.* is not set
CONFIG_LLD_VERSION=.* CONFIG_LLD_VERSION=.*
CONFIG_PAHOLE_VERSION=.*
CONFIG_PLUGIN_HOSTCC=".*" CONFIG_PLUGIN_HOSTCC=".*"
# CONFIG_SET_FS is not set # CONFIG_SET_FS is not set
# CONFIG_TASKS_.* is not set # CONFIG_TASKS_.* is not set

View file

@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2994,8 +2994,8 @@ static irqreturn_t mtk_handle_irq_rx(int @@ -2992,8 +2992,8 @@ static irqreturn_t mtk_handle_irq_rx(int
eth->rx_events++; eth->rx_events++;
if (likely(napi_schedule_prep(&eth->rx_napi))) { if (likely(napi_schedule_prep(&eth->rx_napi))) {
@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
} }
return IRQ_HANDLED; return IRQ_HANDLED;
@@ -3007,8 +3007,8 @@ static irqreturn_t mtk_handle_irq_tx(int @@ -3005,8 +3005,8 @@ static irqreturn_t mtk_handle_irq_tx(int
eth->tx_events++; eth->tx_events++;
if (likely(napi_schedule_prep(&eth->tx_napi))) { if (likely(napi_schedule_prep(&eth->tx_napi))) {
@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
} }
return IRQ_HANDLED; return IRQ_HANDLED;
@@ -4675,6 +4675,8 @@ static int mtk_probe(struct platform_dev @@ -4673,6 +4673,8 @@ static int mtk_probe(struct platform_dev
* for NAPI to work * for NAPI to work
*/ */
init_dummy_netdev(&eth->dummy_dev); init_dummy_netdev(&eth->dummy_dev);

View file

@ -53,7 +53,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -4644,8 +4644,8 @@ static int mtk_probe(struct platform_dev @@ -4642,8 +4642,8 @@ static int mtk_probe(struct platform_dev
for (i = 0; i < num_ppe; i++) { for (i = 0; i < num_ppe; i++) {
u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400; u32 ppe_addr = eth->soc->reg_map->ppe_base + i * 0x400;
@ -64,7 +64,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
if (!eth->ppe[i]) { if (!eth->ppe[i]) {
err = -ENOMEM; err = -ENOMEM;
goto err_free_dev; goto err_free_dev;
@@ -4772,6 +4772,7 @@ static const struct mtk_soc_data mt7622_ @@ -4770,6 +4770,7 @@ static const struct mtk_soc_data mt7622_
.required_pctl = false, .required_pctl = false,
.offload_version = 2, .offload_version = 2,
.hash_offset = 2, .hash_offset = 2,
@ -72,7 +72,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
.foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
.txrx = { .txrx = {
.txd_size = sizeof(struct mtk_tx_dma), .txd_size = sizeof(struct mtk_tx_dma),
@@ -4809,6 +4810,7 @@ static const struct mtk_soc_data mt7629_ @@ -4807,6 +4808,7 @@ static const struct mtk_soc_data mt7629_
.hw_features = MTK_HW_FEATURES, .hw_features = MTK_HW_FEATURES,
.required_clks = MT7629_CLKS_BITMAP, .required_clks = MT7629_CLKS_BITMAP,
.required_pctl = false, .required_pctl = false,
@ -80,7 +80,7 @@ v2: fix wrong variable name in return value check spotted by Denis Kirjanov
.txrx = { .txrx = {
.txd_size = sizeof(struct mtk_tx_dma), .txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma), .rxd_size = sizeof(struct mtk_rx_dma),
@@ -4829,6 +4831,7 @@ static const struct mtk_soc_data mt7981_ @@ -4827,6 +4829,7 @@ static const struct mtk_soc_data mt7981_
.offload_version = 2, .offload_version = 2,
.hash_offset = 4, .hash_offset = 4,
.foe_entry_size = sizeof(struct mtk_foe_entry), .foe_entry_size = sizeof(struct mtk_foe_entry),

View file

@ -17,7 +17,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1852,9 +1852,7 @@ static int mtk_poll_rx(struct napi_struc @@ -1850,9 +1850,7 @@ static int mtk_poll_rx(struct napi_struc
while (done < budget) { while (done < budget) {
unsigned int pktlen, *rxdcsum; unsigned int pktlen, *rxdcsum;
@ -27,7 +27,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
dma_addr_t dma_addr; dma_addr_t dma_addr;
u32 hash, reason; u32 hash, reason;
int mac = 0; int mac = 0;
@@ -1989,36 +1987,21 @@ static int mtk_poll_rx(struct napi_struc @@ -1987,36 +1985,21 @@ static int mtk_poll_rx(struct napi_struc
skb_checksum_none_assert(skb); skb_checksum_none_assert(skb);
skb->protocol = eth_type_trans(skb, netdev); skb->protocol = eth_type_trans(skb, netdev);
@ -70,7 +70,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
skb_record_rx_queue(skb, 0); skb_record_rx_queue(skb, 0);
napi_gro_receive(napi, skb); napi_gro_receive(napi, skb);
@@ -2833,29 +2816,11 @@ static netdev_features_t mtk_fix_feature @@ -2831,29 +2814,11 @@ static netdev_features_t mtk_fix_feature
static int mtk_set_features(struct net_device *dev, netdev_features_t features) static int mtk_set_features(struct net_device *dev, netdev_features_t features)
{ {
@ -100,7 +100,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
return 0; return 0;
} }
@@ -3169,30 +3134,6 @@ static int mtk_open(struct net_device *d @@ -3167,30 +3132,6 @@ static int mtk_open(struct net_device *d
struct mtk_eth *eth = mac->hw; struct mtk_eth *eth = mac->hw;
int i, err; int i, err;
@ -131,7 +131,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0); err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0);
if (err) { if (err) {
netdev_err(dev, "%s: could not attach PHY: %d\n", __func__, netdev_err(dev, "%s: could not attach PHY: %d\n", __func__,
@@ -3233,6 +3174,35 @@ static int mtk_open(struct net_device *d @@ -3231,6 +3172,35 @@ static int mtk_open(struct net_device *d
phylink_start(mac->phylink); phylink_start(mac->phylink);
netif_tx_start_all_queues(dev); netif_tx_start_all_queues(dev);
@ -167,7 +167,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
return 0; return 0;
} }
@@ -3717,10 +3687,9 @@ static int mtk_hw_init(struct mtk_eth *e @@ -3715,10 +3685,9 @@ static int mtk_hw_init(struct mtk_eth *e
if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
val = mtk_r32(eth, MTK_CDMP_IG_CTRL); val = mtk_r32(eth, MTK_CDMP_IG_CTRL);
mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL); mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL);
@ -180,7 +180,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/* set interrupt delays based on current Net DIM sample */ /* set interrupt delays based on current Net DIM sample */
mtk_dim_rx(&eth->rx_dim.work); mtk_dim_rx(&eth->rx_dim.work);
@@ -4367,7 +4336,7 @@ static int mtk_add_mac(struct mtk_eth *e @@ -4365,7 +4334,7 @@ static int mtk_add_mac(struct mtk_eth *e
eth->netdev[id]->hw_features |= NETIF_F_LRO; eth->netdev[id]->hw_features |= NETIF_F_LRO;
eth->netdev[id]->vlan_features = eth->soc->hw_features & eth->netdev[id]->vlan_features = eth->soc->hw_features &

View file

@ -16,7 +16,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1425,12 +1425,28 @@ static void mtk_wake_queue(struct mtk_et @@ -1423,12 +1423,28 @@ static void mtk_wake_queue(struct mtk_et
} }
} }
@ -45,7 +45,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
bool gso = false; bool gso = false;
int tx_num; int tx_num;
@@ -1452,6 +1468,18 @@ static netdev_tx_t mtk_start_xmit(struct @@ -1450,6 +1466,18 @@ static netdev_tx_t mtk_start_xmit(struct
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
@ -64,7 +64,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/* TSO: fill MSS info in tcp checksum field */ /* TSO: fill MSS info in tcp checksum field */
if (skb_is_gso(skb)) { if (skb_is_gso(skb)) {
if (skb_cow_head(skb, 0)) { if (skb_cow_head(skb, 0)) {
@@ -1467,8 +1495,14 @@ static netdev_tx_t mtk_start_xmit(struct @@ -1465,8 +1493,14 @@ static netdev_tx_t mtk_start_xmit(struct
} }
} }

View file

@ -0,0 +1,42 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Wed, 29 Mar 2023 16:02:54 +0200
Subject: [PATCH] net: ethernet: mtk_eth_soc: fix remaining throughput
regression
Based on further tests, it seems that the QDMA shaper is not able to
perform shaping close to the MAC link rate without throughput loss.
This cannot be compensated by increasing the shaping rate, so it seems
to be an internal limit.
Fix the remaining throughput regression by detecting that condition and
limiting shaping to ports with lower link speed.
This patch intentionally ignores link speed gain from TRGMII, because
even on such links, shaping to 1000 Mbit/s incurs some throughput
degradation.
Fixes: f63959c7eec3 ("net: ethernet: mtk_eth_soc: implement multi-queue support for per-port queues")
Reported-by: Frank Wunderlich <frank-w@public-files.de>
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
@@ -667,6 +667,7 @@ static void mtk_mac_link_up(struct phyli
MAC_MCR_FORCE_RX_FC);
/* Configure speed */
+ mac->speed = speed;
switch (speed) {
case SPEED_2500:
case SPEED_1000:
@@ -3145,6 +3146,9 @@ found:
if (dp->index >= MTK_QDMA_NUM_QUEUES)
return NOTIFY_DONE;
+ if (mac->speed > 0 && mac->speed <= s.base.speed)
+ s.base.speed = 0;
+
mtk_set_queue_speed(eth, dp->index + 3, s.base.speed);
return NOTIFY_DONE;

View file

@ -44,7 +44,7 @@ define Device/asus_tuf-ax4200
DEVICE_DTS := mt7986a-asus-tuf-ax4200 DEVICE_DTS := mt7986a-asus-tuf-ax4200
DEVICE_DTS_DIR := ../dts DEVICE_DTS_DIR := ../dts
DEVICE_DTS_LOADADDR := 0x47000000 DEVICE_DTS_LOADADDR := 0x47000000
DEVICE_PACKAGES := kmod-usb3 DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware
IMAGES := sysupgrade.bin IMAGES := sysupgrade.bin
KERNEL_LOADADDR := 0x48000000 KERNEL_LOADADDR := 0x48000000
KERNEL = kernel-bin | lzma | \ KERNEL = kernel-bin | lzma | \

View file

@ -103,7 +103,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
ret = mtk_mdio_busy_wait(eth); ret = mtk_mdio_busy_wait(eth);
if (ret < 0) if (ret < 0)
@@ -730,6 +773,7 @@ static int mtk_mdio_init(struct mtk_eth @@ -729,6 +772,7 @@ static int mtk_mdio_init(struct mtk_eth
eth->mii_bus->name = "mdio"; eth->mii_bus->name = "mdio";
eth->mii_bus->read = mtk_mdio_read; eth->mii_bus->read = mtk_mdio_read;
eth->mii_bus->write = mtk_mdio_write; eth->mii_bus->write = mtk_mdio_write;

View file

@ -14,7 +14,7 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -4259,6 +4259,7 @@ static const struct net_device_ops mtk_n @@ -4261,6 +4261,7 @@ static const struct net_device_ops mtk_n
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
{ {
@ -22,7 +22,7 @@ Signed-off-by: René van Dorst <opensource@vdorst.com>
const __be32 *_id = of_get_property(np, "reg", NULL); const __be32 *_id = of_get_property(np, "reg", NULL);
phy_interface_t phy_mode; phy_interface_t phy_mode;
struct phylink *phylink; struct phylink *phylink;
@@ -4387,6 +4388,9 @@ static int mtk_add_mac(struct mtk_eth *e @@ -4389,6 +4390,9 @@ static int mtk_add_mac(struct mtk_eth *e
register_netdevice_notifier(&mac->device_notifier); register_netdevice_notifier(&mac->device_notifier);
} }