Skip to content

Commit

Permalink
validation: pool: fix uarea init test for external pools
Browse files Browse the repository at this point in the history
The max payload of single segmented packets in external
pools depends on the odp_header_size, app_header_size,
max_headroom_size and odp_trailer_size.

Take all these into consideration when doing packet alloc
from external pools so that allocations don't fail.

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
  • Loading branch information
ashwinyes committed Sep 14, 2023
1 parent a2085dd commit 88e2baf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/validation/api/pool/pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2023,6 +2023,7 @@ static void test_packet_pool_ext_uarea_init(void)
odp_pool_ext_capability_t capa;
odp_pool_ext_param_t param;
uint32_t num = ELEM_NUM, i;
uint32_t max_payload;
odp_pool_t pool;
uarea_init_t data;
odp_shm_t shm;
Expand All @@ -2049,10 +2050,14 @@ static void test_packet_pool_ext_uarea_init(void)
CU_ASSERT_FATAL(shm != ODP_SHM_INVALID);
CU_ASSERT(data.count == num);

max_payload = param.pkt.buf_size;
max_payload -= capa.pkt.odp_header_size + param.pkt.app_header_size;
max_payload -= capa.pkt.max_headroom_size;
max_payload -= capa.pkt.odp_trailer_size;
for (i = 0; i < num; i++) {
CU_ASSERT(data.mark[i] == 1);

pkts[i] = odp_packet_alloc(pool, (param.pkt.buf_size - param.pkt.headroom) / 2);
pkts[i] = odp_packet_alloc(pool, max_payload);

CU_ASSERT(pkts[i] != ODP_PACKET_INVALID);

Expand Down

0 comments on commit 88e2baf

Please sign in to comment.