Add internal API to allow implementation to copy packet metatdata
when replicating a packet.  Add the call to crypto to fix test
failure.

Signed-off-by: Robbie King <robk...@cisco.com>
---
 platform/linux-generic/include/odp_packet_internal.h |  2 ++
 platform/linux-generic/odp_crypto.c                  |  1 +
 platform/linux-generic/odp_packet.c                  | 14 ++++++++++++++
 3 files changed, 17 insertions(+)

diff --git a/platform/linux-generic/include/odp_packet_internal.h 
b/platform/linux-generic/include/odp_packet_internal.h
index 179330c..fa9d282 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -253,6 +253,8 @@ int _odp_packet_copy_to_packet(odp_packet_t srcpkt, 
uint32_t srcoffset,
                               odp_packet_t dstpkt, uint32_t dstoffset,
                               uint32_t len);
 
+void _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t dstpkt);
+
 odp_packet_t _odp_packet_alloc(odp_buffer_pool_t pool_hdl);
 
 int _odp_packet_parse(odp_packet_t pkt);
diff --git a/platform/linux-generic/odp_crypto.c 
b/platform/linux-generic/odp_crypto.c
index f18fa3c..b4580c4 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -362,6 +362,7 @@ odp_crypto_operation(odp_crypto_op_params_t *params,
                        ODP_ABORT();
                _odp_packet_copy_to_packet(params->pkt, 0, params->out_pkt, 0,
                                           odp_packet_len(params->pkt));
+               _odp_packet_copy_md_to_packet(params->pkt, params->out_pkt);
                odp_packet_free(params->pkt);
                params->pkt = ODP_PACKET_INVALID;
        }
diff --git a/platform/linux-generic/odp_packet.c 
b/platform/linux-generic/odp_packet.c
index 257abec..6270f30 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -581,6 +581,20 @@ int odp_packet_is_valid(odp_packet_t pkt)
  *
  */
 
+void _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t dstpkt)
+{
+       odp_packet_hdr_t *srchdr = odp_packet_hdr(srcpkt);
+       odp_packet_hdr_t *dsthdr = odp_packet_hdr(dstpkt);
+
+       dsthdr->input = srchdr->input;
+       dsthdr->buf_hdr.buf_u64 = srchdr->buf_hdr.buf_u64;
+       odp_atomic_store_u32(
+               &dsthdr->buf_hdr.ref_count,
+               odp_atomic_load_u32(
+                       &srchdr->buf_hdr.ref_count));
+       copy_packet_parser_metadata(srchdr, dsthdr);
+}
+
 int _odp_packet_copy_to_packet(odp_packet_t srcpkt, uint32_t srcoffset,
                               odp_packet_t dstpkt, uint32_t dstoffset,
                               uint32_t len)
-- 
1.9.1


_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to