[dpdk-dev] [PATCH v6 3/4] ethdev: add mbuf fast free Tx offload

Shahaf Shuler shahafs at mellanox.com
Wed Oct 4 10:18:00 CEST 2017


PMDs which expose this offload cap supports optimization for fast release
of mbufs following successful Tx.
Such optimization requires that per queue, all mbufs come from the same
mempool and has refcnt = 1.

Signed-off-by: Shahaf Shuler <shahafs at mellanox.com>
---
 doc/guides/nics/features.rst         | 9 +++++++++
 doc/guides/nics/features/default.ini | 1 +
 lib/librte_ether/rte_ethdev.c        | 5 +++++
 lib/librte_ether/rte_ethdev.h        | 5 +++++
 4 files changed, 20 insertions(+)

diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index 17745dace..6538470ac 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst
@@ -628,6 +628,15 @@ Supports packet type parsing and returns a list of supported types.
 
 .. _nic_features_timesync:
 
+Mbuf fast free
+--------------
+
+Supports optimization for fast release of mbufs following successful Tx.
+Requires that per queue, all mbufs come from the same mempool and has refcnt = 1.
+
+* **[uses]       rte_eth_txconf,rte_eth_txmode**: ``offloads:DEV_TX_OFFLOAD_MBUF_FAST_FREE``.
+* **[provides]   rte_eth_dev_info**: ``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_MBUF_FAST_FREE``.
+
 Timesync
 --------
 
diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini
index 542430696..9a5990195 100644
--- a/doc/guides/nics/features/default.ini
+++ b/doc/guides/nics/features/default.ini
@@ -75,3 +75,4 @@ x86-64               =
 Usage doc            =
 Design doc           =
 Perf doc             =
+Mbuf fast free       =
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 856a54a8e..59756dd82 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1232,6 +1232,9 @@ rte_eth_convert_txq_flags(const uint32_t txq_flags, uint64_t *tx_offloads)
 		offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
 	if (!(txq_flags & ETH_TXQ_FLAGS_NOXSUMTCP))
 		offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
+	if ((txq_flags & ETH_TXQ_FLAGS_NOREFCOUNT) &&
+	    (txq_flags & ETH_TXQ_FLAGS_NOMULTMEMP))
+		offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE;
 
 	*tx_offloads = offloads;
 }
@@ -1254,6 +1257,8 @@ rte_eth_convert_txq_offloads(const uint64_t tx_offloads, uint32_t *txq_flags)
 		flags |= ETH_TXQ_FLAGS_NOXSUMUDP;
 	if (!(tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM))
 		flags |= ETH_TXQ_FLAGS_NOXSUMTCP;
+	if (tx_offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
+		flags |= (ETH_TXQ_FLAGS_NOREFCOUNT | ETH_TXQ_FLAGS_NOMULTMEMP);
 
 	*txq_flags = flags;
 }
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index da91f8740..78de045ed 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -991,6 +991,11 @@ struct rte_eth_conf {
  */
 #define DEV_TX_OFFLOAD_MULTI_SEGS	0x00008000
 /**< Device supports multi segment send. */
+#define DEV_TX_OFFLOAD_MBUF_FAST_FREE	0x00010000
+/**< Device supports optimization for fast release of mbufs.
+ *   When set application must guarantee that per-queue all mbufs comes from
+ *   the same mempool and has refcnt = 1.
+ */
 
 struct rte_pci_device;
 
-- 
2.12.0



More information about the dev mailing list