diff mbox series

[API-NEXT,v3,1/2] linux-gen: chksum: implement checksum insertion override functions

Message ID 1510563614-7352-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v3,1/2] linux-gen: chksum: implement checksum insertion override functions | expand

Commit Message

Github ODP bot Nov. 13, 2017, 9 a.m. UTC
From: Bogdan Pricope <bogdan.pricope@linaro.org>


The functions set L3/L4 checksum override output flags on the packet.
Checksum calculation, if requested, is perfromed at packet output time,
depending on interface capabilities.

Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>

---
/** Email created from pull request 245 (bogdanPricope:api_next_ovr_csum_ref_pr)
 ** https://github.com/Linaro/odp/pull/245
 ** Patch: https://github.com/Linaro/odp/pull/245.patch
 ** Base sha: a908a4dead95321e84d6a8a23de060051dcd8969
 ** Merge commit sha: 53e4dcc080039e61dbb9b6b46f7f06a8306631e0
 **/
 platform/linux-generic/odp_packet.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index 61162932b..32c9f5251 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -1292,6 +1292,22 @@  uint16_t odp_packet_ones_comp(odp_packet_t pkt, odp_packet_data_range_t *range)
 	return 0;
 }
 
+void odp_packet_l3_chksum_insert(odp_packet_t pkt, int insert)
+{
+	odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
+
+	pkt_hdr->p.output_flags.l3_chksum_set = 1;
+	pkt_hdr->p.output_flags.l3_chksum = insert;
+}
+
+void odp_packet_l4_chksum_insert(odp_packet_t pkt, int insert)
+{
+	odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
+
+	pkt_hdr->p.output_flags.l4_chksum_set = 1;
+	pkt_hdr->p.output_flags.l4_chksum = insert;
+}
+
 odp_packet_chksum_status_t odp_packet_l3_chksum_status(odp_packet_t pkt)
 {
 	odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);