examples: use new link status print format

Add usage of rte_eth_link_to_str function to example
applications.

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Ivan Dyukov 2020-09-15 22:07:02 +03:00 committed by Ferruh Yigit
parent ba5509a6a8
commit db4e81351f
26 changed files with 137 additions and 211 deletions

View File

@ -326,8 +326,10 @@ check_port_link_status(uint16_t port_id)
const char *dp = (link.link_duplex ==
ETH_LINK_FULL_DUPLEX) ?
"full-duplex" : "half-duplex";
printf("\nPort %u Link Up - speed %u Mbps - %s\n",
port_id, link.link_speed, dp);
printf("\nPort %u Link Up - speed %s - %s\n",
port_id,
rte_eth_link_speed_to_str(link.link_speed),
dp);
return 0;
}
printf(".");

View File

@ -700,6 +700,7 @@ check_link_status(uint32_t port_mask)
uint16_t portid;
struct rte_eth_link link;
int ret, link_status = 0;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status\n");
RTE_ETH_FOREACH_DEV(portid) {
@ -715,15 +716,12 @@ check_link_status(uint32_t port_mask)
}
/* Print link status */
if (link.link_status) {
printf(
"Port %d Link Up. Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid, link_status_text);
if (link.link_status)
link_status = 1;
} else
printf("Port %d Link Down\n", portid);
}
return link_status;
}

View File

@ -593,6 +593,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -612,14 +613,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up .Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -273,7 +273,7 @@ print_link_info(struct link *link, char *out, size_t out_size)
"\n"
"%s: flags=<%s> mtu %u\n"
"\tether %02X:%02X:%02X:%02X:%02X:%02X rxqueues %u txqueues %u\n"
"\tport# %u speed %u Mbps\n"
"\tport# %u speed %s\n"
"\tRX packets %" PRIu64" bytes %" PRIu64"\n"
"\tRX errors %" PRIu64" missed %" PRIu64" no-mbuf %" PRIu64"\n"
"\tTX packets %" PRIu64" bytes %" PRIu64"\n"
@ -287,7 +287,7 @@ print_link_info(struct link *link, char *out, size_t out_size)
link->n_rxq,
link->n_txq,
link->port_id,
eth_link.link_speed,
rte_eth_link_speed_to_str(eth_link.link_speed),
stats.ipackets,
stats.ibytes,
stats.ierrors,

View File

@ -709,6 +709,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -728,14 +729,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -1842,6 +1842,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -1861,14 +1862,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up - speed %u Mbps -%s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -572,6 +572,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -591,14 +592,11 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text),
&link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -661,6 +661,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status\n");
fflush(stdout);
@ -680,14 +681,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up - speed %uMbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */
@ -717,19 +714,15 @@ check_all_ports_link_status(uint32_t port_mask)
static void
log_link_state(struct rte_kni *kni, int prev, struct rte_eth_link *link)
{
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
if (kni == NULL || link == NULL)
return;
if (prev == ETH_LINK_DOWN && link->link_status == ETH_LINK_UP) {
RTE_LOG(INFO, APP, "%s NIC Link is Up %d Mbps %s %s.\n",
rte_eth_link_to_str(link_status_text, sizeof(link_status_text), link);
if (prev != link->link_status)
RTE_LOG(INFO, APP, "%s NIC %s",
rte_kni_get_name(kni),
link->link_speed,
link->link_autoneg ? "(AutoNeg)" : "(Fixed)",
link->link_duplex ? "Full Duplex" : "Half Duplex");
} else if (prev == ETH_LINK_UP && link->link_status == ETH_LINK_DOWN) {
RTE_LOG(INFO, APP, "%s NIC Link is Down.\n",
rte_kni_get_name(kni));
}
link_status_text);
}
/*

View File

@ -1734,6 +1734,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -1753,14 +1754,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -363,6 +363,7 @@ check_all_ports_link_status(struct l2fwd_resources *rsrc,
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status...");
fflush(stdout);
@ -386,14 +387,10 @@ check_all_ports_link_status(struct l2fwd_resources *rsrc,
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps - %s\n",
port_id, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", port_id);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", port_id,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -686,6 +686,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -705,14 +706,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -450,6 +450,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -469,14 +470,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -568,6 +568,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -591,14 +592,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -1812,6 +1812,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -1831,14 +1832,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -596,6 +596,7 @@ check_all_ports_link_status(uint32_t port_mask)
struct rte_eth_link link;
uint16_t portid;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -620,16 +621,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* Print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf("Port%d Link Up. Speed %u Mbps "
"-%s\n",
portid, link.link_speed,
(link.link_duplex ==
ETH_LINK_FULL_DUPLEX)
? ("full-duplex")
: ("half-duplex\n"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* Clear all_ports_up flag if any link down */

View File

@ -2134,6 +2134,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint16_t portid;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -2153,15 +2154,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf("Port %d Link Up - speed %u "
"Mbps - %s\n", (uint8_t)portid,
(unsigned)link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n",
(uint8_t)portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -24,6 +24,8 @@ PKGCONF ?= pkg-config
PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
# Added for 'rte_eth_link_to_str()'
CFLAGS += -DALLOW_EXPERIMENTAL_API
LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)

View File

@ -807,6 +807,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -830,14 +831,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps -%s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -133,7 +133,7 @@ print_stats(void)
link_get_err = rte_eth_link_get_nowait(portid, &link);
printf("\nStatistics for port %u ------------------------------"
"\nLink status: %25s"
"\nLink speed: %26u"
"\nLink speed: %26s"
"\nLink duplex: %25s"
"\nPackets sent: %24"PRIu64
"\nPackets received: %20"PRIu64
@ -141,8 +141,8 @@ print_stats(void)
portid,
link_get_err < 0 ? "Link get failed" :
(link.link_status ? "Link up" : "Link down"),
link_get_err < 0 ? 0 :
(unsigned int)link.link_speed,
link_get_err < 0 ? "0" :
rte_eth_link_speed_to_str(link.link_speed),
link_get_err < 0 ? "Link get failed" :
(link.link_duplex == ETH_LINK_FULL_DUPLEX ? \
"full-duplex" : "half-duplex"),
@ -442,6 +442,7 @@ lsi_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param,
{
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
RTE_SET_USED(param);
RTE_SET_USED(ret_param);
@ -454,13 +455,8 @@ lsi_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param,
port_id, rte_strerror(-ret));
return ret;
}
if (link.link_status) {
printf("Port %d Link Up - speed %u Mbps - %s\n\n",
port_id, (unsigned)link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
} else
printf("Port %d Link Down\n\n", port_id);
rte_eth_link_to_str(link_status_text, sizeof(link_status_text), &link);
printf("Port %d %s\n\n", port_id, link_status_text);
return 0;
}
@ -475,6 +471,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
uint16_t portid;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -494,14 +491,10 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -185,6 +185,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -204,15 +205,11 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf("Port %d Link Up - speed %u "
"Mbps - %s\n", ports->id[portid],
(unsigned)link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n",
(uint8_t)ports->id[portid]);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n",
ports->id[portid],
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -365,6 +365,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -384,14 +385,10 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -729,6 +729,7 @@ start_pkt_fwd(void)
struct rte_eth_link eth_link;
uint32_t lcore_id;
int ret, i;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
ret = ntb_fwd_config_setup();
if (ret < 0) {
@ -747,11 +748,11 @@ start_pkt_fwd(void)
return;
}
if (eth_link.link_status) {
printf("Eth%u Link Up. Speed %u Mbps - %s\n",
eth_port_id, eth_link.link_speed,
(eth_link.link_duplex ==
ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text),
&eth_link);
printf("Eth%u %s\n", eth_port_id,
link_status_text);
break;
}
}

View File

@ -3430,6 +3430,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -3449,14 +3450,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps - %s\n",
portid, link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n", portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -76,6 +76,7 @@ app_init_port(uint16_t portid, struct rte_mempool *mp)
uint16_t rx_size;
uint16_t tx_size;
struct rte_eth_conf local_port_conf = port_conf;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
/* check if port already initialized (multistream configuration) */
if (app_inited_port_mask & (1u << portid))
@ -160,14 +161,9 @@ app_init_port(uint16_t portid, struct rte_mempool *mp)
"rte_eth_link_get: err=%d, port=%u: %s\n",
ret, portid, rte_strerror(-ret));
if (link.link_status) {
printf(" Link Up - speed %u Mbps - %s\n",
(uint32_t) link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
} else {
printf(" Link Down\n");
}
rte_eth_link_to_str(link_status_text, sizeof(link_status_text), &link);
printf("%s\n", link_status_text);
ret = rte_eth_promiscuous_enable(portid);
if (ret != 0)
rte_exit(EXIT_FAILURE,

View File

@ -247,6 +247,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
uint16_t portid;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -266,16 +267,10 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf(
"Port%d Link Up. Speed %u Mbps - %s\n",
info->id[portid],
link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n",
info->id[portid]);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", info->id[portid],
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */

View File

@ -246,6 +246,7 @@ check_all_ports_link_status(uint32_t port_mask)
uint16_t portid, count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
int ret;
char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
printf("\nChecking link status");
fflush(stdout);
@ -269,15 +270,10 @@ check_all_ports_link_status(uint32_t port_mask)
}
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf("Port %d Link Up - speed %u "
"Mbps - %s\n", (uint16_t)portid,
(unsigned int)link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex"));
else
printf("Port %d Link Down\n",
(uint16_t)portid);
rte_eth_link_to_str(link_status_text,
sizeof(link_status_text), &link);
printf("Port %d %s\n", portid,
link_status_text);
continue;
}
/* clear all_ports_up flag if any link down */