From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.246.84.56 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796078216; b=26qcYF2LAUdyakZ4vSDbmpreDqsRwReHTRSjRpsZN0+3voTfWjSP/tn/sXKIDGJJY7T/ GsLRzaFawy9xiOrJ2UGnJt8vPOvlCUzdM+JZaTiIxSiWcO1ChYo/DVxpPNu6KIahlQbfr kbRGmx0oHEJJfycQhv70JkiqCQm73Bs6i/c+63RuYQFtGnlUp0sJKQVf11AafRf3SJ0Wp 0wdCqgwyYdLJ25IQh6pc9Z9xi+wHy6H5gD2lIMN2bqEd4QYVcaYBmuNOGEuMWlli83csP WTrXqohWUPAucajzOccmEckhkgeQDqPO9T3CF908aL51yHhanhGWNw8ngrLEws6E1Dw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796078216; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References:From: Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding: X-Last-TLS-Session-Version; bh=lLNkyttafVJwCghxtV9SBves2jAJQ0t/nqNJrspdGsY=; b=ZXgIViyd3KDLZs+P0+2Dv4EFWs831AnFDnikZh8xqlbUhT5yi68C/sk9flXXopbkdvWM wp7bJnxr31KDWlBBFk8Xg+p281Px4z3RwLtz4cKCBu292nV7jb8PrbZDZ0OaPCGGjooFv OEWJslDlsopc7a/S8fjaDhntQU7GeljGHCmKzjaqCSt+0BjkFIZgC6UZ4jsHqLZ48fizv ZmGeTMafq2m8Z674eJJcaAqdg1LOr19AMYJVKuIIbsg8OwqgqAUysN0tmmVPJm4OKRPJN 4pJzhl7uCufSdMFuT7wPjowxQxE1ZMlAK6zlKBEO249zWIGRrNZ6hgK/pg0vuwF0eNA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b="2XV/eqYz"; arc=none smtp.remote-ip=185.246.84.56 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EB6A606A320 for ; Mon, 30 Nov 2026 22:36:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4EB6A606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=2XV/eqYz Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 7D5861A1896; Mon, 30 Nov 2026 22:36:52 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 3D41C6007C; Mon, 30 Nov 2026 22:36:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 3541711EA0205; Mon, 30 Nov 2026 23:36:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796078207; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=lLNkyttafVJwCghxtV9SBves2jAJQ0t/nqNJrspdGsY=; b=2XV/eqYzjVcwDLvEetA5ZpkYHDC679rKd1TJogRgOLlthUFIyFtzw5zwqk8ozie+4WAInK EI+l8Dr1wC5qoSy7nOUiVNz41mWDXhgxeJ/SRZOhc/Km4tAZ7QzEK5OYt1tdP9Vd5j87D1 VLuUANgv46hXtgt+qEMnb0CZqOEc4KBYCavz8kpd8r9uLVIf15BMHDfA2NAnT8xPvXbAz3 4vfjJAMtvumkHmaLSJ3zRh5cmQTPU2YJ0bBFh896dlXIg/nEqVXrnNaPAOVk85VTOZRT1v QGJnedcDMJ/rSvo+thrwvg4euodDx5lFywt3lZTMsbQ5LY8yCQd0tR7KC/tvFw== Message-ID: Date: Mon, 30 Nov 2026 23:36:39 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v5] net: stmmac: preserve RX checksum capability when offload is disabled To: James Hilliard , netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , Giuseppe CAVALLARO , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev References: <20261125-submit-stmmac-rx-checksum-capability-v1-v5-1-5bb1a9e2cb9c@gmail.com> From: Maxime Chevallier Content-Language: en-US In-Reply-To: <20261125-submit-stmmac-rx-checksum-capability-v1-v5-1-5bb1a9e2cb9c@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 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 > --- > 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