Commit e4b6c303 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by David S. Miller

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: default avatarLuis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2fb42aab
...@@ -69,11 +69,7 @@ ...@@ -69,11 +69,7 @@
#include <net/ip.h> #include <net/ip.h>
#include <net/tcp.h> #include <net/tcp.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/processor.h> #include <asm/processor.h>
#ifdef CONFIG_MTRR
#include <asm/mtrr.h>
#endif
#include <net/busy_poll.h> #include <net/busy_poll.h>
#include "myri10ge_mcp.h" #include "myri10ge_mcp.h"
...@@ -242,8 +238,7 @@ struct myri10ge_priv { ...@@ -242,8 +238,7 @@ struct myri10ge_priv {
unsigned int rdma_tags_available; unsigned int rdma_tags_available;
int intr_coal_delay; int intr_coal_delay;
__be32 __iomem *intr_coal_delay_ptr; __be32 __iomem *intr_coal_delay_ptr;
int mtrr; int wc_cookie;
int wc_enabled;
int down_cnt; int down_cnt;
wait_queue_head_t down_wq; wait_queue_head_t down_wq;
struct work_struct watchdog_work; struct work_struct watchdog_work;
...@@ -1905,7 +1900,7 @@ static const char myri10ge_gstrings_main_stats[][ETH_GSTRING_LEN] = { ...@@ -1905,7 +1900,7 @@ static const char myri10ge_gstrings_main_stats[][ETH_GSTRING_LEN] = {
"tx_aborted_errors", "tx_carrier_errors", "tx_fifo_errors", "tx_aborted_errors", "tx_carrier_errors", "tx_fifo_errors",
"tx_heartbeat_errors", "tx_window_errors", "tx_heartbeat_errors", "tx_window_errors",
/* device-specific stats */ /* device-specific stats */
"tx_boundary", "WC", "irq", "MSI", "MSIX", "tx_boundary", "irq", "MSI", "MSIX",
"read_dma_bw_MBs", "write_dma_bw_MBs", "read_write_dma_bw_MBs", "read_dma_bw_MBs", "write_dma_bw_MBs", "read_write_dma_bw_MBs",
"serial_number", "watchdog_resets", "serial_number", "watchdog_resets",
#ifdef CONFIG_MYRI10GE_DCA #ifdef CONFIG_MYRI10GE_DCA
...@@ -1984,7 +1979,6 @@ myri10ge_get_ethtool_stats(struct net_device *netdev, ...@@ -1984,7 +1979,6 @@ myri10ge_get_ethtool_stats(struct net_device *netdev,
data[i] = ((u64 *)&link_stats)[i]; data[i] = ((u64 *)&link_stats)[i];
data[i++] = (unsigned int)mgp->tx_boundary; data[i++] = (unsigned int)mgp->tx_boundary;
data[i++] = (unsigned int)mgp->wc_enabled;
data[i++] = (unsigned int)mgp->pdev->irq; data[i++] = (unsigned int)mgp->pdev->irq;
data[i++] = (unsigned int)mgp->msi_enabled; data[i++] = (unsigned int)mgp->msi_enabled;
data[i++] = (unsigned int)mgp->msix_enabled; 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,14 +4034,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
mgp->board_span = pci_resource_len(pdev, 0); mgp->board_span = pci_resource_len(pdev, 0);
mgp->iomem_base = pci_resource_start(pdev, 0); mgp->iomem_base = pci_resource_start(pdev, 0);
mgp->mtrr = -1; mgp->wc_cookie = arch_phys_wc_add(mgp->iomem_base, mgp->board_span);
mgp->wc_enabled = 0;
#ifdef CONFIG_MTRR
mgp->mtrr = mtrr_add(mgp->iomem_base, mgp->board_span,
MTRR_TYPE_WRCOMB, 1);
if (mgp->mtrr >= 0)
mgp->wc_enabled = 1;
#endif
mgp->sram = ioremap_wc(mgp->iomem_base, mgp->board_span); mgp->sram = ioremap_wc(mgp->iomem_base, mgp->board_span);
if (mgp->sram == NULL) { if (mgp->sram == NULL) {
dev_err(&pdev->dev, "ioremap failed for %ld bytes at 0x%lx\n", 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,14 +4133,14 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto abort_with_state; goto abort_with_state;
} }
if (mgp->msix_enabled) if (mgp->msix_enabled)
dev_info(dev, "%d MSI-X IRQs, tx bndry %d, fw %s, WC %s\n", dev_info(dev, "%d MSI-X IRQs, tx bndry %d, fw %s, MTRR %s, WC Enabled\n",
mgp->num_slices, mgp->tx_boundary, mgp->fw_name, mgp->num_slices, mgp->tx_boundary, mgp->fw_name,
(mgp->wc_enabled ? "Enabled" : "Disabled")); (mgp->wc_cookie > 0 ? "Enabled" : "Disabled"));
else else
dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n", dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, MTRR %s, WC Enabled\n",
mgp->msi_enabled ? "MSI" : "xPIC", mgp->msi_enabled ? "MSI" : "xPIC",
pdev->irq, mgp->tx_boundary, mgp->fw_name, pdev->irq, mgp->tx_boundary, mgp->fw_name,
(mgp->wc_enabled ? "Enabled" : "Disabled")); (mgp->wc_cookie > 0 ? "Enabled" : "Disabled"));
board_number++; board_number++;
return 0; return 0;
...@@ -4175,10 +4162,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -4175,10 +4162,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
iounmap(mgp->sram); iounmap(mgp->sram);
abort_with_mtrr: abort_with_mtrr:
#ifdef CONFIG_MTRR arch_phys_wc_del(mgp->wc_cookie);
if (mgp->mtrr >= 0)
mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span);
#endif
dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd), dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),
mgp->cmd, mgp->cmd_bus); mgp->cmd, mgp->cmd_bus);
...@@ -4220,11 +4204,7 @@ static void myri10ge_remove(struct pci_dev *pdev) ...@@ -4220,11 +4204,7 @@ static void myri10ge_remove(struct pci_dev *pdev)
pci_restore_state(pdev); pci_restore_state(pdev);
iounmap(mgp->sram); iounmap(mgp->sram);
arch_phys_wc_del(mgp->wc_cookie);
#ifdef CONFIG_MTRR
if (mgp->mtrr >= 0)
mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span);
#endif
myri10ge_free_slices(mgp); myri10ge_free_slices(mgp);
kfree(mgp->msix_vectors); kfree(mgp->msix_vectors);
dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd), dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment