Skip to content

Commit

Permalink
PCI: epf-mhi: Use iATU for small transfers
Browse files Browse the repository at this point in the history
For transfers below 4K, let's use iATU since using eDMA for such small
transfers is inefficient.

This is mainly because setting up an eDMA transfer and waiting for
completion adds some latency. This latency is negligible for large
transfers but not for the smaller ones.

With using iATU, there is an increase in ~50Mbps throughput on both MHI
UL (Uplink) and DL (Downlink) channels.

[kwilczynski: commit log]
Link: https://lore.kernel.org/linux-pci/[email protected]
Signed-off-by: Manivannan Sadhasivam <[email protected]>
Signed-off-by: Krzysztof Wilczyński <[email protected]>
  • Loading branch information
Mani-Sadhasivam authored and kwilczynski committed Aug 26, 2023
1 parent 8ab8a31 commit 127c66c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/pci/endpoint/functions/pci-epf-mhi.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ static int pci_epf_mhi_edma_read(struct mhi_ep_cntrl *mhi_cntrl, u64 from,
dma_addr_t dst_addr;
int ret;

if (size < SZ_4K)
return pci_epf_mhi_iatu_read(mhi_cntrl, from, to, size);

mutex_lock(&epf_mhi->lock);

config.direction = DMA_DEV_TO_MEM;
Expand Down Expand Up @@ -350,6 +353,9 @@ static int pci_epf_mhi_edma_write(struct mhi_ep_cntrl *mhi_cntrl, void *from,
dma_addr_t src_addr;
int ret;

if (size < SZ_4K)
return pci_epf_mhi_iatu_write(mhi_cntrl, from, to, size);

mutex_lock(&epf_mhi->lock);

config.direction = DMA_MEM_TO_DEV;
Expand Down

0 comments on commit 127c66c

Please sign in to comment.