This patch simply demonstrates that a checksum value computed when
verifying an offloaded transport checksum value for both IPv4 and
IPv6 is (normally) 0. It can be squashed into the next patch.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
ip4h->protocol, 0);
pseudo_csum = csum16_add(ip_payload_csum, (__force __be16)pseudo_csum);
ip4h->protocol, 0);
pseudo_csum = csum16_add(ip_payload_csum, (__force __be16)pseudo_csum);
+ /* The trailer checksum *includes* the checksum in the transport
+ * header. Adding that to the pseudo checksum will yield 0xffff
+ * ("negative 0") if the message arrived intact.
+ */
+ WARN_ON((__sum16)~pseudo_csum);
csum_value_final = ~csum16_sub(pseudo_csum, (__force __be16)*csum_field);
if (unlikely(!csum_value_final)) {
csum_value_final = ~csum16_sub(pseudo_csum, (__force __be16)*csum_field);
if (unlikely(!csum_value_final)) {
length, ip6h->nexthdr, 0);
pseudo_csum = csum16_add(ip6_payload_csum, (__force __be16)pseudo_csum);
length, ip6h->nexthdr, 0);
pseudo_csum = csum16_add(ip6_payload_csum, (__force __be16)pseudo_csum);
+ /* Adding the payload checksum to the pseudo checksum yields 0xffff
+ * ("negative 0") if the message arrived intact.
+ */
+ WARN_ON((__sum16)~pseudo_csum);
csum_value_final = ~csum16_sub(pseudo_csum, (__force __be16)*csum_field);
if (unlikely(csum_value_final == 0)) {
csum_value_final = ~csum16_sub(pseudo_csum, (__force __be16)*csum_field);
if (unlikely(csum_value_final == 0)) {