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>
  • Loading branch information
ashwinyes committed Sep 6, 2023
1 parent a2085dd commit 47c7764
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/validation/api/pool/pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2050,9 +2050,15 @@ static void test_packet_pool_ext_uarea_init(void)
CU_ASSERT(data.count == num);

for (i = 0; i < num; i++) {
uint32_t max_payload;

CU_ASSERT(data.mark[i] == 1);

pkts[i] = odp_packet_alloc(pool, (param.pkt.buf_size - param.pkt.headroom) / 2);
max_payload = param.pkt.buf_size;
max_payload -= capa.pkt.odp_header_size + param.pkt.app_header_size;
max_payload -= capa.pkt.odp_trailer_size;
max_payload -= capa.pkt.max_headroom_size;
pkts[i] = odp_packet_alloc(pool, max_payload);

CU_ASSERT(pkts[i] != ODP_PACKET_INVALID);

Expand Down

0 comments on commit 47c7764

Please sign in to comment.