From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795952919; b=SHcq35Bv1PLdViMR3RtdAp85yNZPLMlhIJd9jxsqWnVKaqDfM/XXxrD+/nryOLXKAXtI jyfc8CPB1dWh+to5Si99WpTE/gRqsLf5laSpjBeT51HXkO7Feln+A3XQiJOTTF8MHHgth lA1fzbHNXGMt5HIY46g1j0fehsyTtM3VNdn96R/L4h8vCYdQFqzIfscFkWc+nlRe0zGrD E4C9B4wPPzO/oVJtvcvB2AHK/01w+VSIaz8FG8f4TS/4l+icft+/EpliBcAsIIktB/jZw 7E4Alux/wPcNIdMBL+UxIXfbQ4Zn8SY8Ydx1L5ZmV9Vh+jbnBFGv61tTODHS3sbWE/Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795952919; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=kS6JL0POCY79q/fEv/wHJhbi/ERUzjTOB4fymdB09fw=; b=23SFB6YRHIwfkHq4VwH9kMsxTsRiahpz32yicqFyv5mZGp+Cgwq3ah6nHUquZxE3rk2j 2tJNk9EexAQLUny4COxT/oUeROZr9f73PK7KJUQ86m7beBhhdolzEjiCbn5aii3DwQ7e2 +RobVv3qORmtKKrwhCTXOenmV5Yt85Y+IyjXFKbssITRlsi6cA+/xipcYX80vkyiOgvxd flL7akFnZWk0+J3VAP211vcqtzBIFEIqBKKIlhOcTFGsYSN2zCy2qtuOl1KtqQIT8iPYb eIaIvJ22aT9Y7+XOB0Z0dHv2Nid30kY/VcQjlhMM3YFgmKDRnTfhUJR6/RjtNs5MAdQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BgYj6w0D; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7303A606A68F; Sun, 29 Nov 2026 11:48:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BgYj6w0D Received: by smtp.kernel.org (Postfix) with ESMTPSA id C21C71F00896; Sun, 29 Nov 2026 11:48:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795952919; bh=kS6JL0POCY79q/fEv/wHJhbi/ERUzjTOB4fymdB09fw=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=BgYj6w0Dj/oRGZkpourOmKNFNHJ3pww0yfPWzusAGG7fU3W/HFgYIVEDWuvongwnG K7wpHRIOnN97HTMubvsytDVGcMvPuNSg3taiH0lYzBA0aGSYdo8hObpAJlAcgcM9CN 19c0jr3Yij7hPXaReyjWDMwxmB73XbLUdtzyrmo+gVfVvkGN04A1INuLUtLp4EeKMy tTXBSe2IZJ0BZNWTaPPgPcVQTl0KFGVNJKbII+pyiovQjGpROPgGZKwptUuzPLYTW2 734T4d0xcoizWQ3in9w/hXzMvBCfEfXFjiklOahFPUSIaE2hVFdT9rRudPUecMbcud jE+y17x1TIwMQ== Subject: Re: [PATCH net v5 2/2] net: atl1c: free the RX buffer when the descriptor reports an error From: netdev-bot+sashiko@kernel.org To: federico@rimpianto.com Cc: chris.snook@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sun, 29 Nov 2026 11:48:38 +0000 Message-ID: <179595291831.3146.7906490727635927112@kernel.org> In-Reply-To: <20261125113120.99743-3-federico@rimpianto.com> References: <20261125113120.99743-3-federico@rimpianto.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] In atl1c_clean_rx() (drivers/net/ethernet/atheros/atl1c/atl1c_main.c), the new RRD check… -- net: atl1c: free the RX buffer when the descriptor reports an error This commit changes atl1c_clean_rx() so that errored frames no longer leak their skb and DMA mapping: the buffer is now unmapped and freed. It also checks the RFD count and index in each RRD against rfd_ring->next_to_clean. On a mismatch it schedules an adapter reset through ATL1C_WORK_EVENT_RESET. Finally, it adds a dma_rmb() after the valid-bit test and clears the RRD ring in atl1c_clean_rx_ring(). > diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c > index afab3e16903ba..8383203623c17 100644 > --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c > +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c [ ... ] > @@ -1952,47 +1947,66 @@ static int atl1c_clean_rx(struct napi_struct *napi, int budget) > if (work_done >= budget) > break; > rrs = ATL1C_RRD_DESC(rrd_ring, rrd_ring->next_to_clean); > - if (likely(RRS_RXD_IS_VALID(rrs->word3))) { > - rfd_num = (rrs->word0 >> RRS_RX_RFD_CNT_SHIFT) & > - RRS_RX_RFD_CNT_MASK; > - if (unlikely(rfd_num != 1)) > - /* TODO support mul rfd*/ > - if (netif_msg_rx_err(adapter)) > - dev_warn(&pdev->dev, > - "Multi rfd not support yet!\n"); > - goto rrs_checked; > - } else { > + if (!RRS_RXD_IS_VALID(rrs->word3)) > + break; > + [ ... ] > + rrs_word0 = le32_to_cpu(rrs->word0); > + rfd_num = (rrs_word0 >> RRS_RX_RFD_CNT_SHIFT) & > + RRS_RX_RFD_CNT_MASK; > + rfd_index = (rrs_word0 >> RRS_RX_RFD_INDEX_SHIFT) & > + RRS_RX_RFD_INDEX_MASK; > + buffer_info = &rfd_ring->buffer_info[rfd_ring->next_to_clean]; > + [ ... ] > + if (unlikely(rfd_num != 1 || > + rfd_index != rfd_ring->next_to_clean || > + !buffer_info->skb)) { > + dev_err_ratelimited(&pdev->dev, > + "RRD out of sync: RFD count %u index %u, expected index %u%s; resetting\n", > + rfd_num, rfd_index, > + rfd_ring->next_to_clean, > + buffer_info->skb ? "" : " (no buffer)"); > + set_bit(ATL1C_WORK_EVENT_RESET, &adapter->work_event); > + schedule_work(&adapter->common_task); > break; > } [Severity: Medium] Can this check turn a legitimate multi-RFD frame into a full controller reset? For any mtu <= 1522, atl1c_set_rxbufsize() leaves rx_buffer_len at AT_RX_BUF_SIZE (1522): adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ? roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE; atl1c_configure_rx() writes that value to REG_RX_BUF_SIZE. Meanwhile atl1c_configure_mac() sets the MAC frame limit to mtu + 22: AT_WRITE_REG(hw, REG_MTU, hw->max_frame_size + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN); So with 1501 <= mtu <= 1522 (mtu 1508 for RFC 4638 PPPoE, for example), the MAC accepts frames of up to 1523..1544 bytes into 1522-byte RFDs. Suppose the device splits such a frame over two RFDs and reports RRS_RX_RFD_CNT = 2. This branch then sets ATL1C_WORK_EVENT_RESET, and atl1c_common_task() runs netif_device_detach(), atl1c_down() and atl1c_up() once per frame. Errored multi-RFD frames (RRS_RX_ERR_SUM or RRS_802_3_LEN_ERR) used to be consumed by atl1c_clean_rrd() and atl1c_clean_rfd() with rfd_num, and RX carried on. With this patch they also reset the controller. Nothing limits how often the reset can be scheduled, so a peer that keeps sending such frames could keep the link flapping. The commit message names alx_clean_rx_irq() as the model. alx can treat a count other than 1 as fatal because its rxbuf_size comes from ALX_MAX_FRAME_LEN(mtu), which is always at least the ALX_MTU register value. atl1c does not hold to that for mtu 1501..1522. It isn't confirmed whether the hardware splits an oversized frame across RFDs or truncates it into one. The old "TODO support mul rfd" branches and the 4-bit RFD count field suggest that splitting can happen. Would it work to size rx_buffer_len from the same expression as REG_MTU, for example max(AT_RX_BUF_SIZE, roundup(mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, 8))? Another option is to drop and recycle a multi-RFD frame whose index matches next_to_clean, and keep the reset for a real desync. [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125113120.99743-1-federico%40rimpianto.com