diff options
author | Mike Holmes <mike.holmes@linaro.org> | 2014-07-17 17:46:53 -0400 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2014-07-18 18:05:10 +0400 |
commit | 8f7fd2f16bed95341951856a8ebe77671c3391e5 (patch) | |
tree | 4dc4106343e371538c7e980399fbc83f4600d6b6 /include/helper/odp_ip.h | |
parent | 846fd868f0aa8b7c0e371352c71961b522fba789 (diff) |
Introduce sum type to solve sparse warnings
ODP follows the linux kernel with the use of sparse and BE data type
checking. This patch introduces the sum type which is used by Linux
but was not part of ODP see:
http://lxr.free-electrons.com/source/include/uapi/linux/icmp.h#L71
This patch allows SPARSE to pass cleanly and the odp_generator test
case also passes.
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
Reviewed-and-Tested-by: Anders Roxell <anders.roxell@linaro.org>
Diffstat (limited to 'include/helper/odp_ip.h')
-rw-r--r-- | include/helper/odp_ip.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/include/helper/odp_ip.h b/include/helper/odp_ip.h index d8366bb..6f4e028 100644 --- a/include/helper/odp_ip.h +++ b/include/helper/odp_ip.h @@ -56,7 +56,7 @@ typedef struct ODP_PACKED { uint16be_t frag_offset; /**< Fragmentation offset */ uint8_t ttl; /**< Time to live */ uint8_t proto; /**< Protocol */ - uint16be_t chksum; /**< Checksum */ + uint16sum_t chksum; /**< Checksum */ uint32be_t src_addr; /**< Source address */ uint32be_t dst_addr; /**< Destination address */ } odp_ipv4hdr_t; @@ -101,9 +101,8 @@ static inline int odp_ipv4_csum_valid(odp_packet_t pkt) * * @return IPv4 checksum in host cpu order, or 0 on failure */ -static inline uint16_t odp_ipv4_csum_update(odp_packet_t pkt) +static inline uint16sum_t odp_ipv4_csum_update(odp_packet_t pkt) { - uint16_t res = 0; uint16_t *w; odp_ipv4hdr_t *ip; int nleft = sizeof(odp_ipv4hdr_t); @@ -113,9 +112,8 @@ static inline uint16_t odp_ipv4_csum_update(odp_packet_t pkt) ip = (odp_ipv4hdr_t *)odp_packet_l3(pkt); w = (uint16_t *)(void *)ip; - res = odp_chksum(w, nleft); - ip->chksum = odp_cpu_to_be_16(res); - return res; + ip->chksum = odp_chksum(w, nleft); + return ip->chksum; } /** IPv6 version */ |