diff mbox series

[API-NEXT,v14,12/16] linux-gen: ipsec: store mtu and frag_mode in SA

Message ID 1513119632-28755-13-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v14,1/16] validation: ipsec: add ipv4 name parts | expand

Commit Message

Github ODP bot Dec. 12, 2017, 11 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 304 (lumag:ipsec-ipv6-2)
 ** https://github.com/Linaro/odp/pull/304
 ** Patch: https://github.com/Linaro/odp/pull/304.patch
 ** Base sha: d96a8207591fbcaac25b79286d7d72a537354c1f
 ** Merge commit sha: 832a79461bc8bd90e572c396fa081e162e1dacb6
 **/
 platform/linux-generic/include/odp_ipsec_internal.h |  2 ++
 platform/linux-generic/odp_ipsec_sad.c              | 14 +++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/include/odp_ipsec_internal.h b/platform/linux-generic/include/odp_ipsec_internal.h
index 822c9016b..c6f241fac 100644
--- a/platform/linux-generic/include/odp_ipsec_internal.h
+++ b/platform/linux-generic/include/odp_ipsec_internal.h
@@ -156,6 +156,8 @@  struct ipsec_sa_s {
 		struct {
 			odp_atomic_u64_t counter; /* for CTR/GCM */
 			odp_atomic_u32_t seq;
+			odp_ipsec_frag_mode_t frag_mode;
+			uint32_t mtu;
 
 			union {
 			struct {
diff --git a/platform/linux-generic/odp_ipsec_sad.c b/platform/linux-generic/odp_ipsec_sad.c
index 82b3c4522..2d6321166 100644
--- a/platform/linux-generic/odp_ipsec_sad.c
+++ b/platform/linux-generic/odp_ipsec_sad.c
@@ -230,6 +230,8 @@  odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param)
 		odp_atomic_init_u64(&ipsec_sa->in.antireplay, 0);
 	} else {
 		odp_atomic_store_u32(&ipsec_sa->out.seq, 1);
+		ipsec_sa->out.frag_mode = param->outbound.frag_mode;
+		ipsec_sa->out.mtu = param->outbound.mtu;
 	}
 	ipsec_sa->dec_ttl = param->opt.dec_ttl;
 	ipsec_sa->copy_dscp = param->opt.copy_dscp;
@@ -489,10 +491,16 @@  uint64_t odp_ipsec_sa_to_u64(odp_ipsec_sa_t sa)
 
 int odp_ipsec_sa_mtu_update(odp_ipsec_sa_t sa, uint32_t mtu)
 {
-	(void)sa;
-	(void)mtu;
+	ipsec_sa_t *ipsec_sa;
+
+	ipsec_sa = _odp_ipsec_sa_use(sa);
+	ODP_ASSERT(NULL != ipsec_sa);
 
-	return -1;
+	ipsec_sa->out.mtu = mtu;
+
+	_odp_ipsec_sa_unuse(ipsec_sa);
+
+	return 0;
 }
 
 ipsec_sa_t *_odp_ipsec_sa_lookup(const ipsec_sa_lookup_t *lookup)