]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commita260d0aa2794e6499f730f4654c9868dada562f8
tree49f60782ab19f86874a50804a9f7d07addba04fb
parent5f6a00921317281b4a2b554f517a8972604e12f9
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: fe865957fb4c ("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