@@ -355,7 +355,7 @@ static int setup_udp_pkt(odp_packet_t pkt, odp_pktout_config_opt_t *pktout_cfg)
ip->id = odp_cpu_to_be_16(seq);
if (!pktout_cfg->bit.ipv4_chksum) {
ip->chksum = 0;
- ip->chksum = odph_chksum(ip, ODPH_IPV4HDR_LEN);
+ ip->chksum = ~odp_chksum_ones_comp16(ip, ODPH_IPV4HDR_LEN);
}
if (pktout_cfg->bit.ipv4_chksum || pktout_cfg->bit.udp_chksum) {
@@ -453,7 +453,7 @@ static int setup_icmp_pkt(odp_packet_t pkt,
ip->id = odp_cpu_to_be_16(seq);
if (!pktout_cfg->bit.ipv4_chksum) {
ip->chksum = 0;
- ip->chksum = odph_chksum(ip, ODPH_IPV4HDR_LEN);
+ ip->chksum = ~odp_chksum_ones_comp16(ip, ODPH_IPV4HDR_LEN);
}
/* icmp */
@@ -466,7 +466,8 @@ static int setup_icmp_pkt(odp_packet_t pkt,
memcpy(tval_d, &tval, sizeof(uint64_t));
icmp->chksum = 0;
- icmp->chksum = odph_chksum(icmp, args->appl.payload + ODPH_ICMPHDR_LEN);
+ icmp->chksum = ~odp_chksum_ones_comp16(icmp, args->appl.payload +
+ ODPH_ICMPHDR_LEN);
if (pktout_cfg->bit.ipv4_chksum) {
odp_packet_l2_offset_set(pkt, 0);
@@ -269,7 +269,8 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream,
inner_ip->frag_offset = 0;
inner_ip->src_addr = odp_cpu_to_be_32(stream->src_ip);
inner_ip->dst_addr = odp_cpu_to_be_32(stream->dst_ip);
- inner_ip->chksum = odph_chksum(inner_ip, sizeof(*inner_ip));
+ inner_ip->chksum = ~odp_chksum_ones_comp16(inner_ip,
+ sizeof(*inner_ip));
data += sizeof(*inner_ip);
}
@@ -290,7 +291,7 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream,
/* Close ICMP */
icmp->chksum = 0;
- icmp->chksum = odph_chksum(icmp, data - (uint8_t *)icmp);
+ icmp->chksum = ~odp_chksum_ones_comp16(icmp, data - (uint8_t *)icmp);
/* Close ESP if specified */
if (esp) {