[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230317113238.142970-4-mie@igel.co.jp>
Date: Fri, 17 Mar 2023 20:32:30 +0900
From: Shunsuke Mie <mie@...l.co.jp>
To: Gustavo Pimentel <gustavo.pimentel@...opsys.com>
Cc: Vinod Koul <vkoul@...nel.org>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Manivannan Sadhasivam <mani@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Shunsuke Mie <mie@...l.co.jp>,
Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
Frank Li <Frank.Li@....com>, linux-kernel@...r.kernel.org,
dmaengine@...r.kernel.org, linux-pci@...r.kernel.org
Subject: [RFC PATCH 03/11] pci: endpoint: function/pci-epf-test: Unify a range of time measurement
This test code measures a time of data transfer. Some measurements include
print, preparation and error checking. Change to measure during data
tansfer.
Signed-off-by: Shunsuke Mie <mie@...l.co.jp>
---
drivers/pci/endpoint/functions/pci-epf-test.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 172e5ac0bd96..6955a3d2eb7e 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -356,7 +356,6 @@ static int pci_epf_test_copy(struct pci_epf_test *epf_test)
goto err_dst_addr;
}
- ktime_get_ts64(&start);
use_dma = !!(reg->flags & FLAG_USE_DMA);
if (use_dma) {
if (!epf_test->dma_supported) {
@@ -371,9 +370,11 @@ static int pci_epf_test_copy(struct pci_epf_test *epf_test)
goto err_map_addr;
}
+ ktime_get_ts64(&start);
ret = pci_epf_test_data_transfer(epf_test, dst_phys_addr,
src_phys_addr, reg->size, 0,
DMA_MEM_TO_MEM);
+ ktime_get_ts64(&end);
if (ret)
dev_err(dev, "Data transfer failed\n");
} else {
@@ -385,11 +386,13 @@ static int pci_epf_test_copy(struct pci_epf_test *epf_test)
goto err_map_addr;
}
+ ktime_get_ts64(&start);
memcpy_fromio(buf, src_addr, reg->size);
memcpy_toio(dst_addr, buf, reg->size);
+ ktime_get_ts64(&end);
kfree(buf);
}
- ktime_get_ts64(&end);
+
pci_epf_test_print_rate("COPY", reg->size, &start, &end, use_dma);
err_map_addr:
@@ -467,9 +470,9 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test)
ret = pci_epf_test_data_transfer(epf_test, dst_phys_addr,
phys_addr, reg->size,
reg->src_addr, DMA_DEV_TO_MEM);
+ ktime_get_ts64(&end);
if (ret)
dev_err(dev, "Data transfer failed\n");
- ktime_get_ts64(&end);
dma_unmap_single(dma_dev, dst_phys_addr, reg->size,
DMA_FROM_DEVICE);
@@ -556,14 +559,13 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
}
ktime_get_ts64(&start);
-
ret = pci_epf_test_data_transfer(epf_test, phys_addr,
src_phys_addr, reg->size,
reg->dst_addr,
DMA_MEM_TO_DEV);
+ ktime_get_ts64(&end);
if (ret)
dev_err(dev, "Data transfer failed\n");
- ktime_get_ts64(&end);
dma_unmap_single(dma_dev, src_phys_addr, reg->size,
DMA_TO_DEVICE);
--
2.25.1
Powered by blists - more mailing lists