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

Message ID 1519657209-30140-5-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series
  • [API-NEXT,v1,1/11] linux-gen: packet: add odp_packet_l2_type() implementation
Related show

Commit Message

Github ODP bot Feb. 26, 2018, 3 p.m.
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


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

---
/** Email created from pull request 502 (lumag:ipsec-imp-upd)
 ** https://github.com/Linaro/odp/pull/502
 ** Patch: https://github.com/Linaro/odp/pull/502.patch
 ** Base sha: c91eae61d19350dd19aacf18c1148c9491398c14
 ** Merge commit sha: 8c909084626ccef140542645cd34549ce7f4bcde
 **/
 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(+)

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;
+}