aboutsummaryrefslogtreecommitdiff
path: root/helper
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>2017-11-07 17:33:30 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2017-12-27 21:41:46 +0300
commit08dc9d2008fa31418d4e8b53b8d4b32c18630256 (patch)
tree92a00d2e3b027280dff005add0731123eb2e95b2 /helper
parentb742308f29903a494870840085e4a32ba7c6980b (diff)
helper: use new odp checksum API
Use odp_chksum_ones_comp16 which may be platform-optimized. This removes now unnecessary odph_cksum() function. Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'helper')
-rw-r--r--helper/include/odp/helper/chksum.h27
-rw-r--r--helper/include/odp/helper/ip.h2
2 files changed, 1 insertions, 28 deletions
diff --git a/helper/include/odp/helper/chksum.h b/helper/include/odp/helper/chksum.h
index 1bf950c8b..ed2de91fb 100644
--- a/helper/include/odp/helper/chksum.h
+++ b/helper/include/odp/helper/chksum.h
@@ -35,33 +35,6 @@ typedef enum {
} odph_chksum_op_t;
/**
- * Checksum
- *
- * @param buffer calculate chksum for buffer
- * @param len buffer length
- *
- * @return checksum value in network order
- */
-static inline odp_u16sum_t odph_chksum(void *buffer, int len)
-{
- uint16_t *buf = (uint16_t *)buffer;
- uint32_t sum = 0;
- uint16_t result;
-
- for (sum = 0; len > 1; len -= 2)
- sum += *buf++;
-
- if (len == 1)
- sum += *(unsigned char *)buf;
-
- sum = (sum >> 16) + (sum & 0xFFFF);
- sum += (sum >> 16);
- result = ~sum;
-
- return (__odp_force odp_u16sum_t) result;
-}
-
-/**
* General Purpose TCP/UDP checksum function
*
* This function handles all the different checksum operations like
diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h
index c6eb9d767..b96aab280 100644
--- a/helper/include/odp/helper/ip.h
+++ b/helper/include/odp/helper/ip.h
@@ -125,7 +125,7 @@ static inline int odph_ipv4_csum(odp_packet_t pkt,
if (odp_unlikely(res < 0))
return res;
- *chksum = odph_chksum(buf, nleft);
+ *chksum = ~odp_chksum_ones_comp16(buf, nleft);
return 0;
}