diff mbox series

[v7,16/17] app/testpmd: fix build with musl

Message ID 20210319145730.3555384-17-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series Alpine/musl build support | expand


Context Check Description
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon March 19, 2021, 2:57 p.m. UTC
From: Natanael Copa <ncopa@alpinelinux.org>

1/ Improve portability by avoiding use of non-standard 'uint'.
Use uint8_t for hash_key_len as rss_key_len is a uint8_t type.
This solves following build error when building with musl libc:
    app/test-pmd/testpmd.h:813:29: error: unknown type name 'uint'

2/ In musl libc, stdout is of type (FILE * const).
Because of the const qualifier, a dark magic cast
must be achieved through uintptr_t.

Fixes: 8205e241b2b0 ("app/testpmd: add missing type to RSS hash commands")
Fixes: e977e4199a8d ("app/testpmd: add commands to load/unload BPF filters")
Cc: stable@dpdk.org

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
 app/test-pmd/bpf_cmd.c | 2 +-
 app/test-pmd/config.c  | 2 +-
 app/test-pmd/testpmd.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series


diff --git a/app/test-pmd/bpf_cmd.c b/app/test-pmd/bpf_cmd.c
index 066619e115..6980291f07 100644
--- a/app/test-pmd/bpf_cmd.c
+++ b/app/test-pmd/bpf_cmd.c
@@ -20,7 +20,7 @@  static const struct rte_bpf_xsym bpf_xsym[] = {
 		.name = RTE_STR(stdout),
 		.type = RTE_BPF_XTYPE_VAR,
 		.var = {
-			.val = &stdout,
+			.val = (void *)(uintptr_t)&stdout,
 			.desc = {
 				.type = RTE_BPF_ARG_PTR,
 				.size = sizeof(stdout),
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 576d5acab5..e865de10a4 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2674,7 +2674,7 @@  port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
 port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key,
-			 uint hash_key_len)
+			 uint8_t hash_key_len)
 	struct rte_eth_rss_conf rss_conf;
 	int diag;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index af40859170..a87ccb0f0f 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -936,7 +936,7 @@  int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
 void port_rss_hash_conf_show(portid_t port_id, int show_rss_key);
 void port_rss_hash_key_update(portid_t port_id, char rss_type[],
-			      uint8_t *hash_key, uint hash_key_len);
+			      uint8_t *hash_key, uint8_t hash_key_len);
 int rx_queue_id_is_invalid(queueid_t rxq_id);
 int tx_queue_id_is_invalid(queueid_t txq_id);
 void setup_gro(const char *onoff, portid_t port_id);