lan743x: fix ethernet frame cutoff issue
authorSven Van Asbroeck <thesven73@gmail.com>
Fri, 9 Apr 2021 00:39:04 +0000 (20:39 -0400)
committerJakub Kicinski <kuba@kernel.org>
Fri, 9 Apr 2021 19:49:38 +0000 (12:49 -0700)
commit3bc41d6d2721d5168a8f7fea34028a5332068f5e
tree49f60782ab19f86874a50804a9f7d07addba04fb
parent864db232dc7036aa2de19749c3d5be0143b24f8f
lan743x: fix ethernet frame cutoff issue

The ethernet frame length is calculated incorrectly. Depending on
the value of RX_HEAD_PADDING, this may result in ethernet frames
that are too short (cut off at the end), or too long (garbage added
to the end).

Fix by calculating the ethernet frame length correctly. For added
clarity, use the ETH_FCS_LEN constant in the calculation.

Many thanks to Heiner Kallweit for suggesting this solution.

Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
Fixes: 3e21a10fdea3 ("lan743x: trim all 4 bytes of the FCS; not just 2")
Link: https://lore.kernel.org/lkml/20210408172353.21143-1-TheSven73@gmail.com/
Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
Reviewed-by: George McCollister <george.mccollister@gmail.com>
Tested-by: George McCollister <george.mccollister@gmail.com>
Link: https://lore.kernel.org/r/20210409003904.8957-1-TheSven73@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/microchip/lan743x_main.c