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, master has been updated via c9f7b34c7f0a4cadfabbd6733e3420a8adb8c322 (commit) via 3125f0621c170b5bd3b5f4e48d2c90c7d3d438b2 (commit) via a072a42095fdd2d7b85343007e34bc424bcf5032 (commit) via f6cb2b6f9cd9c0218ec564f75a0cda543a4477ba (commit) via 4de501a5867b93394215b44d3df0e5488c256199 (commit) via b3812d61817aadb18f989fa864481dec53d4570e (commit) via 2e19fc517ec1c1c72d995d1a9c8abc56335e45c2 (commit) from 29c9a342c4cbc4cc92686e6f324fe258afae6b9a (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 c9f7b34c7f0a4cadfabbd6733e3420a8adb8c322 Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon Jan 20 15:30:38 2020 +0200
api: increase version number to 1.23.3
Incremented minor version number to reflect packet length clarifications and addition of packet pool align parameter.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/configure.ac b/configure.ac index c715e4358..82e197956 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_PREREQ([2.5]) ########################################################################## m4_define([odpapi_generation_version], [1]) m4_define([odpapi_major_version], [23]) -m4_define([odpapi_minor_version], [2]) +m4_define([odpapi_minor_version], [3]) m4_define([odpapi_point_version], [0]) m4_define([odpapi_version], [odpapi_generation_version.odpapi_major_version.odpapi_minor_version.odpapi_point_version])
commit 3125f0621c170b5bd3b5f4e48d2c90c7d3d438b2 Author: Petri Savolainen petri.savolainen@nokia.com Date: Fri Jan 10 14:06:35 2020 +0200
validation: packet: add packet alloc align test
Added test case for the new packet align parameter.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 90226819c..6f020d820 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -544,6 +544,57 @@ static void packet_test_alloc_segmented(void) CU_ASSERT(odp_pool_destroy(pool) == 0); }
+static void packet_test_alloc_align(void) +{ + odp_pool_t pool; + odp_pool_param_t params; + uintptr_t data, mask; + uint32_t i; + uint32_t error_print = 10; + uint32_t len = packet_len; + uint32_t align = 256; + uint32_t num = 100; + odp_packet_t pkt[num]; + + CU_ASSERT(pool_capa.pkt.max_align >= 2); + + if (align > pool_capa.pkt.max_align) + align = pool_capa.pkt.max_align; + + mask = align - 1; + + odp_pool_param_init(¶ms); + + params.type = ODP_POOL_PACKET; + params.pkt.len = len; + params.pkt.num = num; + params.pkt.align = align; + + pool = odp_pool_create("packet_pool_align", ¶ms); + CU_ASSERT_FATAL(pool != ODP_POOL_INVALID); + + /* Allocate the only buffer from the pool */ + for (i = 0; i < num; i++) { + pkt[i] = odp_packet_alloc(pool, len); + CU_ASSERT_FATAL(pkt[i] != ODP_PACKET_INVALID); + CU_ASSERT(odp_packet_len(pkt[i]) == len); + data = (uintptr_t)odp_packet_data(pkt[i]); + + if (data & mask) { + /* Print only first couple of failures to the log */ + if (error_print > 0) { + CU_ASSERT((data & mask) == 0); + printf("\nError: Bad data align. Pointer %p, requested align %u\n", + (void *)data, align); + error_print--; + } + } + } + + odp_packet_free_multi(pkt, num); + CU_ASSERT(odp_pool_destroy(pool) == 0); +} + static void packet_test_event_conversion(void) { odp_packet_t pkt0 = test_packet; @@ -3530,6 +3581,7 @@ odp_testinfo_t packet_suite[] = { ODP_TEST_INFO(packet_test_alloc_free_multi), ODP_TEST_INFO(packet_test_free_sp), ODP_TEST_INFO(packet_test_alloc_segmented), + ODP_TEST_INFO(packet_test_alloc_align), ODP_TEST_INFO(packet_test_basic_metadata), ODP_TEST_INFO(packet_test_debug), ODP_TEST_INFO(packet_test_segments),
commit a072a42095fdd2d7b85343007e34bc424bcf5032 Author: Petri Savolainen petri.savolainen@nokia.com Date: Fri Jan 10 13:39:38 2020 +0200
linux-gen: pool: set packet pool max align capa
Implement the new packet align pool parameter with minimal changes. Packet pools are aligned always to the base align, so all application requests up to that value are supported. Base align can be changed through the config file.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/config/odp-linux-generic.conf b/config/odp-linux-generic.conf index 5a3ca72ff..b1f0e9009 100644 --- a/config/odp-linux-generic.conf +++ b/config/odp-linux-generic.conf @@ -62,7 +62,8 @@ pool: { max_num = 262143
# Base alignment for segment data. When set to zero, - # cache line size is used. Use power of two values. + # cache line size is used. Use power of two values. This is + # also the maximum value for the packet pool alignment param. base_align = 0 }
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 5d5217aaf..e1964f840 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -503,6 +503,15 @@ static odp_pool_t pool_create(const char *name, odp_pool_param_t *params, align = 0;
if (params->type == ODP_POOL_PACKET) { + uint32_t align_req = params->pkt.align; + + if (align_req && + (!CHECK_IS_POWER2(align_req) || + align_req > _odp_pool_glb->config.pkt_base_align)) { + ODP_ERR("Bad align requirement\n"); + return ODP_POOL_INVALID; + } + align = _odp_pool_glb->config.pkt_base_align; } else { if (params->type == ODP_POOL_BUFFER) @@ -1106,6 +1115,7 @@ int odp_pool_capability(odp_pool_capability_t *capa) capa->pkt.max_pools = max_pools; capa->pkt.max_len = CONFIG_PACKET_MAX_LEN; capa->pkt.max_num = _odp_pool_glb->config.pkt_max_num; + capa->pkt.max_align = _odp_pool_glb->config.pkt_base_align; capa->pkt.min_headroom = CONFIG_PACKET_HEADROOM; capa->pkt.max_headroom = CONFIG_PACKET_HEADROOM; capa->pkt.min_tailroom = CONFIG_PACKET_TAILROOM;
commit f6cb2b6f9cd9c0218ec564f75a0cda543a4477ba Author: Petri Savolainen petri.savolainen@nokia.com Date: Fri Jan 10 10:56:22 2020 +0200
api: pool: add packet data align parameter
Added packet pool parameter to request minimum data alignment for user allocated packets. When user allocates a new packet and fills in protocol headers, it's convenient that data alignment does not need to be checked (and tuned) on each allocated packet.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h index 69e99605c..754e2cc04 100644 --- a/include/odp/api/spec/pool.h +++ b/include/odp/api/spec/pool.h @@ -92,6 +92,12 @@ typedef struct odp_pool_capability_t { * memory size for the pool. */ uint32_t max_num;
+ /** Maximum packet data alignment in bytes + * + * This is the maximum value of packet pool alignment + * (pkt.align) parameter. */ + uint32_t max_align; + /** Minimum packet level headroom length in bytes * * The minimum number of headroom bytes that newly created @@ -248,6 +254,19 @@ typedef struct odp_pool_param_t { */ uint32_t max_len;
+ /** Minimum packet data alignment in bytes. + * + * Valid values are powers of two. User allocated packets have + * start of data (@see odp_packet_data()) aligned to this or + * a higher alignment (power of two value). This parameter + * does not apply to packets that ODP allocates internally + * (e.g. packets from packet input). + * + * The maximum value is defined by pool capability + * pkt.max_align. Use 0 for default alignment. + */ + uint32_t align; + /** Minimum number of packet data bytes that are stored in the * first segment of a packet. The maximum value is defined by * pool capability pkt.max_seg_len. Use 0 for default.
commit 4de501a5867b93394215b44d3df0e5488c256199 Author: Matias Elo matias.elo@nokia.com Date: Tue Jan 14 17:00:56 2020 +0200
linux-gen: packet: don't allow creating zero length packets
Packet API forbids creating zero length packets.
Signed-off-by: Matias Elo matias.elo@nokia.com Reported-by: Carl Wallen carl.wallen@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 9e3f3a2b8..430839be6 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -686,7 +686,7 @@ odp_packet_t odp_packet_alloc(odp_pool_t pool_hdl, uint32_t len) return ODP_PACKET_INVALID; }
- if (odp_unlikely(len > pool->max_len)) + if (odp_unlikely(len > pool->max_len || len == 0)) return ODP_PACKET_INVALID;
num_seg = num_segments(len, pool->seg_len); @@ -709,7 +709,7 @@ int odp_packet_alloc_multi(odp_pool_t pool_hdl, uint32_t len, return -1; }
- if (odp_unlikely(len > pool->max_len)) + if (odp_unlikely(len > pool->max_len || len == 0)) return -1;
num_seg = num_segments(len, pool->seg_len); @@ -771,7 +771,7 @@ int odp_packet_reset(odp_packet_t pkt, uint32_t len) int num = pkt_hdr->seg_count; int num_req;
- if (odp_unlikely(len > (pool->seg_len * num))) + if (odp_unlikely(len > (pool->seg_len * num)) || len == 0) return -1;
/* Free possible extra segments */ @@ -887,7 +887,7 @@ void *odp_packet_pull_head(odp_packet_t pkt, uint32_t len) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
- if (len > pkt_hdr->frame_len) + if (len >= pkt_hdr->seg_len) return NULL;
pull_head(pkt_hdr, len); @@ -900,7 +900,7 @@ int odp_packet_trunc_head(odp_packet_t *pkt, uint32_t len, odp_packet_hdr_t *pkt_hdr = packet_hdr(*pkt); uint32_t seg_len = packet_first_seg_len(pkt_hdr);
- if (len > pkt_hdr->frame_len) + if (len >= pkt_hdr->frame_len) return -1;
if (len < seg_len) { @@ -993,7 +993,7 @@ void *odp_packet_pull_tail(odp_packet_t pkt, uint32_t len)
ODP_ASSERT(odp_packet_has_ref(pkt) == 0);
- if (len > last_seg->seg_len) + if (len >= last_seg->seg_len) return NULL;
pull_tail(pkt_hdr, len); @@ -1009,7 +1009,7 @@ int odp_packet_trunc_tail(odp_packet_t *pkt, uint32_t len, odp_packet_hdr_t *last_seg; odp_packet_hdr_t *pkt_hdr = packet_hdr(*pkt);
- if (len > pkt_hdr->frame_len) + if (len >= pkt_hdr->frame_len) return -1;
ODP_ASSERT(odp_packet_has_ref(*pkt) == 0); @@ -1234,7 +1234,7 @@ int odp_packet_rem_data(odp_packet_t *pkt_ptr, uint32_t offset, uint32_t len) pool_t *pool = pkt_hdr->buf_hdr.pool_ptr; odp_packet_t newpkt;
- if (offset > pktlen || offset + len > pktlen) + if (offset + len >= pktlen) return -1;
newpkt = odp_packet_alloc(pool->pool_hdl, pktlen - len);
commit b3812d61817aadb18f989fa864481dec53d4570e Author: Matias Elo matias.elo@nokia.com Date: Wed Jan 15 16:52:07 2020 +0200
validation: ipsec: don't allocate zero length test packet
Allocating packets of length zero is not allowed by the packet API.
Also, fix some typos and abort tests after a failed test packet allocation to prevent a seg fault.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index 705fbbabf..5b60fd888 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -429,7 +429,7 @@ odp_packet_t ipsec_packet(const ipsec_test_packet *itp) { odp_packet_t pkt = odp_packet_alloc(suite_context.pool, itp->len);
- CU_ASSERT_NOT_EQUAL(ODP_PACKET_INVALID, pkt); + CU_ASSERT_NOT_EQUAL_FATAL(ODP_PACKET_INVALID, pkt); if (ODP_PACKET_INVALID == pkt) return pkt;
diff --git a/test/validation/api/ipsec/ipsec_test_out.c b/test/validation/api/ipsec/ipsec_test_out.c index 0bfb9cff8..6cdbb72f4 100644 --- a/test/validation/api/ipsec/ipsec_test_out.c +++ b/test/validation/api/ipsec/ipsec_test_out.c @@ -1036,7 +1036,7 @@ static void test_out_dummy_esp_null_sha256_tun_ipv4(void) test.out[0].l3_type = ODP_PROTO_L3_TYPE_IPV4; test.out[0].l4_type = ODP_PROTO_L4_TYPE_NO_NEXT;
- test_empty.pkt_in = &pkt_test_emtpy; + test_empty.pkt_in = &pkt_test_empty; test_empty.num_opt = 1; test_empty.opt.flag.tfc_dummy = 1; test_empty.opt.tfc_pad_len = 16; @@ -1110,7 +1110,7 @@ static void test_out_dummy_esp_null_sha256_tun_ipv6(void) test.out[0].l3_type = ODP_PROTO_L3_TYPE_IPV4; test.out[0].l4_type = ODP_PROTO_L4_TYPE_NO_NEXT;
- test_empty.pkt_in = &pkt_test_emtpy; + test_empty.pkt_in = &pkt_test_empty; test_empty.num_opt = 1; test_empty.opt.flag.tfc_dummy = 1; test_empty.opt.tfc_pad_len = 16; diff --git a/test/validation/api/ipsec/test_vectors.h b/test/validation/api/ipsec/test_vectors.h index 289b8008c..e9b8634f2 100644 --- a/test/validation/api/ipsec/test_vectors.h +++ b/test/validation/api/ipsec/test_vectors.h @@ -1865,8 +1865,8 @@ static const ODP_UNUSED ipsec_test_packet }, };
-static const ipsec_test_packet pkt_test_emtpy = { - .len = 0, +static const ipsec_test_packet pkt_test_empty = { + .len = 1, .l2_offset = ODP_PACKET_OFFSET_INVALID, .l3_offset = ODP_PACKET_OFFSET_INVALID, .l4_offset = ODP_PACKET_OFFSET_INVALID,
commit 2e19fc517ec1c1c72d995d1a9c8abc56335e45c2 Author: Matias Elo matias.elo@nokia.com Date: Wed Jan 15 12:16:12 2020 +0200
api: packet: clarify packet length function argument definitions
Modify documentations of functions, which decrease packet length, to clearly state what are the allowed values for length argument. This is done to avoid creating zero length packets which are not allowed by the packet API.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-by: Stanislaw Kardach skardach@marvell.com
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index cbc3c2cbd..ec20371b2 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -318,11 +318,10 @@ void odp_packet_free_sp(const odp_packet_t pkt[], int num); * * Resets all packet metadata to their default values. Packet length is used * to initialize pointers and lengths. It must be less than the total buffer - * length of the packet minus the default headroom length. Packet is not - * modified on failure. + * length of the packet. Packet is not modified on failure. * * @param pkt Packet handle - * @param len Packet data length + * @param len Packet data length (1 ... odp_packet_buf_len()) * * @retval 0 on success * @retval <0 on failure @@ -724,7 +723,8 @@ int odp_packet_extend_head(odp_packet_t *pkt, uint32_t len, void **data_ptr, * * @param[in, out] pkt Pointer to packet handle. A successful operation outputs * the new packet handle. - * @param len Number of bytes to truncate the head (0 ... packet_len) + * @param len Number of bytes to truncate the head + * (0 ... packet_len - 1) * @param[out] data_ptr Pointer to output the new data pointer. * Ignored when NULL. * @param[out] seg_len Pointer to output segment length at 'data_ptr' above. @@ -797,7 +797,8 @@ int odp_packet_extend_tail(odp_packet_t *pkt, uint32_t len, void **data_ptr, * * @param[in, out] pkt Pointer to packet handle. A successful operation outputs * the new packet handle. - * @param len Number of bytes to truncate the tail (0 ... packet_len) + * @param len Number of bytes to truncate the tail + * (0 ... packet_len - 1) * @param[out] tail_ptr Pointer to output the new tail pointer. * Ignored when NULL. * @param[out] tailroom Pointer to output the new tailroom. Ignored when NULL. @@ -861,7 +862,9 @@ int odp_packet_add_data(odp_packet_t *pkt, uint32_t offset, uint32_t len); * @param[in, out] pkt Pointer to packet handle. A successful operation outputs * the new packet handle. * @param offset Byte offset into the packet - * @param len Number of bytes to remove from the offset + * @param len Number of bytes to remove from the offset. When offset + * is zero: 0 ... packet_len - 1 bytes, otherwise + * 0 ... packet_len - offset bytes. * * @retval 0 Operation successful, old pointers remain valid * @retval >0 Operation successful, old pointers need to be updated @@ -1064,6 +1067,7 @@ int odp_packet_concat(odp_packet_t *dst, odp_packet_t src); * @param[in, out] pkt Pointer to packet handle. A successful operation * outputs a new packet handle for the head packet. * @param len Data length remaining in the head packet + * (1 ... packet_len - 1) * @param tail Pointer to output the tail packet handle * * @retval 0 Operation successful, old pointers remain valid
-----------------------------------------------------------------------
Summary of changes: config/odp-linux-generic.conf | 3 +- configure.ac | 2 +- include/odp/api/spec/packet.h | 16 +++++---- include/odp/api/spec/pool.h | 19 +++++++++++ platform/linux-generic/odp_packet.c | 16 ++++----- platform/linux-generic/odp_pool.c | 10 ++++++ test/validation/api/ipsec/ipsec.c | 2 +- test/validation/api/ipsec/ipsec_test_out.c | 4 +-- test/validation/api/ipsec/test_vectors.h | 4 +-- test/validation/api/packet/packet.c | 52 ++++++++++++++++++++++++++++++ 10 files changed, 107 insertions(+), 21 deletions(-)
hooks/post-receive