ethdev: remove old offload API
[dpdk.git] / examples / server_node_efd / server / init.c
index 2b4e264..af5a18e 100644 (file)
@@ -94,14 +94,16 @@ static int
 init_port(uint16_t port_num)
 {
        /* for port configuration all features are off by default */
-       const struct rte_eth_conf port_conf = {
+       struct rte_eth_conf port_conf = {
                .rxmode = {
-                       .mq_mode = ETH_MQ_RX_RSS
-               }
+                       .mq_mode = ETH_MQ_RX_RSS,
+               },
        };
        const uint16_t rx_rings = 1, tx_rings = num_nodes;
        uint16_t rx_ring_size = RTE_MP_RX_DESC_DEFAULT;
        uint16_t tx_ring_size = RTE_MP_TX_DESC_DEFAULT;
+       struct rte_eth_dev_info dev_info;
+       struct rte_eth_txconf txconf;
 
        uint16_t q;
        int retval;
@@ -109,6 +111,11 @@ init_port(uint16_t port_num)
        printf("Port %u init ... ", port_num);
        fflush(stdout);
 
+       rte_eth_dev_info_get(port_num, &dev_info);
+       if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
+               port_conf.txmode.offloads |=
+                       DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+
        /*
         * Standard DPDK port initialisation - config port, then set up
         * rx and tx rings.
@@ -130,10 +137,12 @@ init_port(uint16_t port_num)
                        return retval;
        }
 
+       txconf = dev_info.default_txconf;
+       txconf.offloads = port_conf.txmode.offloads;
        for (q = 0; q < tx_rings; q++) {
                retval = rte_eth_tx_queue_setup(port_num, q, tx_ring_size,
                                rte_eth_dev_socket_id(port_num),
-                               NULL);
+                               &txconf);
                if (retval < 0)
                        return retval;
        }
@@ -299,7 +308,7 @@ init(int argc, char *argv[])
        argv += retval;
 
        /* get total number of ports */
-       total_ports = rte_eth_dev_count();
+       total_ports = rte_eth_dev_count_avail();
 
        /* set up array for port data */
        mz = rte_memzone_reserve(MZ_SHARED_INFO, sizeof(*info),