misc: make format_hexdump length u32

format_hexdump currently requires the length parameter to be uword
(64-bits) hence all callers must make sure to cast the length to uword.
Use u32 instead to benefit from C automatic integer promotion: any
length smaller or equal to u32 will be promoted to int fitting in u32).
Only callers using a length of u64 needs to downcast.
It also makes it similar to other variants.

Type: fix

Change-Id: I09b52fdde3970cec0be4150a29126ff63106c75b
Signed-off-by: Benoît Ganne <bganne@cisco.com>
This commit is contained in:
Benoît Ganne
2023-04-17 14:50:00 +02:00
committed by Damjan Marion
parent 24d7e72aa5
commit 00c37199d7
2 changed files with 3 additions and 4 deletions
src
plugins/rdma
vppinfra

@ -292,9 +292,8 @@ format_rdma_rxq (u8 * s, va_list * args)
next_cqe_index);
s = format (s, "\n%U%U", format_white_space, indent + 6,
format_mlx5_cqe_rx, rxq->cqes + next_cqe_index);
s = format (s, "\n%U%U", format_white_space, indent + 6,
format_hexdump, rxq->cqes + next_cqe_index,
sizeof (mlx5dv_cqe_t));
s = format (s, "\n%U%U", format_white_space, indent + 6, format_hexdump,
rxq->cqes + next_cqe_index, (u32) sizeof (mlx5dv_cqe_t));
}
return s;

@ -414,7 +414,7 @@ __clib_export u8 *
format_hexdump (u8 * s, va_list * args)
{
u8 *data = va_arg (*args, u8 *);
uword len = va_arg (*args, uword);
u32 len = va_arg (*args, u32);
int i, index = 0;
const int line_len = 16;
u8 *line_hex = 0;