void
nic_xstats_clear(portid_t port_id)
{
- rte_eth_xstats_reset(port_id);
+ int ret;
+
+ 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));
+ }
}
void
/* List ports with matching device name */
RTE_ETH_FOREACH_DEV_OF(port_id, dev) {
- rte_eth_macaddr_get(port_id, &mac_addr);
printf("\n\tPort id: %-2d", port_id);
- print_ethaddr("\n\tMAC address: ", &mac_addr);
+ if (eth_macaddr_get_print_err(port_id,
+ &mac_addr) == 0)
+ print_ethaddr("\n\tMAC address: ",
+ &mac_addr);
rte_eth_dev_get_name_by_port(port_id, name);
printf("\n\tDevice name: %s", name);
printf("\n");
static const char *info_border = "*********************";
uint16_t mtu;
char name[RTE_ETH_NAME_MAX_LEN];
+ int ret;
if (port_id_is_invalid(port_id, ENABLED_WARN)) {
print_valid_ports();
return;
}
port = &ports[port_id];
- rte_eth_link_get_nowait(port_id, &link);
- memset(&dev_info, 0, sizeof(dev_info));
- rte_eth_dev_info_get(port_id, &dev_info);
+ 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;
+
printf("\n%s Infos for port %-2d %s\n",
info_border, port_id, info_border);
- rte_eth_macaddr_get(port_id, &mac_addr);
- print_ethaddr("MAC address: ", &mac_addr);
+ if (eth_macaddr_get_print_err(port_id, &mac_addr) == 0)
+ print_ethaddr("MAC address: ", &mac_addr);
rte_eth_dev_get_name_by_port(port_id, name);
printf("\nDevice name: %s", name);
printf("\nDriver name: %s", dev_info.driver_name);
struct rte_eth_link link;
struct rte_eth_dev_info dev_info;
char name[RTE_ETH_NAME_MAX_LEN];
+ int ret;
if (port_id_is_invalid(port_id, ENABLED_WARN)) {
print_valid_ports();
return;
}
- rte_eth_link_get_nowait(port_id, &link);
- rte_eth_dev_info_get(port_id, &dev_info);
+ 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_dev_get_name_by_port(port_id, name);
- rte_eth_macaddr_get(port_id, &mac_addr);
+ ret = eth_macaddr_get_print_err(port_id, &mac_addr);
+ if (ret != 0)
+ return;
printf("%-4d %02X:%02X:%02X:%02X:%02X:%02X %-12s %-14s %-8s %uMbps\n",
port_id, mac_addr.addr_bytes[0], mac_addr.addr_bytes[1],
{
struct rte_eth_dev_info dev_info;
static const char *info_border = "************";
+ int ret;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
- rte_eth_dev_info_get(port_id, &dev_info);
+ ret = eth_dev_info_get_print_err(port_id, &dev_info);
+ if (ret != 0)
+ return;
printf("\n%s Port %d supported offload features: %s\n",
info_border, port_id, info_border);
{
int diag;
struct rte_eth_dev_info dev_info;
+ int ret;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
- rte_eth_dev_info_get(port_id, &dev_info);
+
+ ret = eth_dev_info_get_print_err(port_id, &dev_info);
+ if (ret != 0)
+ 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",
mtu, dev_info.min_mtu, dev_info.max_mtu);
#endif
uint16_t desc_id)
{
+ int ret;
struct igb_ring_desc_16_bytes *ring =
(struct igb_ring_desc_16_bytes *)ring_mz->addr;
#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
struct rte_eth_dev_info dev_info;
- memset(&dev_info, 0, sizeof(dev_info));
- rte_eth_dev_info_get(port_id, &dev_info);
+ ret = eth_dev_info_get_print_err(port_id, &dev_info);
+ if (ret != 0)
+ return;
+
if (strstr(dev_info.driver_name, "i40e") != NULL) {
/* 32 bytes RX descriptor, i40e only */
struct igb_ring_desc_32_bytes *ring =
int diag;
struct rte_eth_dev_info dev_info;
uint8_t hash_key_size;
+ int ret;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
- rte_eth_dev_info_get(port_id, &dev_info);
+ ret = eth_dev_info_get_print_err(port_id, &dev_info);
+ if (ret != 0)
+ return;
+
if (dev_info.hash_key_size > 0 &&
dev_info.hash_key_size <= sizeof(rss_key))
hash_key_size = dev_info.hash_key_size;
{
struct rte_eth_dev_info dev_info;
uint16_t queue;
+ int ret;
if (port_id_is_invalid(portid, ENABLED_WARN))
return;
- rte_eth_dev_info_get(portid, &dev_info);
+ ret = eth_dev_info_get_print_err(portid, &dev_info);
+ if (ret != 0)
+ return;
+
for (queue = 0; queue < dev_info.nb_rx_queues; queue++)
if (!ports[portid].rx_dump_cb[queue])
ports[portid].rx_dump_cb[queue] =
{
struct rte_eth_dev_info dev_info;
uint16_t queue;
+ int ret;
if (port_id_is_invalid(portid, ENABLED_WARN))
return;
- rte_eth_dev_info_get(portid, &dev_info);
+
+ ret = eth_dev_info_get_print_err(portid, &dev_info);
+ if (ret != 0)
+ return;
+
for (queue = 0; queue < dev_info.nb_tx_queues; queue++)
if (!ports[portid].tx_dump_cb[queue])
ports[portid].tx_dump_cb[queue] =
{
struct rte_eth_dev_info dev_info;
uint16_t queue;
+ int ret;
if (port_id_is_invalid(portid, ENABLED_WARN))
return;
- rte_eth_dev_info_get(portid, &dev_info);
+
+ ret = eth_dev_info_get_print_err(portid, &dev_info);
+ if (ret != 0)
+ return;
+
for (queue = 0; queue < dev_info.nb_rx_queues; queue++)
if (ports[portid].rx_dump_cb[queue]) {
rte_eth_remove_rx_callback(portid, queue,
{
struct rte_eth_dev_info dev_info;
uint16_t queue;
+ int ret;
if (port_id_is_invalid(portid, ENABLED_WARN))
return;
- rte_eth_dev_info_get(portid, &dev_info);
+
+ ret = eth_dev_info_get_print_err(portid, &dev_info);
+ if (ret != 0)
+ return;
+
for (queue = 0; queue < dev_info.nb_tx_queues; queue++)
if (ports[portid].tx_dump_cb[queue]) {
rte_eth_remove_tx_callback(portid, queue,
tx_vlan_set(portid_t port_id, uint16_t vlan_id)
{
struct rte_eth_dev_info dev_info;
+ int ret;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
printf("Error, as QinQ has been enabled.\n");
return;
}
- rte_eth_dev_info_get(port_id, &dev_info);
+
+ ret = eth_dev_info_get_print_err(port_id, &dev_info);
+ if (ret != 0)
+ return;
+
if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) {
printf("Error: vlan insert is not supported by port %d\n",
port_id);
tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer)
{
struct rte_eth_dev_info dev_info;
+ int ret;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
if (vlan_id_is_invalid(vlan_id_outer))
return;
- rte_eth_dev_info_get(port_id, &dev_info);
+ ret = eth_dev_info_get_print_err(port_id, &dev_info);
+ if (ret != 0)
+ return;
+
if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) {
printf("Error: qinq insert not supported by port %d\n",
port_id);
{
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);