aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@suse.com>2015-04-21 16:09:45 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-23 14:28:14 -0400
commite4b6c30375e83b92d9c3e9b9d853417e8cc74006 (patch)
tree19457310c8442be5a747da77c588c8e3cc7baf69
parent2fb42aab48762fb1d5e21fbb40acad0f2650b9b4 (diff)
ethernet: myri10ge: use arch_phys_wc_add()
This driver already uses ioremap_wc() on the same range so when write-combining is available that will be used instead. Cc: Hyong-Youb Kim <hykim@myri.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Suresh Siddha <sbsiddha@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Juergen Gross <jgross@suse.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: netdev@vger.kernel.org Cc: Juergen Gross <jgross@suse.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Dave Airlie <airlied@redhat.com> Cc: Antonino Daplas <adaplas@gmail.com> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: linux-kernel@vger.kernel.org Cc: netdev@vger.kernel.org Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/myricom/myri10ge/myri10ge.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 1412f5af05ec..2bae50292dcd 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -69,11 +69,7 @@
69#include <net/ip.h> 69#include <net/ip.h>
70#include <net/tcp.h> 70#include <net/tcp.h>
71#include <asm/byteorder.h> 71#include <asm/byteorder.h>
72#include <asm/io.h>
73#include <asm/processor.h> 72#include <asm/processor.h>
74#ifdef CONFIG_MTRR
75#include <asm/mtrr.h>
76#endif
77#include <net/busy_poll.h> 73#include <net/busy_poll.h>
78 74
79#include "myri10ge_mcp.h" 75#include "myri10ge_mcp.h"
@@ -242,8 +238,7 @@ struct myri10ge_priv {
242 unsigned int rdma_tags_available; 238 unsigned int rdma_tags_available;
243 int intr_coal_delay; 239 int intr_coal_delay;
244 __be32 __iomem *intr_coal_delay_ptr; 240 __be32 __iomem *intr_coal_delay_ptr;
245 int mtrr; 241 int wc_cookie;
246 int wc_enabled;
247 int down_cnt; 242 int down_cnt;
248 wait_queue_head_t down_wq; 243 wait_queue_head_t down_wq;
249 struct work_struct watchdog_work; 244 struct work_struct watchdog_work;
@@ -1905,7 +1900,7 @@ static const char myri10ge_gstrings_main_stats[][ETH_GSTRING_LEN] = {
1905 "tx_aborted_errors", "tx_carrier_errors", "tx_fifo_errors", 1900 "tx_aborted_errors", "tx_carrier_errors", "tx_fifo_errors",
1906 "tx_heartbeat_errors", "tx_window_errors", 1901 "tx_heartbeat_errors", "tx_window_errors",
1907 /* device-specific stats */ 1902 /* device-specific stats */
1908 "tx_boundary", "WC", "irq", "MSI", "MSIX", 1903 "tx_boundary", "irq", "MSI", "MSIX",
1909 "read_dma_bw_MBs", "write_dma_bw_MBs", "read_write_dma_bw_MBs", 1904 "read_dma_bw_MBs", "write_dma_bw_MBs", "read_write_dma_bw_MBs",
1910 "serial_number", "watchdog_resets", 1905 "serial_number", "watchdog_resets",
1911#ifdef CONFIG_MYRI10GE_DCA 1906#ifdef CONFIG_MYRI10GE_DCA
@@ -1984,7 +1979,6 @@ myri10ge_get_ethtool_stats(struct net_device *netdev,
1984 data[i] = ((u64 *)&link_stats)[i]; 1979 data[i] = ((u64 *)&link_stats)[i];
1985 1980
1986 data[i++] = (unsigned int)mgp->tx_boundary; 1981 data[i++] = (unsigned int)mgp->tx_boundary;
1987 data[i++] = (unsigned int)mgp->wc_enabled;
1988 data[i++] = (unsigned int)mgp->pdev->irq; 1982 data[i++] = (unsigned int)mgp->pdev->irq;
1989 data[i++] = (unsigned int)mgp->msi_enabled; 1983 data[i++] = (unsigned int)mgp->msi_enabled;
1990 data[i++] = (unsigned int)mgp->msix_enabled; 1984 data[i++] = (unsigned int)mgp->msix_enabled;
@@ -4040,14 +4034,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
4040 4034
4041 mgp->board_span = pci_resource_len(pdev, 0); 4035 mgp->board_span = pci_resource_len(pdev, 0);
4042 mgp->iomem_base = pci_resource_start(pdev, 0); 4036 mgp->iomem_base = pci_resource_start(pdev, 0);
4043 mgp->mtrr = -1; 4037 mgp->wc_cookie = arch_phys_wc_add(mgp->iomem_base, mgp->board_span);
4044 mgp->wc_enabled = 0;
4045#ifdef CONFIG_MTRR
4046 mgp->mtrr = mtrr_add(mgp->iomem_base, mgp->board_span,
4047 MTRR_TYPE_WRCOMB, 1);
4048 if (mgp->mtrr >= 0)
4049 mgp->wc_enabled = 1;
4050#endif
4051 mgp->sram = ioremap_wc(mgp->iomem_base, mgp->board_span); 4038 mgp->sram = ioremap_wc(mgp->iomem_base, mgp->board_span);
4052 if (mgp->sram == NULL) { 4039 if (mgp->sram == NULL) {
4053 dev_err(&pdev->dev, "ioremap failed for %ld bytes at 0x%lx\n", 4040 dev_err(&pdev->dev, "ioremap failed for %ld bytes at 0x%lx\n",
@@ -4146,14 +4133,14 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
4146 goto abort_with_state; 4133 goto abort_with_state;
4147 } 4134 }
4148 if (mgp->msix_enabled) 4135 if (mgp->msix_enabled)
4149 dev_info(dev, "%d MSI-X IRQs, tx bndry %d, fw %s, WC %s\n", 4136 dev_info(dev, "%d MSI-X IRQs, tx bndry %d, fw %s, MTRR %s, WC Enabled\n",
4150 mgp->num_slices, mgp->tx_boundary, mgp->fw_name, 4137 mgp->num_slices, mgp->tx_boundary, mgp->fw_name,
4151 (mgp->wc_enabled ? "Enabled" : "Disabled")); 4138 (mgp->wc_cookie > 0 ? "Enabled" : "Disabled"));
4152 else 4139 else
4153 dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n", 4140 dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, MTRR %s, WC Enabled\n",
4154 mgp->msi_enabled ? "MSI" : "xPIC", 4141 mgp->msi_enabled ? "MSI" : "xPIC",
4155 pdev->irq, mgp->tx_boundary, mgp->fw_name, 4142 pdev->irq, mgp->tx_boundary, mgp->fw_name,
4156 (mgp->wc_enabled ? "Enabled" : "Disabled")); 4143 (mgp->wc_cookie > 0 ? "Enabled" : "Disabled"));
4157 4144
4158 board_number++; 4145 board_number++;
4159 return 0; 4146 return 0;
@@ -4175,10 +4162,7 @@ abort_with_ioremap:
4175 iounmap(mgp->sram); 4162 iounmap(mgp->sram);
4176 4163
4177abort_with_mtrr: 4164abort_with_mtrr:
4178#ifdef CONFIG_MTRR 4165 arch_phys_wc_del(mgp->wc_cookie);
4179 if (mgp->mtrr >= 0)
4180 mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span);
4181#endif
4182 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd), 4166 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),
4183 mgp->cmd, mgp->cmd_bus); 4167 mgp->cmd, mgp->cmd_bus);
4184 4168
@@ -4220,11 +4204,7 @@ static void myri10ge_remove(struct pci_dev *pdev)
4220 pci_restore_state(pdev); 4204 pci_restore_state(pdev);
4221 4205
4222 iounmap(mgp->sram); 4206 iounmap(mgp->sram);
4223 4207 arch_phys_wc_del(mgp->wc_cookie);
4224#ifdef CONFIG_MTRR
4225 if (mgp->mtrr >= 0)
4226 mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span);
4227#endif
4228 myri10ge_free_slices(mgp); 4208 myri10ge_free_slices(mgp);
4229 kfree(mgp->msix_vectors); 4209 kfree(mgp->msix_vectors);
4230 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd), 4210 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),