diff mbox series

[v2,10/11] linux-gen: ipsec: insert checksum into SCTP packets if required

Message ID 1534413607-8630-11-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v2,1/11] validation: pktio: check sctp flag in parser tests | expand

Commit Message

Github ODP bot Aug. 16, 2018, 10 a.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 674 (lumag:sctp-checksum)
 ** https://github.com/Linaro/odp/pull/674
 ** Patch: https://github.com/Linaro/odp/pull/674.patch
 ** Base sha: dc28824415ea510e3ef62e47f7640bf4a8420fde
 ** Merge commit sha: 44d3d4f3c02fc6f3ee9811bc4dc5f01561e519a4
 **/
 platform/linux-generic/odp_ipsec.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c
index 5b739cc1a..6ad7d5dd7 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -1305,7 +1305,8 @@  static void ipsec_out_ah_post(ipsec_state_t *state, odp_packet_t pkt)
 static void ipsec_out_checksums(odp_packet_t pkt,
 				ipsec_state_t *state)
 {
-	odp_bool_t ipv4_chksum_pkt, udp_chksum_pkt, tcp_chksum_pkt;
+	odp_bool_t ipv4_chksum_pkt, udp_chksum_pkt, tcp_chksum_pkt,
+		   sctp_chksum_pkt;
 	odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
 	odp_ipsec_outbound_config_t outbound = ipsec_config.outbound;
 
@@ -1324,6 +1325,12 @@  static void ipsec_out_checksums(odp_packet_t pkt,
 					   pkt_hdr->p.flags.l4_chksum_set,
 					   pkt_hdr->p.flags.l4_chksum);
 
+	sctp_chksum_pkt =  OL_TX_CHKSUM_PKT(outbound.chksum.inner_sctp,
+					    state->ip_next_hdr ==
+					    _ODP_IPPROTO_SCTP,
+					    pkt_hdr->p.flags.l4_chksum_set,
+					    pkt_hdr->p.flags.l4_chksum);
+
 	if (ipv4_chksum_pkt)
 		_odp_packet_ipv4_chksum_insert(pkt);
 
@@ -1332,6 +1339,9 @@  static void ipsec_out_checksums(odp_packet_t pkt,
 
 	if (udp_chksum_pkt)
 		_odp_packet_udp_chksum_insert(pkt);
+
+	if (sctp_chksum_pkt)
+		_odp_packet_sctp_chksum_insert(pkt);
 }
 
 static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt,