@@ -40,16 +40,16 @@ typedef enum {
* @param buffer calculate chksum for buffer
* @param len buffer length
*
- * @return checksum value in host cpu order
+ * @return checksum value in network order
*/
static inline odp_u16sum_t odph_chksum(void *buffer, int len)
{
- uint16_t *buf = (uint16_t *)buffer;
+ odp_u16be_t *buf = (odp_u16be_t *)buffer;
uint32_t sum = 0;
uint16_t result;
for (sum = 0; len > 1; len -= 2)
- sum += *buf++;
+ sum += odp_be_to_cpu_16(*buf++);
if (len == 1)
sum += *(unsigned char *)buf;
@@ -58,7 +58,7 @@ static inline odp_u16sum_t odph_chksum(void *buffer, int len)
sum += (sum >> 16);
result = ~sum;
- return (__odp_force odp_u16sum_t) result;
+ return odp_cpu_to_be_16(result);
}
/**