diff mbox series

[API-NEXT,v15,2/9] linux-gen: pktio: loop: support IPsec outbound inline

Message ID 1504606026-28181-3-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [API-NEXT,v15,1/9] test: validation: add IPsec API testsuite | expand

Commit Message

Github ODP bot Sept. 5, 2017, 10:06 a.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: 91c0b58fc87ba0431241818758cea94438cd5498
 ** Merge commit sha: 3ec7da960bd3d497e998f18cb30a2480296e7b6d
 **/
 platform/linux-generic/pktio/loop.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c
index 428b6ceb..6cc86e6a 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -164,6 +164,22 @@  static int loopback_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
 		bytes += odp_packet_len(pkt_tbl[i]);
 	}
 
+	if (pktio_entry->s.config.outbound_ipsec)
+		for (i = 0; i < len; ++i) {
+			odp_buffer_t buf = buf_from_buf_hdr(hdr_tbl[i]);
+			odp_ipsec_packet_result_t result;
+
+			if (_odp_buffer_event_subtype(buf) !=
+			    ODP_EVENT_PACKET_IPSEC)
+				continue;
+
+			/* Possibly postprocessing packet */
+			odp_ipsec_result(&result, pkt_tbl[i]);
+
+			_odp_buffer_event_subtype_set(buf,
+						      ODP_EVENT_PACKET_BASIC);
+		}
+
 	odp_ticketlock_lock(&pktio_entry->s.txl);
 
 	queue = queue_fn->from_ext(pktio_entry->s.pkt_loop.loopq);
@@ -213,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;
 }