aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRobert Hancock <hancockrwd@gmail.com>2010-02-19 20:10:15 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-19 20:10:15 -0500
commit353176888386d9025062a12dcec08d49af10cf2c (patch)
tree75ebc4c4a910f8187e784d75abf5f4be159011f7 /drivers
parente4fc85600b1b4b8114354846ab9594ad354882d0 (diff)
r8169: enable 64-bit DMA by default for PCI Express devices (v2)
Currently use of 64-bit DMA is disabled in r8169 unless the user passes the use_dac module option. This is reasonable for conventional PCI devices where broken chipsets may not handle dual-address-cycle transfers properly for 32-bit slots and so this may not be safe. However, PCI Express should not have this problem and not using 64-bit DMA results in DMA transfers needlessly using the IOMMU or SWIOTLB. Set the use_dac module parameter to a new default value of -1 which results in 64-bit DMA being enabled by default for PCI Express devices only. Signed-off-by: Robert Hancock <hancockrwd@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/r8169.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 616ae5aa66aa..83965eeba456 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -187,7 +187,7 @@ static DEFINE_PCI_DEVICE_TABLE(rtl8169_pci_tbl) = {
187MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); 187MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl);
188 188
189static int rx_copybreak = 200; 189static int rx_copybreak = 200;
190static int use_dac; 190static int use_dac = -1;
191static struct { 191static struct {
192 u32 msg_enable; 192 u32 msg_enable;
193} debug = { -1 }; 193} debug = { -1 };
@@ -511,7 +511,8 @@ MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver");
511module_param(rx_copybreak, int, 0); 511module_param(rx_copybreak, int, 0);
512MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); 512MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames");
513module_param(use_dac, int, 0); 513module_param(use_dac, int, 0);
514MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); 514MODULE_PARM_DESC(use_dac, "Enable PCI DAC. -1 defaults on for PCI Express only."
515" Unsafe on 32 bit PCI slot.");
515module_param_named(debug, debug.msg_enable, int, 0); 516module_param_named(debug, debug.msg_enable, int, 0);
516MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); 517MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)");
517MODULE_LICENSE("GPL"); 518MODULE_LICENSE("GPL");
@@ -2973,6 +2974,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2973 void __iomem *ioaddr; 2974 void __iomem *ioaddr;
2974 unsigned int i; 2975 unsigned int i;
2975 int rc; 2976 int rc;
2977 int this_use_dac = use_dac;
2976 2978
2977 if (netif_msg_drv(&debug)) { 2979 if (netif_msg_drv(&debug)) {
2978 printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n", 2980 printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n",
@@ -3038,8 +3040,17 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3038 3040
3039 tp->cp_cmd = PCIMulRW | RxChkSum; 3041 tp->cp_cmd = PCIMulRW | RxChkSum;
3040 3042
3043 tp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
3044 if (!tp->pcie_cap)
3045 netif_info(tp, probe, dev, "no PCI Express capability\n");
3046
3047 if (this_use_dac < 0)
3048 this_use_dac = tp->pcie_cap != 0;
3049
3041 if ((sizeof(dma_addr_t) > 4) && 3050 if ((sizeof(dma_addr_t) > 4) &&
3042 !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { 3051 this_use_dac &&
3052 !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
3053 netif_info(tp, probe, dev, "using 64-bit DMA\n");
3043 tp->cp_cmd |= PCIDAC; 3054 tp->cp_cmd |= PCIDAC;
3044 dev->features |= NETIF_F_HIGHDMA; 3055 dev->features |= NETIF_F_HIGHDMA;
3045 } else { 3056 } else {
@@ -3058,10 +3069,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3058 goto err_out_free_res_4; 3069 goto err_out_free_res_4;
3059 } 3070 }
3060 3071
3061 tp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
3062 if (!tp->pcie_cap)
3063 netif_info(tp, probe, dev, "no PCI Express capability\n");
3064
3065 RTL_W16(IntrMask, 0x0000); 3072 RTL_W16(IntrMask, 0x0000);
3066 3073
3067 /* Soft reset the chip. */ 3074 /* Soft reset the chip. */