ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "James Hilliard" <james.hilliard1@gmail.com>
Cc: linux-sunxi@lists.linux.dev
Subject: Re: [PATCH net v3] net: stmmac: preserve RX checksum capability when offload is disabled
Date: Sat, 21 Nov 2026 18:54:44 +0000	[thread overview]
Message-ID: <sashiko-outbox-227278@kernel.org> (raw)
In-Reply-To: <20261120-submit-stmmac-rx-checksum-capability-v1-v3-1-e9e1fd85f380@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: stmmac: stmmac_init_rx_csum() checks dev->features
  instead of wanted
--

commit 71e6607bc9a26db47d719c3ea93eefca52be2961
Author: James Hilliard <james.hilliard1@gmail.com>

net: stmmac: preserve RX checksum capability when offload is disabled

This commit passes the requested RX checksum offload state directly to the
MAC and masks NETIF_F_RXCSUM when enabling the hardware checker fails,
reconciling features on open and resume instead of discarding the detected
checksum capability.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index a685ce4638f61..786eb089dc2b8 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -3675,25 +3675,51 @@ static bool stmmac_tso_channel_permitted(struct stmmac_priv *priv,
>  	return !(priv->dma_conf.tx_queue[chan].tbs & STMMAC_TBS_AVAIL);
>  }
>  
> +static int stmmac_set_rx_csum(struct stmmac_priv *priv, unsigned int rx_csum)
> +{
> +	int ret;
> +
> +	if (!rx_csum) {
> +		WRITE_ONCE(priv->hw->rx_csum, 0);
> +		stmmac_rx_ipc(priv, priv->hw, false);
> +		return 0;
> +	}
> +
> +	ret = stmmac_rx_ipc(priv, priv->hw, true);
> +	if (ret <= 0) {
> +		WRITE_ONCE(priv->hw->rx_csum, 0);
> +		priv->rx_csum_failed = true;
> +		return ret ?: -EIO;
> +	}
> +
> +	WRITE_ONCE(priv->hw->rx_csum, rx_csum);
> +	return 0;
> +}
> +
> +/* Recheck the wanted features if this reset clears or uncovers a failure. */
> +static bool stmmac_init_rx_csum(struct net_device *dev)
> +{
> +	struct stmmac_priv *priv = netdev_priv(dev);
> +	bool was_failed = priv->rx_csum_failed;
> +	unsigned int rx_csum;
> +
> +	priv->rx_csum_failed = false;
> +	rx_csum = dev->features & NETIF_F_RXCSUM ? priv->plat->rx_coe : 0;
> +	if (stmmac_set_rx_csum(priv, rx_csum))
> +		netdev_warn(dev, "RX IPC Checksum Offload disabled\n");
> +
> +	return was_failed || priv->rx_csum_failed;
> +}

[Severity: Medium]
Should stmmac_init_rx_csum() test dev->wanted_features instead of
dev->features?

After a previous enable failure sets priv->rx_csum_failed, NETIF_F_RXCSUM
is cleared in dev->features while remaining set in dev->wanted_features.
On the next open or resume, checking dev->features gives rx_csum == 0, so
stmmac_init_rx_csum() clears priv->rx_csum_failed without retesting
stmmac_rx_ipc(priv, priv->hw, true) and returns true (was_failed).  The
caller's netdev_update_features() then leaves NETIF_F_RXCSUM unmasked in
stmmac_fix_features() and invokes stmmac_set_features() with
NETIF_F_RXCSUM set, which fails again with -EIO and aborts
__netdev_update_features() before applying other feature updates.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-submit-stmmac-rx-checksum-capability-v1-v3-1-e9e1fd85f380@gmail.com?part=1

      reply	other threads:[~2026-11-21 18:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 18:54 [PATCH net v3] net: stmmac: preserve RX checksum capability when offload is disabled James Hilliard
2026-11-21 18:54 ` sashiko-bot [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=sashiko-outbox-227278@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=james.hilliard1@gmail.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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