From 78e01d87292c42bc8b66e8032ff9e37b7f6ec6d1 Mon Sep 17 00:00:00 2001 From: hanwckf Date: Tue, 23 Jan 2024 22:06:18 +0800 Subject: [PATCH] mediatek: hnat: set ppe num to 1 for GMAC1 mode --- .../luci-static/resources/view/turboacc.js | 16 +++++++++------- .../root/usr/libexec/rpcd/luci.turboacc | 1 + .../net/ethernet/mediatek/mtk_hnat/hnat.c | 3 +++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/package/mtk/applications/luci-app-turboacc-mtk/htdocs/luci-static/resources/view/turboacc.js b/package/mtk/applications/luci-app-turboacc-mtk/htdocs/luci-static/resources/view/turboacc.js index 18a9946c45..b2276a9ff4 100644 --- a/package/mtk/applications/luci-app-turboacc-mtk/htdocs/luci-static/resources/view/turboacc.js +++ b/package/mtk/applications/luci-app-turboacc-mtk/htdocs/luci-static/resources/view/turboacc.js @@ -239,13 +239,15 @@ return view.extend({ o.placeholder = 30; o.depends('fastpath_mh_eth_hnat', '1'); - o = s.option(form.ListValue, 'fastpath_mh_eth_hnat_ppenum', _('Number of HNAT PPE'), - _('Apply this setting after reboot.')); - o.rmempty = false; - o.value(1); - o.value(2); - o.default = 1; - o.depends('fastpath_mh_eth_hnat', '1'); + if (features.hasGMAC2) { + o = s.option(form.ListValue, 'fastpath_mh_eth_hnat_ppenum', _('Number of HNAT PPE'), + _('Apply this setting after reboot.')); + o.rmempty = false; + o.value(1); + o.value(2); + o.default = 1; + o.depends('fastpath_mh_eth_hnat', '1'); + } o = s.option(form.ListValue, 'fullcone', _('Full cone NAT'), _('Full cone NAT (NAT1) can improve gaming performance effectively.')); diff --git a/package/mtk/applications/luci-app-turboacc-mtk/root/usr/libexec/rpcd/luci.turboacc b/package/mtk/applications/luci-app-turboacc-mtk/root/usr/libexec/rpcd/luci.turboacc index 298b15adfa..cdc34117a3 100755 --- a/package/mtk/applications/luci-app-turboacc-mtk/root/usr/libexec/rpcd/luci.turboacc +++ b/package/mtk/applications/luci-app-turboacc-mtk/root/usr/libexec/rpcd/luci.turboacc @@ -24,6 +24,7 @@ local methods = { hasFASTCLASSIFIER = fs.access("/lib/modules/" .. boardinfo.kernel .. "/fast-classifier.ko"), hasSHORTCUTFECM = fs.access("/lib/modules/" .. boardinfo.kernel .. "/shortcut-fe-cm.ko"), hasMEDIATEKHNAT = fs.access("/lib/modules/" .. boardinfo.kernel .. "/mtkhnat.ko"), + hasGMAC2 = fs.access("/sys/class/net/eth1"), hasXTFULLCONENAT = fs.access("/lib/modules/" .. boardinfo.kernel .. "/xt_FULLCONENAT.ko"), hasTCPCCA = readfile("/proc/sys/net/ipv4/tcp_available_congestion_control") } diff --git a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c index f1cd6b3165..9dd3b84155 100644 --- a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c +++ b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c @@ -734,6 +734,9 @@ static int hnat_probe(struct platform_device *pdev) hnat_priv->ppe_num = ppe_cnt; + if (IS_GMAC1_MODE) + hnat_priv->ppe_num = 1; + dev_info(&pdev->dev, "ppe num = %d\n", hnat_priv->ppe_num); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);