DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Xiaoyun Li <xiaoyun.li@intel.com>, Ori Kam <orika@nvidia.com>
Cc: dev@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	Aman Deep Singh <aman.deep.singh@intel.com>
Subject: [dpdk-dev] [PATCH v2] app/testpmd: send failure logs to stderr
Date: Wed, 16 Jun 2021 19:32:09 +0300	[thread overview]
Message-ID: <20210616163209.823918-1-andrew.rybchenko@oktetlabs.ru> (raw)
In-Reply-To: <20210527162452.1568351-1-andrew.rybchenko@oktetlabs.ru>

Running with stdout suppressed or redirected for further processing
is very confusing in the case of errors. Fix it by logging errors and
warnings to stderr.

Since lines with log messages are touched anyway concatanate split
format string to make it easier to search using grep.

Fix indent of format string arguments.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
v2:
 - switch from printf() to fpritnf(stderr, ...) in more cases
 - do not inherit acks from the previous version since the patch is
   much bigger
 - fix style in few cases (TAB vs spaces, missing space separtor etc)
 - still don't use TESTPMD_LOG() since the patch does not add new logs.
   Also switching to TESTPMD_LOG() will add "testpmd: " prefix to log
   messages and it is a real change and could be a pain for automation.

 app/test-pmd/bpf_cmd.c                 |   6 +-
 app/test-pmd/cmdline.c                 | 957 ++++++++++++++-----------
 app/test-pmd/cmdline_flow.c            |  20 +-
 app/test-pmd/cmdline_mtr.c             |   8 +-
 app/test-pmd/cmdline_tm.c              |  33 +-
 app/test-pmd/config.c                  | 452 ++++++------
 app/test-pmd/csumonly.c                |   5 +-
 app/test-pmd/parameters.c              |  21 +-
 app/test-pmd/testpmd.c                 | 298 ++++----
 app/test-pmd/util.c                    |  19 +-
 doc/guides/rel_notes/release_21_08.rst |   5 +
 11 files changed, 1002 insertions(+), 822 deletions(-)

diff --git a/app/test-pmd/bpf_cmd.c b/app/test-pmd/bpf_cmd.c
index 6980291f07..09c8aec0c0 100644
--- a/app/test-pmd/bpf_cmd.c
+++ b/app/test-pmd/bpf_cmd.c
@@ -82,7 +82,7 @@ bpf_parse_flags(const char *str, struct rte_bpf_arg *arg, uint32_t *flags)
 		} else if (v == '-')
 			continue;
 		else
-			printf("unknown flag: \'%c\'", v);
+			fprintf(stderr, "unknown flag: \'%c\'", v);
 	}
 }
 
@@ -114,7 +114,7 @@ static void cmd_operate_bpf_ld_parsed(void *parsed_result,
 			fname, sname, flags);
 		printf("%d:%s\n", rc, strerror(-rc));
 	} else
-		printf("invalid value: %s\n", res->dir);
+		fprintf(stderr, "invalid value: %s\n", res->dir);
 }
 
 cmdline_parse_token_string_t cmd_load_bpf_start =
@@ -170,7 +170,7 @@ static void cmd_operate_bpf_unld_parsed(void *parsed_result,
 	else if (strcmp(res->dir, "tx") == 0)
 		rte_bpf_eth_tx_unload(res->port, res->queue);
 	else
-		printf("invalid value: %s\n", res->dir);
+		fprintf(stderr, "invalid value: %s\n", res->dir);
 }
 
 cmdline_parse_token_string_t cmd_unload_bpf_start =
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0268b18f95..ea0b43798e 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1226,7 +1226,7 @@ static void cmd_operate_port_parsed(void *parsed_result,
 	else if (!strcmp(res->name, "reset"))
 		reset_port(RTE_PORT_ALL);
 	else
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 }
 
 cmdline_parse_token_string_t cmd_operate_port_all_cmd =
@@ -1272,7 +1272,7 @@ static void cmd_operate_specific_port_parsed(void *parsed_result,
 	else if (!strcmp(res->name, "reset"))
 		reset_port(res->value);
 	else
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 }
 
 cmdline_parse_token_string_t cmd_operate_specific_port_cmd =
@@ -1317,7 +1317,7 @@ static void cmd_set_port_setup_on_parsed(void *parsed_result,
 	else if (strcmp(res->mode, "iterator") == 0)
 		setup_on_probe_event = false;
 	else
-		printf("Unknown mode\n");
+		fprintf(stderr, "Unknown mode\n");
 }
 
 cmdline_parse_token_string_t cmd_set_port_setup_on_set =
@@ -1366,7 +1366,7 @@ static void cmd_operate_attach_port_parsed(void *parsed_result,
 	if (!strcmp(res->keyword, "attach"))
 		attach_port(res->identifier);
 	else
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 }
 
 cmdline_parse_token_string_t cmd_operate_attach_port_port =
@@ -1409,7 +1409,7 @@ static void cmd_operate_detach_port_parsed(void *parsed_result,
 		RTE_ETH_VALID_PORTID_OR_RET(res->port_id);
 		detach_port_device(res->port_id);
 	} else {
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 	}
 }
 
@@ -1451,7 +1451,7 @@ static void cmd_operate_detach_device_parsed(void *parsed_result,
 	if (!strcmp(res->keyword, "detach"))
 		detach_devargs(res->identifier);
 	else
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 }
 
 cmdline_parse_token_string_t cmd_operate_detach_device_device =
@@ -1500,7 +1500,7 @@ parse_and_check_speed_duplex(char *speedstr, char *duplexstr, uint32_t *speed)
 	} else if (!strcmp(duplexstr, "auto")) {
 		duplex = ETH_LINK_FULL_DUPLEX;
 	} else {
-		printf("Unknown duplex parameter\n");
+		fprintf(stderr, "Unknown duplex parameter\n");
 		return -1;
 	}
 
@@ -1512,7 +1512,7 @@ parse_and_check_speed_duplex(char *speedstr, char *duplexstr, uint32_t *speed)
 				ETH_LINK_SPEED_100M_HD : ETH_LINK_SPEED_100M;
 	} else {
 		if (duplex != ETH_LINK_FULL_DUPLEX) {
-			printf("Invalid speed/duplex parameters\n");
+			fprintf(stderr, "Invalid speed/duplex parameters\n");
 			return -1;
 		}
 		if (!strcmp(speedstr, "1000")) {
@@ -1532,7 +1532,7 @@ parse_and_check_speed_duplex(char *speedstr, char *duplexstr, uint32_t *speed)
 		} else if (!strcmp(speedstr, "auto")) {
 			*speed = ETH_LINK_SPEED_AUTONEG;
 		} else {
-			printf("Unknown speed parameter\n");
+			fprintf(stderr, "Unknown speed parameter\n");
 			return -1;
 		}
 	}
@@ -1553,7 +1553,7 @@ cmd_config_speed_all_parsed(void *parsed_result,
 	portid_t pid;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
@@ -1624,7 +1624,7 @@ cmd_config_speed_specific_parsed(void *parsed_result,
 	uint32_t link_speed;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
@@ -1698,7 +1698,7 @@ cmd_config_loopback_all_parsed(void *parsed_result,
 	portid_t pid;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
@@ -1756,7 +1756,7 @@ cmd_config_loopback_specific_parsed(void *parsed_result,
 		return;
 
 	if (!port_is_stopped(res->port_id)) {
-		printf("Please stop port %u first\n", res->port_id);
+		fprintf(stderr, "Please stop port %u first\n", res->port_id);
 		return;
 	}
 
@@ -1813,12 +1813,12 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 	struct cmd_config_rx_tx *res = parsed_result;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 	if (!strcmp(res->name, "rxq")) {
 		if (!res->value && !nb_txq) {
-			printf("Warning: Either rx or tx queues should be non zero\n");
+			fprintf(stderr, "Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
 		if (check_nb_rxq(res->value) != 0)
@@ -1827,7 +1827,7 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 	}
 	else if (!strcmp(res->name, "txq")) {
 		if (!res->value && !nb_rxq) {
-			printf("Warning: Either rx or tx queues should be non zero\n");
+			fprintf(stderr, "Warning: Either rx or tx queues should be non zero\n");
 			return;
 		}
 		if (check_nb_txq(res->value) != 0)
@@ -1844,7 +1844,7 @@ cmd_config_rx_tx_parsed(void *parsed_result,
 
 		nb_txd = res->value;
 	} else {
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 		return;
 	}
 
@@ -1901,7 +1901,7 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
 	int ret;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
@@ -1910,8 +1910,9 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
 
 		if (!strcmp(res->name, "max-pkt-len")) {
 			if (res->value < RTE_ETHER_MIN_LEN) {
-				printf("max-pkt-len can not be less than %d\n",
-						RTE_ETHER_MIN_LEN);
+				fprintf(stderr,
+					"max-pkt-len can not be less than %d\n",
+					RTE_ETHER_MIN_LEN);
 				return;
 			}
 			if (res->value == port->dev_conf.rxmode.max_rx_pkt_len)
@@ -1919,7 +1920,8 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
 
 			ret = eth_dev_info_get_print_err(pid, &port->dev_info);
 			if (ret != 0) {
-				printf("rte_eth_dev_info_get() failed for port %u\n",
+				fprintf(stderr,
+					"rte_eth_dev_info_get() failed for port %u\n",
 					pid);
 				return;
 			}
@@ -1930,7 +1932,7 @@ cmd_config_max_pkt_len_parsed(void *parsed_result,
 			if (update_jumbo_frame_offload(pid) != 0)
 				port->dev_conf.rxmode.max_rx_pkt_len = max_rx_pkt_len_backup;
 		} else {
-			printf("Unknown parameter\n");
+			fprintf(stderr, "Unknown parameter\n");
 			return;
 		}
 	}
@@ -1988,7 +1990,7 @@ cmd_config_max_lro_pkt_size_parsed(void *parsed_result,
 	portid_t pid;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
@@ -2002,7 +2004,7 @@ cmd_config_max_lro_pkt_size_parsed(void *parsed_result,
 
 			port->dev_conf.rxmode.max_lro_pkt_size = res->value;
 		} else {
-			printf("Unknown parameter\n");
+			fprintf(stderr, "Unknown parameter\n");
 			return;
 		}
 	}
@@ -2059,7 +2061,7 @@ cmd_config_mtu_parsed(void *parsed_result,
 	struct cmd_config_mtu_result *res = parsed_result;
 
 	if (res->value < RTE_ETHER_MIN_LEN) {
-		printf("mtu cannot be less than %d\n", RTE_ETHER_MIN_LEN);
+		fprintf(stderr, "mtu cannot be less than %d\n", RTE_ETHER_MIN_LEN);
 		return;
 	}
 	port_mtu_set(res->port_id, res->value);
@@ -2112,7 +2114,7 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result,
 	struct cmd_config_rx_mode_flag *res = parsed_result;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
@@ -2122,11 +2124,11 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result,
 		else if (!strcmp(res->value, "off"))
 			rx_drop_en = 0;
 		else {
-			printf("Unknown parameter\n");
+			fprintf(stderr, "Unknown parameter\n");
 			return;
 		}
 	} else {
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 		return;
 	}
 
@@ -2271,7 +2273,7 @@ cmd_config_rss_parsed(void *parsed_result,
 						atoi(res->value) < 64)
 		rss_conf.rss_hf = 1ULL << atoi(res->value);
 	else {
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 		return;
 	}
 	rss_conf.rss_key = NULL;
@@ -2297,8 +2299,8 @@ cmd_config_rss_parsed(void *parsed_result,
 		diag = rte_eth_dev_rss_hash_update(i, &local_rss_conf);
 		if (diag < 0) {
 			all_updated = 0;
-			printf("Configuration of RSS hash at ethernet port %d "
-				"failed with error (%d): %s.\n",
+			fprintf(stderr,
+				"Configuration of RSS hash at ethernet port %d failed with error (%d): %s.\n",
 				i, -diag, strerror(-diag));
 		}
 	}
@@ -2366,8 +2368,9 @@ parse_and_check_key_hexa_digit(char *key, int idx)
 
 	hexa_v = hexa_digit_to_value(key[idx]);
 	if (hexa_v == 0xFF)
-		printf("invalid key: character %c at position %d is not a "
-		       "valid hexa digit\n", key[idx], idx);
+		fprintf(stderr,
+			"invalid key: character %c at position %d is not a valid hexa digit\n",
+			key[idx], idx);
 	return hexa_v;
 }
 
@@ -2394,15 +2397,16 @@ cmd_config_rss_hash_key_parsed(void *parsed_result,
 			dev_info.hash_key_size <= sizeof(hash_key))
 		hash_key_size = dev_info.hash_key_size;
 	else {
-		printf("dev_info did not provide a valid hash key size\n");
+		fprintf(stderr,
+			"dev_info did not provide a valid hash key size\n");
 		return;
 	}
 	/* Check the length of the RSS hash key */
 	key_len = strlen(res->key);
 	if (key_len != (hash_key_size * 2)) {
-		printf("key length: %d invalid - key must be a string of %d"
-			   " hexa-decimal numbers\n",
-			   (int) key_len, hash_key_size * 2);
+		fprintf(stderr,
+			"key length: %d invalid - key must be a string of %d hexa-decimal numbers\n",
+			(int)key_len, hash_key_size * 2);
 		return;
 	}
 	/* Translate RSS hash key into binary representation */
@@ -2487,26 +2491,26 @@ cmd_cleanup_txq_mbufs_parsed(void *parsed_result,
 	int ret;
 
 	if (test_done == 0) {
-		printf("Please stop forwarding first\n");
+		fprintf(stderr, "Please stop forwarding first\n");
 		return;
 	}
 
 	if (rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo)) {
-		printf("Failed to get port %u Tx queue %u info\n",
-		       port_id, queue_id);
+		fprintf(stderr, "Failed to get port %u Tx queue %u info\n",
+			port_id, queue_id);
 		return;
 	}
 
 	if (qinfo.queue_state != RTE_ETH_QUEUE_STATE_STARTED) {
-		printf("Tx queue %u not started\n", queue_id);
+		fprintf(stderr, "Tx queue %u not started\n", queue_id);
 		return;
 	}
 
 	ret = rte_eth_tx_done_cleanup(port_id, queue_id, free_cnt);
 	if (ret < 0) {
-		printf("Failed to cleanup mbuf for port %u Tx queue %u "
-		       "error desc: %s(%d)\n",
-		       port_id, queue_id, strerror(-ret), ret);
+		fprintf(stderr,
+			"Failed to cleanup mbuf for port %u Tx queue %u error desc: %s(%d)\n",
+			port_id, queue_id, strerror(-ret), ret);
 		return;
 	}
 
@@ -2572,7 +2576,7 @@ cmd_config_rxtx_ring_size_parsed(void *parsed_result,
 		return;
 
 	if (res->portid == (portid_t)RTE_PORT_ALL) {
-		printf("Invalid port id\n");
+		fprintf(stderr, "Invalid port id\n");
 		return;
 	}
 
@@ -2583,7 +2587,7 @@ cmd_config_rxtx_ring_size_parsed(void *parsed_result,
 	else if (!strcmp(res->rxtxq, "txq"))
 		isrx = 0;
 	else {
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 		return;
 	}
 
@@ -2593,8 +2597,9 @@ cmd_config_rxtx_ring_size_parsed(void *parsed_result,
 		return;
 
 	if (isrx && res->size != 0 && res->size <= rx_free_thresh) {
-		printf("Invalid rx ring_size, must > rx_free_thresh: %d\n",
-		       rx_free_thresh);
+		fprintf(stderr,
+			"Invalid rx ring_size, must > rx_free_thresh: %d\n",
+			rx_free_thresh);
 		return;
 	}
 
@@ -2664,7 +2669,7 @@ cmd_config_rxtx_queue_parsed(void *parsed_result,
 	int ret = 0;
 
 	if (test_done == 0) {
-		printf("Please stop forwarding first\n");
+		fprintf(stderr, "Please stop forwarding first\n");
 		return;
 	}
 
@@ -2672,7 +2677,7 @@ cmd_config_rxtx_queue_parsed(void *parsed_result,
 		return;
 
 	if (port_is_started(res->portid) != 1) {
-		printf("Please start port %u first\n", res->portid);
+		fprintf(stderr, "Please start port %u first\n", res->portid);
 		return;
 	}
 
@@ -2681,7 +2686,7 @@ cmd_config_rxtx_queue_parsed(void *parsed_result,
 	else if (!strcmp(res->rxtxq, "txq"))
 		isrx = 0;
 	else {
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 		return;
 	}
 
@@ -2695,7 +2700,7 @@ cmd_config_rxtx_queue_parsed(void *parsed_result,
 	else if (!strcmp(res->opname, "stop"))
 		isstart = 0;
 	else {
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 		return;
 	}
 
@@ -2709,7 +2714,7 @@ cmd_config_rxtx_queue_parsed(void *parsed_result,
 		ret = rte_eth_dev_tx_queue_stop(res->portid, res->qid);
 
 	if (ret == -ENOTSUP)
-		printf("Function not supported in PMD driver\n");
+		fprintf(stderr, "Function not supported in PMD driver\n");
 }
 
 cmdline_parse_token_string_t cmd_config_rxtx_queue_port =
@@ -2763,7 +2768,7 @@ cmd_config_deferred_start_rxtx_queue_parsed(void *parsed_result,
 		return;
 
 	if (port_is_started(res->port_id) != 0) {
-		printf("Please stop port %u first\n", res->port_id);
+		fprintf(stderr, "Please stop port %u first\n", res->port_id);
 		return;
 	}
 
@@ -2862,7 +2867,7 @@ cmd_setup_rxtx_queue_parsed(
 		return;
 
 	if (res->portid == (portid_t)RTE_PORT_ALL) {
-		printf("Invalid port id\n");
+		fprintf(stderr, "Invalid port id\n");
 		return;
 	}
 
@@ -2871,15 +2876,15 @@ cmd_setup_rxtx_queue_parsed(
 	else if (!strcmp(res->rxtxq, "txq"))
 		isrx = 0;
 	else {
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 		return;
 	}
 
 	if (isrx && rx_queue_id_is_invalid(res->qid)) {
-		printf("Invalid rx queue\n");
+		fprintf(stderr, "Invalid rx queue\n");
 		return;
 	} else if (!isrx && tx_queue_id_is_invalid(res->qid)) {
-		printf("Invalid tx queue\n");
+		fprintf(stderr, "Invalid tx queue\n");
 		return;
 	}
 
@@ -2891,9 +2896,8 @@ cmd_setup_rxtx_queue_parsed(
 
 		mp = mbuf_pool_find(socket_id, 0);
 		if (mp == NULL) {
-			printf("Failed to setup RX queue: "
-				"No mempool allocation"
-				" on the socket %d\n",
+			fprintf(stderr,
+				"Failed to setup RX queue: No mempool allocation on the socket %d\n",
 				rxring_numa[res->portid]);
 			return;
 		}
@@ -2904,14 +2908,15 @@ cmd_setup_rxtx_queue_parsed(
 				     &port->rx_conf[res->qid],
 				     mp);
 		if (ret)
-			printf("Failed to setup RX queue\n");
+			fprintf(stderr, "Failed to setup RX queue\n");
 	} else {
 		socket_id = txring_numa[res->portid];
 		if (!numa_support || socket_id == NUMA_NO_CONFIG)
 			socket_id = port->socket_id;
 
 		if (port->nb_tx_desc[res->qid] < tx_pkt_nb_segs) {
-			printf("Failed to setup TX queue: not enough descriptors\n");
+			fprintf(stderr,
+				"Failed to setup TX queue: not enough descriptors\n");
 			return;
 		}
 		ret = rte_eth_tx_queue_setup(res->portid,
@@ -2920,7 +2925,7 @@ cmd_setup_rxtx_queue_parsed(
 					     socket_id,
 					     &port->tx_conf[res->qid]);
 		if (ret)
-			printf("Failed to setup TX queue\n");
+			fprintf(stderr, "Failed to setup TX queue\n");
 	}
 }
 
@@ -2993,7 +2998,8 @@ parse_reta_config(const char *str,
 		nb_queue = (uint16_t)int_fld[FLD_QUEUE];
 
 		if (hash_index >= nb_entries) {
-			printf("Invalid RETA hash index=%d\n", hash_index);
+			fprintf(stderr, "Invalid RETA hash index=%d\n",
+				hash_index);
 			return -1;
 		}
 
@@ -3021,15 +3027,16 @@ cmd_set_rss_reta_parsed(void *parsed_result,
 		return;
 
 	if (dev_info.reta_size == 0) {
-		printf("Redirection table size is 0 which is "
-					"invalid for RSS\n");
+		fprintf(stderr,
+			"Redirection table size is 0 which is invalid for RSS\n");
 		return;
 	} else
 		printf("The reta size of port %d is %u\n",
 			res->port_id, dev_info.reta_size);
 	if (dev_info.reta_size > ETH_RSS_RETA_SIZE_512) {
-		printf("Currently do not support more than %u entries of "
-			"redirection table\n", ETH_RSS_RETA_SIZE_512);
+		fprintf(stderr,
+			"Currently do not support more than %u entries of redirection table\n",
+			ETH_RSS_RETA_SIZE_512);
 		return;
 	}
 
@@ -3037,15 +3044,16 @@ cmd_set_rss_reta_parsed(void *parsed_result,
 	if (!strcmp(res->list_name, "reta")) {
 		if (parse_reta_config(res->list_of_items, reta_conf,
 						dev_info.reta_size)) {
-			printf("Invalid RSS Redirection Table "
-					"config entered\n");
+			fprintf(stderr,
+				"Invalid RSS Redirection Table config entered\n");
 			return;
 		}
 		ret = rte_eth_dev_rss_reta_update(res->port_id,
 				reta_conf, dev_info.reta_size);
 		if (ret != 0)
-			printf("Bad redirection table parameter, "
-					"return code = %d \n", ret);
+			fprintf(stderr,
+				"Bad redirection table parameter, return code = %d\n",
+				ret);
 	}
 }
 
@@ -3112,14 +3120,16 @@ showport_parse_reta_config(struct rte_eth_rss_reta_entry64 *conf,
 		return -1;
 	size = p0 - p;
 	if (size >= sizeof(s)) {
-		printf("The string size exceeds the internal buffer size\n");
+		fprintf(stderr,
+			"The string size exceeds the internal buffer size\n");
 		return -1;
 	}
 	snprintf(s, sizeof(s), "%.*s", size, p);
 	ret = rte_strsplit(s, sizeof(s), str_fld, num, ',');
 	if (ret <= 0 || ret != num) {
-		printf("The bits of masks do not match the number of "
-					"reta entries: %u\n", num);
+		fprintf(stderr,
+			"The bits of masks do not match the number of reta entries: %u\n",
+			num);
 		return -1;
 	}
 	for (i = 0; i < ret; i++)
@@ -3145,7 +3155,7 @@ cmd_showport_reta_parsed(void *parsed_result,
 
 	max_reta_size = RTE_MIN(dev_info.reta_size, ETH_RSS_RETA_SIZE_512);
 	if (res->size == 0 || res->size > max_reta_size) {
-		printf("Invalid redirection table size: %u (1-%u)\n",
+		fprintf(stderr, "Invalid redirection table size: %u (1-%u)\n",
 			res->size, max_reta_size);
 		return;
 	}
@@ -3153,8 +3163,8 @@ cmd_showport_reta_parsed(void *parsed_result,
 	memset(reta_conf, 0, sizeof(reta_conf));
 	if (showport_parse_reta_config(reta_conf, res->size,
 				res->list_of_items) < 0) {
-		printf("Invalid string: %s for reta masks\n",
-					res->list_of_items);
+		fprintf(stderr, "Invalid string: %s for reta masks\n",
+			res->list_of_items);
 		return;
 	}
 	port_rss_reta_info(res->port_id, reta_conf, res->size);
@@ -3279,25 +3289,26 @@ cmd_config_dcb_parsed(void *parsed_result,
 	port = &ports[port_id];
 	/** Check if the port is not started **/
 	if (port->port_status != RTE_PORT_STOPPED) {
-		printf("Please stop port %d first\n", port_id);
+		fprintf(stderr, "Please stop port %d first\n", port_id);
 		return;
 	}
 
 	if ((res->num_tcs != ETH_4_TCS) && (res->num_tcs != ETH_8_TCS)) {
-		printf("The invalid number of traffic class,"
-			" only 4 or 8 allowed.\n");
+		fprintf(stderr,
+			"The invalid number of traffic class, only 4 or 8 allowed.\n");
 		return;
 	}
 
 	if (nb_fwd_lcores < res->num_tcs) {
-		printf("nb_cores shouldn't be less than number of TCs.\n");
+		fprintf(stderr,
+			"nb_cores shouldn't be less than number of TCs.\n");
 		return;
 	}
 
 	/* Check whether the port supports the report of DCB info. */
 	ret = rte_eth_dev_get_dcb_info(port_id, &dcb_info);
 	if (ret == -ENOTSUP) {
-		printf("rte_eth_dev_get_dcb_info not supported.\n");
+		fprintf(stderr, "rte_eth_dev_get_dcb_info not supported.\n");
 		return;
 	}
 
@@ -3316,7 +3327,7 @@ cmd_config_dcb_parsed(void *parsed_result,
 				(enum rte_eth_nb_tcs)res->num_tcs,
 				pfc_en);
 	if (ret != 0) {
-		printf("Cannot initialize network ports.\n");
+		fprintf(stderr, "Cannot initialize network ports.\n");
 		return;
 	}
 
@@ -3382,7 +3393,7 @@ cmd_config_burst_parsed(void *parsed_result,
 	int ret;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
@@ -3414,12 +3425,13 @@ cmd_config_burst_parsed(void *parsed_result,
 				rec_nb_pkts);
 			nb_pkt_per_burst = rec_nb_pkts;
 		} else if (res->value > MAX_PKT_BURST) {
-			printf("burst must be >= 1 && <= %d\n", MAX_PKT_BURST);
+			fprintf(stderr, "burst must be >= 1 && <= %d\n",
+				MAX_PKT_BURST);
 			return;
 		} else
 			nb_pkt_per_burst = res->value;
 	} else {
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 		return;
 	}
 
@@ -3470,7 +3482,7 @@ cmd_config_thresh_parsed(void *parsed_result,
 	struct cmd_config_thresh *res = parsed_result;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
@@ -3487,7 +3499,7 @@ cmd_config_thresh_parsed(void *parsed_result,
 	else if(!strcmp(res->name, "rxwt"))
 		rx_wthresh = res->value;
 	else {
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 		return;
 	}
 
@@ -3539,7 +3551,7 @@ cmd_config_threshold_parsed(void *parsed_result,
 	struct cmd_config_threshold *res = parsed_result;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
@@ -3550,7 +3562,7 @@ cmd_config_threshold_parsed(void *parsed_result,
 	else if (!strcmp(res->name, "rxfreet"))
 		rx_free_thresh = res->value;
 	else {
-		printf("Unknown parameter\n");
+		fprintf(stderr, "Unknown parameter\n");
 		return;
 	}
 
@@ -3638,11 +3650,11 @@ parse_item_list(char* str, const char* item_name, unsigned int max_items,
 			continue;
 		}
 		if (c != ',') {
-			printf("character %c is not a decimal digit\n", c);
+			fprintf(stderr, "character %c is not a decimal digit\n", c);
 			return 0;
 		}
 		if (! value_ok) {
-			printf("No valid value before comma\n");
+			fprintf(stderr, "No valid value before comma\n");
 			return 0;
 		}
 		if (nb_item < max_items) {
@@ -3653,8 +3665,8 @@ parse_item_list(char* str, const char* item_name, unsigned int max_items,
 		nb_item++;
 	}
 	if (nb_item >= max_items) {
-		printf("Number of %s = %u > %u (maximum items)\n",
-		       item_name, nb_item + 1, max_items);
+		fprintf(stderr, "Number of %s = %u > %u (maximum items)\n",
+			item_name, nb_item + 1, max_items);
 		return 0;
 	}
 	parsed_items[nb_item++] = value;
@@ -3668,8 +3680,9 @@ parse_item_list(char* str, const char* item_name, unsigned int max_items,
 	for (i = 0; i < nb_item; i++) {
 		for (j = i + 1; j < nb_item; j++) {
 			if (parsed_items[j] == parsed_items[i]) {
-				printf("duplicated %s %u at index %u and %u\n",
-				       item_name, parsed_items[i], i, j);
+				fprintf(stderr,
+					"duplicated %s %u at index %u and %u\n",
+					item_name, parsed_items[i], i, j);
 				return 0;
 			}
 		}
@@ -3695,7 +3708,7 @@ static void cmd_set_list_parsed(void *parsed_result,
 	unsigned int nb_item;
 
 	if (test_done == 0) {
-		printf("Please stop forwarding first\n");
+		fprintf(stderr, "Please stop forwarding first\n");
 		return;
 	}
 
@@ -3758,7 +3771,7 @@ static void cmd_set_mask_parsed(void *parsed_result,
 	struct cmd_setmask_result *res = parsed_result;
 
 	if (test_done == 0) {
-		printf("Please stop forwarding first\n");
+		fprintf(stderr, "Please stop forwarding first\n");
 		return;
 	}
 	if (!strcmp(res->mask, "coremask")) {
@@ -3859,7 +3872,7 @@ cmd_set_log_parsed(void *parsed_result,
 	else {
 		ret = rte_log_set_level_regexp(res->type, res->level);
 		if (ret < 0)
-			printf("Unable to set log level\n");
+			fprintf(stderr, "Unable to set log level\n");
 	}
 }
 
@@ -4212,7 +4225,7 @@ cmd_vlan_offload_parsed(void *parsed_result,
 
 		/* No queue_id, return */
 		if(i + 1 >= len) {
-			printf("must specify (port,queue_id)\n");
+			fprintf(stderr, "must specify (port,queue_id)\n");
 			return;
 		}
 		tmp = strtoul(str + i + 1, NULL, 0);
@@ -4288,7 +4301,7 @@ cmd_vlan_tpid_parsed(void *parsed_result,
 	else if (!strcmp(res->vlan_type, "outer"))
 		vlan_type = ETH_VLAN_TYPE_OUTER;
 	else {
-		printf("Unknown vlan type\n");
+		fprintf(stderr, "Unknown vlan type\n");
 		return;
 	}
 	vlan_tpid_set(res->port_id, vlan_type, res->tp_id);
@@ -4397,7 +4410,7 @@ cmd_tx_vlan_set_parsed(void *parsed_result,
 		return;
 
 	if (!port_is_stopped(res->port_id)) {
-		printf("Please stop port %d first\n", res->port_id);
+		fprintf(stderr, "Please stop port %d first\n", res->port_id);
 		return;
 	}
 
@@ -4454,7 +4467,7 @@ cmd_tx_vlan_set_qinq_parsed(void *parsed_result,
 		return;
 
 	if (!port_is_stopped(res->port_id)) {
-		printf("Please stop port %d first\n", res->port_id);
+		fprintf(stderr, "Please stop port %d first\n", res->port_id);
 		return;
 	}
 
@@ -4570,7 +4583,7 @@ cmd_tx_vlan_reset_parsed(void *parsed_result,
 		return;
 
 	if (!port_is_stopped(res->port_id)) {
-		printf("Please stop port %d first\n", res->port_id);
+		fprintf(stderr, "Please stop port %d first\n", res->port_id);
 		return;
 	}
 
@@ -4642,34 +4655,40 @@ csum_show(int port_id)
 
 	if ((tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) {
-		printf("Warning: hardware IP checksum enabled but not "
-			"supported by port %d\n", port_id);
+		fprintf(stderr,
+			"Warning: hardware IP checksum enabled but not supported by port %d\n",
+			port_id);
 	}
 	if ((tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) == 0) {
-		printf("Warning: hardware UDP checksum enabled but not "
-			"supported by port %d\n", port_id);
+		fprintf(stderr,
+			"Warning: hardware UDP checksum enabled but not supported by port %d\n",
+			port_id);
 	}
 	if ((tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) {
-		printf("Warning: hardware TCP checksum enabled but not "
-			"supported by port %d\n", port_id);
+		fprintf(stderr,
+			"Warning: hardware TCP checksum enabled but not supported by port %d\n",
+			port_id);
 	}
 	if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) == 0) {
-		printf("Warning: hardware SCTP checksum enabled but not "
-			"supported by port %d\n", port_id);
+		fprintf(stderr,
+			"Warning: hardware SCTP checksum enabled but not supported by port %d\n",
+			port_id);
 	}
 	if ((tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) == 0) {
-		printf("Warning: hardware outer IP checksum enabled but not "
-			"supported by port %d\n", port_id);
+		fprintf(stderr,
+			"Warning: hardware outer IP checksum enabled but not supported by port %d\n",
+			port_id);
 	}
 	if ((tx_offloads & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM)
 			== 0) {
-		printf("Warning: hardware outer UDP checksum enabled but not "
-			"supported by port %d\n", port_id);
+		fprintf(stderr,
+			"Warning: hardware outer UDP checksum enabled but not supported by port %d\n",
+			port_id);
 	}
 }
 
@@ -4696,11 +4715,11 @@ cmd_csum_parsed(void *parsed_result,
 	int ret;
 
 	if (port_id_is_invalid(res->port_id, ENABLED_WARN)) {
-		printf("invalid port %d\n", res->port_id);
+		fprintf(stderr, "invalid port %d\n", res->port_id);
 		return;
 	}
 	if (!port_is_stopped(res->port_id)) {
-		printf("Please stop port %d first\n", res->port_id);
+		fprintf(stderr, "Please stop port %d first\n", res->port_id);
 		return;
 	}
 
@@ -4718,32 +4737,36 @@ cmd_csum_parsed(void *parsed_result,
 						DEV_TX_OFFLOAD_IPV4_CKSUM)) {
 				csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM;
 			} else {
-				printf("IP checksum offload is not supported "
-				       "by port %u\n", res->port_id);
+				fprintf(stderr,
+					"IP checksum offload is not supported by port %u\n",
+					res->port_id);
 			}
 		} else if (!strcmp(res->proto, "udp")) {
 			if (hw == 0 || (dev_info.tx_offload_capa &
 						DEV_TX_OFFLOAD_UDP_CKSUM)) {
 				csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
 			} else {
-				printf("UDP checksum offload is not supported "
-				       "by port %u\n", res->port_id);
+				fprintf(stderr,
+					"UDP checksum offload is not supported by port %u\n",
+					res->port_id);
 			}
 		} else if (!strcmp(res->proto, "tcp")) {
 			if (hw == 0 || (dev_info.tx_offload_capa &
 						DEV_TX_OFFLOAD_TCP_CKSUM)) {
 				csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
 			} else {
-				printf("TCP checksum offload is not supported "
-				       "by port %u\n", res->port_id);
+				fprintf(stderr,
+					"TCP checksum offload is not supported by port %u\n",
+					res->port_id);
 			}
 		} else if (!strcmp(res->proto, "sctp")) {
 			if (hw == 0 || (dev_info.tx_offload_capa &
 						DEV_TX_OFFLOAD_SCTP_CKSUM)) {
 				csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM;
 			} else {
-				printf("SCTP checksum offload is not supported "
-				       "by port %u\n", res->port_id);
+				fprintf(stderr,
+					"SCTP checksum offload is not supported by port %u\n",
+					res->port_id);
 			}
 		} else if (!strcmp(res->proto, "outer-ip")) {
 			if (hw == 0 || (dev_info.tx_offload_capa &
@@ -4751,8 +4774,9 @@ cmd_csum_parsed(void *parsed_result,
 				csum_offloads |=
 						DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM;
 			} else {
-				printf("Outer IP checksum offload is not "
-				       "supported by port %u\n", res->port_id);
+				fprintf(stderr,
+					"Outer IP checksum offload is not supported by port %u\n",
+					res->port_id);
 			}
 		} else if (!strcmp(res->proto, "outer-udp")) {
 			if (hw == 0 || (dev_info.tx_offload_capa &
@@ -4760,8 +4784,9 @@ cmd_csum_parsed(void *parsed_result,
 				csum_offloads |=
 						DEV_TX_OFFLOAD_OUTER_UDP_CKSUM;
 			} else {
-				printf("Outer UDP checksum offload is not "
-				       "supported by port %u\n", res->port_id);
+				fprintf(stderr,
+					"Outer UDP checksum offload is not supported by port %u\n",
+					res->port_id);
 			}
 		}
 
@@ -4900,7 +4925,7 @@ cmd_tso_set_parsed(void *parsed_result,
 	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
 		return;
 	if (!port_is_stopped(res->port_id)) {
-		printf("Please stop port %d first\n", res->port_id);
+		fprintf(stderr, "Please stop port %d first\n", res->port_id);
 		return;
 	}
 
@@ -4913,8 +4938,8 @@ cmd_tso_set_parsed(void *parsed_result,
 
 	if ((ports[res->port_id].tso_segsz != 0) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0) {
-		printf("Error: TSO is not supported by port %d\n",
-		       res->port_id);
+		fprintf(stderr, "Error: TSO is not supported by port %d\n",
+			res->port_id);
 		return;
 	}
 
@@ -4937,8 +4962,9 @@ cmd_tso_set_parsed(void *parsed_result,
 
 	if ((ports[res->port_id].tso_segsz != 0) &&
 		(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0) {
-		printf("Warning: TSO enabled but not "
-			"supported by port %d\n", res->port_id);
+		fprintf(stderr,
+			"Warning: TSO enabled but not supported by port %d\n",
+			res->port_id);
 	}
 
 	cmd_reconfig_device_queue(res->port_id, 1, 1);
@@ -5007,23 +5033,29 @@ check_tunnel_tso_nic_support(portid_t port_id)
 		return dev_info;
 
 	if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO))
-		printf("Warning: VXLAN TUNNEL TSO not supported therefore "
-		       "not enabled for port %d\n", port_id);
+		fprintf(stderr,
+			"Warning: VXLAN TUNNEL TSO not supported therefore not enabled for port %d\n",
+			port_id);
 	if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO))
-		printf("Warning: GRE TUNNEL TSO	not supported therefore "
-		       "not enabled for port %d\n", port_id);
+		fprintf(stderr,
+			"Warning: GRE TUNNEL TSO not supported therefore not enabled for port %d\n",
+			port_id);
 	if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO))
-		printf("Warning: IPIP TUNNEL TSO not supported therefore "
-		       "not enabled for port %d\n", port_id);
+		fprintf(stderr,
+			"Warning: IPIP TUNNEL TSO not supported therefore not enabled for port %d\n",
+			port_id);
 	if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO))
-		printf("Warning: GENEVE TUNNEL TSO not supported therefore "
-		       "not enabled for port %d\n", port_id);
+		fprintf(stderr,
+			"Warning: GENEVE TUNNEL TSO not supported therefore not enabled for port %d\n",
+			port_id);
 	if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IP_TNL_TSO))
-		printf("Warning: IP TUNNEL TSO not supported therefore "
-		       "not enabled for port %d\n", port_id);
+		fprintf(stderr,
+			"Warning: IP TUNNEL TSO not supported therefore not enabled for port %d\n",
+			port_id);
 	if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TNL_TSO))
-		printf("Warning: UDP TUNNEL TSO not supported therefore "
-		       "not enabled for port %d\n", port_id);
+		fprintf(stderr,
+			"Warning: UDP TUNNEL TSO not supported therefore not enabled for port %d\n",
+			port_id);
 	return dev_info;
 }
 
@@ -5038,7 +5070,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,
 	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
 		return;
 	if (!port_is_stopped(res->port_id)) {
-		printf("Please stop port %d first\n", res->port_id);
+		fprintf(stderr, "Please stop port %d first\n", res->port_id);
 		return;
 	}
 
@@ -5081,12 +5113,12 @@ cmd_tunnel_tso_set_parsed(void *parsed_result,
 		 */
 
 		if (!ports[res->port_id].parse_tunnel)
-			printf("Warning: csum parse_tunnel must be set "
-				"so that tunneled packets are recognized\n");
+			fprintf(stderr,
+				"Warning: csum parse_tunnel must be set so that tunneled packets are recognized\n");
 		if (!(ports[res->port_id].dev_conf.txmode.offloads &
 		      DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM))
-			printf("Warning: csum set outer-ip must be set to hw "
-				"if outer L3 is IPv4; not necessary for IPv6\n");
+			fprintf(stderr,
+				"Warning: csum set outer-ip must be set to hw if outer L3 is IPv4; not necessary for IPv6\n");
 	}
 
 	cmd_config_queue_tx_offloads(&ports[res->port_id]);
@@ -5350,17 +5382,17 @@ cmd_gso_size_parsed(void *parsed_result,
 	struct cmd_gso_size_result *res = parsed_result;
 
 	if (test_done == 0) {
-		printf("Before setting GSO segsz, please first"
-				" stop forwarding\n");
+		fprintf(stderr,
+			"Before setting GSO segsz, please first stop forwarding\n");
 		return;
 	}
 
 	if (!strcmp(res->cmd_keyword, "gso") &&
 			!strcmp(res->cmd_segsz, "segsz")) {
 		if (res->cmd_size < RTE_GSO_SEG_SIZE_MIN)
-			printf("gso_size should be larger than %zu."
-					" Please input a legal value\n",
-					RTE_GSO_SEG_SIZE_MIN);
+			fprintf(stderr,
+				"gso_size should be larger than %zu. Please input a legal value\n",
+				RTE_GSO_SEG_SIZE_MIN);
 		else
 			gso_max_segment_size = res->cmd_size;
 	}
@@ -5408,7 +5440,7 @@ cmd_gso_show_parsed(void *parsed_result,
 	struct cmd_gso_show_result *res = parsed_result;
 
 	if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
-		printf("invalid port id %u\n", res->cmd_pid);
+		fprintf(stderr, "invalid port id %u\n", res->cmd_pid);
 		return;
 	}
 	if (!strcmp(res->cmd_keyword, "gso")) {
@@ -5561,7 +5593,8 @@ cmd_set_bypass_mode_parsed(void *parsed_result,
 	rc = rte_pmd_ixgbe_bypass_state_set(port_id, &bypass_mode);
 #endif
 	if (rc != 0)
-		printf("\t Failed to set bypass mode for port = %d.\n", port_id);
+		fprintf(stderr, "\t Failed to set bypass mode for port = %d.\n",
+			port_id);
 }
 
 cmdline_parse_token_string_t cmd_setbypass_mode_set =
@@ -5648,9 +5681,9 @@ cmd_set_bypass_event_parsed(void *parsed_result,
 							   bypass_timeout);
 		}
 		if (rc != 0) {
-			printf("Failed to set timeout value %u "
-			"for port %d, errto code: %d.\n",
-			bypass_timeout, port_id, rc);
+			fprintf(stderr,
+				"Failed to set timeout value %u for port %d, errto code: %d.\n",
+				bypass_timeout, port_id, rc);
 		}
 	}
 
@@ -5660,8 +5693,8 @@ cmd_set_bypass_event_parsed(void *parsed_result,
 #endif
 
 	if (rc != 0)
-		printf("\t Failed to set bypass event for port = %d.\n",
-		       port_id);
+		fprintf(stderr, "\t Failed to set bypass event for port = %d.\n",
+			port_id);
 }
 
 cmdline_parse_token_string_t cmd_setbypass_event_set =
@@ -5803,7 +5836,8 @@ cmd_show_bypass_config_parsed(void *parsed_result,
 
 	/* Display the bypass mode.*/
 	if (rte_pmd_ixgbe_bypass_state_show(port_id, &bypass_mode) != 0) {
-		printf("\tFailed to get bypass mode for port = %d\n", port_id);
+		fprintf(stderr, "\tFailed to get bypass mode for port = %d\n",
+			port_id);
 		return;
 	}
 	else {
@@ -5823,7 +5857,8 @@ cmd_show_bypass_config_parsed(void *parsed_result,
 	for (i = RTE_PMD_IXGBE_BYPASS_EVENT_START; i < RTE_DIM(events); i++) {
 
 		if (rte_pmd_ixgbe_bypass_event_show(port_id, i, &event_mode)) {
-			printf("\tFailed to get bypass mode for event = %s\n",
+			fprintf(stderr,
+				"\tFailed to get bypass mode for event = %s\n",
 				events[i]);
 		} else {
 			if (!RTE_PMD_IXGBE_BYPASS_MODE_VALID(event_mode))
@@ -5835,7 +5870,8 @@ cmd_show_bypass_config_parsed(void *parsed_result,
 	}
 #endif
 	if (rc != 0)
-		printf("\tFailed to get bypass configuration for port = %d\n",
+		fprintf(stderr,
+			"\tFailed to get bypass configuration for port = %d\n",
 		       port_id);
 }
 
@@ -5885,7 +5921,8 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result,
 
 	/* Set the bonding mode for the relevant port. */
 	if (0 != rte_eth_bond_mode_set(port_id, res->value))
-		printf("\t Failed to set bonding mode for port = %d.\n", port_id);
+		fprintf(stderr, "\t Failed to set bonding mode for port = %d.\n",
+			port_id);
 }
 
 cmdline_parse_token_string_t cmd_setbonding_mode_set =
@@ -5941,7 +5978,7 @@ static void cmd_set_bonding_lacp_dedicated_queues_parsed(void *parsed_result,
 
 	/** Check if the port is not started **/
 	if (port->port_status != RTE_PORT_STOPPED) {
-		printf("Please stop port %d first\n", port_id);
+		fprintf(stderr, "Please stop port %d first\n", port_id);
 		return;
 	}
 
@@ -6022,14 +6059,15 @@ static void cmd_set_bonding_balance_xmit_policy_parsed(void *parsed_result,
 	} else if (!strcmp(res->policy, "l34")) {
 		policy = BALANCE_XMIT_POLICY_LAYER34;
 	} else {
-		printf("\t Invalid xmit policy selection");
+		fprintf(stderr, "\t Invalid xmit policy selection");
 		return;
 	}
 
 	/* Set the bonding mode for the relevant port. */
 	if (0 != rte_eth_bond_xmit_policy_set(port_id, policy)) {
-		printf("\t Failed to set bonding balance xmit policy for port = %d.\n",
-				port_id);
+		fprintf(stderr,
+			"\t Failed to set bonding balance xmit policy for port = %d.\n",
+			port_id);
 	}
 }
 
@@ -6088,7 +6126,8 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
 	/* Display the bonding mode.*/
 	bonding_mode = rte_eth_bond_mode_get(port_id);
 	if (bonding_mode < 0) {
-		printf("\tFailed to get bonding mode for port = %d\n", port_id);
+		fprintf(stderr, "\tFailed to get bonding mode for port = %d\n",
+			port_id);
 		return;
 	} else
 		printf("\tBonding mode: %d\n", bonding_mode);
@@ -6098,8 +6137,9 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
 
 		balance_xmit_policy = rte_eth_bond_xmit_policy_get(port_id);
 		if (balance_xmit_policy < 0) {
-			printf("\tFailed to get balance xmit policy for port = %d\n",
-					port_id);
+			fprintf(stderr,
+				"\tFailed to get balance xmit policy for port = %d\n",
+				port_id);
 			return;
 		} else {
 			printf("\tBalance Xmit Policy: ");
@@ -6139,7 +6179,8 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
 	num_slaves = rte_eth_bond_slaves_get(port_id, slaves, RTE_MAX_ETHPORTS);
 
 	if (num_slaves < 0) {
-		printf("\tFailed to get slave list for port = %d\n", port_id);
+		fprintf(stderr, "\tFailed to get slave list for port = %d\n",
+			port_id);
 		return;
 	}
 	if (num_slaves > 0) {
@@ -6157,7 +6198,9 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
 			RTE_MAX_ETHPORTS);
 
 	if (num_active_slaves < 0) {
-		printf("\tFailed to get active slave list for port = %d\n", port_id);
+		fprintf(stderr,
+			"\tFailed to get active slave list for port = %d\n",
+			port_id);
 		return;
 	}
 	if (num_active_slaves > 0) {
@@ -6174,7 +6217,8 @@ static void cmd_show_bonding_config_parsed(void *parsed_result,
 
 	primary_id = rte_eth_bond_primary_get(port_id);
 	if (primary_id < 0) {
-		printf("\tFailed to get primary slave for port = %d\n", port_id);
+		fprintf(stderr, "\tFailed to get primary slave for port = %d\n",
+			port_id);
 		return;
 	} else
 		printf("\tPrimary: [%d]\n", primary_id);
@@ -6227,8 +6271,8 @@ static void cmd_set_bonding_primary_parsed(void *parsed_result,
 
 	/* Set the primary slave for a bonded device. */
 	if (0 != rte_eth_bond_primary_set(master_port_id, slave_port_id)) {
-		printf("\t Failed to set primary slave for port = %d.\n",
-				master_port_id);
+		fprintf(stderr, "\t Failed to set primary slave for port = %d.\n",
+			master_port_id);
 		return;
 	}
 	init_port_config();
@@ -6284,8 +6328,9 @@ static void cmd_add_bonding_slave_parsed(void *parsed_result,
 
 	/* add the slave for a bonded device. */
 	if (0 != rte_eth_bond_slave_add(master_port_id, slave_port_id)) {
-		printf("\t Failed to add slave %d to master port = %d.\n",
-				slave_port_id, master_port_id);
+		fprintf(stderr,
+			"\t Failed to add slave %d to master port = %d.\n",
+			slave_port_id, master_port_id);
 		return;
 	}
 	init_port_config();
@@ -6342,8 +6387,9 @@ static void cmd_remove_bonding_slave_parsed(void *parsed_result,
 
 	/* remove the slave from a bonded device. */
 	if (0 != rte_eth_bond_slave_remove(master_port_id, slave_port_id)) {
-		printf("\t Failed to remove slave %d from master port = %d.\n",
-				slave_port_id, master_port_id);
+		fprintf(stderr,
+			"\t Failed to remove slave %d from master port = %d.\n",
+			slave_port_id, master_port_id);
 		return;
 	}
 	init_port_config();
@@ -6402,7 +6448,7 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
 	int ret;
 
 	if (test_done == 0) {
-		printf("Please stop forwarding first\n");
+		fprintf(stderr, "Please stop forwarding first\n");
 		return;
 	}
 
@@ -6412,7 +6458,7 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
 	/* Create a new bonded device. */
 	port_id = rte_eth_bond_create(ethdev_name, res->mode, res->socket);
 	if (port_id < 0) {
-		printf("\t Failed to create bonded device.\n");
+		fprintf(stderr, "\t Failed to create bonded device.\n");
 		return;
 	} else {
 		printf("Created new bonded device %s on (port %d).\n", ethdev_name,
@@ -6423,7 +6469,8 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
 		reconfig(port_id, res->socket);
 		ret = rte_eth_promiscuous_enable(port_id);
 		if (ret != 0)
-			printf("Failed to enable promiscuous mode for port %u: %s - ignore\n",
+			fprintf(stderr,
+				"Failed to enable promiscuous mode for port %u: %s - ignore\n",
 				port_id, rte_strerror(-ret));
 
 		ports[port_id].need_setup = 0;
@@ -6486,7 +6533,8 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result,
 
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
-		printf("set_bond_mac_addr error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
+			strerror(-ret));
 }
 
 cmdline_parse_token_string_t cmd_set_bond_mac_addr_set =
@@ -6538,7 +6586,8 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result,
 
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
-		printf("set_bond_mac_addr error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
+			strerror(-ret));
 }
 
 cmdline_parse_token_string_t cmd_set_bond_mon_period_set =
@@ -7007,8 +7056,9 @@ cmd_link_flow_ctrl_show_parsed(void *parsed_result,
 
 	ret = rte_eth_dev_flow_ctrl_get(res->port_id, &fc_conf);
 	if (ret != 0) {
-		printf("Failed to get current flow ctrl information: err = %d\n",
-		       ret);
+		fprintf(stderr,
+			"Failed to get current flow ctrl information: err = %d\n",
+			ret);
 		return;
 	}
 
@@ -7304,8 +7354,9 @@ cmd_link_flow_ctrl_set_parsed(void *parsed_result,
 	if (cmd) {
 		ret = rte_eth_dev_flow_ctrl_get(res->port_id, &fc_conf);
 		if (ret != 0) {
-			printf("cannot get current flow ctrl parameters, return"
-			       "code = %d\n", ret);
+			fprintf(stderr,
+				"cannot get current flow ctrl parameters, return code = %d\n",
+				ret);
 			return;
 		}
 
@@ -7349,7 +7400,9 @@ cmd_link_flow_ctrl_set_parsed(void *parsed_result,
 
 	ret = rte_eth_dev_flow_ctrl_set(res->port_id, &fc_conf);
 	if (ret != 0)
-		printf("bad flow contrl parameter, return code = %d \n", ret);
+		fprintf(stderr,
+			"bad flow contrl parameter, return code = %d \n",
+			ret);
 }
 
 /* *** SETUP ETHERNET PRIORITY FLOW CONTROL *** */
@@ -7398,7 +7451,9 @@ cmd_priority_flow_ctrl_set_parsed(void *parsed_result,
 
 	ret = rte_eth_dev_priority_flow_ctrl_set(res->port_id, &pfc_conf);
 	if (ret != 0)
-		printf("bad priority flow contrl parameter, return code = %d \n", ret);
+		fprintf(stderr,
+			"bad priority flow contrl parameter, return code = %d \n",
+			ret);
 }
 
 cmdline_parse_token_string_t cmd_pfc_set_set =
@@ -7912,7 +7967,7 @@ static void cmd_showeeprom_parsed(void *parsed_result,
 	else if (!strcmp(res->type, "module_eeprom"))
 		port_module_eeprom_display(res->portnum);
 	else
-		printf("Unknown argument\n");
+		fprintf(stderr, "Unknown argument\n");
 }
 
 cmdline_parse_token_string_t cmd_showeeprom_show =
@@ -8430,7 +8485,7 @@ static void cmd_mac_addr_parsed(void *parsed_result,
 
 	/* check the return value and print it if is < 0 */
 	if(ret < 0)
-		printf("mac_addr_cmd error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "mac_addr_cmd error: (%s)\n", strerror(-ret));
 
 }
 
@@ -8475,7 +8530,7 @@ static void cmd_set_eth_peer_parsed(void *parsed_result,
 		struct cmd_eth_peer_result *res = parsed_result;
 
 		if (test_done == 0) {
-			printf("Please stop forwarding first\n");
+			fprintf(stderr, "Please stop forwarding first\n");
 			return;
 		}
 		if (!strcmp(res->eth_peer, "eth-peer")) {
@@ -8712,7 +8767,9 @@ cmd_set_uc_hash_parsed(void *parsed_result,
 		ret = rte_eth_dev_uc_hash_table_set(res->port_id,
 						&res->address,(uint8_t)is_on);
 	if (ret < 0)
-		printf("bad unicast hash table parameter, return code = %d \n", ret);
+		fprintf(stderr,
+			"bad unicast hash table parameter, return code = %d \n",
+			ret);
 
 }
 
@@ -8773,8 +8830,9 @@ cmd_set_uc_all_hash_parsed(void *parsed_result,
 		(strcmp(res->value, "all") == 0))
 		ret = rte_eth_dev_uc_all_hash_table_set(res->port_id,(uint8_t) is_on);
 	if (ret < 0)
-		printf("bad unicast hash table parameter,"
-			"return code = %d \n", ret);
+		fprintf(stderr,
+			"bad unicast hash table parameter, return code = %d \n",
+			ret);
 }
 
 cmdline_parse_token_string_t cmd_set_uc_all_hash_set =
@@ -8918,8 +8976,9 @@ cmd_set_vf_rxmode_parsed(void *parsed_result,
 						 vf_rxmode, (uint8_t)is_on);
 #endif
 	if (ret < 0)
-		printf("bad VF receive mode parameter, return code = %d \n",
-		ret);
+		fprintf(stderr,
+			"bad VF receive mode parameter, return code = %d \n",
+			ret);
 }
 
 cmdline_parse_token_string_t cmd_set_vf_rxmode_set =
@@ -8998,7 +9057,7 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result,
 #endif
 
 	if(ret < 0)
-		printf("vf_mac_addr_cmd error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "vf_mac_addr_cmd error: (%s)\n", strerror(-ret));
 
 }
 
@@ -9082,17 +9141,17 @@ cmd_vf_rx_vlan_filter_parsed(void *parsed_result,
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vlan_id %d or vf_mask %"PRIu64"\n",
-				res->vlan_id, res->vf_mask);
+		fprintf(stderr, "invalid vlan_id %d or vf_mask %"PRIu64"\n",
+			res->vlan_id, res->vf_mask);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented or supported\n");
+		fprintf(stderr, "function not implemented or supported\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -9159,7 +9218,8 @@ static void cmd_queue_rate_limit_parsed(void *parsed_result,
 		ret = set_queue_rate_limit(res->port_num, res->queue_num,
 					res->rate_num);
 	if (ret < 0)
-		printf("queue_rate_limit_cmd error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "queue_rate_limit_cmd error: (%s)\n",
+			strerror(-ret));
 
 }
 
@@ -9229,7 +9289,8 @@ static void cmd_vf_rate_limit_parsed(void *parsed_result,
 		ret = set_vf_rate_limit(res->port_num, res->vf_num,
 					res->rate_num, res->q_msk_val);
 	if (ret < 0)
-		printf("vf_rate_limit_cmd error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "vf_rate_limit_cmd error: (%s)\n",
+			strerror(-ret));
 
 }
 
@@ -9309,7 +9370,8 @@ cmd_tunnel_udp_config_parsed(void *parsed_result,
 							 &tunnel_udp);
 
 	if (ret < 0)
-		printf("udp tunneling add error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "udp tunneling add error: (%s)\n",
+			strerror(-ret));
 }
 
 cmdline_parse_token_string_t cmd_tunnel_udp_config_rx_vxlan_port =
@@ -9372,7 +9434,7 @@ cmd_cfg_tunnel_udp_port_parsed(void *parsed_result,
 	} else if (!strcmp(res->tunnel_type, "ecpri")) {
 		tunnel_udp.prot_type = RTE_TUNNEL_TYPE_ECPRI;
 	} else {
-		printf("Invalid tunnel type\n");
+		fprintf(stderr, "Invalid tunnel type\n");
 		return;
 	}
 
@@ -9384,7 +9446,8 @@ cmd_cfg_tunnel_udp_port_parsed(void *parsed_result,
 							 &tunnel_udp);
 
 	if (ret < 0)
-		printf("udp tunneling port add error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "udp tunneling port add error: (%s)\n",
+			strerror(-ret));
 }
 
 cmdline_parse_token_string_t cmd_config_tunnel_udp_port_port =
@@ -9503,7 +9566,8 @@ cmd_set_mirror_mask_parsed(void *parsed_result,
 
 		for (i = 0; i < nb_item; i++) {
 			if (vlan_list[i] > RTE_ETHER_MAX_VLAN_ID) {
-				printf("Invalid vlan_id: must be < 4096\n");
+				fprintf(stderr,
+					"Invalid vlan_id: must be < 4096\n");
 				return;
 			}
 
@@ -9519,7 +9583,8 @@ cmd_set_mirror_mask_parsed(void *parsed_result,
 		ret = rte_eth_mirror_rule_set(res->port_id, &mr_conf,
 						res->rule_id, 0);
 	if (ret < 0)
-		printf("mirror rule add error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "mirror rule add error: (%s)\n",
+			strerror(-ret));
 }
 
 cmdline_parse_inst_t cmd_set_mirror_mask = {
@@ -9610,7 +9675,8 @@ cmd_set_mirror_link_parsed(void *parsed_result,
 
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
-		printf("mirror rule add error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "mirror rule add error: (%s)\n",
+			strerror(-ret));
 
 }
 
@@ -9668,7 +9734,8 @@ cmd_reset_mirror_rule_parsed(void *parsed_result,
         /* check rule_id */
 	ret = rte_eth_mirror_rule_reset(res->port_id,res->rule_id);
 	if(ret < 0)
-		printf("mirror rule remove error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "mirror rule remove error: (%s)\n",
+			strerror(-ret));
 }
 
 cmdline_parse_inst_t cmd_reset_mirror_rule = {
@@ -9889,10 +9956,11 @@ cmd_queue_region_parsed(void *parsed_result,
 	case 0:
 		break;
 	case -ENOTSUP:
-		printf("function not implemented or supported\n");
+		fprintf(stderr, "function not implemented or supported\n");
 		break;
 	default:
-		printf("queue region config error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "queue region config error: (%s)\n",
+			strerror(-ret));
 	}
 }
 
@@ -9988,10 +10056,11 @@ cmd_region_flowtype_parsed(void *parsed_result,
 	case 0:
 		break;
 	case -ENOTSUP:
-		printf("function not implemented or supported\n");
+		fprintf(stderr, "function not implemented or supported\n");
 		break;
 	default:
-		printf("region flowtype config error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "region flowtype config error: (%s)\n",
+			strerror(-ret));
 	}
 }
 
@@ -10078,11 +10147,11 @@ cmd_user_priority_region_parsed(void *parsed_result,
 	case 0:
 		break;
 	case -ENOTSUP:
-		printf("function not implemented or supported\n");
+		fprintf(stderr, "function not implemented or supported\n");
 		break;
 	default:
-		printf("user_priority region config error: (%s)\n",
-				strerror(-ret));
+		fprintf(stderr, "user_priority region config error: (%s)\n",
+			strerror(-ret));
 	}
 }
 
@@ -10171,11 +10240,11 @@ cmd_flush_queue_region_parsed(void *parsed_result,
 	case 0:
 		break;
 	case -ENOTSUP:
-		printf("function not implemented or supported\n");
+		fprintf(stderr, "function not implemented or supported\n");
 		break;
 	default:
-		printf("queue region config flush error: (%s)\n",
-				strerror(-ret));
+		fprintf(stderr, "queue region config flush error: (%s)\n",
+			strerror(-ret));
 	}
 }
 
@@ -10252,11 +10321,11 @@ cmd_show_queue_region_info_parsed(void *parsed_result,
 	case 0:
 		break;
 	case -ENOTSUP:
-		printf("function not implemented or supported\n");
+		fprintf(stderr, "function not implemented or supported\n");
 		break;
 	default:
-		printf("queue region config info show error: (%s)\n",
-				strerror(-ret));
+		fprintf(stderr, "queue region config info show error: (%s)\n",
+			strerror(-ret));
 	}
 }
 
@@ -10294,7 +10363,7 @@ do { \
 	if ((ip_addr).family == AF_INET) \
 		(ip) = (ip_addr).addr.ipv4.s_addr; \
 	else { \
-		printf("invalid parameter.\n"); \
+		fprintf(stderr, "invalid parameter.\n"); \
 		return; \
 	} \
 } while (0)
@@ -10306,7 +10375,7 @@ do { \
 				 &((ip_addr).addr.ipv6), \
 				 sizeof(struct in6_addr)); \
 	else { \
-		printf("invalid parameter.\n"); \
+		fprintf(stderr, "invalid parameter.\n"); \
 		return; \
 	} \
 } while (0)
@@ -10383,7 +10452,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 	memset(&conf, 0, sizeof(conf));
 
 	if (flow_type == RTE_ETH_FLOW_UNKNOWN) {
-		printf("Invalid flow type specified.\n");
+		fprintf(stderr, "Invalid flow type specified.\n");
 		return;
 	}
 	ret = rte_pmd_i40e_flow_type_mapping_get(res->port_id,
@@ -10391,7 +10460,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 	if (ret)
 		return;
 	if (mapping[flow_type].pctype == 0ULL) {
-		printf("Invalid flow type specified.\n");
+		fprintf(stderr, "Invalid flow type specified.\n");
 		return;
 	}
 	for (i = 0; i < RTE_PMD_I40E_PCTYPE_MAX; i++) {
@@ -10420,8 +10489,8 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 							&conf,
 							add);
 	if (ret < 0)
-		printf("flow director config error: (%s)\n",
-		       strerror(-ret));
+		fprintf(stderr, "flow director config error: (%s)\n",
+			strerror(-ret));
 	close_file(conf.input.packet);
 }
 
@@ -10531,7 +10600,7 @@ cmd_flow_director_mask_parsed(void *parsed_result,
 	port = &ports[res->port_id];
 	/** Check if the port is not started **/
 	if (port->port_status != RTE_PORT_STOPPED) {
-		printf("Please stop port %d first\n", res->port_id);
+		fprintf(stderr, "Please stop port %d first\n", res->port_id);
 		return;
 	}
 
@@ -10539,14 +10608,14 @@ cmd_flow_director_mask_parsed(void *parsed_result,
 
 	if (fdir_conf.mode ==  RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
 		if (strcmp(res->mode_value, "MAC-VLAN")) {
-			printf("Please set mode to MAC-VLAN.\n");
+			fprintf(stderr, "Please set mode to MAC-VLAN.\n");
 			return;
 		}
 
 		mask->vlan_tci_mask = rte_cpu_to_be_16(res->vlan_mask);
 	} else if (fdir_conf.mode ==  RTE_FDIR_MODE_PERFECT_TUNNEL) {
 		if (strcmp(res->mode_value, "Tunnel")) {
-			printf("Please set mode to Tunnel.\n");
+			fprintf(stderr, "Please set mode to Tunnel.\n");
 			return;
 		}
 
@@ -10556,7 +10625,7 @@ cmd_flow_director_mask_parsed(void *parsed_result,
 		mask->tunnel_type_mask = res->tunnel_type_mask;
 	} else {
 		if (strcmp(res->mode_value, "IP")) {
-			printf("Please set mode to IP.\n");
+			fprintf(stderr, "Please set mode to IP.\n");
 			return;
 		}
 
@@ -10761,7 +10830,7 @@ cmd_flow_director_flxpld_parsed(void *parsed_result,
 	port = &ports[res->port_id];
 	/** Check if the port is not started **/
 	if (port->port_status != RTE_PORT_STOPPED) {
-		printf("Please stop port %d first\n", res->port_id);
+		fprintf(stderr, "Please stop port %d first\n", res->port_id);
 		return;
 	}
 
@@ -10779,7 +10848,7 @@ cmd_flow_director_flxpld_parsed(void *parsed_result,
 	ret = parse_offsets(res->payload_cfg, flex_cfg.src_offset,
 			    RTE_ETH_FDIR_MAX_FLEXLEN);
 	if (ret < 0) {
-		printf("error: Cannot parse flex payload input.\n");
+		fprintf(stderr, "error: Cannot parse flex payload input.\n");
 		return;
 	}
 
@@ -10833,10 +10902,11 @@ static void cmd_mcast_addr_parsed(void *parsed_result,
 	struct cmd_mcast_addr_result *res = parsed_result;
 
 	if (!rte_is_multicast_ether_addr(&res->mc_addr)) {
-		printf("Invalid multicast addr %02X:%02X:%02X:%02X:%02X:%02X\n",
-		       res->mc_addr.addr_bytes[0], res->mc_addr.addr_bytes[1],
-		       res->mc_addr.addr_bytes[2], res->mc_addr.addr_bytes[3],
-		       res->mc_addr.addr_bytes[4], res->mc_addr.addr_bytes[5]);
+		fprintf(stderr,
+			"Invalid multicast addr %02X:%02X:%02X:%02X:%02X:%02X\n",
+			res->mc_addr.addr_bytes[0], res->mc_addr.addr_bytes[1],
+			res->mc_addr.addr_bytes[2], res->mc_addr.addr_bytes[3],
+			res->mc_addr.addr_bytes[4], res->mc_addr.addr_bytes[5]);
 		return;
 	}
 	if (strcmp(res->what, "add") == 0)
@@ -10948,16 +11018,16 @@ cmd_set_vf_vlan_anti_spoof_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d\n", res->vf_id);
+		fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -11054,16 +11124,17 @@ cmd_set_vf_mac_anti_spoof_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d or is_on %d\n", res->vf_id, is_on);
+		fprintf(stderr, "invalid vf_id %d or is_on %d\n",
+			res->vf_id, is_on);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -11160,16 +11231,17 @@ cmd_set_vf_vlan_stripq_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d or is_on %d\n", res->vf_id, is_on);
+		fprintf(stderr, "invalid vf_id %d or is_on %d\n",
+			res->vf_id, is_on);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -11264,16 +11336,17 @@ cmd_set_vf_vlan_insert_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d or vlan_id %d\n", res->vf_id, res->vlan_id);
+		fprintf(stderr, "invalid vf_id %d or vlan_id %d\n",
+			res->vf_id, res->vlan_id);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -11361,16 +11434,16 @@ cmd_set_tx_loopback_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid is_on %d\n", is_on);
+		fprintf(stderr, "invalid is_on %d\n", is_on);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -11451,16 +11524,16 @@ cmd_set_all_queues_drop_en_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid is_on %d\n", is_on);
+		fprintf(stderr, "invalid is_on %d\n", is_on);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -11543,16 +11616,17 @@ cmd_set_vf_split_drop_en_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d or is_on %d\n", res->vf_id, is_on);
+		fprintf(stderr, "invalid vf_id %d or is_on %d\n",
+			res->vf_id, is_on);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("not supported on port %d\n", res->port_id);
+		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -11647,16 +11721,16 @@ cmd_set_vf_mac_addr_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d or mac_addr\n", res->vf_id);
+		fprintf(stderr, "invalid vf_id %d or mac_addr\n", res->vf_id);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -11745,7 +11819,7 @@ cmd_set_macsec_offload_on_parsed(
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
 		return;
 	if (!port_is_stopped(port_id)) {
-		printf("Please stop port %d first\n", port_id);
+		fprintf(stderr, "Please stop port %d first\n", port_id);
 		return;
 	}
 
@@ -11768,13 +11842,13 @@ cmd_set_macsec_offload_on_parsed(
 		cmd_reconfig_device_queue(port_id, 1, 1);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", port_id);
+		fprintf(stderr, "invalid port_id %d\n", port_id);
 		break;
 	case -ENOTSUP:
-		printf("not supported on port %d\n", port_id);
+		fprintf(stderr, "not supported on port %d\n", port_id);
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -11842,7 +11916,7 @@ cmd_set_macsec_offload_off_parsed(
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
 		return;
 	if (!port_is_stopped(port_id)) {
-		printf("Please stop port %d first\n", port_id);
+		fprintf(stderr, "Please stop port %d first\n", port_id);
 		return;
 	}
 
@@ -11862,13 +11936,13 @@ cmd_set_macsec_offload_off_parsed(
 		cmd_reconfig_device_queue(port_id, 1, 1);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", port_id);
+		fprintf(stderr, "invalid port_id %d\n", port_id);
 		break;
 	case -ENOTSUP:
-		printf("not supported on port %d\n", port_id);
+		fprintf(stderr, "not supported on port %d\n", port_id);
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -11950,13 +12024,13 @@ cmd_set_macsec_sc_parsed(
 	case 0:
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("not supported on port %d\n", res->port_id);
+		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -12070,16 +12144,16 @@ cmd_set_macsec_sa_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid idx %d or an %d\n", res->idx, res->an);
+		fprintf(stderr, "invalid idx %d or an %d\n", res->idx, res->an);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("not supported on port %d\n", res->port_id);
+		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -12162,16 +12236,16 @@ cmd_set_vf_promisc_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d\n", res->vf_id);
+		fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -12252,16 +12326,16 @@ cmd_set_vf_allmulti_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d\n", res->vf_id);
+		fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -12342,16 +12416,17 @@ cmd_set_vf_broadcast_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d or is_on %d\n", res->vf_id, is_on);
+		fprintf(stderr, "invalid vf_id %d or is_on %d\n",
+			res->vf_id, is_on);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -12436,16 +12511,17 @@ cmd_set_vf_vlan_tag_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d or is_on %d\n", res->vf_id, is_on);
+		fprintf(stderr, "invalid vf_id %d or is_on %d\n",
+			res->vf_id, is_on);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -12557,17 +12633,17 @@ cmd_vf_max_bw_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d or bandwidth %d\n",
-		       res->vf_id, res->bw);
+		fprintf(stderr, "invalid vf_id %d or bandwidth %d\n",
+			res->vf_id, res->bw);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -12602,24 +12678,27 @@ vf_tc_min_bw_parse_bw_list(uint8_t *bw_list,
 
 	p = strchr(p0, '(');
 	if (p == NULL) {
-		printf("The bandwidth-list should be '(bw1, bw2, ...)'\n");
+		fprintf(stderr,
+			"The bandwidth-list should be '(bw1, bw2, ...)'\n");
 		return -1;
 	}
 	p++;
 	p0 = strchr(p, ')');
 	if (p0 == NULL) {
-		printf("The bandwidth-list should be '(bw1, bw2, ...)'\n");
+		fprintf(stderr,
+			"The bandwidth-list should be '(bw1, bw2, ...)'\n");
 		return -1;
 	}
 	size = p0 - p;
 	if (size >= sizeof(s)) {
-		printf("The string size exceeds the internal buffer size\n");
+		fprintf(stderr,
+			"The string size exceeds the internal buffer size\n");
 		return -1;
 	}
 	snprintf(s, sizeof(s), "%.*s", size, p);
 	ret = rte_strsplit(s, sizeof(s), str_fld, 16, ',');
 	if (ret <= 0) {
-		printf("Failed to get the bandwidth list. ");
+		fprintf(stderr, "Failed to get the bandwidth list.\n");
 		return -1;
 	}
 	*tc_num = ret;
@@ -12657,16 +12736,16 @@ cmd_vf_tc_min_bw_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d or bandwidth\n", res->vf_id);
+		fprintf(stderr, "invalid vf_id %d or bandwidth\n", res->vf_id);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -12706,7 +12785,7 @@ cmd_tc_min_bw_parsed(
 	port = &ports[res->port_id];
 	/** Check if the port is not started **/
 	if (port->port_status != RTE_PORT_STOPPED) {
-		printf("Please stop port %d first\n", res->port_id);
+		fprintf(stderr, "Please stop port %d first\n", res->port_id);
 		return;
 	}
 
@@ -12722,16 +12801,16 @@ cmd_tc_min_bw_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid bandwidth\n");
+		fprintf(stderr, "invalid bandwidth\n");
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -12772,17 +12851,18 @@ cmd_vf_tc_max_bw_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d, tc_no %d or bandwidth %d\n",
-		       res->vf_id, res->tc_no, res->bw);
+		fprintf(stderr,
+			"invalid vf_id %d, tc_no %d or bandwidth %d\n",
+			res->vf_id, res->tc_no, res->bw);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -14178,16 +14258,16 @@ cmd_strict_link_prio_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid tc_bitmap 0x%x\n", res->tc_map);
+		fprintf(stderr, "invalid tc_bitmap 0x%x\n", res->tc_map);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -14238,13 +14318,13 @@ cmd_ddp_add_parsed(
 	int ret = -ENOTSUP;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
 	filepath = strdup(res->filepath);
 	if (filepath == NULL) {
-		printf("Failed to allocate memory\n");
+		fprintf(stderr, "Failed to allocate memory\n");
 		return;
 	}
 	file_num = rte_strsplit(filepath, strlen(filepath), file_fld, 2, ',');
@@ -14263,9 +14343,9 @@ cmd_ddp_add_parsed(
 #endif
 
 	if (ret == -EEXIST)
-		printf("Profile has already existed.\n");
+		fprintf(stderr, "Profile has already existed.\n");
 	else if (ret < 0)
-		printf("Failed to load profile.\n");
+		fprintf(stderr, "Failed to load profile.\n");
 	else if (file_num == 2)
 		save_file(file_fld[1], buff, size);
 
@@ -14315,7 +14395,7 @@ cmd_ddp_del_parsed(
 	int ret = -ENOTSUP;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
@@ -14331,9 +14411,9 @@ cmd_ddp_del_parsed(
 #endif
 
 	if (ret == -EACCES)
-		printf("Profile does not exist.\n");
+		fprintf(stderr, "Profile does not exist.\n");
 	else if (ret < 0)
-		printf("Failed to delete profile.\n");
+		fprintf(stderr, "Failed to delete profile.\n");
 
 	close_file(buff);
 }
@@ -14571,7 +14651,7 @@ cmd_ddp_info_parsed(
 		free(proto);
 #endif
 	if (ret == -ENOTSUP)
-		printf("Function not supported in PMD driver\n");
+		fprintf(stderr, "Function not supported in PMD driver\n");
 	close_file(pkg);
 }
 
@@ -14629,7 +14709,7 @@ cmd_ddp_get_list_parsed(
 	size = PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4;
 	p_list = (struct rte_pmd_i40e_profile_list *)malloc(size);
 	if (!p_list) {
-		printf("%s: Failed to malloc buffer\n", __func__);
+		fprintf(stderr, "%s: Failed to malloc buffer\n", __func__);
 		return;
 	}
 
@@ -14658,7 +14738,7 @@ cmd_ddp_get_list_parsed(
 #endif
 
 	if (ret < 0)
-		printf("Failed to get ddp list\n");
+		fprintf(stderr, "Failed to get ddp list\n");
 }
 
 cmdline_parse_inst_t cmd_ddp_get_list = {
@@ -14701,7 +14781,7 @@ cmd_cfg_input_set_parsed(
 	int ret = -ENOTSUP;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
@@ -14715,7 +14795,7 @@ cmd_cfg_input_set_parsed(
 	ret = rte_pmd_i40e_inset_get(res->port_id, res->pctype_id,
 				     &inset, inset_type);
 	if (ret) {
-		printf("Failed to get input set.\n");
+		fprintf(stderr, "Failed to get input set.\n");
 		return;
 	}
 
@@ -14734,20 +14814,20 @@ cmd_cfg_input_set_parsed(
 		ret = rte_pmd_i40e_inset_field_clear(&inset.inset,
 						     res->field_idx);
 	if (ret) {
-		printf("Failed to configure input set field.\n");
+		fprintf(stderr, "Failed to configure input set field.\n");
 		return;
 	}
 
 	ret = rte_pmd_i40e_inset_set(res->port_id, res->pctype_id,
 				     &inset, inset_type);
 	if (ret) {
-		printf("Failed to set input set.\n");
+		fprintf(stderr, "Failed to set input set.\n");
 		return;
 	}
 #endif
 
 	if (ret == -ENOTSUP)
-		printf("Function not supported\n");
+		fprintf(stderr, "Function not supported\n");
 }
 
 cmdline_parse_token_string_t cmd_cfg_input_set_port =
@@ -14824,7 +14904,7 @@ cmd_clear_input_set_parsed(
 	int ret = -ENOTSUP;
 
 	if (!all_ports_stopped()) {
-		printf("Please stop all ports first\n");
+		fprintf(stderr, "Please stop all ports first\n");
 		return;
 	}
 
@@ -14841,14 +14921,14 @@ cmd_clear_input_set_parsed(
 	ret = rte_pmd_i40e_inset_set(res->port_id, res->pctype_id,
 				     &inset, inset_type);
 	if (ret) {
-		printf("Failed to clear input set.\n");
+		fprintf(stderr, "Failed to clear input set.\n");
 		return;
 	}
 
 #endif
 
 	if (ret == -ENOTSUP)
-		printf("Function not supported\n");
+		fprintf(stderr, "Function not supported\n");
 }
 
 cmdline_parse_token_string_t cmd_clear_input_set_port =
@@ -14961,16 +15041,16 @@ cmd_show_vf_stats_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d\n", res->vf_id);
+		fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 
 	printf("\n  %s NIC statistics for port %-2d vf %-2d %s\n",
@@ -15064,16 +15144,16 @@ cmd_clear_vf_stats_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid vf_id %d\n", res->vf_id);
+		fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -15149,13 +15229,13 @@ cmd_pctype_mapping_reset_parsed(
 	case 0:
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -15232,13 +15312,13 @@ cmd_pctype_mapping_get_parsed(
 	case 0:
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		return;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		return;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 		return;
 	}
 
@@ -15357,16 +15437,16 @@ cmd_pctype_mapping_update_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid pctype or flow type\n");
+		fprintf(stderr, "invalid pctype or flow type\n");
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -15451,13 +15531,13 @@ cmd_ptype_mapping_get_parsed(
 	case 0:
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 
 #ifdef RTE_NET_I40E
@@ -15549,17 +15629,17 @@ cmd_ptype_mapping_replace_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid ptype 0x%8x or 0x%8x\n",
-				res->target, res->pkt_type);
+		fprintf(stderr, "invalid ptype 0x%8x or 0x%8x\n",
+			res->target, res->pkt_type);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -15628,13 +15708,13 @@ cmd_ptype_mapping_reset_parsed(
 	case 0:
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -15716,16 +15796,16 @@ cmd_ptype_mapping_update_parsed(
 	case 0:
 		break;
 	case -EINVAL:
-		printf("invalid ptype 0x%8x\n", res->sw_ptype);
+		fprintf(stderr, "invalid ptype 0x%8x\n", res->sw_ptype);
 		break;
 	case -ENODEV:
-		printf("invalid port_id %d\n", res->port_id);
+		fprintf(stderr, "invalid port_id %d\n", res->port_id);
 		break;
 	case -ENOTSUP:
-		printf("function not implemented\n");
+		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 	}
 }
 
@@ -16034,14 +16114,15 @@ cmd_config_per_port_rx_offload_parsed(void *parsed_result,
 	int ret;
 
 	if (port->port_status != RTE_PORT_STOPPED) {
-		printf("Error: Can't config offload when Port %d "
-		       "is not stopped\n", port_id);
+		fprintf(stderr,
+			"Error: Can't config offload when Port %d is not stopped\n",
+			port_id);
 		return;
 	}
 
 	single_offload = search_rx_offload(res->offload);
 	if (single_offload == 0) {
-		printf("Unknown offload name: %s\n", res->offload);
+		fprintf(stderr, "Unknown offload name: %s\n", res->offload);
 		return;
 	}
 
@@ -16139,8 +16220,9 @@ cmd_config_per_queue_rx_offload_parsed(void *parsed_result,
 	int ret;
 
 	if (port->port_status != RTE_PORT_STOPPED) {
-		printf("Error: Can't config offload when Port %d "
-		       "is not stopped\n", port_id);
+		fprintf(stderr,
+			"Error: Can't config offload when Port %d is not stopped\n",
+			port_id);
 		return;
 	}
 
@@ -16149,14 +16231,15 @@ cmd_config_per_queue_rx_offload_parsed(void *parsed_result,
 		return;
 
 	if (queue_id >= dev_info.nb_rx_queues) {
-		printf("Error: input queue_id should be 0 ... "
-		       "%d\n", dev_info.nb_rx_queues - 1);
+		fprintf(stderr,
+			"Error: input queue_id should be 0 ... %d\n",
+			dev_info.nb_rx_queues - 1);
 		return;
 	}
 
 	single_offload = search_rx_offload(res->offload);
 	if (single_offload == 0) {
-		printf("Unknown offload name: %s\n", res->offload);
+		fprintf(stderr, "Unknown offload name: %s\n", res->offload);
 		return;
 	}
 
@@ -16449,14 +16532,15 @@ cmd_config_per_port_tx_offload_parsed(void *parsed_result,
 	int ret;
 
 	if (port->port_status != RTE_PORT_STOPPED) {
-		printf("Error: Can't config offload when Port %d "
-		       "is not stopped\n", port_id);
+		fprintf(stderr,
+			"Error: Can't config offload when Port %d is not stopped\n",
+			port_id);
 		return;
 	}
 
 	single_offload = search_tx_offload(res->offload);
 	if (single_offload == 0) {
-		printf("Unknown offload name: %s\n", res->offload);
+		fprintf(stderr, "Unknown offload name: %s\n", res->offload);
 		return;
 	}
 
@@ -16557,8 +16641,9 @@ cmd_config_per_queue_tx_offload_parsed(void *parsed_result,
 	int ret;
 
 	if (port->port_status != RTE_PORT_STOPPED) {
-		printf("Error: Can't config offload when Port %d "
-		       "is not stopped\n", port_id);
+		fprintf(stderr,
+			"Error: Can't config offload when Port %d is not stopped\n",
+			port_id);
 		return;
 	}
 
@@ -16567,14 +16652,15 @@ cmd_config_per_queue_tx_offload_parsed(void *parsed_result,
 		return;
 
 	if (queue_id >= dev_info.nb_tx_queues) {
-		printf("Error: input queue_id should be 0 ... "
-		       "%d\n", dev_info.nb_tx_queues - 1);
+		fprintf(stderr,
+			"Error: input queue_id should be 0 ... %d\n",
+			dev_info.nb_tx_queues - 1);
 		return;
 	}
 
 	single_offload = search_tx_offload(res->offload);
 	if (single_offload == 0) {
-		printf("Unknown offload name: %s\n", res->offload);
+		fprintf(stderr, "Unknown offload name: %s\n", res->offload);
 		return;
 	}
 
@@ -16691,13 +16777,13 @@ cmd_config_dynf_specific_parsed(void *parsed_result,
 	if (flag <= 0) {
 		if (strlcpy(desc_flag.name, res->name,
 			    RTE_MBUF_DYN_NAMESIZE) >= RTE_MBUF_DYN_NAMESIZE) {
-			printf("Flag name too long\n");
+			fprintf(stderr, "Flag name too long\n");
 			return;
 		}
 		desc_flag.flags = 0;
 		flag = rte_mbuf_dynflag_register(&desc_flag);
 		if (flag < 0) {
-			printf("Can't register flag\n");
+			fprintf(stderr, "Can't register flag\n");
 			return;
 		}
 		strcpy(dynf_names[flag], desc_flag.name);
@@ -16764,7 +16850,7 @@ cmd_show_tx_metadata_parsed(void *parsed_result,
 	struct cmd_show_tx_metadata_result *res = parsed_result;
 
 	if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
-		printf("invalid port id %u\n", res->cmd_pid);
+		fprintf(stderr, "invalid port id %u\n", res->cmd_pid);
 		return;
 	}
 	if (!strcmp(res->cmd_keyword, "tx_metadata")) {
@@ -16819,29 +16905,29 @@ cmd_show_fec_capability_parsed(void *parsed_result,
 	int ret;
 
 	if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
-		printf("Invalid port id %u\n", res->cmd_pid);
+		fprintf(stderr, "Invalid port id %u\n", res->cmd_pid);
 		return;
 	}
 
 	ret = rte_eth_fec_get_capability(res->cmd_pid, NULL, 0);
 	if (ret == -ENOTSUP) {
-		printf("Function not implemented\n");
+		fprintf(stderr, "Function not implemented\n");
 		return;
 	} else if (ret < 0) {
-		printf("Get FEC capability failed: %d\n", ret);
+		fprintf(stderr, "Get FEC capability failed: %d\n", ret);
 		return;
 	}
 
 	num = (unsigned int)ret;
 	speed_fec_capa = calloc(num, sizeof(*speed_fec_capa));
 	if (speed_fec_capa == NULL) {
-		printf("Failed to alloc FEC capability buffer\n");
+		fprintf(stderr, "Failed to alloc FEC capability buffer\n");
 		return;
 	}
 
 	ret = rte_eth_fec_get_capability(res->cmd_pid, speed_fec_capa, num);
 	if (ret < 0) {
-		printf("Error getting FEC capability: %d\n", ret);
+		fprintf(stderr, "Error getting FEC capability: %d\n", ret);
 		goto out;
 	}
 
@@ -16900,15 +16986,15 @@ cmd_show_fec_mode_parsed(void *parsed_result,
 	int ret;
 
 	if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
-		printf("Invalid port id %u\n", res->cmd_pid);
+		fprintf(stderr, "Invalid port id %u\n", res->cmd_pid);
 		return;
 	}
 	ret = rte_eth_fec_get(res->cmd_pid, &mode);
 	if (ret == -ENOTSUP) {
-		printf("Function not implemented\n");
+		fprintf(stderr, "Function not implemented\n");
 		return;
 	} else if (ret < 0) {
-		printf("Get FEC mode failed\n");
+		fprintf(stderr, "Get FEC mode failed\n");
 		return;
 	}
 
@@ -17002,17 +17088,17 @@ cmd_set_port_fec_mode_parsed(
 
 	ret = parse_fec_mode(res->fec_value, &mode);
 	if (ret < 0) {
-		printf("Unknown fec mode: %s for Port %d\n", res->fec_value,
-			port_id);
+		fprintf(stderr, "Unknown fec mode: %s for Port %d\n",
+			res->fec_value, port_id);
 		return;
 	}
 
 	ret = rte_eth_fec_set(port_id, mode);
 	if (ret == -ENOTSUP) {
-		printf("Function not implemented\n");
+		fprintf(stderr, "Function not implemented\n");
 		return;
 	} else if (ret < 0) {
-		printf("Set FEC mode failed\n");
+		fprintf(stderr, "Set FEC mode failed\n");
 		return;
 	}
 }
@@ -17160,7 +17246,7 @@ cmd_show_rx_tx_desc_status_parsed(void *parsed_result,
 	int rc;
 
 	if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
-		printf("invalid port id %u\n", res->cmd_pid);
+		fprintf(stderr, "invalid port id %u\n", res->cmd_pid);
 		return;
 	}
 
@@ -17168,8 +17254,9 @@ cmd_show_rx_tx_desc_status_parsed(void *parsed_result,
 		rc = rte_eth_rx_descriptor_status(res->cmd_pid, res->cmd_qid,
 					     res->cmd_did);
 		if (rc < 0) {
-			printf("Invalid input: queue id = %d, desc id = %d\n",
-			       res->cmd_qid, res->cmd_did);
+			fprintf(stderr,
+				"Invalid input: queue id = %d, desc id = %d\n",
+				res->cmd_qid, res->cmd_did);
 			return;
 		}
 		if (rc == RTE_ETH_RX_DESC_AVAIL)
@@ -17182,8 +17269,9 @@ cmd_show_rx_tx_desc_status_parsed(void *parsed_result,
 		rc = rte_eth_tx_descriptor_status(res->cmd_pid, res->cmd_qid,
 					     res->cmd_did);
 		if (rc < 0) {
-			printf("Invalid input: queue id = %d, desc id = %d\n",
-			       res->cmd_qid, res->cmd_did);
+			fprintf(stderr,
+				"Invalid input: queue id = %d, desc id = %d\n",
+				res->cmd_qid, res->cmd_did);
 			return;
 		}
 		if (rc == RTE_ETH_TX_DESC_FULL)
@@ -17258,13 +17346,13 @@ cmd_show_rx_queue_desc_used_count_parsed(void *parsed_result,
 	int rc;
 
 	if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
-		printf("invalid port id %u\n", res->cmd_pid);
+		fprintf(stderr, "invalid port id %u\n", res->cmd_pid);
 		return;
 	}
 
 	rc = rte_eth_rx_queue_count(res->cmd_pid, res->cmd_qid);
 	if (rc < 0) {
-		printf("Invalid queueid = %d\n", res->cmd_qid);
+		fprintf(stderr, "Invalid queueid = %d\n", res->cmd_qid);
 		return;
 	}
 	printf("Used desc count = %d\n", rc);
@@ -17366,7 +17454,8 @@ cmd_set_port_ptypes_parsed(
 	ret = rte_eth_dev_get_supported_ptypes(port_id, RTE_PTYPE_ALL_MASK,
 					       NULL, 0);
 	if (ret <= 0) {
-		printf("Port %d doesn't support any ptypes.\n", port_id);
+		fprintf(stderr, "Port %d doesn't support any ptypes.\n",
+			port_id);
 		return;
 	}
 
@@ -17374,7 +17463,8 @@ cmd_set_port_ptypes_parsed(
 
 	ret = rte_eth_dev_set_ptypes(port_id, ptype_mask, ptypes, ret);
 	if (ret < 0) {
-		printf("Unable to set requested ptypes for Port %d\n", port_id);
+		fprintf(stderr, "Unable to set requested ptypes for Port %d\n",
+			port_id);
 		return;
 	}
 
@@ -17741,8 +17831,9 @@ cmdline_read_from_file(const char *filename)
 
 	cl = cmdline_file_new(main_ctx, "testpmd> ", filename);
 	if (cl == NULL) {
-		printf("Failed to create file based cmdline context: %s\n",
-		       filename);
+		fprintf(stderr,
+			"Failed to create file based cmdline context: %s\n",
+			filename);
 		return;
 	}
 
@@ -17769,7 +17860,7 @@ prompt(void)
 
 	ret = atexit(prompt_exit);
 	if (ret != 0)
-		printf("Cannot set exit function for cmdline\n");
+		fprintf(stderr, "Cannot set exit function for cmdline\n");
 
 	cmdline_interact(testpmd_cl);
 	if (ret != 0)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 1c587bb7b8..d21e458cd1 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -8352,7 +8352,7 @@ cmd_set_raw_parsed_sample(const struct buffer *in)
 			action->conf = &sample_nvgre_encap[idx];
 			break;
 		default:
-			printf("Error - Not supported action\n");
+			fprintf(stderr, "Error - Not supported action\n");
 			return;
 		}
 		rte_memcpy(data, action, sizeof(struct rte_flow_action));
@@ -8477,13 +8477,15 @@ cmd_set_raw_parsed(const struct buffer *in)
 				break;
 			}
 			if (gtp_psc != i + 1) {
-				printf("Error - GTP PSC does not follow GTP\n");
+				fprintf(stderr,
+					"Error - GTP PSC does not follow GTP\n");
 				goto error;
 			}
 			gtp = item->spec;
 			if ((gtp->v_pt_rsv_flags & 0x07) != 0x04) {
 				/* Only E flag should be set. */
-				printf("Error - GTP unsupported flags\n");
+				fprintf(stderr,
+					"Error - GTP unsupported flags\n");
 				goto error;
 			} else {
 				struct rte_gtp_hdr_ext_word ext_word = {
@@ -8499,7 +8501,8 @@ cmd_set_raw_parsed(const struct buffer *in)
 			break;
 		case RTE_FLOW_ITEM_TYPE_GTP_PSC:
 			if (gtp_psc >= 0) {
-				printf("Error - Multiple GTP PSC items\n");
+				fprintf(stderr,
+					"Error - Multiple GTP PSC items\n");
 				goto error;
 			} else {
 				const struct rte_flow_item_gtp_psc
@@ -8513,8 +8516,8 @@ cmd_set_raw_parsed(const struct buffer *in)
 
 				if (opt->pdu_type & 0x0F) {
 					/* Support the minimal option only. */
-					printf("Error - GTP PSC option with "
-					       "extra fields not supported\n");
+					fprintf(stderr,
+						"Error - GTP PSC option with extra fields not supported\n");
 					goto error;
 				}
 				psc.len = sizeof(psc);
@@ -8532,7 +8535,7 @@ cmd_set_raw_parsed(const struct buffer *in)
 			size = sizeof(struct rte_flow_item_pfcp);
 			break;
 		default:
-			printf("Error - Not supported item\n");
+			fprintf(stderr, "Error - Not supported item\n");
 			goto error;
 		}
 		*total_size += size;
@@ -8660,7 +8663,8 @@ cmd_show_set_raw_parsed(void *parsed_result, struct cmdline *cl, void *data)
 		all = 1;
 		index = 0;
 	} else if (index >= RAW_ENCAP_CONFS_MAX_NUM) {
-		printf("index should be 0-%u\n", RAW_ENCAP_CONFS_MAX_NUM - 1);
+		fprintf(stderr, "index should be 0-%u\n",
+			RAW_ENCAP_CONFS_MAX_NUM - 1);
 		return;
 	}
 	do {
diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index eff2473e7b..b5dcfdadcf 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -53,7 +53,8 @@ print_err_msg(struct rte_mtr_error *error)
 	if (error->cause)
 		snprintf(buf, sizeof(buf), "cause: %p, ", error->cause);
 
-	printf("%s: %s%s (error %d)\n", errstr, error->cause ? buf : "",
+	fprintf(stderr, "%s: %s%s (error %d)\n",
+		errstr, error->cause ? buf : "",
 		error->message ? error->message : "(no stated reason)",
 		error->type);
 }
@@ -791,7 +792,8 @@ static void cmd_create_port_meter_parsed(void *parsed_result,
 	/* Parse meter input color string params */
 	ret = parse_meter_color_str(c_str, &use_prev_meter_color, &dscp_table);
 	if (ret) {
-		printf(" Meter input color params string parse error\n");
+		fprintf(stderr,
+			" Meter input color params string parse error\n");
 		return;
 	}
 
@@ -1199,7 +1201,7 @@ static void cmd_set_port_meter_dscp_table_parsed(void *parsed_result,
 	/* Parse string */
 	ret = parse_multi_token_string(t_str, &port_id, &mtr_id, &dscp_table);
 	if (ret) {
-		printf(" Multi token string parse error\n");
+		fprintf(stderr, " Multi token string parse error\n");
 		return;
 	}
 
diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index 9978226573..bfbd43ca9b 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -97,7 +97,8 @@ print_err_msg(struct rte_tm_error *error)
 	if (error->cause)
 		snprintf(buf, sizeof(buf), "cause: %p, ", error->cause);
 
-	printf("%s: %s%s (error %d)\n", errstr, error->cause ? buf : "",
+	fprintf(stderr, "%s: %s%s (error %d)\n",
+		errstr, error->cause ? buf : "",
 		error->message ? error->message : "(no stated reason)",
 		error->type);
 }
@@ -174,7 +175,8 @@ parse_multi_ss_id_str(char *s_str, uint32_t *n_ssp, uint32_t shaper_id[])
 
 	/* Check: num of shared shaper */
 	if (n_shared_shapers >= MAX_NUM_SHARED_SHAPERS) {
-		printf(" Number of shared shapers exceed the max (error)\n");
+		fprintf(stderr,
+			" Number of shared shapers exceed the max (error)\n");
 		return -1;
 	}
 
@@ -670,7 +672,7 @@ static void cmd_show_port_tm_node_stats_parsed(void *parsed_result,
 	memset(&error, 0, sizeof(struct rte_tm_error));
 	/* Port status */
 	if (!port_is_started(port_id)) {
-		printf(" Port %u not started (error)\n", port_id);
+		fprintf(stderr, " Port %u not started (error)\n", port_id);
 		return;
 	}
 
@@ -1085,14 +1087,14 @@ static void cmd_add_port_tm_node_shared_shaper_parsed(void *parsed_result,
 	/* Command type: add */
 	if ((strcmp(res->cmd_type, "add") == 0) &&
 		(port_is_started(port_id))) {
-		printf(" Port %u not stopped (error)\n", port_id);
+		fprintf(stderr, " Port %u not stopped (error)\n", port_id);
 		return;
 	}
 
 	/* Command type: set (update) */
 	if ((strcmp(res->cmd_type, "set") == 0) &&
 		(!port_is_started(port_id))) {
-		printf(" Port %u not started (error)\n", port_id);
+		fprintf(stderr, " Port %u not started (error)\n", port_id);
 		return;
 	}
 
@@ -1539,7 +1541,7 @@ static void cmd_set_port_tm_node_shaper_profile_parsed(void *parsed_result,
 	memset(&error, 0, sizeof(struct rte_tm_error));
 	/* Port status */
 	if (!port_is_started(port_id)) {
-		printf(" Port %u not started (error)\n", port_id);
+		fprintf(stderr, " Port %u not started (error)\n", port_id);
 		return;
 	}
 
@@ -1664,14 +1666,15 @@ static void cmd_add_port_tm_nonleaf_node_parsed(void *parsed_result,
 	shared_shaper_id = (uint32_t *)malloc(MAX_NUM_SHARED_SHAPERS *
 		sizeof(uint32_t));
 	if (shared_shaper_id == NULL) {
-		printf(" Memory not allocated for shared shapers (error)\n");
+		fprintf(stderr,
+			" Memory not allocated for shared shapers (error)\n");
 		return;
 	}
 
 	/* Parse multi shared shaper id string */
 	ret = parse_multi_ss_id_str(s_str, &n_shared_shapers, shared_shaper_id);
 	if (ret) {
-		printf(" Shared shapers params string parse error\n");
+		fprintf(stderr, " Shared shapers params string parse error\n");
 		free(shared_shaper_id);
 		return;
 	}
@@ -1827,14 +1830,15 @@ static void cmd_add_port_tm_nonleaf_node_pmode_parsed(void *parsed_result,
 	shared_shaper_id = (uint32_t *)malloc(MAX_NUM_SHARED_SHAPERS *
 		sizeof(uint32_t));
 	if (shared_shaper_id == NULL) {
-		printf(" Memory not allocated for shared shapers (error)\n");
+		fprintf(stderr,
+			" Memory not allocated for shared shapers (error)\n");
 		return;
 	}
 
 	/* Parse multi shared shaper id string */
 	ret = parse_multi_ss_id_str(s_str, &n_shared_shapers, shared_shaper_id);
 	if (ret) {
-		printf(" Shared shapers params string parse error\n");
+		fprintf(stderr, " Shared shapers params string parse error\n");
 		free(shared_shaper_id);
 		return;
 	}
@@ -1991,14 +1995,15 @@ static void cmd_add_port_tm_leaf_node_parsed(void *parsed_result,
 	shared_shaper_id = (uint32_t *)malloc(MAX_NUM_SHARED_SHAPERS *
 		sizeof(uint32_t));
 	if (shared_shaper_id == NULL) {
-		printf(" Memory not allocated for shared shapers (error)\n");
+		fprintf(stderr,
+			" Memory not allocated for shared shapers (error)\n");
 		return;
 	}
 
 	/* Parse multi shared shaper id string */
 	ret = parse_multi_ss_id_str(s_str, &n_shared_shapers, shared_shaper_id);
 	if (ret) {
-		printf(" Shared shapers params string parse error\n");
+		fprintf(stderr, " Shared shapers params string parse error\n");
 		free(shared_shaper_id);
 		return;
 	}
@@ -2101,7 +2106,7 @@ static void cmd_del_port_tm_node_parsed(void *parsed_result,
 	memset(&error, 0, sizeof(struct rte_tm_error));
 	/* Port status */
 	if (port_is_started(port_id)) {
-		printf(" Port %u not stopped (error)\n", port_id);
+		fprintf(stderr, " Port %u not stopped (error)\n", port_id);
 		return;
 	}
 
@@ -2193,7 +2198,7 @@ static void cmd_set_port_tm_node_parent_parsed(void *parsed_result,
 	memset(&error, 0, sizeof(struct rte_tm_error));
 	/* Port status */
 	if (!port_is_started(port_id)) {
-		printf(" Port %u not started (error)\n", port_id);
+		fprintf(stderr, " Port %u not started (error)\n", port_id);
 		return;
 	}
 
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 43c79b5021..7b336eb878 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -259,8 +259,9 @@ nic_stats_clear(portid_t port_id)
 
 	ret = rte_eth_stats_reset(port_id);
 	if (ret != 0) {
-		printf("%s: Error: failed to reset stats (port %u): %s",
-		       __func__, port_id, strerror(-ret));
+		fprintf(stderr,
+			"%s: Error: failed to reset stats (port %u): %s",
+			__func__, port_id, strerror(-ret));
 		return;
 	}
 
@@ -268,8 +269,9 @@ nic_stats_clear(portid_t port_id)
 	if (ret != 0) {
 		if (ret < 0)
 			ret = -ret;
-		printf("%s: Error: failed to get stats (port %u): %s",
-		       __func__, port_id, strerror(ret));
+		fprintf(stderr,
+			"%s: Error: failed to get stats (port %u): %s",
+			__func__, port_id, strerror(ret));
 		return;
 	}
 	printf("\n  NIC statistics for port %d cleared\n", port_id);
@@ -295,19 +297,19 @@ nic_xstats_display(portid_t port_id)
 	/* Get count */
 	cnt_xstats = rte_eth_xstats_get_names(port_id, NULL, 0);
 	if (cnt_xstats  < 0) {
-		printf("Error: Cannot get count of xstats\n");
+		fprintf(stderr, "Error: Cannot get count of xstats\n");
 		return;
 	}
 
 	/* Get id-name lookup table */
 	xstats_names = malloc(sizeof(struct rte_eth_xstat_name) * cnt_xstats);
 	if (xstats_names == NULL) {
-		printf("Cannot allocate memory for xstats lookup\n");
+		fprintf(stderr, "Cannot allocate memory for xstats lookup\n");
 		return;
 	}
 	if (cnt_xstats != rte_eth_xstats_get_names(
 			port_id, xstats_names, cnt_xstats)) {
-		printf("Error: Cannot get xstats lookup\n");
+		fprintf(stderr, "Error: Cannot get xstats lookup\n");
 		free(xstats_names);
 		return;
 	}
@@ -315,12 +317,12 @@ nic_xstats_display(portid_t port_id)
 	/* Get stats themselves */
 	xstats = malloc(sizeof(struct rte_eth_xstat) * cnt_xstats);
 	if (xstats == NULL) {
-		printf("Cannot allocate memory for xstats\n");
+		fprintf(stderr, "Cannot allocate memory for xstats\n");
 		free(xstats_names);
 		return;
 	}
 	if (cnt_xstats != rte_eth_xstats_get(port_id, xstats, cnt_xstats)) {
-		printf("Error: Unable to get xstats\n");
+		fprintf(stderr, "Error: Unable to get xstats\n");
 		free(xstats_names);
 		free(xstats);
 		return;
@@ -350,8 +352,9 @@ nic_xstats_clear(portid_t port_id)
 
 	ret = rte_eth_xstats_reset(port_id);
 	if (ret != 0) {
-		printf("%s: Error: failed to reset xstats (port %u): %s",
-		       __func__, port_id, strerror(-ret));
+		fprintf(stderr,
+			"%s: Error: failed to reset xstats (port %u): %s\n",
+			__func__, port_id, strerror(-ret));
 		return;
 	}
 
@@ -359,8 +362,8 @@ nic_xstats_clear(portid_t port_id)
 	if (ret != 0) {
 		if (ret < 0)
 			ret = -ret;
-		printf("%s: Error: failed to get stats (port %u): %s",
-		       __func__, port_id, strerror(ret));
+		fprintf(stderr, "%s: Error: failed to get stats (port %u): %s",
+			__func__, port_id, strerror(ret));
 		return;
 	}
 }
@@ -388,8 +391,8 @@ rx_queue_infos_display(portid_t port_id, uint16_t queue_id)
 
 	rc = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo);
 	if (rc != 0) {
-		printf("Failed to retrieve information for port: %u, "
-			"RX queue: %hu\nerror desc: %s(%d)\n",
+		fprintf(stderr,
+			"Failed to retrieve information for port: %u, RX queue: %hu\nerror desc: %s(%d)\n",
 			port_id, queue_id, strerror(-rc), rc);
 		return;
 	}
@@ -432,8 +435,8 @@ tx_queue_infos_display(portid_t port_id, uint16_t queue_id)
 
 	rc = rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo);
 	if (rc != 0) {
-		printf("Failed to retrieve information for port: %u, "
-			"TX queue: %hu\nerror desc: %s(%d)\n",
+		fprintf(stderr,
+			"Failed to retrieve information for port: %u, TX queue: %hu\nerror desc: %s(%d)\n",
 			port_id, queue_id, strerror(-rc), rc);
 		return;
 	}
@@ -526,7 +529,7 @@ device_infos_display(const char *identifier)
 		goto skip_parse;
 
 	if (rte_devargs_parsef(&da, "%s", identifier)) {
-		printf("cannot parse identifier\n");
+		fprintf(stderr, "cannot parse identifier\n");
 		return;
 	}
 
@@ -801,16 +804,17 @@ port_eeprom_display(portid_t port_id)
 	if (len_eeprom < 0) {
 		switch (len_eeprom) {
 		case -ENODEV:
-			printf("port index %d invalid\n", port_id);
+			fprintf(stderr, "port index %d invalid\n", port_id);
 			break;
 		case -ENOTSUP:
-			printf("operation not supported by device\n");
+			fprintf(stderr, "operation not supported by device\n");
 			break;
 		case -EIO:
-			printf("device is removed\n");
+			fprintf(stderr, "device is removed\n");
 			break;
 		default:
-			printf("Unable to get EEPROM: %d\n", len_eeprom);
+			fprintf(stderr, "Unable to get EEPROM: %d\n",
+				len_eeprom);
 			break;
 		}
 		return;
@@ -825,16 +829,16 @@ port_eeprom_display(portid_t port_id)
 	if (ret != 0) {
 		switch (ret) {
 		case -ENODEV:
-			printf("port index %d invalid\n", port_id);
+			fprintf(stderr, "port index %d invalid\n", port_id);
 			break;
 		case -ENOTSUP:
-			printf("operation not supported by device\n");
+			fprintf(stderr, "operation not supported by device\n");
 			break;
 		case -EIO:
-			printf("device is removed\n");
+			fprintf(stderr, "device is removed\n");
 			break;
 		default:
-			printf("Unable to get EEPROM: %d\n", ret);
+			fprintf(stderr, "Unable to get EEPROM: %d\n", ret);
 			break;
 		}
 		return;
@@ -860,16 +864,17 @@ port_module_eeprom_display(portid_t port_id)
 	if (ret != 0) {
 		switch (ret) {
 		case -ENODEV:
-			printf("port index %d invalid\n", port_id);
+			fprintf(stderr, "port index %d invalid\n", port_id);
 			break;
 		case -ENOTSUP:
-			printf("operation not supported by device\n");
+			fprintf(stderr, "operation not supported by device\n");
 			break;
 		case -EIO:
-			printf("device is removed\n");
+			fprintf(stderr, "device is removed\n");
 			break;
 		default:
-			printf("Unable to get module EEPROM: %d\n", ret);
+			fprintf(stderr, "Unable to get module EEPROM: %d\n",
+				ret);
 			break;
 		}
 		return;
@@ -884,16 +889,17 @@ port_module_eeprom_display(portid_t port_id)
 	if (ret != 0) {
 		switch (ret) {
 		case -ENODEV:
-			printf("port index %d invalid\n", port_id);
+			fprintf(stderr, "port index %d invalid\n", port_id);
 			break;
 		case -ENOTSUP:
-			printf("operation not supported by device\n");
+			fprintf(stderr, "operation not supported by device\n");
 			break;
 		case -EIO:
-			printf("device is removed\n");
+			fprintf(stderr, "device is removed\n");
 			break;
 		default:
-			printf("Unable to get module EEPROM: %d\n", ret);
+			fprintf(stderr, "Unable to get module EEPROM: %d\n",
+				ret);
 			break;
 		}
 		return;
@@ -916,7 +922,7 @@ port_id_is_invalid(portid_t port_id, enum print_warning warning)
 			return 0;
 
 	if (warning == ENABLED_WARN)
-		printf("Invalid port %d\n", port_id);
+		fprintf(stderr, "Invalid port %d\n", port_id);
 
 	return 1;
 }
@@ -937,7 +943,7 @@ vlan_id_is_invalid(uint16_t vlan_id)
 {
 	if (vlan_id < 4096)
 		return 0;
-	printf("Invalid vlan_id %d (must be < 4096)\n", vlan_id);
+	fprintf(stderr, "Invalid vlan_id %d (must be < 4096)\n", vlan_id);
 	return 1;
 }
 
@@ -949,14 +955,14 @@ port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
 	uint64_t pci_len;
 
 	if (reg_off & 0x3) {
-		printf("Port register offset 0x%X not aligned on a 4-byte "
-		       "boundary\n",
-		       (unsigned)reg_off);
+		fprintf(stderr,
+			"Port register offset 0x%X not aligned on a 4-byte boundary\n",
+			(unsigned)reg_off);
 		return 1;
 	}
 
 	if (!ports[port_id].dev_info.device) {
-		printf("Invalid device\n");
+		fprintf(stderr, "Invalid device\n");
 		return 0;
 	}
 
@@ -964,15 +970,15 @@ port_reg_off_is_invalid(portid_t port_id, uint32_t reg_off)
 	if (bus && !strcmp(bus->name, "pci")) {
 		pci_dev = RTE_DEV_TO_PCI(ports[port_id].dev_info.device);
 	} else {
-		printf("Not a PCI device\n");
+		fprintf(stderr, "Not a PCI device\n");
 		return 1;
 	}
 
 	pci_len = pci_dev->mem_resource[0].len;
 	if (reg_off >= pci_len) {
-		printf("Port %d: register offset %u (0x%X) out of port PCI "
-		       "resource (length=%"PRIu64")\n",
-		       port_id, (unsigned)reg_off, (unsigned)reg_off,  pci_len);
+		fprintf(stderr,
+			"Port %d: register offset %u (0x%X) out of port PCI resource (length=%"PRIu64")\n",
+			port_id, (unsigned)reg_off, (unsigned)reg_off, pci_len);
 		return 1;
 	}
 	return 0;
@@ -983,7 +989,7 @@ reg_bit_pos_is_invalid(uint8_t bit_pos)
 {
 	if (bit_pos <= 31)
 		return 0;
-	printf("Invalid bit position %d (must be <= 31)\n", bit_pos);
+	fprintf(stderr, "Invalid bit position %d (must be <= 31)\n", bit_pos);
 	return 1;
 }
 
@@ -1070,7 +1076,8 @@ port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
 	if (reg_bit_pos_is_invalid(bit_pos))
 		return;
 	if (bit_v > 1) {
-		printf("Invalid bit value %d (must be 0 or 1)\n", (int) bit_v);
+		fprintf(stderr, "Invalid bit value %d (must be 0 or 1)\n",
+			(int) bit_v);
 		return;
 	}
 	reg_v = port_id_pci_reg_read(port_id, reg_off);
@@ -1110,7 +1117,7 @@ port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
 		max_v = 0xFFFFFFFF;
 
 	if (value > max_v) {
-		printf("Invalid value %u (0x%x) must be < %u (0x%x)\n",
+		fprintf(stderr, "Invalid value %u (0x%x) must be < %u (0x%x)\n",
 				(unsigned)value, (unsigned)value,
 				(unsigned)max_v, (unsigned)max_v);
 		return;
@@ -1150,13 +1157,14 @@ port_mtu_set(portid_t port_id, uint16_t mtu)
 		return;
 
 	if (mtu > dev_info.max_mtu || mtu < dev_info.min_mtu) {
-		printf("Set MTU failed. MTU:%u is not in valid range, min:%u - max:%u\n",
+		fprintf(stderr,
+			"Set MTU failed. MTU:%u is not in valid range, min:%u - max:%u\n",
 			mtu, dev_info.min_mtu, dev_info.max_mtu);
 		return;
 	}
 	diag = rte_eth_dev_set_mtu(port_id, mtu);
 	if (diag)
-		printf("Set MTU failed. diag=%d\n", diag);
+		fprintf(stderr, "Set MTU failed. diag=%d\n", diag);
 	else if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_JUMBO_FRAME) {
 		/*
 		 * Ether overhead in driver is equal to the difference of
@@ -1264,7 +1272,8 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
 	if (!strcmp(ops->type, "vxlan"))
 		type = RTE_FLOW_ITEM_TYPE_VXLAN;
 	else {
-		printf("cannot offload \"%s\" tunnel type\n", ops->type);
+		fprintf(stderr, "cannot offload \"%s\" tunnel type\n",
+			ops->type);
 		return;
 	}
 	LIST_FOREACH(flt, &port->flow_tunnel_list, chain) {
@@ -1274,7 +1283,7 @@ void port_flow_tunnel_create(portid_t port_id, const struct tunnel_ops *ops)
 	if (!flt) {
 		flt = calloc(1, sizeof(*flt));
 		if (!flt) {
-			printf("failed to allocate port flt object\n");
+			fprintf(stderr, "failed to allocate port flt object\n");
 			return;
 		}
 		flt->tunnel.type = type;
@@ -1350,12 +1359,12 @@ port_flow_complain(struct rte_flow_error *error)
 		errstr = "unknown type";
 	else
 		errstr = errstrlist[error->type];
-	printf("%s(): Caught PMD error type %d (%s): %s%s: %s\n", __func__,
-	       error->type, errstr,
-	       error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
-					error->cause), buf) : "",
-	       error->message ? error->message : "(no stated reason)",
-	       rte_strerror(err));
+	fprintf(stderr, "%s(): Caught PMD error type %d (%s): %s%s: %s\n",
+		__func__, error->type, errstr,
+		error->cause ? (snprintf(buf, sizeof(buf), "cause: %p, ",
+					 error->cause), buf) : "",
+		error->message ? error->message : "(no stated reason)",
+		rte_strerror(err));
 	return -err;
 }
 
@@ -1365,7 +1374,7 @@ rss_config_display(struct rte_flow_action_rss *rss_conf)
 	uint8_t i;
 
 	if (rss_conf == NULL) {
-		printf("Invalid rule\n");
+		fprintf(stderr, "Invalid rule\n");
 		return;
 	}
 
@@ -1430,8 +1439,9 @@ action_get_by_id(portid_t port_id, uint32_t id)
 		ppia = &(*ppia)->next;
 	}
 	if (!pia)
-		printf("Failed to find indirect action #%u on port %u\n",
-		       id, port_id);
+		fprintf(stderr,
+			"Failed to find indirect action #%u on port %u\n",
+			id, port_id);
 	return pia;
 }
 
@@ -1452,8 +1462,8 @@ action_alloc(portid_t port_id, uint32_t id,
 		/* taking first available ID */
 		if (port->actions_list) {
 			if (port->actions_list->id == UINT32_MAX - 1) {
-				printf("Highest indirect action ID is already"
-				" assigned, delete it first\n");
+				fprintf(stderr,
+					"Highest indirect action ID is already assigned, delete it first\n");
 				return -ENOMEM;
 			}
 			id = port->actions_list->id + 1;
@@ -1463,16 +1473,18 @@ action_alloc(portid_t port_id, uint32_t id,
 	}
 	pia = calloc(1, sizeof(*pia));
 	if (!pia) {
-		printf("Allocation of port %u indirect action failed\n",
-		       port_id);
+		fprintf(stderr,
+			"Allocation of port %u indirect action failed\n",
+			port_id);
 		return -ENOMEM;
 	}
 	ppia = &port->actions_list;
 	while (*ppia && (*ppia)->id > id)
 		ppia = &(*ppia)->next;
 	if (*ppia && (*ppia)->id == id) {
-		printf("Indirect action #%u is already assigned,"
-			" delete it first\n", id);
+		fprintf(stderr,
+			"Indirect action #%u is already assigned, delete it first\n",
+			id);
 		free(pia);
 		return -EINVAL;
 	}
@@ -1632,8 +1644,9 @@ port_action_handle_query(portid_t port_id, uint32_t id)
 	case RTE_FLOW_ACTION_TYPE_COUNT:
 		break;
 	default:
-		printf("Indirect action %u (type: %d) on port %u doesn't support query\n",
-		       id, pia->type, port_id);
+		fprintf(stderr,
+			"Indirect action %u (type: %d) on port %u doesn't support query\n",
+			id, pia->type, port_id);
 		return -ENOTSUP;
 	}
 	/* Poisoning to make sure PMDs update it in case of error. */
@@ -1706,8 +1719,9 @@ port_action_handle_query(portid_t port_id, uint32_t id)
 		       query.ct.reply_dir.max_ack);
 		break;
 	default:
-		printf("Indirect action %u (type: %d) on port %u doesn't support query\n",
-		       id, pia->type, port_id);
+		fprintf(stderr,
+			"Indirect action %u (type: %d) on port %u doesn't support query\n",
+			id, pia->type, port_id);
 		break;
 	}
 	return 0;
@@ -1727,7 +1741,7 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id,
 	port = &ports[port_id];
 	pft = port_flow_locate_tunnel_id(port, tunnel_ops->id);
 	if (!pft) {
-		printf("failed to locate port flow tunnel #%u\n",
+		fprintf(stderr, "failed to locate port flow tunnel #%u\n",
 			tunnel_ops->id);
 		return NULL;
 	}
@@ -1913,8 +1927,8 @@ port_flow_create(portid_t port_id,
 	port = &ports[port_id];
 	if (port->flow_list) {
 		if (port->flow_list->id == UINT32_MAX) {
-			printf("Highest rule ID is already assigned, delete"
-			       " it first");
+			fprintf(stderr,
+				"Highest rule ID is already assigned, delete it first");
 			return -ENOMEM;
 		}
 		id = port->flow_list->id + 1;
@@ -2063,7 +2077,7 @@ port_flow_dump(portid_t port_id, bool dump_all, uint32_t rule_id,
 			}
 		}
 		if (found == false) {
-			printf("Failed to dump to flow %d\n", rule_id);
+			fprintf(stderr, "Failed to dump to flow %d\n", rule_id);
 			return -EINVAL;
 		}
 	}
@@ -2071,8 +2085,8 @@ port_flow_dump(portid_t port_id, bool dump_all, uint32_t rule_id,
 	if (file_name && strlen(file_name)) {
 		file = fopen(file_name, "w");
 		if (!file) {
-			printf("Failed to create file %s: %s\n", file_name,
-			       strerror(errno));
+			fprintf(stderr, "Failed to create file %s: %s\n",
+				file_name, strerror(errno));
 			return -errno;
 		}
 	}
@@ -2083,7 +2097,7 @@ port_flow_dump(portid_t port_id, bool dump_all, uint32_t rule_id,
 		ret = rte_flow_dev_dump(port_id, NULL, file, &error);
 	if (ret) {
 		port_flow_complain(&error);
-		printf("Failed to dump flow: %s\n", strerror(-ret));
+		fprintf(stderr, "Failed to dump flow: %s\n", strerror(-ret));
 	} else
 		printf("Flow dump finished\n");
 	if (file_name && strlen(file_name))
@@ -2115,7 +2129,7 @@ port_flow_query(portid_t port_id, uint32_t rule,
 		if (pf->id == rule)
 			break;
 	if (!pf) {
-		printf("Flow rule #%u not found\n", rule);
+		fprintf(stderr, "Flow rule #%u not found\n", rule);
 		return -ENOENT;
 	}
 	ret = rte_flow_conv(RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
@@ -2129,7 +2143,7 @@ port_flow_query(portid_t port_id, uint32_t rule,
 	case RTE_FLOW_ACTION_TYPE_AGE:
 		break;
 	default:
-		printf("Cannot query action type %d (%s)\n",
+		fprintf(stderr, "Cannot query action type %d (%s)\n",
 			action->type, name);
 		return -ENOTSUP;
 	}
@@ -2165,8 +2179,9 @@ port_flow_query(portid_t port_id, uint32_t rule,
 		       query.age.sec_since_last_hit);
 		break;
 	default:
-		printf("Cannot display result for action type %d (%s)\n",
-		       action->type, name);
+		fprintf(stderr,
+			"Cannot display result for action type %d (%s)\n",
+			action->type, name);
 		break;
 	}
 	return 0;
@@ -2198,13 +2213,14 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
 		return;
 	contexts = malloc(sizeof(void *) * total);
 	if (contexts == NULL) {
-		printf("Cannot allocate contexts for aged flow\n");
+		fprintf(stderr, "Cannot allocate contexts for aged flow\n");
 		return;
 	}
 	printf("%-20s\tID\tGroup\tPrio\tAttr\n", "Type");
 	nb_context = rte_flow_get_aged_flows(port_id, contexts, total, &error);
 	if (nb_context != total) {
-		printf("Port:%d get aged flows count(%d) != total(%d)\n",
+		fprintf(stderr,
+			"Port:%d get aged flows count(%d) != total(%d)\n",
 			port_id, nb_context, total);
 		free(contexts);
 		return;
@@ -2212,7 +2228,8 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
 	total = 0;
 	for (idx = 0; idx < nb_context; idx++) {
 		if (!contexts[idx]) {
-			printf("Error: get Null context in port %u\n", port_id);
+			fprintf(stderr, "Error: get Null context in port %u\n",
+				port_id);
 			continue;
 		}
 		type = (enum age_action_context_type *)contexts[idx];
@@ -2239,7 +2256,8 @@ port_flow_aged(portid_t port_id, uint8_t destroy)
 			       ctx.pia->id);
 			break;
 		default:
-			printf("Error: invalid context type %u\n", port_id);
+			fprintf(stderr, "Error: invalid context type %u\n",
+				port_id);
 			break;
 		}
 	}
@@ -2356,7 +2374,8 @@ rx_queue_id_is_invalid(queueid_t rxq_id)
 {
 	if (rxq_id < nb_rxq)
 		return 0;
-	printf("Invalid RX queue %d (must be < nb_rxq=%d)\n", rxq_id, nb_rxq);
+	fprintf(stderr, "Invalid RX queue %d (must be < nb_rxq=%d)\n",
+		rxq_id, nb_rxq);
 	return 1;
 }
 
@@ -2365,7 +2384,8 @@ tx_queue_id_is_invalid(queueid_t txq_id)
 {
 	if (txq_id < nb_txq)
 		return 0;
-	printf("Invalid TX queue %d (must be < nb_txq=%d)\n", txq_id, nb_txq);
+	fprintf(stderr, "Invalid TX queue %d (must be < nb_txq=%d)\n",
+		txq_id, nb_txq);
 	return 1;
 }
 
@@ -2446,8 +2466,8 @@ rx_desc_id_is_invalid(portid_t port_id, queueid_t rxq_id, uint16_t rxdesc_id)
 	if (rxdesc_id < ring_size)
 		return 0;
 
-	printf("Invalid RX descriptor %u (must be < ring_size=%u)\n",
-	       rxdesc_id, ring_size);
+	fprintf(stderr, "Invalid RX descriptor %u (must be < ring_size=%u)\n",
+		rxdesc_id, ring_size);
 	return 1;
 }
 
@@ -2464,8 +2484,8 @@ tx_desc_id_is_invalid(portid_t port_id, queueid_t txq_id, uint16_t txdesc_id)
 	if (txdesc_id < ring_size)
 		return 0;
 
-	printf("Invalid TX descriptor %u (must be < ring_size=%u)\n",
-	       txdesc_id, ring_size);
+	fprintf(stderr, "Invalid TX descriptor %u (must be < ring_size=%u)\n",
+		txdesc_id, ring_size);
 	return 1;
 }
 
@@ -2479,9 +2499,9 @@ ring_dma_zone_lookup(const char *ring_name, portid_t port_id, uint16_t q_id)
 			port_id, q_id, ring_name);
 	mz = rte_memzone_lookup(mz_name);
 	if (mz == NULL)
-		printf("%s ring memory zoneof (port %d, queue %d) not"
-		       "found (zone name = %s\n",
-		       ring_name, port_id, q_id, mz_name);
+		fprintf(stderr,
+			"%s ring memory zoneof (port %d, queue %d) not found (zone name = %s\n",
+			ring_name, port_id, q_id, mz_name);
 	return mz;
 }
 
@@ -2739,7 +2759,9 @@ port_rss_reta_info(portid_t port_id,
 
 	ret = rte_eth_dev_rss_reta_query(port_id, reta_conf, nb_entries);
 	if (ret != 0) {
-		printf("Failed to get RSS RETA info, return code = %d\n", ret);
+		fprintf(stderr,
+			"Failed to get RSS RETA info, return code = %d\n",
+			ret);
 		return;
 	}
 
@@ -2780,7 +2802,8 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
 			dev_info.hash_key_size <= sizeof(rss_key))
 		hash_key_size = dev_info.hash_key_size;
 	else {
-		printf("dev_info did not provide a valid hash key size\n");
+		fprintf(stderr,
+			"dev_info did not provide a valid hash key size\n");
 		return;
 	}
 
@@ -2791,13 +2814,13 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
 	if (diag != 0) {
 		switch (diag) {
 		case -ENODEV:
-			printf("port index %d invalid\n", port_id);
+			fprintf(stderr, "port index %d invalid\n", port_id);
 			break;
 		case -ENOTSUP:
-			printf("operation not supported by device\n");
+			fprintf(stderr, "operation not supported by device\n");
 			break;
 		default:
-			printf("operation failed - diag=%d\n", diag);
+			fprintf(stderr, "operation failed - diag=%d\n", diag);
 			break;
 		}
 		return;
@@ -2846,13 +2869,13 @@ port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key,
 
 	switch (diag) {
 	case -ENODEV:
-		printf("port index %d invalid\n", port_id);
+		fprintf(stderr, "port index %d invalid\n", port_id);
 		break;
 	case -ENOTSUP:
-		printf("operation not supported by device\n");
+		fprintf(stderr, "operation not supported by device\n");
 		break;
 	default:
-		printf("operation failed - diag=%d\n", diag);
+		fprintf(stderr, "operation failed - diag=%d\n", diag);
 		break;
 	}
 }
@@ -2914,10 +2937,8 @@ fwd_topology_tx_port_get(portid_t rxp)
 			if (rxp + 1 < cur_fwd_config.nb_fwd_ports)
 				return rxp + 1;
 			if (warning_once) {
-				printf("\nWarning! port-topology=paired"
-				       " and odd forward ports number,"
-				       " the last port will pair with"
-				       " itself.\n\n");
+				fprintf(stderr,
+					"\nWarning! port-topology=paired and odd forward ports number, the last port will pair with itself.\n\n");
 				warning_once = 0;
 			}
 			return rxp;
@@ -3070,7 +3091,8 @@ dcb_fwd_config_setup(void)
 		ret = rte_eth_dev_configure(pid, nb_rxq, nb_txq,
 					    &port->dev_conf);
 		if (ret < 0) {
-			printf("Failed to re-configure port %d, ret = %d.\n",
+			fprintf(stderr,
+				"Failed to re-configure port %d, ret = %d.\n",
 				pid, ret);
 			return;
 		}
@@ -3220,14 +3242,14 @@ fwd_config_setup(void)
 				pt_id = fwd_ports_ids[i];
 				port = &ports[pt_id];
 				if (!port->dcb_flag) {
-					printf("In DCB mode, all forwarding ports must "
-						"be configured in this mode.\n");
+					fprintf(stderr,
+						"In DCB mode, all forwarding ports must be configured in this mode.\n");
 					return;
 				}
 			}
 			if (nb_fwd_lcores == 1) {
-				printf("In DCB mode,the nb forwarding cores "
-					"should be larger than 1.\n");
+				fprintf(stderr,
+					"In DCB mode,the nb forwarding cores should be larger than 1.\n");
 				return;
 			}
 
@@ -3303,11 +3325,12 @@ set_fwd_eth_peer(portid_t port_id, char *peer_addr)
 {
 	struct rte_ether_addr new_peer_addr;
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		printf("Error: Invalid port number %i\n", port_id);
+		fprintf(stderr, "Error: Invalid port number %i\n", port_id);
 		return;
 	}
 	if (rte_ether_unformat_addr(peer_addr, &new_peer_addr) < 0) {
-		printf("Error: Invalid ethernet address: %s\n", peer_addr);
+		fprintf(stderr, "Error: Invalid ethernet address: %s\n",
+			peer_addr);
 		return;
 	}
 	peer_eth_addrs[port_id] = new_peer_addr;
@@ -3325,14 +3348,13 @@ set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc)
 	for (i = 0; i < nb_lc; i++) {
 		lcore_cpuid = lcorelist[i];
 		if (! rte_lcore_is_enabled(lcore_cpuid)) {
-			printf("lcore %u not enabled\n", lcore_cpuid);
+			fprintf(stderr, "lcore %u not enabled\n", lcore_cpuid);
 			return -1;
 		}
 		if (lcore_cpuid == rte_get_main_lcore()) {
-			printf("lcore %u cannot be masked on for running "
-			       "packet forwarding, which is the main lcore "
-			       "and reserved for command line parsing only\n",
-			       lcore_cpuid);
+			fprintf(stderr,
+				"lcore %u cannot be masked on for running packet forwarding, which is the main lcore and reserved for command line parsing only\n",
+				lcore_cpuid);
 			return -1;
 		}
 		if (record_now)
@@ -3361,7 +3383,7 @@ set_fwd_lcores_mask(uint64_t lcoremask)
 	unsigned int i;
 
 	if (lcoremask == 0) {
-		printf("Invalid NULL mask of cores\n");
+		fprintf(stderr, "Invalid NULL mask of cores\n");
 		return -1;
 	}
 	nb_lc = 0;
@@ -3377,13 +3399,13 @@ void
 set_fwd_lcores_number(uint16_t nb_lc)
 {
 	if (test_done == 0) {
-		printf("Please stop forwarding first\n");
+		fprintf(stderr, "Please stop forwarding first\n");
 		return;
 	}
 	if (nb_lc > nb_cfg_lcores) {
-		printf("nb fwd cores %u > %u (max. number of configured "
-		       "lcores) - ignored\n",
-		       (unsigned int) nb_lc, (unsigned int) nb_cfg_lcores);
+		fprintf(stderr,
+			"nb fwd cores %u > %u (max. number of configured lcores) - ignored\n",
+			(unsigned int) nb_lc, (unsigned int) nb_cfg_lcores);
 		return;
 	}
 	nb_fwd_lcores = (lcoreid_t) nb_lc;
@@ -3534,7 +3556,7 @@ set_fwd_ports_mask(uint64_t portmask)
 	unsigned int i;
 
 	if (portmask == 0) {
-		printf("Invalid NULL mask of ports\n");
+		fprintf(stderr, "Invalid NULL mask of ports\n");
 		return;
 	}
 	nb_pt = 0;
@@ -3550,9 +3572,9 @@ void
 set_fwd_ports_number(uint16_t nb_pt)
 {
 	if (nb_pt > nb_cfg_ports) {
-		printf("nb fwd ports %u > %u (number of configured "
-		       "ports) - ignored\n",
-		       (unsigned int) nb_pt, (unsigned int) nb_cfg_ports);
+		fprintf(stderr,
+			"nb fwd ports %u > %u (number of configured ports) - ignored\n",
+			(unsigned int) nb_pt, (unsigned int) nb_cfg_ports);
 		return;
 	}
 	nb_fwd_ports = (portid_t) nb_pt;
@@ -3580,9 +3602,9 @@ void
 set_nb_pkt_per_burst(uint16_t nb)
 {
 	if (nb > MAX_PKT_BURST) {
-		printf("nb pkt per burst: %u > %u (maximum packet per burst) "
-		       " ignored\n",
-		       (unsigned int) nb, (unsigned int) MAX_PKT_BURST);
+		fprintf(stderr,
+			"nb pkt per burst: %u > %u (maximum packet per burst)  ignored\n",
+			(unsigned int) nb, (unsigned int) MAX_PKT_BURST);
 		return;
 	}
 	nb_pkt_per_burst = nb;
@@ -3613,7 +3635,7 @@ set_tx_pkt_split(const char *name)
 			return;
 		}
 	}
-	printf("unknown value: \"%s\"\n", name);
+	fprintf(stderr, "unknown value: \"%s\"\n", name);
 }
 
 int
@@ -3796,13 +3818,15 @@ set_tx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs)
 	 * packets, suppose it is always supported.
 	 */
 	if (nb_segs > 1 && nb_segs_is_invalid(nb_segs)) {
-		printf("Tx segment size(%u) is not supported - txpkts ignored\n",
+		fprintf(stderr,
+			"Tx segment size(%u) is not supported - txpkts ignored\n",
 			nb_segs);
 		return;
 	}
 
 	if (nb_segs > RTE_MAX_SEGS_PER_PKT) {
-		printf("Tx segment size(%u) is bigger than max number of segment(%u)\n",
+		fprintf(stderr,
+			"Tx segment size(%u) is bigger than max number of segment(%u)\n",
 			nb_segs, RTE_MAX_SEGS_PER_PKT);
 		return;
 	}
@@ -3817,14 +3841,15 @@ set_tx_pkt_segments(unsigned int *seg_lengths, unsigned int nb_segs)
 	tx_pkt_len = 0;
 	for (i = 0; i < nb_segs; i++) {
 		if (seg_lengths[i] > mbuf_data_size[0]) {
-			printf("length[%u]=%u > mbuf_data_size=%u - give up\n",
-			       i, seg_lengths[i], mbuf_data_size[0]);
+			fprintf(stderr,
+				"length[%u]=%u > mbuf_data_size=%u - give up\n",
+				i, seg_lengths[i], mbuf_data_size[0]);
 			return;
 		}
 		tx_pkt_len = (uint16_t)(tx_pkt_len + seg_lengths[i]);
 	}
 	if (tx_pkt_len < (sizeof(struct rte_ether_hdr) + 20 + 8)) {
-		printf("total packet length=%u < %d - give up\n",
+		fprintf(stderr, "total packet length=%u < %d - give up\n",
 				(unsigned) tx_pkt_len,
 				(int)(sizeof(struct rte_ether_hdr) + 20 + 8));
 		return;
@@ -3855,18 +3880,19 @@ void
 setup_gro(const char *onoff, portid_t port_id)
 {
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		printf("invalid port id %u\n", port_id);
+		fprintf(stderr, "invalid port id %u\n", port_id);
 		return;
 	}
 	if (test_done == 0) {
-		printf("Before enable/disable GRO,"
-				" please stop forwarding first\n");
+		fprintf(stderr,
+			"Before enable/disable GRO, please stop forwarding first\n");
 		return;
 	}
 	if (strcmp(onoff, "on") == 0) {
 		if (gro_ports[port_id].enable != 0) {
-			printf("Port %u has enabled GRO. Please"
-					" disable GRO first\n", port_id);
+			fprintf(stderr,
+				"Port %u has enabled GRO. Please disable GRO first\n",
+				port_id);
 			return;
 		}
 		if (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) {
@@ -3879,7 +3905,7 @@ setup_gro(const char *onoff, portid_t port_id)
 		gro_ports[port_id].enable = 1;
 	} else {
 		if (gro_ports[port_id].enable == 0) {
-			printf("Port %u has disabled GRO\n", port_id);
+			fprintf(stderr, "Port %u has disabled GRO\n", port_id);
 			return;
 		}
 		gro_ports[port_id].enable = 0;
@@ -3890,18 +3916,16 @@ void
 setup_gro_flush_cycles(uint8_t cycles)
 {
 	if (test_done == 0) {
-		printf("Before change flush interval for GRO,"
-				" please stop forwarding first.\n");
+		fprintf(stderr,
+			"Before change flush interval for GRO, please stop forwarding first.\n");
 		return;
 	}
 
 	if (cycles > GRO_MAX_FLUSH_CYCLES || cycles <
 			GRO_DEFAULT_FLUSH_CYCLES) {
-		printf("The flushing cycle be in the range"
-				" of 1 to %u. Revert to the default"
-				" value %u.\n",
-				GRO_MAX_FLUSH_CYCLES,
-				GRO_DEFAULT_FLUSH_CYCLES);
+		fprintf(stderr,
+			"The flushing cycle be in the range of 1 to %u. Revert to the default value %u.\n",
+			GRO_MAX_FLUSH_CYCLES, GRO_DEFAULT_FLUSH_CYCLES);
 		cycles = GRO_DEFAULT_FLUSH_CYCLES;
 	}
 
@@ -3917,7 +3941,7 @@ show_gro(portid_t port_id)
 	param = &gro_ports[port_id].param;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		printf("Invalid port id %u.\n", port_id);
+		fprintf(stderr, "Invalid port id %u.\n", port_id);
 		return;
 	}
 	if (gro_ports[port_id].enable) {
@@ -3938,20 +3962,20 @@ void
 setup_gso(const char *mode, portid_t port_id)
 {
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		printf("invalid port id %u\n", port_id);
+		fprintf(stderr, "invalid port id %u\n", port_id);
 		return;
 	}
 	if (strcmp(mode, "on") == 0) {
 		if (test_done == 0) {
-			printf("before enabling GSO,"
-					" please stop forwarding first\n");
+			fprintf(stderr,
+				"before enabling GSO, please stop forwarding first\n");
 			return;
 		}
 		gso_ports[port_id].enable = 1;
 	} else if (strcmp(mode, "off") == 0) {
 		if (test_done == 0) {
-			printf("before disabling GSO,"
-					" please stop forwarding first\n");
+			fprintf(stderr,
+				"before disabling GSO, please stop forwarding first\n");
 			return;
 		}
 		gso_ports[port_id].enable = 0;
@@ -4021,7 +4045,7 @@ set_pkt_forwarding_mode(const char *fwd_mode_name)
 		}
 		i++;
 	}
-	printf("Invalid %s packet forwarding mode\n", fwd_mode_name);
+	fprintf(stderr, "Invalid %s packet forwarding mode\n", fwd_mode_name);
 }
 
 void
@@ -4164,8 +4188,9 @@ vlan_extend_set(portid_t port_id, int on)
 
 	diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
 	if (diag < 0) {
-		printf("rx_vlan_extend_set(port_pi=%d, on=%d) failed "
-	       "diag=%d\n", port_id, on, diag);
+		fprintf(stderr,
+			"rx_vlan_extend_set(port_pi=%d, on=%d) failed diag=%d\n",
+			port_id, on, diag);
 		return;
 	}
 	ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
@@ -4193,8 +4218,9 @@ rx_vlan_strip_set(portid_t port_id, int on)
 
 	diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
 	if (diag < 0) {
-		printf("rx_vlan_strip_set(port_pi=%d, on=%d) failed "
-	       "diag=%d\n", port_id, on, diag);
+		fprintf(stderr,
+			"rx_vlan_strip_set(port_pi=%d, on=%d) failed diag=%d\n",
+			port_id, on, diag);
 		return;
 	}
 	ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
@@ -4210,8 +4236,9 @@ rx_vlan_strip_set_on_queue(portid_t port_id, uint16_t queue_id, int on)
 
 	diag = rte_eth_dev_set_vlan_strip_on_queue(port_id, queue_id, on);
 	if (diag < 0)
-		printf("rx_vlan_strip_set_on_queue(port_pi=%d, queue_id=%d, on=%d) failed "
-	       "diag=%d\n", port_id, queue_id, on, diag);
+		fprintf(stderr,
+			"rx_vlan_strip_set_on_queue(port_pi=%d, queue_id=%d, on=%d) failed diag=%d\n",
+			port_id, queue_id, on, diag);
 }
 
 void
@@ -4236,8 +4263,9 @@ rx_vlan_filter_set(portid_t port_id, int on)
 
 	diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
 	if (diag < 0) {
-		printf("rx_vlan_filter_set(port_pi=%d, on=%d) failed "
-	       "diag=%d\n", port_id, on, diag);
+		fprintf(stderr,
+			"rx_vlan_filter_set(port_pi=%d, on=%d) failed diag=%d\n",
+			port_id, on, diag);
 		return;
 	}
 	ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
@@ -4265,8 +4293,8 @@ rx_vlan_qinq_strip_set(portid_t port_id, int on)
 
 	diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
 	if (diag < 0) {
-		printf("%s(port_pi=%d, on=%d) failed "
-	       "diag=%d\n", __func__, port_id, on, diag);
+		fprintf(stderr, "%s(port_pi=%d, on=%d) failed diag=%d\n",
+			__func__, port_id, on, diag);
 		return;
 	}
 	ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
@@ -4284,9 +4312,9 @@ rx_vft_set(portid_t port_id, uint16_t vlan_id, int on)
 	diag = rte_eth_dev_vlan_filter(port_id, vlan_id, on);
 	if (diag == 0)
 		return 0;
-	printf("rte_eth_dev_vlan_filter(port_pi=%d, vlan_id=%d, on=%d) failed "
-	       "diag=%d\n",
-	       port_id, vlan_id, on, diag);
+	fprintf(stderr,
+		"rte_eth_dev_vlan_filter(port_pi=%d, vlan_id=%d, on=%d) failed diag=%d\n",
+		port_id, vlan_id, on, diag);
 	return -1;
 }
 
@@ -4315,9 +4343,9 @@ vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type, uint16_t tp_id)
 	if (diag == 0)
 		return;
 
-	printf("tx_vlan_tpid_set(port_pi=%d, vlan_type=%d, tpid=%d) failed "
-	       "diag=%d\n",
-	       port_id, vlan_type, tp_id, diag);
+	fprintf(stderr,
+		"tx_vlan_tpid_set(port_pi=%d, vlan_type=%d, tpid=%d) failed diag=%d\n",
+		port_id, vlan_type, tp_id, diag);
 }
 
 void
@@ -4331,7 +4359,7 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 
 	if (ports[port_id].dev_conf.txmode.offloads &
 	    DEV_TX_OFFLOAD_QINQ_INSERT) {
-		printf("Error, as QinQ has been enabled.\n");
+		fprintf(stderr, "Error, as QinQ has been enabled.\n");
 		return;
 	}
 
@@ -4340,7 +4368,8 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id)
 		return;
 
 	if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) {
-		printf("Error: vlan insert is not supported by port %d\n",
+		fprintf(stderr,
+			"Error: vlan insert is not supported by port %d\n",
 			port_id);
 		return;
 	}
@@ -4366,7 +4395,8 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
 		return;
 
 	if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) {
-		printf("Error: qinq insert not supported by port %d\n",
+		fprintf(stderr,
+			"Error: qinq insert not supported by port %d\n",
 			port_id);
 		return;
 	}
@@ -4409,8 +4439,8 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
 		return;
 
 	if (map_value >= RTE_ETHDEV_QUEUE_STAT_CNTRS) {
-		printf("map_value not in required range 0..%d\n",
-		       RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
+		fprintf(stderr, "map_value not in required range 0..%d\n",
+			RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
 		return;
 	}
 
@@ -4418,14 +4448,16 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
 		ret = rte_eth_dev_set_tx_queue_stats_mapping(port_id, queue_id,
 							     map_value);
 		if (ret) {
-			printf("failed to set tx queue stats mapping.\n");
+			fprintf(stderr,
+				"failed to set tx queue stats mapping.\n");
 			return;
 		}
 	} else { /* rx */
 		ret = rte_eth_dev_set_rx_queue_stats_mapping(port_id, queue_id,
 							     map_value);
 		if (ret) {
-			printf("failed to set rx queue stats mapping.\n");
+			fprintf(stderr,
+				"failed to set rx queue stats mapping.\n");
 			return;
 		}
 	}
@@ -4608,11 +4640,11 @@ get_fdir_info(portid_t port_id, struct rte_eth_fdir_info *fdir_info,
 	case 0:
 		break;
 	case -ENOTSUP:
-		printf("\n FDIR is not supported on port %-2d\n",
+		fprintf(stderr, "\n FDIR is not supported on port %-2d\n",
 			port_id);
 		break;
 	default:
-		printf("programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
 		break;
 	}
 	return ret;
@@ -4708,8 +4740,9 @@ fdir_set_flex_mask(portid_t port_id, struct rte_eth_fdir_flex_mask *cfg)
 			idx = flex_conf->nb_flexmasks;
 			flex_conf->nb_flexmasks++;
 		} else {
-			printf("The flex mask table is full. Can not set flex"
-				" mask for flow_type(%u).", cfg->flow_type);
+			fprintf(stderr,
+				"The flex mask table is full. Can not set flex mask for flow_type(%u).",
+				cfg->flow_type);
 			return;
 		}
 	}
@@ -4738,8 +4771,9 @@ fdir_set_flex_payload(portid_t port_id, struct rte_eth_flex_payload_cfg *cfg)
 			idx = flex_conf->nb_payloads;
 			flex_conf->nb_payloads++;
 		} else {
-			printf("The flex payload table is full. Can not set"
-				" flex payload for type(%u).", cfg->type);
+			fprintf(stderr,
+				"The flex payload table is full. Can not set flex payload for type(%u).",
+				cfg->type);
 			return;
 		}
 	}
@@ -4762,12 +4796,13 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on)
 
 	if (diag == 0)
 		return;
-	printf("rte_pmd_ixgbe_set_vf_%s for port_id=%d failed diag=%d\n",
-			is_rx ? "rx" : "tx", port_id, diag);
+	fprintf(stderr,
+		"rte_pmd_ixgbe_set_vf_%s for port_id=%d failed diag=%d\n",
+		is_rx ? "rx" : "tx", port_id, diag);
 	return;
 #endif
-	printf("VF %s setting not supported for port %d\n",
-			is_rx ? "Rx" : "Tx", port_id);
+	fprintf(stderr, "VF %s setting not supported for port %d\n",
+		is_rx ? "Rx" : "Tx", port_id);
 	RTE_SET_USED(vf);
 	RTE_SET_USED(on);
 }
@@ -4786,14 +4821,16 @@ set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate)
 		return 1;
 	if (link.link_speed != ETH_SPEED_NUM_UNKNOWN &&
 	    rate > link.link_speed) {
-		printf("Invalid rate value:%u bigger than link speed: %u\n",
+		fprintf(stderr,
+			"Invalid rate value:%u bigger than link speed: %u\n",
 			rate, link.link_speed);
 		return 1;
 	}
 	diag = rte_eth_set_queue_rate_limit(port_id, queue_idx, rate);
 	if (diag == 0)
 		return diag;
-	printf("rte_eth_set_queue_rate_limit for port_id=%d failed diag=%d\n",
+	fprintf(stderr,
+		"rte_eth_set_queue_rate_limit for port_id=%d failed diag=%d\n",
 		port_id, diag);
 	return diag;
 }
@@ -4819,7 +4856,8 @@ set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk)
 	if (diag == 0)
 		return diag;
 
-	printf("set_vf_rate_limit for port_id=%d failed diag=%d\n",
+	fprintf(stderr,
+		"set_vf_rate_limit for port_id=%d failed diag=%d\n",
 		port_id, diag);
 	return diag;
 }
@@ -4867,8 +4905,9 @@ mcast_addr_pool_extend(struct rte_port *port)
 	mc_pool = (struct rte_ether_addr *) realloc(port->mc_addr_pool,
 						mc_pool_size);
 	if (mc_pool == NULL) {
-		printf("allocation of pool of %u multicast addresses failed\n",
-		       port->mc_addr_nb + MCAST_POOL_INC);
+		fprintf(stderr,
+			"allocation of pool of %u multicast addresses failed\n",
+			port->mc_addr_nb + MCAST_POOL_INC);
 		return -ENOMEM;
 	}
 
@@ -4914,7 +4953,8 @@ eth_port_multicast_addr_list_set(portid_t port_id)
 	diag = rte_eth_dev_set_mc_addr_list(port_id, port->mc_addr_pool,
 					    port->mc_addr_nb);
 	if (diag < 0)
-		printf("rte_eth_dev_set_mc_addr_list(port=%d, nb=%u) failed. diag=%d\n",
+		fprintf(stderr,
+			"rte_eth_dev_set_mc_addr_list(port=%d, nb=%u) failed. diag=%d\n",
 			port_id, port->mc_addr_nb, diag);
 
 	return diag;
@@ -4937,7 +4977,8 @@ mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr)
 	 */
 	for (i = 0; i < port->mc_addr_nb; i++) {
 		if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) {
-			printf("multicast address already filtered by port\n");
+			fprintf(stderr,
+				"multicast address already filtered by port\n");
 			return;
 		}
 	}
@@ -4967,7 +5008,8 @@ mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr)
 			break;
 	}
 	if (i == port->mc_addr_nb) {
-		printf("multicast address not filtered by port %d\n", port_id);
+		fprintf(stderr, "multicast address not filtered by port %d\n",
+			port_id);
 		return;
 	}
 
@@ -4990,7 +5032,7 @@ port_dcb_info_display(portid_t port_id)
 
 	ret = rte_eth_dev_get_dcb_info(port_id, &dcb_info);
 	if (ret) {
-		printf("\n Failed to get dcb infos on port %-2d\n",
+		fprintf(stderr, "\n Failed to get dcb infos on port %-2d\n",
 			port_id);
 		return;
 	}
@@ -5033,34 +5075,34 @@ open_file(const char *file_path, uint32_t *size)
 		*size = 0;
 
 	if (fd == -1) {
-		printf("%s: Failed to open %s\n", __func__, file_path);
+		fprintf(stderr, "%s: Failed to open %s\n", __func__, file_path);
 		return buf;
 	}
 
 	if ((fstat(fd, &st_buf) != 0) || (!S_ISREG(st_buf.st_mode))) {
 		close(fd);
-		printf("%s: File operations failed\n", __func__);
+		fprintf(stderr, "%s: File operations failed\n", __func__);
 		return buf;
 	}
 
 	pkg_size = st_buf.st_size;
 	if (pkg_size < 0) {
 		close(fd);
-		printf("%s: File operations failed\n", __func__);
+		fprintf(stderr, "%s: File operations failed\n", __func__);
 		return buf;
 	}
 
 	buf = (uint8_t *)malloc(pkg_size);
 	if (!buf) {
 		close(fd);
-		printf("%s: Failed to malloc memory\n",	__func__);
+		fprintf(stderr, "%s: Failed to malloc memory\n", __func__);
 		return buf;
 	}
 
 	ret = read(fd, buf, pkg_size);
 	if (ret < 0) {
 		close(fd);
-		printf("%s: File read operation failed\n", __func__);
+		fprintf(stderr, "%s: File read operation failed\n", __func__);
 		close_file(buf);
 		return NULL;
 	}
@@ -5079,13 +5121,13 @@ save_file(const char *file_path, uint8_t *buf, uint32_t size)
 	FILE *fh = fopen(file_path, "wb");
 
 	if (fh == NULL) {
-		printf("%s: Failed to open %s\n", __func__, file_path);
+		fprintf(stderr, "%s: Failed to open %s\n", __func__, file_path);
 		return -1;
 	}
 
 	if (fwrite(buf, 1, size, fh) != size) {
 		fclose(fh);
-		printf("%s: File write operation failed\n", __func__);
+		fprintf(stderr, "%s: File write operation failed\n", __func__);
 		return -1;
 	}
 
diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 6b4df335fe..5b34004961 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -1107,8 +1107,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 	nb_prep = rte_eth_tx_prepare(fs->tx_port, fs->tx_queue,
 			tx_pkts_burst, nb_rx);
 	if (nb_prep != nb_rx)
-		printf("Preparing packet burst to transmit failed: %s\n",
-				rte_strerror(rte_errno));
+		fprintf(stderr,
+			"Preparing packet burst to transmit failed: %s\n",
+			rte_strerror(rte_errno));
 
 	nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, tx_pkts_burst,
 			nb_prep);
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index f3954c1c63..eff4a52cfb 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -229,7 +229,8 @@ init_peer_eth_addrs(char *config_filename)
 			break;
 
 		if (rte_ether_unformat_addr(buf, &peer_eth_addrs[i]) < 0) {
-			printf("Bad MAC address format on line %d\n", i+1);
+			fprintf(stderr, "Bad MAC address format on line %d\n",
+				i + 1);
 			fclose(config_file);
 			return -1;
 		}
@@ -283,10 +284,10 @@ print_invalid_socket_id_error(void)
 {
 	unsigned int i = 0;
 
-	printf("Invalid socket id, options are: ");
+	fprintf(stderr, "Invalid socket id, options are: ");
 	for (i = 0; i < num_sockets; i++) {
-		printf("%u%s", socket_ids[i],
-		      (i == num_sockets - 1) ? "\n" : ",");
+		fprintf(stderr, "%u%s", socket_ids[i],
+			(i == num_sockets - 1) ? "\n" : ",");
 	}
 }
 
@@ -402,7 +403,8 @@ parse_ringnuma_config(const char *q_arg)
 		}
 		ring_flag = (uint8_t)int_fld[FLD_FLAG];
 		if ((ring_flag < RX_RING_ONLY) || (ring_flag > RXTX_RING)) {
-			printf("Invalid ring-flag=%d config for port =%d\n",
+			fprintf(stderr,
+				"Invalid ring-flag=%d config for port =%d\n",
 				ring_flag,port_id);
 			return -1;
 		}
@@ -419,7 +421,8 @@ parse_ringnuma_config(const char *q_arg)
 			txring_numa[port_id] = socket_id;
 			break;
 		default:
-			printf("Invalid ring-flag=%d config for port=%d\n",
+			fprintf(stderr,
+				"Invalid ring-flag=%d config for port=%d\n",
 				ring_flag,port_id);
 			break;
 		}
@@ -498,7 +501,7 @@ parse_link_speed(int n)
 	case 100:
 	case 10:
 	default:
-		printf("Unsupported fixed speed\n");
+		fprintf(stderr, "Unsupported fixed speed\n");
 		return 0;
 	}
 
@@ -1398,7 +1401,7 @@ launch_args_parse(int argc, char** argv)
 			break;
 		default:
 			usage(argv[0]);
-			printf("Invalid option: %s\n", argv[optind]);
+			fprintf(stderr, "Invalid option: %s\n", argv[optind]);
 			rte_exit(EXIT_FAILURE,
 				 "Command line is incomplete or incorrect\n");
 			break;
@@ -1407,7 +1410,7 @@ launch_args_parse(int argc, char** argv)
 
 	if (optind != argc) {
 		usage(argv[0]);
-		printf("Invalid parameter: %s\n", argv[optind]);
+		fprintf(stderr, "Invalid parameter: %s\n", argv[optind]);
 		rte_exit(EXIT_FAILURE, "Command line is incorrect\n");
 	}
 
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 8ed1b97dec..1c945437e7 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1076,10 +1076,8 @@ check_socket_id(const unsigned int socket_id)
 
 	if (new_socket_id(socket_id)) {
 		if (!warning_once && numa_support)
-			printf("Warning: NUMA should be configured manually by"
-			       " using --port-numa-config and"
-			       " --ring-numa-config parameters along with"
-			       " --numa.\n");
+			fprintf(stderr,
+				"Warning: NUMA should be configured manually by using --port-numa-config and --ring-numa-config parameters along with --numa.\n");
 		warning_once = 1;
 		return -1;
 	}
@@ -1126,11 +1124,9 @@ check_nb_rxq(queueid_t rxq)
 
 	allowed_max_rxq = get_allowed_max_nb_rxq(&pid);
 	if (rxq > allowed_max_rxq) {
-		printf("Fail: input rxq (%u) can't be greater "
-		       "than max_rx_queues (%u) of port %u\n",
-		       rxq,
-		       allowed_max_rxq,
-		       pid);
+		fprintf(stderr,
+			"Fail: input rxq (%u) can't be greater than max_rx_queues (%u) of port %u\n",
+			rxq, allowed_max_rxq, pid);
 		return -1;
 	}
 	return 0;
@@ -1176,11 +1172,9 @@ check_nb_txq(queueid_t txq)
 
 	allowed_max_txq = get_allowed_max_nb_txq(&pid);
 	if (txq > allowed_max_txq) {
-		printf("Fail: input txq (%u) can't be greater "
-		       "than max_tx_queues (%u) of port %u\n",
-		       txq,
-		       allowed_max_txq,
-		       pid);
+		fprintf(stderr,
+			"Fail: input txq (%u) can't be greater than max_tx_queues (%u) of port %u\n",
+			txq, allowed_max_txq, pid);
 		return -1;
 	}
 	return 0;
@@ -1251,21 +1245,17 @@ check_nb_rxd(queueid_t rxd)
 
 	allowed_max_rxd = get_allowed_max_nb_rxd(&pid);
 	if (rxd > allowed_max_rxd) {
-		printf("Fail: input rxd (%u) can't be greater "
-		       "than max_rxds (%u) of port %u\n",
-		       rxd,
-		       allowed_max_rxd,
-		       pid);
+		fprintf(stderr,
+			"Fail: input rxd (%u) can't be greater than max_rxds (%u) of port %u\n",
+			rxd, allowed_max_rxd, pid);
 		return -1;
 	}
 
 	allowed_min_rxd = get_allowed_min_nb_rxd(&pid);
 	if (rxd < allowed_min_rxd) {
-		printf("Fail: input rxd (%u) can't be less "
-		       "than min_rxds (%u) of port %u\n",
-		       rxd,
-		       allowed_min_rxd,
-		       pid);
+		fprintf(stderr,
+			"Fail: input rxd (%u) can't be less than min_rxds (%u) of port %u\n",
+			rxd, allowed_min_rxd, pid);
 		return -1;
 	}
 
@@ -1336,21 +1326,17 @@ check_nb_txd(queueid_t txd)
 
 	allowed_max_txd = get_allowed_max_nb_txd(&pid);
 	if (txd > allowed_max_txd) {
-		printf("Fail: input txd (%u) can't be greater "
-		       "than max_txds (%u) of port %u\n",
-		       txd,
-		       allowed_max_txd,
-		       pid);
+		fprintf(stderr,
+			"Fail: input txd (%u) can't be greater than max_txds (%u) of port %u\n",
+			txd, allowed_max_txd, pid);
 		return -1;
 	}
 
 	allowed_min_txd = get_allowed_min_nb_txd(&pid);
 	if (txd < allowed_min_txd) {
-		printf("Fail: input txd (%u) can't be less "
-		       "than min_txds (%u) of port %u\n",
-		       txd,
-		       allowed_min_txd,
-		       pid);
+		fprintf(stderr,
+			"Fail: input txd (%u) can't be less than min_txds (%u) of port %u\n",
+			txd, allowed_min_txd, pid);
 		return -1;
 	}
 	return 0;
@@ -1396,9 +1382,9 @@ check_nb_hairpinq(queueid_t hairpinq)
 
 	allowed_max_hairpinq = get_allowed_max_nb_hairpinq(&pid);
 	if (hairpinq > allowed_max_hairpinq) {
-		printf("Fail: input hairpin (%u) can't be greater "
-		       "than max_hairpin_queues (%u) of port %u\n",
-		       hairpinq, allowed_max_hairpinq, pid);
+		fprintf(stderr,
+			"Fail: input hairpin (%u) can't be greater than max_hairpin_queues (%u) of port %u\n",
+			hairpinq, allowed_max_hairpinq, pid);
 		return -1;
 	}
 	return 0;
@@ -1454,7 +1440,8 @@ init_config(void)
 
 		ret = update_jumbo_frame_offload(pid);
 		if (ret != 0)
-			printf("Updating jumbo frame offload failed for port %u\n",
+			fprintf(stderr,
+				"Updating jumbo frame offload failed for port %u\n",
 				pid);
 
 		if (!(port->dev_info.tx_offload_capa &
@@ -1628,15 +1615,15 @@ init_fwd_streams(void)
 	RTE_ETH_FOREACH_DEV(pid) {
 		port = &ports[pid];
 		if (nb_rxq > port->dev_info.max_rx_queues) {
-			printf("Fail: nb_rxq(%d) is greater than "
-				"max_rx_queues(%d)\n", nb_rxq,
-				port->dev_info.max_rx_queues);
+			fprintf(stderr,
+				"Fail: nb_rxq(%d) is greater than max_rx_queues(%d)\n",
+				nb_rxq, port->dev_info.max_rx_queues);
 			return -1;
 		}
 		if (nb_txq > port->dev_info.max_tx_queues) {
-			printf("Fail: nb_txq(%d) is greater than "
-				"max_tx_queues(%d)\n", nb_txq,
-				port->dev_info.max_tx_queues);
+			fprintf(stderr,
+				"Fail: nb_txq(%d) is greater than max_tx_queues(%d)\n",
+				nb_txq, port->dev_info.max_tx_queues);
 			return -1;
 		}
 		if (numa_support) {
@@ -1663,7 +1650,8 @@ init_fwd_streams(void)
 
 	q = RTE_MAX(nb_rxq, nb_txq);
 	if (q == 0) {
-		printf("Fail: Cannot allocate fwd streams as number of queues is 0\n");
+		fprintf(stderr,
+			"Fail: Cannot allocate fwd streams as number of queues is 0\n");
 		return -1;
 	}
 	nb_fwd_streams_new = (streamid_t)(nb_ports * q);
@@ -2120,8 +2108,9 @@ launch_packet_forwarding(lcore_function_t *pkt_fwd_on_lcore)
 			diag = rte_eal_remote_launch(pkt_fwd_on_lcore,
 						     fwd_lcores[i], lc_id);
 			if (diag != 0)
-				printf("launch lcore %u failed - diag=%d\n",
-				       lc_id, diag);
+				fprintf(stderr,
+					"launch lcore %u failed - diag=%d\n",
+					lc_id, diag);
 		}
 	}
 }
@@ -2150,11 +2139,11 @@ start_packet_forwarding(int with_tx_first)
 			cur_fwd_eng->fwd_mode_name);
 
 	if (all_ports_started() == 0) {
-		printf("Not all ports were started\n");
+		fprintf(stderr, "Not all ports were started\n");
 		return;
 	}
 	if (test_done == 0) {
-		printf("Packet forwarding already started\n");
+		fprintf(stderr, "Packet forwarding already started\n");
 		return;
 	}
 	test_done = 0;
@@ -2197,7 +2186,7 @@ stop_packet_forwarding(void)
 	int i;
 
 	if (test_done) {
-		printf("Packet forwarding not started\n");
+		fprintf(stderr, "Packet forwarding not started\n");
 		return;
 	}
 	printf("Telling cores to stop...");
@@ -2223,14 +2212,14 @@ void
 dev_set_link_up(portid_t pid)
 {
 	if (rte_eth_dev_set_link_up(pid) < 0)
-		printf("\nSet link up fail.\n");
+		fprintf(stderr, "\nSet link up fail.\n");
 }
 
 void
 dev_set_link_down(portid_t pid)
 {
 	if (rte_eth_dev_set_link_down(pid) < 0)
-		printf("\nSet link down fail.\n");
+		fprintf(stderr, "\nSet link down fail.\n");
 }
 
 static int
@@ -2351,10 +2340,10 @@ setup_hairpin_queues(portid_t pi, portid_t p_pi, uint16_t cnt_pi)
 		if (rte_atomic16_cmpset(&(port->port_status),
 					RTE_PORT_HANDLING,
 					RTE_PORT_STOPPED) == 0)
-			printf("Port %d can not be set back "
-					"to stopped\n", pi);
-		printf("Fail to configure port %d hairpin "
-				"queues\n", pi);
+			fprintf(stderr,
+				"Port %d can not be set back to stopped\n", pi);
+		fprintf(stderr, "Fail to configure port %d hairpin queues\n",
+			pi);
 		/* try to reconfigure queues next time */
 		port->need_reconfig_queues = 1;
 		return -1;
@@ -2374,10 +2363,10 @@ setup_hairpin_queues(portid_t pi, portid_t p_pi, uint16_t cnt_pi)
 		if (rte_atomic16_cmpset(&(port->port_status),
 					RTE_PORT_HANDLING,
 					RTE_PORT_STOPPED) == 0)
-			printf("Port %d can not be set back "
-					"to stopped\n", pi);
-		printf("Fail to configure port %d hairpin "
-				"queues\n", pi);
+			fprintf(stderr,
+				"Port %d can not be set back to stopped\n", pi);
+		fprintf(stderr, "Fail to configure port %d hairpin queues\n",
+			pi);
 		/* try to reconfigure queues next time */
 		port->need_reconfig_queues = 1;
 		return -1;
@@ -2457,7 +2446,7 @@ start_port(portid_t pid)
 		port = &ports[pi];
 		if (rte_atomic16_cmpset(&(port->port_status), RTE_PORT_STOPPED,
 						 RTE_PORT_HANDLING) == 0) {
-			printf("Port %d is now not stopped\n", pi);
+			fprintf(stderr, "Port %d is now not stopped\n", pi);
 			continue;
 		}
 
@@ -2467,8 +2456,9 @@ start_port(portid_t pid)
 			if (flow_isolate_all) {
 				int ret = port_flow_isolate(pi, 1);
 				if (ret) {
-					printf("Failed to apply isolated"
-					       " mode on port %d\n", pi);
+					fprintf(stderr,
+						"Failed to apply isolated mode on port %d\n",
+						pi);
 					return -1;
 				}
 			}
@@ -2477,8 +2467,9 @@ start_port(portid_t pid)
 					port->socket_id);
 			if (nb_hairpinq > 0 &&
 			    rte_eth_dev_hairpin_capability_get(pi, &cap)) {
-				printf("Port %d doesn't support hairpin "
-				       "queues\n", pi);
+				fprintf(stderr,
+					"Port %d doesn't support hairpin queues\n",
+					pi);
 				return -1;
 			}
 			/* configure port */
@@ -2488,9 +2479,11 @@ start_port(portid_t pid)
 			if (diag != 0) {
 				if (rte_atomic16_cmpset(&(port->port_status),
 				RTE_PORT_HANDLING, RTE_PORT_STOPPED) == 0)
-					printf("Port %d can not be set back "
-							"to stopped\n", pi);
-				printf("Fail to configure port %d\n", pi);
+					fprintf(stderr,
+						"Port %d can not be set back to stopped\n",
+						pi);
+				fprintf(stderr, "Fail to configure port %d\n",
+					pi);
 				/* try to reconfigure port next time */
 				port->need_reconfig = 1;
 				return -1;
@@ -2519,10 +2512,12 @@ start_port(portid_t pid)
 				if (rte_atomic16_cmpset(&(port->port_status),
 							RTE_PORT_HANDLING,
 							RTE_PORT_STOPPED) == 0)
-					printf("Port %d can not be set back "
-							"to stopped\n", pi);
-				printf("Fail to configure port %d tx queues\n",
-				       pi);
+					fprintf(stderr,
+						"Port %d can not be set back to stopped\n",
+						pi);
+				fprintf(stderr,
+					"Fail to configure port %d tx queues\n",
+					pi);
 				/* try to reconfigure queues next time */
 				port->need_reconfig_queues = 1;
 				return -1;
@@ -2535,9 +2530,8 @@ start_port(portid_t pid)
 						mbuf_pool_find
 							(rxring_numa[pi], 0);
 					if (mp == NULL) {
-						printf("Failed to setup RX queue:"
-							"No mempool allocation"
-							" on the socket %d\n",
+						fprintf(stderr,
+							"Failed to setup RX queue: No mempool allocation on the socket %d\n",
 							rxring_numa[pi]);
 						return -1;
 					}
@@ -2552,9 +2546,8 @@ start_port(portid_t pid)
 						mbuf_pool_find
 							(port->socket_id, 0);
 					if (mp == NULL) {
-						printf("Failed to setup RX queue:"
-							"No mempool allocation"
-							" on the socket %d\n",
+						fprintf(stderr,
+							"Failed to setup RX queue: No mempool allocation on the socket %d\n",
 							port->socket_id);
 						return -1;
 					}
@@ -2571,10 +2564,12 @@ start_port(portid_t pid)
 				if (rte_atomic16_cmpset(&(port->port_status),
 							RTE_PORT_HANDLING,
 							RTE_PORT_STOPPED) == 0)
-					printf("Port %d can not be set back "
-							"to stopped\n", pi);
-				printf("Fail to configure port %d rx queues\n",
-				       pi);
+					fprintf(stderr,
+						"Port %d can not be set back to stopped\n",
+						pi);
+				fprintf(stderr,
+					"Fail to configure port %d rx queues\n",
+					pi);
 				/* try to reconfigure queues next time */
 				port->need_reconfig_queues = 1;
 				return -1;
@@ -2588,9 +2583,9 @@ start_port(portid_t pid)
 			diag = rte_eth_dev_set_ptypes(pi, RTE_PTYPE_UNKNOWN,
 					NULL, 0);
 			if (diag < 0)
-				printf(
-				"Port %d: Failed to disable Ptype parsing\n",
-				pi);
+				fprintf(stderr,
+					"Port %d: Failed to disable Ptype parsing\n",
+					pi);
 		}
 
 		p_pi = pi;
@@ -2599,20 +2594,22 @@ start_port(portid_t pid)
 		/* start port */
 		diag = rte_eth_dev_start(pi);
 		if (diag < 0) {
-			printf("Fail to start port %d: %s\n", pi,
-			       rte_strerror(-diag));
+			fprintf(stderr, "Fail to start port %d: %s\n",
+				pi, rte_strerror(-diag));
 
 			/* Fail to setup rx queue, return */
 			if (rte_atomic16_cmpset(&(port->port_status),
 				RTE_PORT_HANDLING, RTE_PORT_STOPPED) == 0)
-				printf("Port %d can not be set back to "
-							"stopped\n", pi);
+				fprintf(stderr,
+					"Port %d can not be set back to stopped\n",
+					pi);
 			continue;
 		}
 
 		if (rte_atomic16_cmpset(&(port->port_status),
 			RTE_PORT_HANDLING, RTE_PORT_STARTED) == 0)
-			printf("Port %d can not be set into started\n", pi);
+			fprintf(stderr, "Port %d can not be set into started\n",
+				pi);
 
 		if (eth_macaddr_get_print_err(pi, &mac_addr) == 0)
 			printf("Port %d: %02X:%02X:%02X:%02X:%02X:%02X\n", pi,
@@ -2629,7 +2626,7 @@ start_port(portid_t pid)
 	if (need_check_link_status == 1 && !no_link_check)
 		check_all_ports_link_status(RTE_PORT_ALL);
 	else if (need_check_link_status == 0)
-		printf("Please stop the ports first\n");
+		fprintf(stderr, "Please stop the ports first\n");
 
 	if (hairpin_mode & 0xf) {
 		uint16_t i;
@@ -2648,10 +2645,10 @@ start_port(portid_t pid)
 					continue;
 				diag = rte_eth_hairpin_bind(pi, peer_pl[j]);
 				if (diag < 0) {
-					printf("Error during binding hairpin"
-					       " Tx port %u to %u: %s\n",
-					       pi, peer_pl[j],
-					       rte_strerror(-diag));
+					fprintf(stderr,
+						"Error during binding hairpin Tx port %u to %u: %s\n",
+						pi, peer_pl[j],
+						rte_strerror(-diag));
 					return -1;
 				}
 			}
@@ -2665,10 +2662,10 @@ start_port(portid_t pid)
 					continue;
 				diag = rte_eth_hairpin_bind(peer_pl[j], pi);
 				if (diag < 0) {
-					printf("Error during binding hairpin"
-					       " Tx port %u to %u: %s\n",
-					       peer_pl[j], pi,
-					       rte_strerror(-diag));
+					fprintf(stderr,
+						"Error during binding hairpin Tx port %u to %u: %s\n",
+						peer_pl[j], pi,
+						rte_strerror(-diag));
 					return -1;
 				}
 			}
@@ -2698,12 +2695,16 @@ stop_port(portid_t pid)
 			continue;
 
 		if (port_is_forwarding(pi) != 0 && test_done == 0) {
-			printf("Please remove port %d from forwarding configuration.\n", pi);
+			fprintf(stderr,
+				"Please remove port %d from forwarding configuration.\n",
+				pi);
 			continue;
 		}
 
 		if (port_is_bonding_slave(pi)) {
-			printf("Please remove port %d from bonded device.\n", pi);
+			fprintf(stderr,
+				"Please remove port %d from bonded device.\n",
+				pi);
 			continue;
 		}
 
@@ -2737,7 +2738,8 @@ stop_port(portid_t pid)
 
 		if (rte_atomic16_cmpset(&(port->port_status),
 			RTE_PORT_HANDLING, RTE_PORT_STOPPED) == 0)
-			printf("Port %d can not be set into stopped\n", pi);
+			fprintf(stderr, "Port %d can not be set into stopped\n",
+				pi);
 		need_check_link_status = 1;
 	}
 	if (need_check_link_status && !no_link_check)
@@ -2784,19 +2786,23 @@ close_port(portid_t pid)
 			continue;
 
 		if (port_is_forwarding(pi) != 0 && test_done == 0) {
-			printf("Please remove port %d from forwarding configuration.\n", pi);
+			fprintf(stderr,
+				"Please remove port %d from forwarding configuration.\n",
+				pi);
 			continue;
 		}
 
 		if (port_is_bonding_slave(pi)) {
-			printf("Please remove port %d from bonded device.\n", pi);
+			fprintf(stderr,
+				"Please remove port %d from bonded device.\n",
+				pi);
 			continue;
 		}
 
 		port = &ports[pi];
 		if (rte_atomic16_cmpset(&(port->port_status),
 			RTE_PORT_CLOSED, RTE_PORT_CLOSED) == 1) {
-			printf("Port %d is already closed\n", pi);
+			fprintf(stderr, "Port %d is already closed\n", pi);
 			continue;
 		}
 
@@ -2820,7 +2826,8 @@ reset_port(portid_t pid)
 
 	if ((pid == (portid_t)RTE_PORT_ALL && !all_ports_stopped()) ||
 		(pid != (portid_t)RTE_PORT_ALL && !port_is_stopped(pid))) {
-		printf("Can not reset port(s), please stop port(s) first.\n");
+		fprintf(stderr,
+			"Can not reset port(s), please stop port(s) first.\n");
 		return;
 	}
 
@@ -2831,14 +2838,16 @@ reset_port(portid_t pid)
 			continue;
 
 		if (port_is_forwarding(pi) != 0 && test_done == 0) {
-			printf("Please remove port %d from forwarding "
-			       "configuration.\n", pi);
+			fprintf(stderr,
+				"Please remove port %d from forwarding configuration.\n",
+				pi);
 			continue;
 		}
 
 		if (port_is_bonding_slave(pi)) {
-			printf("Please remove port %d from bonded device.\n",
-			       pi);
+			fprintf(stderr,
+				"Please remove port %d from bonded device.\n",
+				pi);
 			continue;
 		}
 
@@ -2848,7 +2857,8 @@ reset_port(portid_t pid)
 			port->need_reconfig = 1;
 			port->need_reconfig_queues = 1;
 		} else {
-			printf("Failed to reset port %d. diag=%d\n", pi, diag);
+			fprintf(stderr, "Failed to reset port %d. diag=%d\n",
+				pi, diag);
 		}
 	}
 
@@ -2864,7 +2874,7 @@ attach_port(char *identifier)
 	printf("Attaching a new port...\n");
 
 	if (identifier == NULL) {
-		printf("Invalid parameters are specified\n");
+		fprintf(stderr, "Invalid parameters are specified\n");
 		return;
 	}
 
@@ -2905,7 +2915,8 @@ setup_attached_port(portid_t pi)
 	reconfig(pi, socket_id);
 	ret = rte_eth_promiscuous_enable(pi);
 	if (ret != 0)
-		printf("Error during enabling promiscuous mode for port %u: %s - ignore\n",
+		fprintf(stderr,
+			"Error during enabling promiscuous mode for port %u: %s - ignore\n",
 			pi, rte_strerror(-ret));
 
 	ports_ids[nb_ports++] = pi;
@@ -2924,7 +2935,7 @@ detach_device(struct rte_device *dev)
 	portid_t sibling;
 
 	if (dev == NULL) {
-		printf("Device already removed\n");
+		fprintf(stderr, "Device already removed\n");
 		return;
 	}
 
@@ -2933,7 +2944,8 @@ detach_device(struct rte_device *dev)
 	RTE_ETH_FOREACH_DEV_OF(sibling, dev) {
 		if (ports[sibling].port_status != RTE_PORT_CLOSED) {
 			if (ports[sibling].port_status != RTE_PORT_STOPPED) {
-				printf("Port %u not stopped\n", sibling);
+				fprintf(stderr, "Port %u not stopped\n",
+					sibling);
 				return;
 			}
 			port_flow_flush(sibling);
@@ -2960,10 +2972,10 @@ detach_port_device(portid_t port_id)
 
 	if (ports[port_id].port_status != RTE_PORT_CLOSED) {
 		if (ports[port_id].port_status != RTE_PORT_STOPPED) {
-			printf("Port not stopped\n");
+			fprintf(stderr, "Port not stopped\n");
 			return;
 		}
-		printf("Port was not closed\n");
+		fprintf(stderr, "Port was not closed\n");
 	}
 
 	detach_device(rte_eth_devices[port_id].device);
@@ -2980,14 +2992,15 @@ detach_devargs(char *identifier)
 
 	memset(&da, 0, sizeof(da));
 	if (rte_devargs_parsef(&da, "%s", identifier)) {
-		printf("cannot parse identifier\n");
+		fprintf(stderr, "cannot parse identifier\n");
 		return;
 	}
 
 	RTE_ETH_FOREACH_MATCHING_DEV(port_id, identifier, &iterator) {
 		if (ports[port_id].port_status != RTE_PORT_CLOSED) {
 			if (ports[port_id].port_status != RTE_PORT_STOPPED) {
-				printf("Port %u not stopped\n", port_id);
+				fprintf(stderr, "Port %u not stopped\n",
+					port_id);
 				rte_eth_iterator_cleanup(&iterator);
 				rte_devargs_reset(&da);
 				return;
@@ -3103,7 +3116,8 @@ check_all_ports_link_status(uint32_t port_mask)
 			if (ret < 0) {
 				all_ports_up = 0;
 				if (print_flag == 1)
-					printf("Port %u link get failed: %s\n",
+					fprintf(stderr,
+						"Port %u link get failed: %s\n",
 						portid, rte_strerror(-ret));
 				continue;
 			}
@@ -3175,7 +3189,8 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
 	RTE_SET_USED(ret_param);
 
 	if (type >= RTE_ETH_EVENT_MAX) {
-		fprintf(stderr, "\nPort %" PRIu16 ": %s called upon invalid event %d\n",
+		fprintf(stderr,
+			"\nPort %" PRIu16 ": %s called upon invalid event %d\n",
 			port_id, __func__, type);
 		fflush(stderr);
 	} else if (event_print_mask & (UINT32_C(1) << type)) {
@@ -3194,7 +3209,8 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
 			break;
 		if (rte_eal_alarm_set(100000,
 				rmv_port_callback, (void *)(intptr_t)port_id))
-			fprintf(stderr, "Could not set up deferred device removal\n");
+			fprintf(stderr,
+				"Could not set up deferred device removal\n");
 		break;
 	case RTE_ETH_EVENT_DESTROY:
 		ports[port_id].port_status = RTE_PORT_CLOSED;
@@ -3371,7 +3387,8 @@ update_jumbo_frame_offload(portid_t portid)
 		on = false;
 	} else {
 		if ((port->dev_info.rx_offload_capa & DEV_RX_OFFLOAD_JUMBO_FRAME) == 0) {
-			printf("Frame size (%u) is not supported by port %u\n",
+			fprintf(stderr,
+				"Frame size (%u) is not supported by port %u\n",
 				port->dev_conf.rxmode.max_rx_pkt_len,
 				portid);
 			return -1;
@@ -3401,7 +3418,8 @@ update_jumbo_frame_offload(portid_t portid)
 		ret = rte_eth_dev_set_mtu(portid,
 				port->dev_conf.rxmode.max_rx_pkt_len - eth_overhead);
 		if (ret)
-			printf("Failed to set MTU to %u for port %u\n",
+			fprintf(stderr,
+				"Failed to set MTU to %u for port %u\n",
 				port->dev_conf.rxmode.max_rx_pkt_len - eth_overhead,
 				portid);
 	}
@@ -3615,8 +3633,9 @@ init_port_dcb_config(portid_t pid,
 	 */
 	if (dcb_mode == DCB_VT_ENABLED &&
 	    rte_port->dev_info.vmdq_pool_base > 0) {
-		printf("VMDQ_DCB multi-queue mode is nonsensical"
-			" for port %d.", pid);
+		fprintf(stderr,
+			"VMDQ_DCB multi-queue mode is nonsensical for port %d.\n",
+			pid);
 		return -1;
 	}
 
@@ -3714,8 +3733,8 @@ static void
 signal_handler(int signum)
 {
 	if (signum == SIGINT || signum == SIGTERM) {
-		printf("\nSignal %d received, preparing to exit...\n",
-				signum);
+		fprintf(stderr, "\nSignal %d received, preparing to exit...\n",
+			signum);
 #ifdef RTE_LIB_PDUMP
 		/* uninitialize packet capture framework */
 		rte_pdump_uninit();
@@ -3814,18 +3833,19 @@ main(int argc, char** argv)
 				"interactive mode.\n");
 
 	if (tx_first && lsc_interrupt) {
-		printf("Warning: lsc_interrupt needs to be off when "
-				" using tx_first. Disabling.\n");
+		fprintf(stderr,
+			"Warning: lsc_interrupt needs to be off when using tx_first. Disabling.\n");
 		lsc_interrupt = 0;
 	}
 
 	if (!nb_rxq && !nb_txq)
-		printf("Warning: Either rx or tx queues should be non-zero\n");
+		fprintf(stderr,
+			"Warning: Either rx or tx queues should be non-zero\n");
 
 	if (nb_rxq > 1 && nb_rxq > nb_txq)
-		printf("Warning: nb_rxq=%d enables RSS configuration, "
-		       "but nb_txq=%d will prevent to fully test it.\n",
-		       nb_rxq, nb_txq);
+		fprintf(stderr,
+			"Warning: nb_rxq=%d enables RSS configuration, but nb_txq=%d will prevent to fully test it.\n",
+			nb_rxq, nb_txq);
 
 	init_config();
 
@@ -3860,7 +3880,8 @@ main(int argc, char** argv)
 	RTE_ETH_FOREACH_DEV(port_id) {
 		ret = rte_eth_promiscuous_enable(port_id);
 		if (ret != 0)
-			printf("Error during enabling promiscuous mode for port %u: %s - ignore\n",
+			fprintf(stderr,
+				"Error during enabling promiscuous mode for port %u: %s - ignore\n",
 				port_id, rte_strerror(-ret));
 	}
 
@@ -3871,9 +3892,10 @@ main(int argc, char** argv)
 	if (latencystats_enabled != 0) {
 		int ret = rte_latencystats_init(1, NULL);
 		if (ret)
-			printf("Warning: latencystats init()"
-				" returned error %d\n",	ret);
-		printf("Latencystats running on lcore %d\n",
+			fprintf(stderr,
+				"Warning: latencystats init() returned error %d\n",
+				ret);
+		fprintf(stderr, "Latencystats running on lcore %d\n",
 			latencystats_lcore_id);
 	}
 #endif
diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
index a9e431a8b2..180a444ea2 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -432,8 +432,9 @@ eth_dev_info_get_print_err(uint16_t port_id,
 
 	ret = rte_eth_dev_info_get(port_id, dev_info);
 	if (ret != 0)
-		printf("Error during getting device (port %u) info: %s\n",
-				port_id, strerror(-ret));
+		fprintf(stderr,
+			"Error during getting device (port %u) info: %s\n",
+			port_id, strerror(-ret));
 
 	return ret;
 }
@@ -449,7 +450,8 @@ eth_set_promisc_mode(uint16_t port, int enable)
 		ret = rte_eth_promiscuous_disable(port);
 
 	if (ret != 0)
-		printf("Error during %s promiscuous mode for port %u: %s\n",
+		fprintf(stderr,
+			"Error during %s promiscuous mode for port %u: %s\n",
 			enable ? "enabling" : "disabling",
 			port, rte_strerror(-ret));
 }
@@ -465,7 +467,8 @@ eth_set_allmulticast_mode(uint16_t port, int enable)
 		ret = rte_eth_allmulticast_disable(port);
 
 	if (ret != 0)
-		printf("Error during %s all-multicast mode for port %u: %s\n",
+		fprintf(stderr,
+			"Error during %s all-multicast mode for port %u: %s\n",
 			enable ? "enabling" : "disabling",
 			port, rte_strerror(-ret));
 }
@@ -477,7 +480,8 @@ eth_link_get_nowait_print_err(uint16_t port_id, struct rte_eth_link *link)
 
 	ret = rte_eth_link_get_nowait(port_id, link);
 	if (ret < 0)
-		printf("Device (port %u) link get (without wait) failed: %s\n",
+		fprintf(stderr,
+			"Device (port %u) link get (without wait) failed: %s\n",
 			port_id, rte_strerror(-ret));
 
 	return ret;
@@ -490,8 +494,9 @@ eth_macaddr_get_print_err(uint16_t port_id, struct rte_ether_addr *mac_addr)
 
 	ret = rte_eth_macaddr_get(port_id, mac_addr);
 	if (ret != 0)
-		printf("Error getting device (port %u) mac address: %s\n",
-				port_id, rte_strerror(-ret));
+		fprintf(stderr,
+			"Error getting device (port %u) mac address: %s\n",
+			port_id, rte_strerror(-ret));
 
 	return ret;
 }
diff --git a/doc/guides/rel_notes/release_21_08.rst b/doc/guides/rel_notes/release_21_08.rst
index a6ecfdf3ce..edfb3df478 100644
--- a/doc/guides/rel_notes/release_21_08.rst
+++ b/doc/guides/rel_notes/release_21_08.rst
@@ -55,6 +55,11 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Updated testpmd to log errors to stderr.**
+
+  Updated testpmd application to log errors and warnings to stderr
+  instead of stdout used before.
+
 
 Removed Items
 -------------
-- 
2.30.2


  parent reply	other threads:[~2021-06-16 16:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 16:24 [dpdk-dev] [PATCH] " Andrew Rybchenko
2021-06-11  2:06 ` Li, Xiaoyun
2021-06-11  9:19   ` Andrew Rybchenko
2021-06-11 10:35     ` Ferruh Yigit
2021-06-11 13:21       ` Bruce Richardson
2021-06-14 16:47         ` Andrew Rybchenko
2021-06-14 16:56       ` Andrew Rybchenko
2021-06-14 17:49         ` Singh, Aman Deep
2021-06-15  7:59         ` Ferruh Yigit
2021-06-15  8:14           ` Andrew Rybchenko
2021-06-15  8:52             ` Ferruh Yigit
2021-06-15  9:00               ` Andrew Rybchenko
2021-06-15  9:53                 ` Ferruh Yigit
2021-06-16 16:32 ` Andrew Rybchenko [this message]
2021-06-17  3:29   ` [dpdk-dev] [PATCH v2] " Li, Xiaoyun
2021-06-17 14:21     ` Andrew Rybchenko
2021-06-17 14:20 ` [dpdk-dev] [PATCH v3] " Andrew Rybchenko
2021-06-18  8:32   ` Li, Xiaoyun
2021-06-28 11:05     ` Andrew Rybchenko
2021-07-24 13:14     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210616163209.823918-1-andrew.rybchenko@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=aman.deep.singh@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=orika@nvidia.com \
    --cc=xiaoyun.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).