examples: check status of getting ethdev info

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>
This commit is contained in:
Ivan Ilchenko 2019-09-12 17:42:29 +01:00 committed by Ferruh Yigit
parent 37fb306c16
commit 089e5ed727
34 changed files with 317 additions and 49 deletions

View 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;

View 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;

View 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;

View 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)

View 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;

View 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;

View 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)

View 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);

View 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)

View 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);

View 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);

View 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,

View 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;

View 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;

View 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;

View 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;

View 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,

View 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,

View 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)

View 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;

View 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;

View 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)

View 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;

View 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;

View 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,

View 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;

View 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;

View 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;

View 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;

View 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;

View 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,

View 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;

View 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;

View 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;