]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD
authorSean Anderson <seanga2@gmail.com>
Tue, 20 Sep 2022 23:50:18 +0000 (19:50 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 23 Nov 2022 14:11:48 +0000 (15:11 +0100)
commitbd7c6c74b2386330f17ff0f604aceedf267aa907
treea13a95ec5f0b16d106b6f4030bb8868c1c1b05ef
parent5fef8eee71556dd0a77b399966ff18ea74697e24
net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD

BugLink: https://bugs.launchpad.net/bugs/1995420
[ Upstream commit 878e2405710aacfeeb19364c300f38b7a9abfe8f ]

There is a separate receive path for small packets (under 256 bytes).
Instead of allocating a new dma-capable skb to be used for the next packet,
this path allocates a skb and copies the data into it (reusing the existing
sbk for the next packet). There are two bytes of junk data at the beginning
of every packet. I believe these are inserted in order to allow aligned DMA
and IP headers. We skip over them using skb_reserve. Before copying over
the data, we must use a barrier to ensure we see the whole packet. The
current code only synchronizes len bytes, starting from the beginning of
the packet, including the junk bytes. However, this leaves off the final
two bytes in the packet. Synchronize the whole packet.

To reproduce this problem, ping a HME with a payload size between 17 and
214

$ ping -s 17 <hme_address>

which will complain rather loudly about the data mismatch. Small packets
(below 60 bytes on the wire) do not have this issue. I suspect this is
related to the padding added to increase the minimum packet size.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20220920235018.1675956-1-seanga2@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/sun/sunhme.c