[dpdk-dev,v4,11/11] app/testpmd: enable fast free Tx offload by default

Message ID 7935c0af7767174eebd61ee01ebc0c4f64f3ab21.1515575134.git.shahafs@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Shahaf Shuler Jan. 10, 2018, 9:09 a.m. UTC
  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>
---
 app/test-pmd/testpmd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Comments

Wenzhuo Lu Jan. 15, 2018, 3:33 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler
> Sent: Wednesday, January 10, 2018 5:09 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; thomas@monjalon.net; Yigit,
> Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v4 11/11] 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>
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index c1fb387fb..d6f69f5fa 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -339,7 +339,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,
@@ -605,6 +607,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)