]> git.ipfire.org Git - thirdparty/linux.git/commit
net: atlantic: free RX pages of consumed but not refilled buffers
authorYangyu Chen <cyy@cyyself.name>
Sun, 2 Aug 2026 15:46:38 +0000 (23:46 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 5 Aug 2026 01:15:34 +0000 (18:15 -0700)
commite8e7471ef686b6c002218fee9671cc61992ae01a
tree4a81ed01eb585de74fee8311aef1aabb40e7a2e6
parent452636ea5410a96e02ebaaf80b21e3620b98e0dd
net: atlantic: free RX pages of consumed but not refilled buffers

aq_ring_rx_deinit() only walks [sw_head, sw_tail), the region posted to
hardware. Since the page reuse strategy was added, a cleaned RX buffer
keeps its page (and its DMA mapping) in the ring for reuse, and refill
is batched: aq_ring_rx_fill() returns early until AQ_CFG_RX_REFILL_THRES
slots are free. Slots that were consumed but not yet reposted therefore
sit in the complementary [sw_tail, sw_head) gap with a live page, and
the deinit walk never visits them: up to a refill batch worth of pages
and DMA mappings leak on every interface down.

Walk the whole ring instead and release whatever is still there. Also
bail out if the buffer ring is already gone: a partial
aq_ptp_ring_alloc() failure frees the ring but leaves aq_nic set, so
aq_ptp_ring_deinit() still gets here on the unwind path.

Cc: stable@vger.kernel.org # v5.2+
Fixes: 46f4c29d9de6 ("net: aquantia: optimize rx performance by page reuse strategy")
Reviewed-by: Sukhdeep Singh <sukhdeeps@marvell.com>
Signed-off-by: Yangyu Chen <cyy@cyyself.name>
Acked-by: Mina Almasry <almasrymina@google.com>
Link: https://patch.msgid.link/tencent_607CBA8237DA438E36B844318B21538DE008@qq.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/aquantia/atlantic/aq_ring.c