diff mbox series

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

Message ID 1534870807-18456-12-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v6,1/12] validation: pktio: check sctp flag in parser tests | expand

Commit Message

Github ODP bot Aug. 21, 2018, 5 p.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: f6c423a7d29e2c7d6d890cbc098a398d0d7e1288
 ** Merge commit sha: d4f772b36da26684194cb0452a01b8da1ba7e3e1
 **/
 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 d10100f53..1bc549c22 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -1306,7 +1306,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;
 
@@ -1325,6 +1326,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);
 
@@ -1333,6 +1340,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,