From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796465314; b=w6HbX8SH56E098HAnukptDlZytwcydvhtapYDI+P+E9qc9+ChAHKPPEJELyhtK7i7fFT gHv1TzxrXv/+1BdndK7JbQxb6M28gb+IKMHu/QOjxsfyMfkB5YzN45yzDDmJDpcivugP9 /kiYZP97+MxFVkuZSNxR2uOFdRxmN+Uo0pt7kXQ3fX/SUZYTPQ6wkfQ7NGDdNs71Wwav+ Xvf5op3TYeV0/FzWJ/F5tcWeG/bMTTDJ1Mw4QdoJy8uwXaFb3Siu9A3+gJ+LVwAxU+rBR wahcXZ+i/rk+1n2jVy/bk0J66BuiL5nOcUJAQshUz7dmNHOGVFlPqMLRvXk9D1Vq5sg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796465314; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=+3hc1a0pXGFNclmP/D28QgcS1C6Lv/y5NHehfzvvG1k=; b=e+9SL6uCTu/ajRs0LwfZRFMdMjf5i2lZVORJoyIUMZYseiWlhurbMD7wAkjoadlq9QjG hZQ2ooIj7r3ZSxQ2vP17AKxWbYY9FeOfbHjuztHNe01QPjJxqXD97/eY3aWHIHV7CzzJz /gVw6Y17vjek4uuvssZlwxCPzyov0L/LM9infKasEPpYrvdcbujgWovc2t+L34/CieP5Z c7GStNXTLF70CPxfjCA7iISWuaQJjpbhTjd5JIBxkc4g2U8fXQCRNsHm7uTGgwLrc6vdI pxujqTLEWkG6a3XpmSWCkwpB1VF+oiI/M1nFnjDgFuHcA5R2/HFSwqhitxBfEToXIag== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NuSERWWH; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80B73606A68D for ; Sat, 5 Dec 2026 10:08:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NuSERWWH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BCD11F0092B; Sat, 5 Dec 2026 10:08:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796465314; bh=+3hc1a0pXGFNclmP/D28QgcS1C6Lv/y5NHehfzvvG1k=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=NuSERWWHAO262iVGgtSyKykre8zgx4pG0iHY0eFyHsklyH8cAaqdit8Kk7rsfFnqy +S78GryOz2cDAhxu2QA6cRnLVjPV6iipntHVT4NJNE/xPIuzrvZQ5n4nv0YkI23oCH j9qR05blYM8PZFW6+ksom3LbA8DIiALaisLrWoAJBoC+eEmzwSCvj8Bb+z6X13X0VU f8lzepiBhkYwahaMmaPNs4BWyQKTcqU+Lj6bsoUVkqCE9gJY+sV+/FJEg3od6YkXnG 9WILHpa2bXnAC+P9lwBG4OdrzPd9JFNlu+VJUhr+tQZ+XjVGAjGKe/G+dGFa1PYSGQ fhskNrWQ+88jw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net-next 2/2] net: ethernet: realtek: Add r8169soc Ethernet driver for Realtek STB SoCs Reply-To: sashiko-reviews@lists.linux.dev To: "Eric Wang" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261204100746.1165612-3-ericwang@realtek.com> References: <20261204100746.1165612-1-ericwang@realtek.com> <20261204100746.1165612-3-ericwang@realtek.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 10:08:33 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 18 potential issues to consider: - [High] net: r8169soc: stale nr_frags after skb linearization in rtl8169_start_xmit() - [High] net: r8169soc: LINK_CHG acked in rtl8169_poll() without phy_mac_interrupt() - [High] net: r8169soc: unacked RX_OVERFLOW causes IRQ storm in rtl8169_poll() - [High] net: r8169soc: rtl_tx() can wake TX queue before napi_disable() in reset - [High] net: r8169soc: rtl8169_down() calls phy_stop() before masking IRQs - [Medium] net: r8169soc: unclocked MMIO in r8169_mdio_read_reg()/write_reg() - [Medium] net: r8169soc: missing rtnl_lock() in rtl_shutdown() races with rtl_open() - [Medium] net: r8169soc: NETIF_F_GRO_UDP_FWD enabled by default in rtl_init_one() - [Medium] net: r8169soc: rtl_open() skips reinit after partial rtl_mac_reinit() failure - [Medium] net: r8169soc: cp_cmd desynced in rtl8169_set_features() and rtl_hw_start() - [Medium] net: r8169soc: CLK_ETN_SYS_EN set before clk_etn_250m and RBUS ready - [Medium] net: r8169soc: unlocked RX_CONFIG access races with rtl_set_rx_mode() - [Medium] net: r8169soc: rtd1625_reset_phy_gmac() races with rtl8169_netpoll() - [Medium] net: r8169soc: OCP MDIO page register not updated on phylib page select - [Low] net: r8169soc: hardcoded MDIO bus ID in r8169_mdio_register() - [Low] net: r8169soc: smp_rmb() placed before READ_ONCE(tp->cur_tx) in rtl_tx() - [Low] net: r8169soc: unsynchronized tp->mac_addr access during live MAC change - [Low] net: r8169soc: redundant MMIO and DMA descriptor reads in TX hot path -- commit 6edd5a45c597d0723fa32ed96e224ec89e9f30ad Author: Eric Wang net: ethernet: realtek: Add r8169soc Ethernet driver for Realtek STB SoCs This commit adds the r8169soc platform Ethernet driver for Realtek STB SoCs, starting with RTD1625. > diff --git a/drivers/net/ethernet/realtek/r8169soc/rtl8169soc.c b/drivers= /net/ethernet/realtek/r8169soc/rtl8169soc.c > new file mode 100644 > index 0000000000000..0d3e68bd75123 > --- /dev/null > +++ b/drivers/net/ethernet/realtek/r8169soc/rtl8169soc.c > @@ -0,0 +1,2375 @@ [ ... ] > +static int int_ocp_mdio_read(struct rtl8169_private *tp, int page, int r= eg) > +{ > + if (page !=3D CURRENT_MDIO_PAGE) > + rtl_ocp_write(tp, OCP_SW_GPHY_MDCMDIO_PAGE, page); > + rtl_ocp_write(tp, OCP_SW_GPHY_MDCMDIO_CMD, reg & PHYAR_REG_MASK); > + > + return rtl_loop_wait_low(tp, &rtl_int_phyar_cond, 25, 20) ? > + rtl_ocp_read(tp, OCP_SW_GPHY_MDCMDIO_DATA) & PHY_DATA_MASK : > + -ETIMEDOUT; > +} > + > +static int int_ocp_mdio_write(struct rtl8169_private *tp, int page, int = reg, > + int value) > +{ > + if (page !=3D CURRENT_MDIO_PAGE) > + rtl_ocp_write(tp, OCP_SW_GPHY_MDCMDIO_PAGE, page); > + rtl_ocp_write(tp, OCP_SW_GPHY_MDCMDIO_DATA, value); > + rtl_ocp_write(tp, OCP_SW_GPHY_MDCMDIO_CMD, > + SW_GPHY_MDCMDIO_WRITE_CMD | (reg & PHYAR_REG_MASK)); > + > + return rtl_loop_wait_low(tp, &rtl_int_phyar_cond, 25, 20) ? > + 0 : -ETIMEDOUT; > +} [Severity: Medium] Does OCP_SW_GPHY_MDCMDIO_PAGE stay stuck at PHY_PAGE_A43 after __rtl_reinit_mac_phy() enables ALDPS? r8169_mdio_read_reg() and r8169_mdio_write_reg() always pass CURRENT_MDIO_PAGE, so phylib writes to PHY_PAGSR_REG (register 31) never update OCP_SW_GPHY_MDCMDIO_PAGE. During devm_mdiobus_register(), rtlgen_supports_2_5gbps() selects page 0xa61 and restores page 0 via register 31, which will access page 0x0a43 instead unless register 31 reads and writes are intercepted to update OCP_SW_GPHY_MDCMDIO_PAGE. [ ... ] > +static int rtl8169_set_features(struct net_device *dev, > + netdev_features_t features) > +{ > + struct rtl8169_private *tp =3D netdev_priv(dev); > + > + rtl_lock_work(tp); > + if (test_bit(RTL_STATUS_CLK_ETN_SYS_EN, tp->status)) > + __rtl8169_set_features(tp, features); > + rtl_unlock_work(tp); > + > + return 0; > +} [Severity: Medium] Can tp->cp_cmd become desynchronized from dev->features? When RTL_STATUS_CLK_ETN_SYS_EN is clear, rtl8169_set_features() returns 0 without updating tp->cp_cmd, and rtl_hw_start() never resyncs RX_CHK_SUM or RX_VLAN from tp->dev->features. In addition, rtl_hw_start() does tp->cp_cmd |=3D RTL_R16(tp, C_PLUS_CMD) | PKT_CNTR_DISABLE | INTT_3, which ORs any post-reset C_PLUS_CMD default bits back into tp->cp_cmd even if the user disabled those features. [ ... ] > +static int rtl_set_mac_address(struct net_device *dev, void *p) > +{ > + struct rtl8169_private *tp =3D netdev_priv(dev); > + struct sockaddr *addr =3D p; > + > + if (!is_valid_ether_addr(addr->sa_data)) { > + dev_dbg(tp_to_dev(tp), "invalid MAC address %pM\n", > + addr->sa_data); > + return -EADDRNOTAVAIL; > + } > + > + eth_hw_addr_set(dev, addr->sa_data); > + > + ether_addr_copy(tp->mac_addr, addr->sa_data); > + > + rtl_rar_set(tp, addr->sa_data); > + > + return 0; > +} [Severity: Low] Can ether_addr_copy() to tp->mac_addr race with __rtl_reinit_mac_phy()? Because IFF_LIVE_ADDR_CHANGE is set, rtl_set_mac_address() can write tp->mac_addr under rtnl_lock() before acquiring tp->wk.mutex inside rtl_rar_set(), while rtl_mac_reinit() -> __rtl_reinit_mac_phy() reads tp->mac_addr under tp->wk.mutex. Moving ether_addr_copy() under rtl_lock_work(tp) would avoid this data race. > +static void rtl_init_rxcfg(struct rtl8169_private *tp) > +{ > + /* disable RX128_INT_EN to reduce CPU loading */ > + RTL_W32(tp, RX_CONFIG, RX_DMA_BURST | RX_EARLY_OFF); > +} [ ... ] > +static void rtl_rx_close(struct rtl8169_private *tp) > +{ > + RTL_W32(tp, RX_CONFIG, RTL_R32(tp, RX_CONFIG) & ~RX_CONFIG_ACCEPT_MASK); > +} [Severity: Medium] Can rtl_init_rxcfg() and rtl_rx_close() race with rtl_set_rx_mode() on RX_CONFIG? rtl_set_rx_mode() updates RX_CONFIG under netif_addr_lock_bh() without holding tp->wk.mutex whenever RTL_STATUS_CLK_ETN_SYS_EN is set. Neither rtl_rx_close() (called from rtl8169_cleanup()) nor rtl_init_rxcfg() (called from __rtl_reinit_mac_phy() after RTL_STATUS_CLK_ETN_SYS_EN is set) holds netif_addr_lock_bh(), so a concurrent multicast or promiscuous update can lose RX_CONFIG bits or re-enable reception during FIFO drain and MAC reset. [ ... ] > +static void rtl_reset_work(struct rtl8169_private *tp) > +{ > + struct net_device *dev =3D tp->dev; > + int i; > + > + netif_stop_queue(dev); > + > + rtl8169_cleanup(tp); [Severity: High] Can rtl_tx() wake the TX queue between netif_stop_queue() and napi_disable() inside rtl8169_cleanup()? CPU0 (kworker) CPU1 () rtl_reset_work() netif_stop_queue(dev) rtl8169_poll() rtl_tx() netif_subqueue_completed_wake() netif_tx_wake_queue() rtl8169_cleanup() napi_disable(&tp->napi) synchronize_net() rtl_hw_reset() rtl8169_tx_clear() <-- races with rtl8169_start_xmit() The same ordering occurs in rtl_mac_reinit(), where rtl8169_down() also sleeps in phy_stop() before calling rtl8169_cleanup(), leaving the TX queue open during TX ring teardown, MAC reset, and clock gating. Disabling NAPI before stopping the TX queue (or calling netif_tx_disable() after napi_disable()) would close this race. [ ... ] > +static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, > + struct net_device *dev) > +{ > + unsigned int frags =3D skb_shinfo(skb)->nr_frags; [ ... ] > + if (unlikely(!rtl8169_tso_csum(skb, opts))) > + goto err_dma_0; > + > + if (unlikely(rtl8169_tx_map(tp, opts, skb_headlen(skb), skb->data, > + entry, false))) > + goto err_dma_0; > + > + if (frags) { > + if (rtl8169_xmit_frags(tp, skb, opts, entry)) > + goto err_dma_1; > + entry =3D (entry + frags) % NUM_TX_DESC; > + } > + > + txd_last =3D tp->tx_desc_array + entry; > + txd_last->opts1 |=3D cpu_to_le32(LAST_FRAG); > + tp->tx_skb[entry].skb =3D skb; [Severity: High] Can frags become stale if rtl8169_tso_csum() linearizes the skb? When an IPv4 non-TCP/UDP CHECKSUM_PARTIAL packet (such as UDP-Lite) with shared paged fragments hits rtl8169_tso_csum(), skb_checksum_help() calls __skb_linearize(skb) and sets skb_shinfo(skb)->nr_frags to 0. rtl8169_xmit_frags() then maps nothing, yet entry and tp->cur_tx still advance by the stale frags count, writing LAST_FRAG and skb onto an unmapped zeroed descriptor slot. This stalls TX DMA, causes invalid dma_unmap_single() calls on zeroed entries in rtl_tx(), and leaks skb in rtl8169_tx_clear_range() because tx_skb->len is 0 at that slot. Reading nr_frags after rtl8169_tso_csum() avoids the mismatch. [ ... ] > + } else { > + smp_rmb(); /* make sure dirty_tx is updated */ > + tx_left =3D READ_ONCE(tp->cur_tx) - dirty_tx; > + } [Severity: Low] Should smp_rmb() follow READ_ONCE(tp->cur_tx) here? rtl8169_start_xmit() places smp_wmb() before WRITE_ONCE(tp->cur_tx, ...). With smp_rmb() before READ_ONCE(tp->cur_tx), nothing orders the cur_tx load before reading tp->tx_desc_array[entry].opts1 and tp->tx_skb[entry] on weakly-ordered architectures when RTL_FEATURE_TX_NO_CLOSE is not set. > + while (tx_left > 0) { > + unsigned int entry =3D dirty_tx % NUM_TX_DESC; > + u32 status; > + > + status =3D le32_to_cpu(READ_ONCE(tp->tx_desc_array[entry].opts1)); > + if (!(tp->chip->features & RTL_FEATURE_TX_NO_CLOSE) && > + (status & DESC_OWN)) > + break; [Severity: Low] Are these TX hot-path reads redundant when RTL_FEATURE_TX_NO_CLOSE is set? READ_ONCE(tp->tx_desc_array[entry].opts1) performs an unconditional volatile load from coherent DMA memory on every completed descriptor even though status is never checked when RTL_FEATURE_TX_NO_CLOSE is enabled. Similarly, in rtl8169_start_xmit(), the per-packet MMIO read of TX_DESC_CLOSE_IDX tests a full-ring condition (=3D=3D NUM_TX_DESC) that cannot be reached after rtl_tx_slots_avail(tp) >=3D R8169_TX_STOP_THRS. [ ... ] > +static int rtl8169_poll(struct napi_struct *napi, int budget) > +{ > + struct rtl8169_private *tp =3D container_of(napi, struct rtl8169_privat= e, > + napi); > + struct net_device *dev =3D tp->dev; > + u16 status =3D rtl_get_events(tp); > + int work_done =3D 0; > + > + rtl_ack_events(tp, status & ~RX_OVERFLOW); [Severity: High] Can rtl8169_poll() silently drop LINK_CHG interrupts? r8169_mdio_register() sets new_bus->irq[0] =3D PHY_MAC_INTERRUPT, which disables phylib polling and relies solely on phy_mac_interrupt(). If normal RX/TX traffic masks IRQs in rtl8169_interrupt() and a link transition latches LINK_CHG before rtl8169_poll() reads INTR_STATUS, rtl_ack_events() clears LINK_CHG without calling phy_mac_interrupt(), permanently losing the link state change. > + rtl_tx(dev, tp, budget); > + > + /* always check rx queue */ > + work_done =3D rtl_rx(dev, tp, budget); > + > + if ((status & RX_OVERFLOW) && work_done > 0) > + rtl_ack_events(tp, RX_OVERFLOW); > + > + if (work_done < budget && napi_complete_done(napi, work_done)) > + rtl_irq_enable(tp); > + > + return work_done; > +} [Severity: High] Can an unacknowledged RX_OVERFLOW cause an interrupt storm here? If RX_OVERFLOW latches after status =3D rtl_get_events(tp) while rtl_rx() drains the remaining descriptors (work_done < budget), RX_OVERFLOW is not acknowledged before rtl_irq_enable(tp). The level-triggered IRQ then immediately re-fires, and on the next poll rtl_rx() sees no completed descriptors (work_done =3D=3D 0), so RX_OVERFLOW is skipped again and rtl_irq_enable(tp) re-arms an infinite IRQ/NAPI livelock. Acknowledging RX_OVERFLOW whenever work_done < budget (as r8169_main.c does) avoids this. [ ... ] > +static void rtl8169_down(struct rtl8169_private *tp) > +{ > + if (test_and_set_bit(RTL_STATUS_DOWN, tp->status)) > + return; > + > + phy_stop(tp->phydev); > + > + /* Clear all task flags after stopping PHY state machine */ > + bitmap_zero(tp->wk.flags, RTL_FLAG_MAX); > + > + rtl8169_cleanup(tp); > +} [Severity: High] Can a LINK_CHG interrupt re-queue phydev->state_queue after phy_stop()? CPU0 CPU1 () rtl8169_down() phy_stop(tp->phydev) state =3D PHY_HALTED phy_suspend() cancel_delayed_work_sync() rtl8169_interrupt() if (status & LINK_CHG) phy_mac_interrupt() <-- re-queues rtl8169_cleanup() rtl8169_irq_mask_and_ack() Because MAC interrupts are still enabled during phy_stop() (and phy_suspend() itself can trigger LINK_CHG), phydev->state_queue can be re-queued after phy_stop_machine() completes. On close/remove, phy_disconnect() skips phy_stop() for PHY_HALTED and does not cancel state_queue, allowing phy_state_machine() to run during or after teardown or clock disablement. Masking and synchronizing IRQs before phy_stop() would prevent this. [ ... ] > + rtl_lock_work(tp); > + > + if (!test_bit(RTL_STATUS_CLK_ETN_SYS_EN, tp->status)) { > + retval =3D rtl_reinit_mac_phy(tp); > + if (retval) > + goto err_free_rx_2; > + } [Severity: Medium] Does rtl_open() skip hardware re-initialization if an earlier rtl_mac_reinit() failed midway? rtd1625_pll_clock_init() sets RTL_STATUS_CLK_ETN_SYS_EN before enabling clk_etn_250m, waiting for ISO_PLL_WDOUT, or running rtd1625_mdio_init(). If any of those later steps fail during rtl_mac_reinit(), RTL_STATUS_CLK_ETN_SYS_EN remains set, so a subsequent interface down/up skips rtl_reinit_mac_phy() and brings up half-initialized hardware. [ ... ] > +static void rtl_shutdown(struct platform_device *pdev) > +{ > + struct rtl8169_private *tp =3D platform_get_drvdata(pdev); > + > + rtl_lock_work(tp); > + netif_device_detach(tp->dev); > + if (netif_running(tp->dev)) > + rtl8169_down(tp); > + > + /* Restore permanent MAC address */ > + if (test_bit(RTL_STATUS_CLK_ETN_SYS_EN, tp->status) && > + is_valid_ether_addr(tp->dev->perm_addr)) > + __rtl_rar_set(tp, tp->dev->perm_addr); > + rtl_unlock_work(tp); > +} [Severity: Medium] Can rtl_shutdown() race with rtl_open() because it does not hold rtnl_lock()? CPU0 CPU1 __dev_open() netif_device_present() -> true set __LINK_STATE_START rtl_open() alloc rings ... rtl_shutdown() rtl_lock_work(tp) netif_device_detach(tp->dev) rtl8169_down(tp) /* RTL_STATUS_DOWN */ rtl_unlock_work(tp) rtl_lock_work(tp) rtl8169_up(tp) <-- DMA/IRQs active after shutdown Acquiring rtnl_lock() before rtl_lock_work(tp) in rtl_shutdown() would serialize against __dev_open() and rtl_set_mac_address(). [ ... ] > +static int r8169_mdio_read_reg(struct mii_bus *mii_bus, int phyaddr, int= phyreg) > +{ > + struct rtl8169_private *tp =3D mii_bus->priv; > + > + if (phyaddr > 0) > + return -ENODEV; > + > + return rtl_phy_read(tp, CURRENT_MDIO_PAGE, phyreg); > +} > + > +static int r8169_mdio_write_reg(struct mii_bus *mii_bus, int phyaddr, > + int phyreg, u16 val) > +{ > + struct rtl8169_private *tp =3D mii_bus->priv; > + > + if (phyaddr > 0) > + return -ENODEV; > + > + return rtl_phy_write(tp, CURRENT_MDIO_PAGE, phyreg, val); > +} [Severity: Medium] Can r8169_mdio_read_reg() and r8169_mdio_write_reg() perform unclocked MMIO accesses? If rtl_mac_reinit() fails after rtd1625_reset_phy_gmac() disables clk_etn_sys and asserts rstc_gmac/rstc_gphy, the netdev stays up with the PHY attached while RTL_STATUS_CLK_ETN_SYS_EN is clear. A subsequent MII ioctl, ethtool call, or phy_disconnect() will then access OCPDR or PHYAR with the MAC clock-gated and in reset, risking an RBUS hang or SError. [ ... ] > + new_bus->irq[0] =3D PHY_MAC_INTERRUPT; > + new_bus->phy_mask =3D GENMASK(31, 1); > + snprintf(new_bus->id, MII_BUS_ID_SIZE, "%s-0", KBUILD_MODNAME); [Severity: Low] Will hardcoding new_bus->id to "%s-0" fail with -EEXIST if a platform has more than one r8169soc instance? Deriving the ID from dev_name(&pdev->dev) would keep it unique per device. [ ... ] > + /* Serialize against rtl_set_rx_mode() and ISR before disabling MAC clo= ck */ > + netif_addr_lock_bh(tp->dev); > + clk_en =3D test_and_clear_bit(RTL_STATUS_CLK_ETN_SYS_EN, tp->status); > + netif_addr_unlock_bh(tp->dev); > + if (clk_en) { > + synchronize_irq(tp->dev->irq); > + clk_disable_unprepare(tp->clk_etn_sys); > + } [Severity: Medium] Can rtd1625_reset_phy_gmac() disable clk_etn_sys while rtl8169_netpoll() is still inside rtl8169_interrupt()? CPU0 CPU1 (netpoll) rtl8169_netpoll() rtl8169_interrupt() test_bit(CLK_ETN_SYS_EN) -> true rtd1625_reset_phy_gmac() clear_bit(CLK_ETN_SYS_EN) synchronize_irq() clk_disable_unprepare() reset_control_assert(rstc_gmac) rtl_get_events() <-- unclocked MMIO synchronize_irq() does not wait for netpoll, which calls rtl8169_interrupt() under rcu_read_lock_bh() outside hardirq context. Calling netpoll_poll_disable()/enable() or synchronize_net() after clearing RTL_STATUS_CLK_ETN_SYS_EN would wait for in-flight netpoll callers. [ ... ] > + if (!test_bit(RTL_STATUS_CLK_ETN_SYS_EN, tp->status)) { > + ret =3D clk_prepare_enable(tp->clk_etn_sys); > + if (ret) { > + dev_dbg(d, "failed to enable etn_sys clk: %d\n", ret); > + return ret; > + } > + set_bit(RTL_STATUS_CLK_ETN_SYS_EN, tp->status); > + } > + > + if (!test_bit(RTL_STATUS_CLK_ETN_250M_EN, tp->status)) { > + ret =3D clk_prepare_enable(tp->clk_etn_250m); > + if (ret) { > + dev_dbg(d, "failed to enable etn_250m clk: %d\n", ret); > + return ret; > + } > + set_bit(RTL_STATUS_CLK_ETN_250M_EN, tp->status); > + } > + > + /* Bit 0 of ISO_PLL_WDOUT indicates init_autoload_done (ETN RBUS valid)= */ > + ret =3D regmap_read(tp->iso_base, ISO_PLL_WDOUT, &val); [Severity: Medium] Is RTL_STATUS_CLK_ETN_SYS_EN published too early here? rtl_set_rx_mode() and rtl8169_interrupt() check only RTL_STATUS_CLK_ETN_SYS_EN before accessing GMAC MMIO registers, so setting it before clk_etn_250m is enabled and before ISO_PLL_WDOUT confirms ETN RBUS is valid allows concurrent MMIO accesses during the reinit window (and permanently if those later steps fail). Tracking clock-enable state separately from MAC MMIO readiness would avoid this. [ ... ] > + ndev->hw_features =3D NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | > + NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_TX | > + NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_GRO_UDP_FWD; > + > + ndev->features |=3D ndev->hw_features; [Severity: Medium] Should NETIF_F_GRO_UDP_FWD be omitted from hw_features here? register_netdevice() already exposes NETIF_F_GRO_UDP_FWD via NETIF_F_SOFT_FEATURES_OFF while intentionally leaving it disabled by default in dev->features. Adding it to hw_features and copying it into ndev->features enables rx-udp-gro-forwarding by default without user opt-in. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204100746.1165= 612-1-ericwang@realtek.com?part=3D2