[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251027004331.562345-4-den@valinux.co.jp>
Date: Mon, 27 Oct 2025 09:43:30 +0900
From: Koichiro Den <den@...inux.co.jp>
To: ntb@...ts.linux.dev,
linux-kernel@...r.kernel.org
Cc: jdmason@...zu.us,
dave.jiang@...el.com,
allenbh@...il.com
Subject: [PATCH 3/4] NTB: ntb_transport: Add module parameters use_tx_dma/use_rx_dma
Allow enabling or disabling DMA separately for TX and RX to optimize
performance depending on the environment. The existing use_dma option is
retained for backward compatibility. Setting it to 1 enables DMA for
both directions.
Signed-off-by: Koichiro Den <den@...inux.co.jp>
---
drivers/ntb/ntb_transport.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index a447eca27d0f..aee6793812bc 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -92,7 +92,15 @@ MODULE_PARM_DESC(copy_bytes, "Threshold under which NTB will use the CPU to copy
static bool use_dma;
module_param(use_dma, bool, 0644);
-MODULE_PARM_DESC(use_dma, "Use DMA engine to perform large data copy");
+MODULE_PARM_DESC(use_dma, "Use DMA engine to perform large data copy on both TX and RX");
+
+static bool use_tx_dma;
+module_param(use_tx_dma, bool, 0644);
+MODULE_PARM_DESC(use_tx_dma, "Use DMA engine to perform large data copy on TX");
+
+static bool use_rx_dma;
+module_param(use_rx_dma, bool, 0644);
+MODULE_PARM_DESC(use_rx_dma, "Use DMA engine to perform large data copy on RX");
static bool use_msi;
#ifdef CONFIG_NTB_MSI
@@ -2047,21 +2055,26 @@ ntb_transport_create_queue(void *data, struct device *client_dev,
dma_cap_set(DMA_MEMCPY, dma_mask);
if (use_dma) {
+ use_tx_dma = true;
+ use_rx_dma = true;
+ }
+ if (use_tx_dma) {
qp->tx_dma_chan =
dma_request_channel(dma_mask, ntb_dma_filter_fn,
(void *)(unsigned long)node);
if (!qp->tx_dma_chan)
dev_info(&pdev->dev, "Unable to allocate TX DMA channel\n");
+ } else
+ qp->tx_dma_chan = NULL;
+ if (use_rx_dma) {
qp->rx_dma_chan =
dma_request_channel(dma_mask, ntb_dma_filter_fn,
(void *)(unsigned long)node);
if (!qp->rx_dma_chan)
dev_info(&pdev->dev, "Unable to allocate RX DMA channel\n");
- } else {
- qp->tx_dma_chan = NULL;
+ } else
qp->rx_dma_chan = NULL;
- }
qp->tx_mw_dma_addr = 0;
if (qp->tx_dma_chan) {
--
2.48.1
Powered by blists - more mailing lists