Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i40e: mark the value passed to csum_replace_by_diff as __wsum

Fix, or rather, avoid a sparse warning caused by the fact that
csum_replace_by_diff expects to receive a __wsum value. Since the
calculation appears to work, simply typecast the passed paylen value to
__wsum to avoid the warning.

This seems pretty fishy since __wsum was obviously annotated as
a separate type on purpose, so this throws the entire calculation into
question. Since it currently appears to behave as expected, the typecast
is probably safe.

Change-ID: I4fdc5cddd589abc16098176e8a61127e761488f4
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

authored by

Jacob Keller and committed by
Jeff Kirsher
b9c015d4 ae136708

+6 -4
+3 -2
drivers/net/ethernet/intel/i40e/i40e_txrx.c
··· 2335 2335 2336 2336 /* remove payload length from outer checksum */ 2337 2337 paylen = skb->len - l4_offset; 2338 - csum_replace_by_diff(&l4.udp->check, htonl(paylen)); 2338 + csum_replace_by_diff(&l4.udp->check, 2339 + (__force __wsum)htonl(paylen)); 2339 2340 } 2340 2341 2341 2342 /* reset pointers to inner headers */ ··· 2357 2356 2358 2357 /* remove payload length from inner checksum */ 2359 2358 paylen = skb->len - l4_offset; 2360 - csum_replace_by_diff(&l4.tcp->check, htonl(paylen)); 2359 + csum_replace_by_diff(&l4.tcp->check, (__force __wsum)htonl(paylen)); 2361 2360 2362 2361 /* compute length of segmentation header */ 2363 2362 *hdr_len = (l4.tcp->doff * 4) + l4_offset;
+3 -2
drivers/net/ethernet/intel/i40evf/i40e_txrx.c
··· 1629 1629 1630 1630 /* remove payload length from outer checksum */ 1631 1631 paylen = skb->len - l4_offset; 1632 - csum_replace_by_diff(&l4.udp->check, htonl(paylen)); 1632 + csum_replace_by_diff(&l4.udp->check, 1633 + (__force __wsum)htonl(paylen)); 1633 1634 } 1634 1635 1635 1636 /* reset pointers to inner headers */ ··· 1651 1650 1652 1651 /* remove payload length from inner checksum */ 1653 1652 paylen = skb->len - l4_offset; 1654 - csum_replace_by_diff(&l4.tcp->check, htonl(paylen)); 1653 + csum_replace_by_diff(&l4.tcp->check, (__force __wsum)htonl(paylen)); 1655 1654 1656 1655 /* compute length of segmentation header */ 1657 1656 *hdr_len = (l4.tcp->doff * 4) + l4_offset;