X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fkni%2Fmain.c;h=80c401c511c59adae0a766afce34cd331a381e69;hb=f3a5fa85cfd191522baa8cc144c9d95e7e658972;hp=d944bae6923b59463ba700b87542ff8169771eeb;hpb=8728ccf37615904cf23fb8763895b05c9a3c6b0c;p=dpdk.git diff --git a/examples/kni/main.c b/examples/kni/main.c index d944bae692..80c401c511 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -94,10 +94,6 @@ static struct kni_port_params *kni_port_params_array[RTE_MAX_ETHPORTS]; /* Options for configuring ethernet port */ static struct rte_eth_conf port_conf = { - .rxmode = { - .ignore_offload_bitfield = 1, - .offloads = DEV_RX_OFFLOAD_CRC_STRIP, - }, .txmode = { .mq_mode = ETH_MQ_TX_NONE, }, @@ -607,7 +603,6 @@ init_port(uint16_t port) "port%u (%d)\n", (unsigned)port, ret); txq_conf = dev_info.default_txconf; - txq_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; txq_conf.offloads = local_port_conf.txmode.offloads; ret = rte_eth_tx_queue_setup(port, 0, nb_txd, rte_eth_dev_socket_id(port), &txq_conf); @@ -689,7 +684,7 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu) struct rte_eth_dev_info dev_info; struct rte_eth_rxconf rxq_conf; - if (port_id >= rte_eth_dev_count()) { + if (!rte_eth_dev_is_valid_port(port_id)) { RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id); return -EINVAL; } @@ -748,7 +743,7 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up) { int ret = 0; - if (port_id >= rte_eth_dev_count() || port_id >= RTE_MAX_ETHPORTS) { + if (!rte_eth_dev_is_valid_port(port_id)) { RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id); return -EINVAL; } @@ -782,7 +777,7 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]) { int ret = 0; - if (port_id >= rte_eth_dev_count() || port_id >= RTE_MAX_ETHPORTS) { + if (!rte_eth_dev_is_valid_port(port_id)) { RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id); return -EINVAL; } @@ -926,13 +921,13 @@ main(int argc, char** argv) } /* Get number of ports found in scan */ - nb_sys_ports = rte_eth_dev_count(); + nb_sys_ports = rte_eth_dev_count_avail(); if (nb_sys_ports == 0) rte_exit(EXIT_FAILURE, "No supported Ethernet device found\n"); /* Check if the configured port ID is valid */ for (i = 0; i < RTE_MAX_ETHPORTS; i++) - if (kni_port_params_array[i] && i >= nb_sys_ports) + if (kni_port_params_array[i] && !rte_eth_dev_is_valid_port(i)) rte_exit(EXIT_FAILURE, "Configured invalid " "port ID %u\n", i);