This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, api-next has been updated via ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae (commit) via 85d3b2c169a2e6c549def1441c3df6bb970fcd85 (commit) via 4a507e46a1f7ae4b5354fd97eed7dc8fd23dce72 (commit) via 5c41d868e5cceb3e4fa29ad37c73ef6477132284 (commit) from f774120c17bea5c6a3718c13790f790f3c0a4163 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae Author: Petri Savolainen petri.savolainen@linaro.org Date: Thu Feb 22 15:26:19 2018 +0200
validation: packet: test packet_data_seg_len
Test the new combined packet data and seg_len function.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Balasubramanian Manoharan bala.manoharan@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 82e00c01..104d6c7d 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -636,7 +636,8 @@ static void packet_test_basic_metadata(void) static void packet_test_length(void) { odp_packet_t pkt = test_packet; - uint32_t buf_len, headroom, tailroom; + uint32_t buf_len, headroom, tailroom, seg_len; + void *data; odp_pool_capability_t capa;
CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0); @@ -644,8 +645,13 @@ static void packet_test_length(void) buf_len = odp_packet_buf_len(pkt); headroom = odp_packet_headroom(pkt); tailroom = odp_packet_tailroom(pkt); + data = odp_packet_data(pkt);
+ CU_ASSERT(data != NULL); CU_ASSERT(odp_packet_len(pkt) == packet_len); + CU_ASSERT(odp_packet_seg_len(pkt) <= packet_len); + CU_ASSERT(odp_packet_data_seg_len(pkt, &seg_len) == data); + CU_ASSERT(seg_len == odp_packet_seg_len(pkt)); CU_ASSERT(headroom >= capa.pkt.min_headroom); CU_ASSERT(tailroom >= capa.pkt.min_tailroom);
commit 85d3b2c169a2e6c549def1441c3df6bb970fcd85 Author: Petri Savolainen petri.savolainen@linaro.org Date: Thu Feb 22 15:08:19 2018 +0200
linux-gen: packet: implement packet_data_seg_len
Implement the new combined packet data and seg_len function.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Balasubramanian Manoharan bala.manoharan@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index b6b49336..ae90ec5b 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -63,6 +63,13 @@ static inline uint32_t _odp_packet_seg_len(odp_packet_t pkt) return _odp_pkt_get(pkt, uint32_t, seg_len); }
+static inline void *_odp_packet_data_seg_len(odp_packet_t pkt, + uint32_t *seg_len) +{ + *seg_len = _odp_packet_seg_len(pkt); + return _odp_packet_data(pkt); +} + static inline uint32_t _odp_packet_len(odp_packet_t pkt) { return _odp_pkt_get(pkt, uint32_t, frame_len); diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h index d0f3adc1..76210e00 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines_api.h @@ -23,6 +23,11 @@ _ODP_INLINE uint32_t odp_packet_seg_len(odp_packet_t pkt) return _odp_packet_seg_len(pkt); }
+_ODP_INLINE void *odp_packet_data_seg_len(odp_packet_t pkt, uint32_t *seg_len) +{ + return _odp_packet_data_seg_len(pkt, seg_len); +} + _ODP_INLINE uint32_t odp_packet_len(odp_packet_t pkt) { return _odp_packet_len(pkt);
commit 4a507e46a1f7ae4b5354fd97eed7dc8fd23dce72 Author: Petri Savolainen petri.savolainen@linaro.org Date: Thu Feb 22 14:53:29 2018 +0200
api: packet: add combined packet data and seg len
Packet data pointer and segment length used often. Combine two calls into one call. One call performs better in ABI compatible mode than two calls.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Balasubramanian Manoharan bala.manoharan@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 746f6fbf..e1f2f221 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -439,6 +439,22 @@ void *odp_packet_data(odp_packet_t pkt); */ uint32_t odp_packet_seg_len(odp_packet_t pkt);
+/** + * Packet data pointer with segment length + * + * Returns both data pointer and number of data bytes (in the segment) + * following it. This is equivalent to calling odp_packet_data() and + * odp_packet_seg_len(). + * + * @param pkt Packet handle + * @param[out] seg_len Pointer to output segment length + * + * @return Pointer to the packet data + * + * @see odp_packet_data(), odp_packet_seg_len() + */ +void *odp_packet_data_seg_len(odp_packet_t pkt, uint32_t *seg_len); + /** * Packet data length *
commit 5c41d868e5cceb3e4fa29ad37c73ef6477132284 Author: Petri Savolainen petri.savolainen@linaro.org Date: Thu Feb 22 09:44:30 2018 +0200
api: packet: improve segmented packet documentation
Improve documentation text to be more explicit that packets may be segmented.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Balasubramanian Manoharan bala.manoharan@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 079a1ae1..746f6fbf 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -401,30 +401,39 @@ uint32_t odp_packet_buf_len(odp_packet_t pkt); /** * Packet data pointer * - * Returns the current packet data pointer. When a packet is received - * from packet input, this points to the first byte of the received - * packet. Packet level offsets are calculated relative to this position. + * Returns pointer to the first byte of packet data. When packet is segmented, + * only a portion of packet data follows the pointer. When unsure, use e.g. + * odp_packet_seg_len() to check the data length following the pointer. Packet + * level offsets are calculated relative to this position. * - * User can adjust the data pointer with head_push/head_pull (does not modify - * segmentation) and add_data/rem_data calls (may modify segmentation). + * When a packet is received from packet input, this points to the first byte + * of the received packet. Pool configuration parameters may be used to ensure + * that the first packet segment contains all/most of the data relevant to the + * application. + * + * User can adjust the data pointer with e.g. push_head/pull_head (does not + * modify segmentation) and extend_head/trunc_head (may modify segmentation) + * calls. * * @param pkt Packet handle * * @return Pointer to the packet data * - * @see odp_packet_l2_ptr(), odp_packet_seg_len() + * @see odp_packet_seg_len(), odp_packet_push_head(), odp_packet_extend_head() */ void *odp_packet_data(odp_packet_t pkt);
/** - * Packet segment data length + * Packet data length following the data pointer * - * Returns number of data bytes following the current data pointer - * (odp_packet_data()) location in the segment. + * Returns number of data bytes (in the segment) following the current data + * pointer position. When unsure, use this function to check how many bytes + * can be accessed linearly after data pointer (odp_packet_data()). This + * equals to odp_packet_len() for single segment packets. * * @param pkt Packet handle * - * @return Segment data length in bytes (pointed by odp_packet_data()) + * @return Segment data length in bytes following odp_packet_data() * * @see odp_packet_data() */ @@ -433,11 +442,14 @@ uint32_t odp_packet_seg_len(odp_packet_t pkt); /** * Packet data length * - * Returns sum of data lengths over all packet segments. + * Returns total data length over all packet segments. This equals the sum of + * segment level data lengths (odp_packet_seg_data_len()). * * @param pkt Packet handle * * @return Packet data length + * + * @see odp_packet_seg_len(), odp_packet_data(), odp_packet_seg_data_len() */ uint32_t odp_packet_len(odp_packet_t pkt);
-----------------------------------------------------------------------
Summary of changes: include/odp/api/spec/packet.h | 50 +++++++++++++++++----- .../include/odp/api/plat/packet_inlines.h | 7 +++ .../include/odp/api/plat/packet_inlines_api.h | 5 +++ test/validation/api/packet/packet.c | 8 +++- 4 files changed, 58 insertions(+), 12 deletions(-)
hooks/post-receive