ethdev: remove old offload API
[dpdk.git] / examples / vm_power_manager / main.c
index a50984d..8911f26 100644 (file)
@@ -33,8 +33,8 @@
 #include <rte_pmd_i40e.h>
 #include <rte_pmd_bnxt.h>
 
-#define RX_RING_SIZE 512
-#define TX_RING_SIZE 512
+#define RX_RING_SIZE 1024
+#define TX_RING_SIZE 1024
 
 #define NUM_MBUFS 8191
 #define MBUF_CACHE_SIZE 250
@@ -47,7 +47,6 @@ static volatile bool force_quit;
 static const struct rte_eth_conf port_conf_default = {
        .rxmode = {
                .max_rx_pkt_len = ETHER_MAX_LEN,
-               .ignore_offload_bitfield = 1,
        },
 };
 
@@ -61,7 +60,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
        struct rte_eth_dev_info dev_info;
        struct rte_eth_txconf txq_conf;
 
-       if (port >= rte_eth_dev_count())
+       if (!rte_eth_dev_is_valid_port(port))
                return -1;
 
        rte_eth_dev_info_get(port, &dev_info);
@@ -83,7 +82,6 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
        }
 
        txq_conf = dev_info.default_txconf;
-       txq_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE;
        txq_conf.offloads = port_conf.txmode.offloads;
        /* Allocate and set up 1 TX queue per Ethernet port. */
        for (q = 0; q < tx_rings; q++) {
@@ -176,7 +174,7 @@ parse_args(int argc, char **argv)
 }
 
 static void
-check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
+check_all_ports_link_status(uint32_t port_mask)
 {
 #define CHECK_INTERVAL 100 /* 100ms */
 #define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
@@ -189,7 +187,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
                if (force_quit)
                        return;
                all_ports_up = 1;
-               for (portid = 0; portid < port_num; portid++) {
+               RTE_ETH_FOREACH_DEV(portid) {
                        if (force_quit)
                                return;
                        if ((port_mask & (1 << portid)) == 0)
@@ -278,7 +276,7 @@ main(int argc, char **argv)
        if (ret < 0)
                rte_exit(EXIT_FAILURE, "Invalid arguments\n");
 
-       nb_ports = rte_eth_dev_count();
+       nb_ports = rte_eth_dev_count_avail();
 
        mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports,
                MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
@@ -287,10 +285,10 @@ main(int argc, char **argv)
                rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");
 
        /* Initialize ports. */
-       for (portid = 0; portid < nb_ports; portid++) {
+       RTE_ETH_FOREACH_DEV(portid) {
                struct ether_addr eth;
                int w, j;
-               int ret = -ENOTSUP;
+               int ret;
 
                if ((enabled_port_mask & (1 << portid)) == 0)
                        continue;
@@ -308,8 +306,7 @@ main(int argc, char **argv)
                for (w = 0; w < MAX_VFS; w++) {
                        eth.addr_bytes[5] = w + 0xf0;
 
-                       if (ret == -ENOTSUP)
-                               ret = rte_pmd_ixgbe_set_vf_mac_addr(portid,
+                       ret = rte_pmd_ixgbe_set_vf_mac_addr(portid,
                                                w, &eth);
                        if (ret == -ENOTSUP)
                                ret = rte_pmd_i40e_set_vf_mac_addr(portid,
@@ -340,7 +337,7 @@ main(int argc, char **argv)
                return 0;
        }
 
-       check_all_ports_link_status(nb_ports, enabled_port_mask);
+       check_all_ports_link_status(enabled_port_mask);
        rte_eal_remote_launch(run_monitor, NULL, lcore_id);
 
        if (power_manager_init() < 0) {