net: Set a flag when checksum has been computed

Set checksum flag on the net_pkt, when checksum is calculated in
software.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2023-10-11 16:45:36 +02:00 committed by Fabio Baltieri
parent 98b46340f2
commit eadd933607
4 changed files with 4 additions and 0 deletions

View file

@ -67,6 +67,7 @@ int net_icmpv4_finalize(struct net_pkt *pkt)
icmp_hdr->chksum = 0U;
if (net_if_need_calc_tx_checksum(net_pkt_iface(pkt))) {
icmp_hdr->chksum = net_calc_chksum_icmpv4(pkt);
net_pkt_set_chksum_done(pkt, true);
}
return net_pkt_set_data(pkt, &icmpv4_access);

View file

@ -71,6 +71,7 @@ int net_icmpv6_finalize(struct net_pkt *pkt)
icmp_hdr->chksum = 0U;
if (net_if_need_calc_tx_checksum(net_pkt_iface(pkt))) {
icmp_hdr->chksum = net_calc_chksum_icmpv6(pkt);
net_pkt_set_chksum_done(pkt, true);
}
return net_pkt_set_data(pkt, &icmp_access);

View file

@ -3597,6 +3597,7 @@ int net_tcp_finalize(struct net_pkt *pkt)
if (net_if_need_calc_tx_checksum(net_pkt_iface(pkt))) {
tcp_hdr->chksum = net_calc_chksum_tcp(pkt);
net_pkt_set_chksum_done(pkt, true);
}
return net_pkt_set_data(pkt, &tcp_access);

View file

@ -53,6 +53,7 @@ int net_udp_finalize(struct net_pkt *pkt)
if (net_if_need_calc_tx_checksum(net_pkt_iface(pkt))) {
udp_hdr->chksum = net_calc_chksum_udp(pkt);
net_pkt_set_chksum_done(pkt, true);
}
return net_pkt_set_data(pkt, &udp_access);