diff mbox series

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

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

Commit Message

Github ODP bot Aug. 20, 2018, 11 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: b482f9618a6edb2a2f2491ee5a7af757eab93b24
 **/
 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,