net/sfc: check mbufs allocated using mempool API for Rx
[dpdk.git] / examples / kni / main.c
index d944bae..80c401c 100644 (file)
@@ -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);