public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: mail@birger-koblitz.de
Cc: Jakub Kicinski <kuba@kernel.org>,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, linux-usb@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	hsu.chih.kai@realtek.com
Subject: Re: [PATCH net-next v2 3/4] r8152: Add irq mitigation for RTL8157/9
Date: Thu, 30 Apr 2026 18:16:00 -0700	[thread overview]
Message-ID: <20260501011600.3154202-1-kuba@kernel.org> (raw)
In-Reply-To: <20260429-rtl8159_net_next-v2-3-bab3cd4e4c66@birger-koblitz.de>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
r8152: Add irq mitigation for RTL8157/9

This commit clears bits 0, 1, 2, and 7 of USB register 0xcf04 in
r8156_init() for RTL_VER_16 and later, with the stated intent of avoiding
intr URB completions with urb->status == -ESHUTDOWN on RTL8157 and
RTL8159.

> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 2a07dde289e2..9fcad3dac76f 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
> @@ -8452,6 +8452,12 @@ static void r8156_init(struct r8152 *tp)
>  	else
>  		r8153_u2p3en(tp, false);
>  
> +	if (tp->version >= RTL_VER_16) {
> +		/* Disable Interrupt Mitigation */
> +		ocp_byte_clr_bits(tp, MCU_TYPE_USB, 0xcf04,
> +				  BIT(0) | BIT(1) | BIT(2) | BIT(7));
> +	}
> +

The subject and changelog describe this as adding "irq mitigation" /
"interrupt mitigation code", but the in-tree comment says "Disable
Interrupt Mitigation" and the operation is ocp_byte_clr_bits(), which
turns a hardware feature off.

Would it be clearer to phrase the subject along the lines of "r8152:
disable hardware interrupt mitigation on RTL8157/9" so that someone
bisecting or searching the log for when this feature was "added" is not
led in the opposite direction?

The same sequence already exists in rtl8153_unload():

	static void rtl8153_unload(struct r8152 *tp)
	{
		if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
			return;

		r8153_power_cut_en(tp, false);

		if (tp->version >= RTL_VER_16) {
			/* Disable Interrupt Mitigation */
			ocp_byte_clr_bits(tp, MCU_TYPE_USB, 0xcf04, BIT(0) | BIT(1) | BIT(2) | BIT(7));
		}
	}

That copy was introduced by fd3c7d080df5 ("r8152: Add support for the
RTL8157 hardware"). Now that the bits are cleared during init, does the
unload-path copy still serve a purpose, or can it be removed as part of
this change?

The register 0xcf04 and the bit selection BIT(0) | BIT(1) | BIT(2) |
BIT(7) are bare numeric literals, while most of the file uses named
defines (USB_MSC_TIMER, USB_U2P3_CTRL, U2P3_ENABLE, and so on). Could
this change also introduce a symbolic name for the register and for the
individual bits being cleared, so reviewers can check the mask against
the datasheet and tell which bit is the enable versus threshold versus
reserved?

On the causal chain:

The changelog links the register write to intr URB completions with
status -ESHUTDOWN / -108, but does not explain how a MAC-side
interrupt-mitigation setting produces that status.

-ESHUTDOWN on an intr URB is normally posted by the USB core when an
endpoint has been disabled or the device is disconnecting. Could the
commit message describe the mechanism by which clearing these four bits
prevents the host controller from observing endpoint shutdown, and cite
the datasheet naming for bits 0, 1, 2, and 7 of 0xcf04 so it is clear
why exactly those bits (and no others) are the correct set to clear?

  reply	other threads:[~2026-05-01  1:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29 17:01 [PATCH net-next v2 0/4] r8152: Add support for the RTL8159 10Gbit USB Ethernet chip Birger Koblitz
2026-04-29 17:01 ` [PATCH net-next v2 1/4] r8152: Add support for 10Gbit Link Speeds and EEE Birger Koblitz
2026-05-01  1:15   ` Jakub Kicinski
2026-05-02  4:18     ` Birger Koblitz
2026-04-29 17:01 ` [PATCH net-next v2 2/4] r8152: Add support for the RTL8159 chip Birger Koblitz
2026-05-01  1:15   ` Jakub Kicinski
2026-05-02  4:39     ` Birger Koblitz
2026-04-29 17:01 ` [PATCH net-next v2 3/4] r8152: Add irq mitigation for RTL8157/9 Birger Koblitz
2026-05-01  1:16   ` Jakub Kicinski [this message]
2026-05-02  4:41     ` Birger Koblitz
2026-04-29 17:01 ` [PATCH net-next v2 4/4] r8152: Add firmware upload capability for RTL8157/RTL8159 Birger Koblitz
2026-04-29 22:01 ` [PATCH net-next v2 0/4] r8152: Add support for the RTL8159 10Gbit USB Ethernet chip Aleksander Jan Bajkowski

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=20260501011600.3154202-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hsu.chih.kai@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mail@birger-koblitz.de \
    --cc=netdev@vger.kernel.org \
    --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