diff mbox series

[v2,6/13] linux-gen: ipsec: provide global init/term functions

Message ID 1519938053-24031-7-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v2,1/13] linux-gen: packet: implement packet l3/l4 proto types | expand

Commit Message

Github ODP bot March 1, 2018, 9 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


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

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
/** Email created from pull request 505 (muvarov:devel/master_merge_api-next)
 ** https://github.com/Linaro/odp/pull/505
 ** Patch: https://github.com/Linaro/odp/pull/505.patch
 ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6
 ** Merge commit sha: 5da68bf06572d3d0651c37cbba03aa91995ec465
 **/
 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 c21228982..ff8e4176f 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 */
 };
 
@@ -142,6 +143,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 325c1fb92..19003b6a2 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;
+}