Thread (29 messages) 29 messages, 4 authors, 2019-09-03

Re: [PATCH v5 12/17] net: sgi: ioc3-eth: use dma-direct for dma allocations

From: Jakub Kicinski <hidden>
Date: 2019-08-20 00:07:48
Also in: linux-doc, linux-input, linux-mips, linux-rtc, linux-serial, lkml

On Mon, 19 Aug 2019 18:31:35 +0200, Thomas Bogendoerfer wrote:
quoted hunk ↗ jump to hunk
@@ -1386,18 +1427,24 @@ static netdev_tx_t ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
 		unsigned long b2 = (data | 0x3fffUL) + 1UL;
 		unsigned long s1 = b2 - data;
 		unsigned long s2 = data + len - b2;
+		dma_addr_t d;
 
 		desc->cmd    = cpu_to_be32(len | ETXD_INTWHENDONE |
 					   ETXD_B1V | ETXD_B2V | w0);
 		desc->bufcnt = cpu_to_be32((s1 << ETXD_B1CNT_SHIFT) |
 					   (s2 << ETXD_B2CNT_SHIFT));
-		desc->p1     = cpu_to_be64(ioc3_map(skb->data, 1));
-		desc->p2     = cpu_to_be64(ioc3_map((void *)b2, 1));
+		d = dma_map_single(ip->dma_dev, skb->data, s1, DMA_TO_DEVICE);
You'll need to check the DMA address with dma_mapping_error(dev, addr),
otherwise static checkers will get upset.
+		desc->p1     = cpu_to_be64(ioc3_map(d, PCI64_ATTR_PREF));
+		d = dma_map_single(ip->dma_dev, (void *)b2, s1, DMA_TO_DEVICE);
+		desc->p2     = cpu_to_be64(ioc3_map(d, PCI64_ATTR_PREF));
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help