From 07e5f7bd65718461e4c63757248b9c7bab08341f Mon Sep 17 00:00:00 2001
From: Shahaf Shuler <shahafs@mellanox.com>
Date: Wed, 10 Jan 2018 11:09:19 +0200
Subject: [PATCH] app/testpmd: enable fast free Tx offload by default

Enable the DEV_TX_OFFLOAD_MBUF_FAST_FREE in case the underlying device
supports.

This is to preserve the previous offloads configuration made according
to the PMD defaults.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 app/test-pmd/testpmd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e73d162af8..007d6a212b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -311,7 +311,9 @@ struct rte_eth_rxmode rx_mode = {
 	.ignore_offload_bitfield = 1,
 };
 
-struct rte_eth_txmode tx_mode;
+struct rte_eth_txmode tx_mode = {
+	.offloads = DEV_TX_OFFLOAD_MBUF_FAST_FREE,
+};
 
 struct rte_fdir_conf fdir_conf = {
 	.mode = RTE_FDIR_MODE_NONE,
@@ -577,6 +579,10 @@ init_config(void)
 		port->dev_conf.txmode = tx_mode;
 		port->dev_conf.rxmode = rx_mode;
 		rte_eth_dev_info_get(pid, &port->dev_info);
+		if (!(port->dev_info.tx_offload_capa &
+		      DEV_TX_OFFLOAD_MBUF_FAST_FREE))
+			port->dev_conf.txmode.offloads &=
+				~DEV_TX_OFFLOAD_MBUF_FAST_FREE;
 
 		if (numa_support) {
 			if (port_numa[pid] != NUMA_NO_CONFIG)
-- 
2.39.5