Message ID | 20250308180014.1151187-1-dqfext@gmail.com |
---|---|
State | New |
Headers | show |
Series | kernel: Mediatek: fix EEE registers init | expand |
Hi, On Sat, Mar 8, 2025 at 7:01 PM Qingfang Deng <dqfext@gmail.com> wrote: > > After booting, a "transmit queue 0 timed out" warning followed by a > register dump was observed. The dump indicates that mtk_hw_init() does > not initialize the EEECR during probe. This occurs because the > netdev is allocated in mtk_add_mac(), which is called after > mtk_hw_init(). Consequently, the EEECR register remains uninitialized > until a reset is triggered, causing mtk_hw_init() to run again with a > valid netdev, at which point the register is finally set. > > To address this, instead of modifying the probe sequence, latch the Tx > LPI enable state and timer value, and move the EEECR register > initialization to mtk_mac_link_up() to ensure proper setup when the > interface comes up. > > Additionally, the splat reveals that LPI functionality is controlled by > the MAC_MCR_EEE bits in the MCR register. Update mtk_set_eee() to > modify these bits accordingly. > > Fixes: d8315d5358d5 ("kernel: backport Mediatek SoC EEE support") > Fixes: edddbaf79ccf ("kernel: Mediatek: set default EEE Tx LPI timer") > Signed-off-by: Qingfang Deng <dqfext@gmail.com> > --- > ...et-ethernet-mediatek-add-EEE-support.patch | 57 ++++++++++++------- > ..._eth_soc-add-hw-dump-for-forced-rese.patch | 4 +- > ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 2 +- > ..._eth_soc-reset-all-TX-queues-on-DMA-.patch | 2 +- > ..._eth_soc-compile-out-netsys-v2-code-.patch | 4 +- > ..._eth_soc-work-around-issue-with-send.patch | 6 +- > ...ernet-mtk_eth_soc-use-napi_build_skb.patch | 4 +- > ...-mediatek-enlarge-DMA-reserve-buffer.patch | 2 +- > ..._eth_soc-fix-memory-corruption-durin.patch | 2 +- > ..._eth_soc-add-paths-and-SerDes-modes-.patch | 26 ++++----- > ...th_soc-reduce-rx-ring-size-for-older.patch | 16 +++--- > ..._eth_soc-do-not-enable-page-pool-sta.patch | 4 +- > 12 files changed, 71 insertions(+), 58 deletions(-) > > diff --git a/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch b/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch > index d9b86ae36e..b908d133b5 100644 > --- a/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch > +++ b/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch > @@ -23,34 +23,23 @@ Signed-off-by: Qingfang Deng <dqfext@gmail.com> > MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_TX_FC | > MAC_MCR_FORCE_RX_FC); > > -@@ -811,6 +812,18 @@ static void mtk_mac_link_up(struct phyli > +@@ -811,6 +812,15 @@ static void mtk_mac_link_up(struct phyli > if (rx_pause) > mcr |= MAC_MCR_FORCE_RX_FC; > > -+ if (mode == MLO_AN_PHY && phy && phy_init_eee(phy, false) >= 0) { > -+ switch (speed) { > -+ case SPEED_2500: > -+ case SPEED_1000: > -+ mcr |= MAC_MCR_EEE1G; > -+ break; > -+ case SPEED_100: > -+ mcr |= MAC_MCR_EEE100M; > -+ break; > -+ } > ++ if (mode == MLO_AN_PHY && phy && mac->tx_lpi_enabled && phy_init_eee(phy, false) >= 0) { > ++ mcr |= MAC_MCR_EEE100M | MAC_MCR_EEE1G; > ++ mtk_w32(mac->hw, > ++ FIELD_PREP(MAC_EEE_WAKEUP_TIME_1000, 17) | > ++ FIELD_PREP(MAC_EEE_WAKEUP_TIME_100, 36) | > ++ FIELD_PREP(MAC_EEE_LPI_TXIDLE_THD, mac->txidle_thd_ms), > ++ MTK_MAC_EEECR(mac->id)); > + } > + Please don't modify backported patches, they represent upstream accepted changes, so they are immutable in that regard (apart from required changes for adapting them to older kernels). Just add a patch on top that fixes the behavior, and ideally also send it upstream to netdev so it gets proper review etc. Best Regards, Jonas
Hi Jonas, Due to major API changes upstream, the feature wasn't backported as-is. https://web.git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=952d7325362ffbefa6ce5619fb4e53c2159ec7a7 The original commit does not need fixes. Regards, Qingfang [Resent as plaintext mode] On Wed, Mar 12, 2025 at 10:21 PM Jonas Gorski <jonas.gorski@gmail.com> wrote: > > Hi, > > On Sat, Mar 8, 2025 at 7:01 PM Qingfang Deng <dqfext@gmail.com> wrote: > > > > After booting, a "transmit queue 0 timed out" warning followed by a > > register dump was observed. The dump indicates that mtk_hw_init() does > > not initialize the EEECR during probe. This occurs because the > > netdev is allocated in mtk_add_mac(), which is called after > > mtk_hw_init(). Consequently, the EEECR register remains uninitialized > > until a reset is triggered, causing mtk_hw_init() to run again with a > > valid netdev, at which point the register is finally set. > > > > To address this, instead of modifying the probe sequence, latch the Tx > > LPI enable state and timer value, and move the EEECR register > > initialization to mtk_mac_link_up() to ensure proper setup when the > > interface comes up. > > > > Additionally, the splat reveals that LPI functionality is controlled by > > the MAC_MCR_EEE bits in the MCR register. Update mtk_set_eee() to > > modify these bits accordingly. > > > > Fixes: d8315d5358d5 ("kernel: backport Mediatek SoC EEE support") > > Fixes: edddbaf79ccf ("kernel: Mediatek: set default EEE Tx LPI timer") > > Signed-off-by: Qingfang Deng <dqfext@gmail.com> > > --- > > ...et-ethernet-mediatek-add-EEE-support.patch | 57 ++++++++++++------- > > ..._eth_soc-add-hw-dump-for-forced-rese.patch | 4 +- > > ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 2 +- > > ..._eth_soc-reset-all-TX-queues-on-DMA-.patch | 2 +- > > ..._eth_soc-compile-out-netsys-v2-code-.patch | 4 +- > > ..._eth_soc-work-around-issue-with-send.patch | 6 +- > > ...ernet-mtk_eth_soc-use-napi_build_skb.patch | 4 +- > > ...-mediatek-enlarge-DMA-reserve-buffer.patch | 2 +- > > ..._eth_soc-fix-memory-corruption-durin.patch | 2 +- > > ..._eth_soc-add-paths-and-SerDes-modes-.patch | 26 ++++----- > > ...th_soc-reduce-rx-ring-size-for-older.patch | 16 +++--- > > ..._eth_soc-do-not-enable-page-pool-sta.patch | 4 +- > > 12 files changed, 71 insertions(+), 58 deletions(-) > > > > diff --git a/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch b/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch > > index d9b86ae36e..b908d133b5 100644 > > --- a/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch > > +++ b/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch > > @@ -23,34 +23,23 @@ Signed-off-by: Qingfang Deng <dqfext@gmail.com> > > MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_TX_FC | > > MAC_MCR_FORCE_RX_FC); > > > > -@@ -811,6 +812,18 @@ static void mtk_mac_link_up(struct phyli > > +@@ -811,6 +812,15 @@ static void mtk_mac_link_up(struct phyli > > if (rx_pause) > > mcr |= MAC_MCR_FORCE_RX_FC; > > > > -+ if (mode == MLO_AN_PHY && phy && phy_init_eee(phy, false) >= 0) { > > -+ switch (speed) { > > -+ case SPEED_2500: > > -+ case SPEED_1000: > > -+ mcr |= MAC_MCR_EEE1G; > > -+ break; > > -+ case SPEED_100: > > -+ mcr |= MAC_MCR_EEE100M; > > -+ break; > > -+ } > > ++ if (mode == MLO_AN_PHY && phy && mac->tx_lpi_enabled && phy_init_eee(phy, false) >= 0) { > > ++ mcr |= MAC_MCR_EEE100M | MAC_MCR_EEE1G; > > ++ mtk_w32(mac->hw, > > ++ FIELD_PREP(MAC_EEE_WAKEUP_TIME_1000, 17) | > > ++ FIELD_PREP(MAC_EEE_WAKEUP_TIME_100, 36) | > > ++ FIELD_PREP(MAC_EEE_LPI_TXIDLE_THD, mac->txidle_thd_ms), > > ++ MTK_MAC_EEECR(mac->id)); > > + } > > + > > Please don't modify backported patches, they represent upstream > accepted changes, so they are immutable in that regard (apart from > required changes for adapting them to older kernels). > > Just add a patch on top that fixes the behavior, and ideally also send > it upstream to netdev so it gets proper review etc. > > Best Regards, > Jonas
Hi Qingfang, I've been testing EEE support on MT7986 as well as MT7988 with your patches on top of OpenWrt's Linux 6.6.82. I noticed that while the LPI timer of the MT753x DSA switch ports is 30us by default it is deplayed as 0us on the SoC's Ethernet ports, which seems wrong... I guess this should be fixed as well. Cheers Daniel On Wed, Mar 12, 2025 at 10:40:55PM +0800, Qingfang Deng wrote: > Hi Jonas, > > Due to major API changes upstream, the feature wasn't backported as-is. > https://web.git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=952d7325362ffbefa6ce5619fb4e53c2159ec7a7 > > The original commit does not need fixes. > > Regards, > Qingfang > > [Resent as plaintext mode] > > > On Wed, Mar 12, 2025 at 10:21 PM Jonas Gorski <jonas.gorski@gmail.com> wrote: > > > > Hi, > > > > On Sat, Mar 8, 2025 at 7:01 PM Qingfang Deng <dqfext@gmail.com> wrote: > > > > > > After booting, a "transmit queue 0 timed out" warning followed by a > > > register dump was observed. The dump indicates that mtk_hw_init() does > > > not initialize the EEECR during probe. This occurs because the > > > netdev is allocated in mtk_add_mac(), which is called after > > > mtk_hw_init(). Consequently, the EEECR register remains uninitialized > > > until a reset is triggered, causing mtk_hw_init() to run again with a > > > valid netdev, at which point the register is finally set. > > > > > > To address this, instead of modifying the probe sequence, latch the Tx > > > LPI enable state and timer value, and move the EEECR register > > > initialization to mtk_mac_link_up() to ensure proper setup when the > > > interface comes up. > > > > > > Additionally, the splat reveals that LPI functionality is controlled by > > > the MAC_MCR_EEE bits in the MCR register. Update mtk_set_eee() to > > > modify these bits accordingly. > > > > > > Fixes: d8315d5358d5 ("kernel: backport Mediatek SoC EEE support") > > > Fixes: edddbaf79ccf ("kernel: Mediatek: set default EEE Tx LPI timer") > > > Signed-off-by: Qingfang Deng <dqfext@gmail.com> > > > --- > > > ...et-ethernet-mediatek-add-EEE-support.patch | 57 ++++++++++++------- > > > ..._eth_soc-add-hw-dump-for-forced-rese.patch | 4 +- > > > ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 2 +- > > > ..._eth_soc-reset-all-TX-queues-on-DMA-.patch | 2 +- > > > ..._eth_soc-compile-out-netsys-v2-code-.patch | 4 +- > > > ..._eth_soc-work-around-issue-with-send.patch | 6 +- > > > ...ernet-mtk_eth_soc-use-napi_build_skb.patch | 4 +- > > > ...-mediatek-enlarge-DMA-reserve-buffer.patch | 2 +- > > > ..._eth_soc-fix-memory-corruption-durin.patch | 2 +- > > > ..._eth_soc-add-paths-and-SerDes-modes-.patch | 26 ++++----- > > > ...th_soc-reduce-rx-ring-size-for-older.patch | 16 +++--- > > > ..._eth_soc-do-not-enable-page-pool-sta.patch | 4 +- > > > 12 files changed, 71 insertions(+), 58 deletions(-) > > > > > > diff --git a/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch b/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch > > > index d9b86ae36e..b908d133b5 100644 > > > --- a/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch > > > +++ b/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch > > > @@ -23,34 +23,23 @@ Signed-off-by: Qingfang Deng <dqfext@gmail.com> > > > MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_TX_FC | > > > MAC_MCR_FORCE_RX_FC); > > > > > > -@@ -811,6 +812,18 @@ static void mtk_mac_link_up(struct phyli > > > +@@ -811,6 +812,15 @@ static void mtk_mac_link_up(struct phyli > > > if (rx_pause) > > > mcr |= MAC_MCR_FORCE_RX_FC; > > > > > > -+ if (mode == MLO_AN_PHY && phy && phy_init_eee(phy, false) >= 0) { > > > -+ switch (speed) { > > > -+ case SPEED_2500: > > > -+ case SPEED_1000: > > > -+ mcr |= MAC_MCR_EEE1G; > > > -+ break; > > > -+ case SPEED_100: > > > -+ mcr |= MAC_MCR_EEE100M; > > > -+ break; > > > -+ } > > > ++ if (mode == MLO_AN_PHY && phy && mac->tx_lpi_enabled && phy_init_eee(phy, false) >= 0) { > > > ++ mcr |= MAC_MCR_EEE100M | MAC_MCR_EEE1G; > > > ++ mtk_w32(mac->hw, > > > ++ FIELD_PREP(MAC_EEE_WAKEUP_TIME_1000, 17) | > > > ++ FIELD_PREP(MAC_EEE_WAKEUP_TIME_100, 36) | > > > ++ FIELD_PREP(MAC_EEE_LPI_TXIDLE_THD, mac->txidle_thd_ms), > > > ++ MTK_MAC_EEECR(mac->id)); > > > + } > > > + > > > > Please don't modify backported patches, they represent upstream > > accepted changes, so they are immutable in that regard (apart from > > required changes for adapting them to older kernels). > > > > Just add a patch on top that fixes the behavior, and ideally also send > > it upstream to netdev so it gets proper review etc. > > > > Best Regards, > > Jonas > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Hi Daniel, On Fri, Mar 14, 2025 at 3:42 AM Daniel Golle <daniel@makrotopia.org> wrote: > > Hi Qingfang, > > I've been testing EEE support on MT7986 as well as MT7988 with your > patches on top of OpenWrt's Linux 6.6.82. > > I noticed that while the LPI timer of the MT753x DSA switch ports is > 30us by default it is deplayed as 0us on the SoC's Ethernet ports, which > seems wrong... I guess this should be fixed as well. This patch sets the default to 1000 us. Does it still read 0 us on your end? > > > Cheers > > Daniel > > > On Wed, Mar 12, 2025 at 10:40:55PM +0800, Qingfang Deng wrote: > > Hi Jonas, > > > > Due to major API changes upstream, the feature wasn't backported as-is. > > https://web.git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=952d7325362ffbefa6ce5619fb4e53c2159ec7a7 > > > > The original commit does not need fixes. > > > > Regards, > > Qingfang > > > > [Resent as plaintext mode] > > > > > > On Wed, Mar 12, 2025 at 10:21 PM Jonas Gorski <jonas.gorski@gmail.com> wrote: > > > > > > Hi, > > > > > > On Sat, Mar 8, 2025 at 7:01 PM Qingfang Deng <dqfext@gmail.com> wrote: > > > > > > > > After booting, a "transmit queue 0 timed out" warning followed by a > > > > register dump was observed. The dump indicates that mtk_hw_init() does > > > > not initialize the EEECR during probe. This occurs because the > > > > netdev is allocated in mtk_add_mac(), which is called after > > > > mtk_hw_init(). Consequently, the EEECR register remains uninitialized > > > > until a reset is triggered, causing mtk_hw_init() to run again with a > > > > valid netdev, at which point the register is finally set. > > > > > > > > To address this, instead of modifying the probe sequence, latch the Tx > > > > LPI enable state and timer value, and move the EEECR register > > > > initialization to mtk_mac_link_up() to ensure proper setup when the > > > > interface comes up. > > > > > > > > Additionally, the splat reveals that LPI functionality is controlled by > > > > the MAC_MCR_EEE bits in the MCR register. Update mtk_set_eee() to > > > > modify these bits accordingly. > > > > > > > > Fixes: d8315d5358d5 ("kernel: backport Mediatek SoC EEE support") > > > > Fixes: edddbaf79ccf ("kernel: Mediatek: set default EEE Tx LPI timer") > > > > Signed-off-by: Qingfang Deng <dqfext@gmail.com> > > > > --- > > > > ...et-ethernet-mediatek-add-EEE-support.patch | 57 ++++++++++++------- > > > > ..._eth_soc-add-hw-dump-for-forced-rese.patch | 4 +- > > > > ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 2 +- > > > > ..._eth_soc-reset-all-TX-queues-on-DMA-.patch | 2 +- > > > > ..._eth_soc-compile-out-netsys-v2-code-.patch | 4 +- > > > > ..._eth_soc-work-around-issue-with-send.patch | 6 +- > > > > ...ernet-mtk_eth_soc-use-napi_build_skb.patch | 4 +- > > > > ...-mediatek-enlarge-DMA-reserve-buffer.patch | 2 +- > > > > ..._eth_soc-fix-memory-corruption-durin.patch | 2 +- > > > > ..._eth_soc-add-paths-and-SerDes-modes-.patch | 26 ++++----- > > > > ...th_soc-reduce-rx-ring-size-for-older.patch | 16 +++--- > > > > ..._eth_soc-do-not-enable-page-pool-sta.patch | 4 +- > > > > 12 files changed, 71 insertions(+), 58 deletions(-) > > > > > > > > diff --git a/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch b/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch > > > > index d9b86ae36e..b908d133b5 100644 > > > > --- a/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch > > > > +++ b/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch > > > > @@ -23,34 +23,23 @@ Signed-off-by: Qingfang Deng <dqfext@gmail.com> > > > > MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_TX_FC | > > > > MAC_MCR_FORCE_RX_FC); > > > > > > > > -@@ -811,6 +812,18 @@ static void mtk_mac_link_up(struct phyli > > > > +@@ -811,6 +812,15 @@ static void mtk_mac_link_up(struct phyli > > > > if (rx_pause) > > > > mcr |= MAC_MCR_FORCE_RX_FC; > > > > > > > > -+ if (mode == MLO_AN_PHY && phy && phy_init_eee(phy, false) >= 0) { > > > > -+ switch (speed) { > > > > -+ case SPEED_2500: > > > > -+ case SPEED_1000: > > > > -+ mcr |= MAC_MCR_EEE1G; > > > > -+ break; > > > > -+ case SPEED_100: > > > > -+ mcr |= MAC_MCR_EEE100M; > > > > -+ break; > > > > -+ } > > > > ++ if (mode == MLO_AN_PHY && phy && mac->tx_lpi_enabled && phy_init_eee(phy, false) >= 0) { > > > > ++ mcr |= MAC_MCR_EEE100M | MAC_MCR_EEE1G; > > > > ++ mtk_w32(mac->hw, > > > > ++ FIELD_PREP(MAC_EEE_WAKEUP_TIME_1000, 17) | > > > > ++ FIELD_PREP(MAC_EEE_WAKEUP_TIME_100, 36) | > > > > ++ FIELD_PREP(MAC_EEE_LPI_TXIDLE_THD, mac->txidle_thd_ms), > > > > ++ MTK_MAC_EEECR(mac->id)); > > > > + } > > > > + > > > > > > Please don't modify backported patches, they represent upstream > > > accepted changes, so they are immutable in that regard (apart from > > > required changes for adapting them to older kernels). > > > > > > Just add a patch on top that fixes the behavior, and ideally also send > > > it upstream to netdev so it gets proper review etc. > > > > > > Best Regards, > > > Jonas > > > > _______________________________________________ > > openwrt-devel mailing list > > openwrt-devel@lists.openwrt.org > > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. Am 14. März 2025 02:56:59 MEZ schrieb Qingfang Deng <dqfext@gmail.com>: >Hi Daniel, > >On Fri, Mar 14, 2025 at 3:42 AM Daniel Golle <daniel@makrotopia.org> wrote: >> >> Hi Qingfang, >> >> I've been testing EEE support on MT7986 as well as MT7988 with your >> patches on top of OpenWrt's Linux 6.6.82. >> >> I noticed that while the LPI timer of the MT753x DSA switch ports is >> 30us by default it is deplayed as 0us on the SoC's Ethernet ports, which >> seems wrong... I guess this should be fixed as well. > >This patch sets the default to 1000 us. Does it still read 0 us on your end? > >> >> >> Cheers >> >> Daniel >> >> >> On Wed, Mar 12, 2025 at 10:40:55PM +0800, Qingfang Deng wrote: >> > Hi Jonas, >> > >> > Due to major API changes upstream, the feature wasn't backported as-is. >> > https://web.git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=952d7325362ffbefa6ce5619fb4e53c2159ec7a7 >> > >> > The original commit does not need fixes. >> > >> > Regards, >> > Qingfang >> > >> > [Resent as plaintext mode] >> > >> > >> > On Wed, Mar 12, 2025 at 10:21 PM Jonas Gorski <jonas.gorski@gmail.com> wrote: >> > > >> > > Hi, >> > > >> > > On Sat, Mar 8, 2025 at 7:01 PM Qingfang Deng <dqfext@gmail.com> wrote: >> > > > >> > > > After booting, a "transmit queue 0 timed out" warning followed by a >> > > > register dump was observed. The dump indicates that mtk_hw_init() does >> > > > not initialize the EEECR during probe. This occurs because the >> > > > netdev is allocated in mtk_add_mac(), which is called after >> > > > mtk_hw_init(). Consequently, the EEECR register remains uninitialized >> > > > until a reset is triggered, causing mtk_hw_init() to run again with a >> > > > valid netdev, at which point the register is finally set. >> > > > >> > > > To address this, instead of modifying the probe sequence, latch the Tx >> > > > LPI enable state and timer value, and move the EEECR register >> > > > initialization to mtk_mac_link_up() to ensure proper setup when the >> > > > interface comes up. >> > > > >> > > > Additionally, the splat reveals that LPI functionality is controlled by >> > > > the MAC_MCR_EEE bits in the MCR register. Update mtk_set_eee() to >> > > > modify these bits accordingly. >> > > > >> > > > Fixes: d8315d5358d5 ("kernel: backport Mediatek SoC EEE support") >> > > > Fixes: edddbaf79ccf ("kernel: Mediatek: set default EEE Tx LPI timer") >> > > > Signed-off-by: Qingfang Deng <dqfext@gmail.com> >> > > > --- >> > > > ...et-ethernet-mediatek-add-EEE-support.patch | 57 ++++++++++++------- >> > > > ..._eth_soc-add-hw-dump-for-forced-rese.patch | 4 +- >> > > > ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 2 +- >> > > > ..._eth_soc-reset-all-TX-queues-on-DMA-.patch | 2 +- >> > > > ..._eth_soc-compile-out-netsys-v2-code-.patch | 4 +- >> > > > ..._eth_soc-work-around-issue-with-send.patch | 6 +- >> > > > ...ernet-mtk_eth_soc-use-napi_build_skb.patch | 4 +- >> > > > ...-mediatek-enlarge-DMA-reserve-buffer.patch | 2 +- >> > > > ..._eth_soc-fix-memory-corruption-durin.patch | 2 +- >> > > > ..._eth_soc-add-paths-and-SerDes-modes-.patch | 26 ++++----- >> > > > ...th_soc-reduce-rx-ring-size-for-older.patch | 16 +++--- >> > > > ..._eth_soc-do-not-enable-page-pool-sta.patch | 4 +- >> > > > 12 files changed, 71 insertions(+), 58 deletions(-) >> > > > >> > > > diff --git a/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch b/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch >> > > > index d9b86ae36e..b908d133b5 100644 >> > > > --- a/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch >> > > > +++ b/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch >> > > > @@ -23,34 +23,23 @@ Signed-off-by: Qingfang Deng <dqfext@gmail.com> >> > > > MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_TX_FC | >> > > > MAC_MCR_FORCE_RX_FC); >> > > > >> > > > -@@ -811,6 +812,18 @@ static void mtk_mac_link_up(struct phyli >> > > > +@@ -811,6 +812,15 @@ static void mtk_mac_link_up(struct phyli >> > > > if (rx_pause) >> > > > mcr |= MAC_MCR_FORCE_RX_FC; >> > > > >> > > > -+ if (mode == MLO_AN_PHY && phy && phy_init_eee(phy, false) >= 0) { >> > > > -+ switch (speed) { >> > > > -+ case SPEED_2500: >> > > > -+ case SPEED_1000: >> > > > -+ mcr |= MAC_MCR_EEE1G; >> > > > -+ break; >> > > > -+ case SPEED_100: >> > > > -+ mcr |= MAC_MCR_EEE100M; >> > > > -+ break; >> > > > -+ } >> > > > ++ if (mode == MLO_AN_PHY && phy && mac->tx_lpi_enabled && phy_init_eee(phy, false) >= 0) { >> > > > ++ mcr |= MAC_MCR_EEE100M | MAC_MCR_EEE1G; >> > > > ++ mtk_w32(mac->hw, >> > > > ++ FIELD_PREP(MAC_EEE_WAKEUP_TIME_1000, 17) | >> > > > ++ FIELD_PREP(MAC_EEE_WAKEUP_TIME_100, 36) | >> > > > ++ FIELD_PREP(MAC_EEE_LPI_TXIDLE_THD, mac->txidle_thd_ms), >> > > > ++ MTK_MAC_EEECR(mac->id)); >> > > > + } >> > > > + >> > > >> > > Please don't modify backported patches, they represent upstream >> > > accepted changes, so they are immutable in that regard (apart from >> > > required changes for adapting them to older kernels). >> > > >> > > Just add a patch on top that fixes the behavior, and ideally also send >> > > it upstream to netdev so it gets proper review etc. >> > > >> > > Best Regards, >> > > Jonas >> > >> > _______________________________________________ >> > openwrt-devel mailing list >> > openwrt-devel@lists.openwrt.org >> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel > >_______________________________________________ >openwrt-devel mailing list >openwrt-devel@lists.openwrt.org >https://lists.openwrt.org/mailman/listinfo/openwrt-devel Hi, it would be great if this could be moved along. Reading bug reports this breaks usage of snapshots for quite a few users of filogic. Daniel it would be great if you could answer Qingfang's question so they could adjust their patch if necessary. Apart from that there doesn't appear to speak anything against merging this, right? I mean this patch only adjusts an upstream patch to account for kernel 6.6 still using an older API that was reworked upstream. Sounds reasonable to me. Not something that needs to be discussed upstream since the feature is not going to be backported there. Regards Felix Baumann
Hi Daniel, On Fri, Mar 14, 2025 at 9:56 AM Qingfang Deng <dqfext@gmail.com> wrote: > > Hi Daniel, > > On Fri, Mar 14, 2025 at 3:42 AM Daniel Golle <daniel@makrotopia.org> wrote: > > > > Hi Qingfang, > > > > I've been testing EEE support on MT7986 as well as MT7988 with your > > patches on top of OpenWrt's Linux 6.6.82. > > > > I noticed that while the LPI timer of the MT753x DSA switch ports is > > 30us by default it is deplayed as 0us on the SoC's Ethernet ports, which > > seems wrong... I guess this should be fixed as well. > > This patch sets the default to 1000 us. Does it still read 0 us on your end? I've been testing this patch on my TP-Link XDR8086 for the past two weeks without any issues. Running ethtool --show-eee eth1 correctly reports the default LPI timer value (1000 us). Additionally, there's a related issue on GitHub (#18219) that has been open for three weeks, so I hope this patch gets merged soon. If the current backport approach is not preferred, an alternative would be to revert it first and then discuss the proper way forward with Russell King, who has already accepted my upstream patch. Regards, Qingfang
diff --git a/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch b/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch index d9b86ae36e..b908d133b5 100644 --- a/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch +++ b/target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch @@ -23,34 +23,23 @@ Signed-off-by: Qingfang Deng <dqfext@gmail.com> MAC_MCR_FORCE_DPX | MAC_MCR_FORCE_TX_FC | MAC_MCR_FORCE_RX_FC); -@@ -811,6 +812,18 @@ static void mtk_mac_link_up(struct phyli +@@ -811,6 +812,15 @@ static void mtk_mac_link_up(struct phyli if (rx_pause) mcr |= MAC_MCR_FORCE_RX_FC; -+ if (mode == MLO_AN_PHY && phy && phy_init_eee(phy, false) >= 0) { -+ switch (speed) { -+ case SPEED_2500: -+ case SPEED_1000: -+ mcr |= MAC_MCR_EEE1G; -+ break; -+ case SPEED_100: -+ mcr |= MAC_MCR_EEE100M; -+ break; -+ } ++ if (mode == MLO_AN_PHY && phy && mac->tx_lpi_enabled && phy_init_eee(phy, false) >= 0) { ++ mcr |= MAC_MCR_EEE100M | MAC_MCR_EEE1G; ++ mtk_w32(mac->hw, ++ FIELD_PREP(MAC_EEE_WAKEUP_TIME_1000, 17) | ++ FIELD_PREP(MAC_EEE_WAKEUP_TIME_100, 36) | ++ FIELD_PREP(MAC_EEE_LPI_TXIDLE_THD, mac->txidle_thd_ms), ++ MTK_MAC_EEECR(mac->id)); + } + mcr |= MAC_MCR_TX_EN | MAC_MCR_RX_EN | MAC_MCR_FORCE_LINK; mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); } -@@ -3956,6 +3969,7 @@ static int mtk_hw_init(struct mtk_eth *e - continue; - - mtk_w32(eth, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(i)); -+ mtk_w32(eth, FIELD_PREP(MAC_EEE_LPI_TXIDLE_THD, 1), MTK_MAC_EEECR(i)); - mtk_set_mcr_max_rx(netdev_priv(dev), - dev->mtu + MTK_RX_ETH_HLEN); - } -@@ -4476,6 +4490,55 @@ static int mtk_set_pauseparam(struct net +@@ -4476,6 +4486,61 @@ static int mtk_set_pauseparam(struct net return phylink_ethtool_set_pauseparam(mac->phylink, pause); } @@ -65,7 +54,7 @@ Signed-off-by: Qingfang Deng <dqfext@gmail.com> + return ret; + + reg = mtk_r32(mac->hw, MTK_MAC_EEECR(mac->id)); -+ eee->tx_lpi_enabled = !(reg & MAC_EEE_LPI_MODE); ++ eee->tx_lpi_enabled = mac->tx_lpi_enabled; + eee->tx_lpi_timer = FIELD_GET(MAC_EEE_LPI_TXIDLE_THD, reg) * 1000; + + return 0; @@ -98,7 +87,13 @@ Signed-off-by: Qingfang Deng <dqfext@gmail.com> + if (ret) + return ret; + ++ mac->tx_lpi_enabled = eee->tx_lpi_enabled; ++ mac->txidle_thd_ms = txidle_thd_ms; + mtk_w32(mac->hw, reg, MTK_MAC_EEECR(mac->id)); ++ if (eee->eee_enabled && eee->eee_active && eee->tx_lpi_enabled) ++ mtk_m32(mac->hw, 0, MAC_MCR_EEE100M | MAC_MCR_EEE1G, MTK_MAC_MCR(mac->id)); ++ else ++ mtk_m32(mac->hw, MAC_MCR_EEE100M | MAC_MCR_EEE1G, 0, MTK_MAC_MCR(mac->id)); + + return 0; +} @@ -106,7 +101,7 @@ Signed-off-by: Qingfang Deng <dqfext@gmail.com> static u16 mtk_select_queue(struct net_device *dev, struct sk_buff *skb, struct net_device *sb_dev) { -@@ -4508,6 +4571,8 @@ static const struct ethtool_ops mtk_etht +@@ -4508,6 +4573,8 @@ static const struct ethtool_ops mtk_etht .set_pauseparam = mtk_set_pauseparam, .get_rxnfc = mtk_get_rxnfc, .set_rxnfc = mtk_set_rxnfc, @@ -115,6 +110,15 @@ Signed-off-by: Qingfang Deng <dqfext@gmail.com> }; static const struct net_device_ops mtk_netdev_ops = { +@@ -4568,6 +4635,8 @@ static int mtk_add_mac(struct mtk_eth *e + } + mac = netdev_priv(eth->netdev[id]); + eth->mac[id] = mac; ++ mac->tx_lpi_enabled = true; ++ mac->txidle_thd_ms = 1; + mac->id = id; + mac->hw = eth; + mac->of_node = np; --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -453,6 +453,8 @@ @@ -142,3 +146,12 @@ Signed-off-by: Qingfang Deng <dqfext@gmail.com> /* Mac status registers */ #define MTK_MAC_MSR(x) (0x10108 + (x * 0x100)) #define MAC_MSR_EEE1G BIT(7) +@@ -1321,6 +1332,8 @@ struct mtk_mac { + int id; + phy_interface_t interface; + u8 ppe_idx; ++ bool tx_lpi_enabled; ++ u8 txidle_thd_ms; + int speed; + struct device_node *of_node; + struct phylink *phylink; diff --git a/target/linux/generic/hack-6.6/730-net-ethernet-mtk_eth_soc-add-hw-dump-for-forced-rese.patch b/target/linux/generic/hack-6.6/730-net-ethernet-mtk_eth_soc-add-hw-dump-for-forced-rese.patch index c25629e830..dbc139fb06 100644 --- a/target/linux/generic/hack-6.6/730-net-ethernet-mtk_eth_soc-add-hw-dump-for-forced-rese.patch +++ b/target/linux/generic/hack-6.6/730-net-ethernet-mtk_eth_soc-add-hw-dump-for-forced-rese.patch @@ -37,7 +37,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com> .glo_cfg = 0x4604, .rst_idx = 0x4608, .delay_irq = 0x460c, -@@ -3898,6 +3901,56 @@ static void mtk_set_mcr_max_rx(struct mt +@@ -3895,6 +3898,56 @@ static void mtk_set_mcr_max_rx(struct mt mtk_w32(mac->hw, mcr_new, MTK_MAC_MCR(mac->id)); } @@ -94,7 +94,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com> static void mtk_hw_reset(struct mtk_eth *eth) { u32 val; -@@ -4358,6 +4411,8 @@ static void mtk_pending_work(struct work +@@ -4354,6 +4407,8 @@ static void mtk_pending_work(struct work rtnl_lock(); set_bit(MTK_RESETTING, ð->state); diff --git a/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch b/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch index 021ed9fa73..a80433c986 100644 --- a/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch +++ b/target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch @@ -10,7 +10,7 @@ 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 -@@ -5101,6 +5101,8 @@ static int mtk_probe(struct platform_dev +@@ -5105,6 +5105,8 @@ static int mtk_probe(struct platform_dev * for NAPI to work */ init_dummy_netdev(ð->dummy_dev); diff --git a/target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch b/target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch index 6995ad31c1..572c07eb70 100644 --- a/target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch +++ b/target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch @@ -23,7 +23,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3148,11 +3148,19 @@ static int mtk_dma_init(struct mtk_eth * +@@ -3145,11 +3145,19 @@ static int mtk_dma_init(struct mtk_eth * static void mtk_dma_free(struct mtk_eth *eth) { const struct mtk_soc_data *soc = eth->soc; diff --git a/target/linux/generic/pending-6.6/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch b/target/linux/generic/pending-6.6/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch index e6e97cffff..07ade816a6 100644 --- a/target/linux/generic/pending-6.6/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch +++ b/target/linux/generic/pending-6.6/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h -@@ -1347,6 +1347,22 @@ struct mtk_mac { +@@ -1349,6 +1349,22 @@ struct mtk_mac { /* the struct describing the SoC. these are declared in the soc_xyz.c files */ extern const struct of_device_id of_mtk_match[]; @@ -34,7 +34,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> static inline bool mtk_is_netsys_v1(struct mtk_eth *eth) { return eth->soc->version == 1; -@@ -1361,6 +1377,7 @@ static inline bool mtk_is_netsys_v3_or_g +@@ -1363,6 +1379,7 @@ static inline bool mtk_is_netsys_v3_or_g { return eth->soc->version > 2; } diff --git a/target/linux/generic/pending-6.6/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch b/target/linux/generic/pending-6.6/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch index 8e2c7d5a35..87e376c3c4 100644 --- a/target/linux/generic/pending-6.6/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch +++ b/target/linux/generic/pending-6.6/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch @@ -24,7 +24,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> #include <net/page_pool/helpers.h> #include "mtk_eth_soc.h" -@@ -1609,12 +1610,28 @@ static void mtk_wake_queue(struct mtk_et +@@ -1606,12 +1607,28 @@ static void mtk_wake_queue(struct mtk_et } } @@ -53,7 +53,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> bool gso = false; int tx_num; -@@ -1636,6 +1653,18 @@ static netdev_tx_t mtk_start_xmit(struct +@@ -1633,6 +1650,18 @@ static netdev_tx_t mtk_start_xmit(struct return NETDEV_TX_BUSY; } @@ -72,7 +72,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /* TSO: fill MSS info in tcp checksum field */ if (skb_is_gso(skb)) { if (skb_cow_head(skb, 0)) { -@@ -1651,8 +1680,14 @@ static netdev_tx_t mtk_start_xmit(struct +@@ -1648,8 +1677,14 @@ static netdev_tx_t mtk_start_xmit(struct } } diff --git a/target/linux/generic/pending-6.6/733-01-net-ethernet-mtk_eth_soc-use-napi_build_skb.patch b/target/linux/generic/pending-6.6/733-01-net-ethernet-mtk_eth_soc-use-napi_build_skb.patch index 7f1a638af0..a2a10d1417 100644 --- a/target/linux/generic/pending-6.6/733-01-net-ethernet-mtk_eth_soc-use-napi_build_skb.patch +++ b/target/linux/generic/pending-6.6/733-01-net-ethernet-mtk_eth_soc-use-napi_build_skb.patch @@ -10,7 +10,7 @@ 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 -@@ -2153,7 +2153,7 @@ static int mtk_poll_rx(struct napi_struc +@@ -2150,7 +2150,7 @@ static int mtk_poll_rx(struct napi_struc if (ret != XDP_PASS) goto skip_rx; @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> if (unlikely(!skb)) { page_pool_put_full_page(ring->page_pool, page, true); -@@ -2191,7 +2191,7 @@ static int mtk_poll_rx(struct napi_struc +@@ -2188,7 +2188,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); diff --git a/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch b/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch index 3d2aee9485..ccb9d1bc1d 100644 --- a/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch +++ b/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch @@ -25,7 +25,7 @@ Signed-off-by: Chad Monroe <chad@monroe.io> /* QDMA Flow Control Register */ --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -3322,12 +3322,14 @@ static int mtk_start_dma(struct mtk_eth +@@ -3319,12 +3319,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; diff --git a/target/linux/generic/pending-6.6/735-net-ethernet-mtk_eth_soc-fix-memory-corruption-durin.patch b/target/linux/generic/pending-6.6/735-net-ethernet-mtk_eth_soc-fix-memory-corruption-durin.patch index 419c158c5c..6d7a6ed052 100644 --- a/target/linux/generic/pending-6.6/735-net-ethernet-mtk_eth_soc-fix-memory-corruption-durin.patch +++ b/target/linux/generic/pending-6.6/735-net-ethernet-mtk_eth_soc-fix-memory-corruption-durin.patch @@ -13,7 +13,7 @@ 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 -@@ -1185,7 +1185,7 @@ static int mtk_init_fq_dma(struct mtk_et +@@ -1182,7 +1182,7 @@ static int mtk_init_fq_dma(struct mtk_et if (unlikely(dma_mapping_error(eth->dma_dev, dma_addr))) return -ENOMEM; diff --git a/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch b/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch index 09067c4712..067ea1f86d 100644 --- a/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch +++ b/target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch @@ -426,7 +426,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> u32 mcr; mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); -@@ -829,9 +916,63 @@ static void mtk_mac_link_up(struct phyli +@@ -826,9 +913,63 @@ static void mtk_mac_link_up(struct phyli mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); } @@ -490,7 +490,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> .mac_finish = mtk_mac_finish, .mac_link_down = mtk_mac_link_down, .mac_link_up = mtk_mac_link_up, -@@ -3430,6 +3571,9 @@ static int mtk_open(struct net_device *d +@@ -3427,6 +3568,9 @@ static int mtk_open(struct net_device *d ppe_num = eth->soc->ppe_num; @@ -500,7 +500,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0); if (err) { netdev_err(dev, "%s: could not attach PHY: %d\n", __func__, -@@ -3580,6 +3724,9 @@ static int mtk_stop(struct net_device *d +@@ -3577,6 +3721,9 @@ static int mtk_stop(struct net_device *d for (i = 0; i < ARRAY_SIZE(eth->ppe); i++) mtk_ppe_stop(eth->ppe[i]); @@ -510,7 +510,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> return 0; } -@@ -4645,6 +4792,7 @@ static const struct net_device_ops mtk_n +@@ -4647,6 +4794,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); @@ -518,7 +518,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> phy_interface_t phy_mode; struct phylink *phylink; struct mtk_mac *mac; -@@ -4681,16 +4829,41 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4685,16 +4833,41 @@ static int mtk_add_mac(struct mtk_eth *e mac->id = id; mac->hw = eth; mac->of_node = np; @@ -568,7 +568,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> } memset(mac->hwlro_ip, 0, sizeof(mac->hwlro_ip)); -@@ -4773,8 +4946,21 @@ static int mtk_add_mac(struct mtk_eth *e +@@ -4777,8 +4950,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); @@ -590,7 +590,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> phylink = phylink_create(&mac->phylink_config, of_fwnode_handle(mac->of_node), phy_mode, &mtk_phylink_ops); -@@ -4825,6 +5011,26 @@ free_netdev: +@@ -4829,6 +5015,26 @@ free_netdev: return err; } @@ -617,7 +617,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev) { struct net_device *dev, *tmp; -@@ -4971,7 +5177,8 @@ static int mtk_probe(struct platform_dev +@@ -4975,7 +5181,8 @@ static int mtk_probe(struct platform_dev regmap_write(cci, 0, 3); } @@ -627,7 +627,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> err = mtk_sgmii_init(eth); if (err) -@@ -5082,6 +5289,24 @@ static int mtk_probe(struct platform_dev +@@ -5086,6 +5293,24 @@ static int mtk_probe(struct platform_dev } } @@ -652,7 +652,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> if (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_INT)) { err = devm_request_irq(eth->dev, eth->irq[0], mtk_handle_irq, 0, -@@ -5185,6 +5410,11 @@ static int mtk_remove(struct platform_de +@@ -5189,6 +5414,11 @@ static int mtk_remove(struct platform_de mtk_stop(eth->netdev[i]); mac = netdev_priv(eth->netdev[i]); phylink_disconnect_phy(mac->phylink); @@ -893,7 +893,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> struct mtk_tx_dma_desc_info { dma_addr_t addr; -@@ -1336,6 +1393,9 @@ struct mtk_mac { +@@ -1338,6 +1395,9 @@ struct mtk_mac { struct device_node *of_node; struct phylink *phylink; struct phylink_config phylink_config; @@ -903,7 +903,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> struct mtk_eth *hw; struct mtk_hw_stats *hw_stats; __be32 hwlro_ip[MTK_MAX_LRO_IP_CNT]; -@@ -1459,6 +1519,19 @@ static inline u32 mtk_get_ib2_multicast_ +@@ -1461,6 +1521,19 @@ static inline u32 mtk_get_ib2_multicast_ return MTK_FOE_IB2_MULTICAST; } @@ -923,7 +923,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org> /* read the hardware status register */ void mtk_stats_update_mac(struct mtk_mac *mac); -@@ -1467,8 +1540,10 @@ u32 mtk_r32(struct mtk_eth *eth, unsigne +@@ -1469,8 +1542,10 @@ u32 mtk_r32(struct mtk_eth *eth, unsigne u32 mtk_m32(struct mtk_eth *eth, u32 mask, u32 set, unsigned int reg); int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id); diff --git a/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch b/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch index 03e610e8c2..30f645c728 100644 --- a/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch +++ b/target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch @@ -30,7 +30,7 @@ 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 -@@ -5446,7 +5446,7 @@ static const struct mtk_soc_data mt2701_ +@@ -5450,7 +5450,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, @@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5474,7 +5474,7 @@ static const struct mtk_soc_data mt7621_ +@@ -5478,7 +5478,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, @@ -48,7 +48,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5504,7 +5504,7 @@ static const struct mtk_soc_data mt7622_ +@@ -5508,7 +5508,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, @@ -57,7 +57,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5533,7 +5533,7 @@ static const struct mtk_soc_data mt7623_ +@@ -5537,7 +5537,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, @@ -66,7 +66,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5559,7 +5559,7 @@ static const struct mtk_soc_data mt7629_ +@@ -5563,7 +5563,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, @@ -75,7 +75,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, }, -@@ -5591,7 +5591,7 @@ static const struct mtk_soc_data mt7981_ +@@ -5595,7 +5595,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, @@ -84,7 +84,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> }, }; -@@ -5621,7 +5621,7 @@ static const struct mtk_soc_data mt7986_ +@@ -5625,7 +5625,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, @@ -93,7 +93,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> }, }; -@@ -5674,7 +5674,7 @@ static const struct mtk_soc_data rt5350_ +@@ -5678,7 +5678,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, diff --git a/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch b/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch index c74c9e888f..628e61f77d 100644 --- a/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch +++ b/target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch @@ -25,7 +25,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> help --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c -@@ -4566,6 +4566,7 @@ static int mtk_get_sset_count(struct net +@@ -4562,6 +4562,7 @@ static int mtk_get_sset_count(struct net static void mtk_ethtool_pp_stats(struct mtk_eth *eth, u64 *data) { @@ -33,7 +33,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> struct page_pool_stats stats = {}; int i; -@@ -4578,6 +4579,7 @@ static void mtk_ethtool_pp_stats(struct +@@ -4574,6 +4575,7 @@ static void mtk_ethtool_pp_stats(struct page_pool_get_stats(ring->page_pool, &stats); } page_pool_ethtool_stats_get(data, &stats);
After booting, a "transmit queue 0 timed out" warning followed by a register dump was observed. The dump indicates that mtk_hw_init() does not initialize the EEECR during probe. This occurs because the netdev is allocated in mtk_add_mac(), which is called after mtk_hw_init(). Consequently, the EEECR register remains uninitialized until a reset is triggered, causing mtk_hw_init() to run again with a valid netdev, at which point the register is finally set. To address this, instead of modifying the probe sequence, latch the Tx LPI enable state and timer value, and move the EEECR register initialization to mtk_mac_link_up() to ensure proper setup when the interface comes up. Additionally, the splat reveals that LPI functionality is controlled by the MAC_MCR_EEE bits in the MCR register. Update mtk_set_eee() to modify these bits accordingly. Fixes: d8315d5358d5 ("kernel: backport Mediatek SoC EEE support") Fixes: edddbaf79ccf ("kernel: Mediatek: set default EEE Tx LPI timer") Signed-off-by: Qingfang Deng <dqfext@gmail.com> --- ...et-ethernet-mediatek-add-EEE-support.patch | 57 ++++++++++++------- ..._eth_soc-add-hw-dump-for-forced-rese.patch | 4 +- ...net-mtk_eth_soc-enable-threaded-NAPI.patch | 2 +- ..._eth_soc-reset-all-TX-queues-on-DMA-.patch | 2 +- ..._eth_soc-compile-out-netsys-v2-code-.patch | 4 +- ..._eth_soc-work-around-issue-with-send.patch | 6 +- ...ernet-mtk_eth_soc-use-napi_build_skb.patch | 4 +- ...-mediatek-enlarge-DMA-reserve-buffer.patch | 2 +- ..._eth_soc-fix-memory-corruption-durin.patch | 2 +- ..._eth_soc-add-paths-and-SerDes-modes-.patch | 26 ++++----- ...th_soc-reduce-rx-ring-size-for-older.patch | 16 +++--- ..._eth_soc-do-not-enable-page-pool-sta.patch | 4 +- 12 files changed, 71 insertions(+), 58 deletions(-)