Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: javen_xu@realsil.com.cn
Cc: Jakub Kicinski <kuba@kernel.org>,
	hkallweit1@gmail.com, nic_swsd@realtek.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v10 4/7] r8169: enable new interrupt mapping
Date: Mon, 10 Aug 2026 14:31:04 -0700	[thread overview]
Message-ID: <20260810213104.853262-1-kuba@kernel.org> (raw)
In-Reply-To: <20260803021305.488-5-javen_xu@realsil.com.cn>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
r8169: enable new interrupt mapping

This patch enables new interrupt mapping for the RTL8127 device. It sets up
vector mapping if the device is configured with multiple MSI-X vectors.

> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
> index 6a7e9d875cf00..31f6d0c2e3d15 100644
> --- a/drivers/net/ethernet/realtek/r8169_main.c
> +++ b/drivers/net/ethernet/realtek/r8169_main.c

[ ... ]

> @@ -3945,6 +3954,9 @@ static void rtl_hw_start_8125_common(struct rtl8169_private *tp)
>  	RTL_W32(tp, RSS_CTRL_8125, 0);
>  	RTL_W16(tp, Q_NUM_CTRL_8125, 0);
>  
> +	if (tp->irq_nvecs > 1)
> +		rtl8169_hw_enable_vec_mapping(tp);
> +

[Severity: Medium]
With multiple MSI-X vectors enabled here, will concurrent NAPI polling cause
data races on the shared dev->stats counters?

When multiple NAPI instances process packets on different CPUs, rtl_rx() and
rtl8169_check_rx_desc_error() directly increment shared counters without
synchronization:

drivers/net/ethernet/realtek/r8169_main.c:rtl8169_check_rx_desc_error() {
    ...
    dev->stats.rx_length_errors++;
    if (status & RxCRC)
        dev->stats.rx_crc_errors++;
    ...
}

Could this lead to lost increments or torn reads on these network statistics?

[Severity: Medium]
Also, regarding the multiple RX rings setup for these vectors, is there a
memory leak in the teardown path?

The rx_ring array is allocated dynamically in rtl_init_one() during probe,
but rtl_remove_one() doesn't seem to free it:

drivers/net/ethernet/realtek/r8169_main.c:rtl_remove_one() {
    ...
    unregister_netdev(tp->dev);
    r8169_free_napi(tp);
    if (tp->dash_type != RTL_DASH_NONE)
        rtl8168_driver_stop(tp);
    rtl_release_firmware(tp);
    /* restore original MAC address */
    rtl_rar_set(tp, tp->dev->perm_addr);
}

Should there be a call to kfree(tp->rx_ring) here when the driver unbinds?

>  	/* disable UPS */
>  	r8168_mac_ocp_modify(tp, 0xd40a, 0x0010, 0x0000);
>

  reply	other threads:[~2026-08-10 21:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  2:12 [PATCH net-next v10 0/7] r8169: add RSS support for RTL8127 javen
2026-08-03  2:12 ` [PATCH net-next v10 1/7] r8169: add support for multi irqs javen
2026-08-03  2:13 ` [PATCH net-next v10 2/7] r8169: refactor RX path to prepare for multi-queue javen
2026-08-10 21:26   ` Jakub Kicinski
2026-08-03  2:13 ` [PATCH net-next v10 3/7] r8169: add support for new interrupt mapping javen
2026-08-10 21:29   ` Jakub Kicinski
2026-08-03  2:13 ` [PATCH net-next v10 4/7] r8169: enable " javen
2026-08-10 21:31   ` Jakub Kicinski [this message]
2026-08-03  2:13 ` [PATCH net-next v10 5/7] r8169: add support and enable rss javen
2026-08-10 21:31   ` Jakub Kicinski
2026-08-10 21:38   ` Jakub Kicinski
2026-08-03  2:13 ` [PATCH net-next v10 6/7] r8169: move struct ethtool_ops javen
2026-08-03  2:13 ` [PATCH net-next v10 7/7] r8169: support setting rx queue numbers via ethtool javen
2026-08-10 21:41   ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260810213104.853262-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=javen_xu@realsil.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox