diff mbox series

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

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

Commit Message

Github ODP bot Aug. 21, 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: 912e026c108d7a496ac7467e953dea77dadaaa57
 ** Merge commit sha: 9ab290c4f721a97e8c289b8a7992e6cc6614e7c3
 **/
 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,