[dpdk-dev,v3,13/39] examples/ip_pipeline: convert to new ethdev offloads API

Message ID c7e20b4fae6f5434709f93d8985f15a90971e759.1514280004.git.shahafs@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Shahaf Shuler Dec. 26, 2017, 9:23 a.m. UTC
  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>
---
 examples/ip_pipeline/config_parse.c | 13 +++----------
 examples/ip_pipeline/init.c         | 15 +++++++++++----
 2 files changed, 14 insertions(+), 14 deletions(-)
  

Patch

diff --git a/examples/ip_pipeline/config_parse.c b/examples/ip_pipeline/config_parse.c
index 3211c6ab7..835541229 100644
--- a/examples/ip_pipeline/config_parse.c
+++ b/examples/ip_pipeline/config_parse.c
@@ -97,14 +97,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 */
@@ -158,8 +152,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,
 	}
 };
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index e56e40482..84017ddf9 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -876,10 +876,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;
 		}
 	}
 }
@@ -962,6 +962,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;
 
@@ -978,6 +979,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,
@@ -1019,6 +1024,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,
@@ -1060,6 +1066,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,