diff mbox series

[API-NEXT,v1,6/15] linux-gen: ipsec: provide global init/term functions

Message ID 1519232408-28445-7-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [API-NEXT,v1,1/15] api: don't create special case for the tunnel-dummy packets | expand

Commit Message

Github ODP bot Feb. 21, 2018, 4:59 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 494 (lumag:ipsec-tfc-imp)
 ** https://github.com/Linaro/odp/pull/494
 ** Patch: https://github.com/Linaro/odp/pull/494.patch
 ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88
 ** Merge commit sha: 7bc900650676584bfb99c8a92c3d8812b458f172
 **/
 platform/linux-generic/include/odp_internal.h |  4 ++++
 platform/linux-generic/odp_init.c             | 13 +++++++++++++
 platform/linux-generic/odp_ipsec.c            | 13 +++++++++++++
 3 files changed, 30 insertions(+)
diff mbox series

Patch

diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h
index 444e1163b..fcf7d1109 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -76,6 +76,7 @@  enum init_stage {
 	NAME_TABLE_INIT,
 	IPSEC_EVENTS_INIT,
 	IPSEC_SAD_INIT,
+	IPSEC_INIT,
 	ALL_INIT      /* All init stages completed */
 };
 
@@ -136,6 +137,9 @@  int _odp_ishm_init_local(void);
 int _odp_ishm_term_global(void);
 int _odp_ishm_term_local(void);
 
+int _odp_ipsec_init_global(void);
+int _odp_ipsec_term_global(void);
+
 int _odp_ipsec_sad_init_global(void);
 int _odp_ipsec_sad_term_global(void);
 
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index a2d9d52ff..0da1a5d11 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -150,6 +150,12 @@  int odp_init_global(odp_instance_t *instance,
 	}
 	stage = IPSEC_SAD_INIT;
 
+	if (_odp_ipsec_init_global()) {
+		ODP_ERR("ODP IPsec init failed.\n");
+		goto init_failed;
+	}
+	stage = IPSEC_INIT;
+
 	*instance = (odp_instance_t)odp_global_data.main_pid;
 
 	return 0;
@@ -174,6 +180,13 @@  int _odp_term_global(enum init_stage stage)
 
 	switch (stage) {
 	case ALL_INIT:
+	case IPSEC_INIT:
+		if (_odp_ipsec_term_global()) {
+			ODP_ERR("ODP IPsec term failed.\n");
+			rc = -1;
+		}
+		/* Fall through */
+
 	case IPSEC_SAD_INIT:
 		if (_odp_ipsec_sad_term_global()) {
 			ODP_ERR("ODP IPsec SAD term failed.\n");
diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c
index 3e6a80987..8c3d6cd63 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -1796,3 +1796,16 @@  odp_event_t odp_ipsec_packet_to_event(odp_packet_t pkt)
 {
 	return odp_packet_to_event(pkt);
 }
+
+int _odp_ipsec_init_global(void)
+{
+	odp_ipsec_config_init(&ipsec_config);
+
+	return 0;
+}
+
+int _odp_ipsec_term_global(void)
+{
+	/* Do nothing for now */
+	return 0;
+}