From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp10.goneo.de (smtp10.goneo.de [85.220.189.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44B324D9918; Fri, 5 Jun 2026 12:14:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=85.220.189.106 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780661694; cv=none; b=crmtoX4A6dNLpM1CoPZswmPXKGFZuE5hu3UuIHWhwxAv/y5LtR3Uk2CRGvKf/tMPupjnevIugx47vE/Xvobs8Y0/uwa5UGDN4rzSNk617M17P438FEnRQEXqe5kpNLmiTdahG8xVLOQ/hPxAgAncUzxrLivIwUHdoOe+h8yXTf8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780661694; c=relaxed/simple; bh=X3uWoFTL43TKtRaGf/jtjolAY6UPFdTmz02blP+KP3k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lr9UeC3AooPaZx91sapMhIJjtp41SA/7npPieE4BfgXvo8+DciADcuYcucpDend5MXt3zdcneFHLzRvso6O3KTxiZ1QOwxqBDDJe1OhCy2VGWrlUvHipGxRN4a+cZWsg3GRP4IeSKOY+MhPckngkFVsYU8K2JRXAXVy1e2WE1hg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tk154.de; spf=pass smtp.mailfrom=tk154.de; dkim=pass (2048-bit key) header.d=tk154.de header.i=@tk154.de header.b=h9fre6Tl; arc=none smtp.client-ip=85.220.189.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tk154.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tk154.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tk154.de header.i=@tk154.de header.b="h9fre6Tl" Received: from hub2.goneo.de (hub2.goneo.de [IPv6:2001:1640:5::8:53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by smtp10.goneo.de (Postfix) with ESMTPS id 9577124028A; Fri, 05 Jun 2026 14:14:45 +0200 (CEST) Received: from hub2.goneo.de (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPS id ED2BD240523; Fri, 5 Jun 2026 14:14:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tk154.de; s=DKIM001; t=1780661684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZoTVEgLNauvougTiOOzgJ66IRmD3vjDkLm4JeWlu9kI=; b=h9fre6TlkmEzg86Oh7Oxv/LmHPlKDPeGOCvKg/4TxZ0WXx3FS9gCoTloAlYppVEI6atNUq wCUOAfc89nVaQUqKod+eco9mAQfDHZR4XC8oPg03UguseKCxYj9H588/HxFBkMBguxumWm 04crzUisKBam+hNzh8asZE6dA4jrct0WubnXMCw5U4vEkBjM3qtoHl2eUXrURF3ELdUa1g 0+cEAmCjWHmuyX26Jj/OUt5vLYiCYsTDXxzWRq2eheKvxd4ZP9I/WutgAj52osu1+6I33m 8WJbcLI0QknMp1kVq3hHahHvdCgxVAnxfSTlxTUfcdOh3f0usCMihT71YP/Uwg== Received: from Til-Notebook.meshlab (unknown [195.37.88.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hub2.goneo.de (Postfix) with ESMTPSA id 9C4D4240511; Fri, 5 Jun 2026 14:14:40 +0200 (CEST) From: Til Kaiser To: netdev@vger.kernel.org, bpf@vger.kernel.org Cc: marcin.s.wojtas@gmail.com, linux@armlinux.org.uk, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, mcroce@redhat.com, sven.auhagen@voleatech.de, lorenzo@kernel.org, Til Kaiser Subject: [PATCH net v3 1/4] net: mvpp2: sync RX data at the hardware packet offset Date: Fri, 5 Jun 2026 14:13:29 +0200 Message-ID: <20260605121332.147397-2-mail@tk154.de> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260605121332.147397-1-mail@tk154.de> References: <20260602164635.62517-1-mail@tk154.de> <20260605121332.147397-1-mail@tk154.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-UID: 197c98 X-Rspamd-UID: f827fd mvpp2 programs the RX queue packet offset, so hardware writes received data at dma_addr + MVPP2_SKB_HEADROOM. The current CPU sync starts at dma_addr and only covers rx_bytes + MVPP2_MH_SIZE bytes, which syncs the unused headroom and misses the same number of bytes at the packet tail. On non-coherent DMA systems this can leave the CPU reading stale cache contents for the end of the received frame. Use dma_sync_single_range_for_cpu() with MVPP2_SKB_HEADROOM as the range offset so the sync covers the Marvell header and packet data actually written by hardware. Fixes: e1921168bbd4 ("mvpp2: sync only the received frame") Signed-off-by: Til Kaiser --- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index f442b874bb59..92a701f4fe3f 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -3946,9 +3946,10 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, dma_dir = DMA_FROM_DEVICE; } - dma_sync_single_for_cpu(dev->dev.parent, dma_addr, - rx_bytes + MVPP2_MH_SIZE, - dma_dir); + dma_sync_single_range_for_cpu(dev->dev.parent, dma_addr, + MVPP2_SKB_HEADROOM, + rx_bytes + MVPP2_MH_SIZE, + dma_dir); /* Buffer header not supported */ if (rx_status & MVPP2_RXD_BUF_HDR) -- 2.54.0