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
2287 dma_length_status = status->length_status;2287 dma_length_status = status->length_status;
2288 if (dev->features & NETIF_F_RXCSUM) {2288 if (dev->features & NETIF_F_RXCSUM) {
2289 rx_csum = (__force __be16)(status->rx_csum & 0xffff);2289 rx_csum = (__force __be16)(status->rx_csum & 0xffff);
2290 skb->csum = (__force __wsum)ntohs(rx_csum);2290 if (rx_csum) {
2291 skb->ip_summed = CHECKSUM_COMPLETE;2291 skb->csum = (__force __wsum)ntohs(rx_csum);
2292 skb->ip_summed = CHECKSUM_COMPLETE;
2293 }
2292 }2294 }
2293 2295
2294 /* DMA flags and length are still valid no matter how2296 /* DMA flags and length are still valid no matter how