]> git.baikalelectronics.ru Git - kernel.git/commit
net: cpsw: avoid alignment faults by taking NET_IP_ALIGN into account
authorArd Biesheuvel <ardb@kernel.org>
Tue, 18 Jan 2022 10:22:04 +0000 (11:22 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Jan 2022 14:19:19 +0000 (14:19 +0000)
commite978a9a0decf1be6c02d99df7ab8b26d78d4659c
treeb8f50eae6e63e42b7ee1963f36461be8ff7ac106
parentcb3919ad9d3e958ec29301148058cbf72d5ab4dc
net: cpsw: avoid alignment faults by taking NET_IP_ALIGN into account

Both versions of the CPSW driver declare a CPSW_HEADROOM_NA macro that
takes NET_IP_ALIGN into account, but fail to use it appropriately when
storing incoming packets in memory. This results in the IPv4 source and
destination addresses to appear misaligned in memory, which causes
aligment faults that need to be fixed up in software.

So let's switch from CPSW_HEADROOM to CPSW_HEADROOM_NA where needed.
This gets rid of any alignment faults on the RX path on a Beaglebone
White.

Fixes: bd880e301d4e ("net: ethernet: ti: cpsw: add XDP support")
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/cpsw.c
drivers/net/ethernet/ti/cpsw_new.c
drivers/net/ethernet/ti/cpsw_priv.c