examples/ip_pipeline: convert to new ethdev offloads API
authorShahaf Shuler <shahafs@mellanox.com>
Tue, 26 Dec 2017 09:23:12 +0000 (11:23 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jan 2018 17:47:49 +0000 (18:47 +0100)
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 <shahafs@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
examples/ip_pipeline/config_parse.c
examples/ip_pipeline/init.c

index a6a3ec7..e90499e 100644 (file)
@@ -68,14 +68,8 @@ static const struct app_link_params link_params_default = {
                .rxmode = {
                        .mq_mode = ETH_MQ_RX_NONE,
 
-                       .header_split   = 0, /* Header split */
-                       .hw_ip_checksum = 0, /* IP checksum offload */
-                       .hw_vlan_filter = 0, /* VLAN filtering */
-                       .hw_vlan_strip  = 0, /* VLAN strip */
-                       .hw_vlan_extend = 0, /* Extended VLAN */
-                       .jumbo_frame    = 0, /* Jumbo frame support */
-                       .hw_strip_crc   = 1, /* CRC strip by HW */
-                       .enable_scatter = 0, /* Scattered packets RX handler */
+                       .ignore_offload_bitfield = 1,
+                       .offloads = DEV_RX_OFFLOAD_CRC_STRIP,
 
                        .max_rx_pkt_len = 9000, /* Jumbo frame max packet len */
                        .split_hdr_size = 0, /* Header split buffer size */
@@ -129,8 +123,7 @@ static const struct app_pktq_hwq_out_params default_hwq_out_params = {
                },
                .tx_rs_thresh = 0,
                .tx_free_thresh = 0,
-               .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
-                       ETH_TXQ_FLAGS_NOOFFLOADS,
+               .txq_flags = ETH_TXQ_FLAGS_IGNORE,
                .tx_deferred_start = 0,
        }
 };
index 1391655..55d246f 100644 (file)
@@ -847,10 +847,10 @@ app_init_link_frag_ras(struct app_params *app)
        uint32_t i;
 
        if (is_any_swq_frag_or_ras(app)) {
-               for (i = 0; i < app->n_pktq_hwq_out; i++) {
-                       struct app_pktq_hwq_out_params *p_txq = &app->hwq_out_params[i];
-
-                       p_txq->conf.txq_flags &= ~ETH_TXQ_FLAGS_NOMULTSEGS;
+               for (i = 0; i < app->n_links; i++) {
+                       struct app_link_params *p_link = &app->link_params[i];
+                               p_link->conf.txmode.offloads |=
+                                               DEV_TX_OFFLOAD_MULTI_SEGS;
                }
        }
 }
@@ -933,6 +933,7 @@ app_init_link(struct app_params *app)
 
        for (i = 0; i < app->n_links; i++) {
                struct app_link_params *p_link = &app->link_params[i];
+               struct rte_eth_dev_info dev_info;
                uint32_t link_id, n_hwq_in, n_hwq_out, j;
                int status;
 
@@ -949,6 +950,10 @@ app_init_link(struct app_params *app)
                        n_hwq_out);
 
                /* LINK */
+               rte_eth_dev_info_get(p_link->pmd_id, &dev_info);
+               if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
+                       p_link->conf.txmode.offloads |=
+                               DEV_TX_OFFLOAD_MBUF_FAST_FREE;
                status = rte_eth_dev_configure(
                        p_link->pmd_id,
                        n_hwq_in,
@@ -990,6 +995,7 @@ app_init_link(struct app_params *app)
                                        p_rxq->name,
                                        status);
 
+                       p_rxq->conf.offloads = p_link->conf.rxmode.offloads;
                        status = rte_eth_rx_queue_setup(
                                p_link->pmd_id,
                                rxq_queue_id,
@@ -1031,6 +1037,7 @@ app_init_link(struct app_params *app)
                                        p_txq->name,
                                        status);
 
+                       p_txq->conf.offloads = p_link->conf.txmode.offloads;
                        status = rte_eth_tx_queue_setup(
                                p_link->pmd_id,
                                txq_queue_id,