examples: check status of getting ethdev info
authorIvan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Thu, 12 Sep 2019 16:42:29 +0000 (17:42 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 7 Oct 2019 12:45:35 +0000 (14:45 +0200)
rte_eth_dev_info_get() return value was changed from void to
int, so this patch modify rte_eth_dev_info_get() usage across
examples according to its new return type.

Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
34 files changed:
examples/bond/main.c
examples/distributor/main.c
examples/ethtool/ethtool-app/main.c
examples/ethtool/lib/rte_ethtool.c
examples/eventdev_pipeline/main.c
examples/exception_path/main.c
examples/ip_fragmentation/main.c
examples/ip_pipeline/kni.c
examples/ip_pipeline/link.c
examples/ip_reassembly/main.c
examples/ipv4_multicast/main.c
examples/kni/main.c
examples/l2fwd-crypto/main.c
examples/l2fwd-jobstats/main.c
examples/l2fwd-keepalive/main.c
examples/l2fwd/main.c
examples/l3fwd-acl/main.c
examples/l3fwd-power/main.c
examples/l3fwd/main.c
examples/link_status_interrupt/main.c
examples/load_balancer/init.c
examples/multi_process/symmetric_mp/main.c
examples/netmap_compat/lib/compat_netmap.c
examples/packet_ordering/main.c
examples/performance-thread/l3fwd-thread/main.c
examples/ptpclient/ptpclient.c
examples/qos_meter/main.c
examples/rxtx_callbacks/main.c
examples/server_node_efd/server/init.c
examples/skeleton/basicfwd.c
examples/tep_termination/vxlan_setup.c
examples/vm_power_manager/main.c
examples/vmdq/main.c
examples/vmdq_dcb/main.c

index 1c0df9d..be62c17 100644 (file)
@@ -148,7 +148,12 @@ slave_port_init(uint16_t portid, struct rte_mempool *mbuf_pool)
        if (!rte_eth_dev_is_valid_port(portid))
                rte_exit(EXIT_FAILURE, "Invalid port\n");
 
-       rte_eth_dev_info_get(portid, &dev_info);
+       retval = rte_eth_dev_info_get(portid, &dev_info);
+       if (retval != 0)
+               rte_exit(EXIT_FAILURE,
+                       "Error during getting device (port %u) info: %s\n",
+                       portid, strerror(-retval));
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                local_port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
@@ -230,7 +235,12 @@ bond_port_init(struct rte_mempool *mbuf_pool)
 
        BOND_PORT = retval;
 
-       rte_eth_dev_info_get(BOND_PORT, &dev_info);
+       retval = rte_eth_dev_info_get(BOND_PORT, &dev_info);
+       if (retval != 0)
+               rte_exit(EXIT_FAILURE,
+                       "Error during getting device (port %u) info: %s\n",
+                       BOND_PORT, strerror(-retval));
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                local_port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 81d7ca6..8942f36 100644 (file)
@@ -120,7 +120,13 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
        if (!rte_eth_dev_is_valid_port(port))
                return -1;
 
-       rte_eth_dev_info_get(port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port, strerror(-retval));
+               return retval;
+       }
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 3d2a70d..774df7e 100644 (file)
@@ -95,6 +95,7 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports)
        char str_name[16];
        uint16_t nb_rxd = PORT_RX_QUEUE_SIZE;
        uint16_t nb_txd = PORT_TX_QUEUE_SIZE;
+       int ret;
 
        memset(&cfg_port, 0, sizeof(cfg_port));
        cfg_port.txmode.mq_mode = ETH_MQ_TX_NONE;
@@ -102,7 +103,12 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports)
        for (idx_port = 0; idx_port < cnt_ports; idx_port++) {
                struct app_port *ptr_port = &app_cfg->ports[idx_port];
 
-               rte_eth_dev_info_get(idx_port, &dev_info);
+               ret = rte_eth_dev_info_get(idx_port, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               idx_port, strerror(-ret));
+
                size_pktpool = dev_info.rx_desc_lim.nb_max +
                        dev_info.tx_desc_lim.nb_max + PKTPOOL_EXTRA_SIZE;
 
index fd1692d..43cacc0 100644 (file)
@@ -41,7 +41,13 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
                printf("Insufficient fw version buffer size, "
                       "the minimum size should be %d\n", ret);
 
-       rte_eth_dev_info_get(port_id, &dev_info);
+       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));
+
+               return ret;
+       }
 
        strlcpy(drvinfo->driver, dev_info.driver_name,
                sizeof(drvinfo->driver));
@@ -370,8 +376,12 @@ rte_ethtool_net_set_rx_mode(uint16_t port_id)
        uint16_t num_vfs;
        struct rte_eth_dev_info dev_info;
        uint16_t vf;
+       int ret;
+
+       ret = rte_eth_dev_info_get(port_id, &dev_info);
+       if (ret != 0)
+               return ret;
 
-       rte_eth_dev_info_get(port_id, &dev_info);
        num_vfs = dev_info.max_vfs;
 
        /* Set VF vf_rx_mode, VF unsupport status is discard */
@@ -397,11 +407,14 @@ rte_ethtool_get_ringparam(uint16_t port_id,
        struct rte_eth_rxq_info rx_qinfo;
        struct rte_eth_txq_info tx_qinfo;
        int stat;
+       int ret;
 
        if (ring_param == NULL)
                return -EINVAL;
 
-       rte_eth_dev_info_get(port_id, &dev_info);
+       ret = rte_eth_dev_info_get(port_id, &dev_info);
+       if (ret != 0)
+               return ret;
 
        stat = rte_eth_rx_queue_info_get(port_id, 0, &rx_qinfo);
        if (stat != 0)
index f4e57f5..3789fbf 100644 (file)
@@ -274,7 +274,13 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
        if (!rte_eth_dev_is_valid_port(port))
                return -1;
 
-       rte_eth_dev_info_get(port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port, strerror(-retval));
+               return retval;
+       }
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 0d79e5a..d7f3598 100644 (file)
@@ -432,7 +432,12 @@ init_port(uint16_t port)
        /* Initialise device and RX/TX queues */
        PRINT_INFO("Initialising port %u ...", port);
        fflush(stdout);
-       rte_eth_dev_info_get(port, &dev_info);
+
+       ret = rte_eth_dev_info_get(port, &dev_info);
+       if (ret != 0)
+               FATAL_ERROR("Error during getting device (port %u) info: %s\n",
+                       port, strerror(-ret));
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                local_port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 324d607..6b83244 100644 (file)
@@ -903,7 +903,12 @@ main(int argc, char **argv)
                qconf = &lcore_queue_conf[rx_lcore_id];
 
                /* limit the frame size to the maximum supported by NIC */
-               rte_eth_dev_info_get(portid, &dev_info);
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                local_port_conf.rxmode.max_rx_pkt_len = RTE_MIN(
                    dev_info.max_rx_pktlen,
                    local_port_conf.rxmode.max_rx_pkt_len);
@@ -984,7 +989,12 @@ main(int argc, char **argv)
                printf("\n");
 
                /* init one TX queue per couple (lcore,port) */
-               rte_eth_dev_info_get(portid, &dev_info);
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                queueid = 0;
                for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
                        if (rte_lcore_is_enabled(lcore_id) == 0)
index e9262e0..4519685 100644 (file)
@@ -109,6 +109,7 @@ kni_create(const char *name, struct kni_params *params)
        struct rte_kni *k;
        const struct rte_pci_device *pci_dev;
        const struct rte_bus *bus = NULL;
+       int ret;
 
        /* Check input params */
        if ((name == NULL) ||
@@ -123,7 +124,9 @@ kni_create(const char *name, struct kni_params *params)
                return NULL;
 
        /* Resource create */
-       rte_eth_dev_info_get(link->port_id, &dev_info);
+       ret = rte_eth_dev_info_get(link->port_id, &dev_info);
+       if (ret != 0)
+               return NULL;
 
        memset(&kni_conf, 0, sizeof(kni_conf));
        strlcpy(kni_conf.name, name, RTE_KNI_NAMESIZE);
index 787eb86..4e3a40b 100644 (file)
@@ -129,7 +129,8 @@ link_create(const char *name, struct link_params *params)
                if (!rte_eth_dev_is_valid_port(port_id))
                        return NULL;
 
-       rte_eth_dev_info_get(port_id, &port_info);
+       if (rte_eth_dev_info_get(port_id, &port_info) != 0)
+               return NULL;
 
        mempool = mempool_find(params->rx.mempool_name);
        if (mempool == NULL)
index 38b39be..87d4b5c 100644 (file)
@@ -1038,7 +1038,12 @@ main(int argc, char **argv)
                qconf = &lcore_queue_conf[rx_lcore_id];
 
                /* limit the frame size to the maximum supported by NIC */
-               rte_eth_dev_info_get(portid, &dev_info);
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                local_port_conf.rxmode.max_rx_pkt_len = RTE_MIN(
                    dev_info.max_rx_pktlen,
                    local_port_conf.rxmode.max_rx_pkt_len);
index 72eaadc..1ee3b61 100644 (file)
@@ -686,7 +686,12 @@ main(int argc, char **argv)
                qconf = &lcore_queue_conf[rx_lcore_id];
 
                /* limit the frame size to the maximum supported by NIC */
-               rte_eth_dev_info_get(portid, &dev_info);
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                local_port_conf.rxmode.max_rx_pkt_len = RTE_MIN(
                    dev_info.max_rx_pktlen,
                    local_port_conf.rxmode.max_rx_pkt_len);
index 17f695e..e43f174 100644 (file)
@@ -595,7 +595,13 @@ init_port(uint16_t port)
        /* Initialise device and RX/TX queues */
        RTE_LOG(INFO, APP, "Initialising port %u ...\n", (unsigned)port);
        fflush(stdout);
-       rte_eth_dev_info_get(port, &dev_info);
+
+       ret = rte_eth_dev_info_get(port, &dev_info);
+       if (ret != 0)
+               rte_exit(EXIT_FAILURE,
+                       "Error during getting device (port %u) info: %s\n",
+                       port, strerror(-ret));
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                local_port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
@@ -780,7 +786,15 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
                                "for port%u (%d)\n", (unsigned int)port_id,
                                ret);
 
-       rte_eth_dev_info_get(port_id, &dev_info);
+       ret = rte_eth_dev_info_get(port_id, &dev_info);
+       if (ret != 0) {
+               RTE_LOG(ERR, APP,
+                       "Error during getting device (port %u) info: %s\n",
+                       port_id, strerror(-ret));
+
+               return ret;
+       }
+
        rxq_conf = dev_info.default_rxconf;
        rxq_conf.offloads = conf.rxmode.offloads;
        ret = rte_eth_rx_queue_setup(port_id, 0, nb_rxd,
@@ -869,6 +883,7 @@ kni_alloc(uint16_t port_id)
        struct rte_kni *kni;
        struct rte_kni_conf conf;
        struct kni_port_params **params = kni_port_params_array;
+       int ret;
 
        if (port_id >= RTE_MAX_ETHPORTS || !params[port_id])
                return -1;
@@ -898,7 +913,11 @@ kni_alloc(uint16_t port_id)
                        struct rte_kni_ops ops;
                        struct rte_eth_dev_info dev_info;
 
-                       rte_eth_dev_info_get(port_id, &dev_info);
+                       ret = rte_eth_dev_info_get(port_id, &dev_info);
+                       if (ret != 0)
+                               rte_exit(EXIT_FAILURE,
+                                       "Error during getting device (port %u) info: %s\n",
+                                       port_id, strerror(-ret));
 
                        /* Get the interface default mac address */
                        rte_eth_macaddr_get(port_id,
index 3fe2ba7..9a370f2 100644 (file)
@@ -2513,7 +2513,14 @@ initialize_ports(struct l2fwd_crypto_options *options)
                /* init port */
                printf("Initializing port %u... ", portid);
                fflush(stdout);
-               rte_eth_dev_info_get(portid, &dev_info);
+
+               retval = rte_eth_dev_info_get(portid, &dev_info);
+               if (retval != 0) {
+                       printf("Error during getting device (port %u) info: %s\n",
+                                       portid, strerror(-retval));
+                       return retval;
+               }
+
                if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                        local_port_conf.txmode.offloads |=
                                DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 77e44dc..5fcba5c 100644 (file)
@@ -842,7 +842,13 @@ main(int argc, char **argv)
                /* init port */
                printf("Initializing port %u... ", portid);
                fflush(stdout);
-               rte_eth_dev_info_get(portid, &dev_info);
+
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                        local_port_conf.txmode.offloads |=
                                DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 9831a43..a051390 100644 (file)
@@ -634,7 +634,13 @@ main(int argc, char **argv)
                /* init port */
                printf("Initializing port %u... ", portid);
                fflush(stdout);
-               rte_eth_dev_info_get(portid, &dev_info);
+
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                        local_port_conf.txmode.offloads |=
                                DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 1e2b142..8d4c539 100644 (file)
@@ -635,7 +635,13 @@ main(int argc, char **argv)
                /* init port */
                printf("Initializing port %u... ", portid);
                fflush(stdout);
-               rte_eth_dev_info_get(portid, &dev_info);
+
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                        local_port_conf.txmode.offloads |=
                                DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 0c44df7..60531ce 100644 (file)
@@ -1924,7 +1924,13 @@ main(int argc, char **argv)
                        n_tx_queue = MAX_TX_QUEUE_PER_PORT;
                printf("Creating queues: nb_rxq=%d nb_txq=%u... ",
                        nb_rx_queue, (unsigned)n_tx_queue);
-               rte_eth_dev_info_get(portid, &dev_info);
+
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                        local_port_conf.txmode.offloads |=
                                DEV_TX_OFFLOAD_MBUF_FAST_FREE;
@@ -1994,7 +2000,12 @@ main(int argc, char **argv)
                        printf("txq=%u,%d,%d ", lcore_id, queueid, socketid);
                        fflush(stdout);
 
-                       rte_eth_dev_info_get(portid, &dev_info);
+                       ret = rte_eth_dev_info_get(portid, &dev_info);
+                       if (ret != 0)
+                               rte_exit(EXIT_FAILURE,
+                                       "Error during getting device (port %u) info: %s\n",
+                                       portid, strerror(-ret));
+
                        txconf = &dev_info.default_txconf;
                        txconf->offloads = local_port_conf.txmode.offloads;
                        ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd,
@@ -2036,7 +2047,12 @@ main(int argc, char **argv)
                        printf("rxq=%d,%d,%d ", portid, queueid, socketid);
                        fflush(stdout);
 
-                       rte_eth_dev_info_get(portid, &dev_info);
+                       ret = rte_eth_dev_info_get(portid, &dev_info);
+                       if (ret != 0)
+                               rte_exit(EXIT_FAILURE,
+                                       "Error during getting device (port %u) info: %s\n",
+                                       portid, strerror(-ret));
+
                        rxq_conf = dev_info.default_rxconf;
                        rxq_conf.offloads = port_conf.rxmode.offloads;
                        ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
index fd8d952..bfcaa46 100644 (file)
@@ -2257,7 +2257,12 @@ main(int argc, char **argv)
                printf("Initializing port %d ... ", portid );
                fflush(stdout);
 
-               rte_eth_dev_info_get(portid, &dev_info);
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                dev_rxq_num = dev_info.max_rx_queues;
                dev_txq_num = dev_info.max_tx_queues;
 
@@ -2275,7 +2280,13 @@ main(int argc, char **argv)
                /* If number of Rx queue is 0, no need to enable Rx interrupt */
                if (nb_rx_queue == 0)
                        local_port_conf.intr_conf.rxq = 0;
-               rte_eth_dev_info_get(portid, &dev_info);
+
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                        local_port_conf.txmode.offloads |=
                                DEV_TX_OFFLOAD_MBUF_FAST_FREE;
@@ -2398,7 +2409,12 @@ main(int argc, char **argv)
                        printf("rxq=%d,%d,%d ", portid, queueid, socketid);
                        fflush(stdout);
 
-                       rte_eth_dev_info_get(portid, &dev_info);
+                       ret = rte_eth_dev_info_get(portid, &dev_info);
+                       if (ret != 0)
+                               rte_exit(EXIT_FAILURE,
+                                       "Error during getting device (port %u) info: %s\n",
+                                       portid, strerror(-ret));
+
                        rxq_conf = dev_info.default_rxconf;
                        rxq_conf.offloads = port_conf.rxmode.offloads;
                        ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
index 3800bad..3294ac2 100644 (file)
@@ -874,7 +874,12 @@ main(int argc, char **argv)
                printf("Creating queues: nb_rxq=%d nb_txq=%u... ",
                        nb_rx_queue, (unsigned)n_tx_queue );
 
-               rte_eth_dev_info_get(portid, &dev_info);
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                        local_port_conf.txmode.offloads |=
                                DEV_TX_OFFLOAD_MBUF_FAST_FREE;
@@ -985,7 +990,12 @@ main(int argc, char **argv)
                        printf("rxq=%d,%d,%d ", portid, queueid, socketid);
                        fflush(stdout);
 
-                       rte_eth_dev_info_get(portid, &dev_info);
+                       ret = rte_eth_dev_info_get(portid, &dev_info);
+                       if (ret != 0)
+                               rte_exit(EXIT_FAILURE,
+                                       "Error during getting device (port %u) info: %s\n",
+                                       portid, strerror(-ret));
+
                        rxq_conf = dev_info.default_rxconf;
                        rxq_conf.offloads = port_conf.rxmode.offloads;
                        if (!per_port_pool)
index 9cd4dc7..0c3dfc6 100644 (file)
@@ -609,7 +609,13 @@ main(int argc, char **argv)
                /* init port */
                printf("Initializing port %u... ", (unsigned) portid);
                fflush(stdout);
-               rte_eth_dev_info_get(portid, &dev_info);
+
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                        local_port_conf.txmode.offloads |=
                                DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 3ab7d02..660f5a8 100644 (file)
@@ -411,7 +411,12 @@ app_init_nics(void)
 
                /* Init port */
                printf("Initializing NIC port %u ...\n", port);
-               rte_eth_dev_info_get(port, &dev_info);
+
+               ret = rte_eth_dev_info_get(port, &dev_info);
+               if (ret != 0)
+                       rte_panic("Error during getting device (port %u) info: %s\n",
+                               port, strerror(-ret));
+
                if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                        local_port_conf.txmode.offloads |=
                                DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 62771e0..9ae8efb 100644 (file)
@@ -209,7 +209,13 @@ smp_port_init(uint16_t port, struct rte_mempool *mbuf_pool,
        printf("# Initialising port %u... ", port);
        fflush(stdout);
 
-       rte_eth_dev_info_get(port, &info);
+       retval = rte_eth_dev_info_get(port, &info);
+       if (retval != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port, strerror(-retval));
+               return retval;
+       }
+
        info.default_rxconf.rx_drop_en = 1;
 
        if (info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
index 10a4379..c25cc09 100644 (file)
@@ -684,7 +684,14 @@ rte_netmap_init_port(uint16_t portid, const struct rte_netmap_port_conf *conf)
                return -EINVAL;
        }
 
-       rte_eth_dev_info_get(portid, &dev_info);
+       ret = rte_eth_dev_info_get(portid, &dev_info);
+       if (ret != 0) {
+               RTE_LOG(ERR, USER1,
+                       "Error during getting device (port %u) info: %s\n",
+                       portid, strerror(-ret));
+               return ret;
+       }
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                conf->eth_conf->txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 030e922..a99961f 100644 (file)
@@ -283,7 +283,13 @@ configure_eth_port(uint16_t port_id)
        if (!rte_eth_dev_is_valid_port(port_id))
                return -1;
 
-       rte_eth_dev_info_get(port_id, &dev_info);
+       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));
+               return ret;
+       }
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 49d9424..00f5350 100644 (file)
@@ -3559,7 +3559,13 @@ main(int argc, char **argv)
                        n_tx_queue = MAX_TX_QUEUE_PER_PORT;
                printf("Creating queues: nb_rxq=%d nb_txq=%u... ",
                        nb_rx_queue, (unsigned)n_tx_queue);
-               rte_eth_dev_info_get(portid, &dev_info);
+
+               ret = rte_eth_dev_info_get(portid, &dev_info);
+               if (ret != 0)
+                       rte_exit(EXIT_FAILURE,
+                               "Error during getting device (port %u) info: %s\n",
+                               portid, strerror(-ret));
+
                if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                        local_port_conf.txmode.offloads |=
                                DEV_TX_OFFLOAD_MBUF_FAST_FREE;
@@ -3663,7 +3669,12 @@ main(int argc, char **argv)
                        printf("rxq=%d,%d,%d ", portid, queueid, socketid);
                        fflush(stdout);
 
-                       rte_eth_dev_info_get(portid, &dev_info);
+                       ret = rte_eth_dev_info_get(portid, &dev_info);
+                       if (ret != 0)
+                               rte_exit(EXIT_FAILURE,
+                                       "Error during getting device (port %u) info: %s\n",
+                                       portid, strerror(-ret));
+
                        rxq_conf = dev_info.default_rxconf;
                        rxq_conf.offloads = port_conf.rxmode.offloads;
                        ret = rte_eth_rx_queue_setup(portid, queueid, nb_rxd,
index 31778fd..bc427a5 100644 (file)
@@ -189,7 +189,14 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
        if (!rte_eth_dev_is_valid_port(port))
                return -1;
 
-       rte_eth_dev_info_get(port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port, strerror(-retval));
+
+               return retval;
+       }
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index da7afe8..13c85e9 100644 (file)
@@ -329,7 +329,13 @@ main(int argc, char **argv)
 
        /* NIC init */
        conf = port_conf;
-       rte_eth_dev_info_get(port_rx, &dev_info);
+
+       ret = rte_eth_dev_info_get(port_rx, &dev_info);
+       if (ret != 0)
+               rte_exit(EXIT_FAILURE,
+                       "Error during getting device (port %u) info: %s\n",
+                       port_rx, strerror(-ret));
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                conf.txmode.offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE;
 
@@ -369,7 +375,13 @@ main(int argc, char **argv)
        rte_exit(EXIT_FAILURE, "Port %d TX queue setup error (%d)\n", port_rx, ret);
 
        conf = port_conf;
-       rte_eth_dev_info_get(port_tx, &dev_info);
+
+       ret = rte_eth_dev_info_get(port_tx, &dev_info);
+       if (ret != 0)
+               rte_exit(EXIT_FAILURE,
+                       "Error during getting device (port %u) info: %s\n",
+                       port_tx, strerror(-ret));
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                conf.txmode.offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE;
 
index dbcd9f4..9fd4b8e 100644 (file)
@@ -112,7 +112,14 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
        if (!rte_eth_dev_is_valid_port(port))
                return -1;
 
-       rte_eth_dev_info_get(port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port, strerror(-retval));
+
+               return retval;
+       }
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index af5a18e..773780b 100644 (file)
@@ -111,7 +111,10 @@ init_port(uint16_t port_num)
        printf("Port %u init ... ", port_num);
        fflush(stdout);
 
-       rte_eth_dev_info_get(port_num, &dev_info);
+       retval = rte_eth_dev_info_get(port_num, &dev_info);
+       if (retval != 0)
+               return retval;
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index a8a8e98..171ebde 100644 (file)
@@ -44,7 +44,13 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
        if (!rte_eth_dev_is_valid_port(port))
                return -1;
 
-       rte_eth_dev_info_get(port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port, strerror(-retval));
+               return retval;
+       }
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 9a08800..8d6514d 100644 (file)
@@ -119,7 +119,11 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 
        pconf->dst_port = udp_port;
 
-       rte_eth_dev_info_get(port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0)
+               rte_exit(EXIT_FAILURE,
+                       "Error during getting device (port %u) info: %s\n",
+                       port, strerror(-retval));
 
        if (dev_info.max_rx_queues > MAX_QUEUES) {
                rte_exit(EXIT_FAILURE,
index 54c7046..0f48ae9 100644 (file)
@@ -71,7 +71,13 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
        if (!rte_eth_dev_is_valid_port(port))
                return -1;
 
-       rte_eth_dev_info_get(port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port, strerror(-retval));
+               return retval;
+       }
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 7281ffd..91f9a99 100644 (file)
@@ -169,7 +169,13 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
         * The max pool number from dev_info will be used to validate the pool
         * number specified in cmd line
         */
-       rte_eth_dev_info_get(port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port, strerror(-retval));
+               return retval;
+       }
+
        max_nb_pools = (uint32_t)dev_info.max_vmdq_pools;
        /*
         * We allow to process part of VMDQ pools specified by num_pools in
@@ -214,7 +220,13 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
        rxRings = (uint16_t)dev_info.max_rx_queues;
        txRings = (uint16_t)dev_info.max_tx_queues;
 
-       rte_eth_dev_info_get(port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port, strerror(-retval));
+               return retval;
+       }
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;
index 3890003..2122e41 100644 (file)
@@ -202,7 +202,14 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
         * The max pool number from dev_info will be used to validate the pool
         * number specified in cmd line
         */
-       rte_eth_dev_info_get(port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port, strerror(-retval));
+
+               return retval;
+       }
+
        max_nb_pools = (uint32_t)dev_info.max_vmdq_pools;
        /*
         * We allow to process part of VMDQ pools specified by num_pools in
@@ -253,7 +260,14 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
        if (retval < 0)
                return retval;
 
-       rte_eth_dev_info_get(port, &dev_info);
+       retval = rte_eth_dev_info_get(port, &dev_info);
+       if (retval != 0) {
+               printf("Error during getting device (port %u) info: %s\n",
+                               port, strerror(-retval));
+
+               return retval;
+       }
+
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
                port_conf.txmode.offloads |=
                        DEV_TX_OFFLOAD_MBUF_FAST_FREE;