diff mbox series

[API-NEXT,v4,1/7] linux-gen: pktio: loop: support IPsec outbound inline

Message ID 1500904888-11014-2-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [API-NEXT,v4,1/7] linux-gen: pktio: loop: support IPsec outbound inline | expand

Commit Message

Github ODP bot July 24, 2017, 2:01 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Add support for outbound inline IPsec packet processing on loop
interface.

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

---
/** Email created from pull request 81 (lumag:ipsec-packet-impl-2)
 ** https://github.com/Linaro/odp/pull/81
 ** Patch: https://github.com/Linaro/odp/pull/81.patch
 ** Base sha: db7cc41aeb559dd296f3a6d8570aa10326a31d5e
 ** Merge commit sha: b783305474c8ca3a4ce862c64e2ce5aa8348f2df
 **/
 platform/linux-generic/pktio/loop.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c
index c825393a..5b7a9692 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -166,6 +166,18 @@  static int loopback_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
 	for (i = 0; i < len; ++i) {
 		hdr_tbl[i] = packet_to_buf_hdr(pkt_tbl[i]);
 		bytes += odp_packet_len(pkt_tbl[i]);
+
+		if (pktio_entry->s.config.outbound_ipsec &&
+		    _odp_buffer_event_subtype(hdr_tbl[i]->handle.handle) ==
+		    ODP_EVENT_PACKET_IPSEC) {
+			odp_ipsec_packet_result_t result;
+
+			/* Possibly postprocessing packet */
+			odp_ipsec_result(&result, pkt_tbl[i]);
+
+			_odp_buffer_event_subtype_set(hdr_tbl[i]->handle.handle,
+						      ODP_EVENT_PACKET_BASIC);
+		}
 	}
 
 	odp_ticketlock_lock(&pktio_entry->s.txl);
@@ -217,6 +229,8 @@  static int loopback_capability(pktio_entry_t *pktio_entry ODP_UNUSED,
 	odp_pktio_config_init(&capa->config);
 	capa->config.pktin.bit.ts_all = 1;
 	capa->config.pktin.bit.ts_ptp = 1;
+	capa->config.outbound_ipsec = 1;
+
 	return 0;
 }