Browse Source

net: ethernet: ti: am65-cpsw-nuss: fix dma mask

CPSW DMA (using UDMA) on AM65x can access full
48 bits of physical address space available on
AM65x platform.

Not setting the DMA mask correctly unnecessarily
forces use of SWIOTLB for allocations above 32-bit
boundary causing performance loss.

Using bi-directional iperf TCP test, performance
measured went up from ~720 Mbits/s to ~1210 Mbits/s
(68% jump).

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Sekhar Nori 6 years ago
parent
commit
c6cbcf674c
1 changed files with 6 additions and 0 deletions
  1. 6 0
      drivers/net/ethernet/ti/am65-cpsw-nuss.c

+ 6 - 0
drivers/net/ethernet/ti/am65-cpsw-nuss.c

@@ -2064,6 +2064,12 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;
 
 
+	ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(48));
+	if (ret) {
+		dev_err(dev, "error setting dma mask: %d\n", ret);
+		goto unreg_ndev;
+	}
+
 	ret = devm_request_irq(dev, common->tx_chns[0].irq,
 	ret = devm_request_irq(dev, common->tx_chns[0].irq,
 			       am65_cpsw_nuss_tx_irq,
 			       am65_cpsw_nuss_tx_irq,
 			       0, dev_name(dev), common);
 			       0, dev_name(dev), common);