]> git.baikalelectronics.ru Git - kernel.git/commit
net: lan966x: Fix unmapping of received frames using FDMA
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Mon, 31 Oct 2022 13:34:21 +0000 (14:34 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 2 Nov 2022 04:20:30 +0000 (21:20 -0700)
commit3c6015664783df333526cc88668de4cc5e48d2d6
tree619a2ab4c1e58bbe6c327e77bacda5f4915a4ae8
parent2b647864a570acba6954c0211ac15d496f1873f0
net: lan966x: Fix unmapping of received frames using FDMA

When lan966x was receiving a frame, then it was building the skb and
after that it was calling dma_unmap_single with frame size as the
length. This actually has 2 issues:
1. It is using a length to map and a different length to unmap.
2. When the unmap was happening, the data was sync for cpu but it could
   be that this will overwrite what build_skb was initializing.

The fix for these two problems is to change the order of operations.
First to sync the frame for cpu, then to build the skb and in the end to
unmap using the correct size but without sync the frame again for cpu.

Fixes: ebd353447de7 ("net: lan966x: Add FDMA functionality")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Link: https://lore.kernel.org/r/20221031133421.1283196-1-horatiu.vultur@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c