diff mbox series

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

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

Commit Message

Github ODP bot Nov. 1, 2017, 2 p.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: d22c949cc466bf28de559855a1cb525740578137
 ** Merge commit sha: 3ee6c4da5a3b375e5eb87b9e656668e4fd6c8d73
 **/
 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 3b2fac212..0ad1a9329 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -1284,6 +1284,22 @@  int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset)
 	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;
+}
+
 void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t flow_hash)
 {
 	odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);