Skip to content

Commit eb1ba8d

Browse files
stgrabergregkh
authored andcommitted
drivers: net: xgene: Fix regression in CRC stripping
commit e9e6fae upstream. All packets on ingress (except for jumbo) are terminated with a 4-bytes CRC checksum. It's the responsability of the driver to strip those 4 bytes. Unfortunately a change dating back to March 2017 re-shuffled some code and made the CRC stripping code effectively dead. This change re-orders that part a bit such that the datalen is immediately altered if needed. Fixes: 4902a92 ("drivers: net: xgene: Add workaround for errata 10GE_8/ENET_11") Cc: stable@vger.kernel.org Signed-off-by: Stephane Graber <stgraber@ubuntu.com> Tested-by: Stephane Graber <stgraber@ubuntu.com> Link: https://lore.kernel.org/r/20220322224205.752795-1-stgraber@ubuntu.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a2368d1 commit eb1ba8d

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

drivers/net/ethernet/apm/xgene/xgene_enet_main.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,12 @@ static int xgene_enet_rx_frame(struct xgene_enet_desc_ring *rx_ring,
696696
buf_pool->rx_skb[skb_index] = NULL;
697697

698698
datalen = xgene_enet_get_data_len(le64_to_cpu(raw_desc->m1));
699+
700+
/* strip off CRC as HW isn't doing this */
701+
nv = GET_VAL(NV, le64_to_cpu(raw_desc->m0));
702+
if (!nv)
703+
datalen -= 4;
704+
699705
skb_put(skb, datalen);
700706
prefetch(skb->data - NET_IP_ALIGN);
701707
skb->protocol = eth_type_trans(skb, ndev);
@@ -717,12 +723,8 @@ static int xgene_enet_rx_frame(struct xgene_enet_desc_ring *rx_ring,
717723
}
718724
}
719725

720-
nv = GET_VAL(NV, le64_to_cpu(raw_desc->m0));
721-
if (!nv) {
722-
/* strip off CRC as HW isn't doing this */
723-
datalen -= 4;
726+
if (!nv)
724727
goto skip_jumbo;
725-
}
726728

727729
slots = page_pool->slots - 1;
728730
head = page_pool->head;

0 commit comments

Comments
 (0)