Commit e5493600 authored by Herve Codina's avatar Herve Codina Committed by Jakub Kicinski

net: wan: fsl_qmc_hdlc: Discard received CRC

Received frame from QMC contains the CRC.
Upper layers don't need this CRC and tcpdump mentioned trailing junk
data due to this CRC presence.

As some other HDLC driver, simply discard this CRC.

Fixes: d0f2258e ("net: wan: Add support for QMC HDLC")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarHerve Codina <herve.codina@bootlin.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20240730063133.179598-1-herve.codina@bootlin.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c4d6a347
...@@ -250,6 +250,7 @@ static void qmc_hcld_recv_complete(void *context, size_t length, unsigned int fl ...@@ -250,6 +250,7 @@ static void qmc_hcld_recv_complete(void *context, size_t length, unsigned int fl
struct qmc_hdlc_desc *desc = context; struct qmc_hdlc_desc *desc = context;
struct net_device *netdev; struct net_device *netdev;
struct qmc_hdlc *qmc_hdlc; struct qmc_hdlc *qmc_hdlc;
size_t crc_size;
int ret; int ret;
netdev = desc->netdev; netdev = desc->netdev;
...@@ -268,15 +269,26 @@ static void qmc_hcld_recv_complete(void *context, size_t length, unsigned int fl ...@@ -268,15 +269,26 @@ static void qmc_hcld_recv_complete(void *context, size_t length, unsigned int fl
if (flags & QMC_RX_FLAG_HDLC_CRC) /* CRC error */ if (flags & QMC_RX_FLAG_HDLC_CRC) /* CRC error */
netdev->stats.rx_crc_errors++; netdev->stats.rx_crc_errors++;
kfree_skb(desc->skb); kfree_skb(desc->skb);
} else { goto re_queue;
netdev->stats.rx_packets++; }
netdev->stats.rx_bytes += length;
skb_put(desc->skb, length); /* Discard the CRC */
desc->skb->protocol = hdlc_type_trans(desc->skb, netdev); crc_size = qmc_hdlc->is_crc32 ? 4 : 2;
netif_rx(desc->skb); if (length < crc_size) {
netdev->stats.rx_length_errors++;
kfree_skb(desc->skb);
goto re_queue;
} }
length -= crc_size;
netdev->stats.rx_packets++;
netdev->stats.rx_bytes += length;
skb_put(desc->skb, length);
desc->skb->protocol = hdlc_type_trans(desc->skb, netdev);
netif_rx(desc->skb);
re_queue:
/* Re-queue a transfer using the same descriptor */ /* Re-queue a transfer using the same descriptor */
ret = qmc_hdlc_recv_queue(qmc_hdlc, desc, desc->dma_size); ret = qmc_hdlc_recv_queue(qmc_hdlc, desc, desc->dma_size);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment