[v4,1/3] linux-gen: use packet pointer in _odp_ipsec_try_inline

Message ID 1517972408-19360-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • [v4,1/3] linux-gen: use packet pointer in _odp_ipsec_try_inline
Related show

Commit Message

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


_odp_ipsec_try_inline() can change packet handle during decryption.
Return new package handler via packet pointer argument.

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

---
/** Email created from pull request 456 (lumag:ipsec-fix)
 ** https://github.com/Linaro/odp/pull/456
 ** Patch: https://github.com/Linaro/odp/pull/456.patch
 ** Base sha: 257b08b35ceea41bad5a7f1c626496cf111e657a
 ** Merge commit sha: eb3880eebfb94c83205c92a87e99dfd372a9c064
 **/
 platform/linux-generic/include/odp_ipsec_internal.h |  2 +-
 platform/linux-generic/odp_ipsec.c                  | 10 +++++-----
 platform/linux-generic/pktio/loop.c                 |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

Patch

diff --git a/platform/linux-generic/include/odp_ipsec_internal.h b/platform/linux-generic/include/odp_ipsec_internal.h
index bdb86c400..8a7b42c50 100644
--- a/platform/linux-generic/include/odp_ipsec_internal.h
+++ b/platform/linux-generic/include/odp_ipsec_internal.h
@@ -262,7 +262,7 @@  int _odp_ipsec_sa_replay_update(ipsec_sa_t *ipsec_sa, uint32_t seq,
  * @retval 0 if packet was processed and will be queue using IPsec inline
  *           processing
  */
-int _odp_ipsec_try_inline(odp_packet_t pkt);
+int _odp_ipsec_try_inline(odp_packet_t *pkt);
 
 /**
  * @}
diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c
index 586653d4e..0ef8b88a7 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -1628,7 +1628,7 @@  int odp_ipsec_out_enq(const odp_packet_t pkt_in[], int num_in,
 	return in_pkt;
 }
 
-int _odp_ipsec_try_inline(odp_packet_t pkt)
+int _odp_ipsec_try_inline(odp_packet_t *pkt)
 {
 	odp_ipsec_op_status_t status;
 	ipsec_sa_t *ipsec_sa;
@@ -1637,7 +1637,7 @@  int _odp_ipsec_try_inline(odp_packet_t pkt)
 
 	memset(&status, 0, sizeof(status));
 
-	ipsec_sa = ipsec_in_single(pkt, ODP_IPSEC_SA_INVALID, &pkt, &status);
+	ipsec_sa = ipsec_in_single(*pkt, ODP_IPSEC_SA_INVALID, pkt, &status);
 	/*
 	 * Route packet back in case of lookup failure or early error before
 	 * lookup
@@ -1645,14 +1645,14 @@  int _odp_ipsec_try_inline(odp_packet_t pkt)
 	if (NULL == ipsec_sa)
 		return -1;
 
-	packet_subtype_set(pkt, ODP_EVENT_PACKET_IPSEC);
-	result = ipsec_pkt_result(pkt);
+	packet_subtype_set(*pkt, ODP_EVENT_PACKET_IPSEC);
+	result = ipsec_pkt_result(*pkt);
 	memset(result, 0, sizeof(*result));
 	result->status = status;
 	result->sa = ipsec_sa->ipsec_sa_hdl;
 	result->flag.inline_mode = 1;
 
-	pkt_hdr = packet_hdr(pkt);
+	pkt_hdr = packet_hdr(*pkt);
 	pkt_hdr->p.input_flags.dst_queue = 1;
 	pkt_hdr->dst_queue = queue_fn->from_ext(ipsec_sa->queue);
 
diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c
index 0cf45acbd..79c21ee7a 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -156,7 +156,7 @@  static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
 		/* Try IPsec inline processing */
 		if (pktio_entry->s.config.inbound_ipsec &&
 		    odp_packet_has_ipsec(pkt))
-			_odp_ipsec_try_inline(pkt);
+			_odp_ipsec_try_inline(&pkt);
 
 		pktio_entry->s.stats.in_octets += pkt_len;
 		pkts[num_rx++] = pkt;