From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Xiaoyun Li <xiaoyun.li@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] app/testpmd: send failure logs to stderr
Date: Thu, 27 May 2021 19:24:52 +0300 [thread overview]
Message-ID: <20210527162452.1568351-1-andrew.rybchenko@oktetlabs.ru> (raw)
Running with stdout suppressed or redirected for further processing
is very confusing in the case of errors.
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
app/test-pmd/testpmd.c | 151 ++++++++++++++++++++---------------------
1 file changed, 75 insertions(+), 76 deletions(-)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 8ed1b97dec..a5ad4ef4e9 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1126,11 +1126,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 +1174,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 +1247,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 +1328,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 +1384,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 +1442,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 +1617,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 +1652,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 +2110,8 @@ 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);
}
}
}
@@ -2223,14 +2213,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
@@ -2353,8 +2343,8 @@ setup_hairpin_queues(portid_t pi, portid_t p_pi, uint16_t cnt_pi)
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, "Fail to configure port %d hairpin queues\n",
+ pi);
/* try to reconfigure queues next time */
port->need_reconfig_queues = 1;
return -1;
@@ -2376,8 +2366,8 @@ setup_hairpin_queues(portid_t pi, portid_t p_pi, uint16_t cnt_pi)
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, "Fail to configure port %d hairpin queues\n",
+ pi);
/* try to reconfigure queues next time */
port->need_reconfig_queues = 1;
return -1;
@@ -2467,8 +2457,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 +2468,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 */
@@ -2490,7 +2482,8 @@ start_port(portid_t pid)
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, "Fail to configure port %d\n",
+ pi);
/* try to reconfigure port next time */
port->need_reconfig = 1;
return -1;
@@ -2521,8 +2514,9 @@ start_port(portid_t pid)
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,
+ "Fail to configure port %d tx queues\n",
+ pi);
/* try to reconfigure queues next time */
port->need_reconfig_queues = 1;
return -1;
@@ -2535,7 +2529,8 @@ start_port(portid_t pid)
mbuf_pool_find
(rxring_numa[pi], 0);
if (mp == NULL) {
- printf("Failed to setup RX queue:"
+ fprintf(stderr,
+ "Failed to setup RX queue:"
"No mempool allocation"
" on the socket %d\n",
rxring_numa[pi]);
@@ -2552,7 +2547,8 @@ start_port(portid_t pid)
mbuf_pool_find
(port->socket_id, 0);
if (mp == NULL) {
- printf("Failed to setup RX queue:"
+ fprintf(stderr,
+ "Failed to setup RX queue:"
"No mempool allocation"
" on the socket %d\n",
port->socket_id);
@@ -2573,8 +2569,9 @@ start_port(portid_t pid)
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,
+ "Fail to configure port %d rx queues\n",
+ pi);
/* try to reconfigure queues next time */
port->need_reconfig_queues = 1;
return -1;
@@ -2588,9 +2585,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,8 +2596,8 @@ 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),
@@ -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;
}
}
@@ -2848,7 +2845,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);
}
}
@@ -3103,7 +3101,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;
}
@@ -3401,7 +3400,7 @@ 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);
}
--
2.30.2
next reply other threads:[~2021-05-27 16:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-27 16:24 Andrew Rybchenko [this message]
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 ` [dpdk-dev] [PATCH v2] " Andrew Rybchenko
2021-06-17 3:29 ` 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=20210527162452.1568351-1-andrew.rybchenko@oktetlabs.ru \
--to=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--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).