@@ -34,33 +34,6 @@ typedef enum {
ODPH_CHKSUM_RETURN /**< Don't generate or verify chksum */
} 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
*
@@ -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;
}