Ethdev offloads API has changed since:

commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
commit cba7f53b717d ("ethdev: introduce Tx queue offloads API")

This commit support the new API.

Signed-off-by: Shahaf Shuler <shah...@mellanox.com>
---
 examples/packet_ordering/main.c | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c
index 3add7be..4a58e4d 100644
--- a/examples/packet_ordering/main.c
+++ b/examples/packet_ordering/main.c
@@ -64,7 +64,14 @@
 
 static struct rte_mempool *mbuf_pool;
 
-static struct rte_eth_conf port_conf_default;
+static struct rte_eth_conf port_conf_default = {
+       .rxmode = {
+               .ignore_offload_bitfield = 1,
+       },
+       .txmode = {
+               .offloads = DEV_TX_OFFLOAD_MBUF_FAST_FREE,
+       },
+};
 
 struct worker_thread_args {
        struct rte_ring *ring_in;
@@ -293,10 +300,28 @@ struct send_thread_args {
        uint16_t q;
        uint16_t nb_rxd = RX_DESC_PER_QUEUE;
        uint16_t nb_txd = TX_DESC_PER_QUEUE;
+       struct rte_eth_dev_info dev_info;
+       struct rte_eth_txconf txconf;
+       struct rte_eth_conf port_conf = port_conf_default;
 
        if (port_id > nb_ports)
                return -1;
 
+       rte_eth_dev_info_get(port_id, &dev_info);
+       if ((dev_info.rx_offload_capa & port_conf.rxmode.offloads) !=
+           port_conf.rxmode.offloads) {
+               printf("Some Rx offloads are not supported "
+                      "by port %d: requested 0x%lx supported 0x%lx\n",
+                       port_id, port_conf.rxmode.offloads,
+                       dev_info.rx_offload_capa);
+       }
+       if ((dev_info.tx_offload_capa & port_conf.txmode.offloads) !=
+           port_conf.txmode.offloads) {
+               printf("Some Tx offloads are not supported "
+                      "by port %d: requested 0x%lx supported 0x%lx\n",
+                      port_id, port_conf.txmode.offloads,
+                      dev_info.tx_offload_capa);
+       }
        ret = rte_eth_dev_configure(port_id, rxRings, txRings, 
&port_conf_default);
        if (ret != 0)
                return ret;
@@ -313,9 +338,12 @@ struct send_thread_args {
                        return ret;
        }
 
+       txconf = dev_info.default_txconf;
+       txconf.txq_flags = ETH_TXQ_FLAGS_IGNORE;
+       txconf.offloads = port_conf.txmode.offloads;
        for (q = 0; q < txRings; q++) {
                ret = rte_eth_tx_queue_setup(port_id, q, nb_txd,
-                               rte_eth_dev_socket_id(port_id), NULL);
+                               rte_eth_dev_socket_id(port_id), &txconf);
                if (ret < 0)
                        return ret;
        }
-- 
1.8.3.1

Reply via email to