diff mbox series

[21/35] net/ionic: add support for mbuf fast free

Message ID 20221007174336.54354-22-andrew.boyer@amd.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series net/ionic: updates for 22.11 release | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Boyer, Andrew Oct. 7, 2022, 5:43 p.m. UTC
Use a put() rather than a free() in the optimized case.

Signed-off-by: Andrew Boyer <andrew.boyer@amd.com>
---
 doc/guides/nics/features/ionic.ini     | 1 +
 doc/guides/rel_notes/release_22_11.rst | 1 +
 drivers/net/ionic/ionic_ethdev.c       | 2 +-
 drivers/net/ionic/ionic_lif.h          | 1 +
 drivers/net/ionic/ionic_rxtx.c         | 9 ++++++++-
 5 files changed, 12 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/doc/guides/nics/features/ionic.ini b/doc/guides/nics/features/ionic.ini
index 5bd18e39e9..77947bfd22 100644
--- a/doc/guides/nics/features/ionic.ini
+++ b/doc/guides/nics/features/ionic.ini
@@ -7,6 +7,7 @@ 
 Speed capabilities   = Y
 Link status          = Y
 Link status event    = Y
+Fast mbuf free       = Y
 Queue start/stop     = Y
 MTU update           = Y
 Scattered Rx         = Y
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index d7eced510e..0c962f9637 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -84,6 +84,7 @@  New Features
 
   * Updated to reflect that Pensando has been acquired by AMD.
   * Enhanced data path to provide substantial performance improvements.
+  * Added support for mbuf fast free.
 
 Removed Items
 -------------
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 186cde8330..38241d41ec 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -396,7 +396,7 @@  ionic_dev_info_get(struct rte_eth_dev *eth_dev,
 	 */
 
 	dev_info->rx_queue_offload_capa = 0;
-	dev_info->tx_queue_offload_capa = 0;
+	dev_info->tx_queue_offload_capa = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 
 	/*
 	 * Per-port capabilities
diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h
index b0bd721b06..4fb1f213ff 100644
--- a/drivers/net/ionic/ionic_lif.h
+++ b/drivers/net/ionic/ionic_lif.h
@@ -50,6 +50,7 @@  struct ionic_rx_stats {
 #define IONIC_QCQ_F_CSUM_L3	BIT(7)
 #define IONIC_QCQ_F_CSUM_UDP	BIT(8)
 #define IONIC_QCQ_F_CSUM_TCP	BIT(9)
+#define IONIC_QCQ_F_FAST_FREE	BIT(10)
 
 /* Queue / Completion Queue */
 struct ionic_qcq {
diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c
index 53b0add228..30f7ce9fc6 100644
--- a/drivers/net/ionic/ionic_rxtx.c
+++ b/drivers/net/ionic/ionic_rxtx.c
@@ -94,6 +94,8 @@  ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 
 	qinfo->nb_desc = q->num_descs;
 	qinfo->conf.offloads = dev->data->dev_conf.txmode.offloads;
+	if (txq->flags & IONIC_QCQ_F_FAST_FREE)
+		qinfo->conf.offloads |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 	qinfo->conf.tx_deferred_start = txq->flags & IONIC_QCQ_F_DEFERRED;
 }
 
@@ -136,7 +138,10 @@  ionic_tx_flush(struct ionic_tx_qcq *txq)
 				if (!txm)
 					break;
 
-				rte_pktmbuf_free_seg(txm);
+				if (txq->flags & IONIC_QCQ_F_FAST_FREE)
+					rte_mempool_put(txm->pool, txm);
+				else
+					rte_pktmbuf_free_seg(txm);
 
 				info[i] = NULL;
 			}
@@ -240,6 +245,8 @@  ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
 		txq->flags |= IONIC_QCQ_F_CSUM_TCP;
 	if (offloads & RTE_ETH_TX_OFFLOAD_UDP_CKSUM)
 		txq->flags |= IONIC_QCQ_F_CSUM_UDP;
+	if (offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)
+		txq->flags |= IONIC_QCQ_F_FAST_FREE;
 
 	eth_dev->data->tx_queues[tx_queue_id] = txq;