return;
}
port = &ports[port_id];
- rte_eth_link_get_nowait(port_id, &link);
+ ret = eth_link_get_nowait_print_err(port_id, &link);
+ if (ret < 0)
+ return;
ret = eth_dev_info_get_print_err(port_id, &dev_info);
if (ret != 0)
return;
}
- rte_eth_link_get_nowait(port_id, &link);
+ ret = eth_link_get_nowait_print_err(port_id, &link);
+ if (ret < 0)
+ return;
ret = eth_dev_info_get_print_err(port_id, &dev_info);
if (ret != 0)
{
int diag;
struct rte_eth_link link;
+ int ret;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return 1;
- rte_eth_link_get_nowait(port_id, &link);
+ ret = eth_link_get_nowait_print_err(port_id, &link);
+ if (ret < 0)
+ return 1;
if (rate > link.link_speed) {
printf("Invalid rate value:%u bigger than link speed: %u\n",
rate, link.link_speed);
return 0;
}
-static void
+static int
set_tm_hiearchy_nodes_shaper_rate(portid_t port_id,
struct tm_hierarchy *h)
{
struct rte_eth_link link_params;
uint64_t tm_port_rate;
+ int ret;
memset(&link_params, 0, sizeof(link_params));
- rte_eth_link_get(port_id, &link_params);
+ ret = rte_eth_link_get(port_id, &link_params);
+ if (ret < 0) {
+ printf("Error during getting device (port %u) link info: %s\n",
+ port_id, rte_strerror(-ret));
+ return ret;
+ }
tm_port_rate = (uint64_t)ETH_SPEED_NUM_10G * BYTES_IN_MBPS;
/* Set tm hierarchy shapers rate */
= h->subport_node_shaper_rate / PIPE_NODES_PER_SUBPORT;
h->tc_node_shaper_rate = h->pipe_node_shaper_rate;
h->tc_node_shared_shaper_rate = h->subport_node_shaper_rate;
+
+ return 0;
}
static int
memset(&h, 0, sizeof(struct tm_hierarchy));
/* TM hierarchy shapers rate */
- set_tm_hiearchy_nodes_shaper_rate(port_id, &h);
+ status = set_tm_hiearchy_nodes_shaper_rate(port_id, &h);
+ if (status)
+ return status;
/* Add root node (level 0) */
status = softport_tm_root_node_add(port_id, &h, error);
portid_t portid;
uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
+ int ret;
printf("Checking link statuses...\n");
fflush(stdout);
if ((port_mask & (1 << portid)) == 0)
continue;
memset(&link, 0, sizeof(link));
- rte_eth_link_get_nowait(portid, &link);
+ ret = rte_eth_link_get_nowait(portid, &link);
+ if (ret < 0) {
+ all_ports_up = 0;
+ if (print_flag == 1)
+ printf("Port %u link get failed: %s\n",
+ portid, rte_strerror(-ret));
+ continue;
+ }
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
int eth_dev_info_get_print_err(uint16_t port_id,
struct rte_eth_dev_info *dev_info);
void eth_set_promisc_mode(uint16_t port_id, int enable);
+int eth_link_get_nowait_print_err(uint16_t port_id, struct rte_eth_link *link);
/* Functions to manage the set of filtered Multicast MAC addresses */
enable ? "enabling" : "disabling",
port, rte_strerror(-ret));
}
+
+int
+eth_link_get_nowait_print_err(uint16_t port_id, struct rte_eth_link *link)
+{
+ int ret;
+
+ ret = rte_eth_link_get_nowait(port_id, link);
+ if (ret < 0)
+ printf("Device (port %u) link get (without wait) failed: %s\n",
+ port_id, rte_strerror(-ret));
+
+ return ret;
+}