Skip to contentSkip to conversation

igc: Improve the DMA mapping flow

PATCH New Sasha Neftin 2 participants 2 messages Nov 5, 2019 – Nov 21, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igc: Improve the DMA mapping flow

Improve the probe flow and set both the DMA mask and the coherent to the same thing. Make the flow optimized and cleared.

---
 drivers/net/ethernet/intel/igc/igc_main.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +9 -15
index c3266645c95e..648aee679cb6 100644
@@ -4346,32 +4346,26 @@ static int igc_probe(struct pci_dev *pdev,
 	struct net_device *netdev;
 	struct igc_hw *hw;
 	const struct igc_info *ei = igc_info_tbl[ent->driver_data];
-	int err;
+	int err, pci_using_dac;
 
 	err = pci_enable_device_mem(pdev);
 	if (err)
 		return err;
 
-	err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
+	pci_using_dac = 0;
+	err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
 	if (!err) {
-		err = dma_set_coherent_mask(&pdev->dev,
-					    DMA_BIT_MASK(64));
+		pci_using_dac = 1;
 	} else {
-		err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+		err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
 		if (err) {
-			err = dma_set_coherent_mask(&pdev->dev,
-						    DMA_BIT_MASK(32));
-			if (err) {
-				dev_err(&pdev->dev, "igc: Wrong DMA config\n");
-				goto err_dma;
-			}
+			dev_err(&pdev->dev,
+				"No usable DMA configuration, aborting\n");
+			goto err_dma;
 		}
 	}
 
-	err = pci_request_selected_regions(pdev,
-					   pci_select_bars(pdev,
-							   IORESOURCE_MEM),
-					   igc_driver_name);
+	err = pci_request_mem_regions(pdev, igc_driver_name);
 	if (err)
 		goto err_pci_reg;
 
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 igc: Improve the DMA mapping flow

Quoted 6 lines

From: Intel-wired-lan <[email protected]> On Behalf Of Sasha Neftin
Sent: Tuesday, November 5, 2019 1:44 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH v1] igc: Improve the DMA mapping flow

Quoted 8 lines

Improve the probe flow and set both the DMA mask and the coherent to the same thing. Make the flow optimized and cleared.

---
 drivers/net/ethernet/intel/igc/igc_main.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)