mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: James Hilliard <james.hilliard1@gmail.com>,
	netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Giuseppe CAVALLARO <peppe.cavallaro@st.com>,
	Chen-Yu Tsai <wens@kernel.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH net v5] net: stmmac: preserve RX checksum capability when offload is disabled
Date: Mon, 30 Nov 2026 23:36:39 +0100	[thread overview]
Message-ID: <d7e4461f-384c-492b-b926-3591050f2ba5@bootlin.com> (raw)
In-Reply-To: <20261125-submit-stmmac-rx-checksum-capability-v1-v5-1-5bb1a9e2cb9c@gmail.com>

Hi,

On 11/25/26 10:14, James Hilliard wrote:
> Disabling RX checksum offload with ethtool and reopening the interface
> can make it impossible to enable offload again. GMAC, GMAC4 and XGMAC
> return the IPC enable bit after programming it. A clear bit is expected
> on disable, but stmmac_hw_setup() treats it as a missing capability and
> discards the detected checksum type.
> 
> Keep the detected type and pass the requested setting directly to the
> MAC. Publish a nonzero checksum type only after a successful enable
> readback. If the MAC rejects an enable, mask RXCSUM in subsequent
> feature negotiation. Finish applying the other features in the same
> request and report the resulting active mask. This lets an ethtool
> request change VLAN stripping even when it cannot enable RXCSUM.
> 
> On open and resume, probe a previously failed checker before starting
> reception. If it still fails, the active feature mask already reflects
> that and there is nothing to report. If its availability changes, let
> the network core reconcile the current request before starting RX.
> 
> Found while investigating RX checksum offload on H616. Maxime
> Chevallier reproduced the capability loss on AgileX5, CycloneV and
> STM32MP1.
> 
> In a host test with mocked XGMAC registers, a rejected enable left
> only RXCSUM unmet and repeated resets sent no feature notifications.
> 
> Fixes: d2afb5bdffde ("stmmac: fix the rx csum feature")
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
> Changes in v5:
> - Base on posted Sun8i checksum-delivery v3 and retain its always-on
>   checker while adding the callback's enable argument.
> - Apply unrelated features in the same request when a live RX checksum
>   enable fails; report the active mask to ethtool.
> - Recheck a previously failed checker before RX starts. Recalculate
>   features only when the checker's availability changes.
> - When merging the RXALL series mentioned below, apply RXALL alongside
>   VLAN stripping even if RXCSUM is refused.
> - Link to v4: https://patch.msgid.link/20261122-submit-stmmac-rx-checksum-capability-v1-v4-1-b729bef2695d@gmail.com
> 
> IPC readback confirms the register state, not whether frames already in
> the FIFO or ring were checked. The live NAPI and FIFO transition is
> unchanged.
> 
> Changes in v4:
> - Repeat feature negotiation after a reset-time RX checksum retry fails,
>   so RXCSUM is masked before unrelated requested features are applied.
> - Link to v3: https://patch.msgid.link/20261120-submit-stmmac-rx-checksum-capability-v1-v3-1-e9e1fd85f380@gmail.com
> 
> The sun8i checksum-delivery fix for net [0] renames the RX IPC callback.
> When merging, keep its new name and body, and add the bool enable
> argument from this patch. The RXALL series for net-next [1] also changes
> stmmac_set_features(); apply the RXALL setting after the RX checksum
> change succeeds.
> 
> [0] https://lore.kernel.org/r/20261122-submit-sun8i-rx-features-v1-v2-1-24a2564f6edf@gmail.com/
> [1] https://lore.kernel.org/r/20261122-submit-sun8i-rxall-v1-v1-0-607789772c56@gmail.com/
> 
> Changes in v3:
> - Check a live enable before reporting hardware-verified checksums;
>   defer requests made while down to hardware setup.
> - Keep a failed enable from blocking unrelated feature changes and
>   recheck the saved request before RX starts on open and resume.
> - Pass the requested state directly to the MAC and document the
>   callback's return value.
> - Link to v2: https://patch.msgid.link/20261117-submit-stmmac-rx-checksum-capability-v1-v2-1-059f9499c386@gmail.com

I fail to see how we got there. This was a one-liner in V2.

Now there are changes in the internal API, new fields to check if a configuration
action failed before, stuff in the resume path...

You're trying too hard to please sashiko here, without looking at the quality
of the code being produced.

Frankly, V2 was fine, it fixed a real problem. After that, it goes to fixing
theoretical issues and it seems way too complicated, especially for something
that goes to net...

Sorry not I'm not confortable with that, should've said so earlier but man is
there a lot of stmmac stuff lately.

Feel free to do the more advanced reworks on net-next. I would definitely not go
with "bool rx_csum_failed". We have the rx_coe and rx_csum fields already to track
the HW caps and enable status. We write to rx_coe upon failure and it's very likely
not a good idea :

ret = stmmac_rx_ipc(priv, priv->hw);
if (!ret) {
        netdev_warn(priv->dev, "RX IPC Checksum Offload disabled\n");
        priv->plat->rx_coe = STMMAC_RX_COE_NONE; <<<<< We probably don't want that
        priv->hw->rx_csum = 0;
}

that would be a cleaner approach to build on that ground instead of tracking if
we failed IPC config.

pw-bot: cr

Maxime


      reply	other threads:[~2026-11-30 22:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  9:14 James Hilliard
2026-11-30 22:36 ` Maxime Chevallier [this message]

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=d7e4461f-384c-492b-b926-3591050f2ba5@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=james.hilliard1@gmail.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=samuel@sholland.org \
    --cc=wens@kernel.org \
    /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

all inboxes | Powered by JetHome®