summaryrefslogtreecommitdiff
path: root/drivers/net/stmmac/stmmac_main.c
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>2010-07-27 00:09:47 (GMT)
committerDavid S. Miller <davem@davemloft.net>2010-07-28 03:43:50 (GMT)
commit3eeb29972b1139f733f7269def527900729f4cc7 (patch)
tree7189feaee380e0921c65935879e65030b01d9560 /drivers/net/stmmac/stmmac_main.c
parentca09c9760101b607cd2282c45b342655e26fa683 (diff)
downloadlinux-fsl-qoriq-3eeb29972b1139f733f7269def527900729f4cc7.tar.xz
stmmac: fix automatic PAD/FCS stripping
For Simple Ethernet frames (802.2 and 802.3) the GMAC Core never strips pad and fcs. This means the ACS has no effect on IPv4/6 frames. The FL bits, in the RDES0, include the FCS so the driver has to remove it in SW. For 802.3 frame format with LLC or LLC-SNAP, when set the ACS bit, the HW strips both PAD and FCS. The FL bits, in the RDES0, actually represents the frame length already stripped. This patch fixes this logic within the device driver that erroneously removed 4byte from 802.3 frames already stripped corrupting the payload. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/stmmac/stmmac_main.c')
-rw-r--r--drivers/net/stmmac/stmmac_main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index 1083334..bbb7951 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -1216,9 +1216,13 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
priv->dev->stats.rx_errors++;
else {
struct sk_buff *skb;
- /* Length should omit the CRC */
- int frame_len = priv->hw->desc->get_rx_frame_len(p) - 4;
+ int frame_len;
+ frame_len = priv->hw->desc->get_rx_frame_len(p);
+ /* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3
+ * Type frames (LLC/LLC-SNAP) */
+ if (unlikely(status != llc_snap))
+ frame_len -= ETH_FCS_LEN;
#ifdef STMMAC_RX_DEBUG
if (frame_len > ETH_FRAME_LEN)
pr_debug("\tRX frame size %d, COE status: %d\n",