History

net: bcmgenet: skip invalid partial checksums

The RXCHK block will return a partial checksum of 0 if it encounters a problem while receiving a packet. Since a 1's complement sum can only produce this result if no bits are set in the received data stream it is fair to treat it as an invalid partial checksum and not pass it up the stack.

Doug Berger committed 4 years ago

Commit 0f643c81 parent 424e7831 file · +4 −2Browse files

Unified · Split

drivers/net/ethernet/broadcom/genet/bcmgenet.c+4−2
@@ -2287,8 +2287,10 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, · 2286 unmodified lines
22872287 dma_length_status = status->length_status;
22882288 if (dev->features & NETIF_F_RXCSUM) {
22892289 rx_csum = (__force __be16)(status->rx_csum & 0xffff);
2290− skb->csum = (__force __wsum)ntohs(rx_csum);
2291− skb->ip_summed = CHECKSUM_COMPLETE;
2290+ if (rx_csum) {
2291+ skb->csum = (__force __wsum)ntohs(rx_csum);
2292+ skb->ip_summed = CHECKSUM_COMPLETE;
2293+ }
22922294 }
22932295
22942296 /* DMA flags and length are still valid no matter how