Re: [PATCH net-next 07/12] r8152: support rx checksum

From: David Miller
Date: Tue Mar 04 2014 - 16:33:13 EST


From: Hayes Wang <hayeswang@xxxxxxxxxxx>
Date: Tue, 4 Mar 2014 20:00:59 +0800

> @@ -1453,11 +1491,19 @@ static void rx_bottom(struct r8152 *tp)
> pkt_len -= CRC_SIZE;
> rx_data += sizeof(struct rx_desc);
>
> + checksum = r8152_rx_csum(tp, rx_desc);
> + if (checksum == RTL_CHECKSUM_FAIL) {
> + stats->rx_errors++;
> + goto find_next_rx;
> + }
> +

It is not for the driver to make this policy decision and drop the
packet. It is not a device RX error event.

In fact you do not know what corrupted the checksum, or even if
the device verified it correctly. Anything is possible.

You must therefore still pass the packet up into the networking
stack using CHECKSUM_NONE, and let the protocols double-check
the checksum(s) in software and bump the appropriate statistic
counter if the checksum is really bad.

This allows allows network taps to see the packet, so that the
administrator can analyze the situation.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/